Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SMDS_UNSTRUCTUREDGRID_HXX
00025 #define _SMDS_UNSTRUCTUREDGRID_HXX
00026
00027 #include <vtkUnstructuredGrid.h>
00028 #include <vtkCellLinks.h>
00029 #include "chrono.hxx"
00030
00031 #include <vector>
00032 #include <set>
00033 #include <map>
00034
00035
00036
00037 #define VTK_MAXTYPE VTK_POLYHEDRON
00038
00039
00040
00041
00042 #define NBMAXNEIGHBORS 100
00043
00044
00045 #define NBMAXNODESINCELL 5000
00046
00047 class SMDS_Downward;
00048 class SMDS_Mesh;
00049 class SMDS_MeshVolume;
00050
00051 class SMDS_CellLinks: public vtkCellLinks
00052 {
00053 public:
00054 vtkCellLinks::Link* ResizeL(vtkIdType sz);
00055 vtkIdType GetLinksSize();
00056 static SMDS_CellLinks* New();
00057 protected:
00058 SMDS_CellLinks();
00059 ~SMDS_CellLinks();
00060 };
00061
00062 class SMDS_UnstructuredGrid: public vtkUnstructuredGrid
00063 {
00064 public:
00065 void setSMDS_mesh(SMDS_Mesh *mesh);
00066 void compactGrid(std::vector<int>& idNodesOldToNew, int newNodeSize, std::vector<int>& idCellsOldToNew,
00067 int newCellSize);
00068
00069 virtual unsigned long GetMTime();
00070 virtual void Update();
00071 virtual void UpdateInformation();
00072 virtual vtkPoints *GetPoints();
00073
00074
00075 int InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
00076
00077
00078 int CellIdToDownId(int vtkCellId);
00079 void setCellIdToDownId(int vtkCellId, int downId);
00080 void CleanDownwardConnectivity();
00081 void BuildDownwardConnectivity(bool withEdges);
00082 int GetNeighbors(int* neighborsVtkIds, int* downIds, unsigned char* downTypes, int vtkId);
00083 int GetParentVolumes(int* volVtkIds, int vtkId);
00084 int GetParentVolumes(int* volVtkIds, int downId, unsigned char downType);
00085 void GetNodeIds(std::set<int>& nodeSet, int downId, unsigned char downType);
00086 void ModifyCellNodes(int vtkVolId, std::map<int, int> localClonedNodeIds);
00087 int getOrderedNodesOfFace(int vtkVolId, std::vector<vtkIdType>& orderedNodes);
00088 void BuildLinks();
00089 SMDS_MeshVolume* extrudeVolumeFromFace(int vtkVolId, int domain1, int domain2, std::set<int>& originalNodes,
00090 std::map<int, std::map<int, int> >& nodeDomains,
00091 std::map<int, std::map<long,int> >& nodeQuadDomains);
00092 vtkCellLinks* GetLinks()
00093 {
00094 return Links;
00095 }
00096 SMDS_Downward* getDownArray(unsigned char vtkType)
00097 {
00098 return _downArray[vtkType];
00099 }
00100 static SMDS_UnstructuredGrid* New();
00101 SMDS_Mesh *_mesh;
00102 protected:
00103 SMDS_UnstructuredGrid();
00104 ~SMDS_UnstructuredGrid();
00105 void copyNodes(vtkPoints *newPoints, std::vector<int>& idNodesOldToNew, int& alreadyCopied, int start, int end);
00106 void copyBloc(vtkUnsignedCharArray *newTypes, std::vector<int>& idCellsOldToNew, std::vector<int>& idNodesOldToNew,
00107 vtkCellArray* newConnectivity, vtkIdTypeArray* newLocations, vtkIdType* pointsCell, int& alreadyCopied,
00108 int start, int end);
00109
00110 std::vector<int> _cellIdToDownId;
00111 std::vector<unsigned char> _downTypes;
00112 std::vector<SMDS_Downward*> _downArray;
00113 };
00114
00115 #endif
00116