This class extends vtkUnstructuredGrid to deal with downward connectivity. More...
#include <SMDS_UnstructuredGrid.hxx>

Public Member Functions | |
| void | setSMDS_mesh (SMDS_Mesh *mesh) |
| void | compactGrid (std::vector< smIdType > &idNodesOldToNew, smIdType newNodeSize, std::vector< smIdType > &idCellsOldToNew, smIdType newCellSize) |
| virtual vtkMTimeType | GetMTime () |
| virtual vtkPoints * | GetPoints () |
| vtkIdType | InsertNextLinkedCell (int type, int npts, vtkIdType *pts) |
| int | CellIdToDownId (vtkIdType vtkCellId) |
| void | setCellIdToDownId (vtkIdType vtkCellId, int downId) |
| void | CleanDownwardConnectivity () |
| void | BuildDownwardConnectivity (bool withEdges) |
| Build downward connectivity: to do only when needed because heavy memory load. More... | |
| int | GetNeighbors (int *neighborsVtkIds, int *downIds, unsigned char *downTypes, int vtkId, bool getSkin=false) |
| Get the neighbors of a cell. More... | |
| int | GetParentVolumes (int *volVtkIds, int vtkId) |
| get the volumes containing a face or an edge of the grid The edge or face belongs to the vtkUnstructuredGrid More... | |
| int | GetParentVolumes (int *volVtkIds, int downId, unsigned char downType) |
| get the volumes containing a face or an edge of the downward structure The edge or face does not necessary belong to the vtkUnstructuredGrid More... | |
| void | GetNodeIds (std::set< int > &nodeSet, int downId, unsigned char downType) |
| get the node id's of a cell. More... | |
| void | ModifyCellNodes (int vtkVolId, std::map< int, int > localClonedNodeIds) |
| change some nodes in cell without modifying type or internal connectivity. More... | |
| int | getOrderedNodesOfFace (int vtkVolId, int &dim, std::vector< vtkIdType > &orderedNodes) |
| reorder the nodes of a face More... | |
| SMDS_MeshCell * | extrudeVolumeFromFace (int vtkVolId, int domain1, int domain2, std::set< int > &originalNodes, std::map< int, std::map< int, int > > &nodeDomains, std::map< int, std::map< long, int > > &nodeQuadDomains) |
| Create a volume (prism or hexahedron) by duplication of a face. More... | |
| void | BuildLinks () |
| void | DeleteLinks () |
| SMDS_CellLinks * | GetLinks () |
| bool | HasLinks () const |
| SMDS_Downward * | getDownArray (unsigned char vtkType) |
| void | AllocateDiameters (vtkIdType maxVtkID) |
| Allocates data array for ball diameters. More... | |
| void | SetBallDiameter (vtkIdType vtkID, double diameter) |
| Sets diameter of a ball element. More... | |
| double | GetBallDiameter (vtkIdType vtkID) const |
| Returns diameter of a ball element. More... | |
Static Public Member Functions | |
| static SMDS_UnstructuredGrid * | New () |
Data Fields | |
| SMDS_Mesh * | _mesh |
Protected Member Functions | |
| SMDS_UnstructuredGrid () | |
| ~SMDS_UnstructuredGrid () | |
| void | copyNodes (vtkPoints *newPoints, std::vector< smIdType > &idNodesOldToNew, vtkIdType &alreadyCopied, vtkIdType start, vtkIdType end) |
| void | copyBloc (vtkUnsignedCharArray *newTypes, const std::vector< smIdType > &idCellsOldToNew, const std::vector< smIdType > &idNodesOldToNew, vtkCellArray *newConnectivity, vtkIdTypeArray *newLocations, std::vector< vtkIdType > &pointsCell) |
Protected Attributes | |
| std::vector< int > | _cellIdToDownId |
| convert vtk Id to downward[vtkType] id, initialized with -1 More... | |
| std::vector< unsigned char > | _downTypes |
| std::vector< SMDS_Downward * > | _downArray |
This class extends vtkUnstructuredGrid to deal with downward connectivity.
Use method BuildDownwardConnectivity to build downward connectivity and CleanDownwardConnectivity() to clean it. The downward connectivity takes up a lot of memory, so, build it only when necessary and clean after usage.
Downward connectivity is no more valid if vtkUnstructuredGrid is modified.
Built downward connectivity is kept in std::vector<SMDS_Downward*> _downArray; Vector item #i stores connectivity of all elements of VTK type i.
As vtkUnstructuredGrid has elements and nodes numbering different from the SMDS one, here are the methods to convert IDs between VTK and SMDS:
And here are the way to convert between VTK IDs and downward connectivity indices:
|
protected |
References _cellIdToDownId, _downArray, _downTypes, and _mesh.
Referenced by New().
|
protected |
| void SMDS_UnstructuredGrid::AllocateDiameters | ( | vtkIdType | MaxVtkID | ) |
Allocates data array for ball diameters.
| MaxVtkID | - max ID of a ball element |
References SetBallDiameter().
Referenced by DriverMED_R_SMESHDS_Mesh::Perform().
| void SMDS_UnstructuredGrid::BuildDownwardConnectivity | ( | bool | withEdges | ) |
Build downward connectivity: to do only when needed because heavy memory load.
Downward connectivity is no more valid if vtkUnstructuredGrid is modified.
References _cellIdToDownId, _downArray, _mesh, SMDS_Downward::addCell(), SMDS_Downward::addDownCell(), SMDS_Down1D::addUpCell(), CHRONO, CHRONOSTOP, CleanDownwardConnectivity(), SMDS_Down2D::computeEdgesWithNodes(), SMDS_Down1D::computeFaces(), SMDS_Down3D::computeFacesWithNodes(), SMDS_Down2D::computeVolumeIds(), SMDS_Down2D::computeVolumeIdsFromNodesFace(), SMDS_Down1D::computeVtkCells(), ListElemByNodesType::elems, SMDS_Down2D::FindEdgeByNodes(), SMDS_Down2D::FindEdgeByNodesSet(), SMDS_Down3D::FindFaceByNodes(), SMDS_Downward::getCellDimension(), SMDS_Downward::getMaxId(), SMDS_Mesh::GetMeshInfo(), SMDS_Down1D::getNodeSet(), MESSAGE, ListElemByNodesType::nbElems, SMDS_MeshInfo::NbHexas(), SMDS_MeshInfo::NbHexPrisms(), ElemByNodesType::nbNodes, SMDS_MeshInfo::NbPrisms(), SMDS_MeshInfo::NbPyramids(), SMDS_MeshInfo::NbTetras(), ElemByNodesType::nodeIds, ORDER_LINEAR, ORDER_QUADRATIC, SMDS_Down1D::setNodes(), SMDS_Down2D::setTempNodes(), VTK_MAXTYPE, and ElemByNodesType::vtkType.
Referenced by SMESHDS_Mesh::BuildDownWardConnectivity().
| void SMDS_UnstructuredGrid::BuildLinks | ( | ) |
References SMDS_CellLinks::BuildLinks(), and SMDS_CellLinks::New().
Referenced by GetLinks().
| int SMDS_UnstructuredGrid::CellIdToDownId | ( | vtkIdType | vtkCellId | ) |
References _cellIdToDownId.
Referenced by SMDS_Downward::addCell(), SMDS_Down1D::computeFaces(), SMESH_MeshEditor::DoubleNodesOnGroupBoundaries(), and GetParentVolumes().
| void SMDS_UnstructuredGrid::CleanDownwardConnectivity | ( | ) |
References _cellIdToDownId, and _downArray.
Referenced by BuildDownwardConnectivity(), and SMESHDS_Mesh::CleanDownWardConnectivity().
| void SMDS_UnstructuredGrid::compactGrid | ( | std::vector< smIdType > & | idNodesOldToNew, |
| smIdType | newNodeSize, | ||
| std::vector< smIdType > & | idCellsOldToNew, | ||
| smIdType | newCellSize | ||
| ) |
updateCells
References copyBloc(), copyNodes(), and DeleteLinks().
Referenced by SMDS_Mesh::CompactMesh().
|
protected |
Referenced by compactGrid().
|
protected |
References end().
Referenced by compactGrid().
| void SMDS_UnstructuredGrid::DeleteLinks | ( | ) |
Referenced by SMDS_Mesh::Clear(), compactGrid(), and SMESH_MeshEditor::DoubleNodesOnGroupBoundaries().
| SMDS_MeshCell * SMDS_UnstructuredGrid::extrudeVolumeFromFace | ( | int | vtkVolId, |
| int | domain1, | ||
| int | domain2, | ||
| std::set< int > & | originalNodes, | ||
| std::map< int, std::map< int, int > > & | nodeDomains, | ||
| std::map< int, std::map< long, int > > & | nodeQuadDomains | ||
| ) |
Create a volume (prism or hexahedron) by duplication of a face.
Designed for use in creation of flat elements separating volume domains. A face separating two domains is shared by two volume cells. All the nodes are already created (for the two faces). Each original Node is associated to corresponding nodes in the domains. Some nodes may be duplicated for more than two domains, when domain separations intersect. In that case, even some of the nodes to use for the original face may be changed.
| vtkVolId | vtk id of a volume containing the face, to get an orientation for the face. |
| domain1 | domain of the original face |
| domain2 | domain of the duplicated face |
| originalNodes | the vtk node ids of the original face |
| nodeDomains | map(original id --> map(domain --> duplicated node id)) |
References _mesh, SMDS_Mesh::AddFaceFromVtkIds(), SMDS_Mesh::AddNode(), SMDS_Mesh::AddVolumeFromVtkIds(), SMDS_MeshCell::applyInterlace(), SMDS_Mesh::FindElementVtk(), SMDS_Mesh::FindNodeVtk(), SMDS_MeshElement::GetNodeIndex(), getOrderedNodesOfFace(), SMDS_MeshElement::GetVtkID(), SMDS_MeshCell::reverseSmdsOrder(), SMDSEntity_Quad_Quadrangle, and SMDSEntity_Quadrangle.
Referenced by SMESH_MeshEditor::DoubleNodesOnGroupBoundaries().
| double SMDS_UnstructuredGrid::GetBallDiameter | ( | vtkIdType | vtkID | ) | const |
Returns diameter of a ball element.
| vtkID | - vtk id of the ball element |
Referenced by SMDS_BallElement::GetDiameter().
| SMDS_Downward * SMDS_UnstructuredGrid::getDownArray | ( | unsigned char | vtkType | ) |
| SMDS_CellLinks * SMDS_UnstructuredGrid::GetLinks | ( | ) |
References BuildLinks().
Referenced by SMDS_MeshNode::AddInverseElement(), SMDS_Down2D::computeVolumeIdsFromNodesFace(), SMDS_Down1D::computeVtkCells(), SMESH_MeshEditor::DoubleNodesOnGroupBoundaries(), SMDS_Mesh::dumpGrid(), SMDS_MeshNode::GetInverseElementIterator(), SMDS_MeshNode::init(), and SMDS_MeshNode::NbInverseElements().
|
virtual |
| int SMDS_UnstructuredGrid::GetNeighbors | ( | int * | neighborsVtkIds, |
| int * | downIds, | ||
| unsigned char * | downTypes, | ||
| int | vtkId, | ||
| bool | getSkin = false |
||
| ) |
Get the neighbors of a cell.
Only the neighbors having the dimension of the cell are taken into account (neighbors of a volume are the volumes sharing a face with this volume, neighbors of a face are the faces sharing an edge with this face...).
| neighborsVtkIds | vector of neighbors vtk id's to fill (reserve enough space). |
| downIds | downward id's of cells of dimension n-1, to fill (reserve enough space). |
| downTypes | vtk types of cells of dimension n-1, to fill (reserve enough space). |
| vtkId | the vtk id of the cell |
References _cellIdToDownId, _downArray, SMDS_Downward::getCellDimension(), and NBMAXNEIGHBORS.
Referenced by SMESH_MeshEditor::CreateHoleSkin(), and SMESH_MeshEditor::DoubleNodesOnGroupBoundaries().
| void SMDS_UnstructuredGrid::GetNodeIds | ( | std::set< int > & | nodeSet, |
| int | downId, | ||
| unsigned char | downType | ||
| ) |
get the node id's of a cell.
The cell is defined by it's downward connectivity id and type.
| nodeSet | set of of vtk node id's to fill. |
| downId | downward connectivity id of the cell. |
| downType | type of cell. |
References _downArray.
Referenced by SMESH_MeshEditor::DoubleNodesOnGroupBoundaries().
| int SMDS_UnstructuredGrid::getOrderedNodesOfFace | ( | int | vtkVolId, |
| int & | dim, | ||
| std::vector< vtkIdType > & | orderedNodes | ||
| ) |
reorder the nodes of a face
| vtkVolId | vtk id of a volume containing the face, to get an orientation for the face. |
| orderedNodes | list of nodes to reorder (in out) |
References _cellIdToDownId, _downArray, SMDS_Downward::getCellDimension(), and SMDS_Downward::getOrderedNodesOfFace().
Referenced by extrudeVolumeFromFace().
| int SMDS_UnstructuredGrid::GetParentVolumes | ( | int * | volVtkIds, |
| int | downId, | ||
| unsigned char | downType | ||
| ) |
get the volumes containing a face or an edge of the downward structure The edge or face does not necessary belong to the vtkUnstructuredGrid
| volVtkIds | vector of parent volume ids to fill (reserve enough space!) |
| downId | id in the downward structure |
| downType | type of cell |
References _downArray, and SMDS_Downward::getCellDimension().
| int SMDS_UnstructuredGrid::GetParentVolumes | ( | int * | volVtkIds, |
| int | vtkId | ||
| ) |
get the volumes containing a face or an edge of the grid The edge or face belongs to the vtkUnstructuredGrid
| volVtkIds | vector of parent volume ids to fill (reserve enough space!) |
| vtkId | vtk id of the face or edge |
References _downArray, CellIdToDownId(), SMDS_Downward::getCellDimension(), and MESSAGE.
Referenced by SMESH_MeshEditor::DoubleNodesOnGroupBoundaries().
|
virtual |
Referenced by SMDS_MeshNode::init(), and SMDS_MeshNode::setXYZ().
| bool SMDS_UnstructuredGrid::HasLinks | ( | ) | const |
Referenced by SMDS_MeshNode::AddInverseElement(), and SMDS_MeshNode::init().
| vtkIdType SMDS_UnstructuredGrid::InsertNextLinkedCell | ( | int | type, |
| int | npts, | ||
| vtkIdType * | pts | ||
| ) |
Referenced by SMDS_BallElement::init(), SMDS_MeshVolume::init(), and SMDS_MeshCell::init().
| void SMDS_UnstructuredGrid::ModifyCellNodes | ( | int | vtkVolId, |
| std::map< int, int > | localClonedNodeIds | ||
| ) |
change some nodes in cell without modifying type or internal connectivity.
Nodes inverse connectivity is maintained up to date.
| vtkVolId | vtk id of the cell |
| localClonedNodeIds | map old node id to new node id. |
Referenced by SMESHDS_Mesh::ModifyCellNodes().
|
static |
References SMDS_UnstructuredGrid().
Referenced by SMESH_MeshObj::NulData(), and SMDS_Mesh::SMDS_Mesh().
| void SMDS_UnstructuredGrid::SetBallDiameter | ( | vtkIdType | vtkID, |
| double | diameter | ||
| ) |
Sets diameter of a ball element.
| vtkID | - vtk id of the ball element |
| diameter | - diameter of the ball element |
Referenced by AllocateDiameters(), SMDS_BallElement::init(), and SMDS_BallElement::SetDiameter().
| void SMDS_UnstructuredGrid::setCellIdToDownId | ( | vtkIdType | vtkCellId, |
| int | downId | ||
| ) |
References _cellIdToDownId.
Referenced by SMDS_Downward::addCell().
| void SMDS_UnstructuredGrid::setSMDS_mesh | ( | SMDS_Mesh * | mesh | ) |
References _mesh.
Referenced by SMDS_Mesh::SMDS_Mesh().
|
protected |
convert vtk Id to downward[vtkType] id, initialized with -1
Referenced by BuildDownwardConnectivity(), CellIdToDownId(), CleanDownwardConnectivity(), GetNeighbors(), getOrderedNodesOfFace(), setCellIdToDownId(), and SMDS_UnstructuredGrid().
|
protected |
|
protected |
Referenced by SMDS_UnstructuredGrid().
| SMDS_Mesh* SMDS_UnstructuredGrid::_mesh |
Referenced by BuildDownwardConnectivity(), extrudeVolumeFromFace(), SMDS_DownTetra::getOrderedNodesOfFace(), SMDS_DownQuadTetra::getOrderedNodesOfFace(), SMDS_DownPyramid::getOrderedNodesOfFace(), SMDS_DownQuadPyramid::getOrderedNodesOfFace(), SMDS_DownPenta::getOrderedNodesOfFace(), SMDS_DownQuadPenta::getOrderedNodesOfFace(), SMDS_DownHexa::getOrderedNodesOfFace(), SMDS_DownQuadHexa::getOrderedNodesOfFace(), setSMDS_mesh(), and SMDS_UnstructuredGrid().