mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-25 06:10:33 +05:00
New DS implementation
This commit is contained in:
parent
13b8c20dfc
commit
484fe83a97
File diff suppressed because it is too large
Load Diff
@ -27,209 +27,145 @@
|
||||
#ifndef _SMDS_Mesh_HeaderFile
|
||||
#define _SMDS_Mesh_HeaderFile
|
||||
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Handle_SMDS_Mesh_HeaderFile
|
||||
#include "Handle_SMDS_Mesh.hxx"
|
||||
#endif
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMDS_MeshEdge.hxx"
|
||||
#include "SMDS_MeshFace.hxx"
|
||||
#include "SMDS_MeshVolume.hxx"
|
||||
#include "SMDS_MeshElementIDFactory.hxx"
|
||||
#include "SMDS_Iterator.hxx"
|
||||
|
||||
#ifndef _SMDS_MapOfMeshOrientedElement_HeaderFile
|
||||
#include "SMDS_MapOfMeshOrientedElement.hxx"
|
||||
#endif
|
||||
#ifndef _Handle_SMDS_Mesh_HeaderFile
|
||||
#include "Handle_SMDS_Mesh.hxx"
|
||||
#endif
|
||||
#ifndef _SMDS_ListOfMesh_HeaderFile
|
||||
#include "SMDS_ListOfMesh.hxx"
|
||||
#endif
|
||||
#ifndef _Handle_SMDS_MeshNodeIDFactory_HeaderFile
|
||||
#include "Handle_SMDS_MeshNodeIDFactory.hxx"
|
||||
#endif
|
||||
#ifndef _Handle_SMDS_MeshElementIDFactory_HeaderFile
|
||||
#include "Handle_SMDS_MeshElementIDFactory.hxx"
|
||||
#endif
|
||||
#ifndef _Standard_Boolean_HeaderFile
|
||||
#include "Standard_Boolean.hxx"
|
||||
#endif
|
||||
#ifndef _SMDS_MeshObject_HeaderFile
|
||||
#include "SMDS_MeshObject.hxx"
|
||||
#endif
|
||||
#ifndef _Standard_Integer_HeaderFile
|
||||
#include <Standard_Integer.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Real_HeaderFile
|
||||
#include <Standard_Real.hxx>
|
||||
#endif
|
||||
#ifndef _Handle_SMDS_MeshElement_HeaderFile
|
||||
#include "Handle_SMDS_MeshElement.hxx"
|
||||
#endif
|
||||
#ifndef _Handle_SMDS_MeshNode_HeaderFile
|
||||
#include "Handle_SMDS_MeshNode.hxx"
|
||||
#endif
|
||||
class SMDS_MeshNodeIDFactory;
|
||||
class SMDS_MeshElementIDFactory;
|
||||
class Standard_NoSuchObject;
|
||||
class SMDS_MeshVolumesIterator;
|
||||
class SMDS_MeshFacesIterator;
|
||||
class SMDS_MeshEdgesIterator;
|
||||
class SMDS_MeshNodesIterator;
|
||||
class SMDS_MeshElement;
|
||||
class SMDS_MeshNode;
|
||||
class SMDS_ListIteratorOfListOfMesh;
|
||||
class SMDS_MapOfMeshOrientedElement;
|
||||
#include <set>
|
||||
#include <list>
|
||||
|
||||
class SMDSControl_BoundaryEdges;
|
||||
|
||||
class SMDS_Mesh : public SMDS_MeshObject {
|
||||
class SMDS_Mesh:public SMDS_MeshObject
|
||||
{
|
||||
|
||||
public:
|
||||
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_Mesh(const Standard_Integer nbnodes = 10,const Standard_Integer nbedges = 10,const Standard_Integer nbfaces = 10,const Standard_Integer nbvolumes = 10);
|
||||
Standard_EXPORT Handle_SMDS_Mesh AddSubMesh() ;
|
||||
Standard_EXPORT virtual Standard_Integer AddNode(const Standard_Real x,const Standard_Real y,const Standard_Real z) ;
|
||||
Standard_EXPORT virtual Standard_Boolean AddNodeWithID(const Standard_Real x,const Standard_Real y,const Standard_Real z,const Standard_Integer ID) ;
|
||||
Standard_EXPORT virtual Standard_Boolean AddNode(const Standard_Integer ID) ;
|
||||
Standard_EXPORT virtual Standard_Integer AddEdge(const Standard_Integer idnode1,const Standard_Integer idnode2) ;
|
||||
Standard_EXPORT virtual Standard_Boolean AddEdgeWithID(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer ID) ;
|
||||
Standard_EXPORT virtual Standard_Integer AddFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ;
|
||||
Standard_EXPORT virtual Standard_Boolean AddFaceWithID(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer ID) ;
|
||||
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_Boolean AddFaceWithID(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer ID) ;
|
||||
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_Boolean AddVolumeWithID(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer ID) ;
|
||||
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_Boolean AddVolumeWithID(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer ID) ;
|
||||
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_Boolean AddVolumeWithID(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 ID) ;
|
||||
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 Standard_Boolean AddVolumeWithID(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,const Standard_Integer ID) ;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement AddVolume(const Handle(SMDS_MeshElement)& node1,const Handle(SMDS_MeshElement)& node2,const Handle(SMDS_MeshElement)& node3,const Handle(SMDS_MeshElement)& node4) ;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement AddVolume(const Handle(SMDS_MeshElement)& node1,const Handle(SMDS_MeshElement)& node2,const Handle(SMDS_MeshElement)& node3,const Handle(SMDS_MeshElement)& node4,const Handle(SMDS_MeshElement)& node5) ;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement AddVolume(const Handle(SMDS_MeshElement)& node1,const Handle(SMDS_MeshElement)& node2,const Handle(SMDS_MeshElement)& node3,const Handle(SMDS_MeshElement)& node4,const Handle(SMDS_MeshElement)& node5,const Handle(SMDS_MeshElement)& node6) ;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement AddVolume(const Handle(SMDS_MeshElement)& node1,const Handle(SMDS_MeshElement)& node2,const Handle(SMDS_MeshElement)& node3,const Handle(SMDS_MeshElement)& node4,const Handle(SMDS_MeshElement)& node5,const Handle(SMDS_MeshElement)& node6,const Handle(SMDS_MeshElement)& node7,const Handle(SMDS_MeshElement)& node8) ;
|
||||
Standard_EXPORT virtual void RemoveNode(const Standard_Integer IDnode) ;
|
||||
Standard_EXPORT virtual void RemoveEdge(const Standard_Integer idnode1,const Standard_Integer idnode2) ;
|
||||
Standard_EXPORT virtual void RemoveFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ;
|
||||
Standard_EXPORT virtual void RemoveFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ;
|
||||
Standard_EXPORT virtual void RemoveElement(const Standard_Integer IDelem,const Standard_Boolean removenodes = Standard_False) ;
|
||||
Standard_EXPORT void RemoveElement(const Handle(SMDS_MeshElement)& elem,const Standard_Boolean removenodes = Standard_False) ;
|
||||
Standard_EXPORT virtual Standard_Boolean RemoveFromParent() ;
|
||||
Standard_EXPORT virtual Standard_Boolean RemoveSubMesh(const Handle(SMDS_Mesh)& aMesh) ;
|
||||
Standard_EXPORT Handle_SMDS_MeshNode GetNode(const Standard_Integer rank,const Handle(SMDS_MeshElement)& ME) const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement FindNode(const Standard_Integer idnode) const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement FindEdge(const Standard_Integer idnode1,const Standard_Integer idnode2) const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement FindFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement FindFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement FindElement(const Standard_Integer IDelem) const;
|
||||
Standard_EXPORT Standard_Boolean Contains(const Handle(SMDS_MeshElement)& elem) const;
|
||||
Standard_EXPORT void RebuildAllInverseConnections() ;
|
||||
Standard_EXPORT void SubMeshIterator(SMDS_ListIteratorOfListOfMesh& itmsh) const;
|
||||
Standard_EXPORT inline Standard_Integer NbNodes() const;
|
||||
Standard_EXPORT inline Standard_Integer NbEdges() const;
|
||||
Standard_EXPORT inline Standard_Integer NbFaces() const;
|
||||
Standard_EXPORT inline Standard_Integer NbVolumes() const;
|
||||
Standard_EXPORT inline Standard_Integer NbSubMesh() const;
|
||||
Standard_EXPORT void DumpNodes() const;
|
||||
Standard_EXPORT void DumpEdges() const;
|
||||
Standard_EXPORT void DumpFaces() const;
|
||||
Standard_EXPORT void DumpVolumes() const;
|
||||
Standard_EXPORT void DebugStats() const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement CreateEdge(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2) const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement CreateFace(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement CreateFace(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement CreateVolume(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement CreateVolume(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5) const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement CreateVolume(const Standard_Integer ID,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_EXPORT Handle_SMDS_MeshElement CreateVolume(const Standard_Integer ID,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) const;
|
||||
Standard_EXPORT ~SMDS_Mesh();
|
||||
SMDS_Mesh();
|
||||
|
||||
SMDS_Iterator<const SMDS_MeshNode *> * nodesIterator() const;
|
||||
SMDS_Iterator<const SMDS_MeshEdge *> * edgesIterator() const;
|
||||
SMDS_Iterator<const SMDS_MeshFace *> * facesIterator() const;
|
||||
SMDS_Iterator<const SMDS_MeshVolume *> * volumesIterator() const;
|
||||
|
||||
friend class SMDS_MeshVolumesIterator;
|
||||
friend class SMDS_MeshFacesIterator;
|
||||
friend class SMDS_MeshEdgesIterator;
|
||||
friend class SMDS_MeshNodesIterator;
|
||||
SMDS_Mesh *AddSubMesh();
|
||||
virtual SMDS_MeshNode* AddNode(double x, double y, double z);
|
||||
virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
|
||||
|
||||
virtual SMDS_MeshEdge* AddEdge(int idnode1, int idnode2);
|
||||
virtual SMDS_MeshEdge* AddEdgeWithID(int idnode1, int idnode2, int ID);
|
||||
virtual SMDS_MeshFace* AddFace(int idnode1, int idnode2, int idnode3);
|
||||
virtual SMDS_MeshFace* AddFaceWithID(int idnode1, int idnode2, int idnode3,
|
||||
int ID);
|
||||
virtual SMDS_MeshFace* AddFace(int idnode1, int idnode2, int idnode3,
|
||||
int idnode4);
|
||||
virtual SMDS_MeshFace* AddFaceWithID(int idnode1, int idnode2, int idnode3,
|
||||
int idnode4, int ID);
|
||||
virtual SMDS_MeshVolume* AddVolume(int idnode1, int idnode2, int idnode3,
|
||||
int idnode4);
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(int idnode1, int idnode2,
|
||||
int idnode3, int idnode4, int ID);
|
||||
virtual SMDS_MeshVolume* AddVolume(int idnode1, int idnode2, int idnode3,
|
||||
int idnode4, int idnode5);
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(int idnode1, int idnode2, int idnode3,
|
||||
int idnode4, int idnode5, int ID);
|
||||
virtual SMDS_MeshVolume* AddVolume(int idnode1, int idnode2, int idnode3,
|
||||
int idnode4, int idnode5, int idnode6);
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(int idnode1, int idnode2,
|
||||
int idnode3, int idnode4, int idnode5, int idnode6, int ID);
|
||||
virtual SMDS_MeshVolume* AddVolume(int idnode1, int idnode2, int idnode3,
|
||||
int idnode4, int idnode5, int idnode6, int idnode7, int idnode8);
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(int idnode1, int idnode2, int idnode3,
|
||||
int idnode4, int idnode5, int idnode6, int idnode7, int idnode8,
|
||||
int ID);
|
||||
virtual void RemoveNode(int IDnode);
|
||||
virtual void RemoveEdge(int idnode1, int idnode2);
|
||||
virtual void RemoveFace(int idnode1, int idnode2, int idnode3);
|
||||
virtual void RemoveFace(int idnode1, int idnode2, int idnode3, int idnode4);
|
||||
virtual void RemoveElement(int IDelem, const bool removenodes = false);
|
||||
void RemoveElement(const SMDS_MeshElement * elem, const bool removenodes =
|
||||
false);
|
||||
bool RemoveNode(const SMDS_MeshNode * node); //Remove a node and elements which need this node
|
||||
void RemoveEdge(const SMDS_MeshEdge * edge);
|
||||
void RemoveFace(const SMDS_MeshFace * face);
|
||||
void RemoveVolume(const SMDS_MeshVolume * volume);
|
||||
|
||||
// Type management
|
||||
//
|
||||
Standard_EXPORT friend Handle_Standard_Type& SMDS_Mesh_Type_();
|
||||
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
|
||||
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
|
||||
virtual bool RemoveFromParent();
|
||||
virtual bool RemoveSubMesh(const SMDS_Mesh * aMesh);
|
||||
|
||||
const SMDS_MeshNode *FindNode(int idnode) const;
|
||||
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const;
|
||||
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3) const;
|
||||
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4) const;
|
||||
const SMDS_MeshElement *FindElement(int IDelem) const;
|
||||
|
||||
int NbNodes() const;
|
||||
int NbEdges() const;
|
||||
int NbFaces() const;
|
||||
int NbVolumes() const;
|
||||
int NbSubMesh() const;
|
||||
void DumpNodes() const;
|
||||
void DumpEdges() const;
|
||||
void DumpFaces() const;
|
||||
void DumpVolumes() const;
|
||||
void DebugStats() const;
|
||||
SMDS_Mesh *boundaryFaces();
|
||||
SMDS_Mesh *boundaryEdges();
|
||||
~SMDS_Mesh();
|
||||
bool hasConstructionEdges();
|
||||
bool hasConstructionFaces();
|
||||
bool hasInverseElements();
|
||||
void setConstructionEdges(bool);
|
||||
void setConstructionFaces(bool);
|
||||
void setInverseElements(bool);
|
||||
|
||||
protected:
|
||||
private:
|
||||
SMDS_Mesh(SMDS_Mesh * parent);
|
||||
SMDS_MeshFace * createTriangle(SMDS_MeshNode * node1,
|
||||
SMDS_MeshNode * node2, SMDS_MeshNode * node3);
|
||||
SMDS_MeshFace * createQuadrangle(SMDS_MeshNode * node1,
|
||||
SMDS_MeshNode * node2, SMDS_MeshNode * node3, SMDS_MeshNode * node4);
|
||||
void removeElementDependencies(SMDS_MeshElement * element);
|
||||
const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2) const;
|
||||
SMDS_MeshEdge* FindEdgeOrCreate(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2);
|
||||
SMDS_MeshFace* FindFaceOrCreate(
|
||||
const SMDS_MeshNode *n1,
|
||||
const SMDS_MeshNode *n2,
|
||||
const SMDS_MeshNode *n3);
|
||||
const SMDS_MeshFace* FindFace(
|
||||
const SMDS_MeshNode *n1,
|
||||
const SMDS_MeshNode *n2,
|
||||
const SMDS_MeshNode *n3,
|
||||
const SMDS_MeshNode *n4) const;
|
||||
SMDS_MeshFace* FindFaceOrCreate(
|
||||
const SMDS_MeshNode *n1,
|
||||
const SMDS_MeshNode *n2,
|
||||
const SMDS_MeshNode *n3,
|
||||
const SMDS_MeshNode *n4);
|
||||
|
||||
// Methods PROTECTED
|
||||
//
|
||||
Standard_EXPORT Handle_SMDS_MeshElement FindNode(const Handle(SMDS_MeshElement)& node) const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement FindEdge(const Handle(SMDS_MeshElement)& edge) const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement FindFace(const Handle(SMDS_MeshElement)& face) const;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement FindVolume(const Handle(SMDS_MeshElement)& volume) const;
|
||||
Standard_EXPORT void RemoveInverseElement(const Handle(SMDS_MeshElement)& node,const Handle(SMDS_MeshElement)& parent) const;
|
||||
Standard_EXPORT Standard_Boolean RemoveNode(const Handle(SMDS_MeshElement)& node) ;
|
||||
Standard_EXPORT void RemoveEdge(const Handle(SMDS_MeshElement)& edge) ;
|
||||
Standard_EXPORT void RemoveFace(const Handle(SMDS_MeshElement)& face) ;
|
||||
Standard_EXPORT void RemoveVolume(const Handle(SMDS_MeshElement)& volume) ;
|
||||
Standard_EXPORT Handle_SMDS_MeshElement GetNode(const Standard_Integer ID) const;
|
||||
Standard_EXPORT void RemoveAncestors(const Handle(SMDS_MeshElement)& ME,const SMDS_MapOfMeshOrientedElement& map) ;
|
||||
|
||||
|
||||
// Fields PROTECTED
|
||||
//
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Methods PRIVATE
|
||||
//
|
||||
Standard_EXPORT SMDS_Mesh(const Handle(SMDS_Mesh)& parent,const Standard_Integer nbnodes = 10);
|
||||
Standard_EXPORT Standard_Boolean AddNode(const Handle(SMDS_MeshElement)& node) ;
|
||||
Standard_EXPORT void FreeNode(const Handle(SMDS_MeshElement)& node) ;
|
||||
Standard_EXPORT void BuildMapNodeAncestors(const Handle(SMDS_MeshElement)& ME,SMDS_MapOfMeshOrientedElement& map) const;
|
||||
Standard_EXPORT void BuildMapEdgeAncestors(const Handle(SMDS_MeshElement)& ME,SMDS_MapOfMeshOrientedElement& map) const;
|
||||
Standard_EXPORT void BuildMapFaceAncestors(const Handle(SMDS_MeshElement)& ME,SMDS_MapOfMeshOrientedElement& map) const;
|
||||
Standard_EXPORT void RebuildInverseConnections() ;
|
||||
|
||||
|
||||
// Fields PRIVATE
|
||||
//
|
||||
SMDS_MapOfMeshOrientedElement myNodes;
|
||||
SMDS_MapOfMeshOrientedElement myEdges;
|
||||
SMDS_MapOfMeshOrientedElement myFaces;
|
||||
SMDS_MapOfMeshOrientedElement myVolumes;
|
||||
Handle_SMDS_Mesh myParent;
|
||||
SMDS_ListOfMesh myChildren;
|
||||
Handle_SMDS_MeshNodeIDFactory myNodeIDFactory;
|
||||
Handle_SMDS_MeshElementIDFactory myElementIDFactory;
|
||||
Standard_Boolean myHasInverse;
|
||||
// Fields PRIVATE
|
||||
typedef set<SMDS_MeshNode *> SetOfNodes;
|
||||
typedef set<SMDS_MeshEdge *> SetOfEdges;
|
||||
typedef set<SMDS_MeshFace *> SetOfFaces;
|
||||
typedef set<SMDS_MeshVolume *> SetOfVolumes;
|
||||
|
||||
SetOfNodes myNodes;
|
||||
SetOfEdges myEdges;
|
||||
SetOfFaces myFaces;
|
||||
SetOfVolumes myVolumes;
|
||||
SMDS_Mesh *myParent;
|
||||
list<SMDS_Mesh *> myChildren;
|
||||
SMDS_MeshElementIDFactory *myNodeIDFactory;
|
||||
SMDS_MeshElementIDFactory *myElementIDFactory;
|
||||
|
||||
bool myHasConstructionEdges;
|
||||
bool myHasConstructionFaces;
|
||||
bool myHasInverseElements;
|
||||
};
|
||||
|
||||
|
||||
#include "SMDS_Mesh.lxx"
|
||||
|
||||
|
||||
|
||||
// other inline functions and methods (like "C++: function call" methods)
|
||||
//
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -25,38 +25,21 @@
|
||||
// Author : Jean-Michel BOULCOURT
|
||||
// Module : SMESH
|
||||
|
||||
using namespace std;
|
||||
#include "SMDS_MeshEdge.ixx"
|
||||
|
||||
#include "SMDS_MeshEdge.hxx"
|
||||
#include "SMDS_IteratorOfElements.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include <iostream>
|
||||
|
||||
//=======================================================================
|
||||
//function : SMDS_MeshEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMDS_MeshEdge::SMDS_MeshEdge(const Standard_Integer ID,
|
||||
const Standard_Integer idnode1,
|
||||
const Standard_Integer idnode2) :
|
||||
SMDS_MeshElement(ID,2,SMDSAbs_Edge)
|
||||
{
|
||||
SetConnections(idnode1,idnode2);
|
||||
ComputeKey();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetConnections
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMDS_MeshEdge::SetConnections(const Standard_Integer idnode1,
|
||||
const Standard_Integer idnode2)
|
||||
{
|
||||
Standard_Integer idmin = (idnode1 < idnode2? idnode1 : idnode2);
|
||||
|
||||
myNodes[0] = idmin;
|
||||
if (idmin == idnode1) {
|
||||
myNodes[1] = idnode2;
|
||||
} else {
|
||||
myNodes[1] = idnode1;
|
||||
}
|
||||
SMDS_MeshEdge::SMDS_MeshEdge(SMDS_MeshNode * node1, SMDS_MeshNode * node2)
|
||||
{
|
||||
myNodes[0]=node1;
|
||||
myNodes[1]=node2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -64,11 +47,81 @@ void SMDS_MeshEdge::SetConnections(const Standard_Integer idnode1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_MeshEdge::Print(Standard_OStream& OS) const
|
||||
void SMDS_MeshEdge::Print(ostream & OS) const
|
||||
{
|
||||
OS << "edge <" << myID <<"> : (" << myNodes[0] << " , " << myNodes[1] << ") " << endl;
|
||||
OS << "edge <" << GetID() << "> : (" << myNodes[0] << " , " << myNodes[1] <<
|
||||
") " << endl;
|
||||
}
|
||||
|
||||
int SMDS_MeshEdge::NbNodes() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
int SMDS_MeshEdge::NbEdges() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SMDSAbs_ElementType SMDS_MeshEdge::GetType() const
|
||||
{
|
||||
return SMDSAbs_Edge;
|
||||
}
|
||||
|
||||
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshEdge::
|
||||
elementsIterator(SMDSAbs_ElementType type) const
|
||||
{
|
||||
class MyNodeIterator:public SMDS_Iterator<const SMDS_MeshElement *>
|
||||
{
|
||||
SMDS_MeshNode *const* myNodes;
|
||||
int myIndex;
|
||||
public:
|
||||
MyNodeIterator(SMDS_MeshNode * const* nodes):myNodes(nodes),myIndex(0)
|
||||
{}
|
||||
|
||||
bool more()
|
||||
{
|
||||
return myIndex<2;
|
||||
}
|
||||
|
||||
const SMDS_MeshElement* next()
|
||||
{
|
||||
myIndex++;
|
||||
return myNodes[myIndex-1];
|
||||
}
|
||||
};
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case SMDSAbs_Edge:return SMDS_MeshElement::elementsIterator(SMDSAbs_Edge);
|
||||
case SMDSAbs_Node:return new MyNodeIterator(myNodes);
|
||||
default: return new SMDS_IteratorOfElements(this,type, nodesIterator());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool operator<(const SMDS_MeshEdge & e1, const SMDS_MeshEdge & e2)
|
||||
{
|
||||
int id11=e1.myNodes[0]->GetID();
|
||||
int id21=e2.myNodes[0]->GetID();
|
||||
int id12=e1.myNodes[1]->GetID();
|
||||
int id22=e2.myNodes[1]->GetID();
|
||||
int tmp;
|
||||
|
||||
if(id11>=id12)
|
||||
{
|
||||
tmp=id11;
|
||||
id11=id12;
|
||||
id12=tmp;
|
||||
}
|
||||
if(id21>=id22)
|
||||
{
|
||||
tmp=id21;
|
||||
id21=id22;
|
||||
id22=tmp;
|
||||
}
|
||||
|
||||
if(id11<id21) return true;
|
||||
else if(id11==id21) return (id21<id22);
|
||||
else return false;
|
||||
}
|
||||
|
@ -27,98 +27,26 @@
|
||||
#ifndef _SMDS_MeshEdge_HeaderFile
|
||||
#define _SMDS_MeshEdge_HeaderFile
|
||||
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Handle_SMDS_MeshEdge_HeaderFile
|
||||
#include "Handle_SMDS_MeshEdge.hxx"
|
||||
#endif
|
||||
|
||||
#ifndef _Standard_Integer_HeaderFile
|
||||
#include <Standard_Integer.hxx>
|
||||
#endif
|
||||
#ifndef _SMDS_MeshElement_HeaderFile
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#endif
|
||||
#ifndef _Standard_Address_HeaderFile
|
||||
#include <Standard_Address.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_OStream_HeaderFile
|
||||
#include <Standard_OStream.hxx>
|
||||
#endif
|
||||
#include <ostream>
|
||||
|
||||
class SMDS_MeshEdge:public SMDS_MeshElement
|
||||
{
|
||||
|
||||
class SMDS_MeshEdge : public SMDS_MeshElement {
|
||||
public:
|
||||
SMDS_MeshEdge(SMDS_MeshNode * node1, SMDS_MeshNode * node2);
|
||||
void Print(ostream & OS) const;
|
||||
|
||||
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_MeshEdge(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2);
|
||||
Standard_EXPORT inline void ComputeKey() ;
|
||||
Standard_EXPORT inline Standard_Integer GetKey() const;
|
||||
Standard_EXPORT inline Standard_Address GetConnections() const;
|
||||
Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const;
|
||||
Standard_EXPORT void Print(Standard_OStream& OS) const;
|
||||
Standard_EXPORT ~SMDS_MeshEdge();
|
||||
|
||||
|
||||
|
||||
|
||||
// Type management
|
||||
//
|
||||
Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshEdge_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 void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2) ;
|
||||
|
||||
|
||||
// Fields PRIVATE
|
||||
//
|
||||
Standard_Integer myKey;
|
||||
Standard_Integer myNodes[2];
|
||||
SMDSAbs_ElementType GetType() const;
|
||||
int NbNodes() const;
|
||||
int NbEdges() const;
|
||||
friend bool operator<(const SMDS_MeshEdge& e1, const SMDS_MeshEdge& e2);
|
||||
protected:
|
||||
SMDS_Iterator<const SMDS_MeshElement *> *
|
||||
elementsIterator(SMDSAbs_ElementType type) const;
|
||||
|
||||
private:
|
||||
SMDS_MeshNode* myNodes[2];
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include "SMDS_MeshEdge.lxx"
|
||||
|
||||
|
||||
|
||||
// other inline functions and methods (like "C++: function call" methods)
|
||||
//
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -18,181 +18,172 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_MeshElement.cxx
|
||||
// Author : Jean-Michel BOULCOURT
|
||||
// Module : SMESH
|
||||
|
||||
using namespace std;
|
||||
#include "SMDS_MeshElement.ixx"
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMDS_MeshEdge.hxx"
|
||||
#include "SMDS_MeshFace.hxx"
|
||||
#include "SMDS_MeshVolume.hxx"
|
||||
#include "utilities.h"
|
||||
|
||||
//=======================================================================
|
||||
//function : SMDS_MeshElement
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMDS_MeshElement::SMDS_MeshElement(const Standard_Integer ID, const Standard_Integer nb,const SMDSAbs_ElementType Type)
|
||||
:myID(ID),myNbNodes(nb),myType(Type)
|
||||
SMDS_MeshElement::SMDS_MeshElement(int ID):myID(ID)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetConnections
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Address SMDS_MeshElement::GetConnections() const
|
||||
void SMDS_MeshElement::Print(ostream & OS) const
|
||||
{
|
||||
return (Standard_Address)&myID;
|
||||
OS << "dump of mesh element" << endl;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetConnection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer SMDS_MeshElement::GetConnection(const Standard_Integer rank) const
|
||||
ostream & operator <<(ostream & OS, const SMDS_MeshElement * ME)
|
||||
{
|
||||
return myID;
|
||||
ME->Print(OS);
|
||||
return OS;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : InverseElements
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const SMDS_ListOfMeshElement& SMDS_MeshElement::InverseElements() const
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Create an iterator which iterate on nodes owned by the element.
|
||||
/// This method call elementsIterator().
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshElement::nodesIterator() const
|
||||
{
|
||||
static SMDS_ListOfMeshElement empty;
|
||||
return empty;
|
||||
return elementsIterator(SMDSAbs_Node);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ClearInverseElements
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_MeshElement::ClearInverseElements()
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Create an iterator which iterate on edges linked with or owned by the element.
|
||||
/// This method call elementsIterator().
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshElement::edgesIterator() const
|
||||
{
|
||||
return elementsIterator(SMDSAbs_Edge);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddInverseElement
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_MeshElement::AddInverseElement(const Handle(SMDS_MeshElement)& elem)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Create an iterator which iterate on faces linked with or owned by the element.
|
||||
/// This method call elementsIterator().
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshElement::facesIterator() const
|
||||
{
|
||||
return elementsIterator(SMDSAbs_Face);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer SMDS_MeshElement::NbEdges() const
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///Return The number of nodes owned by the current element
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int SMDS_MeshElement::NbNodes() const
|
||||
{
|
||||
return 0;
|
||||
int nbnodes=0;
|
||||
SMDS_Iterator<const SMDS_MeshElement *> * it=nodesIterator();
|
||||
while(it->more())
|
||||
{
|
||||
it->next();
|
||||
nbnodes++;
|
||||
}
|
||||
delete it;
|
||||
return nbnodes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer SMDS_MeshElement::NbFaces() const
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///Return the number of edges owned by or linked with the current element
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int SMDS_MeshElement::NbEdges() const
|
||||
{
|
||||
return 0;
|
||||
int nbedges=0;
|
||||
SMDS_Iterator<const SMDS_MeshElement *> * it=edgesIterator();
|
||||
while(it->more())
|
||||
{
|
||||
it->next();
|
||||
nbedges++;
|
||||
}
|
||||
delete it;
|
||||
return nbedges;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetEdgeDefinedByNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_MeshElement::GetEdgeDefinedByNodes(const Standard_Integer rank,
|
||||
Standard_Integer& idnode1,
|
||||
Standard_Integer& idnode2) const
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///Return the number of faces owned by or linked with the current element
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int SMDS_MeshElement::NbFaces() const
|
||||
{
|
||||
idnode1 = 0;
|
||||
idnode2 = 0;
|
||||
int nbfaces=0;
|
||||
SMDS_Iterator<const SMDS_MeshElement *> * it=facesIterator();
|
||||
while(it->more())
|
||||
{
|
||||
it->next();
|
||||
nbfaces++;
|
||||
}
|
||||
delete it;
|
||||
return nbfaces;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetFaceDefinedByNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_MeshElement::GetFaceDefinedByNodes(const Standard_Integer rank,
|
||||
const Standard_Address idnode,
|
||||
Standard_Integer& nb) const
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///Create and iterator which iterate on elements linked with the current element.
|
||||
///The iterator must be free by the caller (call delete myIterator).
|
||||
///@param type The of elements on which you want to iterate
|
||||
///@return An iterator, that you must free when you no longer need it
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshElement::
|
||||
elementsIterator(SMDSAbs_ElementType type) const
|
||||
{
|
||||
nb = 0;
|
||||
class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*>
|
||||
{
|
||||
const SMDS_MeshElement * myElement;
|
||||
bool myMore;
|
||||
public:
|
||||
MyIterator(const SMDS_MeshElement * element):
|
||||
myElement(element),myMore(true)
|
||||
{
|
||||
}
|
||||
|
||||
bool more()
|
||||
{
|
||||
return myMore;
|
||||
}
|
||||
|
||||
const SMDS_MeshElement* next()
|
||||
{
|
||||
myMore=false;
|
||||
return myElement;
|
||||
}
|
||||
};
|
||||
|
||||
if(type==GetType()) return new MyIterator(this);
|
||||
else
|
||||
{
|
||||
MESSAGE("Iterator not implemented");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetNormal
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_MeshElement::SetNormal(const Standard_Integer rank,
|
||||
const Standard_Real vx,
|
||||
const Standard_Real vy,
|
||||
const Standard_Real vz)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///Return the ID of the element
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int SMDS_MeshElement::GetID() const
|
||||
{
|
||||
if (myNormals.IsNull()) {
|
||||
myNormals = new TColgp_HArray1OfDir(1,NbNodes());
|
||||
}
|
||||
myNormals->SetValue(rank, gp_Dir(vx,vy,vz));
|
||||
return myID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetNormal
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_MeshElement::SetNormal(const Standard_Integer rank,
|
||||
const gp_Vec& V)
|
||||
bool operator<(const SMDS_MeshElement& e1, const SMDS_MeshElement& e2)
|
||||
{
|
||||
if (myNormals.IsNull()) {
|
||||
myNormals = new TColgp_HArray1OfDir(1,NbNodes());
|
||||
}
|
||||
myNormals->SetValue(rank, gp_Dir(V));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetNormal
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Dir SMDS_MeshElement::GetNormal(const Standard_Integer rank)
|
||||
{
|
||||
if (myNormals.IsNull()) {
|
||||
myNormals = new TColgp_HArray1OfDir(1,NbNodes());
|
||||
}
|
||||
return myNormals->Value(rank);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Print
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_MeshElement::Print(Standard_OStream& OS) const
|
||||
{
|
||||
OS << "dump of mesh element" << endl;
|
||||
}
|
||||
|
||||
|
||||
Standard_OStream& operator << (Standard_OStream& OS
|
||||
,const Handle(SMDS_MeshElement)& ME)
|
||||
{
|
||||
ME->Print(OS);
|
||||
return OS;
|
||||
if(e1.GetType()!=e2.GetType()) return false;
|
||||
switch(e1.GetType())
|
||||
{
|
||||
case SMDSAbs_Node:
|
||||
return static_cast<const SMDS_MeshNode &>(e1) <
|
||||
static_cast<const SMDS_MeshNode &>(e2);
|
||||
|
||||
case SMDSAbs_Edge:
|
||||
return static_cast<const SMDS_MeshEdge &>(e1) <
|
||||
static_cast<const SMDS_MeshEdge &>(e2);
|
||||
|
||||
case SMDSAbs_Face:
|
||||
return static_cast<const SMDS_MeshFace &>(e1) <
|
||||
static_cast<const SMDS_MeshFace &>(e2);
|
||||
|
||||
case SMDSAbs_Volume:
|
||||
return static_cast<const SMDS_MeshVolume &>(e1) <
|
||||
static_cast<const SMDS_MeshVolume &>(e2);
|
||||
|
||||
default : MESSAGE("Internal Error");
|
||||
}
|
||||
}
|
||||
|
@ -26,134 +26,49 @@
|
||||
|
||||
#ifndef _SMDS_MeshElement_HeaderFile
|
||||
#define _SMDS_MeshElement_HeaderFile
|
||||
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Handle_SMDS_MeshElement_HeaderFile
|
||||
#include "Handle_SMDS_MeshElement.hxx"
|
||||
#endif
|
||||
|
||||
#ifndef _Standard_Integer_HeaderFile
|
||||
#include <Standard_Integer.hxx>
|
||||
#endif
|
||||
#ifndef _SMDSAbs_ElementType_HeaderFile
|
||||
|
||||
#include "SMDSAbs_ElementType.hxx"
|
||||
#endif
|
||||
#ifndef _Handle_TColgp_HArray1OfDir_HeaderFile
|
||||
#include "Handle_TColgp_HArray1OfDir.hxx"
|
||||
#endif
|
||||
#ifndef _SMDS_MeshObject_HeaderFile
|
||||
#include "SMDS_MeshObject.hxx"
|
||||
#endif
|
||||
#ifndef _Standard_Boolean_HeaderFile
|
||||
#include <Standard_Boolean.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Address_HeaderFile
|
||||
#include <Standard_Address.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Real_HeaderFile
|
||||
#include <Standard_Real.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_OStream_HeaderFile
|
||||
#include <Standard_OStream.hxx>
|
||||
#endif
|
||||
class TColgp_HArray1OfDir;
|
||||
class Standard_OutOfRange;
|
||||
class SMDS_ListOfMeshElement;
|
||||
class gp_Vec;
|
||||
class gp_Dir;
|
||||
#include "SMDS_Iterator.hxx"
|
||||
#include "SMDS_MeshElementIDFactory.hxx"
|
||||
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
|
||||
class SMDS_MeshElement : public SMDS_MeshObject {
|
||||
using namespace std;
|
||||
class SMDS_MeshNode;
|
||||
class SMDS_MeshEdge;
|
||||
class SMDS_MeshFace;
|
||||
|
||||
public:
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Base class for elements
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class SMDS_MeshElement:public SMDS_MeshObject
|
||||
{
|
||||
|
||||
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 inline Standard_Integer HashCode(const Standard_Integer Upper) const;
|
||||
Standard_EXPORT inline Standard_Boolean IsSame(const Handle(SMDS_MeshElement)& other) const;
|
||||
Standard_EXPORT inline Standard_Boolean IsEqual(const Handle(SMDS_MeshElement)& other) const;
|
||||
Standard_EXPORT inline Standard_Boolean IsNodeInElement(const Standard_Integer idnode) const;
|
||||
Standard_EXPORT virtual void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const;
|
||||
Standard_EXPORT virtual void GetFaceDefinedByNodes(const Standard_Integer rank,const Standard_Address idnode,Standard_Integer& nb) const;
|
||||
Standard_EXPORT virtual Standard_Integer GetConnection(const Standard_Integer rank) const;
|
||||
Standard_EXPORT virtual void AddInverseElement(const Handle(SMDS_MeshElement)& ME) ;
|
||||
Standard_EXPORT virtual const SMDS_ListOfMeshElement& InverseElements() const;
|
||||
Standard_EXPORT virtual void ClearInverseElements() ;
|
||||
Standard_EXPORT inline Standard_Integer NbNodes() const;
|
||||
Standard_EXPORT virtual Standard_Integer NbEdges() const;
|
||||
Standard_EXPORT virtual Standard_Integer NbFaces() const;
|
||||
Standard_EXPORT inline Standard_Integer GetID() const;
|
||||
Standard_EXPORT virtual Standard_Integer GetKey() const = 0;
|
||||
Standard_EXPORT virtual void SetNormal(const Standard_Integer rank,const Standard_Real vx,const Standard_Real vy,const Standard_Real vz) ;
|
||||
Standard_EXPORT virtual void SetNormal(const Standard_Integer rank,const gp_Vec& v) ;
|
||||
Standard_EXPORT virtual gp_Dir GetNormal(const Standard_Integer rank) ;
|
||||
Standard_EXPORT virtual void Print(Standard_OStream& OS) const;
|
||||
friend Standard_EXPORT Standard_OStream& operator << (Standard_OStream& OS, const Handle(SMDS_MeshElement)& );
|
||||
Standard_EXPORT inline SMDSAbs_ElementType GetType() const;
|
||||
Standard_EXPORT ~SMDS_MeshElement();
|
||||
public:
|
||||
SMDS_Iterator<const SMDS_MeshElement *> * nodesIterator() const;
|
||||
SMDS_Iterator<const SMDS_MeshElement *> * edgesIterator() const;
|
||||
SMDS_Iterator<const SMDS_MeshElement *> * facesIterator() const;
|
||||
virtual SMDS_Iterator<const SMDS_MeshElement *> *
|
||||
elementsIterator(SMDSAbs_ElementType type) const;
|
||||
|
||||
virtual int NbNodes() const;
|
||||
virtual int NbEdges() const;
|
||||
virtual int NbFaces() const;
|
||||
int GetID() const;
|
||||
|
||||
///Return the type of the current element
|
||||
virtual SMDSAbs_ElementType GetType() const = 0;
|
||||
friend ostream & operator <<(ostream & OS, const SMDS_MeshElement *);
|
||||
friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem);
|
||||
|
||||
|
||||
// Type management
|
||||
//
|
||||
Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshElement_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_MeshElement(const Standard_Integer ID,const Standard_Integer NbConnections,const SMDSAbs_ElementType Type);
|
||||
Standard_EXPORT virtual Standard_Address GetConnections() const;
|
||||
|
||||
|
||||
// Fields PROTECTED
|
||||
//
|
||||
Standard_Integer myID;
|
||||
Standard_Integer myNbNodes;
|
||||
Handle_TColgp_HArray1OfDir myNormals;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Methods PRIVATE
|
||||
//
|
||||
|
||||
|
||||
// Fields PRIVATE
|
||||
//
|
||||
SMDSAbs_ElementType myType;
|
||||
|
||||
|
||||
protected:
|
||||
SMDS_MeshElement(int ID=-1);
|
||||
virtual void Print(ostream & OS) const;
|
||||
|
||||
private:
|
||||
int myID;
|
||||
};
|
||||
|
||||
|
||||
#include "SMDS_MeshElement.lxx"
|
||||
|
||||
|
||||
|
||||
// other inline functions and methods (like "C++: function call" methods)
|
||||
//
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -18,49 +18,10 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_MeshFace.cxx
|
||||
// Author : Jean-Michel BOULCOURT
|
||||
// Module : SMESH
|
||||
|
||||
using namespace std;
|
||||
#include "SMDS_MeshFace.ixx"
|
||||
#include "SMDS_MeshFace.hxx"
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SMDS_MeshFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMDS_MeshFace::SMDS_MeshFace(const Standard_Integer ID, const Standard_Integer nb)
|
||||
:SMDS_MeshElement(ID,nb,SMDSAbs_Face)
|
||||
SMDSAbs_ElementType SMDS_MeshFace::GetType() const
|
||||
{
|
||||
return SMDSAbs_Face;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer SMDS_MeshFace::NbEdges() const
|
||||
{
|
||||
return myNbNodes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Print
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_MeshFace::Print(Standard_OStream& OS) const
|
||||
{
|
||||
OS << "face <" << myID <<" > : ";
|
||||
for (Standard_Integer i=1; i<myNbNodes; ++i)
|
||||
OS << GetConnection(i) << ",";
|
||||
OS << GetConnection(myNbNodes) << ") " << endl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,92 +27,12 @@
|
||||
#ifndef _SMDS_MeshFace_HeaderFile
|
||||
#define _SMDS_MeshFace_HeaderFile
|
||||
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Handle_SMDS_MeshFace_HeaderFile
|
||||
#include "Handle_SMDS_MeshFace.hxx"
|
||||
#endif
|
||||
|
||||
#ifndef _Standard_Integer_HeaderFile
|
||||
#include <Standard_Integer.hxx>
|
||||
#endif
|
||||
#ifndef _SMDS_MeshElement_HeaderFile
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#endif
|
||||
#ifndef _Standard_OStream_HeaderFile
|
||||
#include <Standard_OStream.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
class SMDS_MeshFace : public SMDS_MeshElement {
|
||||
|
||||
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 void ComputeKey() = 0;
|
||||
Standard_EXPORT inline Standard_Integer GetKey() const;
|
||||
Standard_EXPORT virtual Standard_Integer NbEdges() const;
|
||||
Standard_EXPORT virtual void Print(Standard_OStream& OS) const;
|
||||
Standard_EXPORT ~SMDS_MeshFace();
|
||||
|
||||
|
||||
|
||||
|
||||
// Type management
|
||||
//
|
||||
Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshFace_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_MeshFace(const Standard_Integer ID,const Standard_Integer NbConnections);
|
||||
|
||||
|
||||
// Fields PROTECTED
|
||||
//
|
||||
Standard_Integer myKey;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Methods PRIVATE
|
||||
//
|
||||
|
||||
|
||||
// Fields PRIVATE
|
||||
//
|
||||
|
||||
|
||||
class SMDS_MeshFace:public SMDS_MeshElement
|
||||
{
|
||||
public:
|
||||
SMDSAbs_ElementType GetType() const;
|
||||
};
|
||||
|
||||
|
||||
#include "SMDS_MeshFace.lxx"
|
||||
|
||||
|
||||
|
||||
// other inline functions and methods (like "C++: function call" methods)
|
||||
//
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -18,78 +18,52 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_MeshNode.cxx
|
||||
// Author : Jean-Michel BOULCOURT
|
||||
// Module : SMESH
|
||||
|
||||
using namespace std;
|
||||
#include "SMDS_MeshNode.ixx"
|
||||
#include "SMDS_ListIteratorOfListOfMeshElement.hxx"
|
||||
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMDS_SpacePosition.hxx"
|
||||
|
||||
static Handle(SMDS_Position)& StaticInstancePosition()
|
||||
{
|
||||
static Handle(SMDS_SpacePosition) staticpos;
|
||||
if (staticpos.IsNull())
|
||||
staticpos = new SMDS_SpacePosition();
|
||||
|
||||
return staticpos;
|
||||
}
|
||||
#include "SMDS_IteratorOfElements.hxx"
|
||||
|
||||
//=======================================================================
|
||||
//function : SMDS_MeshNode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMDS_MeshNode::SMDS_MeshNode(const Standard_Integer ID,
|
||||
const Standard_Real x, const Standard_Real y, const Standard_Real z) :
|
||||
SMDS_MeshElement(ID,1,SMDSAbs_Node),myPnt(x,y,z),myPosition(StaticInstancePosition())
|
||||
SMDS_MeshNode::SMDS_MeshNode(double x, double y, double z):
|
||||
myX(x), myY(y), myZ(z),
|
||||
myPosition(SMDS_SpacePosition::originSpacePosition())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveInverseElement
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_MeshNode::RemoveInverseElement(const Handle(SMDS_MeshElement)& parent)
|
||||
void SMDS_MeshNode::RemoveInverseElement(const SMDS_MeshElement * parent)
|
||||
{
|
||||
|
||||
SMDS_ListIteratorOfListOfMeshElement itLstInvCnx(myInverseElements);
|
||||
|
||||
for (;itLstInvCnx.More();itLstInvCnx.Next()) {
|
||||
Handle(SMDS_MeshElement)& ME = itLstInvCnx.Value();
|
||||
if (ME->IsSame(parent))
|
||||
myInverseElements.Remove(itLstInvCnx);
|
||||
if (!itLstInvCnx.More())
|
||||
break;
|
||||
}
|
||||
myInverseElements.erase(parent);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Print
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_MeshNode::Print(Standard_OStream& OS) const
|
||||
void SMDS_MeshNode::Print(ostream & OS) const
|
||||
{
|
||||
OS << "Node <" << myID << "> : X = " << myPnt.X() << " Y = " << myPnt.Y() << " Z = " << myPnt.Z() << endl;
|
||||
OS << "Node <" << GetID() << "> : X = " << myX << " Y = "
|
||||
<< myY << " Z = " << myZ << endl;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPosition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_MeshNode::SetPosition(const Handle(SMDS_Position)& aPos)
|
||||
void SMDS_MeshNode::SetPosition(SMDS_Position * aPos)
|
||||
{
|
||||
myPosition = aPos;
|
||||
myPosition = aPos;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -97,8 +71,164 @@ void SMDS_MeshNode::SetPosition(const Handle(SMDS_Position)& aPos)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(SMDS_Position) SMDS_MeshNode::GetPosition() const
|
||||
SMDS_Position *SMDS_MeshNode::GetPosition()
|
||||
{
|
||||
return myPosition;
|
||||
return myPosition;
|
||||
}
|
||||
|
||||
const SMDS_Position *SMDS_MeshNode::GetPosition() const
|
||||
{
|
||||
return myPosition;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
SMDS_Iterator<const SMDS_MeshElement*> * SMDS_MeshNode::
|
||||
GetInverseElementIterator() const
|
||||
{
|
||||
class SMDS_InverseElementIterator:public SMDS_Iterator<const SMDS_MeshElement*>
|
||||
{
|
||||
const set<const SMDS_MeshElement*>& mySet;
|
||||
set<const SMDS_MeshElement*>::iterator myIterator;
|
||||
public:
|
||||
SMDS_InverseElementIterator(const set<const SMDS_MeshElement*>& s):mySet(s)
|
||||
{
|
||||
myIterator=mySet.begin();
|
||||
}
|
||||
|
||||
bool more()
|
||||
{
|
||||
myIterator!=mySet.end();
|
||||
}
|
||||
|
||||
const SMDS_MeshElement* next()
|
||||
{
|
||||
const SMDS_MeshElement* current=*myIterator;
|
||||
myIterator++;
|
||||
return current;
|
||||
}
|
||||
};
|
||||
return new SMDS_InverseElementIterator(myInverseElements);
|
||||
}
|
||||
|
||||
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshNode::
|
||||
elementsIterator(SMDSAbs_ElementType type) const
|
||||
{
|
||||
// Same as GetInverseElementIterator but the create iterator only return
|
||||
// wanted type elements.
|
||||
class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*>
|
||||
{
|
||||
set<const SMDS_MeshElement*> mySet;
|
||||
set<const SMDS_MeshElement*>::iterator myIterator;
|
||||
public:
|
||||
MyIterator(SMDSAbs_ElementType type,
|
||||
const set<const SMDS_MeshElement*>& s)
|
||||
{
|
||||
const SMDS_MeshElement * e;
|
||||
bool toInsert;
|
||||
set<const SMDS_MeshElement*>::iterator it=s.begin();
|
||||
while(it!=s.end())
|
||||
{
|
||||
e=*it;
|
||||
switch(type)
|
||||
{
|
||||
case SMDSAbs_Edge: toInsert=true; break;
|
||||
case SMDSAbs_Face: toInsert=(e->GetType()!=SMDSAbs_Edge); break;
|
||||
case SMDSAbs_Volume: toInsert=(e->GetType()==SMDSAbs_Volume); break;
|
||||
}
|
||||
if(toInsert) mySet.insert(e);
|
||||
it++;
|
||||
}
|
||||
myIterator=mySet.begin();
|
||||
}
|
||||
|
||||
bool more()
|
||||
{
|
||||
myIterator!=mySet.end();
|
||||
}
|
||||
|
||||
const SMDS_MeshElement* next()
|
||||
{
|
||||
const SMDS_MeshElement* current=*myIterator;
|
||||
myIterator++;
|
||||
return current;
|
||||
}
|
||||
};
|
||||
|
||||
if(type==SMDSAbs_Node)
|
||||
return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
|
||||
else
|
||||
return new SMDS_IteratorOfElements(this,type,
|
||||
new MyIterator(type, myInverseElements));
|
||||
}
|
||||
|
||||
int SMDS_MeshNode::NbNodes() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
double SMDS_MeshNode::X() const
|
||||
{
|
||||
return myX;
|
||||
}
|
||||
|
||||
double SMDS_MeshNode::Y() const
|
||||
{
|
||||
return myY;
|
||||
}
|
||||
|
||||
double SMDS_MeshNode::Z() const
|
||||
{
|
||||
return myZ;
|
||||
}
|
||||
|
||||
void SMDS_MeshNode::setXYZ(double x, double y, double z)
|
||||
{
|
||||
myX=x;
|
||||
myY=y;
|
||||
myZ=z;
|
||||
}
|
||||
|
||||
SMDSAbs_ElementType SMDS_MeshNode::GetType() const
|
||||
{
|
||||
return SMDSAbs_Node;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddInverseElement
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
|
||||
{
|
||||
myInverseElements.insert(ME);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ClearInverseElements
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMDS_MeshNode::ClearInverseElements()
|
||||
{
|
||||
myInverseElements.clear();
|
||||
}
|
||||
|
||||
bool SMDS_MeshNode::emptyInverseElements()
|
||||
{
|
||||
return myInverseElements.empty();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// To be used with STL set
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2)
|
||||
{
|
||||
return e1.GetID()<e2.GetID();
|
||||
/*if(e1.myX<e2.myX) return true;
|
||||
else if(e1.myX==e2.myX)
|
||||
{
|
||||
if(e1.myY<e2.myY) return true;
|
||||
else if(e1.myY==e2.myY) return (e1.myZ<e2.myZ);
|
||||
else return false;
|
||||
}
|
||||
else return false;*/
|
||||
}
|
||||
|
||||
|
@ -27,122 +27,42 @@
|
||||
#ifndef _SMDS_MeshNode_HeaderFile
|
||||
#define _SMDS_MeshNode_HeaderFile
|
||||
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Handle_SMDS_MeshNode_HeaderFile
|
||||
#include "Handle_SMDS_MeshNode.hxx"
|
||||
#endif
|
||||
|
||||
#ifndef _gp_Pnt_HeaderFile
|
||||
#include <gp_Pnt.hxx>
|
||||
#endif
|
||||
#ifndef _SMDS_ListOfMeshElement_HeaderFile
|
||||
#include "SMDS_ListOfMeshElement.hxx"
|
||||
#endif
|
||||
#ifndef _Handle_SMDS_Position_HeaderFile
|
||||
#include "Handle_SMDS_Position.hxx"
|
||||
#endif
|
||||
#ifndef _SMDS_MeshElement_HeaderFile
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#endif
|
||||
#ifndef _Standard_Integer_HeaderFile
|
||||
#include <Standard_Integer.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Real_HeaderFile
|
||||
#include <Standard_Real.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_OStream_HeaderFile
|
||||
#include <Standard_OStream.hxx>
|
||||
#endif
|
||||
#ifndef _Handle_SMDS_MeshElement_HeaderFile
|
||||
#include "Handle_SMDS_MeshElement.hxx"
|
||||
#endif
|
||||
class SMDS_Position;
|
||||
class gp_Pnt;
|
||||
class SMDS_MeshElement;
|
||||
class SMDS_ListOfMeshElement;
|
||||
#include "SMDS_Position.hxx"
|
||||
|
||||
#include <set>
|
||||
using namespace std;
|
||||
|
||||
class SMDS_MeshNode : public SMDS_MeshElement {
|
||||
class SMDS_MeshNode:public SMDS_MeshElement
|
||||
{
|
||||
|
||||
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_MeshNode(const Standard_Integer ID,const Standard_Real x,const Standard_Real y,const Standard_Real z);
|
||||
Standard_EXPORT void Print(Standard_OStream& OS) const;
|
||||
Standard_EXPORT inline Standard_Integer GetKey() const;
|
||||
Standard_EXPORT inline Standard_Real X() const;
|
||||
Standard_EXPORT inline Standard_Real Y() const;
|
||||
Standard_EXPORT inline Standard_Real Z() const;
|
||||
Standard_EXPORT inline gp_Pnt Pnt() const;
|
||||
Standard_EXPORT inline void SetPnt(const gp_Pnt& P) ;
|
||||
Standard_EXPORT inline void AddInverseElement(const Handle(SMDS_MeshElement)& ME) ;
|
||||
Standard_EXPORT void RemoveInverseElement(const Handle(SMDS_MeshElement)& parent) ;
|
||||
Standard_EXPORT inline const SMDS_ListOfMeshElement& InverseElements() const;
|
||||
Standard_EXPORT inline void ClearInverseElements() ;
|
||||
Standard_EXPORT void SetPosition(const Handle(SMDS_Position)& aPos) ;
|
||||
Standard_EXPORT Handle_SMDS_Position GetPosition() const;
|
||||
Standard_EXPORT ~SMDS_MeshNode();
|
||||
|
||||
|
||||
|
||||
|
||||
// Type management
|
||||
//
|
||||
Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshNode_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 myPnt;
|
||||
SMDS_ListOfMeshElement myInverseElements;
|
||||
Handle_SMDS_Position myPosition;
|
||||
public:
|
||||
SMDS_MeshNode(double x, double y, double z);
|
||||
void Print(ostream & OS) const;
|
||||
double X() const;
|
||||
double Y() const;
|
||||
double Z() const;
|
||||
void AddInverseElement(const SMDS_MeshElement * ME);
|
||||
void RemoveInverseElement(const SMDS_MeshElement * parent);
|
||||
void ClearInverseElements();
|
||||
bool emptyInverseElements();
|
||||
SMDS_Iterator<const SMDS_MeshElement*> * GetInverseElementIterator() const;
|
||||
void SetPosition(SMDS_Position * aPos);
|
||||
SMDS_Position *GetPosition();
|
||||
const SMDS_Position *GetPosition() const;
|
||||
SMDSAbs_ElementType GetType() const;
|
||||
int NbNodes() const;
|
||||
void setXYZ(double x, double y, double z);
|
||||
friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2);
|
||||
|
||||
protected:
|
||||
SMDS_Iterator<const SMDS_MeshElement *> *
|
||||
elementsIterator(SMDSAbs_ElementType type) const;
|
||||
|
||||
private:
|
||||
double myX, myY, myZ;
|
||||
SMDS_Position *myPosition;
|
||||
set<const SMDS_MeshElement*> myInverseElements;
|
||||
};
|
||||
|
||||
|
||||
#include "SMDS_MeshNode.lxx"
|
||||
|
||||
|
||||
|
||||
// other inline functions and methods (like "C++: function call" methods)
|
||||
//
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -25,31 +25,14 @@
|
||||
// Author : Jean-Michel BOULCOURT
|
||||
// Module : SMESH
|
||||
|
||||
using namespace std;
|
||||
#include "SMDS_MeshVolume.ixx"
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : SMDS_MeshVolume
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMDS_MeshVolume::SMDS_MeshVolume(const Standard_Integer ID, const Standard_Integer nb)
|
||||
:SMDS_MeshElement(ID,nb,SMDSAbs_Volume)
|
||||
{
|
||||
}
|
||||
|
||||
#include "SMDS_MeshVolume.hxx"
|
||||
//=======================================================================
|
||||
//function : Print
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_MeshVolume::Print(Standard_OStream& OS) const
|
||||
SMDSAbs_ElementType SMDS_MeshVolume::GetType() const
|
||||
{
|
||||
OS << "volume <" << myID <<"> : " ;
|
||||
for (Standard_Integer i=1; i<myNbNodes; ++i)
|
||||
OS << GetConnection(i) << ",";
|
||||
OS << GetConnection(myNbNodes) << ") " << endl;
|
||||
return SMDSAbs_Volume;
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,92 +27,12 @@
|
||||
#ifndef _SMDS_MeshVolume_HeaderFile
|
||||
#define _SMDS_MeshVolume_HeaderFile
|
||||
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Handle_SMDS_MeshVolume_HeaderFile
|
||||
#include "Handle_SMDS_MeshVolume.hxx"
|
||||
#endif
|
||||
|
||||
#ifndef _Standard_Integer_HeaderFile
|
||||
#include <Standard_Integer.hxx>
|
||||
#endif
|
||||
#ifndef _SMDS_MeshElement_HeaderFile
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#endif
|
||||
#ifndef _Standard_OStream_HeaderFile
|
||||
#include <Standard_OStream.hxx>
|
||||
#endif
|
||||
class Standard_ConstructionError;
|
||||
|
||||
|
||||
class SMDS_MeshVolume : public SMDS_MeshElement {
|
||||
|
||||
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 void ComputeKey() = 0;
|
||||
Standard_EXPORT inline Standard_Integer GetKey() const;
|
||||
Standard_EXPORT virtual void Print(Standard_OStream& OS) const;
|
||||
Standard_EXPORT ~SMDS_MeshVolume();
|
||||
|
||||
|
||||
|
||||
|
||||
// Type management
|
||||
//
|
||||
Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshVolume_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_MeshVolume(const Standard_Integer ID,const Standard_Integer NbConnections);
|
||||
|
||||
|
||||
// Fields PROTECTED
|
||||
//
|
||||
Standard_Integer myKey;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Methods PRIVATE
|
||||
//
|
||||
|
||||
|
||||
// Fields PRIVATE
|
||||
//
|
||||
|
||||
|
||||
class SMDS_MeshVolume:public SMDS_MeshElement
|
||||
{
|
||||
|
||||
public:
|
||||
SMDSAbs_ElementType GetType() const;
|
||||
};
|
||||
|
||||
|
||||
#include "SMDS_MeshVolume.lxx"
|
||||
|
||||
|
||||
|
||||
// other inline functions and methods (like "C++: function call" methods)
|
||||
//
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user