VMTK
Loading...
Searching...
No Matches
vtkvmtkBoundaryLayerGenerator2 Class Reference

Provides an extended version of vtkvmtkBoundaryLayerGenerator. More...

#include <vtkvmtkBoundaryLayerGenerator2.h>

Inheritance diagram for vtkvmtkBoundaryLayerGenerator2:
[legend]
Collaboration diagram for vtkvmtkBoundaryLayerGenerator2:
[legend]

Public Types

typedef vtkvmtkBoundaryLayerGenerator Superclass
Public Types inherited from vtkvmtkBoundaryLayerGenerator
typedef vtkUnstructuredGridAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkBoundaryLayerGenerator2 * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override
virtual char * GetOpenProfilesIdsArrayName ()
virtual void SetOpenProfilesIdsArrayName (const char *)
virtual int GetIncludeExtrudedOpenProfilesCells ()
virtual void SetIncludeExtrudedOpenProfilesCells (int)
virtual void IncludeExtrudedOpenProfilesCellsOn ()
virtual void IncludeExtrudedOpenProfilesCellsOff ()
virtual int GetIncludeExtrudedSurfaceCells ()
virtual void SetIncludeExtrudedSurfaceCells (int)
virtual void IncludeExtrudedSurfaceCellsOn ()
virtual void IncludeExtrudedSurfaceCellsOff ()
virtual int GetIncludeOriginalSurfaceCells ()
virtual void SetIncludeOriginalSurfaceCells (int)
virtual void IncludeOriginalSurfaceCellsOn ()
virtual void IncludeOriginalSurfaceCellsOff ()
virtual int GetLayerEntityId ()
virtual void SetLayerEntityId (int)
virtual int GetSurfaceEntityId ()
virtual void SetSurfaceEntityId (int)
virtual int GetOpenProfilesEntityId ()
virtual void SetOpenProfilesEntityId (int)
Public Member Functions inherited from vtkvmtkBoundaryLayerGenerator
vtkvmtkBoundaryLayerGenerator * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override
virtual vtkUnstructuredGrid * GetInnerSurface ()
virtual char * GetWarpVectorsArrayName ()
virtual void SetWarpVectorsArrayName (const char *)
virtual char * GetLayerThicknessArrayName ()
virtual void SetLayerThicknessArrayName (const char *)
virtual int GetUseWarpVectorMagnitudeAsThickness ()
virtual void SetUseWarpVectorMagnitudeAsThickness (int)
virtual void UseWarpVectorMagnitudeAsThicknessOn ()
virtual void UseWarpVectorMagnitudeAsThicknessOff ()
virtual int GetConstantThickness ()
virtual void SetConstantThickness (int)
virtual void ConstantThicknessOn ()
virtual void ConstantThicknessOff ()
virtual int GetIncludeSurfaceCells ()
virtual void SetIncludeSurfaceCells (int)
virtual void IncludeSurfaceCellsOn ()
virtual void IncludeSurfaceCellsOff ()
virtual int GetIncludeSidewallCells ()
virtual void SetIncludeSidewallCells (int)
virtual void IncludeSidewallCellsOn ()
virtual void IncludeSidewallCellsOff ()
virtual int GetNegateWarpVectors ()
virtual void SetNegateWarpVectors (int)
virtual void NegateWarpVectorsOn ()
virtual void NegateWarpVectorsOff ()
virtual double GetLayerThickness ()
virtual void SetLayerThickness (double)
virtual double GetLayerThicknessRatio ()
virtual void SetLayerThicknessRatio (double)
virtual double GetMaximumLayerThickness ()
virtual void SetMaximumLayerThickness (double)
virtual int GetNumberOfSubLayers ()
virtual void SetNumberOfSubLayers (int)
virtual double GetSubLayerRatio ()
virtual void SetSubLayerRatio (double)
virtual int GetNumberOfSubsteps ()
virtual void SetNumberOfSubsteps (int)
virtual double GetRelaxation ()
virtual void SetRelaxation (double)
virtual double GetLocalCorrectionFactor ()
virtual void SetLocalCorrectionFactor (double)
virtual int GetMaximumUntangleRoundsWithoutImprovement ()
virtual void SetMaximumUntangleRoundsWithoutImprovement (int)
virtual int GetNumberOfTangledCells ()
virtual void SetCellEntityIdsArrayName (const char *)
virtual char * GetCellEntityIdsArrayName ()
virtual int GetInnerSurfaceCellEntityId ()
virtual void SetInnerSurfaceCellEntityId (int)
virtual int GetOuterSurfaceCellEntityId ()
virtual void SetOuterSurfaceCellEntityId (int)
virtual int GetSidewallCellEntityId ()
virtual void SetSidewallCellEntityId (int)
virtual int GetVolumeCellEntityId ()
virtual void SetVolumeCellEntityId (int)

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkvmtkBoundaryLayerGenerator2 * SafeDownCast (vtkObjectBase *o)
static vtkvmtkBoundaryLayerGenerator2 * New ()
Static Public Member Functions inherited from vtkvmtkBoundaryLayerGenerator
static int IsTypeOf (const char *type)
static vtkvmtkBoundaryLayerGenerator * SafeDownCast (vtkObjectBase *o)
static vtkvmtkBoundaryLayerGenerator * New ()

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkBoundaryLayerGenerator2 ()
 ~vtkvmtkBoundaryLayerGenerator2 ()
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Protected Member Functions inherited from vtkvmtkBoundaryLayerGenerator
 vtkvmtkBoundaryLayerGenerator ()
 ~vtkvmtkBoundaryLayerGenerator ()
