33 #include "vtkPVFoamReader.h" 37 #include "vtkDataArraySelection.h" 38 #include "vtkMultiBlockDataSet.h" 39 #include "vtkPolyData.h" 40 #include "vtkUnstructuredGrid.h" 44 void Foam::vtkPVFoam::convertMeshVolume
46 vtkMultiBlockDataSet* output,
50 arrayRange& range = arrayRangeVolume_;
53 const fvMesh& mesh = *meshPtr_;
56 regionPolyDecomp_.
setSize(range.size());
60 Info<<
"<beg> Foam::vtkPVFoam::convertMeshVolume" <<
endl;
66 for (
int partId = range.start(); partId < range.end(); ++partId)
68 const word partName =
"internalMesh";
70 if (!partStatus_[partId])
75 vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
78 regionPolyDecomp_[datasetNo]
83 AddToBlock(output, vtkmesh, range, datasetNo, partName);
86 partDataset_[partId] = datasetNo++;
98 Info<<
"<end> Foam::vtkPVFoam::convertMeshVolume" <<
endl;
104 void Foam::vtkPVFoam::convertMeshLagrangian
106 vtkMultiBlockDataSet* output,
110 arrayRange& range = arrayRangeLagrangian_;
111 range.block(blockNo);
113 const fvMesh& mesh = *meshPtr_;
117 Info<<
"<beg> Foam::vtkPVFoam::convertMeshLagrangian" <<
endl;
121 for (
int partId = range.start(); partId < range.end(); ++partId)
123 const word cloudName = getPartName(partId);
125 if (!partStatus_[partId])
130 vtkPolyData* vtkmesh = lagrangianVTKMesh(mesh, cloudName);
134 AddToBlock(output, vtkmesh, range, datasetNo, cloudName);
137 partDataset_[partId] = datasetNo++;
149 Info<<
"<end> Foam::vtkPVFoam::convertMeshLagrangian" <<
endl;
155 void Foam::vtkPVFoam::convertMeshPatches
157 vtkMultiBlockDataSet* output,
161 arrayRange& range = arrayRangePatches_;
162 range.block(blockNo);
164 const fvMesh& mesh = *meshPtr_;
169 Info<<
"<beg> Foam::vtkPVFoam::convertMeshPatches" <<
endl;
173 for (
int partId = range.start(); partId < range.end(); ++partId)
175 if (!partStatus_[partId])
180 const word patchName = getPartName(partId);
183 patchIds(patches.patchSet(List<wordRe>(1, wordRe(patchName))));
187 Info<<
"Creating VTK mesh for patches [" << patchIds <<
"] " 188 << patchName <<
endl;
191 vtkPolyData* vtkmesh = NULL;
192 if (patchIds.size() == 1)
194 vtkmesh = patchVTKMesh(patchName, patches[patchIds.begin().key()]);
202 sz += patches[iter.key()].size();
208 const polyPatch& pp = patches[iter.key()];
211 meshFaceLabels[sz++] = pp.start()+i;
214 UIndirectList<face> fcs(mesh.faces(), meshFaceLabels);
217 vtkmesh = patchVTKMesh(patchName, pp);
223 AddToBlock(output, vtkmesh, range, datasetNo, patchName);
226 partDataset_[partId] = datasetNo++;
238 Info<<
"<end> Foam::vtkPVFoam::convertMeshPatches" <<
endl;
244 void Foam::vtkPVFoam::convertMeshCellZones
246 vtkMultiBlockDataSet* output,
250 arrayRange& range = arrayRangeCellZones_;
251 range.block(blockNo);
253 const fvMesh& mesh = *meshPtr_;
256 zonePolyDecomp_.
setSize(range.size());
265 Info<<
"<beg> Foam::vtkPVFoam::convertMeshCellZones" <<
endl;
270 for (
int partId = range.start(); partId < range.end(); ++partId)
272 const word zoneName = getPartName(partId);
273 const label zoneId = zMesh.findZoneID(zoneName);
275 if (!partStatus_[partId] || zoneId < 0)
282 Info<<
"Creating VTK mesh for cellZone[" << zoneId <<
"] " 286 fvMeshSubset subsetter(mesh);
287 subsetter.setLargeCellSubset(zMesh[zoneId]);
289 vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
292 zonePolyDecomp_[datasetNo]
301 zonePolyDecomp_[datasetNo].superCells()
306 zonePolyDecomp_[datasetNo].addPointCellLabels()
310 zonePolyDecomp_[datasetNo].pointMap() = subsetter.pointMap();
312 AddToBlock(output, vtkmesh, range, datasetNo, zoneName);
315 partDataset_[partId] = datasetNo++;
327 Info<<
"<end> Foam::vtkPVFoam::convertMeshCellZones" <<
endl;
333 void Foam::vtkPVFoam::convertMeshCellSets
335 vtkMultiBlockDataSet* output,
339 arrayRange& range = arrayRangeCellSets_;
340 range.block(blockNo);
342 const fvMesh& mesh = *meshPtr_;
345 csetPolyDecomp_.
setSize(range.size());
349 Info<<
"<beg> Foam::vtkPVFoam::convertMeshCellSets" <<
endl;
353 for (
int partId = range.start(); partId < range.end(); ++partId)
355 const word partName = getPartName(partId);
357 if (!partStatus_[partId])
364 Info<<
"Creating VTK mesh for cellSet=" << partName <<
endl;
367 const cellSet cSet(mesh, partName);
368 fvMeshSubset subsetter(mesh);
369 subsetter.setLargeCellSubset(cSet);
371 vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
374 csetPolyDecomp_[datasetNo]
383 csetPolyDecomp_[datasetNo].superCells()
388 csetPolyDecomp_[datasetNo].addPointCellLabels()
392 csetPolyDecomp_[datasetNo].pointMap() = subsetter.pointMap();
394 AddToBlock(output, vtkmesh, range, datasetNo, partName);
397 partDataset_[partId] = datasetNo++;
409 Info<<
"<end> Foam::vtkPVFoam::convertMeshCellSets" <<
endl;
415 void Foam::vtkPVFoam::convertMeshFaceZones
417 vtkMultiBlockDataSet* output,
421 arrayRange& range = arrayRangeFaceZones_;
422 range.block(blockNo);
424 const fvMesh& mesh = *meshPtr_;
433 Info<<
"<beg> Foam::vtkPVFoam::convertMeshFaceZones" <<
endl;
438 for (
int partId = range.start(); partId < range.end(); ++partId)
440 const word zoneName = getPartName(partId);
441 const label zoneId = zMesh.findZoneID(zoneName);
443 if (!partStatus_[partId] || zoneId < 0)
450 Info<<
"Creating VTKmesh for faceZone[" << zoneId <<
"] " 454 vtkPolyData* vtkmesh = patchVTKMesh(zoneName, zMesh[zoneId]());
458 AddToBlock(output, vtkmesh, range, datasetNo, zoneName);
461 partDataset_[partId] = datasetNo++;
473 Info<<
"<end> Foam::vtkPVFoam::convertMeshFaceZones" <<
endl;
479 void Foam::vtkPVFoam::convertMeshFaceSets
481 vtkMultiBlockDataSet* output,
485 arrayRange& range = arrayRangeFaceSets_;
486 range.block(blockNo);
488 const fvMesh& mesh = *meshPtr_;
492 Info<<
"<beg> Foam::vtkPVFoam::convertMeshFaceSets" <<
endl;
496 for (
int partId = range.start(); partId < range.end(); ++partId)
498 const word partName = getPartName(partId);
500 if (!partStatus_[partId])
507 Info<<
"Creating VTK mesh for faceSet=" << partName <<
endl;
510 const faceSet fSet(mesh, partName);
512 vtkPolyData* vtkmesh = faceSetVTKMesh(mesh, fSet);
515 AddToBlock(output, vtkmesh, range, datasetNo, partName);
518 partDataset_[partId] = datasetNo++;
530 Info<<
"<end> Foam::vtkPVFoam::convertMeshFaceSets" <<
endl;
536 void Foam::vtkPVFoam::convertMeshPointZones
538 vtkMultiBlockDataSet* output,
542 arrayRange& range = arrayRangePointZones_;
543 range.block(blockNo);
545 const fvMesh& mesh = *meshPtr_;
549 Info<<
"<beg> Foam::vtkPVFoam::convertMeshPointZones" <<
endl;
556 for (
int partId = range.start(); partId < range.end(); ++partId)
558 word zoneName = getPartName(partId);
559 label zoneId = zMesh.findZoneID(zoneName);
561 if (!partStatus_[partId] || zoneId < 0)
566 vtkPolyData* vtkmesh = pointZoneVTKMesh(mesh, zMesh[zoneId]);
569 AddToBlock(output, vtkmesh, range, datasetNo, zoneName);
572 partDataset_[partId] = datasetNo++;
585 Info<<
"<end> Foam::vtkPVFoam::convertMeshPointZones" <<
endl;
592 void Foam::vtkPVFoam::convertMeshPointSets
594 vtkMultiBlockDataSet* output,
598 arrayRange& range = arrayRangePointSets_;
599 range.block(blockNo);
601 const fvMesh& mesh = *meshPtr_;
605 Info<<
"<beg> Foam::vtkPVFoam::convertMeshPointSets" <<
endl;
609 for (
int partId = range.start(); partId < range.end(); ++partId)
611 word partName = getPartName(partId);
613 if (!partStatus_[partId])
620 Info<<
"Creating VTK mesh for pointSet=" << partName <<
endl;
623 const pointSet pSet(mesh, partName);
625 vtkPolyData* vtkmesh = pointSetVTKMesh(mesh, pSet);
628 AddToBlock(output, vtkmesh, range, datasetNo, partName);
631 partDataset_[partId] = datasetNo++;
643 Info<<
"<end> Foam::vtkPVFoam::convertMeshPointSets" <<
endl;
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with the type faceZone.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static void printMemory()
Simple memory used debugging information.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
List< label > labelList
A List of labels.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with the type pointZone.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
void setSize(const label)
Reset size of List.
PrimitivePatch< face, UIndirectList, const pointField & > uindirectPrimitivePatch
Foam::uindirectPrimitivePatch.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with the type cellZone.