{
return myNbEdges == 3 ? SMDSEntity_Triangle : SMDSEntity_Quadrangle;
}
+
+SMDSAbs_GeometryType SMDS_FaceOfEdges::GetGeomType() const
+{
+ return myNbEdges == 3 ? SMDSGeom_TRIANGLE : SMDSGeom_QUADRANGLE;
+}
const SMDS_MeshEdge* edge3,
const SMDS_MeshEdge* edge4);
- SMDSAbs_ElementType GetType() const;
+ virtual SMDSAbs_ElementType GetType() const;
virtual SMDSAbs_EntityType GetEntityType() const;
- virtual bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes) {return false;};
- int NbNodes() const;
- int NbEdges() const;
- int NbFaces() const;
-// friend bool operator<(const SMDS_FaceOfEdges& e1, const SMDS_FaceOfEdges& e2);
-
-
- /*!
- * \brief Return node by its index
- * \param ind - node index
- * \retval const SMDS_MeshNode* - the node
- */
- virtual const SMDS_MeshNode* GetNode(const int ind) const;
+ virtual SMDSAbs_GeometryType GetGeomType() const;
+ virtual bool ChangeNodes(const SMDS_MeshNode* nodes[],
+ const int nbNodes) {return false;}
+ virtual int NbNodes() const;
+ virtual int NbEdges() const;
+ virtual int NbFaces() const;
+ virtual const SMDS_MeshNode* GetNode(const int ind) const;
protected:
- SMDS_ElemIteratorPtr
- elementsIterator(SMDSAbs_ElementType type) const;
+ virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
private:
const SMDS_MeshEdge* myEdges[4];
SMDSAbs_EntityType SMDS_FaceOfNodes::GetEntityType() const
{
- return myNbNodes == 3 ? SMDSEntity_Triangle : SMDSEntity_Quadrangle;
+ return NbNodes() == 3 ? SMDSEntity_Triangle : SMDSEntity_Quadrangle;
+}
+SMDSAbs_GeometryType SMDS_FaceOfNodes::GetGeomType() const
+{
+ return NbNodes() == 3 ? SMDSGeom_TRIANGLE : SMDSGeom_QUADRANGLE;
}
virtual const SMDS_MeshNode* GetNode(const int ind) const;
virtual SMDSAbs_EntityType GetEntityType() const;
+ virtual SMDSAbs_GeometryType GetGeomType() const;
protected:
SMDS_ElemIteratorPtr
// SMESH SMDS : implementaion of Salome mesh data structure
// File : SMDS_Mesh0DElement.cxx
-// Author : Jean-Michel BOULCOURT
// Module : SMESH
//
#ifdef _MSC_VER
}
}
-//=======================================================================
-//function : operator<
-//purpose :
-//=======================================================================
-bool operator< (const SMDS_Mesh0DElement & e1, const SMDS_Mesh0DElement & e2)
-{
- int id1 = e1.myNode->getVtkId();
- int id2 = e2.myNode->getVtkId();
-
- return (id1 < id2);
-}
-
/*!
* \brief Return node by its index
* \param ind - node index
SMDS_Mesh0DElement (const SMDS_MeshNode * node);
bool ChangeNode (const SMDS_MeshNode * node);
virtual bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes) {return false;};
- void Print (std::ostream & OS) const;
-
- SMDSAbs_ElementType GetType() const;
- virtual vtkIdType GetVtkType() const;
- SMDSAbs_EntityType GetEntityType() const {return SMDSEntity_0D;}
- int NbNodes() const;
- int NbEdges() const;
- friend bool operator< (const SMDS_Mesh0DElement& e1, const SMDS_Mesh0DElement& e2);
-
- /*!
- * \brief Return node by its index
- * \param ind - node index
- * \retval const SMDS_MeshNode* - the node
- */
+ virtual void Print (std::ostream & OS) const;
+
+ virtual SMDSAbs_ElementType GetType() const;
+ virtual vtkIdType GetVtkType() const;
+ virtual SMDSAbs_EntityType GetEntityType() const {return SMDSEntity_0D;}
+ virtual SMDSAbs_GeometryType GetGeomType() const { return SMDSGeom_POINT; }
virtual const SMDS_MeshNode* GetNode (const int ind) const;
+ virtual int NbNodes() const;
+ virtual int NbEdges() const;
protected:
- SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
+ virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
protected:
const SMDS_MeshNode* myNode;
#include "SMDS_MeshCell.hxx"
-class SMDS_EXPORT SMDS_MeshEdge:public SMDS_MeshCell
+class SMDS_EXPORT SMDS_MeshEdge: public SMDS_MeshCell
{
- public:
- SMDSAbs_ElementType GetType() const;
- virtual vtkIdType GetVtkType() const;
+ public:
+ virtual SMDSAbs_ElementType GetType() const;
+ virtual vtkIdType GetVtkType() const;
+ virtual SMDSAbs_GeometryType GetGeomType() const { return SMDSGeom_EDGE; }
};
#endif
///Return the type of the current element
virtual SMDSAbs_ElementType GetType() const = 0;
+ virtual SMDSAbs_EntityType GetEntityType() const = 0;
+ virtual SMDSAbs_GeometryType GetGeomType() const = 0;
virtual vtkIdType GetVtkType() const = 0;
- virtual bool IsPoly() const { return false; };
+ virtual bool IsPoly() const { return false; }
virtual bool IsQuadratic() const;
- //! Return type of entity
- virtual SMDSAbs_EntityType GetEntityType() const = 0;
virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
virtual int NbCornerNodes() const;
*/
int GetNodeIndex( const SMDS_MeshNode* node ) const;
- inline ShortType getMeshId() const {return myMeshId; }
- inline LongType getshapeId() const {return myShapeId; }
- inline int getIdInShape() const { return myIdInShape; }
- inline int getVtkId() const { return myVtkID; }
+ inline ShortType getMeshId() const { return myMeshId; }
+ inline LongType getshapeId() const { return myShapeId; }
+ inline int getIdInShape() const { return myIdInShape; }
+ inline int getVtkId() const { return myVtkID; }
+
+ /*!
+ * \brief Filters of elements, to be used with SMDS_SetIterator
+ */
+ struct TypeFilter
+ {
+ SMDSAbs_ElementType _type;
+ TypeFilter( SMDSAbs_ElementType t = SMDSAbs_NbElementTypes ):_type(t) {}
+ bool operator()(const SMDS_MeshElement* e) const { return e && e->GetType() == _type; }
+ };
+ struct EntityFilter
+ {
+ SMDSAbs_EntityType _type;
+ EntityFilter( SMDSAbs_EntityType t = SMDSEntity_Last ):_type(t) {}
+ bool operator()(const SMDS_MeshElement* e) const { return e && e->GetEntityType() == _type; }
+ };
+ struct GeomFilter
+ {
+ SMDSAbs_GeometryType _type;
+ GeomFilter( SMDSAbs_GeometryType t = SMDSGeom_NONE ):_type(t) {}
+ bool operator()(const SMDS_MeshElement* e) const { return e && e->GetGeomType() == _type; }
+ };
protected:
inline void setId(int id) {myID = id; }
#include "SMDS_Position.hxx"
#include "ObjectPool.hxx"
-class SMDS_EXPORT SMDS_MeshNode:public SMDS_MeshElement
+class SMDS_EXPORT SMDS_MeshNode: public SMDS_MeshElement
{
public:
friend class SMESHDS_Mesh;
SMDS_ElemIteratorPtr GetInverseElementIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
int NbInverseElements(SMDSAbs_ElementType type=SMDSAbs_All) const;
const SMDS_PositionPtr& GetPosition() const;
- SMDSAbs_ElementType GetType() const;
- virtual vtkIdType GetVtkType() const;
- SMDSAbs_EntityType GetEntityType() const {return SMDSEntity_Node;}
- int NbNodes() const;
-
- friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2);
+ virtual SMDSAbs_ElementType GetType() const;
+ virtual vtkIdType GetVtkType() const;
+ virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Node;}
+ virtual SMDSAbs_GeometryType GetGeomType() const { return SMDSGeom_NONE; }
+ virtual int NbNodes() const;
void SetPosition(const SMDS_PositionPtr& aPos);
void setXYZ(double x, double y, double z);
}
return aType;
}
+
+SMDSAbs_GeometryType SMDS_VolumeOfFaces::GetGeomType() const
+{
+ SMDSAbs_GeometryType aType = SMDSGeom_NONE;
+ switch(myNbFaces)
+ {
+ case 4: aType = SMDSGeom_TETRA; break;
+ case 5: aType = SMDSGeom_PYRAMID; break;
+ case 6: aType = SMDSGeom_PENTA; break;
+ case 8:
+ default: aType = SMDSGeom_HEXA; break;
+ }
+ return aType;
+}
const SMDS_MeshFace * face6);
virtual SMDSAbs_EntityType GetEntityType() const;
- virtual bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes) {return false;};
- void Print(std::ostream & OS) const;
+ virtual SMDSAbs_GeometryType GetGeomType() const;
+ virtual bool ChangeNodes(const SMDS_MeshNode* nodes[],
+ const int nbNodes) {return false;}
+ virtual void Print(std::ostream & OS) const;
- int NbFaces() const;
+ virtual int NbFaces() const;
protected:
- SMDS_ElemIteratorPtr
- elementsIterator(SMDSAbs_ElementType type) const;
+ virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
const SMDS_MeshFace * myFaces[6];
int myNbFaces;
};
return aType;
}
+SMDSAbs_GeometryType SMDS_VolumeOfNodes::GetGeomType() const
+{
+ SMDSAbs_GeometryType aType = SMDSGeom_NONE;
+ switch(myNbNodes)
+ {
+ case 4: aType = SMDSGeom_TETRA; break;
+ case 5: aType = SMDSGeom_PYRAMID; break;
+ case 6: aType = SMDSGeom_PENTA; break;
+ case 12: aType = SMDSGeom_HEXAGONAL_PRISM; break;
+ case 8:
+ default: aType = SMDSGeom_HEXA; break;
+ }
+ return aType;
+}
int NbFaces() const;
int NbNodes() const;
int NbEdges() const;
- virtual SMDSAbs_ElementType GetType() const;
- virtual SMDSAbs_EntityType GetEntityType() const;
+ virtual SMDSAbs_ElementType GetType() const;
+ virtual SMDSAbs_EntityType GetEntityType() const;
+ virtual SMDSAbs_GeometryType GetGeomType() const;
/*!
* \brief Return node by its index
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SMESH SMDS : implementaion of Salome mesh data structure
+// File : SMDS_VtkEdge.hxx
+// Module : SMESH
+
#ifndef _SMDS_VTKEDGE_HXX_
#define _SMDS_VTKEDGE_HXX_
virtual bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes);
virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
- void Print(std::ostream & OS) const;
- int NbNodes() const;
- int NbEdges() const;
+ virtual void Print(std::ostream & OS) const;
+ virtual int NbNodes() const;
+ virtual int NbEdges() const;
virtual vtkIdType GetVtkType() const;
virtual SMDSAbs_EntityType GetEntityType() const;
return SMDS_MeshCell::toSmdsType( VTKCellType( aVtkType ));
}
+SMDSAbs_GeometryType SMDS_VtkFace::GetGeomType() const
+{
+ vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+ vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
+ switch ( aVtkType ) {
+ case VTK_TRIANGLE:
+ case VTK_QUADRATIC_TRIANGLE:
+ return SMDSGeom_TRIANGLE;
+ case VTK_QUAD:
+ case VTK_QUADRATIC_QUAD:
+ case VTK_BIQUADRATIC_QUAD:
+ return SMDSGeom_QUADRANGLE;
+ case VTK_POLYGON:
+ return SMDSGeom_POLYGON;
+ default:;
+ }
+ return SMDSGeom_NONE;
+}
+
vtkIdType SMDS_VtkFace::GetVtkType() const
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
~SMDS_VtkFace();
void init(const std::vector<vtkIdType>& nodeIds, SMDS_Mesh* mesh);
void initPoly(const std::vector<vtkIdType>& nodeIds, SMDS_Mesh* mesh);
+
bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes);
void ChangeApex(SMDS_MeshNode* node); // to use only for tmp triangles
- void Print(std::ostream & OS) const;
- int NbEdges() const;
- int NbFaces() const;
- int NbNodes() const;
- virtual vtkIdType GetVtkType() const;
- virtual SMDSAbs_EntityType GetEntityType() const;
+ virtual void Print(std::ostream & OS) const;
+ virtual int NbEdges() const;
+ virtual int NbFaces() const;
+ virtual int NbNodes() const;
+
+ virtual vtkIdType GetVtkType() const;
+ virtual SMDSAbs_EntityType GetEntityType() const;
+ virtual SMDSAbs_GeometryType GetGeomType() const;
virtual const SMDS_MeshNode* GetNode(const int ind) const;
+
virtual bool IsQuadratic() const;
virtual bool IsPoly() const;
virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
return aType;
}
+SMDSAbs_GeometryType SMDS_VtkVolume::GetGeomType() const
+{
+ vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+ vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
+
+ SMDSAbs_GeometryType aType = SMDSGeom_NONE;
+ switch (aVtkType)
+ {
+ case VTK_TETRA:
+ case VTK_QUADRATIC_TETRA:
+ aType = SMDSGeom_TETRA;
+ break;
+ case VTK_PYRAMID:
+ case VTK_QUADRATIC_PYRAMID:
+ aType = SMDSGeom_PYRAMID;
+ break;
+ case VTK_WEDGE:
+ case VTK_QUADRATIC_WEDGE:
+ aType = SMDSGeom_PENTA;
+ break;
+ case VTK_HEXAHEDRON:
+ case VTK_QUADRATIC_HEXAHEDRON:
+ case VTK_TRIQUADRATIC_HEXAHEDRON:
+ aType = SMDSGeom_HEXA;
+ break;
+ case VTK_HEXAGONAL_PRISM:
+ aType = SMDSGeom_HEXAGONAL_PRISM;
+ break;
+//#ifdef VTK_HAVE_POLYHEDRON
+ case VTK_POLYHEDRON:
+ aType = SMDSGeom_POLYHEDRA;
+ break;
+//#endif
+ default:
+ aType = SMDSGeom_POLYHEDRA;
+ break;
+ }
+ return aType;
+}
+
vtkIdType SMDS_VtkVolume::GetVtkType() const
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
virtual bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes);
virtual bool vtkOrder(const SMDS_MeshNode* nodes[], const int nbNodes);
- void Print(std::ostream & OS) const;
- int NbFaces() const;
- int NbNodes() const;
- int NbEdges() const;
+ virtual void Print(std::ostream & OS) const;
+ virtual int NbFaces() const;
+ virtual int NbNodes() const;
+ virtual int NbEdges() const;
// 1 <= face_ind <= NbFaces()
int NbFaceNodes (const int face_ind) const;
// 1 <= node_ind <= NbFaceNodes()
const SMDS_MeshNode* GetFaceNode (const int face_ind, const int node_ind) const;
- virtual SMDSAbs_ElementType GetType() const;
- virtual vtkIdType GetVtkType() const;
- virtual SMDSAbs_EntityType GetEntityType() const;
+ virtual SMDSAbs_ElementType GetType() const;
+ virtual vtkIdType GetVtkType() const;
+ virtual SMDSAbs_EntityType GetEntityType() const;
+ virtual SMDSAbs_GeometryType GetGeomType() const;
virtual const SMDS_MeshNode* GetNode(const int ind) const;
virtual bool IsQuadratic() const;
virtual bool IsPoly() const;