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
LIB = libSMESHDS.la
LIB_SRC = SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_0.cxx \
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 \
LIB_SRC = \
SMESHDS_Document.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_Command.cxx \
SMESHDS_SubMesh.cxx
SMESHDS_SubMesh.cxx \
SMESHDS_Mesh.cxx
LIB_CLIENT_IDL =
LIB_SERVER_IDL =
@ -77,47 +54,10 @@ BIN_CLIENT_IDL =
BIN_SERVER_IDL =
# header files
EXPORT_HEADERS= Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx \
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 \
EXPORT_HEADERS= \
SMESHDS_Document.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_PtrHypothesis.hxx \
SMESHDS_Script.hxx \
SMESHDS_Command.hxx \
SMESHDS_CommandType.hxx \
@ -126,7 +66,7 @@ EXPORT_HEADERS= Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx \
# additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) -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
@ -135,4 +75,3 @@ CLEAN =
DISTCLEAN =
@CONCLUDE@

View File

@ -27,35 +27,33 @@
// $Header:
using namespace std;
#include "SMESHDS_Command.ixx"
#include "SMESHDS_CommandType.hxx"
#include "SMESHDS_Command.hxx"
#include "utilities.h"
//=======================================================================
//function :
//purpose :
//=======================================================================
SMESHDS_Command::SMESHDS_Command(const SMESHDS_CommandType aType)
: myType(aType), myNumber(0)
{}
SMESHDS_Command::SMESHDS_Command(const SMESHDS_CommandType aType):myType(aType),
myNumber(0)
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::AddNode(const Standard_Integer NewNodeID,
const Standard_Real x,
const Standard_Real y,
const Standard_Real z)
void SMESHDS_Command::AddNode(int NewNodeID, double x, double y, double z)
{
if (!myType == SMESHDS_AddNode)
{
if (!myType == SMESHDS_AddNode) {
MESSAGE("SMESHDS_Command::AddNode : Bad Type");
return;
}
myIntegers.Append(NewNodeID);
myReals.Append(x);
myReals.Append(y);
myReals.Append(z);
myIntegers.push_back(NewNodeID);
myReals.push_back(x);
myReals.push_back(y);
myReals.push_back(z);
myNumber++;
}
@ -63,19 +61,17 @@ void SMESHDS_Command::AddNode(const Standard_Integer NewNodeID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::MoveNode(const Standard_Integer NodeID,
const Standard_Real x,
const Standard_Real y,
const Standard_Real z)
void SMESHDS_Command::MoveNode(int NodeID, double x, double y, double z)
{
if (!myType == SMESHDS_MoveNode)
{
if (!myType == SMESHDS_MoveNode) {
MESSAGE("SMESHDS_Command::MoveNode : Bad Type");
return;
}
myIntegers.Append(NodeID);
myReals.Append(x);
myReals.Append(y);
myReals.Append(z);
myIntegers.push_back(NodeID);
myReals.push_back(x);
myReals.push_back(y);
myReals.push_back(z);
myNumber++;
}
@ -83,17 +79,16 @@ void SMESHDS_Command::MoveNode(const Standard_Integer NodeID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::AddEdge(const Standard_Integer NewEdgeID,
const Standard_Integer idnode1,
const Standard_Integer idnode2)
void SMESHDS_Command::AddEdge(int NewEdgeID, int idnode1, int idnode2)
{
if (!myType == SMESHDS_AddEdge)
{
if (!myType == SMESHDS_AddEdge) {
MESSAGE("SMESHDS_Command::AddEdge : Bad Type");
return;
}
myIntegers.Append(NewEdgeID);
myIntegers.Append(idnode1);
myIntegers.Append(idnode2);
myIntegers.push_back(NewEdgeID);
myIntegers.push_back(idnode1);
myIntegers.push_back(idnode2);
myNumber++;
}
@ -101,19 +96,18 @@ void SMESHDS_Command::AddEdge(const Standard_Integer NewEdgeID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::AddFace(const Standard_Integer NewFaceID,
const Standard_Integer idnode1,
const Standard_Integer idnode2,
const Standard_Integer idnode3)
void SMESHDS_Command::AddFace(int NewFaceID,
int idnode1, int idnode2, int idnode3)
{
if (!myType == SMESHDS_AddTriangle)
{
if (!myType == SMESHDS_AddTriangle) {
MESSAGE("SMESHDS_Command::AddFace : Bad Type");
return;
}
myIntegers.Append(NewFaceID);
myIntegers.Append(idnode1);
myIntegers.Append(idnode2);
myIntegers.Append(idnode3);
myIntegers.push_back(NewFaceID);
myIntegers.push_back(idnode1);
myIntegers.push_back(idnode2);
myIntegers.push_back(idnode3);
myNumber++;
}
@ -121,21 +115,19 @@ void SMESHDS_Command::AddFace(const Standard_Integer NewFaceID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::AddFace(const Standard_Integer NewFaceID,
const Standard_Integer idnode1,
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4)
void SMESHDS_Command::AddFace(int NewFaceID,
int idnode1, int idnode2, int idnode3, int idnode4)
{
if (!myType == SMESHDS_AddQuadrangle)
{
if (!myType == SMESHDS_AddQuadrangle) {
MESSAGE("SMESHDS_Command::AddFace : Bad Type");
return;
}
myIntegers.Append(NewFaceID);
myIntegers.Append(idnode1);
myIntegers.Append(idnode2);
myIntegers.Append(idnode3);
myIntegers.Append(idnode4);
myIntegers.push_back(NewFaceID);
myIntegers.push_back(idnode1);
myIntegers.push_back(idnode2);
myIntegers.push_back(idnode3);
myIntegers.push_back(idnode4);
myNumber++;
}
@ -143,21 +135,19 @@ void SMESHDS_Command::AddFace(const Standard_Integer NewFaceID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::AddVolume(const Standard_Integer NewVolID,
const Standard_Integer idnode1,
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4)
void SMESHDS_Command::AddVolume(int NewVolID,
int idnode1, int idnode2, int idnode3, int idnode4)
{
if (!myType == SMESHDS_AddTetrahedron)
{
if (!myType == SMESHDS_AddTetrahedron) {
MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
return;
}
myIntegers.Append(NewVolID);
myIntegers.Append(idnode1);
myIntegers.Append(idnode2);
myIntegers.Append(idnode3);
myIntegers.Append(idnode4);
myIntegers.push_back(NewVolID);
myIntegers.push_back(idnode1);
myIntegers.push_back(idnode2);
myIntegers.push_back(idnode3);
myIntegers.push_back(idnode4);
myNumber++;
}
@ -165,23 +155,20 @@ void SMESHDS_Command::AddVolume(const Standard_Integer NewVolID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::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)
void SMESHDS_Command::AddVolume(int NewVolID,
int idnode1, int idnode2, int idnode3, int idnode4, int idnode5)
{
if (!myType == SMESHDS_AddPyramid)
{
if (!myType == SMESHDS_AddPyramid) {
MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
return;
}
myIntegers.Append(NewVolID);
myIntegers.Append(idnode1);
myIntegers.Append(idnode2);
myIntegers.Append(idnode3);
myIntegers.Append(idnode4);
myIntegers.Append(idnode5);
myIntegers.push_back(NewVolID);
myIntegers.push_back(idnode1);
myIntegers.push_back(idnode2);
myIntegers.push_back(idnode3);
myIntegers.push_back(idnode4);
myIntegers.push_back(idnode5);
myNumber++;
}
@ -189,25 +176,22 @@ void SMESHDS_Command::AddVolume(const Standard_Integer NewVolID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::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)
void SMESHDS_Command::AddVolume(int NewVolID,
int idnode1,
int idnode2, int idnode3, int idnode4, int idnode5, int idnode6)
{
if (!myType == SMESHDS_AddPrism)
{
if (!myType == SMESHDS_AddPrism) {
MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
return;
}
myIntegers.Append(NewVolID);
myIntegers.Append(idnode1);
myIntegers.Append(idnode2);
myIntegers.Append(idnode3);
myIntegers.Append(idnode4);
myIntegers.Append(idnode5);
myIntegers.Append(idnode6);
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);
myNumber++;
}
@ -215,29 +199,26 @@ void SMESHDS_Command::AddVolume(const Standard_Integer NewVolID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::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)
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_AddHexahedron)
{
if (!myType == SMESHDS_AddHexahedron) {
MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
return;
}
myIntegers.Append(NewVolID);
myIntegers.Append(idnode1);
myIntegers.Append(idnode2);
myIntegers.Append(idnode3);
myIntegers.Append(idnode4);
myIntegers.Append(idnode5);
myIntegers.Append(idnode6);
myIntegers.Append(idnode7);
myIntegers.Append(idnode8);
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++;
}
@ -245,13 +226,14 @@ void SMESHDS_Command::AddVolume(const Standard_Integer NewVolID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::RemoveNode(const Standard_Integer NodeID)
void SMESHDS_Command::RemoveNode(int NodeID)
{
if (!myType == SMESHDS_RemoveNode)
{
if (!myType == SMESHDS_RemoveNode) {
MESSAGE("SMESHDS_Command::RemoveNode : Bad Type");
return;
}
myIntegers.Append(NodeID);
myIntegers.push_back(NodeID);
myNumber++;
}
@ -259,13 +241,14 @@ void SMESHDS_Command::RemoveNode(const Standard_Integer NodeID)
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::RemoveElement(const Standard_Integer ElementID)
void SMESHDS_Command::RemoveElement(int ElementID)
{
if (!myType == SMESHDS_RemoveElement)
{
if (!myType == SMESHDS_RemoveElement) {
MESSAGE("SMESHDS_Command::RemoveElement : Bad Type");
return;
}
myIntegers.Append(ElementID);
myIntegers.push_back(ElementID);
myNumber++;
}
@ -282,7 +265,7 @@ SMESHDS_CommandType SMESHDS_Command::GetType()
//function :
//purpose :
//=======================================================================
Standard_Integer SMESHDS_Command::GetNumber()
int SMESHDS_Command::GetNumber()
{
return myNumber;
}
@ -291,7 +274,7 @@ Standard_Integer SMESHDS_Command::GetNumber()
//function :
//purpose :
//=======================================================================
const TColStd_ListOfInteger& SMESHDS_Command::GetIndexes()
const list < int >&SMESHDS_Command::GetIndexes()
{
return myIntegers;
}
@ -300,7 +283,7 @@ const TColStd_ListOfInteger& SMESHDS_Command::GetIndexes()
//function :
//purpose :
//=======================================================================
const TColStd_ListOfReal& SMESHDS_Command::GetCoords()
const list < double >&SMESHDS_Command::GetCoords()
{
return myReals;
}

View File

@ -27,116 +27,39 @@
#ifndef _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"
#endif
#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;
#include <list>
class SMESHDS_Command : public MMgt_TShared {
class SMESHDS_Command
{
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
//
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:
// Methods PRIVATE
//
// Fields PRIVATE
//
SMESHDS_CommandType myType;
Standard_Integer myNumber;
TColStd_ListOfReal myReals;
TColStd_ListOfInteger myIntegers;
int myNumber;
list<double> myReals;
list<int> myIntegers;
};
// other inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -27,28 +27,27 @@
// $Header:
using namespace std;
#include "SMESHDS_Document.ixx"
#include "SMESHDS_Hypothesis.hxx"
#include <Standard_OutOfRange.hxx>
#include "SMESHDS_Document.hxx"
#include <utilities.h>
//=======================================================================
//function : Create
//purpose :
//=======================================================================
SMESHDS_Document::SMESHDS_Document(const Standard_Integer UserID): myUserID(UserID)
{}
SMESHDS_Document::SMESHDS_Document(int UserID):myUserID(UserID)
{
}
//=======================================================================
//function : NewMesh
//purpose :
//=======================================================================
Standard_Integer SMESHDS_Document::NewMesh()
int SMESHDS_Document::NewMesh()
{
static Standard_Integer NewMeshID = 0;
static int NewMeshID = 0;
NewMeshID++;
Handle (SMESHDS_Mesh) aNewMesh = new SMESHDS_Mesh (NewMeshID);
myMeshes.Bind(NewMeshID ,aNewMesh);
SMESHDS_Mesh *aNewMesh = new SMESHDS_Mesh(NewMeshID);
myMeshes[NewMeshID] = aNewMesh;
return NewMeshID;
}
@ -56,71 +55,81 @@ Standard_Integer SMESHDS_Document::NewMesh()
//function : GetMesh
//purpose :
//=======================================================================
Handle(SMESHDS_Mesh) SMESHDS_Document::GetMesh(const Standard_Integer MeshID)
SMESHDS_Mesh *SMESHDS_Document::GetMesh(int MeshID)
{
if (!myMeshes.IsBound(MeshID))
Standard_OutOfRange::Raise("SMESHDS_Document::RemoveMesh");
return myMeshes.Find(MeshID);
map<int,SMESHDS_Mesh*>::iterator it=myMeshes.find(MeshID);
if (it==myMeshes.end())
{
MESSAGE("SMESHDS_Document::GetMesh : ID not found");
return NULL;
}
else return (*it).second;
}
//=======================================================================
//function : RemoveMesh
//purpose :
//=======================================================================
void SMESHDS_Document::RemoveMesh(const Standard_Integer MeshID)
void SMESHDS_Document::RemoveMesh(int MeshID)
{
if (!myMeshes.IsBound(MeshID))
Standard_OutOfRange::Raise("SMESHDS_Document::RemoveMesh");
myMeshes.UnBind(MeshID);
map<int,SMESHDS_Mesh*>::iterator it=myMeshes.find(MeshID);
if (it==myMeshes.end())
MESSAGE("SMESHDS_Document::RemoveMesh : ID not found");
myMeshes.erase(it);
}
//=======================================================================
//function : AddHypothesis
//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
//purpose :
//=======================================================================
SMESHDS_PtrHypothesis SMESHDS_Document::GetHypothesis(const Standard_Integer HypID)
SMESHDS_Hypothesis * SMESHDS_Document::GetHypothesis(int HypID)
{
if (!myHypothesis.IsBound(HypID))
Standard_OutOfRange::Raise("SMESHDS_Document::GetHypothesis");
return myHypothesis.Find(HypID);
map<int,SMESHDS_Hypothesis*>::iterator it=myHypothesis.find(HypID);
if (it==myHypothesis.end())
{
MESSAGE("SMESHDS_Document::GetHypothesis : ID not found");
return NULL;
}
else return (*it).second;
}
//=======================================================================
//function : RemoveHypothesis
//purpose :
//=======================================================================
void SMESHDS_Document::RemoveHypothesis(const Standard_Integer HypID)
void SMESHDS_Document::RemoveHypothesis(int HypID)
{
if (!myHypothesis.IsBound(HypID))
Standard_OutOfRange::Raise("SMESHDS_Document::RemoveHypothesis");
myMeshes.UnBind(HypID);
map<int,SMESHDS_Hypothesis*>::iterator it=myHypothesis.find(HypID);
if (it==myHypothesis.end())
MESSAGE("SMESHDS_Document::RemoveHypothesis : ID not found");
myHypothesis.erase(it);
}
//=======================================================================
//function : NbMeshes
//purpose :
//=======================================================================
Standard_Integer SMESHDS_Document::NbMeshes()
int SMESHDS_Document::NbMeshes()
{
return myMeshes.Extent();
return myMeshes.size();
}
//=======================================================================
//function : NbHypothesis
//purpose :
//=======================================================================
Standard_Integer SMESHDS_Document::NbHypothesis()
int SMESHDS_Document::NbHypothesis()
{
return myHypothesis.Extent();
return myHypothesis.size();
}
//=======================================================================
@ -129,31 +138,27 @@ Standard_Integer SMESHDS_Document::NbHypothesis()
//=======================================================================
void SMESHDS_Document::InitMeshesIterator()
{
myMeshesIt.Initialize(myMeshes);
myMeshesIt=myMeshes.begin();
}
//=======================================================================
//function : NextMesh
//purpose :
//=======================================================================
void SMESHDS_Document::NextMesh()
SMESHDS_Mesh * SMESHDS_Document::NextMesh()
{
myMeshesIt.Next();
SMESHDS_Mesh * toReturn=(*myMeshesIt).second;
myMeshesIt++;
return toReturn;
}
//=======================================================================
//function : MoreMesh
//purpose :
//=======================================================================
Standard_Boolean SMESHDS_Document::MoreMesh()
bool SMESHDS_Document::MoreMesh()
{
return myMeshesIt.More();
}
//=======================================================================
//function : CurrentMesh
//purpose :
//=======================================================================
Handle_SMESHDS_Mesh SMESHDS_Document::CurrentMesh()
{
return myMeshesIt.Value();
return myMeshesIt!=myMeshes.end();
}
//=======================================================================
@ -162,31 +167,25 @@ Handle_SMESHDS_Mesh SMESHDS_Document::CurrentMesh()
//=======================================================================
void SMESHDS_Document::InitHypothesisIterator()
{
myHypothesisIt.Initialize(myHypothesis);
myHypothesisIt=myHypothesis.begin();
}
//=======================================================================
//function : NextMesh
//purpose :
//=======================================================================
void SMESHDS_Document::NextHypothesis()
SMESHDS_Hypothesis * SMESHDS_Document::NextHypothesis()
{
myHypothesisIt.Next();
SMESHDS_Hypothesis * toReturn=(*myHypothesisIt).second;
myHypothesisIt++;
return toReturn;
}
//=======================================================================
//function : MoreMesh
//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
#define _SMESHDS_Document_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Handle_SMESHDS_Document_HeaderFile
#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 {
#include <map>
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_Hypothesis.hxx"
using namespace std;
class SMESHDS_Document
{
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
//
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:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_Integer myUserID;
SMESHDS_DataMapOfIntegerMesh myMeshes;
SMESHDS_DataMapOfIntegerPtrHypothesis myHypothesis;
SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh myMeshesIt;
SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis myHypothesisIt;
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

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");
// SCRUTE(_name);
@ -77,7 +77,7 @@ const char* SMESHDS_Hypothesis::GetName()
*/
//=============================================================================
int SMESHDS_Hypothesis::GetID()
int SMESHDS_Hypothesis::GetID() const
{
// MESSAGE("SMESHDS_Hypothesis::GetId");
// SCRUTE(_hypId);
@ -90,7 +90,7 @@ int SMESHDS_Hypothesis::GetID()
*/
//=============================================================================
int SMESHDS_Hypothesis::GetType()
int SMESHDS_Hypothesis::GetType() const
{
// MESSAGE("SMESHDS_Hypothesis::GetType");
// SCRUTE(_type);

View File

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

View File

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

View File

@ -27,171 +27,87 @@
#ifndef _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"
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _SMESHDS_PtrHypothesis_HeaderFile
#include "SMESHDS_PtrHypothesis.hxx"
#endif
#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 "SMDS_MeshNode.hxx"
#include "SMDS_MeshEdge.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx"
#include "SMESHDS_Hypothesis.hxx"
#include "SMESHDS_SubMesh.hxx"
#include "SMESHDS_Script.hxx"
#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;
class SMESHDS_Mesh:public SMDS_Mesh
{
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_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
//
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:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_Integer myMeshID;
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;
SMESHDS_DataMapOfIntegerSubMesh myShapeIndexToSubMesh;
SMESHDS_DataMapOfShapeListOfPtrHypothesis myShapeToHypothesis;
Handle_SMESHDS_Script myScript;
map<int,SMESHDS_SubMesh*> myShapeIndexToSubMesh;
ShapeToHypothesis myShapeToHypothesis;
SMESHDS_Script * myScript;
};
// other inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -27,54 +27,51 @@
// $Header:
using namespace std;
#include "SMESHDS_Script.ixx"
#include "SMESHDS_Command.hxx"
#include "SMESHDS_CommandType.hxx"
#include "SMESHDS_ListOfCommand.hxx"
#include "SMESHDS_Script.hxx"
//=======================================================================
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::AddNode(const Standard_Integer NewNodeID,
const Standard_Real x,
const Standard_Real y,
const Standard_Real z)
void SMESHDS_Script::AddNode(int NewNodeID, double x, double y, double z)
{
SMESHDS_Command* com;
if (myCommands.empty())
{
Handle(SMESHDS_Command) com;
if (myCommands.IsEmpty()) {
com = new SMESHDS_Command(SMESHDS_AddNode);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
else {
com = myCommands.Last();
if (com->GetType() != SMESHDS_AddNode) {
else
{
com = myCommands.back();
if (com->GetType() != SMESHDS_AddNode)
{
com = new SMESHDS_Command(SMESHDS_AddNode);
myCommands.Append (com);
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)
void SMESHDS_Script::AddEdge(int NewEdgeID, int idnode1, int idnode2)
{
SMESHDS_Command* com;
if (myCommands.empty())
{
Handle(SMESHDS_Command) com;
if (myCommands.IsEmpty()) {
com = new SMESHDS_Command(SMESHDS_AddEdge);
myCommands.Append (com);
myCommands.insert(myCommands.end(), com);
}
else {
com = myCommands.Last();
if (com->GetType() != SMESHDS_AddEdge) {
else
{
com = myCommands.back();
if (com->GetType() != SMESHDS_AddEdge)
{
com = new SMESHDS_Command(SMESHDS_AddEdge);
myCommands.Append (com);
myCommands.insert(myCommands.end(), com);
}
}
com->AddEdge(NewEdgeID, idnode1, idnode2);
@ -84,21 +81,22 @@ void SMESHDS_Script::AddEdge(const Standard_Integer NewEdgeID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::AddFace(const Standard_Integer NewFaceID,
const Standard_Integer idnode1,
const Standard_Integer idnode2,
const Standard_Integer idnode3)
void SMESHDS_Script::AddFace(int NewFaceID,
int idnode1, int idnode2, int idnode3)
{
SMESHDS_Command * com;
if (myCommands.empty())
{
Handle(SMESHDS_Command) com;
if (myCommands.IsEmpty()) {
com = new SMESHDS_Command(SMESHDS_AddTriangle);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
else {
com = myCommands.Last();
if (com->GetType() != SMESHDS_AddTriangle) {
else
{
com = myCommands.back();
if (com->GetType() != SMESHDS_AddTriangle)
{
com = new SMESHDS_Command(SMESHDS_AddTriangle);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
}
com->AddFace(NewFaceID, idnode1, idnode2, idnode3);
@ -108,22 +106,22 @@ void SMESHDS_Script::AddFace(const Standard_Integer NewFaceID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::AddFace(const Standard_Integer NewFaceID,
const Standard_Integer idnode1,
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4)
void SMESHDS_Script::AddFace(int NewFaceID,
int idnode1, int idnode2, int idnode3, int idnode4)
{
SMESHDS_Command * com;
if (myCommands.empty())
{
Handle(SMESHDS_Command) com;
if (myCommands.IsEmpty()) {
com = new SMESHDS_Command(SMESHDS_AddQuadrangle);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
else {
com = myCommands.Last();
if (com->GetType() != SMESHDS_AddQuadrangle) {
else
{
com = myCommands.back();
if (com->GetType() != SMESHDS_AddQuadrangle)
{
com = new SMESHDS_Command(SMESHDS_AddQuadrangle);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
}
com->AddFace(NewFaceID, idnode1, idnode2, idnode3, idnode4);
@ -133,22 +131,22 @@ void SMESHDS_Script::AddFace(const Standard_Integer NewFaceID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::AddVolume(const Standard_Integer NewID,
const Standard_Integer idnode1,
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4)
void SMESHDS_Script::AddVolume(int NewID,
int idnode1, int idnode2, int idnode3, int idnode4)
{
SMESHDS_Command * com;
if (myCommands.empty())
{
Handle(SMESHDS_Command) com;
if (myCommands.IsEmpty()) {
com = new SMESHDS_Command(SMESHDS_AddTetrahedron);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
else {
com = myCommands.Last();
if (com->GetType() != SMESHDS_AddQuadrangle) {
else
{
com = myCommands.back();
if (com->GetType() != SMESHDS_AddQuadrangle)
{
com = new SMESHDS_Command(SMESHDS_AddQuadrangle);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
}
com->AddVolume(NewID, idnode1, idnode2, idnode3, idnode4);
@ -158,23 +156,22 @@ void SMESHDS_Script::AddVolume(const Standard_Integer NewID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::AddVolume(const Standard_Integer NewID,
const Standard_Integer idnode1,
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4,
const Standard_Integer idnode5)
void SMESHDS_Script::AddVolume(int NewID,
int idnode1, int idnode2, int idnode3, int idnode4, int idnode5)
{
SMESHDS_Command * com;
if (myCommands.empty())
{
Handle(SMESHDS_Command) com;
if (myCommands.IsEmpty()) {
com = new SMESHDS_Command(SMESHDS_AddPyramid);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
else {
com = myCommands.Last();
if (com->GetType() != SMESHDS_AddPyramid) {
else
{
com = myCommands.back();
if (com->GetType() != SMESHDS_AddPyramid)
{
com = new SMESHDS_Command(SMESHDS_AddPyramid);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
}
com->AddVolume(NewID, idnode1, idnode2, idnode3, idnode4, idnode5);
@ -184,24 +181,23 @@ void SMESHDS_Script::AddVolume(const Standard_Integer NewID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::AddVolume(const Standard_Integer NewID,
const Standard_Integer idnode1,
const Standard_Integer idnode2,
const Standard_Integer idnode3,
const Standard_Integer idnode4,
const Standard_Integer idnode5,
const Standard_Integer idnode6)
void SMESHDS_Script::AddVolume(int NewID,
int idnode1,
int idnode2, int idnode3, int idnode4, int idnode5, int idnode6)
{
SMESHDS_Command * com;
if (myCommands.empty())
{
Handle(SMESHDS_Command) com;
if (myCommands.IsEmpty()) {
com = new SMESHDS_Command(SMESHDS_AddPrism);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
else {
com = myCommands.Last();
if (com->GetType() != SMESHDS_AddPrism) {
else
{
com = myCommands.back();
if (com->GetType() != SMESHDS_AddPrism)
{
com = new SMESHDS_Command(SMESHDS_AddPrism);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
}
com->AddVolume(NewID, idnode1, idnode2, idnode3, idnode4, idnode5, idnode6);
@ -211,26 +207,25 @@ void SMESHDS_Script::AddVolume(const Standard_Integer NewID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::AddVolume(const Standard_Integer NewID,
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)
void SMESHDS_Script::AddVolume(int NewID,
int idnode1,
int idnode2,
int idnode3,
int idnode4, int idnode5, int idnode6, int idnode7, int idnode8)
{
SMESHDS_Command * com;
if (myCommands.empty())
{
Handle(SMESHDS_Command) com;
if (myCommands.IsEmpty()) {
com = new SMESHDS_Command(SMESHDS_AddHexahedron);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
else {
com = myCommands.Last();
if (com->GetType() != SMESHDS_AddHexahedron) {
else
{
com = myCommands.back();
if (com->GetType() != SMESHDS_AddHexahedron)
{
com = new SMESHDS_Command(SMESHDS_AddHexahedron);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
}
com->AddVolume(NewID, idnode1, idnode2, idnode3, idnode4,
@ -241,43 +236,45 @@ void SMESHDS_Script::AddVolume(const Standard_Integer NewID,
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::MoveNode(const Standard_Integer NewNodeID,
const Standard_Real x,
const Standard_Real y,
const Standard_Real z)
void SMESHDS_Script::MoveNode(int NewNodeID, double x, double y, double z)
{
SMESHDS_Command * com;
if (myCommands.empty())
{
Handle(SMESHDS_Command) com;
if (myCommands.IsEmpty()) {
com = new SMESHDS_Command(SMESHDS_MoveNode);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
else {
com = myCommands.Last();
if (com->GetType() != SMESHDS_MoveNode) {
else
{
com = myCommands.back();
if (com->GetType() != SMESHDS_MoveNode)
{
com = new SMESHDS_Command(SMESHDS_MoveNode);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
}
com->MoveNode(NewNodeID, x, y, z);
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::RemoveNode(const Standard_Integer ID)
void SMESHDS_Script::RemoveNode(int ID)
{
SMESHDS_Command * com;
if (myCommands.empty())
{
Handle(SMESHDS_Command) com;
if (myCommands.IsEmpty()) {
com = new SMESHDS_Command(SMESHDS_RemoveNode);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
else {
com = myCommands.Last();
if (com->GetType() != SMESHDS_RemoveNode) {
else
{
com = myCommands.back();
if (com->GetType() != SMESHDS_RemoveNode)
{
com = new SMESHDS_Command(SMESHDS_RemoveNode);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
}
com->RemoveNode(ID);
@ -287,18 +284,21 @@ void SMESHDS_Script::RemoveNode(const Standard_Integer ID)
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::RemoveElement(const Standard_Integer ElementID)
void SMESHDS_Script::RemoveElement(int ElementID)
{
SMESHDS_Command * com;
if (myCommands.empty())
{
Handle(SMESHDS_Command) com;
if (myCommands.IsEmpty()) {
com = new SMESHDS_Command(SMESHDS_RemoveElement);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
else {
com = myCommands.Last();
if (com->GetType() != SMESHDS_RemoveElement) {
else
{
com = myCommands.back();
if (com->GetType() != SMESHDS_RemoveElement)
{
com = new SMESHDS_Command(SMESHDS_RemoveElement);
myCommands.Append (com);
myCommands.insert(myCommands.end(),com);
}
}
com->RemoveElement(ElementID);
@ -310,14 +310,14 @@ void SMESHDS_Script::RemoveNode(const Standard_Integer ID)
//=======================================================================
void SMESHDS_Script::Clear()
{
myCommands.Clear();
myCommands.clear();
}
//=======================================================================
//function :
//purpose :
//=======================================================================
const SMESHDS_ListOfCommand& SMESHDS_Script::GetCommands()
const list<SMESHDS_Command*>& SMESHDS_Script::GetCommands()
{
return myCommands;
}

View File

@ -27,103 +27,35 @@
#ifndef _SMESHDS_Script_HeaderFile
#define _SMESHDS_Script_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#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 {
#include "SMESHDS_Command.hxx"
#include <list>
using namespace std;
class SMESHDS_Script
{
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
//
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:
// Methods PRIVATE
//
// Fields PRIVATE
//
SMESHDS_ListOfCommand myCommands;
list<SMESHDS_Command*> myCommands;
};
// other inline functions and methods (like "C++: function call" methods)
//
#endif

View File

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

View File

@ -27,123 +27,34 @@
#ifndef _SMESHDS_SubMesh_HeaderFile
#define _SMESHDS_SubMesh_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Handle_SMESHDS_SubMesh_HeaderFile
#include "Handle_SMESHDS_SubMesh.hxx"
#endif
#include "SMDS_Mesh.hxx"
#include <vector>
#include <set>
#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 {
using namespace std;
class SMESHDS_SubMesh
{
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
//
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:
// 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;
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