Version: 6.3.1
Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes

SMDS_UnstructuredGrid Class Reference

#include <SMDS_UnstructuredGrid.hxx>

Inheritance diagram for SMDS_UnstructuredGrid:
Inheritance graph
[legend]

Public Member Functions

void setSMDS_mesh (SMDS_Mesh *mesh)
void compactGrid (std::vector< int > &idNodesOldToNew, int newNodeSize, std::vector< int > &idCellsOldToNew, int newCellSize)
virtual unsigned long GetMTime ()
virtual void Update ()
virtual void UpdateInformation ()
virtual vtkPoints * GetPoints ()
int InsertNextLinkedCell (int type, int npts, vtkIdType *pts)
int CellIdToDownId (int vtkCellId)
void setCellIdToDownId (int vtkCellId, int downId)
void CleanDownwardConnectivity ()
void BuildDownwardConnectivity (bool withEdges)
 Build downward connectivity: to do only when needed because heavy memory load.
int GetNeighbors (int *neighborsVtkIds, int *downIds, unsigned char *downTypes, int vtkId)
 Get the neighbors of a cell.
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
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
void GetNodeIds (std::set< int > &nodeSet, int downId, unsigned char downType)
 get the node id's of a cell.
void ModifyCellNodes (int vtkVolId, std::map< int, int > localClonedNodeIds)
 change some nodes in cell without modifying type or internal connectivity.
int getOrderedNodesOfFace (int vtkVolId, std::vector< vtkIdType > &orderedNodes)
 reorder the nodes of a face
