From: jrt Date: Wed, 3 Sep 2003 17:29:04 +0000 (+0000) Subject: Remove Opencascade dependencies X-Git-Tag: V1_2_2~39 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=13b8c20dfc9f5bedf2dd4699ac1e05a8d4227791;p=modules%2Fsmesh.git Remove Opencascade dependencies --- diff --git a/src/SMDS/SMDS_EdgePosition.cxx b/src/SMDS/SMDS_EdgePosition.cxx index d9d4caecd..e2f7d9755 100644 --- a/src/SMDS/SMDS_EdgePosition.cxx +++ b/src/SMDS/SMDS_EdgePosition.cxx @@ -25,8 +25,7 @@ // Author : Jean-Michel BOULCOURT // Module : SMESH -using namespace std; -#include "SMDS_EdgePosition.ixx" +#include "SMDS_EdgePosition.hxx" #include "utilities.h" //======================================================================= @@ -34,29 +33,41 @@ using namespace std; //purpose : //======================================================================= -SMDS_EdgePosition::SMDS_EdgePosition() - :SMDS_Position(0,SMDS_TOP_EDGE),myUParameter(0.) +SMDS_EdgePosition::SMDS_EdgePosition(const int aEdgeId, + const double aUParam):SMDS_Position(aEdgeId), myUParameter(aUParam) { } //======================================================================= -//function : SMDS_EdgePosition +//function : Coords //purpose : //======================================================================= -SMDS_EdgePosition::SMDS_EdgePosition(const Standard_Integer aEdgeId, - const Standard_Real aUParam) - :SMDS_Position(aEdgeId,SMDS_TOP_EDGE),myUParameter(aUParam) +const double *SMDS_EdgePosition::Coords() const +{ + static double origin[]={0,0,0}; + MESSAGE("SMDS_EdgePosition::Coords not implemented"); + return origin; +} + +/** +*/ +SMDS_TypeOfPosition SMDS_EdgePosition::GetTypeOfPosition() const { + return SMDS_TOP_EDGE; +} + +void SMDS_EdgePosition::SetUParameter(double aUparam) +{ + myUParameter = aUparam; } //======================================================================= -//function : Coords +//function : GetUParameter //purpose : //======================================================================= -gp_Pnt SMDS_EdgePosition::Coords() const +double SMDS_EdgePosition::GetUParameter() const { - MESSAGE( "SMDS_EdgePosition::Coords not implemented" ); - return gp_Pnt(0,0,0); + return myUParameter; } diff --git a/src/SMDS/SMDS_EdgePosition.hxx b/src/SMDS/SMDS_EdgePosition.hxx index 5bce22614..868310b51 100644 --- a/src/SMDS/SMDS_EdgePosition.hxx +++ b/src/SMDS/SMDS_EdgePosition.hxx @@ -27,93 +27,23 @@ #ifndef _SMDS_EdgePosition_HeaderFile #define _SMDS_EdgePosition_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SMDS_EdgePosition_HeaderFile -#include "Handle_SMDS_EdgePosition.hxx" -#endif - -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _SMDS_Position_HeaderFile #include "SMDS_Position.hxx" -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -class gp_Pnt; - - -class SMDS_EdgePosition : public SMDS_Position { - -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 SMDS_EdgePosition(); -Standard_EXPORT SMDS_EdgePosition(const Standard_Integer aEdgeId,const Standard_Real aUParam); -Standard_EXPORT virtual gp_Pnt Coords() const; -Standard_EXPORT inline void SetUParameter(const Standard_Real aUparam) ; -Standard_EXPORT inline Standard_Real GetUParameter() const; -Standard_EXPORT ~SMDS_EdgePosition(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SMDS_EdgePosition_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; -protected: +class SMDS_EdgePosition:public SMDS_Position +{ - // Methods PROTECTED - // + public: + SMDS_EdgePosition(const int aEdgeId=0, const double aUParam=0); + const virtual double * Coords() const; + SMDS_TypeOfPosition GetTypeOfPosition() const; + void SetUParameter(double aUparam); + double GetUParameter() const; + ~SMDS_EdgePosition(); + private: - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Real myUParameter; - + double myUParameter; }; - -#include "SMDS_EdgePosition.lxx" - - - -// other inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/SMDS/SMDS_FacePosition.cxx b/src/SMDS/SMDS_FacePosition.cxx index df458d5b2..57a98e7d4 100644 --- a/src/SMDS/SMDS_FacePosition.cxx +++ b/src/SMDS/SMDS_FacePosition.cxx @@ -25,8 +25,7 @@ // Author : Jean-Michel BOULCOURT // Module : SMESH -using namespace std; -#include "SMDS_FacePosition.ixx" +#include "SMDS_FacePosition.hxx" #include "utilities.h" //======================================================================= @@ -34,31 +33,63 @@ using namespace std; //purpose : //======================================================================= -SMDS_FacePosition::SMDS_FacePosition() - :SMDS_Position(0,SMDS_TOP_FACE),myUParameter(0.),myVParameter(0.) +SMDS_FacePosition::SMDS_FacePosition(const int aEdgeId, + const double aUParam, + const double aVParam) + :SMDS_Position(aEdgeId), + myUParameter(aUParam),myVParameter(aVParam) { } //======================================================================= -//function : SMDS_FacePosition +//function : Coords //purpose : //======================================================================= +const double *SMDS_FacePosition::Coords() const +{ + static double origin[]={0,0,0}; + MESSAGE("SMDS_EdgePosition::Coords not implemented"); + return origin; +} -SMDS_FacePosition::SMDS_FacePosition(const Standard_Integer aEdgeId, - const Standard_Real aUParam, - const Standard_Real aVParam) - :SMDS_Position(aEdgeId,SMDS_TOP_FACE), - myUParameter(aUParam),myVParameter(aVParam) +/** +*/ +SMDS_TypeOfPosition SMDS_FacePosition::GetTypeOfPosition() const { + return SMDS_TOP_FACE; +} + +void SMDS_FacePosition::SetUParameter(double aUparam) +{ + myUParameter = aUparam; } //======================================================================= -//function : Coords +//function : SetVParameter +//purpose : +//======================================================================= + +void SMDS_FacePosition::SetVParameter(double aVparam) +{ + myVParameter = aVparam; +} + +//======================================================================= +//function : GetUParameter +//purpose : +//======================================================================= + +double SMDS_FacePosition::GetUParameter() const +{ + return myUParameter; +} + +//======================================================================= +//function : GetVParameter //purpose : //======================================================================= -gp_Pnt SMDS_FacePosition::Coords() const +double SMDS_FacePosition::GetVParameter() const { - MESSAGE( "SMDS_FacePosition::Coords not implemented" ); - return gp_Pnt(0,0,0); + return myVParameter; } diff --git a/src/SMDS/SMDS_FacePosition.hxx b/src/SMDS/SMDS_FacePosition.hxx index acdcb0ae2..255fd05d8 100644 --- a/src/SMDS/SMDS_FacePosition.hxx +++ b/src/SMDS/SMDS_FacePosition.hxx @@ -27,96 +27,23 @@ #ifndef _SMDS_FacePosition_HeaderFile #define _SMDS_FacePosition_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SMDS_FacePosition_HeaderFile -#include "Handle_SMDS_FacePosition.hxx" -#endif - -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _SMDS_Position_HeaderFile #include "SMDS_Position.hxx" -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -class gp_Pnt; - - -class SMDS_FacePosition : public SMDS_Position { - -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 SMDS_FacePosition(); -Standard_EXPORT SMDS_FacePosition(const Standard_Integer aFaceId,const Standard_Real aUParam,const Standard_Real aVParam); -Standard_EXPORT virtual gp_Pnt Coords() const; -Standard_EXPORT inline void SetUParameter(const Standard_Real aUparam) ; -Standard_EXPORT inline void SetVParameter(const Standard_Real aVparam) ; -Standard_EXPORT inline Standard_Real GetUParameter() const; -Standard_EXPORT inline Standard_Real GetVParameter() const; -Standard_EXPORT ~SMDS_FacePosition(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SMDS_FacePosition_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Real myUParameter; -Standard_Real myVParameter; - +class SMDS_FacePosition:public SMDS_Position +{ + + public: + SMDS_FacePosition(int aFaceId=0, double aUParam=0, + double aVParam=0); + const virtual double * Coords() const; + SMDS_TypeOfPosition GetTypeOfPosition() const; + void SetUParameter(double aUparam); + void SetVParameter(double aVparam); + double GetUParameter() const; + double GetVParameter() const; + + private: + double myUParameter; + double myVParameter; }; - - -#include "SMDS_FacePosition.lxx" - - - -// other inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/SMDS/SMDS_MeshElementIDFactory.cxx b/src/SMDS/SMDS_MeshElementIDFactory.cxx index 5413533ea..d635b0110 100644 --- a/src/SMDS/SMDS_MeshElementIDFactory.cxx +++ b/src/SMDS/SMDS_MeshElementIDFactory.cxx @@ -25,15 +25,36 @@ // Author : Jean-Michel BOULCOURT // Module : SMESH -using namespace std; -#include "SMDS_MeshElementIDFactory.ixx" + +#include "SMDS_MeshElementIDFactory.hxx" +#include "SMDS_MeshElement.hxx" //======================================================================= //function : SMDS_MeshElementIDFactory //purpose : //======================================================================= +SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():SMDS_MeshIDFactory() +{ +} -SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory() : SMDS_MeshIDFactory() +//======================================================================= +//function : BindID +//purpose : +//======================================================================= +bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem) { + bool bound=myIDElements.insert( + map::value_type(ID,elem)).second; + if(bound) elem->myID=ID; + return bound; } +//======================================================================= +//function : MeshElement +//purpose : +//======================================================================= +SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID) +{ + map::iterator it=myIDElements.find(ID); + if(it==myIDElements.end()) return NULL; else return (*it).second; +} diff --git a/src/SMDS/SMDS_MeshElementIDFactory.hxx b/src/SMDS/SMDS_MeshElementIDFactory.hxx index 1d7480b49..881467633 100644 --- a/src/SMDS/SMDS_MeshElementIDFactory.hxx +++ b/src/SMDS/SMDS_MeshElementIDFactory.hxx @@ -27,99 +27,23 @@ #ifndef _SMDS_MeshElementIDFactory_HeaderFile #define _SMDS_MeshElementIDFactory_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SMDS_MeshElementIDFactory_HeaderFile -#include "Handle_SMDS_MeshElementIDFactory.hxx" -#endif - -#ifndef _SMDS_DataMapOfIntegerMeshElement_HeaderFile -#include "SMDS_DataMapOfIntegerMeshElement.hxx" -#endif -#ifndef _SMDS_MeshIDFactory_HeaderFile #include "SMDS_MeshIDFactory.hxx" -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Handle_SMDS_MeshElement_HeaderFile -#include "Handle_SMDS_MeshElement.hxx" -#endif -class SMDS_MeshElement; - - -class SMDS_MeshElementIDFactory : public SMDS_MeshIDFactory { - -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 SMDS_MeshElementIDFactory(); -Standard_EXPORT inline Standard_Integer GetFreeID() ; -Standard_EXPORT inline void ReleaseID(const Standard_Integer ID) ; -Standard_EXPORT inline Standard_Boolean BindID(const Standard_Integer ID,const Handle(SMDS_MeshElement)& elem) ; -Standard_EXPORT inline Handle_SMDS_MeshElement MeshElement(const Standard_Integer ID) const; -Standard_EXPORT ~SMDS_MeshElementIDFactory(); - - - +#include - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshElementIDFactory_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; +#include +using namespace std; -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -SMDS_DataMapOfIntegerMeshElement myIDElements; +class SMDS_MeshElement; +class SMDS_MeshElementIDFactory:public SMDS_MeshIDFactory +{ + public: + SMDS_MeshElementIDFactory(); + bool BindID(int ID, SMDS_MeshElement * elem); + SMDS_MeshElement * MeshElement(int ID); + private: + map myIDElements; }; - -#include "SMDS_MeshElementIDFactory.lxx" - - - -// other inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/SMDS/SMDS_MeshGroup.cxx b/src/SMDS/SMDS_MeshGroup.cxx index da85821da..25e942abb 100644 --- a/src/SMDS/SMDS_MeshGroup.cxx +++ b/src/SMDS/SMDS_MeshGroup.cxx @@ -25,16 +25,15 @@ // Module : SMESH using namespace std; -#include "SMDS_MeshGroup.ixx" -#include "SMDS_ListIteratorOfListOfMeshGroup.hxx" - +#include "SMDS_MeshGroup.hxx" +#include "utilities.h" //======================================================================= //function : SMDS_MeshGroup //purpose : //======================================================================= -SMDS_MeshGroup::SMDS_MeshGroup(const Handle(SMDS_Mesh)& aMesh) - :myMesh(aMesh),myType(SMDSAbs_All) +SMDS_MeshGroup::SMDS_MeshGroup(const SMDS_Mesh * aMesh) + :myMesh(aMesh),myType(SMDSAbs_All), myParent(NULL) { } @@ -43,8 +42,8 @@ SMDS_MeshGroup::SMDS_MeshGroup(const Handle(SMDS_Mesh)& aMesh) //purpose : //======================================================================= -SMDS_MeshGroup::SMDS_MeshGroup(const Handle(SMDS_MeshGroup)& parent) - :myMesh(parent->myMesh),myType(SMDSAbs_All),myParent(parent) +SMDS_MeshGroup::SMDS_MeshGroup(SMDS_MeshGroup * parent) + :myMesh(parent->myMesh),myType(SMDSAbs_All), myParent(parent) { } @@ -53,13 +52,11 @@ SMDS_MeshGroup::SMDS_MeshGroup(const Handle(SMDS_MeshGroup)& parent) //purpose : //======================================================================= -Handle(SMDS_MeshGroup) SMDS_MeshGroup::AddSubGroup() +const SMDS_MeshGroup *SMDS_MeshGroup::AddSubGroup() { - Handle(SMDS_MeshGroup) subgroup = new SMDS_MeshGroup(this); - if (!subgroup.IsNull()) { - myChildren.Append(subgroup); - } - return subgroup; + const SMDS_MeshGroup * subgroup = new SMDS_MeshGroup(this); + myChildren.insert(myChildren.end(),subgroup); + return subgroup; } //======================================================================= @@ -67,21 +64,21 @@ Handle(SMDS_MeshGroup) SMDS_MeshGroup::AddSubGroup() //purpose : //======================================================================= -Standard_Boolean SMDS_MeshGroup::RemoveSubGroup(const Handle(SMDS_MeshGroup)& aGroup) +bool SMDS_MeshGroup::RemoveSubGroup(const SMDS_MeshGroup * aGroup) { - Standard_Boolean found = Standard_False; - - SMDS_ListIteratorOfListOfMeshGroup itgroup(myChildren); - for (;itgroup.More() && !found; itgroup.Next()) { - Handle(SMDS_MeshGroup) subgroup; - subgroup = itgroup.Value(); - if (subgroup == aGroup) { - found = Standard_True; - myChildren.Remove(itgroup); - } - } - - return found; + bool found = false; + list::iterator itgroup; + for(itgroup=myChildren.begin(); itgroup!=myChildren.end(); itgroup++) + { + const SMDS_MeshGroup* subgroup=*itgroup; + if (subgroup == aGroup) + { + found = true; + myChildren.erase(itgroup); + } + } + + return found; } //======================================================================= @@ -89,15 +86,15 @@ Standard_Boolean SMDS_MeshGroup::RemoveSubGroup(const Handle(SMDS_MeshGroup)& aG //purpose : //======================================================================= -Standard_Boolean SMDS_MeshGroup::RemoveFromParent() +bool SMDS_MeshGroup::RemoveFromParent() { - if (myParent.IsNull()) - return Standard_False; - - return (myParent->RemoveSubGroup(this)); - + + if (myParent==NULL) return false; + else + { + return (myParent->RemoveSubGroup(this)); + } } - //======================================================================= //function : Clear //purpose : @@ -105,8 +102,8 @@ Standard_Boolean SMDS_MeshGroup::RemoveFromParent() void SMDS_MeshGroup::Clear() { - myElements.Clear(); - myType = SMDSAbs_All; + myElements.clear(); + myType = SMDSAbs_All; } //======================================================================= @@ -114,9 +111,9 @@ void SMDS_MeshGroup::Clear() //purpose : //======================================================================= -Standard_Boolean SMDS_MeshGroup::IsEmpty() const +bool SMDS_MeshGroup::IsEmpty() const { - return myElements.IsEmpty(); + return myElements.empty(); } //======================================================================= @@ -124,9 +121,9 @@ Standard_Boolean SMDS_MeshGroup::IsEmpty() const //purpose : //======================================================================= -Standard_Integer SMDS_MeshGroup::Extent() const +int SMDS_MeshGroup::Extent() const { - return myElements.Extent(); + return myElements.size(); } //======================================================================= @@ -134,31 +131,25 @@ Standard_Integer SMDS_MeshGroup::Extent() const //purpose : //======================================================================= -void SMDS_MeshGroup::Add(const Handle(SMDS_MeshElement)& ME) +void SMDS_MeshGroup::Add(const SMDS_MeshElement * ME) { - // the type of the group is determined by the first element added - if (myElements.IsEmpty()) { - myType = ME->GetType(); - } - - if (ME->GetType() != myType) { - Standard_TypeMismatch::Raise("SMDS_MeshGroup::Add"); - } - - myElements.Add(ME); + // the type of the group is determined by the first element added + if (myElements.empty()) myType = ME->GetType(); + else if (ME->GetType() != myType) + MESSAGE("SMDS_MeshGroup::Add : Type Mismatch"); + + myElements.insert(ME); } - //======================================================================= //function : Remove //purpose : //======================================================================= -void SMDS_MeshGroup::Remove(const Handle(SMDS_MeshElement)& ME) +void SMDS_MeshGroup::Remove(const SMDS_MeshElement * ME) { - myElements.Remove(ME); - if (myElements.IsEmpty()) - myType = SMDSAbs_All; + myElements.erase(ME); + if (myElements.empty()) myType = SMDSAbs_All; } //======================================================================= @@ -168,7 +159,7 @@ void SMDS_MeshGroup::Remove(const Handle(SMDS_MeshElement)& ME) SMDSAbs_ElementType SMDS_MeshGroup::Type() const { - return myType; + return myType; } //======================================================================= @@ -176,7 +167,7 @@ SMDSAbs_ElementType SMDS_MeshGroup::Type() const //purpose : //======================================================================= -Standard_Boolean SMDS_MeshGroup::Contains(const Handle(SMDS_MeshElement)& ME) const +bool SMDS_MeshGroup::Contains(const SMDS_MeshElement * ME) const { - return myElements.Contains(ME); + return myElements.find(ME)!=myElements.end(); } diff --git a/src/SMDS/SMDS_MeshGroup.hxx b/src/SMDS/SMDS_MeshGroup.hxx index 5df197b27..f73c1dd1f 100644 --- a/src/SMDS/SMDS_MeshGroup.hxx +++ b/src/SMDS/SMDS_MeshGroup.hxx @@ -26,127 +26,32 @@ #ifndef _SMDS_MeshGroup_HeaderFile #define _SMDS_MeshGroup_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SMDS_MeshGroup_HeaderFile -#include "Handle_SMDS_MeshGroup.hxx" -#endif - -#ifndef _Handle_SMDS_Mesh_HeaderFile -#include "Handle_SMDS_Mesh.hxx" -#endif -#ifndef _SMDSAbs_ElementType_HeaderFile -#include "SMDSAbs_ElementType.hxx" -#endif -#ifndef _SMDS_MapOfMeshElement_HeaderFile -#include "SMDS_MapOfMeshElement.hxx" -#endif -#ifndef _Handle_SMDS_MeshGroup_HeaderFile -#include "Handle_SMDS_MeshGroup.hxx" -#endif -#ifndef _SMDS_ListOfMeshGroup_HeaderFile -#include "SMDS_ListOfMeshGroup.hxx" -#endif -#ifndef _SMDS_MeshObject_HeaderFile -#include "SMDS_MeshObject.hxx" -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Handle_SMDS_MeshElement_HeaderFile -#include "Handle_SMDS_MeshElement.hxx" -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -class SMDS_Mesh; -class Standard_NoSuchObject; -class Standard_TypeMismatch; -class SMDS_MeshElement; -class SMDS_MapOfMeshElement; - - -class SMDS_MeshGroup : public SMDS_MeshObject { - -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 SMDS_MeshGroup(const Handle(SMDS_Mesh)& aMesh); -Standard_EXPORT Handle_SMDS_MeshGroup AddSubGroup() ; -Standard_EXPORT virtual Standard_Boolean RemoveSubGroup(const Handle(SMDS_MeshGroup)& aGroup) ; -Standard_EXPORT virtual Standard_Boolean RemoveFromParent() ; -Standard_EXPORT void Clear() ; -Standard_EXPORT void Add(const Handle(SMDS_MeshElement)& ME) ; -Standard_EXPORT void Remove(const Handle(SMDS_MeshElement)& ME) ; -Standard_EXPORT Standard_Boolean IsEmpty() const; -Standard_EXPORT Standard_Integer Extent() const; -Standard_EXPORT SMDSAbs_ElementType Type() const; -Standard_EXPORT Standard_Boolean Contains(const Handle(SMDS_MeshElement)& ME) const; -Standard_EXPORT inline const SMDS_MapOfMeshElement& Elements() const; -Standard_EXPORT ~SMDS_MeshGroup(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshGroup_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // -Standard_EXPORT SMDS_MeshGroup(const Handle(SMDS_MeshGroup)& parent); - - - // Fields PRIVATE - // -Handle_SMDS_Mesh myMesh; -SMDSAbs_ElementType myType; -SMDS_MapOfMeshElement myElements; -Handle_SMDS_MeshGroup myParent; -SMDS_ListOfMeshGroup myChildren; - - +#include "SMDS_Mesh.hxx" +#include +using namespace std; + +class SMDS_MeshGroup:public SMDS_MeshObject +{ + public: + SMDS_MeshGroup(const SMDS_Mesh * aMesh); + const SMDS_MeshGroup * AddSubGroup(); + virtual bool RemoveSubGroup(const SMDS_MeshGroup* aGroup); + virtual bool RemoveFromParent(); + void Clear(); + void Add(const SMDS_MeshElement * ME); + void Remove(const SMDS_MeshElement * ME); + bool IsEmpty() const; + int Extent() const; + SMDSAbs_ElementType Type() const; + bool Contains(const SMDS_MeshElement * ME) const; + + ~SMDS_MeshGroup(); + private: + SMDS_MeshGroup(SMDS_MeshGroup* parent); + const SMDS_Mesh *myMesh; + SMDSAbs_ElementType myType; + set myElements; + SMDS_MeshGroup * myParent; + list myChildren; }; - - -#include "SMDS_MeshGroup.lxx" - - - -// other inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/SMDS/SMDS_MeshIDFactory.cxx b/src/SMDS/SMDS_MeshIDFactory.cxx index 6e02557e0..a68ae5ad0 100644 --- a/src/SMDS/SMDS_MeshIDFactory.cxx +++ b/src/SMDS/SMDS_MeshIDFactory.cxx @@ -25,16 +25,34 @@ // Author : Jean-Michel BOULCOURT // Module : SMESH -using namespace std; -#include "SMDS_MeshIDFactory.ixx" +#include "SMDS_MeshIDFactory.hxx" //======================================================================= //function : SMDS_MeshIDFactory //purpose : //======================================================================= -SMDS_MeshIDFactory::SMDS_MeshIDFactory() : myMaxID(0) +SMDS_MeshIDFactory::SMDS_MeshIDFactory():myMaxID(0) { } +int SMDS_MeshIDFactory::GetFreeID() +{ + if (myPoolOfID.empty()) return ++myMaxID; + else + { + int ID = myPoolOfID.top(); + myPoolOfID.pop(); + return ID; + } +} + +//======================================================================= +//function : ReleaseID +//purpose : +//======================================================================= +void SMDS_MeshIDFactory::ReleaseID(const int ID) +{ + if (ID < myMaxID) myPoolOfID.push(ID); +} diff --git a/src/SMDS/SMDS_MeshIDFactory.hxx b/src/SMDS/SMDS_MeshIDFactory.hxx index 4c5581d04..76ac5ee91 100644 --- a/src/SMDS/SMDS_MeshIDFactory.hxx +++ b/src/SMDS/SMDS_MeshIDFactory.hxx @@ -27,90 +27,20 @@ #ifndef _SMDS_MeshIDFactory_HeaderFile #define _SMDS_MeshIDFactory_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SMDS_MeshIDFactory_HeaderFile -#include "Handle_SMDS_MeshIDFactory.hxx" -#endif - -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _TColStd_StackOfInteger_HeaderFile -#include -#endif -#ifndef _SMDS_MeshObject_HeaderFile #include "SMDS_MeshObject.hxx" -#endif - - -class SMDS_MeshIDFactory : public SMDS_MeshObject { - -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 virtual Standard_Integer GetFreeID() = 0; -Standard_EXPORT virtual void ReleaseID(const Standard_Integer ID) = 0; -Standard_EXPORT ~SMDS_MeshIDFactory(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshIDFactory_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // -Standard_EXPORT SMDS_MeshIDFactory(); - - - // Fields PROTECTED - // -Standard_Integer myMaxID; -TColStd_StackOfInteger myPoolOfID; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - +#include +using namespace std; + +class SMDS_MeshIDFactory:public SMDS_MeshObject +{ + public: + virtual int GetFreeID(); + virtual void ReleaseID(int ID); + + protected: + SMDS_MeshIDFactory(); + int myMaxID; + stack myPoolOfID; }; - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/SMDS/SMDS_MeshObject.cxx b/src/SMDS/SMDS_MeshObject.cxx index 1efac384f..b822b8098 100644 --- a/src/SMDS/SMDS_MeshObject.cxx +++ b/src/SMDS/SMDS_MeshObject.cxx @@ -25,5 +25,4 @@ // Author : Jean-Michel BOULCOURT // Module : SMESH -using namespace std; -#include "SMDS_MeshObject.ixx" +#include "SMDS_MeshObject.hxx" diff --git a/src/SMDS/SMDS_MeshObject.hxx b/src/SMDS/SMDS_MeshObject.hxx index 4610ca187..7e4bcd464 100644 --- a/src/SMDS/SMDS_MeshObject.hxx +++ b/src/SMDS/SMDS_MeshObject.hxx @@ -27,79 +27,8 @@ #ifndef _SMDS_MeshObject_HeaderFile #define _SMDS_MeshObject_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SMDS_MeshObject_HeaderFile -#include "Handle_SMDS_MeshObject.hxx" -#endif - -#ifndef _MMgt_TShared_HeaderFile -#include -#endif - - -class SMDS_MeshObject : public MMgt_TShared { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT ~SMDS_MeshObject(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshObject_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - +class SMDS_MeshObject +{ + public: }; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/SMDS/SMDS_Position.cxx b/src/SMDS/SMDS_Position.cxx index dfba3ca63..0a634ceb2 100644 --- a/src/SMDS/SMDS_Position.cxx +++ b/src/SMDS/SMDS_Position.cxx @@ -25,16 +25,33 @@ // Author : Jean-Michel BOULCOURT // Module : SMESH -using namespace std; -#include "SMDS_Position.ixx" +#include "SMDS_Position.hxx" //======================================================================= //function : SMDS_Position //purpose : //======================================================================= -SMDS_Position::SMDS_Position(const Standard_Integer aShapeId, - const SMDS_TypeOfPosition aType) - :myShapeId(aShapeId),myType(aType) +SMDS_Position::SMDS_Position(int aShapeId) :myShapeId(aShapeId) { } + +//======================================================================= +//function : SetShapeId +//purpose : +//======================================================================= + +void SMDS_Position::SetShapeId(int aShapeId) +{ + myShapeId = aShapeId; +} + +//======================================================================= +//function : GetShapeId +//purpose : +//======================================================================= + +int SMDS_Position::GetShapeId() const +{ + return myShapeId; +} diff --git a/src/SMDS/SMDS_Position.hxx b/src/SMDS/SMDS_Position.hxx index 50ebcffcd..29a54d82b 100644 --- a/src/SMDS/SMDS_Position.hxx +++ b/src/SMDS/SMDS_Position.hxx @@ -27,94 +27,22 @@ #ifndef _SMDS_Position_HeaderFile #define _SMDS_Position_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SMDS_Position_HeaderFile -#include "Handle_SMDS_Position.hxx" -#endif - -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _SMDS_TypeOfPosition_HeaderFile #include "SMDS_TypeOfPosition.hxx" -#endif -#ifndef _MMgt_TShared_HeaderFile -#include -#endif -class gp_Pnt; - - -class SMDS_Position : public MMgt_TShared { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT virtual gp_Pnt Coords() const = 0; -Standard_EXPORT inline SMDS_TypeOfPosition GetTypeOfPosition() const; -Standard_EXPORT inline void SetShapeId(const Standard_Integer aShapeId) ; -Standard_EXPORT inline Standard_Integer GetShapeId() const; -Standard_EXPORT ~SMDS_Position(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SMDS_Position_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - // Methods PROTECTED - // -Standard_EXPORT SMDS_Position(const Standard_Integer aShapeId,const SMDS_TypeOfPosition aType = SMDS_TOP_UNSPEC); +class SMDS_Position +{ + public: + const virtual double * Coords() const = 0; + virtual inline SMDS_TypeOfPosition GetTypeOfPosition() const = 0; + void SetShapeId(int aShapeId); + int GetShapeId() const; + ~SMDS_Position(); - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Integer myShapeId; -SMDS_TypeOfPosition myType; - + protected: + SMDS_Position(int aShapeId); + private: + int myShapeId; }; - - -#include "SMDS_Position.lxx" - - - -// other inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/SMDS/SMDS_SpacePosition.cxx b/src/SMDS/SMDS_SpacePosition.cxx index 573c36a40..82ef3d54f 100644 --- a/src/SMDS/SMDS_SpacePosition.cxx +++ b/src/SMDS/SMDS_SpacePosition.cxx @@ -25,47 +25,35 @@ // Author : Jean-Michel BOULCOURT // Module : SMESH -using namespace std; -#include "SMDS_SpacePosition.ixx" +#include "SMDS_SpacePosition.hxx" //======================================================================= //function : SMDS_SpacePosition //purpose : //======================================================================= -SMDS_SpacePosition::SMDS_SpacePosition() - :SMDS_Position(0,SMDS_TOP_3DSPACE),myCoords(0.,0.,0.) +SMDS_SpacePosition::SMDS_SpacePosition(double x, double y, double z): + SMDS_Position(0) { + myCoords[0]=x; + myCoords[1]=y; + myCoords[2]=z; } -//======================================================================= -//function : SMDS_SpacePosition -//purpose : -//======================================================================= - -SMDS_SpacePosition::SMDS_SpacePosition(const Standard_Real x, - const Standard_Real y, - const Standard_Real z) - :SMDS_Position(0,SMDS_TOP_3DSPACE),myCoords(x,y,z) +/** +*/ +SMDS_TypeOfPosition SMDS_SpacePosition::GetTypeOfPosition() const { + return SMDS_TOP_3DSPACE; } -//======================================================================= -//function : SMDS_SpacePosition -//purpose : -//======================================================================= - -SMDS_SpacePosition::SMDS_SpacePosition(const gp_Pnt& aCoords) - :SMDS_Position(0,SMDS_TOP_3DSPACE),myCoords(aCoords) +const double * SMDS_SpacePosition::Coords() const { + return myCoords; } -//======================================================================= -//function : Coords -//purpose : -//======================================================================= - -gp_Pnt SMDS_SpacePosition::Coords() const +SMDS_SpacePosition * SMDS_SpacePosition::originSpacePosition() { - return myCoords; + static SMDS_SpacePosition * staticpos=new SMDS_SpacePosition(); + return staticpos; } diff --git a/src/SMDS/SMDS_SpacePosition.hxx b/src/SMDS/SMDS_SpacePosition.hxx index c2f5ee1a4..af995f175 100644 --- a/src/SMDS/SMDS_SpacePosition.hxx +++ b/src/SMDS/SMDS_SpacePosition.hxx @@ -27,94 +27,20 @@ #ifndef _SMDS_SpacePosition_HeaderFile #define _SMDS_SpacePosition_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SMDS_SpacePosition_HeaderFile -#include "Handle_SMDS_SpacePosition.hxx" -#endif - -#ifndef _gp_Pnt_HeaderFile -#include -#endif -#ifndef _SMDS_Position_HeaderFile #include "SMDS_Position.hxx" -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -class gp_Pnt; - - -class SMDS_SpacePosition : public SMDS_Position { - -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 SMDS_SpacePosition(); -Standard_EXPORT SMDS_SpacePosition(const Standard_Real x,const Standard_Real y,const Standard_Real z); -Standard_EXPORT SMDS_SpacePosition(const gp_Pnt& aCoords); -Standard_EXPORT virtual gp_Pnt Coords() const; -Standard_EXPORT inline void SetCoords(const Standard_Real x,const Standard_Real y,const Standard_Real z) ; -Standard_EXPORT inline void SetCoords(const gp_Pnt& aCoords) ; -Standard_EXPORT ~SMDS_SpacePosition(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SMDS_SpacePosition_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -gp_Pnt myCoords; - +class SMDS_SpacePosition:public SMDS_Position +{ + + public: + SMDS_SpacePosition(double x=0, double y=0, double z=0); + const virtual double * Coords() const; + virtual inline SMDS_TypeOfPosition GetTypeOfPosition() const; + inline void SetCoords(const double x, const double y, const double z); + ~SMDS_SpacePosition(); + static SMDS_SpacePosition * originSpacePosition(); + private: + double myCoords[3]; }; - -#include "SMDS_SpacePosition.lxx" - - - -// other inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/SMDS/SMDS_TypeOfPosition.hxx b/src/SMDS/SMDS_TypeOfPosition.hxx index 54b18211a..9de8b7fb8 100644 --- a/src/SMDS/SMDS_TypeOfPosition.hxx +++ b/src/SMDS/SMDS_TypeOfPosition.hxx @@ -27,17 +27,13 @@ #ifndef _SMDS_TypeOfPosition_HeaderFile #define _SMDS_TypeOfPosition_HeaderFile -enum SMDS_TypeOfPosition { - SMDS_TOP_UNSPEC, -SMDS_TOP_3DSPACE, -SMDS_TOP_VERTEX, -SMDS_TOP_EDGE, -SMDS_TOP_FACE +enum SMDS_TypeOfPosition +{ + SMDS_TOP_UNSPEC, + SMDS_TOP_3DSPACE, + SMDS_TOP_VERTEX, + SMDS_TOP_EDGE, + SMDS_TOP_FACE }; - -#ifndef _Standard_PrimitiveTypes_HeaderFile -#include -#endif - #endif diff --git a/src/SMDS/SMDS_VertexPosition.cxx b/src/SMDS/SMDS_VertexPosition.cxx index ed554f335..8757ad4d3 100644 --- a/src/SMDS/SMDS_VertexPosition.cxx +++ b/src/SMDS/SMDS_VertexPosition.cxx @@ -25,8 +25,7 @@ // Author : Jean-Michel BOULCOURT // Module : SMESH -using namespace std; -#include "SMDS_VertexPosition.ixx" +#include "SMDS_VertexPosition.hxx" #include "utilities.h" //======================================================================= @@ -34,29 +33,25 @@ using namespace std; //purpose : //======================================================================= -SMDS_VertexPosition::SMDS_VertexPosition() - :SMDS_Position(0,SMDS_TOP_VERTEX) +SMDS_VertexPosition:: SMDS_VertexPosition(const int aVertexId) + :SMDS_Position(aVertexId) { } //======================================================================= -//function : SMDS_VertexPosition +//function : Coords //purpose : //======================================================================= -SMDS_VertexPosition::SMDS_VertexPosition(const Standard_Integer aVertexId) - :SMDS_Position(aVertexId,SMDS_TOP_VERTEX) +const double *SMDS_VertexPosition::Coords() const { + const static double origin[]={0,0,0}; + MESSAGE("SMDS_EdgePosition::Coords not implemented"); + return origin; } -//======================================================================= -//function : Coords -//purpose : -//======================================================================= - -gp_Pnt SMDS_VertexPosition::Coords() const +SMDS_TypeOfPosition SMDS_VertexPosition::GetTypeOfPosition() const { - MESSAGE( "SMDS_VertexPosition::Coords not implemented" ); - return gp_Pnt(0,0,0); + return SMDS_TOP_VERTEX; } diff --git a/src/SMDS/SMDS_VertexPosition.hxx b/src/SMDS/SMDS_VertexPosition.hxx index 8577eaf9c..6fc5a3c61 100644 --- a/src/SMDS/SMDS_VertexPosition.hxx +++ b/src/SMDS/SMDS_VertexPosition.hxx @@ -27,86 +27,16 @@ #ifndef _SMDS_VertexPosition_HeaderFile #define _SMDS_VertexPosition_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SMDS_VertexPosition_HeaderFile -#include "Handle_SMDS_VertexPosition.hxx" -#endif - -#ifndef _SMDS_Position_HeaderFile #include "SMDS_Position.hxx" -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -class gp_Pnt; - - -class SMDS_VertexPosition : public SMDS_Position { - -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 SMDS_VertexPosition(); -Standard_EXPORT SMDS_VertexPosition(const Standard_Integer aVertexId); -Standard_EXPORT virtual gp_Pnt Coords() const; -Standard_EXPORT ~SMDS_VertexPosition(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SMDS_VertexPosition_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // +class SMDS_VertexPosition:public SMDS_Position +{ + public: + SMDS_TypeOfPosition GetTypeOfPosition() const; + SMDS_VertexPosition(int aVertexId=0); + const double *Coords() const; + ~SMDS_VertexPosition(); }; - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - #endif