/* * File: SMDS_UnstructuredGrid.hxx * Author: prascle * * Created on September 16, 2009, 10:28 PM */ #ifndef _SMDS_UNSTRUCTUREDGRID_HXX #define _SMDS_UNSTRUCTUREDGRID_HXX #include #include #include "chrono.hxx" #include #include #include //#define VTK_HAVE_POLYHEDRON //#ifdef VTK_HAVE_POLYHEDRON #define VTK_MAXTYPE VTK_POLYHEDRON //#else // #define VTK_MAXTYPE VTK_QUADRATIC_PYRAMID //#endif #define NBMAXNEIGHBORS 100 // allow very huge polyhedrons in tests #define NBMAXNODESINCELL 5000 class SMDS_Downward; class SMDS_Mesh; class SMDS_MeshVolume; class SMDS_CellLinks: public vtkCellLinks { public: vtkCellLinks::Link* ResizeL(vtkIdType sz); vtkIdType GetLinksSize(); static SMDS_CellLinks* New(); protected: SMDS_CellLinks(); ~SMDS_CellLinks(); }; class SMDS_UnstructuredGrid: public vtkUnstructuredGrid { public: void setSMDS_mesh(SMDS_Mesh *mesh); void compactGrid(std::vector& idNodesOldToNew, int newNodeSize, std::vector& idCellsOldToNew, int newCellSize); virtual unsigned long GetMTime(); virtual void Update(); virtual void UpdateInformation(); virtual vtkPoints *GetPoints(); //#ifdef VTK_HAVE_POLYHEDRON int InsertNextLinkedCell(int type, int npts, vtkIdType *pts); //#endif int CellIdToDownId(int vtkCellId); void setCellIdToDownId(int vtkCellId, int downId); void CleanDownwardConnectivity(); void BuildDownwardConnectivity(bool withEdges); int GetNeighbors(int* neighborsVtkIds, int* downIds, unsigned char* downTypes, int vtkId); int GetParentVolumes(int* volVtkIds, int vtkId); int GetParentVolumes(int* volVtkIds, int downId, unsigned char downType); void GetNodeIds(std::set& nodeSet, int downId, unsigned char downType); void ModifyCellNodes(int vtkVolId, std::map localClonedNodeIds); int getOrderedNodesOfFace(int vtkVolId, std::vector& orderedNodes); void BuildLinks(); SMDS_MeshVolume* extrudeVolumeFromFace(int vtkVolId, int domain1, int domain2, std::set& originalNodes, std::map >& nodeDomains, std::map >& nodeQuadDomains); vtkCellLinks* GetLinks() { return Links; } SMDS_Downward* getDownArray(unsigned char vtkType) { return _downArray[vtkType]; } static SMDS_UnstructuredGrid* New(); SMDS_Mesh *_mesh; protected: SMDS_UnstructuredGrid(); ~SMDS_UnstructuredGrid(); void copyNodes(vtkPoints *newPoints, std::vector& idNodesOldToNew, int& alreadyCopied, int start, int end); void copyBloc(vtkUnsignedCharArray *newTypes, std::vector& idCellsOldToNew, std::vector& idNodesOldToNew, vtkCellArray* newConnectivity, vtkIdTypeArray* newLocations, vtkIdType* pointsCell, int& alreadyCopied, int start, int end); std::vector _cellIdToDownId; //!< convert vtk Id to downward[vtkType] id, initialized with -1 std::vector _downTypes; std::vector _downArray; }; #endif /* _SMDS_UNSTRUCTUREDGRID_HXX */