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>
12 #include <vtkCellLinks.h>
19 //#define VTK_HAVE_POLYHEDRON
20 //#ifdef VTK_HAVE_POLYHEDRON
21 #define VTK_MAXTYPE VTK_POLYHEDRON
23 // #define VTK_MAXTYPE VTK_QUADRATIC_PYRAMID
26 #define NBMAXNEIGHBORS 100
28 // allow very huge polyhedrons in tests
29 #define NBMAXNODESINCELL 5000
34 class SMDS_CellLinks: public vtkCellLinks
37 vtkCellLinks::Link* ResizeL(vtkIdType sz);
38 vtkIdType GetLinksSize();
39 static SMDS_CellLinks* New();
45 class SMDS_UnstructuredGrid: public vtkUnstructuredGrid
48 void setSMDS_mesh(SMDS_Mesh *mesh);
49 void compactGrid(std::vector<int>& idNodesOldToNew, int newNodeSize, std::vector<int>& idCellsOldToNew,
52 virtual unsigned long GetMTime();
53 virtual void Update();
54 virtual void UpdateInformation();
55 virtual vtkPoints *GetPoints();
57 //#ifdef VTK_HAVE_POLYHEDRON
58 int InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
61 int CellIdToDownId(int vtkCellId);
62 void setCellIdToDownId(int vtkCellId, int downId);
63 void BuildDownwardConnectivity(bool withEdges);
64 int GetNeighbors(int* neighborsVtkIds, int* downIds, unsigned char* downTypes, int vtkId);
65 void GetNodeIds(std::set<int>& nodeSet, int downId, unsigned char downType);
66 void ModifyCellNodes(int vtkVolId, std::map<int, int> localClonedNodeIds);
67 int getOrderedNodesOfFace(int vtkVolId, std::vector<int>& orderedNodes);
69 vtkCellLinks* GetLinks()
73 SMDS_Downward* getDownArray(unsigned char vtkType)
75 return _downArray[vtkType];
77 static SMDS_UnstructuredGrid* New();
80 SMDS_UnstructuredGrid();
81 ~SMDS_UnstructuredGrid();
82 void copyNodes(vtkPoints *newPoints, std::vector<int>& idNodesOldToNew, int& alreadyCopied, int start, int end);
83 void copyBloc(vtkUnsignedCharArray *newTypes, std::vector<int>& idCellsOldToNew, std::vector<int>& idNodesOldToNew,
84 vtkCellArray* newConnectivity, vtkIdTypeArray* newLocations, vtkIdType* pointsCell, int& alreadyCopied,
87 std::vector<int> _cellIdToDownId; //!< convert vtk Id to downward[vtkType] id, initialized with -1
88 std::vector<unsigned char> _downTypes;
89 std::vector<SMDS_Downward*> _downArray;
92 #endif /* _SMDS_UNSTRUCTUREDGRID_HXX */