Version: 9.16.0
SMDS_UnstructuredGrid.hxx
Go to the documentation of this file.
1// Copyright (C) 2010-2026 CEA, EDF, OPEN CASCADE
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20// File: SMDS_UnstructuredGrid.hxx
21// Author: prascle
22// Created: September 16, 2009, 10:28 PM
23
24#ifndef _SMDS_UNSTRUCTUREDGRID_HXX
25#define _SMDS_UNSTRUCTUREDGRID_HXX
26
27#include "SMESH_SMDS.hxx"
28
29#include <vtkUnstructuredGrid.h>
30#include <vtkCellLinks.h>
31#include <smIdType.hxx>
32
33#include <vector>
34#include <set>
35#include <map>
36
37//#define VTK_HAVE_POLYHEDRON
38//#ifdef VTK_HAVE_POLYHEDRON
39#define VTK_MAXTYPE VTK_POLYHEDRON
40//#else
41// #define VTK_MAXTYPE VTK_QUADRATIC_PYRAMID
42//#endif
43
44#define NBMAXNEIGHBORS 100
45
46// allow very huge polyhedrons in tests
47#define NBMAXNODESINCELL 5000
48
49// Keep compatibility with paraview 5.0.1 on Linux
50#ifndef WIN32
51 #ifndef VTK_HAS_MTIME_TYPE
52 #define VTK_HAS_MTIME_TYPE
53 typedef unsigned long int vtkMTimeType;
54 #endif
55#endif
56
57class SMDS_Downward;
58class SMDS_Mesh;
59class SMDS_MeshCell;
60class SMDS_MeshVolume;
61
63{
64public:
65 void ResizeForPoint(vtkIdType vtkID);
66 void BuildLinks(vtkDataSet *data, vtkCellArray *Connectivity, vtkUnsignedCharArray* types);
67 static SMDS_CellLinks* New();
68protected:
71};
72
108{
109public:
110 void setSMDS_mesh(SMDS_Mesh *mesh);
111 void compactGrid(std::vector<smIdType>& idNodesOldToNew,
112 smIdType newNodeSize,
113 std::vector<smIdType>& idCellsOldToNew,
114 smIdType newCellSize);
115 virtual vtkMTimeType GetMTime();
116 virtual vtkPoints *GetPoints();
117
118 vtkIdType InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
119
120 int CellIdToDownId(vtkIdType vtkCellId);
121 void setCellIdToDownId(vtkIdType vtkCellId, int downId);
122 void CleanDownwardConnectivity();
123 void BuildDownwardConnectivity(bool withEdges);
124 int GetNeighbors(int* neighborsVtkIds, int* downIds, unsigned char* downTypes, int vtkId, bool getSkin=false);
125 int GetParentVolumes(int* volVtkIds, int vtkId);
126 int GetParentVolumes(int* volVtkIds, int downId, unsigned char downType);
127 void GetNodeIds(std::set<int>& nodeSet, int downId, unsigned char downType);
128 void ModifyCellNodes(int vtkVolId, std::map<int, int> localClonedNodeIds);
129 int getOrderedNodesOfFace(int vtkVolId, int& dim, std::vector<vtkIdType>& orderedNodes);
130 SMDS_MeshCell* extrudeVolumeFromFace(int vtkVolId, int domain1, int domain2,
131 std::set<int>& originalNodes,
132 std::map<int, std::map<int, int> >& nodeDomains,
133 std::map<int, std::map<long,int> >& nodeQuadDomains);
134 void BuildLinks();
135 void DeleteLinks();
136 SMDS_CellLinks* GetLinks();
137 bool HasLinks() const { return this->Links; }
138
139 SMDS_Downward* getDownArray(unsigned char vtkType)
140 {
141 return _downArray[vtkType];
142 }
143 void AllocateDiameters( vtkIdType maxVtkID );
144 void SetBallDiameter( vtkIdType vtkID, double diameter );
145 double GetBallDiameter( vtkIdType vtkID ) const;
146
147 static SMDS_UnstructuredGrid* New();
149
150protected:
153 void copyNodes(vtkPoints *newPoints, std::vector<smIdType>& idNodesOldToNew, vtkIdType& alreadyCopied, vtkIdType start, vtkIdType end);
154 void copyBloc(vtkUnsignedCharArray *newTypes,
155 const std::vector<smIdType>& idCellsOldToNew,
156 const std::vector<smIdType>& idNodesOldToNew,
157 vtkCellArray* newConnectivity,
158 vtkIdTypeArray* newLocations,
159 std::vector<vtkIdType>& pointsCell);
160
161 std::vector<int> _cellIdToDownId;
162 std::vector<unsigned char> _downTypes;
163 std::vector<SMDS_Downward*> _downArray;
164};
165
166#endif /* _SMDS_UNSTRUCTUREDGRID_HXX */
167
unsigned long int vtkMTimeType
Definition: SMDS_UnstructuredGrid.hxx:53
#define SMDS_EXPORT
Definition: SMESH_SMDS.hxx:37
IMAP::const_iterator end(const IMAP &m)
Definition: StdMeshers_Projection_2D.cxx:106
Definition: SMDS_Downward.hxx:68
Base class for all cells.
Definition: SMDS_MeshCell.hxx:32
Mesh volume.
Definition: SMDS_MeshVolume.hxx:40
Definition: SMDS_Mesh.hxx:53
This class extends vtkUnstructuredGrid to deal with downward connectivity.
Definition: SMDS_UnstructuredGrid.hxx:108
std::vector< int > _cellIdToDownId
convert vtk Id to downward[vtkType] id, initialized with -1
Definition: SMDS_UnstructuredGrid.hxx:161
std::vector< unsigned char > _downTypes
Definition: SMDS_UnstructuredGrid.hxx:162
std::vector< SMDS_Downward * > _downArray
Definition: SMDS_UnstructuredGrid.hxx:163
bool HasLinks() const
Definition: SMDS_UnstructuredGrid.hxx:137
SMDS_Mesh * _mesh
Definition: SMDS_UnstructuredGrid.hxx:148
SMDS_Downward * getDownArray(unsigned char vtkType)
Definition: SMDS_UnstructuredGrid.hxx:139
QMap< int, QList< int > > Connectivity
Definition: SMESHGUI_SelectionProxy.h:114