mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-21 00:19:41 +05:00
0021459: EDF 1495 SMESH: Manipulation of discrete elements with attributes
+ virtual SMDSAbs_GeometryType GetGeomType() const;
This commit is contained in:
parent
2cafa22d7b
commit
064c555726
@ -189,3 +189,8 @@ SMDSAbs_EntityType SMDS_FaceOfEdges::GetEntityType() const
|
||||
{
|
||||
return myNbEdges == 3 ? SMDSEntity_Triangle : SMDSEntity_Quadrangle;
|
||||
}
|
||||
|
||||
SMDSAbs_GeometryType SMDS_FaceOfEdges::GetGeomType() const
|
||||
{
|
||||
return myNbEdges == 3 ? SMDSGeom_TRIANGLE : SMDSGeom_QUADRANGLE;
|
||||
}
|
||||
|
@ -46,25 +46,18 @@ class SMDS_EXPORT SMDS_FaceOfEdges:public SMDS_MeshFace
|
||||
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];
|
||||
|
@ -180,5 +180,9 @@ const SMDS_MeshNode* SMDS_FaceOfNodes::GetNode(const int ind) const
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ class SMDS_EXPORT SMDS_FaceOfNodes:public SMDS_MeshFace
|
||||
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||
|
||||
virtual SMDSAbs_EntityType GetEntityType() const;
|
||||
virtual SMDSAbs_GeometryType GetGeomType() const;
|
||||
|
||||
protected:
|
||||
SMDS_ElemIteratorPtr
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
// File : SMDS_Mesh0DElement.cxx
|
||||
// Author : Jean-Michel BOULCOURT
|
||||
// Module : SMESH
|
||||
//
|
||||
#ifdef _MSC_VER
|
||||
@ -125,18 +124,6 @@ SMDS_ElemIteratorPtr SMDS_Mesh0DElement::elementsIterator (SMDSAbs_ElementType t
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//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
|
||||
|
@ -36,24 +36,18 @@ class SMDS_EXPORT SMDS_Mesh0DElement: public SMDS_MeshCell
|
||||
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;
|
||||
virtual 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 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;
|
||||
|
@ -28,11 +28,12 @@
|
||||
|
||||
#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
|
||||
|
@ -80,11 +80,11 @@ public:
|
||||
|
||||
///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;
|
||||
@ -140,10 +140,32 @@ public:
|
||||
*/
|
||||
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; }
|
||||
|
@ -33,7 +33,7 @@
|
||||
#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;
|
||||
@ -49,12 +49,11 @@ public:
|
||||
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);
|
||||
|
@ -153,3 +153,17 @@ SMDSAbs_EntityType SMDS_VolumeOfFaces::GetEntityType() const
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@ -56,14 +56,15 @@ class SMDS_EXPORT SMDS_VolumeOfFaces:public SMDS_MeshVolume
|
||||
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;
|
||||
};
|
||||
|
@ -254,4 +254,18 @@ SMDSAbs_EntityType SMDS_VolumeOfNodes::GetEntityType() const
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,9 @@ class SMDS_EXPORT SMDS_VolumeOfNodes:public SMDS_MeshVolume
|
||||
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
|
||||
|
@ -17,6 +17,10 @@
|
||||
// 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_
|
||||
|
||||
@ -38,9 +42,9 @@ public:
|
||||
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;
|
||||
|
@ -238,6 +238,25 @@ SMDSAbs_EntityType SMDS_VtkFace::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();
|
||||
|
@ -34,16 +34,20 @@ public:
|
||||
~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;
|
||||
|
@ -571,6 +571,46 @@ SMDSAbs_EntityType SMDS_VtkVolume::GetEntityType() 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();
|
||||
|
@ -40,10 +40,10 @@ public:
|
||||
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;
|
||||
@ -51,9 +51,10 @@ public:
|
||||
// 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;
|
||||
|
Loading…
Reference in New Issue
Block a user