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].blockDef();
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].blockDef();
173 edgeList blkEdges = blockDef.blockShape().edges();
176 label foundEdgeI = -1;
177 forAll(blkEdges, blkEdgeI)
179 if (edges[edgeI].compare(blkEdges[blkEdgeI]))
181 foundEdgeI = blkEdgeI;
186 if (foundEdgeI != -1)
188 const List<point>& edgePoints =
189 blockDef.blockEdgePoints()[foundEdgeI];
195 vtkpoints->Allocate( edgePoints.size() );
196 vtkmesh->Allocate(1);
198 vtkIdType pointIds[edgePoints.size()];
210 vtkmesh->InsertNextCell
217 vtkmesh->SetPoints(vtkpoints);
222 output, vtkmesh, range, datasetNo,
223 selection->GetArrayName(partId)
243 Info<<
"<end> Foam::vtkPVblockMesh::convertMeshEdges" <<
endl;
249 void Foam::vtkPVblockMesh::convertMeshCorners
251 vtkMultiBlockDataSet* output,
255 arrayRange& range = arrayRangeCorners_;
256 range.block(blockNo);
260 const scalar& scaleFactor = meshPtr_->
scaleFactor();
264 Info<<
"<beg> Foam::vtkPVblockMesh::convertMeshCorners" <<
endl;
273 vtkpoints->Allocate( blockPoints.size() );
274 vtkcells->Allocate( blockPoints.size() );
276 vtkIdType pointId = 0;
286 vtkcells->InsertNextCell(1, &pointId);
290 vtkmesh->SetPoints(vtkpoints);
293 vtkmesh->SetVerts(vtkcells);
298 output, vtkmesh, range, datasetNo,
299 arrayRangeCorners_.name()
314 Info<<
"<end> Foam::vtkPVblockMesh::convertMeshCorners" <<
endl;
scalar scaleFactor() const
The scaling factor used to convert to metres.
#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.
PtrList< curvedEdge > curvedEdgeList
A PtrList of curvedEdges.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void vtkInsertNextOpenFOAMPoint(vtkPoints *points, const Foam::point &p)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
vectorField pointField
pointField is a vectorField.
const pointField & blockPointField() const
Reference to point field defining the block mesh.
List< label > labelList
A List of labels.