void BuildWarpVectors (vtkUnstructuredGrid *input)
void IncrementalWarpPoints (vtkUnstructuredGrid *input, vtkPoints *basePoints, vtkPoints *warpedPoints, int substep, int numberOfSubsteps, double relaxation)
void IncrementalWarpVectors (vtkUnstructuredGrid *input, int numberOfSubsteps, double relaxation)
int CheckTangle (vtkUnstructuredGrid *input, vtkUnsignedCharArray *checkArray)
void LocalUntangle (vtkUnstructuredGrid *input, vtkUnsignedCharArray *checkArray, double alpha)
void WarpPoints (vtkPoints *inputPoints, vtkPoints *warpedPoints, int subLayerId, bool quadratic)
void UnwrapSublayers (vtkUnstructuredGrid *input, vtkPoints *outputPoints)

Protected Attributes

char * OpenProfilesIdsArrayName
int IncludeExtrudedOpenProfilesCells
int IncludeExtrudedSurfaceCells
int IncludeOriginalSurfaceCells
int LayerEntityId
int SurfaceEntityId
int OpenProfilesEntityId
vtkOrderedTriangulator * Triangulator
Protected Attributes inherited from vtkvmtkBoundaryLayerGenerator
vtkDataArray * WarpVectorsArray
vtkDataArray * LayerThicknessArray
int UseWarpVectorMagnitudeAsThickness
int ConstantThickness
char * WarpVectorsArrayName
char * LayerThicknessArrayName
double LayerThickness
double LayerThicknessRatio
double MaximumLayerThickness
int NumberOfSubLayers
int NumberOfSubsteps
double SubLayerRatio
int IncludeSurfaceCells
int IncludeSidewallCells
int NegateWarpVectors
vtkUnstructuredGrid * InnerSurface
char * CellEntityIdsArrayName
int InnerSurfaceCellEntityId
int OuterSurfaceCellEntityId
int SidewallCellEntityId
int VolumeCellEntityId
double Relaxation
double LocalCorrectionFactor
int MaximumUntangleRoundsWithoutImprovement
int NumberOfTangledCells

Detailed Description

Provides an extended version of vtkvmtkBoundaryLayerGenerator.

This version allows finer control on the surfaces to be included. If the original surface has open profiles, a surface can be extracted from them as well. The points on the open profiles may be specified with an array (OpenProfilesIdsArrayName). A value of -1 in this array specifies a point on the interior of the surface. Cell entity ids can also be output for the volume and surface elements. Surface elements are numbered in increasing numbers, using the openProfilesIds if specified.

See also
vtkvmtkBoundaryLayerGenerator

Definition at line 41 of file vtkvmtkBoundaryLayerGenerator2.h.

Member Typedef Documentation

◆ Superclass

Constructor & Destructor Documentation

◆ vtkvmtkBoundaryLayerGenerator2()

vtkvmtkBoundaryLayerGenerator2::vtkvmtkBoundaryLayerGenerator2 ( )
protected

Definition at line 50 of file vtkvmtkBoundaryLayerGenerator2.cxx.

51{
52 this->CellEntityIdsArrayName = NULL;
53 this->OpenProfilesIdsArrayName = NULL;
57 this->LayerEntityId = 0;
58 this->SurfaceEntityId = 1;
59 this->OpenProfilesEntityId = 2;
60 this->Triangulator = vtkOrderedTriangulator::New();
61}

◆ ~vtkvmtkBoundaryLayerGenerator2()

vtkvmtkBoundaryLayerGenerator2::~vtkvmtkBoundaryLayerGenerator2 ( )
protected

Definition at line 63 of file vtkvmtkBoundaryLayerGenerator2.cxx.

64{
65 if (this->CellEntityIdsArrayName)
66 {
67 delete[] this->CellEntityIdsArrayName;
68 this->CellEntityIdsArrayName = NULL;
69 }
71 {
72 delete[] this->OpenProfilesIdsArrayName;
73 this->OpenProfilesIdsArrayName = NULL;
74 }
75 this->Triangulator->Delete();
76}

Member Function Documentation