void BuildLinks ()
SMDS_MeshVolumeextrudeVolumeFromFace (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.
vtkCellLinksGetLinks ()
SMDS_DownwardgetDownArray (unsigned char vtkType)

Static Public Member Functions

static SMDS_UnstructuredGridNew ()

Data Fields

SMDS_Mesh_mesh

Protected Member Functions

 SMDS_UnstructuredGrid ()
 ~SMDS_UnstructuredGrid ()
void copyNodes (vtkPoints *newPoints, std::vector< int > &idNodesOldToNew, int &alreadyCopied, int start, int end)
void copyBloc (vtkUnsignedCharArray *newTypes, std::vector< int > &idCellsOldToNew, std::vector< int > &idNodesOldToNew, vtkCellArray *newConnectivity, vtkIdTypeArray *newLocations, vtkIdType *pointsCell, int &alreadyCopied, int start, int end)

Protected Attributes

std::vector< int_cellIdToDownId
 convert vtk Id to downward[vtkType] id, initialized with -1
std::vector< unsigned char > _downTypes
std::vector< SMDS_Downward * > _downArray

Detailed Description

Definition at line 62 of file SMDS_UnstructuredGrid.hxx.


Constructor & Destructor Documentation

SMDS_UnstructuredGrid::SMDS_UnstructuredGrid ( ) [protected]

Definition at line 70 of file SMDS_UnstructuredGrid.cxx.

References _cellIdToDownId, _downArray, _downTypes, and _mesh.

Referenced by New().

                                             :
  vtkUnstructuredGrid()
{
  _cellIdToDownId.clear();
  _downTypes.clear();
  _downArray.clear();
  _mesh = 0;
}
SMDS_UnstructuredGrid::~SMDS_UnstructuredGrid ( ) [protected]

Definition at line 79 of file SMDS_UnstructuredGrid.cxx.

{
}

Member Function Documentation

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.

Definition at line 364 of file SMDS_UnstructuredGrid.cxx.

References _cellIdToDownId, _downArray, _mesh, 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_Down3D.FindFaceByNodes(), SMDS_Downward.getCellDimension(), SMDS_Downward.getMaxId(), SMDS_Mesh.GetMeshInfo(), SMESH_test.idf, MESSAGE, ListElemByNodesType.nbElems, SMDS_MeshInfo.NbHexas(), ElemByNodesType.nbNodes, SMDS_MeshInfo.NbPrisms(), SMDS_MeshInfo.NbPyramids(), SMDS_MeshInfo.NbTetras(), ElemByNodesType.nodeIds, SMESH_AdvancedEditor.nodes, ORDER_LINEAR, ORDER_QUADRATIC, SMDS_Down1D.setNodes(), SMDS_Down2D.setTempNodes(), counters.stats(), VTK_MAXTYPE, and ElemByNodesType.vtkType.

Referenced by SMESHDS_Mesh.BuildDownWardConnectivity().

{
  MESSAGE("SMDS_UnstructuredGrid::BuildDownwardConnectivity");CHRONO(2);
  // TODO calcul partiel sans edges

  // --- erase previous data if any

  this->CleanDownwardConnectivity();

  // --- create SMDS_Downward structures (in _downArray vector[vtkCellType])

  _downArray.resize(VTK_MAXTYPE + 1, 0); // --- max. type value = VTK_QUADRATIC_PYRAMID

  _downArray[VTK_LINE] = new SMDS_DownEdge(this);
  _downArray[VTK_QUADRATIC_EDGE] = new SMDS_DownQuadEdge(this);
  _downArray[VTK_TRIANGLE] = new SMDS_DownTriangle(this);
  _downArray[VTK_QUADRATIC_TRIANGLE] = new SMDS_DownQuadTriangle(this);
  _downArray[VTK_QUAD] = new SMDS_DownQuadrangle(this);
  _downArray[VTK_QUADRATIC_QUAD] = new SMDS_DownQuadQuadrangle(this);
  _downArray[VTK_TETRA] = new SMDS_DownTetra(this);
  _downArray[VTK_QUADRATIC_TETRA] = new SMDS_DownQuadTetra(this);
  _downArray[VTK_PYRAMID] = new SMDS_DownPyramid(this);
  _downArray[VTK_QUADRATIC_PYRAMID] = new SMDS_DownQuadPyramid(this);
  _downArray[VTK_WEDGE] = new SMDS_DownPenta(this);
  _downArray[VTK_QUADRATIC_WEDGE] = new SMDS_DownQuadPenta(this);
  _downArray[VTK_HEXAHEDRON] = new SMDS_DownHexa(this);
  _downArray[VTK_QUADRATIC_HEXAHEDRON] = new SMDS_DownQuadHexa(this);

  // --- get detailed info of number of cells of each type, allocate SMDS_downward structures

  const SMDS_MeshInfo &meshInfo = _mesh->GetMeshInfo();

  int nbLinTetra = meshInfo.NbTetras(ORDER_LINEAR);
  int nbQuadTetra = meshInfo.NbTetras(ORDER_QUADRATIC);
  int nbLinPyra = meshInfo.NbPyramids(ORDER_LINEAR);
  int nbQuadPyra = meshInfo.NbPyramids(ORDER_QUADRATIC);
  int nbLinPrism = meshInfo.NbPrisms(ORDER_LINEAR);
  int nbQuadPrism = meshInfo.NbPrisms(ORDER_QUADRATIC);
  int nbLinHexa = meshInfo.NbHexas(ORDER_LINEAR);
  int nbQuadHexa = meshInfo.NbHexas(ORDER_QUADRATIC);

  int nbLineGuess = int((4.0 / 3.0) * nbLinTetra + 2 * nbLinPrism + 2.5 * nbLinPyra + 3 * nbLinHexa);
  int nbQuadEdgeGuess = int((4.0 / 3.0) * nbQuadTetra + 2 * nbQuadPrism + 2.5 * nbQuadPyra + 3 * nbQuadHexa);
  int nbLinTriaGuess = 2 * nbLinTetra + nbLinPrism + 2 * nbLinPyra;
  int nbQuadTriaGuess = 2 * nbQuadTetra + nbQuadPrism + 2 * nbQuadPyra;
  int nbLinQuadGuess = int((2.0 / 3.0) * nbLinPrism + (1.0 / 2.0) * nbLinPyra + 3 * nbLinHexa);
  int nbQuadQuadGuess = int((2.0 / 3.0) * nbQuadPrism + (1.0 / 2.0) * nbQuadPyra + 3 * nbQuadHexa);

  int GuessSize[VTK_QUADRATIC_TETRA];
  GuessSize[VTK_LINE] = nbLineGuess;
  GuessSize[VTK_QUADRATIC_EDGE] = nbQuadEdgeGuess;
  GuessSize[VTK_TRIANGLE] = nbLinTriaGuess;
  GuessSize[VTK_QUADRATIC_TRIANGLE] = nbQuadTriaGuess;
  GuessSize[VTK_QUAD] = nbLinQuadGuess;
  GuessSize[VTK_QUADRATIC_QUAD] = nbQuadQuadGuess;
  GuessSize[VTK_TETRA] = nbLinTetra;
  GuessSize[VTK_QUADRATIC_TETRA] = nbQuadTetra;
  GuessSize[VTK_PYRAMID] = nbLinPyra;
  GuessSize[VTK_QUADRATIC_PYRAMID] = nbQuadPyra;
  GuessSize[VTK_WEDGE] = nbLinPrism;
  GuessSize[VTK_QUADRATIC_WEDGE] = nbQuadPrism;
  GuessSize[VTK_HEXAHEDRON] = nbLinHexa;
  GuessSize[VTK_QUADRATIC_HEXAHEDRON] = nbQuadHexa;

  _downArray[VTK_LINE]->allocate(nbLineGuess);
  _downArray[VTK_QUADRATIC_EDGE]->allocate(nbQuadEdgeGuess);
  _downArray[VTK_TRIANGLE]->allocate(nbLinTriaGuess);
  _downArray[VTK_QUADRATIC_TRIANGLE]->allocate(nbQuadTriaGuess);
  _downArray[VTK_QUAD]->allocate(nbLinQuadGuess);
  _downArray[VTK_QUADRATIC_QUAD]->allocate(nbQuadQuadGuess);
  _downArray[VTK_TETRA]->allocate(nbLinTetra);
  _downArray[VTK_QUADRATIC_TETRA]->allocate(nbQuadTetra);
  _downArray[VTK_PYRAMID]->allocate(nbLinPyra);
  _downArray[VTK_QUADRATIC_PYRAMID]->allocate(nbQuadPyra);
  _downArray[VTK_WEDGE]->allocate(nbLinPrism);
  _downArray[VTK_QUADRATIC_WEDGE]->allocate(nbQuadPrism);
  _downArray[VTK_HEXAHEDRON]->allocate(nbLinHexa);
  _downArray[VTK_QUADRATIC_HEXAHEDRON]->allocate(nbQuadHexa);

  // --- iteration on vtkUnstructuredGrid cells, only faces
  //     for each vtk face:
  //       create a downward face entry with its downward id.
  //       compute vtk volumes, create downward volumes entry.
  //       mark face in downward volumes
  //       mark volumes in downward face

  MESSAGE("--- iteration on vtkUnstructuredGrid cells, only faces");CHRONO(20);
  int cellSize = this->Types->GetNumberOfTuples();
  _cellIdToDownId.resize(cellSize, -1);

  for (int i = 0; i < cellSize; i++)
    {
      int vtkFaceType = this->GetCellType(i);
      if (SMDS_Downward::getCellDimension(vtkFaceType) == 2)
        {
          int vtkFaceId = i;
          //ASSERT(_downArray[vtkFaceType]);
          int connFaceId = _downArray[vtkFaceType]->addCell(vtkFaceId);
          SMDS_Down2D* downFace = static_cast<SMDS_Down2D*> (_downArray[vtkFaceType]);
          downFace->setTempNodes(connFaceId, vtkFaceId);
          int vols[2] = { -1, -1 };
          int nbVolumes = downFace->computeVolumeIds(vtkFaceId, vols);
          //MESSAGE("nbVolumes="<< nbVolumes);
          for (int ivol = 0; ivol < nbVolumes; ivol++)
            {
              int vtkVolId = vols[ivol];
              int vtkVolType = this->GetCellType(vtkVolId);
              //ASSERT(_downArray[vtkVolType]);
              int connVolId = _downArray[vtkVolType]->addCell(vtkVolId);
              _downArray[vtkVolType]->addDownCell(connVolId, connFaceId, vtkFaceType);
              _downArray[vtkFaceType]->addUpCell(connFaceId, connVolId, vtkVolType);
              // MESSAGE("Face " << vtkFaceId << " belongs to volume " << vtkVolId);
            }
        }
    }

  // --- iteration on vtkUnstructuredGrid cells, only volumes
  //     for each vtk volume:
  //       create downward volumes entry if not already done
  //       build a temporary list of faces described with their nodes
  //       for each face
  //         compute the vtk volumes containing this face
  //         check if the face is already listed in the volumes (comparison of ordered list of nodes)
  //         if not, create a downward face entry (resizing of structure required)
  //         (the downward faces store a temporary list of nodes to ease the comparison)
  //         create downward volumes entry if not already done
  //         mark volumes in downward face
  //         mark face in downward volumes

  CHRONOSTOP(20);
  MESSAGE("--- iteration on vtkUnstructuredGrid cells, only volumes");CHRONO(21);

  for (int i = 0; i < cellSize; i++)
    {
      int vtkType = this->GetCellType(i);
      if (SMDS_Downward::getCellDimension(vtkType) == 3)
        {
          //CHRONO(31);
          int vtkVolId = i;
          // MESSAGE("vtk volume " << vtkVolId);
          //ASSERT(_downArray[vtkType]);
          /*int connVolId = */_downArray[vtkType]->addCell(vtkVolId);

          // --- find all the faces of the volume, describe the faces by their nodes

          SMDS_Down3D* downVol = static_cast<SMDS_Down3D*> (_downArray[vtkType]);
          ListElemByNodesType facesWithNodes;
          downVol->computeFacesWithNodes(vtkVolId, facesWithNodes);
          // MESSAGE("vtk volume " << vtkVolId << " contains " << facesWithNodes.nbElems << " faces");
          //CHRONOSTOP(31);
          for (int iface = 0; iface < facesWithNodes.nbElems; iface++)
            {
              // --- find the volumes containing the face

              //CHRONO(32);
              int vtkFaceType = facesWithNodes.elems[iface].vtkType;
              SMDS_Down2D* downFace = static_cast<SMDS_Down2D*> (_downArray[vtkFaceType]);
              int vols[2] = { -1, -1 };
              int *nodes = &facesWithNodes.elems[iface].nodeIds[0];
              int lg = facesWithNodes.elems[iface].nbNodes;
              int nbVolumes = downFace->computeVolumeIdsFromNodesFace(nodes, lg, vols);
              // MESSAGE("vtk volume " << vtkVolId << " face " << iface << " belongs to " << nbVolumes << " volumes");

              // --- check if face is registered in the volumes
              //CHRONOSTOP(32);

              //CHRONO(33);
              int connFaceId = -1;
              for (int ivol = 0; ivol < nbVolumes; ivol++)
                {
                  int vtkVolId2 = vols[ivol];
                  int vtkVolType = this->GetCellType(vtkVolId2);
                  //ASSERT(_downArray[vtkVolType]);
                  int connVolId2 = _downArray[vtkVolType]->addCell(vtkVolId2);
                  SMDS_Down3D* downVol2 = static_cast<SMDS_Down3D*> (_downArray[vtkVolType]);
                  connFaceId = downVol2->FindFaceByNodes(connVolId2, facesWithNodes.elems[iface]);
                  if (connFaceId >= 0)
                    break; // --- face already created
                }//CHRONOSTOP(33);

              // --- if face is not registered in the volumes, create face

              //CHRONO(34);
              if (connFaceId < 0)
                {
                  connFaceId = _downArray[vtkFaceType]->addCell();
                  downFace->setTempNodes(connFaceId, facesWithNodes.elems[iface]);
                }//CHRONOSTOP(34);

              // --- mark volumes in downward face and mark face in downward volumes

              //CHRONO(35);
              for (int ivol = 0; ivol < nbVolumes; ivol++)
                {
                  int vtkVolId2 = vols[ivol];
                  int vtkVolType = this->GetCellType(vtkVolId2);
                  //ASSERT(_downArray[vtkVolType]);
                  int connVolId2 = _downArray[vtkVolType]->addCell(vtkVolId2);
                  _downArray[vtkVolType]->addDownCell(connVolId2, connFaceId, vtkFaceType);
                  _downArray[vtkFaceType]->addUpCell(connFaceId, connVolId2, vtkVolType);
                  // MESSAGE(" From volume " << vtkVolId << " face " << connFaceId << " belongs to volume " << vtkVolId2);
                }//CHRONOSTOP(35);
            }
        }
    }

  // --- iteration on vtkUnstructuredGrid cells, only edges
  //     for each vtk edge:
  //       create downward edge entry
  //       store the nodes id's in downward edge (redundant with vtkUnstructuredGrid)
  //       find downward faces
  //       (from vtk faces or volumes, get downward faces, they have a temporary list of nodes)
  //       mark edge in downward faces
  //       mark faces in downward edge

  CHRONOSTOP(21);
  MESSAGE("--- iteration on vtkUnstructuredGrid cells, only edges");CHRONO(22);

  for (int i = 0; i < cellSize; i++)
    {
      int vtkEdgeType = this->GetCellType(i);
      if (SMDS_Downward::getCellDimension(vtkEdgeType) == 1)
        {
          int vtkEdgeId = i;
          //ASSERT(_downArray[vtkEdgeType]);
          int connEdgeId = _downArray[vtkEdgeType]->addCell(vtkEdgeId);
          SMDS_Down1D* downEdge = static_cast<SMDS_Down1D*> (_downArray[vtkEdgeType]);
          downEdge->setNodes(connEdgeId, vtkEdgeId);
          vector<int> vtkIds;
          int nbVtkCells = downEdge->computeVtkCells(connEdgeId, vtkIds);
          int downFaces[1000];
          unsigned char downTypes[1000];
          int nbDownFaces = downEdge->computeFaces(connEdgeId, &vtkIds[0], nbVtkCells, downFaces, downTypes);
          for (int n = 0; n < nbDownFaces; n++)
            {
              _downArray[downTypes[n]]->addDownCell(downFaces[n], connEdgeId, vtkEdgeType);
              _downArray[vtkEdgeType]->addUpCell(connEdgeId, downFaces[n], downTypes[n]);
            }
        }
    }

  // --- iteration on downward faces (they are all listed now)
  //     for each downward face:
  //       build a temporary list of edges with their ordered list of nodes
  //       for each edge:
  //         find all the vtk cells containing this edge
  //         then identify all the downward faces containing the edge, from the vtk cells
  //         check if the edge is already listed in the faces (comparison of ordered list of nodes)
  //         if not, create a downward edge entry with the node id's
  //         mark edge in downward faces
  //         mark downward faces in edge (size of list unknown, to be allocated)

  CHRONOSTOP(22);CHRONO(23);

  for (int vtkFaceType = 0; vtkFaceType < VTK_QUADRATIC_PYRAMID; vtkFaceType++)
    {
      if (SMDS_Downward::getCellDimension(vtkFaceType) != 2)
        continue;

      // --- find all the edges of the face, describe the edges by their nodes

      SMDS_Down2D* downFace = static_cast<SMDS_Down2D*> (_downArray[vtkFaceType]);
      int maxId = downFace->getMaxId();
      for (int faceId = 0; faceId < maxId; faceId++)
        {
          //CHRONO(40);
          ListElemByNodesType edgesWithNodes;
          downFace->computeEdgesWithNodes(faceId, edgesWithNodes);
          // MESSAGE("downward face type " << vtkFaceType << " num " << faceId << " contains " << edgesWithNodes.nbElems << " edges");

          //CHRONOSTOP(40);
          for (int iedge = 0; iedge < edgesWithNodes.nbElems; iedge++)
            {

              // --- check if the edge is already registered by exploration of the faces

              //CHRONO(41);
              vector<int> vtkIds;
              unsigned char vtkEdgeType = edgesWithNodes.elems[iedge].vtkType;
              int *pts = &edgesWithNodes.elems[iedge].nodeIds[0];
              SMDS_Down1D* downEdge = static_cast<SMDS_Down1D*> (_downArray[vtkEdgeType]);
              int nbVtkCells = downEdge->computeVtkCells(pts, vtkIds);
              //CHRONOSTOP(41);CHRONO(42);
              int downFaces[1000];
              unsigned char downTypes[1000];
              int nbDownFaces = downEdge->computeFaces(pts, &vtkIds[0], nbVtkCells, downFaces, downTypes);
              //CHRONOSTOP(42);

              //CHRONO(43);
              int connEdgeId = -1;
              for (int idf = 0; idf < nbDownFaces; idf++)
                {
                  int faceId2 = downFaces[idf];
                  int faceType = downTypes[idf];
                  //ASSERT(_downArray[faceType]);
                  SMDS_Down2D* downFace2 = static_cast<SMDS_Down2D*> (_downArray[faceType]);
                  connEdgeId = downFace2->FindEdgeByNodes(faceId2, edgesWithNodes.elems[iedge]);
                  if (connEdgeId >= 0)
                    break; // --- edge already created
                }//CHRONOSTOP(43);

              // --- if edge is not registered in the faces, create edge

              if (connEdgeId < 0)
                {
                  //CHRONO(44);
                  connEdgeId = _downArray[vtkEdgeType]->addCell();
                  downEdge->setNodes(connEdgeId, edgesWithNodes.elems[iedge].nodeIds);
                  //CHRONOSTOP(44);
                }

              // --- mark faces in downward edge and mark edge in downward faces

              //CHRONO(45);
              for (int idf = 0; idf < nbDownFaces; idf++)
                {
                  int faceId2 = downFaces[idf];
                  int faceType = downTypes[idf];
                  //ASSERT(_downArray[faceType]);
                  //SMDS_Down2D* downFace2 = static_cast<SMDS_Down2D*> (_downArray[faceType]);
                  _downArray[vtkEdgeType]->addUpCell(connEdgeId, faceId2, faceType);
                  _downArray[faceType]->addDownCell(faceId2, connEdgeId, vtkEdgeType);
                  // MESSAGE(" From face t:" << vtkFaceType << " " << faceId <<
                  //  " edge " << connEdgeId << " belongs to face t:" << faceType << " " << faceId2);
                }//CHRONOSTOP(45);
            }
        }
    }

  CHRONOSTOP(23);CHRONO(24);

  // compact downward connectivity structure: adjust downward arrays size, replace vector<vector int>> by a single vector<int>
  // 3D first then 2D and last 1D to release memory before edge upCells reorganization, (temporary memory use)

  for (int vtkType = VTK_QUADRATIC_PYRAMID; vtkType >= 0; vtkType--)
    {
      if (SMDS_Downward *down = _downArray[vtkType])
        {
          down->compactStorage();
        }
    }

  // --- Statistics

  for (int vtkType = 0; vtkType <= VTK_QUADRATIC_PYRAMID; vtkType++)
    {
      if (SMDS_Downward *down = _downArray[vtkType])
        {
          if (down->getMaxId())
            {
              MESSAGE("Cells of Type " << vtkType << " : number of entities, est: "
                  << GuessSize[vtkType] << " real: " << down->getMaxId());
            }
        }
    }CHRONOSTOP(24);CHRONOSTOP(2);
  counters::stats();
}
void SMDS_UnstructuredGrid::BuildLinks ( )

Definition at line 934 of file SMDS_UnstructuredGrid.cxx.

References New().

Referenced by SMDS_Mesh.Clear(), compactGrid(), SMESH_MeshEditor.DoubleNodesOnGroupBoundaries(), and SMDS_Mesh.SMDS_Mesh().

{
  // Remove the old links if they are already built
  if (this->Links)
    {
    this->Links->UnRegister(this);
    }

  this->Links = SMDS_CellLinks::New();
  this->Links->Allocate(this->GetNumberOfPoints());
  this->Links->Register(this);
  this->Links->BuildLinks(this, this->Connectivity);
  this->Links->Delete();
}
int SMDS_UnstructuredGrid::CellIdToDownId ( int  vtkCellId)

Definition at line 332 of file SMDS_UnstructuredGrid.cxx.

References _cellIdToDownId.

Referenced by SMDS_Downward.addCell(), SMDS_Down1D.computeFaces(), SMESH_MeshEditor.DoubleNodesOnGroupBoundaries(), and GetParentVolumes().

{
  if((vtkCellId < 0) || (vtkCellId >= _cellIdToDownId.size()))
    {
      //MESSAGE("SMDS_UnstructuredGrid::CellIdToDownId structure not up to date: vtkCellId="
      //    << vtkCellId << " max="<< _cellIdToDownId.size());
      return -1;
    }
  return _cellIdToDownId[vtkCellId];
}
void SMDS_UnstructuredGrid::CleanDownwardConnectivity ( )

Definition at line 349 of file SMDS_UnstructuredGrid.cxx.

References _cellIdToDownId, and _downArray.

Referenced by BuildDownwardConnectivity(), and SMESHDS_Mesh.CleanDownWardConnectivity().

{
  for (int i = 0; i < _downArray.size(); i++)
    {
      if (_downArray[i])
        delete _downArray[i];
      _downArray[i] = 0;
    }
  _cellIdToDownId.clear();
}
void SMDS_UnstructuredGrid::compactGrid ( std::vector< int > &  idNodesOldToNew,
int  newNodeSize,
std::vector< int > &  idCellsOldToNew,
int  newCellSize 
)

Definition at line 152 of file SMDS_UnstructuredGrid.cxx.

References BuildLinks(), CHRONO, copyBloc(), copyNodes(), MESSAGE, NBMAXNODESINCELL, and New().

Referenced by SMESHDS_Mesh.compactMesh().

{
  MESSAGE("------------------------- SMDS_UnstructuredGrid::compactGrid " << newNodeSize << " " << newCellSize);CHRONO(1);
  int alreadyCopied = 0;

  // --- if newNodeSize, create a new compacted vtkPoints

  vtkPoints *newPoints = vtkPoints::New();
  newPoints->SetDataType(VTK_DOUBLE);
  newPoints->SetNumberOfPoints(newNodeSize);
  if (newNodeSize)
    {
      MESSAGE("-------------- compactGrid, newNodeSize " << newNodeSize);
      // rnv: to fix bug "21125: EDF 1233 SMESH: Degradation of precision in a test case for quadratic conversion"
      // using double type for storing coordinates of nodes instead float.
      int oldNodeSize = idNodesOldToNew.size();

      int i = 0;
      while ( i < oldNodeSize )
      {
        // skip a hole if any
        while ( i < oldNodeSize && idNodesOldToNew[i] < 0 )
          ++i;
        int startBloc = i;
        // look for a block end
        while ( i < oldNodeSize && idNodesOldToNew[i] >= 0 )
          ++i;
        int endBloc = i;
        copyNodes(newPoints, idNodesOldToNew, alreadyCopied, startBloc, endBloc);
      }
      newPoints->Squeeze();
    }

  // --- create new compacted Connectivity, Locations and Types

  int oldCellSize = this->Types->GetNumberOfTuples();

  vtkCellArray *newConnectivity = vtkCellArray::New();
  newConnectivity->Initialize();
  int oldCellDataSize = this->Connectivity->GetData()->GetSize();
  newConnectivity->Allocate(oldCellDataSize);
  MESSAGE("oldCellSize="<< oldCellSize << " oldCellDataSize=" << oldCellDataSize);

  vtkUnsignedCharArray *newTypes = vtkUnsignedCharArray::New();
  newTypes->Initialize();
  newTypes->SetNumberOfValues(newCellSize);

  vtkIdTypeArray *newLocations = vtkIdTypeArray::New();
  newLocations->Initialize();
  newLocations->SetNumberOfValues(newCellSize);

  // TODO some polyhedron may be huge (only in some tests)
  vtkIdType tmpid[NBMAXNODESINCELL];
  vtkIdType *pointsCell = &tmpid[0]; // --- points id to fill a new cell

  alreadyCopied = 0;
  int i = 0;
  while ( i < oldCellSize )
  {
    // skip a hole if any
    while ( i < oldCellSize && this->Types->GetValue(i) == VTK_EMPTY_CELL )
      ++i;
    int startBloc = i;
    // look for a block end
    while ( i < oldCellSize && this->Types->GetValue(i) != VTK_EMPTY_CELL )
      ++i;
    int endBloc = i;
    if ( endBloc > startBloc )
      copyBloc(newTypes, idCellsOldToNew, idNodesOldToNew, newConnectivity, newLocations, pointsCell,
               alreadyCopied, startBloc, endBloc);
  }

  newConnectivity->Squeeze();

  if (1/*newNodeSize*/)
    {
      MESSAGE("------- newNodeSize, setPoints");
      this->SetPoints(newPoints);
      MESSAGE("NumberOfPoints: " << this->GetNumberOfPoints());
    }

  if (this->FaceLocations)
    {
      vtkIdTypeArray *newFaceLocations = vtkIdTypeArray::New();
      newFaceLocations->Initialize();
      newFaceLocations->Allocate(newTypes->GetSize());
      vtkIdTypeArray *newFaces = vtkIdTypeArray::New();
      newFaces->Initialize();
      newFaces->Allocate(this->Faces->GetSize());
      for (int i = 0; i < oldCellSize; i++)
        {
          if (this->Types->GetValue(i) == VTK_EMPTY_CELL)
            continue;
          int newCellId = idCellsOldToNew[i];
          if (newTypes->GetValue(newCellId) == VTK_POLYHEDRON)
            {
               newFaceLocations->InsertNextValue(newFaces->GetMaxId()+1);
               int oldFaceLoc = this->FaceLocations->GetValue(i);
               int nCellFaces = this->Faces->GetValue(oldFaceLoc++);
               newFaces->InsertNextValue(nCellFaces);
               for (int n=0; n<nCellFaces; n++)
                 {
                   int nptsInFace = this->Faces->GetValue(oldFaceLoc++);
                   newFaces->InsertNextValue(nptsInFace);
                   for (int k=0; k<nptsInFace; k++)
                     {
                       int oldpt = this->Faces->GetValue(oldFaceLoc++);
                       newFaces->InsertNextValue(idNodesOldToNew[oldpt]);
                     }
                 }
            }
          else
            {
               newFaceLocations->InsertNextValue(-1);
            }
        }
      newFaceLocations->Squeeze();
      newFaces->Squeeze();
      newFaceLocations->Register(this);
      newFaces->Register(this);
      this->SetCells(newTypes, newLocations, newConnectivity, newFaceLocations, newFaces);
      newFaceLocations->Delete();
      newFaces->Delete();
    }
  else
    this->SetCells(newTypes, newLocations, newConnectivity, FaceLocations, Faces);

  newPoints->Delete();
  newTypes->Delete();
  newLocations->Delete();
  newConnectivity->Delete();
  this->BuildLinks();
}
void SMDS_UnstructuredGrid::copyBloc ( vtkUnsignedCharArray *  newTypes,
std::vector< int > &  idCellsOldToNew,
std::vector< int > &  idNodesOldToNew,
vtkCellArray *  newConnectivity,
vtkIdTypeArray *  newLocations,
vtkIdType *  pointsCell,
int alreadyCopied,
int  start,
int  end 
) [protected]

Definition at line 302 of file SMDS_UnstructuredGrid.cxx.

References MESSAGE, and NBMAXNODESINCELL.

Referenced by compactGrid().

{
  MESSAGE("copyBloc " << alreadyCopied << " " << start << " " << end << " size: " << end - start << " total: " << alreadyCopied + end - start);
  for (int j = start; j < end; j++)
    {
      newTypes->SetValue(alreadyCopied, this->Types->GetValue(j));
      idCellsOldToNew[j] = alreadyCopied; // old vtkId --> new vtkId
      vtkIdType oldLoc = this->Locations->GetValue(j);
      vtkIdType nbpts;
      vtkIdType *oldPtsCell = 0;
      this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell);
      assert(nbpts < NBMAXNODESINCELL);
      //MESSAGE(j << " " << alreadyCopied << " " << (int)this->Types->GetValue(j) << " " << oldLoc << " " << nbpts );
      for (int l = 0; l < nbpts; l++)
        {
          int oldval = oldPtsCell[l];
          pointsCell[l] = idNodesOldToNew[oldval];
          //MESSAGE("   " << oldval << " " << pointsCell[l]);
        }
      /*int newcnt = */newConnectivity->InsertNextCell(nbpts, pointsCell);
      int newLoc = newConnectivity->GetInsertLocation(nbpts);
      //MESSAGE(newcnt << " " << newLoc);
      newLocations->SetValue(alreadyCopied, newLoc);
      alreadyCopied++;
    }
}
void SMDS_UnstructuredGrid::copyNodes ( vtkPoints *  newPoints,
std::vector< int > &  idNodesOldToNew,
int alreadyCopied,
int  start,
int  end 
) [protected]

