Remove Opencascade dependencies. Change to STL.

This commit is contained in:
jrt 2003-09-04 07:14:51 +00:00
parent b64e58d011
commit 2d46bce298
13 changed files with 970 additions and 1518 deletions

View File

@ -36,36 +36,13 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
# Libraries targets # Libraries targets
LIB = libSMESHDS.la LIB = libSMESHDS.la
LIB_SRC = SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_0.cxx \ LIB_SRC = \
SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_0.cxx \
SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis_0.cxx \
SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh_0.cxx \
SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh_0.cxx \
SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_0.cxx \
SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_0.cxx \
SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_0.cxx \
SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_0.cxx \
SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_0.cxx \
SMESHDS_DataMapOfIntegerMesh_0.cxx \
SMESHDS_DataMapOfIntegerPtrHypothesis_0.cxx \
SMESHDS_DataMapOfShapeListOfPtrHypothesis_0.cxx \
SMESHDS_DataMapOfShapeSubMesh_0.cxx \
SMESHDS_DataMapOfIntegerSubMesh_0.cxx \
SMESHDS_Document.cxx \ SMESHDS_Document.cxx \
SMESHDS_Hypothesis.cxx \ SMESHDS_Hypothesis.cxx \
SMESHDS_ListIteratorOfListOfAsciiString_0.cxx \
SMESHDS_ListIteratorOfListOfPtrHypothesis_0.cxx \
SMESHDS_ListIteratorOfListOfCommand_0.cxx \
SMESHDS_ListNodeOfListOfAsciiString_0.cxx \
SMESHDS_ListNodeOfListOfPtrHypothesis_0.cxx \
SMESHDS_ListNodeOfListOfCommand_0.cxx \
SMESHDS_ListOfAsciiString_0.cxx \
SMESHDS_ListOfPtrHypothesis_0.cxx \
SMESHDS_ListOfCommand_0.cxx \
SMESHDS_Mesh.cxx \
SMESHDS_Script.cxx \ SMESHDS_Script.cxx \
SMESHDS_Command.cxx \ SMESHDS_Command.cxx \
SMESHDS_SubMesh.cxx SMESHDS_SubMesh.cxx \
SMESHDS_Mesh.cxx
LIB_CLIENT_IDL = LIB_CLIENT_IDL =
LIB_SERVER_IDL = LIB_SERVER_IDL =
@ -77,47 +54,10 @@ BIN_CLIENT_IDL =
BIN_SERVER_IDL = BIN_SERVER_IDL =
# header files # header files
EXPORT_HEADERS= Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx \ EXPORT_HEADERS= \
Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx \
Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx \
Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx \
Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx \
Handle_SMESHDS_Document.hxx \
Handle_SMESHDS_ListNodeOfListOfAsciiString.hxx \
Handle_SMESHDS_ListNodeOfListOfPtrHypothesis.hxx \
Handle_SMESHDS_ListNodeOfListOfCommand.hxx \
Handle_SMESHDS_Mesh.hxx \
Handle_SMESHDS_Script.hxx \
Handle_SMESHDS_Command.hxx \
Handle_SMESHDS_SubMesh.hxx \
SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh.hxx \
SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis.hxx \
SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis.hxx \
SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh.hxx \
SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh.hxx \
SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx \
SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx \
SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx \
SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx \
SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx \
SMESHDS_DataMapOfIntegerMesh.hxx \
SMESHDS_DataMapOfIntegerPtrHypothesis.hxx \
SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx \
SMESHDS_DataMapOfShapeSubMesh.hxx \
SMESHDS_DataMapOfIntegerSubMesh.hxx \
SMESHDS_Document.hxx \ SMESHDS_Document.hxx \
SMESHDS_Hypothesis.hxx \ SMESHDS_Hypothesis.hxx \
SMESHDS_ListIteratorOfListOfAsciiString.hxx \
SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx \
SMESHDS_ListIteratorOfListOfCommand.hxx \
SMESHDS_ListNodeOfListOfAsciiString.hxx \
SMESHDS_ListNodeOfListOfPtrHypothesis.hxx \
SMESHDS_ListNodeOfListOfCommand.hxx \
SMESHDS_ListOfAsciiString.hxx \
SMESHDS_ListOfPtrHypothesis.hxx \
SMESHDS_ListOfCommand.hxx \
SMESHDS_Mesh.hxx \ SMESHDS_Mesh.hxx \
SMESHDS_PtrHypothesis.hxx \
SMESHDS_Script.hxx \ SMESHDS_Script.hxx \
SMESHDS_Command.hxx \ SMESHDS_Command.hxx \
SMESHDS_CommandType.hxx \ SMESHDS_CommandType.hxx \
@ -126,7 +66,7 @@ EXPORT_HEADERS= Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx \
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(OCC_LIBS) LDFLAGS += $(OCC_KERNEL_LIBS)
# additional file to be cleaned # additional file to be cleaned
@ -135,4 +75,3 @@ CLEAN =
DISTCLEAN = DISTCLEAN =
@CONCLUDE@ @CONCLUDE@

View File

@ -27,246 +27,229 @@
// $Header: // $Header:
using namespace std; using namespace std;
#include "SMESHDS_Command.ixx" #include "SMESHDS_Command.hxx"
#include "SMESHDS_CommandType.hxx"
#include "utilities.h" #include "utilities.h"
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
SMESHDS_Command::SMESHDS_Command(const SMESHDS_CommandType aType) SMESHDS_Command::SMESHDS_Command(const SMESHDS_CommandType aType):myType(aType),
: myType(aType), myNumber(0) myNumber(0)
{}
//=======================================================================
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::AddNode(const Standard_Integer NewNodeID,
const Standard_Real x,
const Standard_Real y,
const Standard_Real z)
{ {
if (!myType == SMESHDS_AddNode) {
MESSAGE("SMESHDS_Command::AddNode : Bad Type");
return;
}
myIntegers.Append(NewNodeID);
myReals.Append(x);
myReals.Append(y);
myReals.Append(z);
myNumber++;
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Command::MoveNode(const Standard_Integer NodeID, void SMESHDS_Command::AddNode(int NewNodeID, double x, double y, double z)
const Standard_Real x,
const Standard_Real y,
const Standard_Real z)
{ {
if (!myType == SMESHDS_MoveNode) { if (!myType == SMESHDS_AddNode)
MESSAGE("SMESHDS_Command::MoveNode : Bad Type"); {
return; MESSAGE("SMESHDS_Command::AddNode : Bad Type");
} return;
myIntegers.Append(NodeID); }
myReals.Append(x); myIntegers.push_back(NewNodeID);
myReals.Append(y); myReals.push_back(x);
myReals.Append(z); myReals.push_back(y);
myNumber++; myReals.push_back(z);
myNumber++;
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Command::AddEdge(const Standard_Integer NewEdgeID, void SMESHDS_Command::MoveNode(int NodeID, double x, double y, double z)
const Standard_Integer idnode1,
const Standard_Integer idnode2)
{ {
if (!myType == SMESHDS_AddEdge) { if (!myType == SMESHDS_MoveNode)
MESSAGE("SMESHDS_Command::AddEdge : Bad Type"); {
return; MESSAGE("SMESHDS_Command::MoveNode : Bad Type");
} return;
myIntegers.Append(NewEdgeID); }
myIntegers.Append(idnode1); myIntegers.push_back(NodeID);
myIntegers.Append(idnode2); myReals.push_back(x);
myNumber++; myReals.push_back(y);
myReals.push_back(z);
myNumber++;
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Command::AddFace(const Standard_Integer NewFaceID, void SMESHDS_Command::AddEdge(int NewEdgeID, int idnode1, int idnode2)
const Standard_Integer idnode1,
const Standard_Integer idnode2,
const Standard_Integer idnode3)
{ {
if (!myType == SMESHDS_AddTriangle) { if (!myType == SMESHDS_AddEdge)
MESSAGE("SMESHDS_Command::AddFace : Bad Type"); {
return; MESSAGE("SMESHDS_Command::AddEdge : Bad Type");
} return;
myIntegers.Append(NewFaceID); }
myIntegers.Append(idnode1); myIntegers.push_back(NewEdgeID);
myIntegers.Append(idnode2); myIntegers.push_back(idnode1);
myIntegers.Append(idnode3); myIntegers.push_back(idnode2);
myNumber++; myNumber++;
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Command::AddFace(const Standard_Integer NewFaceID, void SMESHDS_Command::AddFace(int NewFaceID,
const Standard_Integer idnode1, int idnode1, int idnode2, int idnode3)
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4)
{ {
if (!myType == SMESHDS_AddQuadrangle) { if (!myType == SMESHDS_AddTriangle)
MESSAGE("SMESHDS_Command::AddFace : Bad Type"); {
return; MESSAGE("SMESHDS_Command::AddFace : Bad Type");
} return;
myIntegers.Append(NewFaceID); }
myIntegers.Append(idnode1); myIntegers.push_back(NewFaceID);
myIntegers.Append(idnode2); myIntegers.push_back(idnode1);
myIntegers.Append(idnode3); myIntegers.push_back(idnode2);
myIntegers.Append(idnode4); myIntegers.push_back(idnode3);
myNumber++; myNumber++;
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Command::AddVolume(const Standard_Integer NewVolID, void SMESHDS_Command::AddFace(int NewFaceID,
const Standard_Integer idnode1, int idnode1, int idnode2, int idnode3, int idnode4)
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4)
{ {
if (!myType == SMESHDS_AddTetrahedron) { if (!myType == SMESHDS_AddQuadrangle)
MESSAGE("SMESHDS_Command::AddVolume : Bad Type"); {
return; MESSAGE("SMESHDS_Command::AddFace : Bad Type");
} return;
myIntegers.Append(NewVolID); }
myIntegers.Append(idnode1); myIntegers.push_back(NewFaceID);
myIntegers.Append(idnode2); myIntegers.push_back(idnode1);
myIntegers.Append(idnode3); myIntegers.push_back(idnode2);
myIntegers.Append(idnode4); myIntegers.push_back(idnode3);
myNumber++; myIntegers.push_back(idnode4);
myNumber++;
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Command::AddVolume(const Standard_Integer NewVolID, void SMESHDS_Command::AddVolume(int NewVolID,
const Standard_Integer idnode1, int idnode1, int idnode2, int idnode3, int idnode4)
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4,
const Standard_Integer idnode5)
{ {
if (!myType == SMESHDS_AddPyramid) { if (!myType == SMESHDS_AddTetrahedron)
MESSAGE("SMESHDS_Command::AddVolume : Bad Type"); {
return; MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
} return;
myIntegers.Append(NewVolID); }
myIntegers.Append(idnode1); myIntegers.push_back(NewVolID);
myIntegers.Append(idnode2); myIntegers.push_back(idnode1);
myIntegers.Append(idnode3); myIntegers.push_back(idnode2);
myIntegers.Append(idnode4); myIntegers.push_back(idnode3);
myIntegers.Append(idnode5); myIntegers.push_back(idnode4);
myNumber++; myNumber++;
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Command::AddVolume(const Standard_Integer NewVolID, void SMESHDS_Command::AddVolume(int NewVolID,
const Standard_Integer idnode1, int idnode1, int idnode2, int idnode3, int idnode4, int idnode5)
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4,
const Standard_Integer idnode5,
const Standard_Integer idnode6)
{ {
if (!myType == SMESHDS_AddPrism) { if (!myType == SMESHDS_AddPyramid)
MESSAGE("SMESHDS_Command::AddVolume : Bad Type"); {
return; MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
} return;
myIntegers.Append(NewVolID); }
myIntegers.Append(idnode1); myIntegers.push_back(NewVolID);
myIntegers.Append(idnode2); myIntegers.push_back(idnode1);
myIntegers.Append(idnode3); myIntegers.push_back(idnode2);
myIntegers.Append(idnode4); myIntegers.push_back(idnode3);
myIntegers.Append(idnode5); myIntegers.push_back(idnode4);
myIntegers.Append(idnode6); myIntegers.push_back(idnode5);
myNumber++; myNumber++;
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Command::AddVolume(const Standard_Integer NewVolID, void SMESHDS_Command::AddVolume(int NewVolID,
const Standard_Integer idnode1, int idnode1,
const Standard_Integer idnode2, int idnode2, int idnode3, int idnode4, int idnode5, int idnode6)
const Standard_Integer idnode3,
const Standard_Integer idnode4,
const Standard_Integer idnode5,
const Standard_Integer idnode6,
const Standard_Integer idnode7,
const Standard_Integer idnode8)
{ {
if (!myType == SMESHDS_AddHexahedron) { if (!myType == SMESHDS_AddPrism)
MESSAGE("SMESHDS_Command::AddVolume : Bad Type"); {
return; MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
} return;
myIntegers.Append(NewVolID); }
myIntegers.Append(idnode1); myIntegers.push_back(NewVolID);
myIntegers.Append(idnode2); myIntegers.push_back(idnode1);
myIntegers.Append(idnode3); myIntegers.push_back(idnode2);
myIntegers.Append(idnode4); myIntegers.push_back(idnode3);
myIntegers.Append(idnode5); myIntegers.push_back(idnode4);
myIntegers.Append(idnode6); myIntegers.push_back(idnode5);
myIntegers.Append(idnode7); myIntegers.push_back(idnode6);
myIntegers.Append(idnode8); myNumber++;
myNumber++;
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Command::RemoveNode(const Standard_Integer NodeID) void SMESHDS_Command::AddVolume(int NewVolID,
int idnode1,
int idnode2,
int idnode3,
int idnode4, int idnode5, int idnode6, int idnode7, int idnode8)
{ {
if (!myType == SMESHDS_RemoveNode) { if (!myType == SMESHDS_AddHexahedron)
MESSAGE("SMESHDS_Command::RemoveNode : Bad Type"); {
return; MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
} return;
myIntegers.Append(NodeID); }
myNumber++; myIntegers.push_back(NewVolID);
myIntegers.push_back(idnode1);
myIntegers.push_back(idnode2);
myIntegers.push_back(idnode3);
myIntegers.push_back(idnode4);
myIntegers.push_back(idnode5);
myIntegers.push_back(idnode6);
myIntegers.push_back(idnode7);
myIntegers.push_back(idnode8);
myNumber++;
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Command::RemoveElement(const Standard_Integer ElementID) void SMESHDS_Command::RemoveNode(int NodeID)
{ {
if (!myType == SMESHDS_RemoveElement) { if (!myType == SMESHDS_RemoveNode)
MESSAGE("SMESHDS_Command::RemoveElement : Bad Type"); {
return; MESSAGE("SMESHDS_Command::RemoveNode : Bad Type");
} return;
myIntegers.Append(ElementID); }
myNumber++; myIntegers.push_back(NodeID);
myNumber++;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::RemoveElement(int ElementID)
{
if (!myType == SMESHDS_RemoveElement)
{
MESSAGE("SMESHDS_Command::RemoveElement : Bad Type");
return;
}
myIntegers.push_back(ElementID);
myNumber++;
} }
//======================================================================= //=======================================================================
@ -275,32 +258,32 @@ void SMESHDS_Command::RemoveElement(const Standard_Integer ElementID)
//======================================================================= //=======================================================================
SMESHDS_CommandType SMESHDS_Command::GetType() SMESHDS_CommandType SMESHDS_Command::GetType()
{ {
return myType; return myType;
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer SMESHDS_Command::GetNumber() int SMESHDS_Command::GetNumber()
{ {
return myNumber; return myNumber;
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
const TColStd_ListOfInteger& SMESHDS_Command::GetIndexes() const list < int >&SMESHDS_Command::GetIndexes()
{ {
return myIntegers; return myIntegers;
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
const TColStd_ListOfReal& SMESHDS_Command::GetCoords() const list < double >&SMESHDS_Command::GetCoords()
{ {
return myReals; return myReals;
} }

View File

@ -27,116 +27,39 @@
#ifndef _SMESHDS_Command_HeaderFile #ifndef _SMESHDS_Command_HeaderFile
#define _SMESHDS_Command_HeaderFile #define _SMESHDS_Command_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Handle_SMESHDS_Command_HeaderFile
#include "Handle_SMESHDS_Command.hxx"
#endif
#ifndef _SMESHDS_CommandType_HeaderFile
#include "SMESHDS_CommandType.hxx" #include "SMESHDS_CommandType.hxx"
#endif #include <list>
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _TColStd_ListOfReal_HeaderFile
#include <TColStd_ListOfReal.hxx>
#endif
#ifndef _TColStd_ListOfInteger_HeaderFile
#include <TColStd_ListOfInteger.hxx>
#endif
#ifndef _MMgt_TShared_HeaderFile
#include <MMgt_TShared.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
class TColStd_ListOfInteger;
class TColStd_ListOfReal;
class SMESHDS_Command : public MMgt_TShared {
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// inline void operator delete(void *anAddress, size_t size)
// {
// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
// }
// Methods PUBLIC
//
Standard_EXPORT SMESHDS_Command(const SMESHDS_CommandType aType);
Standard_EXPORT void AddNode(const Standard_Integer NewNodeID,const Standard_Real x,const Standard_Real y,const Standard_Real z) ;
Standard_EXPORT void AddEdge(const Standard_Integer NewEdgeID,const Standard_Integer idnode1,const Standard_Integer idnode2) ;
Standard_EXPORT void AddFace(const Standard_Integer NewFaceID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ;
Standard_EXPORT void AddFace(const Standard_Integer NewFaceID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ;
Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ;
Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5) ;
Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6) ;
Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8) ;
Standard_EXPORT void MoveNode(const Standard_Integer NewNodeID,const Standard_Real x,const Standard_Real y,const Standard_Real z) ;
Standard_EXPORT void RemoveNode(const Standard_Integer NodeID) ;
Standard_EXPORT void RemoveElement(const Standard_Integer ElementID) ;
Standard_EXPORT SMESHDS_CommandType GetType() ;
Standard_EXPORT Standard_Integer GetNumber() ;
Standard_EXPORT const TColStd_ListOfInteger& GetIndexes() ;
Standard_EXPORT const TColStd_ListOfReal& GetCoords() ;
Standard_EXPORT ~SMESHDS_Command();
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& SMESHDS_Command_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
SMESHDS_CommandType myType;
Standard_Integer myNumber;
TColStd_ListOfReal myReals;
TColStd_ListOfInteger myIntegers;
class SMESHDS_Command
{
public:
SMESHDS_Command(const SMESHDS_CommandType aType);
void AddNode(int NewNodeID, double x, double y, double z);
void AddEdge(int NewEdgeID, int idnode1, int idnode2);
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3);
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3,
int idnode4);
void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
int idnode4);
void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
int idnode4, int idnode5);
void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
int idnode4, int idnode5, int idnode6);
void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
int idnode4, int idnode5, int idnode6, int idnode7, int idnode8);
void MoveNode(int NewNodeID, double x, double y, double z);
void RemoveNode(int NodeID);
void RemoveElement(int ElementID);
SMESHDS_CommandType GetType();
int GetNumber();
const list<int> & GetIndexes();
const list<double> & GetCoords();
~SMESHDS_Command();
private:
SMESHDS_CommandType myType;
int myNumber;
list<double> myReals;
list<int> myIntegers;
}; };
// other inline functions and methods (like "C++: function call" methods)
//
#endif #endif

View File

@ -27,166 +27,165 @@
// $Header: // $Header:
using namespace std; using namespace std;
#include "SMESHDS_Document.ixx" #include "SMESHDS_Document.hxx"
#include "SMESHDS_Hypothesis.hxx" #include <utilities.h>
#include <Standard_OutOfRange.hxx>
//======================================================================= //=======================================================================
//function : Create //function : Create
//purpose : //purpose :
//======================================================================= //=======================================================================
SMESHDS_Document::SMESHDS_Document(const Standard_Integer UserID): myUserID(UserID) SMESHDS_Document::SMESHDS_Document(int UserID):myUserID(UserID)
{} {
}
//======================================================================= //=======================================================================
//function : NewMesh //function : NewMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer SMESHDS_Document::NewMesh() int SMESHDS_Document::NewMesh()
{ {
static Standard_Integer NewMeshID = 0; static int NewMeshID = 0;
NewMeshID++; NewMeshID++;
Handle (SMESHDS_Mesh) aNewMesh = new SMESHDS_Mesh (NewMeshID); SMESHDS_Mesh *aNewMesh = new SMESHDS_Mesh(NewMeshID);
myMeshes.Bind(NewMeshID ,aNewMesh); myMeshes[NewMeshID] = aNewMesh;
return NewMeshID; return NewMeshID;
} }
//======================================================================= //=======================================================================
//function : GetMesh //function : GetMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
Handle(SMESHDS_Mesh) SMESHDS_Document::GetMesh(const Standard_Integer MeshID) SMESHDS_Mesh *SMESHDS_Document::GetMesh(int MeshID)
{ {
if (!myMeshes.IsBound(MeshID)) map<int,SMESHDS_Mesh*>::iterator it=myMeshes.find(MeshID);
Standard_OutOfRange::Raise("SMESHDS_Document::RemoveMesh"); if (it==myMeshes.end())
return myMeshes.Find(MeshID); {
MESSAGE("SMESHDS_Document::GetMesh : ID not found");
return NULL;
}
else return (*it).second;
} }
//======================================================================= //=======================================================================
//function : RemoveMesh //function : RemoveMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Document::RemoveMesh(const Standard_Integer MeshID) void SMESHDS_Document::RemoveMesh(int MeshID)
{ {
if (!myMeshes.IsBound(MeshID)) map<int,SMESHDS_Mesh*>::iterator it=myMeshes.find(MeshID);
Standard_OutOfRange::Raise("SMESHDS_Document::RemoveMesh"); if (it==myMeshes.end())
myMeshes.UnBind(MeshID); MESSAGE("SMESHDS_Document::RemoveMesh : ID not found");
myMeshes.erase(it);
} }
//======================================================================= //=======================================================================
//function : AddHypothesis //function : AddHypothesis
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Document::AddHypothesis(const SMESHDS_PtrHypothesis& H) void SMESHDS_Document::AddHypothesis(SMESHDS_Hypothesis * H)
{ {
myHypothesis.Bind (H->GetID(), H); myHypothesis[H->GetID()]=H;
} }
//======================================================================= //=======================================================================
//function : GetHypothesis //function : GetHypothesis
//purpose : //purpose :
//======================================================================= //=======================================================================
SMESHDS_PtrHypothesis SMESHDS_Document::GetHypothesis(const Standard_Integer HypID) SMESHDS_Hypothesis * SMESHDS_Document::GetHypothesis(int HypID)
{ {
if (!myHypothesis.IsBound(HypID)) map<int,SMESHDS_Hypothesis*>::iterator it=myHypothesis.find(HypID);
Standard_OutOfRange::Raise("SMESHDS_Document::GetHypothesis"); if (it==myHypothesis.end())
return myHypothesis.Find(HypID); {
MESSAGE("SMESHDS_Document::GetHypothesis : ID not found");
return NULL;
}
else return (*it).second;
} }
//======================================================================= //=======================================================================
//function : RemoveHypothesis //function : RemoveHypothesis
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Document::RemoveHypothesis(const Standard_Integer HypID) void SMESHDS_Document::RemoveHypothesis(int HypID)
{ {
if (!myHypothesis.IsBound(HypID)) map<int,SMESHDS_Hypothesis*>::iterator it=myHypothesis.find(HypID);
Standard_OutOfRange::Raise("SMESHDS_Document::RemoveHypothesis"); if (it==myHypothesis.end())
myMeshes.UnBind(HypID); MESSAGE("SMESHDS_Document::RemoveHypothesis : ID not found");
myHypothesis.erase(it);
} }
//======================================================================= //=======================================================================
//function : NbMeshes //function : NbMeshes
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer SMESHDS_Document::NbMeshes() int SMESHDS_Document::NbMeshes()
{ {
return myMeshes.Extent(); return myMeshes.size();
} }
//======================================================================= //=======================================================================
//function : NbHypothesis //function : NbHypothesis
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer SMESHDS_Document::NbHypothesis() int SMESHDS_Document::NbHypothesis()
{ {
return myHypothesis.Extent(); return myHypothesis.size();
} }
//======================================================================= //=======================================================================
//function : InitMeshesIterator //function : InitMeshesIterator
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Document::InitMeshesIterator() void SMESHDS_Document::InitMeshesIterator()
{ {
myMeshesIt.Initialize(myMeshes); myMeshesIt=myMeshes.begin();
} }
//======================================================================= //=======================================================================
//function : NextMesh //function : NextMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Document::NextMesh() SMESHDS_Mesh * SMESHDS_Document::NextMesh()
{ {
myMeshesIt.Next(); SMESHDS_Mesh * toReturn=(*myMeshesIt).second;
myMeshesIt++;
return toReturn;
} }
//======================================================================= //=======================================================================
//function : MoreMesh //function : MoreMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean SMESHDS_Document::MoreMesh() bool SMESHDS_Document::MoreMesh()
{ {
return myMeshesIt.More(); return myMeshesIt!=myMeshes.end();
}
//=======================================================================
//function : CurrentMesh
//purpose :
//=======================================================================
Handle_SMESHDS_Mesh SMESHDS_Document::CurrentMesh()
{
return myMeshesIt.Value();
} }
//======================================================================= //=======================================================================
//function : InitHypothesisIterator //function : InitHypothesisIterator
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Document::InitHypothesisIterator() void SMESHDS_Document::InitHypothesisIterator()
{ {
myHypothesisIt.Initialize(myHypothesis); myHypothesisIt=myHypothesis.begin();
} }
//======================================================================= //=======================================================================
//function : NextMesh //function : NextMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Document::NextHypothesis() SMESHDS_Hypothesis * SMESHDS_Document::NextHypothesis()
{ {
myHypothesisIt.Next(); SMESHDS_Hypothesis * toReturn=(*myHypothesisIt).second;
myHypothesisIt++;
return toReturn;
} }
//======================================================================= //=======================================================================
//function : MoreMesh //function : MoreMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean SMESHDS_Document::MoreHypothesis() bool SMESHDS_Document::MoreHypothesis()
{ {
return myHypothesisIt.More(); return myHypothesisIt!=myHypothesis.end();
} }
//=======================================================================
//function : CurrentMesh
//purpose :
//=======================================================================
SMESHDS_PtrHypothesis SMESHDS_Document::CurrentHypothesis()
{
return myHypothesisIt.Value();
}

View File

@ -27,126 +27,37 @@
#ifndef _SMESHDS_Document_HeaderFile #ifndef _SMESHDS_Document_HeaderFile
#define _SMESHDS_Document_HeaderFile #define _SMESHDS_Document_HeaderFile
#ifndef _Standard_HeaderFile #include <map>
#include <Standard.hxx> #include "SMESHDS_Mesh.hxx"
#endif #include "SMESHDS_Hypothesis.hxx"
#ifndef _Handle_SMESHDS_Document_HeaderFile using namespace std;
#include "Handle_SMESHDS_Document.hxx"
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _SMESHDS_DataMapOfIntegerMesh_HeaderFile
#include "SMESHDS_DataMapOfIntegerMesh.hxx"
#endif
#ifndef _SMESHDS_DataMapOfIntegerPtrHypothesis_HeaderFile
#include "SMESHDS_DataMapOfIntegerPtrHypothesis.hxx"
#endif
#ifndef _SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_HeaderFile
#include "SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh.hxx"
#endif
#ifndef _SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_HeaderFile
#include "SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis.hxx"
#endif
#ifndef _MMgt_TShared_HeaderFile
#include <MMgt_TShared.hxx>
#endif
#ifndef _Handle_SMESHDS_Mesh_HeaderFile
#include "Handle_SMESHDS_Mesh.hxx"
#endif
#ifndef _SMESHDS_PtrHypothesis_HeaderFile
#include "SMESHDS_PtrHypothesis.hxx"
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
class SMESHDS_Mesh;
class SMESHDS_Document : public MMgt_TShared {
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// inline void operator delete(void *anAddress, size_t size)
// {
// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
// }
// Methods PUBLIC
//
Standard_EXPORT SMESHDS_Document(const Standard_Integer UserID);
Standard_EXPORT Standard_Integer NewMesh() ;
Standard_EXPORT void RemoveMesh(const Standard_Integer MeshID) ;
Standard_EXPORT Handle_SMESHDS_Mesh GetMesh(const Standard_Integer MeshID) ;
Standard_EXPORT void AddHypothesis(const SMESHDS_PtrHypothesis& H) ;
Standard_EXPORT void RemoveHypothesis(const Standard_Integer HypID) ;
Standard_EXPORT SMESHDS_PtrHypothesis GetHypothesis(const Standard_Integer HypID) ;
Standard_EXPORT Standard_Integer NbMeshes() ;
Standard_EXPORT Standard_Integer NbHypothesis() ;
Standard_EXPORT void InitMeshesIterator() ;
Standard_EXPORT void NextMesh() ;
Standard_EXPORT Standard_Boolean MoreMesh() ;
Standard_EXPORT Handle_SMESHDS_Mesh CurrentMesh() ;
Standard_EXPORT void InitHypothesisIterator() ;
Standard_EXPORT void NextHypothesis() ;
Standard_EXPORT Standard_Boolean MoreHypothesis() ;
Standard_EXPORT SMESHDS_PtrHypothesis CurrentHypothesis() ;
Standard_EXPORT ~SMESHDS_Document();
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& SMESHDS_Document_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_Integer myUserID;
SMESHDS_DataMapOfIntegerMesh myMeshes;
SMESHDS_DataMapOfIntegerPtrHypothesis myHypothesis;
SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh myMeshesIt;
SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis myHypothesisIt;
class SMESHDS_Document
{
public:
SMESHDS_Document(int UserID);
int NewMesh();
void RemoveMesh(int MeshID);
SMESHDS_Mesh * GetMesh(int MeshID);
void AddHypothesis(SMESHDS_Hypothesis * H);
void RemoveHypothesis(int HypID);
SMESHDS_Hypothesis * GetHypothesis(int HypID);
int NbMeshes();
int NbHypothesis();
void InitMeshesIterator();
SMESHDS_Mesh * NextMesh();
bool MoreMesh();
void InitHypothesisIterator();
SMESHDS_Hypothesis * NextHypothesis();
bool MoreHypothesis();
~SMESHDS_Document();
private:
int myUserID;
map<int,SMESHDS_Mesh*> myMeshes;
map<int,SMESHDS_Hypothesis*> myHypothesis;
map<int,SMESHDS_Mesh*>::iterator myMeshesIt;
map<int,SMESHDS_Hypothesis*>::iterator myHypothesisIt;
}; };
// other inline functions and methods (like "C++: function call" methods)
//
#endif #endif

View File

@ -63,7 +63,7 @@ SMESHDS_Hypothesis::~SMESHDS_Hypothesis()
*/ */
//============================================================================= //=============================================================================
const char* SMESHDS_Hypothesis::GetName() const char* SMESHDS_Hypothesis::GetName() const
{ {
// MESSAGE("SMESHDS_Hypothesis::GetName"); // MESSAGE("SMESHDS_Hypothesis::GetName");
// SCRUTE(_name); // SCRUTE(_name);
@ -77,7 +77,7 @@ const char* SMESHDS_Hypothesis::GetName()
*/ */
//============================================================================= //=============================================================================
int SMESHDS_Hypothesis::GetID() int SMESHDS_Hypothesis::GetID() const
{ {
// MESSAGE("SMESHDS_Hypothesis::GetId"); // MESSAGE("SMESHDS_Hypothesis::GetId");
// SCRUTE(_hypId); // SCRUTE(_hypId);
@ -90,7 +90,7 @@ int SMESHDS_Hypothesis::GetID()
*/ */
//============================================================================= //=============================================================================
int SMESHDS_Hypothesis::GetType() int SMESHDS_Hypothesis::GetType() const
{ {
// MESSAGE("SMESHDS_Hypothesis::GetType"); // MESSAGE("SMESHDS_Hypothesis::GetType");
// SCRUTE(_type); // SCRUTE(_type);

View File

@ -38,9 +38,7 @@
#include <istream.h> #include <istream.h>
#include <ostream.h> #include <ostream.h>
#endif #endif
using namespace std;
// class istream;
// class ostream;
class SMESHDS_Hypothesis class SMESHDS_Hypothesis
{ {
@ -48,9 +46,9 @@ public:
SMESHDS_Hypothesis(int hypId); SMESHDS_Hypothesis(int hypId);
virtual ~SMESHDS_Hypothesis(); virtual ~SMESHDS_Hypothesis();
const char* GetName(); const char* GetName() const;
int GetID(); int GetID() const;
int GetType(); int GetType() const;
virtual ostream & SaveTo(ostream & save)=0; virtual ostream & SaveTo(ostream & save)=0;
virtual istream & LoadFrom(istream & load)=0; virtual istream & LoadFrom(istream & load)=0;

View File

@ -26,64 +26,51 @@
// Module : SMESH // Module : SMESH
// $Header: // $Header:
using namespace std; #include "SMESHDS_Mesh.hxx"
#include "SMESHDS_Mesh.ixx"
#include "SMESHDS_Hypothesis.hxx"
#include "SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx"
#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx"
#include "SMDS_VertexPosition.hxx" #include "SMDS_VertexPosition.hxx"
#include "SMDS_EdgePosition.hxx" #include "SMDS_EdgePosition.hxx"
#include "SMDS_FacePosition.hxx" #include "SMDS_FacePosition.hxx"
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <TopExp.hxx> #include <TopExp.hxx>
#include <Standard_NullObject.hxx>
#include "utilities.h" #include "utilities.h"
//======================================================================= //=======================================================================
//function : Create //function : Create
//purpose : //purpose :
//======================================================================= //=======================================================================
SMESHDS_Mesh::SMESHDS_Mesh(const Standard_Integer MeshID) : myMeshID( MeshID) SMESHDS_Mesh::SMESHDS_Mesh(int MeshID):myMeshID(MeshID)
{ {
myScript = new SMESHDS_Script(); myScript = new SMESHDS_Script();
} }
//======================================================================= //=======================================================================
//function : ShapeToMesh //function : ShapeToMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::ShapeToMesh(const TopoDS_Shape& S) void SMESHDS_Mesh::ShapeToMesh(const TopoDS_Shape & S)
{ {
myShape = S; myShape = S;
TopExp::MapShapes(myShape,myIndexToShape); TopExp::MapShapes(myShape, myIndexToShape);
} }
//======================================================================= //=======================================================================
//function : AddHypothesis //function : AddHypothesis
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape& SS, bool SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape & SS,
const SMESHDS_PtrHypothesis& H) const SMESHDS_Hypothesis * H)
{ {
if (!myShapeToHypothesis.IsBound(SS)){ list<const SMESHDS_Hypothesis *>& alist=myShapeToHypothesis[SS];
SMESHDS_ListOfPtrHypothesis empty;
myShapeToHypothesis.Bind(SS,empty);
}
else {
//Check if the Hypothesis is still present
SMESHDS_ListOfPtrHypothesis& Hypos = myShapeToHypothesis.ChangeFind (SS);
for (SMESHDS_ListIteratorOfListOfPtrHypothesis it(Hypos); it.More(); it.Next()) { //Check if the Hypothesis is still present
if (H == it.Value()) { list<const SMESHDS_Hypothesis*>::iterator ith=alist.begin();
return Standard_False;
} for (; ith!=alist.end(); ith++)
} if (H == *ith) return false;
}
myShapeToHypothesis(SS).Append(H); alist.push_back(H);
return Standard_True; return true;
} }
//======================================================================= //=======================================================================
@ -91,530 +78,476 @@ Standard_Boolean SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape& SS,
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape& S, bool SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape & S,
const SMESHDS_PtrHypothesis& H) const SMESHDS_Hypothesis * H)
{ {
if (myShapeToHypothesis.IsBound(S)){ ShapeToHypothesis::iterator its=myShapeToHypothesis.find(S);
SMESHDS_ListOfPtrHypothesis& Hypos = myShapeToHypothesis.ChangeFind (S); if(its!=myShapeToHypothesis.end())
for (SMESHDS_ListIteratorOfListOfPtrHypothesis it(Hypos); it.More(); it.Next()) { {
if (H == it.Value()) { list<const SMESHDS_Hypothesis*>::iterator ith=(*its).second.begin();
Hypos.Remove(it);
return Standard_True; for (; ith!=(*its).second.end(); ith++)
} if (H == *ith)
} {
} (*its).second.erase(ith);
return Standard_False; return true;
}
}
return false;
} }
//======================================================================= //=======================================================================
//function : AddNode //function : AddNode
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer SMESHDS_Mesh::AddNode(const Standard_Real x, SMDS_MeshNode* SMESHDS_Mesh::AddNode(double x, double y, double z)
const Standard_Real y,
const Standard_Real z)
{ {
Standard_Integer NodeID = SMDS_Mesh::AddNode(x,y,z); SMDS_MeshNode* node = SMDS_Mesh::AddNode(x, y, z);
myScript->AddNode(NodeID,x,y,z); if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z);
return NodeID; return node;
} }
//======================================================================= //=======================================================================
//function : MoveNode //function : MoveNode
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::MoveNode(const Standard_Integer ID, void SMESHDS_Mesh::MoveNode(int ID, double x, double y, double z)
const Standard_Real x,
const Standard_Real y,
const Standard_Real z)
{ {
SMDS_MeshNode * node=const_cast<SMDS_MeshNode*>(FindNode(ID));
Handle(SMDS_MeshNode) Node = Handle(SMDS_MeshNode)::DownCast(FindNode(ID)); node->setXYZ(x,y,z);
gp_Pnt P(x,y,z); myScript->MoveNode(ID, x, y, z);
Node->SetPnt(P);
myScript->MoveNode(ID,x,y,z);
} }
//======================================================================= //=======================================================================
//function : AddEdge //function : AddEdge
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer SMESHDS_Mesh::AddEdge(const Standard_Integer idnode1, SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(int idnode1, int idnode2)
const Standard_Integer idnode2)
{ {
Standard_Integer ID = SMDS_Mesh::AddEdge(idnode1,idnode2); SMDS_MeshEdge* e = SMDS_Mesh::AddEdge(idnode1, idnode2);
myScript->AddEdge (ID,idnode1,idnode2); if(e!=NULL) myScript->AddEdge(e->GetID(), idnode1, idnode2);
return ID; return e;
}
//=======================================================================
//function :AddFace
//purpose :
//=======================================================================
Standard_Integer SMESHDS_Mesh::AddFace(const Standard_Integer idnode1,
const Standard_Integer idnode2,
const Standard_Integer idnode3)
{
Standard_Integer ID = SMDS_Mesh::AddFace(idnode1,idnode2,idnode3);
myScript->AddFace (ID,idnode1,idnode2,idnode3);
return ID;
} }
//======================================================================= //=======================================================================
//function :AddFace //function :AddFace
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer SMESHDS_Mesh::AddFace(const Standard_Integer idnode1, SMDS_MeshFace* SMESHDS_Mesh::AddFace(int idnode1, int idnode2, int idnode3)
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4)
{ {
Standard_Integer ID = SMDS_Mesh::AddFace(idnode1,idnode2,idnode3,idnode4); SMDS_MeshFace *f = SMDS_Mesh::AddFace(idnode1, idnode2, idnode3);
myScript->AddFace (ID,idnode1,idnode2,idnode3,idnode4); if(f!=NULL) myScript->AddFace(f->GetID(), idnode1, idnode2, idnode3);
return ID; return f;
} }
//======================================================================= //=======================================================================
//function :AddVolume //function :AddFace
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer SMESHDS_Mesh::AddVolume(const Standard_Integer idnode1, SMDS_MeshFace* SMESHDS_Mesh::AddFace(int idnode1, int idnode2, int idnode3,
const Standard_Integer idnode2, int idnode4)
const Standard_Integer idnode3,
const Standard_Integer idnode4)
{ {
Standard_Integer ID = SMDS_Mesh::AddVolume(idnode1,idnode2,idnode3,idnode4); SMDS_MeshFace *f = SMDS_Mesh::AddFace(idnode1, idnode2, idnode3, idnode4);
myScript->AddVolume (ID,idnode1,idnode2,idnode3,idnode4); if(f!=NULL)
return ID; myScript->AddFace(f->GetID(), idnode1, idnode2, idnode3, idnode4);
} return f;
//=======================================================================
//function :AddVolume
//purpose :
//=======================================================================
Standard_Integer SMESHDS_Mesh::AddVolume(const Standard_Integer idnode1,
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4,
const Standard_Integer idnode5)
{
Standard_Integer ID = SMDS_Mesh::AddVolume(idnode1,idnode2,idnode3,idnode4,idnode5);
myScript->AddVolume (ID,idnode1,idnode2,idnode3,idnode4,idnode5);
return ID;
}
//=======================================================================
//function :AddVolume
//purpose :
//=======================================================================
Standard_Integer SMESHDS_Mesh::AddVolume(const Standard_Integer idnode1,
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4,
const Standard_Integer idnode5,
const Standard_Integer idnode6)
{
Standard_Integer ID = SMDS_Mesh::AddVolume(idnode1,idnode2,idnode3,idnode4,idnode5,idnode6);
myScript->AddVolume (ID,idnode1,idnode2,idnode3,idnode4,idnode5,idnode6);
return ID;
} }
//======================================================================= //=======================================================================
//function :AddVolume //function :AddVolume
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer SMESHDS_Mesh::AddVolume(const Standard_Integer idnode1, SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(int idnode1, int idnode2, int idnode3,
const Standard_Integer idnode2, int idnode4)
const Standard_Integer idnode3,
const Standard_Integer idnode4,
const Standard_Integer idnode5,
const Standard_Integer idnode6,
const Standard_Integer idnode7,
const Standard_Integer idnode8)
{ {
Standard_Integer ID = SMDS_Mesh::AddVolume(idnode1,idnode2,idnode3,idnode4,idnode5,idnode6,idnode7,idnode8); SMDS_MeshVolume *f = SMDS_Mesh::AddVolume(idnode1, idnode2, idnode3,
myScript->AddVolume (ID,idnode1,idnode2,idnode3,idnode4,idnode5,idnode6,idnode7,idnode8); idnode4);
return ID; if(f!=NULL)
myScript->AddVolume(f->GetID(), idnode1, idnode2, idnode3, idnode4);
return f;
} }
//=======================================================================
//function :AddVolume
//purpose :
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(int idnode1, int idnode2, int idnode3,
int idnode4, int idnode5)
{
SMDS_MeshVolume *v = SMDS_Mesh::AddVolume(idnode1, idnode2, idnode3,
idnode4, idnode5);
if(v!=NULL)
myScript->AddVolume(v->GetID(), idnode1, idnode2, idnode3, idnode4,
idnode5);
return v;
}
//=======================================================================
//function :AddVolume
//purpose :
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(int idnode1, int idnode2, int idnode3,
int idnode4, int idnode5, int idnode6)
{
SMDS_MeshVolume *v=
SMDS_Mesh::AddVolume(idnode1, idnode2, idnode3, idnode4, idnode5,
idnode6);
if(v!=NULL)
myScript->AddVolume(v->GetID(), idnode1, idnode2, idnode3, idnode4,
idnode5, idnode6);
return v;
}
//=======================================================================
//function :AddVolume
//purpose :
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(int idnode1, int idnode2, int idnode3,
int idnode4, int idnode5, int idnode6, int idnode7, int idnode8)
{
SMDS_MeshVolume *v=
SMDS_Mesh::AddVolume(idnode1, idnode2, idnode3, idnode4, idnode5,
idnode6, idnode7, idnode8);
if(v!=NULL)
myScript->AddVolume(v->GetID(), idnode1, idnode2, idnode3, idnode4,
idnode5, idnode6, idnode7, idnode8);
return v;
}
//======================================================================= //=======================================================================
//function : RemoveNode //function : RemoveNode
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::RemoveNode(const Standard_Integer ID) void SMESHDS_Mesh::RemoveNode(int ID)
{ {
SMDS_Mesh::RemoveNode (ID); SMDS_Mesh::RemoveNode(ID);
myScript->RemoveNode (ID); myScript->RemoveNode(ID);
} }
//======================================================================= //=======================================================================
//function : RemoveElement //function : RemoveElement
//purpose : //purpose :
//======================================================================== //========================================================================
void SMESHDS_Mesh::RemoveElement(const Standard_Integer ID) void SMESHDS_Mesh::RemoveElement(int ID)
{ {
SMDS_Mesh::RemoveElement (ID); SMDS_Mesh::RemoveElement(ID);
myScript->RemoveElement (ID); myScript->RemoveElement(ID);
} }
//======================================================================= //=======================================================================
//function : SetNodeOnVolume //function : SetNodeOnVolume
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::SetNodeInVolume (const Handle(SMDS_MeshNode)& aNode, void SMESHDS_Mesh::SetNodeInVolume(SMDS_MeshNode * aNode,
const TopoDS_Shell& S) const TopoDS_Shell & S)
{ {
if (myShape.IsNull()) if (myShape.IsNull()) MESSAGE("myShape is NULL");
Standard_NullObject::Raise("SMESHDS_Mesh::SetNodeOnVolume");
int Index = myIndexToShape.FindIndex(S);
Standard_Integer Index = myIndexToShape.FindIndex(S);
//Set Position on Node
//Set Position on Node //Handle (SMDS_FacePosition) aPos = new SMDS_FacePosition (myFaceToId(S),0.,0.);;
//Handle (SMDS_FacePosition) aPos = new SMDS_FacePosition (myFaceToId(S),0.,0.);; //aNode->SetPosition(aPos);
//aNode->SetPosition(aPos);
//Update or build submesh
//Update or build submesh map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index);
if (!myShapeIndexToSubMesh.IsBound(Index)) { if (it==myShapeIndexToSubMesh.end())
Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh(this);
myShapeIndexToSubMesh.Bind(Index,SM);
} myShapeIndexToSubMesh[Index]->AddNode(aNode);
myShapeIndexToSubMesh(Index)->AddNode (aNode);
} }
//======================================================================= //=======================================================================
//function : SetNodeOnFace //function : SetNodeOnFace
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::SetNodeOnFace (const Handle(SMDS_MeshNode)& aNode, void SMESHDS_Mesh::SetNodeOnFace(SMDS_MeshNode * aNode,
const TopoDS_Face& S) const TopoDS_Face & S)
{ {
if (myShape.IsNull()) if (myShape.IsNull()) MESSAGE("myShape is NULL");
Standard_NullObject::Raise("SMESHDS_Mesh::SetNodeOnFace");
int Index = myIndexToShape.FindIndex(S);
Standard_Integer Index = myIndexToShape.FindIndex(S);
//Set Position on Node
//Set Position on Node aNode->SetPosition(new SMDS_FacePosition(Index, 0., 0.));
Handle (SMDS_FacePosition) aPos = new SMDS_FacePosition (Index,0.,0.);;
aNode->SetPosition(aPos); //Update or build submesh
map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index);
//Update or build submesh if (it==myShapeIndexToSubMesh.end())
if (!myShapeIndexToSubMesh.IsBound(Index)) { myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh(this);
Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this);
myShapeIndexToSubMesh.Bind(Index,SM); myShapeIndexToSubMesh[Index]->AddNode(aNode);
}
myShapeIndexToSubMesh(Index)->AddNode (aNode);
} }
//======================================================================= //=======================================================================
//function : SetNodeOnEdge //function : SetNodeOnEdge
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::SetNodeOnEdge (const Handle(SMDS_MeshNode)& aNode, void SMESHDS_Mesh::SetNodeOnEdge(SMDS_MeshNode * aNode,
const TopoDS_Edge& S) const TopoDS_Edge & S)
{ {
if (myShape.IsNull()) if (myShape.IsNull()) MESSAGE("myShape is NULL");
Standard_NullObject::Raise("SMESHDS_Mesh::SetNodeOnEdge");
int Index = myIndexToShape.FindIndex(S);
Standard_Integer Index = myIndexToShape.FindIndex(S);
//Set Position on Node
//Set Position on Node aNode->SetPosition(new SMDS_EdgePosition(Index, 0.));
Handle (SMDS_EdgePosition) aPos = new SMDS_EdgePosition (Index,0.);;
aNode->SetPosition(aPos); //Update or build submesh
map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index);
//Update or build submesh if (it==myShapeIndexToSubMesh.end())
if (!myShapeIndexToSubMesh.IsBound(Index)) { myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh(this);
Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this);
myShapeIndexToSubMesh.Bind(Index,SM); myShapeIndexToSubMesh[Index]->AddNode(aNode);
}
myShapeIndexToSubMesh(Index)->AddNode (aNode);
} }
//======================================================================= //=======================================================================
//function : SetNodeOnVertex //function : SetNodeOnVertex
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::SetNodeOnVertex (const Handle(SMDS_MeshNode)& aNode, void SMESHDS_Mesh::SetNodeOnVertex(SMDS_MeshNode * aNode,
const TopoDS_Vertex& S) const TopoDS_Vertex & S)
{ {
if (myShape.IsNull()) if (myShape.IsNull()) MESSAGE("myShape is NULL");
Standard_NullObject::Raise("SMESHDS_Mesh::SetNodeOnVertex");
Standard_Integer Index = myIndexToShape.FindIndex(S);
//Set Position on Node
Handle (SMDS_VertexPosition) aPos = new SMDS_VertexPosition (Index);;
aNode->SetPosition(aPos);
//Update or build submesh
if (!myShapeIndexToSubMesh.IsBound(Index)) {
Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this);
myShapeIndexToSubMesh.Bind(Index,SM);
}
myShapeIndexToSubMesh(Index)->AddNode (aNode);
}
int Index = myIndexToShape.FindIndex(S);
//Set Position on Node
aNode->SetPosition(new SMDS_VertexPosition(Index));
//Update or build submesh
map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index);
if (it==myShapeIndexToSubMesh.end())
myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh(this);
myShapeIndexToSubMesh[Index]->AddNode(aNode);
}
//======================================================================= //=======================================================================
//function : UnSetNodeOnShape //function : UnSetNodeOnShape
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::UnSetNodeOnShape(const Handle(SMDS_MeshNode)& aNode) void SMESHDS_Mesh::UnSetNodeOnShape(const SMDS_MeshNode* aNode)
{ {
MESSAGE("not implemented"); MESSAGE("not implemented");
} }
//======================================================================= //=======================================================================
//function : SetMeshElementOnShape //function : SetMeshElementOnShape
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::SetMeshElementOnShape (const Handle(SMDS_MeshElement)& anElement, void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement * anElement,
const TopoDS_Shape& S) const TopoDS_Shape & S)
{ {
if (myShape.IsNull()) if (myShape.IsNull()) MESSAGE("myShape is NULL");
Standard_NullObject::Raise("SMESHDS_Mesh::SetMeshElementOnShape");
Standard_Integer Index = myIndexToShape.FindIndex(S);
if (!myShapeIndexToSubMesh.IsBound(Index)) { int Index = myIndexToShape.FindIndex(S);
Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this);
myShapeIndexToSubMesh.Bind(Index,SM); if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
} myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(this);
myShapeIndexToSubMesh(Index)->AddElement (anElement);
myShapeIndexToSubMesh[Index]->AddElement(anElement);
} }
//======================================================================= //=======================================================================
//function : UnSetMeshElementOnShape //function : UnSetMeshElementOnShape
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::UnSetMeshElementOnShape (const Handle(SMDS_MeshElement)& anElement, void SMESHDS_Mesh::
const TopoDS_Shape& S) UnSetMeshElementOnShape(const SMDS_MeshElement * anElement,
const TopoDS_Shape & S)
{ {
if (myShape.IsNull()) if (myShape.IsNull()) MESSAGE("myShape is NULL");
Standard_NullObject::Raise("SMESHDS_Mesh::UnSetMeshElementOnShape");
Standard_Integer Index = myIndexToShape.FindIndex(S);
if (myShapeIndexToSubMesh.IsBound(Index)) int Index = myIndexToShape.FindIndex(S);
myShapeIndexToSubMesh(Index)->RemoveElement (anElement);
if (myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end())
myShapeIndexToSubMesh[Index]->RemoveElement(anElement);
} }
//======================================================================= //=======================================================================
//function : ShapeToMesh //function : ShapeToMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
TopoDS_Shape SMESHDS_Mesh::ShapeToMesh() TopoDS_Shape SMESHDS_Mesh::ShapeToMesh() const
{ {
return myShape; return myShape;
} }
//======================================================================= ///////////////////////////////////////////////////////////////////////////////
//function : MeshElements /// Return the sub mesh linked to the a given TopoDS_Shape or NULL if the given
//purpose : /// TopoDS_Shape is unknown
//======================================================================= ///////////////////////////////////////////////////////////////////////////////
Handle_SMESHDS_SubMesh SMESHDS_Mesh::MeshElements(const TopoDS_Shape& S) SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S)
{ {
if (myShape.IsNull()) if (myShape.IsNull()) MESSAGE("myShape is NULL");
Standard_NullObject::Raise("SMESHDS_Mesh::MeshElements");
Standard_Integer Index = myIndexToShape.FindIndex(S);
if (myShapeIndexToSubMesh.IsBound(Index)) int Index = myIndexToShape.FindIndex(S);
return myShapeIndexToSubMesh(Index); if (myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end())
Handle(SMESHDS_SubMesh) SM; return myShapeIndexToSubMesh[Index];
return SM; else
return NULL;
} }
//======================================================================= //=======================================================================
//function : GetHypothesis //function : GetHypothesis
//purpose : //purpose :
//======================================================================= //=======================================================================
const SMESHDS_ListOfPtrHypothesis& SMESHDS_Mesh::GetHypothesis(const TopoDS_Shape& S)
const list<const SMESHDS_Hypothesis*>& SMESHDS_Mesh::GetHypothesis(
const TopoDS_Shape & S) const
{ {
if (myShapeToHypothesis.IsBound(S)) if (myShapeToHypothesis.find(S)!=myShapeToHypothesis.end())
return myShapeToHypothesis(S); return myShapeToHypothesis.find(S)->second;
static SMESHDS_ListOfPtrHypothesis empty; static list<const SMESHDS_Hypothesis*> empty;
return empty; return empty;
} }
//======================================================================= //=======================================================================
//function : GetScript //function : GetScript
//purpose : //purpose :
//======================================================================= //=======================================================================
const Handle (SMESHDS_Script)& SMESHDS_Mesh::GetScript() SMESHDS_Script* SMESHDS_Mesh::GetScript()
{ {
return myScript; return myScript;
} }
//======================================================================= //=======================================================================
//function : ClearScript //function : ClearScript
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::ClearScript() void SMESHDS_Mesh::ClearScript()
{ {
myScript->Clear(); myScript->Clear();
} }
//======================================================================= //=======================================================================
//function : HasMeshElements //function : HasMeshElements
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape& S) bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S)
{ {
if (myShape.IsNull()) if (myShape.IsNull()) MESSAGE("myShape is NULL");
Standard_NullObject::Raise("SMESHDS_Mesh::MeshElements"); int Index = myIndexToShape.FindIndex(S);
return myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end();
Standard_Integer Index = myIndexToShape.FindIndex(S);
return myShapeIndexToSubMesh.IsBound(Index);
} }
//======================================================================= //=======================================================================
//function : HasHypothesis //function : HasHypothesis
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean SMESHDS_Mesh::HasHypothesis(const TopoDS_Shape& S) bool SMESHDS_Mesh::HasHypothesis(const TopoDS_Shape & S)
{ {
return myShapeToHypothesis.IsBound(S); return myShapeToHypothesis.find(S)!=myShapeToHypothesis.end();
} }
//======================================================================= //=======================================================================
//function : NewSubMesh //function : NewSubMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::NewSubMesh(const Standard_Integer Index) void SMESHDS_Mesh::NewSubMesh(int Index)
{ {
if (!myShapeIndexToSubMesh.IsBound(Index)) { if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); {
myShapeIndexToSubMesh.Bind(Index,SM); SMESHDS_SubMesh* SM = new SMESHDS_SubMesh(this);
} myShapeIndexToSubMesh[Index]=SM;
}
} }
//======================================================================= //=======================================================================
//function : IndexToShape //function : IndexToShape
//purpose : //purpose :
//======================================================================= //=======================================================================
TopoDS_Shape SMESHDS_Mesh::IndexToShape(const Standard_Integer ShapeIndex) TopoDS_Shape SMESHDS_Mesh::IndexToShape(int ShapeIndex)
{ {
return myIndexToShape.FindKey(ShapeIndex); return myIndexToShape.FindKey(ShapeIndex);
} }
//======================================================================= //=======================================================================
//function : ShapeToIndex //function : ShapeToIndex
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape& S) int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S)
{ {
if (myShape.IsNull()) if (myShape.IsNull()) MESSAGE("myShape is NULL");
Standard_NullObject::Raise("SMESHDS_Mesh::SetNodeOnVolume"); return myIndexToShape.FindIndex(S);
return myIndexToShape.FindIndex(S);
} }
//======================================================================= //=======================================================================
//function : SetNodeOnVolume //function : SetNodeOnVolume
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::SetNodeInVolume (const Handle(SMDS_MeshNode)& aNode, void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode* aNode, int Index)
const Standard_Integer Index)
{ {
//Set Position on Node
//Set Position on Node //Handle (SMDS_FacePosition) aPos = new SMDS_FacePosition (myFaceToId(S),0.,0.);;
//Handle (SMDS_FacePosition) aPos = new SMDS_FacePosition (myFaceToId(S),0.,0.);; //aNode->SetPosition(aPos);
//aNode->SetPosition(aPos);
//Update or build submesh
//Update or build submesh if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
if (!myShapeIndexToSubMesh.IsBound(Index)) { myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(this);
Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this);
myShapeIndexToSubMesh.Bind(Index,SM); myShapeIndexToSubMesh[Index]->AddNode(aNode);
}
myShapeIndexToSubMesh(Index)->AddNode (aNode);
} }
//======================================================================= //=======================================================================
//function : SetNodeOnFace //function : SetNodeOnFace
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::SetNodeOnFace (const Handle(SMDS_MeshNode)& aNode, void SMESHDS_Mesh::SetNodeOnFace(SMDS_MeshNode* aNode, int Index)
const Standard_Integer Index)
{ {
//Set Position on Node
//Set Position on Node aNode->SetPosition(new SMDS_FacePosition(Index, 0., 0.));
Handle (SMDS_FacePosition) aPos = new SMDS_FacePosition (Index,0.,0.);;
aNode->SetPosition(aPos); //Update or build submesh
if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
//Update or build submesh myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(this);
if (!myShapeIndexToSubMesh.IsBound(Index)) {
Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); myShapeIndexToSubMesh[Index]->AddNode(aNode);
myShapeIndexToSubMesh.Bind(Index,SM);
}
myShapeIndexToSubMesh(Index)->AddNode (aNode);
} }
//======================================================================= //=======================================================================
//function : SetNodeOnEdge //function : SetNodeOnEdge
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::SetNodeOnEdge (const Handle(SMDS_MeshNode)& aNode, void SMESHDS_Mesh::SetNodeOnEdge(SMDS_MeshNode* aNode, int Index)
const Standard_Integer Index)
{ {
//Set Position on Node
//Set Position on Node aNode->SetPosition(new SMDS_EdgePosition(Index, 0.));
Handle (SMDS_EdgePosition) aPos = new SMDS_EdgePosition (Index,0.);;
aNode->SetPosition(aPos); //Update or build submesh
if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
//Update or build submesh myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(this);
if (!myShapeIndexToSubMesh.IsBound(Index)) {
Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); myShapeIndexToSubMesh[Index]->AddNode(aNode);
myShapeIndexToSubMesh.Bind(Index,SM);
}
myShapeIndexToSubMesh(Index)->AddNode (aNode);
} }
//======================================================================= //=======================================================================
//function : SetNodeOnVertex //function : SetNodeOnVertex
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::SetNodeOnVertex (const Handle(SMDS_MeshNode)& aNode, void SMESHDS_Mesh::SetNodeOnVertex(SMDS_MeshNode* aNode, int Index)
const Standard_Integer Index) {
{ //Set Position on Node
//Set Position on Node aNode->SetPosition(new SMDS_VertexPosition(Index));
Handle (SMDS_VertexPosition) aPos = new SMDS_VertexPosition (Index);;
aNode->SetPosition(aPos); //Update or build submesh
if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
//Update or build submesh myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(this);
if (!myShapeIndexToSubMesh.IsBound(Index)) {
Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); myShapeIndexToSubMesh[Index]->AddNode(aNode);
myShapeIndexToSubMesh.Bind(Index,SM);
}
myShapeIndexToSubMesh(Index)->AddNode (aNode);
} }
//======================================================================= //=======================================================================
//function : SetMeshElementOnShape //function : SetMeshElementOnShape
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::SetMeshElementOnShape (const Handle(SMDS_MeshElement)& anElement, void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement* anElement,
const Standard_Integer Index) int Index)
{ {
if (!myShapeIndexToSubMesh.IsBound(Index)) { if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(this);
myShapeIndexToSubMesh.Bind(Index,SM);
} myShapeIndexToSubMesh[Index]->AddElement(anElement);
myShapeIndexToSubMesh(Index)->AddElement (anElement);
} }

View File

@ -27,171 +27,87 @@
#ifndef _SMESHDS_Mesh_HeaderFile #ifndef _SMESHDS_Mesh_HeaderFile
#define _SMESHDS_Mesh_HeaderFile #define _SMESHDS_Mesh_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Handle_SMESHDS_Mesh_HeaderFile
#include "Handle_SMESHDS_Mesh.hxx"
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _TopoDS_Shell_HeaderFile
#include <TopoDS_Shell.hxx>
#endif
#ifndef _TopTools_IndexedMapOfShape_HeaderFile
#include <TopTools_IndexedMapOfShape.hxx>
#endif
#ifndef _SMESHDS_DataMapOfIntegerSubMesh_HeaderFile
#include "SMESHDS_DataMapOfIntegerSubMesh.hxx"
#endif
#ifndef _SMESHDS_DataMapOfShapeListOfPtrHypothesis_HeaderFile
#include "SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx"
#endif
#ifndef _Handle_SMESHDS_Script_HeaderFile
#include "Handle_SMESHDS_Script.hxx"
#endif
#ifndef _SMDS_Mesh_HeaderFile
#include "SMDS_Mesh.hxx" #include "SMDS_Mesh.hxx"
#endif #include "SMDS_MeshNode.hxx"
#ifndef _Standard_Boolean_HeaderFile #include "SMDS_MeshEdge.hxx"
#include <Standard_Boolean.hxx> #include "SMDS_MeshFace.hxx"
#endif #include "SMDS_MeshVolume.hxx"
#ifndef _SMESHDS_PtrHypothesis_HeaderFile #include "SMESHDS_Hypothesis.hxx"
#include "SMESHDS_PtrHypothesis.hxx" #include "SMESHDS_SubMesh.hxx"
#endif #include "SMESHDS_Script.hxx"
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Handle_SMDS_MeshNode_HeaderFile
#include "Handle_SMDS_MeshNode.hxx"
#endif
#ifndef _Handle_SMDS_MeshElement_HeaderFile
#include "Handle_SMDS_MeshElement.hxx"
#endif
#ifndef _Handle_SMESHDS_SubMesh_HeaderFile
#include "Handle_SMESHDS_SubMesh.hxx"
#endif
class SMESHDS_Script;
class TopoDS_Shape;
class SMDS_MeshNode;
class TopoDS_Shell;
class TopoDS_Face;
class TopoDS_Edge;
class TopoDS_Vertex;
class SMDS_MeshElement;
class SMESHDS_SubMesh;
class SMESHDS_ListOfPtrHypothesis;
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
//Not portable see http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#5_4 to know more.
#include <ext/hash_map>
using namespace __gnu_cxx;
class SMESHDS_Mesh : public SMDS_Mesh { using namespace std;
public: class SMESHDS_Mesh:public SMDS_Mesh
{
inline void* operator new(size_t,void* anAddress) public:
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// inline void operator delete(void *anAddress, size_t size)
// {
// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
// }
// Methods PUBLIC
//
Standard_EXPORT SMESHDS_Mesh(const Standard_Integer MeshID);
Standard_EXPORT void ShapeToMesh(const TopoDS_Shape& S) ;
Standard_EXPORT Standard_Boolean AddHypothesis(const TopoDS_Shape& SS,const SMESHDS_PtrHypothesis& H) ;
Standard_EXPORT Standard_Boolean RemoveHypothesis(const TopoDS_Shape& S,const SMESHDS_PtrHypothesis& H) ;
Standard_EXPORT virtual Standard_Integer AddNode(const Standard_Real x,const Standard_Real y,const Standard_Real z) ;
Standard_EXPORT virtual void RemoveNode(const Standard_Integer ID) ;
Standard_EXPORT void MoveNode(const Standard_Integer ID,const Standard_Real x,const Standard_Real y,const Standard_Real z) ;
Standard_EXPORT virtual Standard_Integer AddEdge(const Standard_Integer idnode1,const Standard_Integer idnode2) ;
Standard_EXPORT virtual Standard_Integer AddFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ;
Standard_EXPORT virtual Standard_Integer AddFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ;
Standard_EXPORT virtual Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ;
Standard_EXPORT virtual Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5) ;
Standard_EXPORT virtual Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6) ;
Standard_EXPORT virtual Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8) ;
Standard_EXPORT virtual void RemoveElement(const Standard_Integer IDelem) ;
Standard_EXPORT void SetNodeInVolume(const Handle(SMDS_MeshNode)& aNode,const TopoDS_Shell& S) ;
Standard_EXPORT void SetNodeOnFace(const Handle(SMDS_MeshNode)& aNode,const TopoDS_Face& S) ;
Standard_EXPORT void SetNodeOnEdge(const Handle(SMDS_MeshNode)& aNode,const TopoDS_Edge& S) ;
Standard_EXPORT void SetNodeOnVertex(const Handle(SMDS_MeshNode)& aNode,const TopoDS_Vertex& S) ;
Standard_EXPORT void UnSetNodeOnShape(const Handle(SMDS_MeshNode)& aNode) ;
Standard_EXPORT void SetMeshElementOnShape(const Handle(SMDS_MeshElement)& anElt,const TopoDS_Shape& S) ;
Standard_EXPORT void UnSetMeshElementOnShape(const Handle(SMDS_MeshElement)& anElt,const TopoDS_Shape& S) ;
Standard_EXPORT TopoDS_Shape ShapeToMesh() ;
Standard_EXPORT Standard_Boolean HasMeshElements(const TopoDS_Shape& S) ;
Standard_EXPORT Handle_SMESHDS_SubMesh MeshElements(const TopoDS_Shape& S) ;
Standard_EXPORT Standard_Boolean HasHypothesis(const TopoDS_Shape& S) ;
Standard_EXPORT const SMESHDS_ListOfPtrHypothesis& GetHypothesis(const TopoDS_Shape& S) ;
Standard_EXPORT const Handle_SMESHDS_Script& GetScript() ;
Standard_EXPORT void ClearScript() ;
Standard_EXPORT Standard_Integer ShapeToIndex(const TopoDS_Shape& aShape) ;
Standard_EXPORT TopoDS_Shape IndexToShape(const Standard_Integer ShapeIndex) ;
Standard_EXPORT void NewSubMesh(const Standard_Integer Index) ;
Standard_EXPORT void SetNodeInVolume(const Handle(SMDS_MeshNode)& aNode,const Standard_Integer Index) ;
Standard_EXPORT void SetNodeOnFace(const Handle(SMDS_MeshNode)& aNode,const Standard_Integer Index) ;
Standard_EXPORT void SetNodeOnEdge(const Handle(SMDS_MeshNode)& aNode,const Standard_Integer Index) ;
Standard_EXPORT void SetNodeOnVertex(const Handle(SMDS_MeshNode)& aNode,const Standard_Integer Index) ;
Standard_EXPORT void SetMeshElementOnShape(const Handle(SMDS_MeshElement)& anElt,const Standard_Integer Index) ;
Standard_EXPORT ~SMESHDS_Mesh();
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& SMESHDS_Mesh_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_Integer myMeshID;
TopoDS_Shape myShape;
TopTools_IndexedMapOfShape myIndexToShape;
SMESHDS_DataMapOfIntegerSubMesh myShapeIndexToSubMesh;
SMESHDS_DataMapOfShapeListOfPtrHypothesis myShapeToHypothesis;
Handle_SMESHDS_Script myScript;
SMESHDS_Mesh(int MeshID);
void ShapeToMesh(const TopoDS_Shape & S);
bool AddHypothesis(const TopoDS_Shape & SS, const SMESHDS_Hypothesis * H);
bool RemoveHypothesis(const TopoDS_Shape & S, const SMESHDS_Hypothesis * H);
SMDS_MeshNode * AddNode(double x, double y, double z);
virtual void RemoveNode(int ID);
void MoveNode(int ID, double x, double y, double z);
SMDS_MeshEdge* AddEdge(int idnode1, int idnode2);
SMDS_MeshFace* AddFace(int idnode1, int idnode2, int idnode3);
SMDS_MeshFace* AddFace(int idnode1, int idnode2, int idnode3, int idnode4);
SMDS_MeshVolume* AddVolume(int idnode1, int idnode2, int idnode3, int idnode4);
SMDS_MeshVolume* AddVolume(int idnode1, int idnode2, int idnode3, int idnode4,
int idnode5);
SMDS_MeshVolume* AddVolume(int idnode1, int idnode2, int idnode3, int idnode4,
int idnode5, int idnode6);
SMDS_MeshVolume* AddVolume(int idnode1, int idnode2, int idnode3, int idnode4,
int idnode5, int idnode6, int idnode7, int idnode8);
virtual void RemoveElement(int IDelem);
void SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Shell & S);
void SetNodeOnFace(SMDS_MeshNode * aNode, const TopoDS_Face & S);
void SetNodeOnEdge(SMDS_MeshNode * aNode, const TopoDS_Edge & S);
void SetNodeOnVertex(SMDS_MeshNode * aNode, const TopoDS_Vertex & S);
void UnSetNodeOnShape(const SMDS_MeshNode * aNode);
void SetMeshElementOnShape(const SMDS_MeshElement * anElt,
const TopoDS_Shape & S);
void UnSetMeshElementOnShape(const SMDS_MeshElement * anElt,
const TopoDS_Shape & S);
TopoDS_Shape ShapeToMesh() const;
bool HasMeshElements(const TopoDS_Shape & S);
SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S);
bool HasHypothesis(const TopoDS_Shape & S);
const list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
SMESHDS_Script * GetScript();
void ClearScript();
int ShapeToIndex(const TopoDS_Shape & aShape);
TopoDS_Shape IndexToShape(int ShapeIndex);
void NewSubMesh(int Index);
void SetNodeInVolume(const SMDS_MeshNode * aNode, int Index);
void SetNodeOnFace(SMDS_MeshNode * aNode, int Index);
void SetNodeOnEdge(SMDS_MeshNode * aNode, int Index);
void SetNodeOnVertex(SMDS_MeshNode * aNode, int Index);
void SetMeshElementOnShape(const SMDS_MeshElement * anElt, int Index);
~SMESHDS_Mesh();
private:
struct HashTopoDS_Shape
{
size_t operator()(const TopoDS_Shape& S) const {return S.HashCode(2147483647);}
};
typedef hash_map<TopoDS_Shape, list<const SMESHDS_Hypothesis*>,HashTopoDS_Shape > ShapeToHypothesis;
int myMeshID;
TopoDS_Shape myShape;
TopTools_IndexedMapOfShape myIndexToShape;
map<int,SMESHDS_SubMesh*> myShapeIndexToSubMesh;
ShapeToHypothesis myShapeToHypothesis;
SMESHDS_Script * myScript;
}; };
// other inline functions and methods (like "C++: function call" methods)
//
#endif #endif