◆ IsTypeOf()

int vtkvmtkBoundaryLayerGenerator2::IsTypeOf ( const char * type)
static

◆ IsA()

virtual int vtkvmtkBoundaryLayerGenerator2::IsA ( const char * type)
virtual

Reimplemented from vtkvmtkBoundaryLayerGenerator.

◆ SafeDownCast()

vtkvmtkBoundaryLayerGenerator2 * vtkvmtkBoundaryLayerGenerator2::SafeDownCast ( vtkObjectBase * o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkBoundaryLayerGenerator2::NewInstanceInternal ( ) const
protectedvirtual

Reimplemented from vtkvmtkBoundaryLayerGenerator.

◆ NewInstance()

vtkvmtkBoundaryLayerGenerator2 * vtkvmtkBoundaryLayerGenerator2::NewInstance ( ) const

◆ PrintSelf()

void vtkvmtkBoundaryLayerGenerator2::PrintSelf ( std::ostream & os,
vtkIndent indent )
override

Definition at line 541 of file vtkvmtkBoundaryLayerGenerator2.cxx.

542{
543 this->Superclass::PrintSelf(os,indent);
544}
void PrintSelf(std::ostream &os, vtkIndent indent) override

◆ New()

vtkvmtkBoundaryLayerGenerator2 * vtkvmtkBoundaryLayerGenerator2::New ( )
static

◆ GetOpenProfilesIdsArrayName()

virtual char * vtkvmtkBoundaryLayerGenerator2::GetOpenProfilesIdsArrayName ( )
virtual

Set/get the name of the per-point array that identifies which points of the input surface lie on an open profile. A value of -1 marks a point on the interior of the surface; any other value groups points belonging to the same open profile.

◆ SetOpenProfilesIdsArrayName()

virtual void vtkvmtkBoundaryLayerGenerator2::SetOpenProfilesIdsArrayName ( const char * )
virtual

Set/get the name of the per-point array that identifies which points of the input surface lie on an open profile. A value of -1 marks a point on the interior of the surface; any other value groups points belonging to the same open profile.

◆ GetIncludeExtrudedOpenProfilesCells()

virtual int vtkvmtkBoundaryLayerGenerator2::GetIncludeExtrudedOpenProfilesCells ( )
virtual

Include/exclude the extruded open-profile surface cells (the caps generated on the boundary-layer extrusion of the open profiles) in the output unstructured grid.

◆ SetIncludeExtrudedOpenProfilesCells()

virtual void vtkvmtkBoundaryLayerGenerator2::SetIncludeExtrudedOpenProfilesCells ( int )
virtual

Include/exclude the extruded open-profile surface cells (the caps generated on the boundary-layer extrusion of the open profiles) in the output unstructured grid.

◆ IncludeExtrudedOpenProfilesCellsOn()

virtual void vtkvmtkBoundaryLayerGenerator2::IncludeExtrudedOpenProfilesCellsOn ( )
virtual

Include/exclude the extruded open-profile surface cells (the caps generated on the boundary-layer extrusion of the open profiles) in the output unstructured grid.

◆ IncludeExtrudedOpenProfilesCellsOff()

virtual void vtkvmtkBoundaryLayerGenerator2::IncludeExtrudedOpenProfilesCellsOff ( )
virtual

Include/exclude the extruded open-profile surface cells (the caps generated on the boundary-layer extrusion of the open profiles) in the output unstructured grid.

◆ GetIncludeExtrudedSurfaceCells()

virtual int vtkvmtkBoundaryLayerGenerator2::GetIncludeExtrudedSurfaceCells ( )
virtual

Include/exclude the extruded outer surface cells (the outermost shell of the boundary layer) in the output unstructured grid.

◆ SetIncludeExtrudedSurfaceCells()

virtual void vtkvmtkBoundaryLayerGenerator2::SetIncludeExtrudedSurfaceCells ( int )
virtual

Include/exclude the extruded outer surface cells (the outermost shell of the boundary layer) in the output unstructured grid.

◆ IncludeExtrudedSurfaceCellsOn()

virtual void vtkvmtkBoundaryLayerGenerator2::IncludeExtrudedSurfaceCellsOn ( )
virtual

Include/exclude the extruded outer surface cells (the outermost shell of the boundary layer) in the output unstructured grid.

◆ IncludeExtrudedSurfaceCellsOff()

virtual void vtkvmtkBoundaryLayerGenerator2::IncludeExtrudedSurfaceCellsOff ( )
virtual

Include/exclude the extruded outer surface cells (the outermost shell of the boundary layer) in the output unstructured grid.

◆ GetIncludeOriginalSurfaceCells()

virtual int vtkvmtkBoundaryLayerGenerator2::GetIncludeOriginalSurfaceCells ( )
virtual

Include/exclude the original (non-extruded) input surface cells in the output unstructured grid.

◆ SetIncludeOriginalSurfaceCells()

virtual void vtkvmtkBoundaryLayerGenerator2::SetIncludeOriginalSurfaceCells ( int )
virtual

Include/exclude the original (non-extruded) input surface cells in the output unstructured grid.

◆ IncludeOriginalSurfaceCellsOn()

virtual void vtkvmtkBoundaryLayerGenerator2::IncludeOriginalSurfaceCellsOn ( )
virtual

Include/exclude the original (non-extruded) input surface cells in the output unstructured grid.

◆ IncludeOriginalSurfaceCellsOff()

virtual void vtkvmtkBoundaryLayerGenerator2::IncludeOriginalSurfaceCellsOff ( )
virtual

Include/exclude the original (non-extruded) input surface cells in the output unstructured grid.

◆ GetLayerEntityId()

virtual int vtkvmtkBoundaryLayerGenerator2::GetLayerEntityId ( )
virtual

Id assigned to the volumetric layer in the CellEntityIds array

◆ SetLayerEntityId()

virtual void vtkvmtkBoundaryLayerGenerator2::SetLayerEntityId ( int )
virtual

Id assigned to the volumetric layer in the CellEntityIds array

◆ GetSurfaceEntityId()

virtual int vtkvmtkBoundaryLayerGenerator2::GetSurfaceEntityId ( )
virtual

Entity Id of the first surface element of the layer.

◆ SetSurfaceEntityId()

virtual void vtkvmtkBoundaryLayerGenerator2::SetSurfaceEntityId ( int )
virtual

Entity Id of the first surface element of the layer.

◆ GetOpenProfilesEntityId()

virtual int vtkvmtkBoundaryLayerGenerator2::GetOpenProfilesEntityId ( )
virtual

Entity Id of the first open profile of the layer

◆ SetOpenProfilesEntityId()

virtual void vtkvmtkBoundaryLayerGenerator2::SetOpenProfilesEntityId ( int )
virtual

Entity Id of the first open profile of the layer

◆ RequestData()

int vtkvmtkBoundaryLayerGenerator2::RequestData ( vtkInformation * ,
vtkInformationVector ** ,
vtkInformationVector *  )
overrideprotectedvirtual

Reimplemented from vtkvmtkBoundaryLayerGenerator.

Definition at line 78 of file vtkvmtkBoundaryLayerGenerator2.cxx.

82{
83 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
84 vtkInformation *outInfo = outputVector->GetInformationObject(0);
85
86 vtkUnstructuredGrid *input = vtkUnstructuredGrid::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
87 vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
88
89 vtkPoints* inputPoints = input->GetPoints();
90
91 vtkIdType numberOfInputPoints = inputPoints->GetNumberOfPoints();
92 vtkIdType numberOfInputCells = input->GetNumberOfCells();
93
94 if (!this->WarpVectorsArrayName)
95 {
96 vtkErrorMacro("WarpVectors array name not specified.");
97 return 1;
98 }
99
100 if (!input->GetPointData()->GetArray(this->WarpVectorsArrayName))
101 {
102 vtkErrorMacro(<< "WarpVectors array with name specified does not exist!");
103 return 1;
104 }
105
106 this->WarpVectorsArray = input->GetPointData()->GetArray(this->WarpVectorsArrayName);
107
109 {
110 if (!this->LayerThicknessArrayName)
111 {
112 vtkErrorMacro("LayerThickness array name not specified.");
113 return 1;
114 }
115
116 if (!input->GetPointData()->GetArray(this->LayerThicknessArrayName))
117 {
118 vtkErrorMacro(<< "LayerThickness array with name specified does not exist!");
119 return 1;
120 }
121
122 this->LayerThicknessArray = input->GetPointData()->GetArray(this->LayerThicknessArrayName);
123 }
124
125 vtkPoints* outputPoints = vtkPoints::New();
126 vtkPoints* warpedPoints = vtkPoints::New();
127
128 vtkCellArray* boundaryLayerCellArray = vtkCellArray::New();
129 vtkIdList* boundaryLayerCellTypes = vtkIdList::New();
130
131 vtkIntArray *cellEntityIdsArray = NULL;
132
133 if ((this->CellEntityIdsArrayName) && (strcmp(this->CellEntityIdsArrayName,"") != 0))
134 {
135 cellEntityIdsArray = vtkIntArray::New();
136 cellEntityIdsArray->SetName(this->CellEntityIdsArrayName);
137 cellEntityIdsArray->SetNumberOfComponents(1);
138 }
139 //Keep track of the id to use
140 int currentSurfaceEntityId = this->SurfaceEntityId;
141
142 int cellType;
143 cellType = input->GetCellType(0); // TODO: check if all elements are consistent
144 bool warpQuadratic = false;
145 if (cellType == VTK_QUADRATIC_TRIANGLE)
146 {
147 warpQuadratic = true;
148 }
149
150 vtkIdType numberOfLayerPoints = numberOfInputPoints;
151 if (warpQuadratic)
152 {
153 numberOfLayerPoints = 2 * numberOfInputPoints;
154 }
155
156 outputPoints->SetNumberOfPoints(numberOfInputPoints + numberOfLayerPoints * this->NumberOfSubLayers);
157
158 double point[3];
159 int i;
160 for (i=0; i<numberOfInputPoints; i++)
161 {
162 inputPoints->GetPoint(i,point);
163 outputPoints->SetPoint(i,point);
164 }
165
166 vtkIdType npts;
167 const vtkIdType *pts;
168
169 vtkIdType *surfacePts;
170
172 {
173 for (i=0; i<numberOfInputCells; i++)
174 {
175 input->GetCellPoints(i,npts,pts);
176 cellType = input->GetCellType(i);
177 surfacePts = new vtkIdType[npts];
178 switch(cellType)
179 {
180 case VTK_TRIANGLE:
181 boundaryLayerCellTypes->InsertNextId(VTK_TRIANGLE);
182 surfacePts[0] = pts[0];
183 surfacePts[1] = pts[1];
184 surfacePts[2] = pts[2];
185 break;
186 case VTK_QUAD:
187 boundaryLayerCellTypes->InsertNextId(VTK_QUAD);
188 surfacePts[0] = pts[0];
189 surfacePts[1] = pts[1];
190 surfacePts[2] = pts[2];
191 surfacePts[3] = pts[3];
192 break;
193 case VTK_QUADRATIC_TRIANGLE:
194 boundaryLayerCellTypes->InsertNextId(VTK_QUADRATIC_TRIANGLE);
195 surfacePts[0] = pts[0];
196 surfacePts[1] = pts[1];
197 surfacePts[2] = pts[2];
198 surfacePts[3] = pts[3];
199 surfacePts[4] = pts[4];
200 surfacePts[5] = pts[5];
201 break;
202 default:
203 vtkErrorMacro(<<"Unsupported surface element.");
204 return 1;
205 break;
206 }
207 boundaryLayerCellArray->InsertNextCell(npts,surfacePts);
208 if (cellEntityIdsArray)
209 {
210 cellEntityIdsArray->InsertNextValue(currentSurfaceEntityId);
211 }
212 delete[] surfacePts;
213 }
214 //Switch to next surface entity
215 currentSurfaceEntityId++;
216 }
217
218 if (this->InnerSurface)
219 {
220 this->InnerSurface->Delete();
221 this->InnerSurface = NULL;
222 }
223
224 this->InnerSurface = vtkUnstructuredGrid::New();
225 this->InnerSurface->DeepCopy(input);
226 vtkPoints* innerSurfacePoints = vtkPoints::New();
227 this->WarpPoints(inputPoints,innerSurfacePoints,this->NumberOfSubLayers-1,warpQuadratic);
228 this->InnerSurface->GetPoints()->DeepCopy(innerSurfacePoints);
229
230 //Get the ids of the open profiles if necessary
231 vtkDataArray *openProfilesIdsArray = NULL;
232 bool allocateArray = false;
233
234
236 {
237 //Find or build the ids of the open profiles
238 //TODO: Check that the open profiles ids are consistent
239 if (this->OpenProfilesIdsArrayName)
240 {
241 openProfilesIdsArray = input->GetPointData()->GetArray(this->OpenProfilesIdsArrayName);
242 }
243
244 allocateArray = (openProfilesIdsArray == NULL);
245 if (allocateArray)
246 {
247 //The open profiles ids have to be created
248 openProfilesIdsArray = vtkIntArray::New();
249 openProfilesIdsArray->SetName("OpenProfilesIds");
250 openProfilesIdsArray->SetNumberOfComponents(1);
251 openProfilesIdsArray->SetNumberOfTuples(numberOfInputPoints);
252 openProfilesIdsArray->FillComponent(0, -1);
253
254 //First convert the unstructured grid to poly data
255 vtkGeometryFilter *meshToSurface = vtkGeometryFilter::New();
256 meshToSurface->SetInputData(input);
257 meshToSurface->MergingOff();
258 meshToSurface->Update();
259
260 //Extract the open profiles
261 vtkvmtkPolyDataBoundaryExtractor *openProfilesExtractor = vtkvmtkPolyDataBoundaryExtractor::New();
262 openProfilesExtractor->SetInputData(meshToSurface->GetOutput());
263 openProfilesExtractor->Update();
264
265 //Update the openProfilesIdsArray
266 vtkCellArray *openProfiles = openProfilesExtractor->GetOutput()->GetLines();
267 vtkDataArray *openProfilesScalars = openProfilesExtractor->GetOutput()->GetPointData()->GetScalars();
268
269 vtkIdType npts = 0;
270 const vtkIdType *pts = NULL;
271 int profileId;
272 for (profileId=0, openProfiles->InitTraversal(); openProfiles->GetNextCell(npts,pts); profileId++)
273 {
274 for (int i=0;i<npts;i++)
275 {
276 openProfilesIdsArray->SetComponent(openProfilesScalars->GetComponent(pts[i],0),0,profileId);
277 }
278 }
279
280 openProfilesExtractor->Delete();
281 meshToSurface->Delete();
282 }
283
284 }
285
286
287 //Add the volumetric elements and the open profiles extensions if necessary
288 int k;
289 for (k=0; k<this->NumberOfSubLayers; k++)
290 {
291 warpedPoints->Initialize();
292 this->WarpPoints(inputPoints,warpedPoints,k,warpQuadratic);
293
294 for (i=0; i<numberOfLayerPoints; i++)
295 {
296 warpedPoints->GetPoint(i,point);
297 outputPoints->SetPoint(i + numberOfInputPoints + k*numberOfLayerPoints,point);
298 }
299
300 vtkIdType prismNPts, *prismPts;
301 vtkIdType nTetraPts = 0;
302 const vtkIdType *tetraPts = NULL;
303
304 for (i=0; i<numberOfInputCells; i++)
305 {
306 input->GetCellPoints(i,npts,pts);
307 cellType = input->GetCellType(i);
308 if (cellType == VTK_TRIANGLE || cellType == VTK_QUAD)
309 {
310 prismNPts = npts * 2;
311 prismPts = new vtkIdType[prismNPts];
312 int j;
313 for (j=0; j<npts; j++)
314 {
315 prismPts[j] = pts[j] + k*numberOfLayerPoints;
316 }
317 for (j=0; j<npts; j++)
318 {
319 prismPts[j+npts] = pts[j] + (k+1)*numberOfLayerPoints;
320 }
321
322 //Tetrahedralize the cell
323 //Wedge parametric coords
324 double pCoordsWedge[] = {0.0,0.0,0.0, 1.0,0.0,0.0, 0.0,1.0,0.0,
325 0.0,0.0,1.0, 1.0,0.0,1.0, 0.0,1.0,1.0};
326 //Hexahedron parametric coords
327 double pCoordsHex[] = {0.0,0.0,0.0, 1.0,0.0,0.0,
328 1.0,1.0,0.0, 0.0,1.0,0.0,
329 0.0,0.0,1.0, 1.0,0.0,1.0,
330 1.0,1.0,1.0, 0.0,1.0,1.0};
331 double *pCoords = NULL;
332 int prismNEdges = 0;
333 int prismType = 0;
334
335 if (cellType == VTK_TRIANGLE)
336 {
337 prismType = VTK_WEDGE;
338 pCoords = pCoordsWedge;
339 prismNEdges = 9;
340 }
341 else if (cellType == VTK_QUAD)
342 {
343 prismType = VTK_HEXAHEDRON;
344 pCoords = pCoordsHex;
345 prismNEdges = 12;
346 }
347
348 this->Triangulator->InitTriangulation(0.0,1.0, 0.0,1.0, 0.0,1.0, prismNPts);
349
350 double prismPt[3];
351 double *p;
352 for (p=pCoords, j=0; j<prismNPts; j++, p+=3)
353 {
354 outputPoints->GetPoint(prismPts[j], prismPt);
355 this->Triangulator->InsertPoint(prismPts[j], prismPt, p, 0);
356 }
357
358 this->Triangulator->TemplateTriangulate(prismType, prismNPts, prismNEdges);
359
360 //Index of the first tetrahedron that is about to be inserted
361 vtkIdType tetraStartId = boundaryLayerCellArray->GetNumberOfCells();
362 //Insert the new tetras
363 vtkIdType numTets = this->Triangulator->AddTetras(0,boundaryLayerCellArray);
364
365 for (j=0; j<numTets; j++)
366 {
367 boundaryLayerCellTypes->InsertNextId(VTK_TETRA);
368 if (cellEntityIdsArray)
369 {
370 cellEntityIdsArray->InsertNextValue(this->LayerEntityId);
371 }
372 }
373
374
375 //Add the extruded open profiles
376 if (openProfilesIdsArray)
377 {
378 for (j=0;j<npts;j++)
379 {
380 //TODO: what to do if the profileid is not -1 but different between the 2 points?
381 if ((openProfilesIdsArray->GetComponent(pts[j],0) != -1) && (openProfilesIdsArray->GetComponent(pts[(j+1)%npts],0) != -1))
382 {
383 //The points forming the extruded open profile
384 vtkIdList *openProfilePts = vtkIdList::New();
385 openProfilePts->InsertNextId(prismPts[j]);
386 openProfilePts->InsertNextId(prismPts[(j+1)%npts]);
387 openProfilePts->InsertNextId(prismPts[j+npts]);
388 openProfilePts->InsertNextId(prismPts[(j+1)%npts + npts]);
389
390 vtkIdList *tetraPtsList = vtkIdList::New();
391 //Go through the tetrahedra we just added
392 for (int k=0; k<numTets; k++)
393 {
394 boundaryLayerCellArray->GetCellAtId(tetraStartId + k, nTetraPts, tetraPts);
395 tetraPtsList->Initialize();
396 for (int l=0; l<nTetraPts; l++)
397 {
398 tetraPtsList->InsertNextId(tetraPts[l]);
399 }
400 tetraPtsList->IntersectWith(openProfilePts);
401 //If this tetrahedra has a face on the extruded open profile, include it
402 if (tetraPtsList->GetNumberOfIds() == 3)
403 {
404 boundaryLayerCellArray->InsertNextCell(tetraPtsList);
405 boundaryLayerCellTypes->InsertNextId(VTK_TRIANGLE);
406 if (cellEntityIdsArray)
407 {
408 cellEntityIdsArray->InsertNextValue(this->OpenProfilesEntityId + openProfilesIdsArray->GetComponent(pts[j],0));
409 }
410 }
411 }
412 tetraPtsList->Delete();
413 openProfilePts->Delete();
414 }
415 }
416 }
417
418 delete[] prismPts;
419 }
420 //FIXME: NOT HANDLED
421// else if (cellType == VTK_QUADRATIC_TRIANGLE)
422// {
423// prismNPts = npts * 3 - 3;
424// // prismNPts = npts * 3;
425// prismPts = new vtkIdType[prismNPts];
426//
427// boundaryLayerCellTypes->InsertNextId(VTK_QUADRATIC_WEDGE);
428//
429// prismPts[0] = pts[0] + k*numberOfLayerPoints;
430// prismPts[1] = pts[1] + k*numberOfLayerPoints;
431// prismPts[2] = pts[2] + k*numberOfLayerPoints;
432//
433// prismPts[3] = pts[0] + k*numberOfLayerPoints + numberOfLayerPoints;
434// prismPts[4] = pts[1] + k*numberOfLayerPoints + numberOfLayerPoints;
435// prismPts[5] = pts[2] + k*numberOfLayerPoints + numberOfLayerPoints;
436//
437// prismPts[6] = pts[3] + k*numberOfLayerPoints;
438// prismPts[7] = pts[4] + k*numberOfLayerPoints;
439// prismPts[8] = pts[5] + k*numberOfLayerPoints;
440//
441// prismPts[9] = pts[3] + k*numberOfLayerPoints + numberOfLayerPoints;
442// prismPts[10] = pts[4] + k*numberOfLayerPoints + numberOfLayerPoints;
443// prismPts[11] = pts[5] + k*numberOfLayerPoints + numberOfLayerPoints;
444//
445// prismPts[12] = pts[0] + k*numberOfLayerPoints + numberOfLayerPoints/2;
446// prismPts[13] = pts[1] + k*numberOfLayerPoints + numberOfLayerPoints/2;
447// prismPts[14] = pts[2] + k*numberOfLayerPoints + numberOfLayerPoints/2;
448//
449// // TODO: this creates a 18-noded wedge, which is not supported by VTK, but it works as a 15-node (the last 3 points are ignored). Better solutions? Could put it in as a vtkGenericCell, but harder to identify it afterwards
450// // prismPts[15] = pts[3] + k*numberOfLayerPoints + numberOfLayerPoints/2;
451// // prismPts[16] = pts[4] + k*numberOfLayerPoints + numberOfLayerPoints/2;
452// // prismPts[17] = pts[5] + k*numberOfLayerPoints + numberOfLayerPoints/2;
453//
454// boundaryLayerCellArray->InsertNextCell(prismNPts,prismPts);
455// if (cellEntityIdsArray) cellEntityIdsArray->InsertNextValue(this->LayerEntityId);
456// delete[] prismPts;
457// }
458 else
459 {
460 vtkErrorMacro(<<"Unsupported surface element.");
461 return 1;
462 }
463 }
464 }
465
466 if (allocateArray)
467 {
468 openProfilesIdsArray->Delete();
469 }
470
471
473 {
474 for (i=0; i<numberOfInputCells; i++)
475 {
476 input->GetCellPoints(i,npts,pts);
477 cellType = input->GetCellType(i);
478 surfacePts = new vtkIdType[npts];
479 switch(cellType)
480 {
481 case VTK_TRIANGLE:
482 boundaryLayerCellTypes->InsertNextId(VTK_TRIANGLE);
483 surfacePts[0] = pts[0] + this->NumberOfSubLayers*numberOfLayerPoints;
484 surfacePts[1] = pts[1] + this->NumberOfSubLayers*numberOfLayerPoints;
485 surfacePts[2] = pts[2] + this->NumberOfSubLayers*numberOfLayerPoints;
486 break;
487 case VTK_QUAD:
488 boundaryLayerCellTypes->InsertNextId(VTK_QUAD);
489 surfacePts[0] = pts[0] + this->NumberOfSubLayers*numberOfLayerPoints;
490 surfacePts[1] = pts[1] + this->NumberOfSubLayers*numberOfLayerPoints;
491 surfacePts[2] = pts[2] + this->NumberOfSubLayers*numberOfLayerPoints;
492 surfacePts[3] = pts[3] + this->NumberOfSubLayers*numberOfLayerPoints;
493 break;
494 case VTK_QUADRATIC_TRIANGLE:
495 boundaryLayerCellTypes->InsertNextId(VTK_QUADRATIC_TRIANGLE);
496 surfacePts[0] = pts[0] + this->NumberOfSubLayers*numberOfLayerPoints;
497 surfacePts[1] = pts[1] + this->NumberOfSubLayers*numberOfLayerPoints;
498 surfacePts[2] = pts[2] + this->NumberOfSubLayers*numberOfLayerPoints;
499 surfacePts[3] = pts[3] + this->NumberOfSubLayers*numberOfLayerPoints;
500 surfacePts[4] = pts[4] + this->NumberOfSubLayers*numberOfLayerPoints;
501 surfacePts[5] = pts[5] + this->NumberOfSubLayers*numberOfLayerPoints;
502 break;
503 default:
504 vtkErrorMacro(<<"Unsupported surface element.");
505 return 1;
506 break;
507 }
508 boundaryLayerCellArray->InsertNextCell(npts,surfacePts);
509 if (cellEntityIdsArray) cellEntityIdsArray->InsertNextValue(currentSurfaceEntityId);
510 delete[] surfacePts;
511 }
512 }
513
514 output->SetPoints(outputPoints);
515
516 int* boundaryLayerCellTypesInt = new int[boundaryLayerCellTypes->GetNumberOfIds()];
517 for (i=0; i<boundaryLayerCellTypes->GetNumberOfIds(); i++)
518 {
519 boundaryLayerCellTypesInt[i] = boundaryLayerCellTypes->GetId(i);
520 }
521
522 output->SetCells(boundaryLayerCellTypesInt,boundaryLayerCellArray);
523
524 delete[] boundaryLayerCellTypesInt;
525
526 if (cellEntityIdsArray)
527 {
528 output->GetCellData()->AddArray(cellEntityIdsArray);
529 cellEntityIdsArray->Delete();
530 }
531
532 outputPoints->Delete();
533 warpedPoints->Delete();
534 boundaryLayerCellArray->Delete();
535 boundaryLayerCellTypes->Delete();
536 innerSurfacePoints->Delete();
537
538 return 1;
539}
void WarpPoints(vtkPoints *inputPoints, vtkPoints *warpedPoints, int subLayerId, bool quadratic)
static vtkvmtkPolyDataBoundaryExtractor * New()

Member Data Documentation

◆ OpenProfilesIdsArrayName

char* vtkvmtkBoundaryLayerGenerator2::OpenProfilesIdsArrayName
protected

Definition at line 128 of file vtkvmtkBoundaryLayerGenerator2.h.

◆ IncludeExtrudedOpenProfilesCells

int vtkvmtkBoundaryLayerGenerator2::IncludeExtrudedOpenProfilesCells
protected

Definition at line 130 of file vtkvmtkBoundaryLayerGenerator2.h.

◆ IncludeExtrudedSurfaceCells

int vtkvmtkBoundaryLayerGenerator2::IncludeExtrudedSurfaceCells
protected

Definition at line 131 of file vtkvmtkBoundaryLayerGenerator2.h.

◆ IncludeOriginalSurfaceCells

int vtkvmtkBoundaryLayerGenerator2::IncludeOriginalSurfaceCells
protected

Definition at line 132 of file vtkvmtkBoundaryLayerGenerator2.h.

◆ LayerEntityId

int vtkvmtkBoundaryLayerGenerator2::LayerEntityId
protected

Definition at line 134 of file vtkvmtkBoundaryLayerGenerator2.h.

◆ SurfaceEntityId

int vtkvmtkBoundaryLayerGenerator2::SurfaceEntityId
protected

Definition at line 135 of file vtkvmtkBoundaryLayerGenerator2.h.

◆ OpenProfilesEntityId

int vtkvmtkBoundaryLayerGenerator2::OpenProfilesEntityId
protected

Definition at line 136 of file vtkvmtkBoundaryLayerGenerator2.h.

◆ Triangulator

vtkOrderedTriangulator* vtkvmtkBoundaryLayerGenerator2::Triangulator
protected

Definition at line 139 of file vtkvmtkBoundaryLayerGenerator2.h.


The documentation for this class was generated from the following files: