27 #include "vtkPVblockMeshReader.h" 33 #include "vtkOpenFOAMPoints.H" 36 #include "vtkCellArray.h" 37 #include "vtkDataArraySelection.h" 38 #include "vtkMultiBlockDataSet.h" 39 #include "vtkPoints.h" 40 #include "vtkPolyData.h" 41 #include "vtkUnstructuredGrid.h" 46 void Foam::vtkPVblockMesh::convertMeshBlocks
48 vtkMultiBlockDataSet* output,
52 vtkDataArraySelection* selection = reader_->GetBlockSelection();
53 arrayRange& range = arrayRangeBlocks_;
57 const blockMesh& blkMesh = *meshPtr_;
62 Info<<
"<beg> Foam::vtkPVblockMesh::convertMeshBlocks" <<
endl;
66 const scalar scaleFactor = blkMesh.scaleFactor();
70 int partId = range.start();
75 if (!blockStatus_[partId])
80 const blockDescriptor& blockDef = blkMesh[blockI];
86 vtkpoints->Allocate( blockDef.nPoints() );
87 const labelList& blockLabels = blockDef.blockShape();
97 blockPoints[blockLabels[ptI]],
104 vtkmesh->InsertNextCell
111 vtkmesh->SetPoints(vtkpoints);
116 output, vtkmesh, range, datasetNo,
117 selection->GetArrayName(partId)
133 Info<<
"<end> Foam::vtkPVblockMesh::convertMeshBlocks" <<
endl;
138 void Foam::vtkPVblockMesh::convertMeshEdges
140 vtkMultiBlockDataSet* output,
144 vtkDataArraySelection* selection = reader_->GetCurvedEdgesSelection();
145 arrayRange& range = arrayRangeEdges_;
147 range.block(blockNo);
150 const blockMesh& blkMesh = *meshPtr_;
154 const scalar scaleFactor = blkMesh.scaleFactor();
158 int partId = range.start();
159 partId < range.end();
163 if (!edgeStatus_[partId])
171 const blockDescriptor& blockDef = blkMesh[blockI];
173 edgeList blkEdges = blockDef.blockShape().edges();
178 blockDef.edgesPointsWeights(edgesPoints, edgesWeights);
181 label foundEdgeI = -1;
182 forAll(blkEdges, blkEdgeI)
184 if (edges[edgeI].compare(blkEdges[blkEdgeI]))
186 foundEdgeI = blkEdgeI;
191 if (foundEdgeI != -1)
193 const List<point>& edgePoints = edgesPoints[foundEdgeI];
198 vtkpoints->Allocate( edgePoints.size() );
199 vtkmesh->Allocate(1);
201 vtkIdType pointIds[edgePoints.size()];
213 vtkmesh->InsertNextCell
220 vtkmesh->SetPoints(vtkpoints);
225 output, vtkmesh, range, datasetNo,
226 selection->GetArrayName(partId)
246 Info<<
"<end> Foam::vtkPVblockMesh::convertMeshEdges" <<
endl;
252 void Foam::vtkPVblockMesh::convertMeshCorners
254 vtkMultiBlockDataSet* output,
258 arrayRange& range = arrayRangeCorners_;
259 range.block(blockNo);
263 const scalar& scaleFactor = meshPtr_->
scaleFactor();
267 Info<<
"<beg> Foam::vtkPVblockMesh::convertMeshCorners" <<
endl;
276 vtkpoints->Allocate( blockPoints.size() );
277 vtkcells->Allocate( blockPoints.size() );
279 vtkIdType pointId = 0;
289 vtkcells->InsertNextCell(1, &pointId);
293 vtkmesh->SetPoints(vtkpoints);
296 vtkmesh->SetVerts(vtkcells);
301 output, vtkmesh, range, datasetNo,
302 arrayRangeCorners_.name()
317 Info<<
"<end> Foam::vtkPVblockMesh::convertMeshCorners" <<
endl;
#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.
void vtkInsertNextOpenFOAMPoint(vtkPoints *points, const Foam::point &p)
Ostream & endl(Ostream &os)
Add newline and flush stream.
scalar scaleFactor() const
The scaling factor used to convert to meters.
const pointField & vertices() const
Reference to point field defining the blockMesh.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
vectorField pointField
pointField is a vectorField.
List< scalar > scalarList
A List of scalars.
List< label > labelList
A List of labels.
PtrList< blockEdge > blockEdgeList
A PtrList of blockEdges.