Definition at line 287 of file SMDS_UnstructuredGrid.cxx.

References MESSAGE.

Referenced by compactGrid().

{
  MESSAGE("copyNodes " << alreadyCopied << " " << start << " " << end << " size: " << end - start << " total: " << alreadyCopied + end - start);
  void *target = newPoints->GetVoidPointer(3 * alreadyCopied);
  void *source = this->Points->GetVoidPointer(3 * start);
  int nbPoints = end - start;
  if (nbPoints > 0)
    {
      memcpy(target, source, 3 * sizeof(double) * nbPoints);
      for (int j = start; j < end; j++)
        idNodesOldToNew[j] = alreadyCopied++; // old vtkId --> new vtkId
    }
}
SMDS_MeshVolume * 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.

Parameters:
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))
Returns:
ok if success.

Definition at line 963 of file SMDS_UnstructuredGrid.cxx.

References _mesh, SMDS_Mesh.AddNode(), SMDS_Mesh.AddVolumeFromVtkIds(), getOrderedNodesOfFace(), SMDS_MeshElement.getVtkId(), and SMESH_demo_hexa2_upd.vol.

Referenced by SMESH_MeshEditor.DoubleNodesOnGroupBoundaries().

{
  //MESSAGE("extrudeVolumeFromFace " << vtkVolId);
  vector<vtkIdType> orderedOriginals;
  orderedOriginals.clear();
  set<int>::const_iterator it = originalNodes.begin();
  for (; it != originalNodes.end(); ++it)
    orderedOriginals.push_back(*it);

  int nbNodes = this->getOrderedNodesOfFace(vtkVolId, orderedOriginals);
  vector<vtkIdType> orderedNodes;

  switch (orderedOriginals.size())
  {
    case 3:
    case 4:
      for (int i = 0; i < nbNodes; i++)
        orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain1]);
      for (int i = 0; i < nbNodes; i++)
        orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain2]);
      break;
    case 6:
    case 8:
      {
        long dom1 = domain1;
        long dom2 = domain2;
        long dom1_2; // for nodeQuadDomains
        if (domain1 < domain2)
          dom1_2 = dom1 + INT_MAX * dom2;
        else
          dom1_2 = dom2 + INT_MAX * dom1;
        //cerr << "dom1=" << dom1 << " dom2=" << dom2 << " dom1_2=" << dom1_2 << endl;
        int ima = orderedOriginals.size();
        int mid = orderedOriginals.size() / 2;
        //cerr << "ima=" << ima << " mid=" << mid << endl;
        for (int i = 0; i < mid; i++)
          orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain1]);
        for (int i = 0; i < mid; i++)
          orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain2]);
        for (int i = mid; i < ima; i++)
          orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain1]);
        for (int i = mid; i < ima; i++)
          orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain2]);
        for (int i = 0; i < mid; i++)
          {
            int oldId = orderedOriginals[i];
            int newId;
            if (nodeQuadDomains.count(oldId) && nodeQuadDomains[oldId].count(dom1_2))
              newId = nodeQuadDomains[oldId][dom1_2];
            else
              {
                double *coords = this->GetPoint(oldId);
                SMDS_MeshNode *newNode = _mesh->AddNode(coords[0], coords[1], coords[2]);
                newId = newNode->getVtkId();
                std::map<long, int> emptyMap;
                nodeQuadDomains[oldId] = emptyMap;
                nodeQuadDomains[oldId][dom1_2] = newId;
              }
            orderedNodes.push_back(newId);
          }
      }
      break;
    default:
      ASSERT(0);
  }

  SMDS_MeshVolume *vol = _mesh->AddVolumeFromVtkIds(orderedNodes);

  // TODO update subshape list of elements and nodes
  return vol;
}
SMDS_Downward* SMDS_UnstructuredGrid.getDownArray ( unsigned char  vtkType)
vtkCellLinks* SMDS_UnstructuredGrid.GetLinks ( )