View File

@ -27,297 +27,297 @@
// $Header: // $Header:
using namespace std; using namespace std;
#include "SMESHDS_Script.ixx" #include "SMESHDS_Script.hxx"
#include "SMESHDS_Command.hxx"
#include "SMESHDS_CommandType.hxx"
#include "SMESHDS_ListOfCommand.hxx"
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Script::AddNode(const Standard_Integer NewNodeID, void SMESHDS_Script::AddNode(int NewNodeID, double x, double y, double z)
const Standard_Real x,
const Standard_Real y,
const Standard_Real z)
{ {
Handle(SMESHDS_Command) com; SMESHDS_Command* com;
if (myCommands.IsEmpty()) { if (myCommands.empty())
com = new SMESHDS_Command(SMESHDS_AddNode); {
myCommands.Append (com); com = new SMESHDS_Command(SMESHDS_AddNode);
} myCommands.insert(myCommands.end(),com);
else { }
com = myCommands.Last(); else
if (com->GetType() != SMESHDS_AddNode) { {
com = new SMESHDS_Command(SMESHDS_AddNode); com = myCommands.back();
myCommands.Append (com); if (com->GetType() != SMESHDS_AddNode)
} {
} com = new SMESHDS_Command(SMESHDS_AddNode);
com->AddNode (NewNodeID,x,y,z); myCommands.insert(myCommands.end(),com);
} }
}
com->AddNode(NewNodeID, x, y, z);
//=======================================================================
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::AddEdge(const Standard_Integer NewEdgeID,
const Standard_Integer idnode1,
const Standard_Integer idnode2)
{
Handle(SMESHDS_Command) com;
if (myCommands.IsEmpty()) {
com = new SMESHDS_Command(SMESHDS_AddEdge);
myCommands.Append (com);
}
else {
com = myCommands.Last();
if (com->GetType() != SMESHDS_AddEdge) {
com = new SMESHDS_Command(SMESHDS_AddEdge);
myCommands.Append (com);
}
}
com->AddEdge (NewEdgeID,idnode1,idnode2);
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Script::AddFace(const Standard_Integer NewFaceID, void SMESHDS_Script::AddEdge(int NewEdgeID, int idnode1, int idnode2)
const Standard_Integer idnode1,
const Standard_Integer idnode2,
const Standard_Integer idnode3)
{ {
Handle(SMESHDS_Command) com; SMESHDS_Command* com;
if (myCommands.IsEmpty()) { if (myCommands.empty())
com = new SMESHDS_Command(SMESHDS_AddTriangle); {
myCommands.Append (com); com = new SMESHDS_Command(SMESHDS_AddEdge);
} myCommands.insert(myCommands.end(), com);
else { }
com = myCommands.Last(); else
if (com->GetType() != SMESHDS_AddTriangle) { {
com = new SMESHDS_Command(SMESHDS_AddTriangle); com = myCommands.back();
myCommands.Append (com); if (com->GetType() != SMESHDS_AddEdge)
} {
} com = new SMESHDS_Command(SMESHDS_AddEdge);
com->AddFace (NewFaceID,idnode1,idnode2,idnode3); myCommands.insert(myCommands.end(), com);
}
}
com->AddEdge(NewEdgeID, idnode1, idnode2);
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Script::AddFace(const Standard_Integer NewFaceID, void SMESHDS_Script::AddFace(int NewFaceID,
const Standard_Integer idnode1, int idnode1, int idnode2, int idnode3)
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4)
{ {
Handle(SMESHDS_Command) com; SMESHDS_Command * com;
if (myCommands.IsEmpty()) { if (myCommands.empty())
com = new SMESHDS_Command(SMESHDS_AddQuadrangle); {
myCommands.Append (com); com = new SMESHDS_Command(SMESHDS_AddTriangle);
} myCommands.insert(myCommands.end(),com);
else { }
com = myCommands.Last(); else
if (com->GetType() != SMESHDS_AddQuadrangle) { {
com = new SMESHDS_Command(SMESHDS_AddQuadrangle); com = myCommands.back();
myCommands.Append (com); if (com->GetType() != SMESHDS_AddTriangle)
} {
} com = new SMESHDS_Command(SMESHDS_AddTriangle);
com->AddFace (NewFaceID,idnode1,idnode2,idnode3,idnode4); myCommands.insert(myCommands.end(),com);
}
}
com->AddFace(NewFaceID, idnode1, idnode2, idnode3);
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Script::AddVolume(const Standard_Integer NewID, void SMESHDS_Script::AddFace(int NewFaceID,
const Standard_Integer idnode1, int idnode1, int idnode2, int idnode3, int idnode4)
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4)
{ {
Handle(SMESHDS_Command) com; SMESHDS_Command * com;
if (myCommands.IsEmpty()) { if (myCommands.empty())
com = new SMESHDS_Command(SMESHDS_AddTetrahedron); {
myCommands.Append (com); com = new SMESHDS_Command(SMESHDS_AddQuadrangle);
} myCommands.insert(myCommands.end(),com);
else { }
com = myCommands.Last(); else
if (com->GetType() != SMESHDS_AddQuadrangle) { {
com = new SMESHDS_Command(SMESHDS_AddQuadrangle); com = myCommands.back();
myCommands.Append (com); if (com->GetType() != SMESHDS_AddQuadrangle)
} {
} com = new SMESHDS_Command(SMESHDS_AddQuadrangle);
com->AddVolume (NewID,idnode1,idnode2,idnode3,idnode4); myCommands.insert(myCommands.end(),com);
}
}
com->AddFace(NewFaceID, idnode1, idnode2, idnode3, idnode4);
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Script::AddVolume(const Standard_Integer NewID, void SMESHDS_Script::AddVolume(int NewID,
const Standard_Integer idnode1, int idnode1, int idnode2, int idnode3, int idnode4)
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4,
const Standard_Integer idnode5)
{ {
Handle(SMESHDS_Command) com; SMESHDS_Command * com;
if (myCommands.IsEmpty()) { if (myCommands.empty())
com = new SMESHDS_Command(SMESHDS_AddPyramid); {
myCommands.Append (com); com = new SMESHDS_Command(SMESHDS_AddTetrahedron);
} myCommands.insert(myCommands.end(),com);
else { }
com = myCommands.Last(); else
if (com->GetType() != SMESHDS_AddPyramid) { {
com = new SMESHDS_Command(SMESHDS_AddPyramid); com = myCommands.back();
myCommands.Append (com); if (com->GetType() != SMESHDS_AddQuadrangle)
} {
} com = new SMESHDS_Command(SMESHDS_AddQuadrangle);
com->AddVolume (NewID,idnode1,idnode2,idnode3,idnode4,idnode5); myCommands.insert(myCommands.end(),com);
}
}
com->AddVolume(NewID, idnode1, idnode2, idnode3, idnode4);
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Script::AddVolume(const Standard_Integer NewID, void SMESHDS_Script::AddVolume(int NewID,
const Standard_Integer idnode1, int idnode1, int idnode2, int idnode3, int idnode4, int idnode5)
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4,
const Standard_Integer idnode5,
const Standard_Integer idnode6)
{ {
Handle(SMESHDS_Command) com; SMESHDS_Command * com;
if (myCommands.IsEmpty()) { if (myCommands.empty())
com = new SMESHDS_Command(SMESHDS_AddPrism); {
myCommands.Append (com); com = new SMESHDS_Command(SMESHDS_AddPyramid);
} myCommands.insert(myCommands.end(),com);
else { }
com = myCommands.Last(); else
if (com->GetType() != SMESHDS_AddPrism) { {
com = new SMESHDS_Command(SMESHDS_AddPrism); com = myCommands.back();
myCommands.Append (com); if (com->GetType() != SMESHDS_AddPyramid)
} {
} com = new SMESHDS_Command(SMESHDS_AddPyramid);
com->AddVolume (NewID,idnode1,idnode2,idnode3,idnode4,idnode5,idnode6); myCommands.insert(myCommands.end(),com);
}
}
com->AddVolume(NewID, idnode1, idnode2, idnode3, idnode4, idnode5);
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Script::AddVolume(const Standard_Integer NewID, void SMESHDS_Script::AddVolume(int NewID,
const Standard_Integer idnode1, int idnode1,
const Standard_Integer idnode2, int idnode2, int idnode3, int idnode4, int idnode5, int idnode6)
const Standard_Integer idnode3,
const Standard_Integer idnode4,
const Standard_Integer idnode5,
const Standard_Integer idnode6,
const Standard_Integer idnode7,
const Standard_Integer idnode8)
{ {
Handle(SMESHDS_Command) com; SMESHDS_Command * com;
if (myCommands.IsEmpty()) { if (myCommands.empty())
com = new SMESHDS_Command(SMESHDS_AddHexahedron); {
myCommands.Append (com); com = new SMESHDS_Command(SMESHDS_AddPrism);
} myCommands.insert(myCommands.end(),com);
else { }
com = myCommands.Last(); else
if (com->GetType() != SMESHDS_AddHexahedron) { {
com = new SMESHDS_Command(SMESHDS_AddHexahedron); com = myCommands.back();
myCommands.Append (com); if (com->GetType() != SMESHDS_AddPrism)
} {
} com = new SMESHDS_Command(SMESHDS_AddPrism);
com->AddVolume (NewID,idnode1,idnode2,idnode3,idnode4, myCommands.insert(myCommands.end(),com);
idnode5,idnode6,idnode7,idnode8); }
}
com->AddVolume(NewID, idnode1, idnode2, idnode3, idnode4, idnode5, idnode6);
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Script::MoveNode(const Standard_Integer NewNodeID, void SMESHDS_Script::AddVolume(int NewID,
const Standard_Real x, int idnode1,
const Standard_Real y, int idnode2,
const Standard_Real z) int idnode3,
int idnode4, int idnode5, int idnode6, int idnode7, int idnode8)
{ {
Handle(SMESHDS_Command) com; SMESHDS_Command * com;
if (myCommands.IsEmpty()) { if (myCommands.empty())
com = new SMESHDS_Command(SMESHDS_MoveNode); {
myCommands.Append (com); com = new SMESHDS_Command(SMESHDS_AddHexahedron);
} myCommands.insert(myCommands.end(),com);
else { }
com = myCommands.Last(); else
if (com->GetType() != SMESHDS_MoveNode) { {
com = new SMESHDS_Command(SMESHDS_MoveNode); com = myCommands.back();
myCommands.Append (com); if (com->GetType() != SMESHDS_AddHexahedron)
} {
} com = new SMESHDS_Command(SMESHDS_AddHexahedron);
com->MoveNode (NewNodeID,x,y,z); myCommands.insert(myCommands.end(),com);
} }
}
com->AddVolume(NewID, idnode1, idnode2, idnode3, idnode4,
//======================================================================= idnode5, idnode6, idnode7, idnode8);
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::RemoveNode(const Standard_Integer ID)
{
Handle(SMESHDS_Command) com;
if (myCommands.IsEmpty()) {
com = new SMESHDS_Command(SMESHDS_RemoveNode);
myCommands.Append (com);
}
else {
com = myCommands.Last();
if (com->GetType() != SMESHDS_RemoveNode) {
com = new SMESHDS_Command(SMESHDS_RemoveNode);
myCommands.Append (com);
}
}
com->RemoveNode (ID);
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Script::RemoveElement(const Standard_Integer ElementID) void SMESHDS_Script::MoveNode(int NewNodeID, double x, double y, double z)
{ {
Handle(SMESHDS_Command) com; SMESHDS_Command * com;
if (myCommands.IsEmpty()) { if (myCommands.empty())
com = new SMESHDS_Command(SMESHDS_RemoveElement); {
myCommands.Append (com); com = new SMESHDS_Command(SMESHDS_MoveNode);
} myCommands.insert(myCommands.end(),com);
else { }
com = myCommands.Last(); else
if (com->GetType() != SMESHDS_RemoveElement) { {
com = new SMESHDS_Command(SMESHDS_RemoveElement); com = myCommands.back();
myCommands.Append (com); if (com->GetType() != SMESHDS_MoveNode)
} {
} com = new SMESHDS_Command(SMESHDS_MoveNode);
com->RemoveElement (ElementID); myCommands.insert(myCommands.end(),com);
}
}
com->MoveNode(NewNodeID, x, y, z);
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Script::Clear() void SMESHDS_Script::RemoveNode(int ID)
{ {
myCommands.Clear(); SMESHDS_Command * com;
if (myCommands.empty())
{
com = new SMESHDS_Command(SMESHDS_RemoveNode);
myCommands.insert(myCommands.end(),com);
}
else
{
com = myCommands.back();
if (com->GetType() != SMESHDS_RemoveNode)
{
com = new SMESHDS_Command(SMESHDS_RemoveNode);
myCommands.insert(myCommands.end(),com);
}
}
com->RemoveNode(ID);
} }
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
const SMESHDS_ListOfCommand& SMESHDS_Script::GetCommands() void SMESHDS_Script::RemoveElement(int ElementID)
{ {
return myCommands; SMESHDS_Command * com;
if (myCommands.empty())
{
com = new SMESHDS_Command(SMESHDS_RemoveElement);
myCommands.insert(myCommands.end(),com);
}
else
{
com = myCommands.back();
if (com->GetType() != SMESHDS_RemoveElement)
{
com = new SMESHDS_Command(SMESHDS_RemoveElement);
myCommands.insert(myCommands.end(),com);
}
}
com->RemoveElement(ElementID);
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::Clear()
{
myCommands.clear();
}
//=======================================================================
//function :
//purpose :
//=======================================================================
const list<SMESHDS_Command*>& SMESHDS_Script::GetCommands()
{
return myCommands;
} }

View File

@ -27,103 +27,35 @@
#ifndef _SMESHDS_Script_HeaderFile #ifndef _SMESHDS_Script_HeaderFile
#define _SMESHDS_Script_HeaderFile #define _SMESHDS_Script_HeaderFile
#ifndef _Standard_HeaderFile #include "SMESHDS_Command.hxx"
#include <Standard.hxx> #include <list>
#endif using namespace std;
#ifndef _Handle_SMESHDS_Script_HeaderFile
#include "Handle_SMESHDS_Script.hxx"
#endif
#ifndef _SMESHDS_ListOfCommand_HeaderFile
#include "SMESHDS_ListOfCommand.hxx"
#endif
#ifndef _MMgt_TShared_HeaderFile
#include <MMgt_TShared.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
class SMESHDS_ListOfCommand;
class SMESHDS_Script : public MMgt_TShared {
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// inline void operator delete(void *anAddress, size_t size)
// {
// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
// }
// Methods PUBLIC
//
Standard_EXPORT void AddNode(const Standard_Integer NewNodeID,const Standard_Real x,const Standard_Real y,const Standard_Real z) ;
Standard_EXPORT void AddEdge(const Standard_Integer NewEdgeID,const Standard_Integer idnode1,const Standard_Integer idnode2) ;
Standard_EXPORT void AddFace(const Standard_Integer NewFaceID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ;
Standard_EXPORT void AddFace(const Standard_Integer NewFaceID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ;
Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ;
Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5) ;
Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6) ;
Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8) ;
Standard_EXPORT void MoveNode(const Standard_Integer NewNodeID,const Standard_Real x,const Standard_Real y,const Standard_Real z) ;
Standard_EXPORT void RemoveNode(const Standard_Integer NodeID) ;
Standard_EXPORT void RemoveElement(const Standard_Integer ElementID) ;
Standard_EXPORT void Clear() ;
Standard_EXPORT const SMESHDS_ListOfCommand& GetCommands() ;
Standard_EXPORT ~SMESHDS_Script();
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& SMESHDS_Script_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
SMESHDS_ListOfCommand myCommands;
class SMESHDS_Script
{
public:
void AddNode(int NewNodeID, double x, double y, double z);
void AddEdge(int NewEdgeID, int idnode1, int idnode2);
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3);
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3,
int idnode4);
void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
int idnode4);
void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
int idnode4, int idnode5);
void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
int idnode4, int idnode5, int idnode6);
void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
int idnode4, int idnode5, int idnode6, int idnode7, int idnode8);
void MoveNode(int NewNodeID, double x, double y, double z);
void RemoveNode(int NodeID);
void RemoveElement(int ElementID);
void Clear();
const list<SMESHDS_Command*> & GetCommands();
~SMESHDS_Script();
private:
list<SMESHDS_Command*> myCommands;
}; };
// other inline functions and methods (like "C++: function call" methods)
//
#endif #endif

View File

@ -27,121 +27,128 @@
// $Header: // $Header:
using namespace std; using namespace std;
#include "SMESHDS_SubMesh.ixx" #include "SMESHDS_SubMesh.hxx"
#include "SMDS_MapIteratorOfExtendedMap.hxx"
//======================================================================= //=======================================================================
//function : SMESHDS_SubMesh //function : SMESHDS_SubMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
SMESHDS_SubMesh::SMESHDS_SubMesh(const Handle(SMDS_Mesh)& M) : myMesh(M) SMESHDS_SubMesh::SMESHDS_SubMesh(const SMDS_Mesh * M):myMesh(M)
{ {
myListOfEltIDIsUpdate = Standard_False; myListOfEltIDIsUpdate = false;
myListOfNodeIDIsUpdate = Standard_False; myListOfNodeIDIsUpdate = false;
} }
//======================================================================= //=======================================================================
//function : AddElement //function : AddElement
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_SubMesh::AddElement (const Handle(SMDS_MeshElement)& ME) void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
{ {
myElements.Add(ME); myElements.insert(ME);
myListOfEltIDIsUpdate = Standard_False; myListOfEltIDIsUpdate = false;
} }
//======================================================================= //=======================================================================
//function : RemoveElement //function : RemoveElement
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_SubMesh::RemoveElement(const Handle(SMDS_MeshElement)& ME) void SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME)
{ {
myElements.Remove(ME); myElements.erase(ME);
myListOfEltIDIsUpdate = Standard_False; myListOfEltIDIsUpdate = false;
} }
//======================================================================= //=======================================================================
//function : AddNode //function : AddNode
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_SubMesh::AddNode (const Handle(SMDS_MeshNode)& N) void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N)
{ {
myNodes.Add(N); myNodes.insert(N);
myListOfNodeIDIsUpdate = Standard_False; myListOfNodeIDIsUpdate = false;
} }
//======================================================================= //=======================================================================
//function : RemoveNode //function : RemoveNode
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_SubMesh::RemoveNode (const Handle(SMDS_MeshNode)& N) void SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N)
{ {
myNodes.Remove(N); myNodes.erase(N);
myListOfNodeIDIsUpdate = Standard_False; myListOfNodeIDIsUpdate = false;
} }
//======================================================================= //=======================================================================
//function : NbElements //function : NbElements
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer SMESHDS_SubMesh::NbElements() int SMESHDS_SubMesh::NbElements() const
{ {
return myElements.Extent(); return myElements.size();
} }
//======================================================================= //=======================================================================
//function : GetElements //function : GetElements
//purpose : //purpose :
//======================================================================= //=======================================================================
const SMDS_MapOfMeshElement& SMESHDS_SubMesh::GetElements() const set<const SMDS_MeshElement*> & SMESHDS_SubMesh::GetElements()
{ {
return myElements; return myElements;
} }
//======================================================================= //=======================================================================
//function : NbNodes //function : NbNodes
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer SMESHDS_SubMesh::NbNodes() int SMESHDS_SubMesh::NbNodes() const
{ {
return myNodes.Extent(); return myNodes.size();
} }
//======================================================================= //=======================================================================
//function : GetNodes //function : GetNodes
//purpose : //purpose :
//======================================================================= //=======================================================================
const SMDS_MapOfMeshElement& SMESHDS_SubMesh::GetNodes() const set<const SMDS_MeshNode*> & SMESHDS_SubMesh::GetNodes() const
{ {
return myNodes; return myNodes;
} }
//======================================================================= //=======================================================================
//function : GetIDElements //function : GetIDElements
//purpose : //purpose :
//======================================================================= //=======================================================================
const TColStd_ListOfInteger& SMESHDS_SubMesh::GetIDElements() const vector<int> & SMESHDS_SubMesh::GetIDElements()
{ {
if (!myListOfEltIDIsUpdate) { if (!myListOfEltIDIsUpdate)
myListOfEltID.Clear(); {
for (SMDS_MapIteratorOfExtendedMap it(myElements); it.More(); it.Next()) { myListOfEltID.clear();
myListOfEltID.Append(it.Key()->GetID()); set<const SMDS_MeshElement*>::iterator it=myElements.begin();
} for (; it!=myElements.end(); it++)
myListOfEltIDIsUpdate = Standard_True; {
} myListOfEltID.push_back((*it)->GetID());
return myListOfEltID; }
myListOfEltIDIsUpdate = true;
}
return myListOfEltID;
} }
//======================================================================= //=======================================================================
//function : GetIDNodes //function : GetIDNodes
//purpose : //purpose :
//======================================================================= //=======================================================================
const TColStd_ListOfInteger& SMESHDS_SubMesh::GetIDNodes() const vector<int> & SMESHDS_SubMesh::GetIDNodes()
{ {
if (!myListOfNodeIDIsUpdate) { if (!myListOfNodeIDIsUpdate)
myListOfNodeID.Clear(); {
for (SMDS_MapIteratorOfExtendedMap it(myNodes); it.More(); it.Next()) { myListOfNodeID.clear();
myListOfNodeID.Append(it.Key()->GetID()); set<const SMDS_MeshNode*>::iterator it=myNodes.begin();
} for (; it!=myNodes.end(); it++)
myListOfNodeIDIsUpdate = Standard_True; {
} myListOfNodeID.push_back((*it)->GetID());
return myListOfNodeID; }
myListOfNodeIDIsUpdate = true;
}
return myListOfNodeID;
} }

View File

@ -27,123 +27,34 @@
#ifndef _SMESHDS_SubMesh_HeaderFile #ifndef _SMESHDS_SubMesh_HeaderFile
#define _SMESHDS_SubMesh_HeaderFile #define _SMESHDS_SubMesh_HeaderFile
#ifndef _Standard_HeaderFile #include "SMDS_Mesh.hxx"
#include <Standard.hxx> #include <vector>
#endif #include <set>
#ifndef _Handle_SMESHDS_SubMesh_HeaderFile
#include "Handle_SMESHDS_SubMesh.hxx"
#endif
#ifndef _Handle_SMDS_Mesh_HeaderFile
#include "Handle_SMDS_Mesh.hxx"
#endif
#ifndef _SMDS_MapOfMeshElement_HeaderFile
#include "SMDS_MapOfMeshElement.hxx"
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _TColStd_ListOfInteger_HeaderFile
#include <TColStd_ListOfInteger.hxx>
#endif
#ifndef _MMgt_TShared_HeaderFile
#include <MMgt_TShared.hxx>
#endif
#ifndef _Handle_SMDS_MeshElement_HeaderFile
#include "Handle_SMDS_MeshElement.hxx"
#endif
#ifndef _Handle_SMDS_MeshNode_HeaderFile
#include "Handle_SMDS_MeshNode.hxx"
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
class SMDS_Mesh;
class SMDS_MeshElement;
class SMDS_MeshNode;
class SMDS_MapOfMeshElement;
class TColStd_ListOfInteger;
class SMESHDS_SubMesh : public MMgt_TShared {
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// inline void operator delete(void *anAddress, size_t size)
// {
// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
// }
// Methods PUBLIC
//
Standard_EXPORT SMESHDS_SubMesh(const Handle(SMDS_Mesh)& M);
Standard_EXPORT void AddElement(const Handle(SMDS_MeshElement)& ME) ;
Standard_EXPORT void RemoveElement(const Handle(SMDS_MeshElement)& ME) ;
Standard_EXPORT void AddNode(const Handle(SMDS_MeshNode)& ME) ;
Standard_EXPORT void RemoveNode(const Handle(SMDS_MeshNode)& ME) ;
Standard_EXPORT Standard_Integer NbElements() ;
Standard_EXPORT const SMDS_MapOfMeshElement& GetElements() ;
Standard_EXPORT const TColStd_ListOfInteger& GetIDElements() ;
Standard_EXPORT Standard_Integer NbNodes() ;
Standard_EXPORT const SMDS_MapOfMeshElement& GetNodes() ;
Standard_EXPORT const TColStd_ListOfInteger& GetIDNodes() ;
Standard_EXPORT ~SMESHDS_SubMesh();
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& SMESHDS_SubMesh_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Handle_SMDS_Mesh myMesh;
SMDS_MapOfMeshElement myElements;
SMDS_MapOfMeshElement myNodes;
Standard_Boolean myListOfEltIDIsUpdate;
TColStd_ListOfInteger myListOfEltID;
Standard_Boolean myListOfNodeIDIsUpdate;
TColStd_ListOfInteger myListOfNodeID;
using namespace std;
class SMESHDS_SubMesh
{
public:
SMESHDS_SubMesh(const SMDS_Mesh * M);
void AddElement(const SMDS_MeshElement * ME);
void RemoveElement(const SMDS_MeshElement * ME);
void AddNode(const SMDS_MeshNode * ME);
void RemoveNode(const SMDS_MeshNode * ME);
int NbElements() const;
const set<const SMDS_MeshElement*> & GetElements();
const vector<int> & GetIDElements();
int NbNodes() const;
const set<const SMDS_MeshNode*> & GetNodes() const;
const vector<int> & GetIDNodes();
~SMESHDS_SubMesh();
private:
const SMDS_Mesh * myMesh;
set<const SMDS_MeshElement*> myElements;
set<const SMDS_MeshNode*> myNodes;
bool myListOfEltIDIsUpdate;
vector<int> myListOfEltID;
bool myListOfNodeIDIsUpdate;
vector<int> myListOfNodeID;
}; };
// other inline functions and methods (like "C++: function call" methods)
//
#endif #endif