2 * File: SMDS_UnstructuredGrid.hxx
5 * Created on September 16, 2009, 10:28 PM
8 #ifndef _SMDS_UNSTRUCTUREDGRID_HXX
9 #define _SMDS_UNSTRUCTUREDGRID_HXX
11 #include <vtkUnstructuredGrid.h>
18 //#define VTK_HAVE_POLYHEDRON
19 //#ifdef VTK_HAVE_POLYHEDRON
20 #define VTK_MAXTYPE VTK_POLYHEDRON
22 // #define VTK_MAXTYPE VTK_QUADRATIC_PYRAMID
25 #define NBMAXNEIGHBORS 100
27 // allow very huge polyhedrons in tests
28 #define NBMAXNODESINCELL 5000
33 class SMDS_UnstructuredGrid: public vtkUnstructuredGrid
36 void setSMDS_mesh(SMDS_Mesh *mesh);
37 void compactGrid(std::vector<int>& idNodesOldToNew, int newNodeSize, std::vector<int>& idCellsOldToNew,
40 virtual unsigned long GetMTime();
41 virtual void Update();
42 virtual void UpdateInformation();
43 virtual vtkPoints *GetPoints();
45 //#ifdef VTK_HAVE_POLYHEDRON
46 int InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
49 int CellIdToDownId(int vtkCellId);
50 void setCellIdToDownId(int vtkCellId, int downId);
51 void BuildDownwardConnectivity(bool withEdges);
52 int GetNeighbors(int* neighborsVtkIds, int* downIds, unsigned char* downTypes, int vtkId);
53 void GetNodeIds(std::set<int>& nodeSet, int downId, unsigned char downType);
54 void ModifyCellNodes(int vtkVolId, std::map<int, int> localClonedNodeIds);
55 int getOrderedNodesOfFace(int vtkVolId, std::vector<int>& orderedNodes);
56 vtkCellLinks* GetLinks()
60 SMDS_Downward* getDownArray(unsigned char vtkType)
62 return _downArray[vtkType];
64 static SMDS_UnstructuredGrid* New();
67 SMDS_UnstructuredGrid();
68 ~SMDS_UnstructuredGrid();
69 void copyNodes(vtkPoints *newPoints, std::vector<int>& idNodesOldToNew, int& alreadyCopied, int start, int end);
70 void copyBloc(vtkUnsignedCharArray *newTypes, std::vector<int>& idCellsOldToNew, std::vector<int>& idNodesOldToNew,
71 vtkCellArray* newConnectivity, vtkIdTypeArray* newLocations, vtkIdType* pointsCell, int& alreadyCopied,
74 std::vector<int> _cellIdToDownId; //!< convert vtk Id to downward[vtkType] id, initialized with -1
75 std::vector<unsigned char> _downTypes;
76 std::vector<SMDS_Downward*> _downArray;
79 #endif /* _SMDS_UNSTRUCTUREDGRID_HXX */