Definition at line 92 of file SMDS_UnstructuredGrid.hxx.

Referenced by SMDS_Down2D.computeVolumeIdsFromNodesFace(), and SMDS_Down1D.computeVtkCells().

  {
    return Links;
  }
unsigned long SMDS_UnstructuredGrid::GetMTime ( ) [virtual]

Definition at line 83 of file SMDS_UnstructuredGrid.cxx.

References MESSAGE.

{
  unsigned long mtime = vtkUnstructuredGrid::GetMTime();
  MESSAGE("vtkUnstructuredGrid::GetMTime: " << mtime);
  return mtime;
}
int SMDS_UnstructuredGrid::GetNeighbors ( int neighborsVtkIds,
int downIds,
unsigned char *  downTypes,
int  vtkId 
)

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...).

Parameters:
neighborsVtkIdsvector of neighbors vtk id's to fill (reserve enough space).
downIdsdownward id's of cells of dimension n-1, to fill (reserve enough space).
downTypesvtk types of cells of dimension n-1, to fill (reserve enough space).
vtkIdthe vtk id of the cell
Returns:
number of neighbors

Definition at line 732 of file SMDS_UnstructuredGrid.cxx.

References _cellIdToDownId, _downArray, SMDS_Downward.getCellDimension(), and NBMAXNEIGHBORS.

Referenced by SMESH_MeshEditor.DoubleNodesOnGroupBoundaries().

{
  int vtkType = this->GetCellType(vtkId);
  int cellDim = SMDS_Downward::getCellDimension(vtkType);
  if (cellDim <2)
    return 0; // TODO voisins des edges = edges connectees
  int cellId = this->_cellIdToDownId[vtkId];

  int nbCells = _downArray[vtkType]->getNumberOfDownCells(cellId);
  const int *downCells = _downArray[vtkType]->getDownCells(cellId);
  const unsigned char* downTyp = _downArray[vtkType]->getDownTypes(cellId);

  // --- iteration on faces of the 3D cell (or edges on the 2D cell).

  int nb = 0;
  for (int i = 0; i < nbCells; i++)
    {
      int downId = downCells[i];
      int cellType = downTyp[i];
      int nbUp = _downArray[cellType]->getNumberOfUpCells(downId);
      const int *upCells = _downArray[cellType]->getUpCells(downId);
      const unsigned char* upTypes = _downArray[cellType]->getUpTypes(downId);

      // ---for a volume, max 2 upCells, one is this cell, the other is a neighbor
      //    for a face, number of neighbors (connected faces) not known

      for (int j = 0; j < nbUp; j++)
        {
          if ((upCells[j] == cellId) && (upTypes[j] == vtkType))
            continue;
          int vtkNeighbor = _downArray[upTypes[j]]->getVtkCellId(upCells[j]);
          neighborsVtkIds[nb] = vtkNeighbor;
          downIds[nb] = downId;
          downTypes[nb] = cellType;
          nb++;
        }
      if (nb >= NBMAXNEIGHBORS)
        assert(0);
    }
  return nb;
}
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.

Parameters:
nodeSetset of of vtk node id's to fill.
downIddownward connectivity id of the cell.
downTypetype of cell.

Definition at line 889 of file SMDS_UnstructuredGrid.cxx.

References _downArray.

Referenced by SMESH_MeshEditor.DoubleNodesOnGroupBoundaries().

{
  _downArray[downType]->getNodeIds(downId, nodeSet);
}
int SMDS_UnstructuredGrid::getOrderedNodesOfFace ( int  vtkVolId,
std::vector< vtkIdType > &  orderedNodes 
)

reorder the nodes of a face

Parameters:
vtkVolIdvtk id of a volume containing the face, to get an orientation for the face.
orderedNodeslist of nodes to reorder (in out)
Returns:
size of the list

Definition at line 922 of file SMDS_UnstructuredGrid.cxx.

References _cellIdToDownId, _downArray, SMDS_Downward.getCellDimension(), and SMDS_Down3D.getOrderedNodesOfFace().

Referenced by extrudeVolumeFromFace().

{
  int vtkType = this->GetCellType(vtkVolId);
  int cellDim = SMDS_Downward::getCellDimension(vtkType);
  if (cellDim != 3)
    return 0;
  SMDS_Down3D *downvol = static_cast<SMDS_Down3D*> (_downArray[vtkType]);
  int downVolId = this->_cellIdToDownId[vtkVolId];
  downvol->getOrderedNodesOfFace(downVolId, orderedNodes);
  return orderedNodes.size();
}
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

