// Author : Jean-Michel BOULCOURT
// Module : SMESH
-using namespace std;
-#include "SMDS_EdgePosition.ixx"
+#include "SMDS_EdgePosition.hxx"
#include "utilities.h"
//=======================================================================
//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;
}
#ifndef _SMDS_EdgePosition_HeaderFile
#define _SMDS_EdgePosition_HeaderFile
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDS_EdgePosition_HeaderFile
-#include "Handle_SMDS_EdgePosition.hxx"
-#endif
-
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#endif
-#ifndef _SMDS_Position_HeaderFile
#include "SMDS_Position.hxx"
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#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
// Author : Jean-Michel BOULCOURT
// Module : SMESH
-using namespace std;
-#include "SMDS_FacePosition.ixx"
+#include "SMDS_FacePosition.hxx"
#include "utilities.h"
//=======================================================================
//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;
}
#ifndef _SMDS_FacePosition_HeaderFile
#define _SMDS_FacePosition_HeaderFile
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDS_FacePosition_HeaderFile
-#include "Handle_SMDS_FacePosition.hxx"
-#endif
-
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#endif
-#ifndef _SMDS_Position_HeaderFile
#include "SMDS_Position.hxx"
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#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
// 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<int, SMDS_MeshElement*>::value_type(ID,elem)).second;
+ if(bound) elem->myID=ID;
+ return bound;
}
+//=======================================================================
+//function : MeshElement
+//purpose :
+//=======================================================================
+SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
+{
+ map<int, SMDS_MeshElement*>::iterator it=myIDElements.find(ID);
+ if(it==myIDElements.end()) return NULL; else return (*it).second;
+}
#ifndef _SMDS_MeshElementIDFactory_HeaderFile
#define _SMDS_MeshElementIDFactory_HeaderFile
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#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 <Standard_Integer.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#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 <SMDS_Iterator.hxx>
- // 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 <map>
+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<int, SMDS_MeshElement *> myIDElements;
};
-
-#include "SMDS_MeshElementIDFactory.lxx"
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
#endif
// 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)
{
}
//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)
{
}
//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;
}
//=======================================================================
//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<const SMDS_MeshGroup*>::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;
}
//=======================================================================
//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 :
void SMDS_MeshGroup::Clear()
{
- myElements.Clear();
- myType = SMDSAbs_All;
+ myElements.clear();
+ myType = SMDSAbs_All;
}
//=======================================================================
//purpose :
//=======================================================================
-Standard_Boolean SMDS_MeshGroup::IsEmpty() const
+bool SMDS_MeshGroup::IsEmpty() const
{
- return myElements.IsEmpty();
+ return myElements.empty();
}
//=======================================================================
//purpose :
//=======================================================================
-Standard_Integer SMDS_MeshGroup::Extent() const
+int SMDS_MeshGroup::Extent() const
{
- return myElements.Extent();
+ return myElements.size();
}
//=======================================================================
//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;
}
//=======================================================================
SMDSAbs_ElementType SMDS_MeshGroup::Type() const
{
- return myType;
+ return myType;
}
//=======================================================================
//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();
}
#ifndef _SMDS_MeshGroup_HeaderFile
#define _SMDS_MeshGroup_HeaderFile
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#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 <Standard_Boolean.hxx>
-#endif
-#ifndef _Handle_SMDS_MeshElement_HeaderFile
-#include "Handle_SMDS_MeshElement.hxx"
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#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 <set>
+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<const SMDS_MeshElement *> myElements;
+ SMDS_MeshGroup * myParent;
+ list<const SMDS_MeshGroup*> myChildren;
};
-
-
-#include "SMDS_MeshGroup.lxx"
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
#endif
// 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);
+}
#ifndef _SMDS_MeshIDFactory_HeaderFile
#define _SMDS_MeshIDFactory_HeaderFile
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDS_MeshIDFactory_HeaderFile
-#include "Handle_SMDS_MeshIDFactory.hxx"
-#endif
-
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _TColStd_StackOfInteger_HeaderFile
-#include <TColStd_StackOfInteger.hxx>
-#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 <stack>
+using namespace std;
+
+class SMDS_MeshIDFactory:public SMDS_MeshObject
+{
+ public:
+ virtual int GetFreeID();
+ virtual void ReleaseID(int ID);
+
+ protected:
+ SMDS_MeshIDFactory();
+ int myMaxID;
+ stack<int> myPoolOfID;
};
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
#endif
// Author : Jean-Michel BOULCOURT
// Module : SMESH
-using namespace std;
-#include "SMDS_MeshObject.ixx"
+#include "SMDS_MeshObject.hxx"
#ifndef _SMDS_MeshObject_HeaderFile
#define _SMDS_MeshObject_HeaderFile
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDS_MeshObject_HeaderFile
-#include "Handle_SMDS_MeshObject.hxx"
-#endif
-
-#ifndef _MMgt_TShared_HeaderFile
-#include <MMgt_TShared.hxx>
-#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
// 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;
+}
#ifndef _SMDS_Position_HeaderFile
#define _SMDS_Position_HeaderFile
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDS_Position_HeaderFile
-#include "Handle_SMDS_Position.hxx"
-#endif
-
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _SMDS_TypeOfPosition_HeaderFile
#include "SMDS_TypeOfPosition.hxx"
-#endif
-#ifndef _MMgt_TShared_HeaderFile
-#include <MMgt_TShared.hxx>
-#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
// 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;
}
#ifndef _SMDS_SpacePosition_HeaderFile
#define _SMDS_SpacePosition_HeaderFile
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDS_SpacePosition_HeaderFile
-#include "Handle_SMDS_SpacePosition.hxx"
-#endif
-
-#ifndef _gp_Pnt_HeaderFile
-#include <gp_Pnt.hxx>
-#endif
-#ifndef _SMDS_Position_HeaderFile
#include "SMDS_Position.hxx"
-#endif
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#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
#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 <Standard_PrimitiveTypes.hxx>
-#endif
-
#endif
// Author : Jean-Michel BOULCOURT
// Module : SMESH
-using namespace std;
-#include "SMDS_VertexPosition.ixx"
+#include "SMDS_VertexPosition.hxx"
#include "utilities.h"
//=======================================================================
//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;
}
#ifndef _SMDS_VertexPosition_HeaderFile
#define _SMDS_VertexPosition_HeaderFile
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#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 <Standard_Integer.hxx>
-#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