Parameters:
volVtkIdsvector of parent volume ids to fill (reserve enough space!)
vtkIdvtk id of the face or edge

Definition at line 779 of file SMDS_UnstructuredGrid.cxx.

References _downArray, CellIdToDownId(), SMDS_Downward.getCellDimension(), and MESSAGE.

Referenced by SMESH_MeshEditor.DoubleNodesOnGroupBoundaries().

{
  int vtkType = this->GetCellType(vtkId);
  int dim = SMDS_Downward::getCellDimension(vtkType);
  int nbFaces = 0;
  unsigned char cellTypes[1000];
  int downCellId[1000];
  if (dim == 1)
    {
      int downId = this->CellIdToDownId(vtkId);
      if (downId < 0)
        {
          MESSAGE("Downward structure not up to date: new edge not taken into account");
          return 0;
        }
      nbFaces = _downArray[vtkType]->getNumberOfUpCells(downId);
      const int *upCells = _downArray[vtkType]->getUpCells(downId);
      const unsigned char* upTypes = _downArray[vtkType]->getUpTypes(downId);
      for (int i=0; i< nbFaces; i++)
        {
          cellTypes[i] = upTypes[i];
          downCellId[i] = upCells[i];
        }
    }
  else if (dim == 2)
    {
      nbFaces = 1;
      cellTypes[0] = this->GetCellType(vtkId);
      int downId = this->CellIdToDownId(vtkId);
      if (downId < 0)
        {
          MESSAGE("Downward structure not up to date: new face not taken into account");
          return 0;
        }
      downCellId[0] = downId;
    }

  int nbvol =0;
  for (int i=0; i<nbFaces; i++)
    {
      int vtkTypeFace = cellTypes[i];
      int downId = downCellId[i];
      int nv = _downArray[vtkTypeFace]->getNumberOfUpCells(downId);
      const int *upCells = _downArray[vtkTypeFace]->getUpCells(downId);
      const unsigned char* upTypes = _downArray[vtkTypeFace]->getUpTypes(downId);
       for (int j=0; j<nv; j++)
        {
          int vtkVolId = _downArray[upTypes[j]]->getVtkCellId(upCells[j]);
          if (vtkVolId >= 0)
            volVtkIds[nbvol++] = vtkVolId;
        }
    }
  return nbvol;
}
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

Parameters:
volVtkIdsvector of parent volume ids to fill (reserve enough space!)
downIdid in the downward structure
downTypetype of cell

Definition at line 840 of file SMDS_UnstructuredGrid.cxx.

References _downArray, and SMDS_Downward.getCellDimension().

{
  int vtkType = downType;
  int dim = SMDS_Downward::getCellDimension(vtkType);
  int nbFaces = 0;
  unsigned char cellTypes[1000];
  int downCellId[1000];
  if (dim == 1)
    {
      nbFaces = _downArray[vtkType]->getNumberOfUpCells(downId);
      const int *upCells = _downArray[vtkType]->getUpCells(downId);
      const unsigned char* upTypes = _downArray[vtkType]->getUpTypes(downId);
      for (int i=0; i< nbFaces; i++)
        {
          cellTypes[i] = upTypes[i];
          downCellId[i] = upCells[i];
        }
    }
  else if (dim == 2)
    {
      nbFaces = 1;
      cellTypes[0] = vtkType;
      downCellId[0] = downId;
    }

  int nbvol =0;
  for (int i=0; i<nbFaces; i++)
    {
      int vtkTypeFace = cellTypes[i];
      int downId = downCellId[i];
      int nv = _downArray[vtkTypeFace]->getNumberOfUpCells(downId);
      const int *upCells = _downArray[vtkTypeFace]->getUpCells(downId);
      const unsigned char* upTypes = _downArray[vtkTypeFace]->getUpTypes(downId);
       for (int j=0; j<nv; j++)
        {
          int vtkVolId = _downArray[upTypes[j]]->getVtkCellId(upCells[j]);
          if (vtkVolId >= 0)
            volVtkIds[nbvol++] = vtkVolId;
        }
    }
  return nbvol;
}
vtkPoints * SMDS_UnstructuredGrid::GetPoints ( ) [virtual]

Definition at line 102 of file SMDS_UnstructuredGrid.cxx.

Referenced by SMDS_Mesh.adjustStructure(), SMDS_MeshNode.init(), SMDS_VtkVolume.initPoly(), SMDS_MeshNode.setXYZ(), and SMDS_Mesh.updateBoundingBox().

{
  // TODO erreur incomprehensible de la macro vtk GetPoints apparue avec la version paraview de fin aout 2010
  //MESSAGE("*********************** SMDS_UnstructuredGrid::GetPoints " << this->Points << " " << vtkUnstructuredGrid::GetPoints());
  return this->Points;
}
int SMDS_UnstructuredGrid::InsertNextLinkedCell ( int  type,
int  npts,
vtkIdType *  pts 
)

Definition at line 110 of file SMDS_UnstructuredGrid.cxx.

Referenced by SMDS_VtkVolume.initPoly().

{
  if (type != VTK_POLYHEDRON)
    return vtkUnstructuredGrid::InsertNextLinkedCell(type, npts, pts);

  // --- type = VTK_POLYHEDRON
  //MESSAGE("InsertNextLinkedCell VTK_POLYHEDRON");
  int cellid = this->InsertNextCell(type, npts, pts);

  set<vtkIdType> setOfNodes;
  setOfNodes.clear();
  int nbfaces = npts;
  int i = 0;
  for (int nf = 0; nf < nbfaces; nf++)
    {
      int nbnodes = pts[i];
      i++;
      for (int k = 0; k < nbnodes; k++)
        {
          //MESSAGE(" cell " << cellid << " face " << nf << " node " << pts[i]);
          setOfNodes.insert(pts[i]);
          i++;
        }
    }

  set<vtkIdType>::iterator it = setOfNodes.begin();
  for (; it != setOfNodes.end(); ++it)
    {
      //MESSAGE("reverse link for node " << *it << " cell " << cellid);
      this->Links->ResizeCellList(*it, 1);
      this->Links->AddCellReference(cellid, *it);
    }

  return cellid;
}
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.

Parameters:
vtkVolIdvtk id of the cell
localClonedNodeIdsmap old node id to new node id.

Definition at line 899 of file SMDS_UnstructuredGrid.cxx.

Referenced by SMESHDS_Mesh.ModifyCellNodes().

{
  vtkIdType npts = 0;
  vtkIdType *pts; // will refer to the point id's of the face
  this->GetCellPoints(vtkVolId, npts, pts);
  for (int i = 0; i < npts; i++)
    {
      if (localClonedNodeIds.count(pts[i]))
        {
          vtkIdType oldpt = pts[i];
          pts[i] = localClonedNodeIds[oldpt];
          //MESSAGE(oldpt << " --> " << pts[i]);
          //this->RemoveReferenceToCell(oldpt, vtkVolId);
          //this->AddReferenceToCell(pts[i], vtkVolId);
        }
    }
}
SMDS_UnstructuredGrid * SMDS_UnstructuredGrid::New ( ) [static]

Definition at line 64 of file SMDS_UnstructuredGrid.cxx.

References MESSAGE, and SMDS_UnstructuredGrid().

Referenced by BuildLinks(), compactGrid(), SMESH_MeshObj.NulData(), and SMDS_Mesh.SMDS_Mesh().

{
  MESSAGE("SMDS_UnstructuredGrid::New");
  return new SMDS_UnstructuredGrid();
}
void SMDS_UnstructuredGrid::setCellIdToDownId ( int  vtkCellId,
int  downId 
)

Definition at line 343 of file SMDS_UnstructuredGrid.cxx.

References _cellIdToDownId.

Referenced by SMDS_Downward.addCell().

{
  // ASSERT((vtkCellId >= 0) && (vtkCellId < _cellIdToDownId.size()));
  _cellIdToDownId[vtkCellId] = downId;
}
void SMDS_UnstructuredGrid::setSMDS_mesh ( SMDS_Mesh mesh)

Definition at line 147 of file SMDS_UnstructuredGrid.cxx.

References _mesh, and PAL_MESH_041_mesh.mesh.

Referenced by SMDS_Mesh.SMDS_Mesh().

{
  _mesh = mesh;
}
void SMDS_UnstructuredGrid::Update ( ) [virtual]

Definition at line 90 of file SMDS_UnstructuredGrid.cxx.

References MESSAGE.

{
  MESSAGE("SMDS_UnstructuredGrid::Update");
  return vtkUnstructuredGrid::Update();
}
void SMDS_UnstructuredGrid::UpdateInformation ( ) [virtual]

Definition at line 96 of file SMDS_UnstructuredGrid.cxx.

References MESSAGE.

{
  MESSAGE("SMDS_UnstructuredGrid::UpdateInformation");
  return vtkUnstructuredGrid::UpdateInformation();
}

Field Documentation

std::vector<int> SMDS_UnstructuredGrid._cellIdToDownId [protected]

convert vtk Id to downward[vtkType] id, initialized with -1

Definition at line 110 of file SMDS_UnstructuredGrid.hxx.

Referenced by BuildDownwardConnectivity(), CellIdToDownId(), CleanDownwardConnectivity(), GetNeighbors(), getOrderedNodesOfFace(), setCellIdToDownId(), and SMDS_UnstructuredGrid().

std::vector<unsigned char> SMDS_UnstructuredGrid._downTypes [protected]

Definition at line 111 of file SMDS_UnstructuredGrid.hxx.

Referenced by SMDS_UnstructuredGrid().

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS