27 #include "vtkPVblockMeshReader.h"
28 #include "vtkOpenFOAMPoints.H"
35 #include "vtkCellArray.h"
36 #include "vtkDataArraySelection.h"
37 #include "vtkMultiBlockDataSet.h"
38 #include "vtkPoints.h"
39 #include "vtkPolyData.h"
40 #include "vtkUnstructuredGrid.h"
44 void Foam::vtkPVblockMesh::convertMeshBlocks
46 vtkMultiBlockDataSet* output,
52 if (!meshPtr_.valid())
return;
54 vtkDataArraySelection* selection = reader_->GetBlockSelection();
55 arrayRange&
range = arrayRangeBlocks_;
59 const blockMesh& blkMesh = *meshPtr_;
63 const scalar scaleFactor = blkMesh.scaleFactor();
65 for (
int partId =
range.start(); partId <
range.end(); ++partId, ++blockI)
67 if (!blockStatus_[partId])
continue;
69 const blockDescriptor& blockDef = blkMesh[blockI];
75 vtkpoints->Allocate(blockDef.nPoints());
76 const labelList& blockLabels = blockDef.blockShape();
86 blockPoints[blockLabels[ptI]],
93 vtkmesh->InsertNextCell
100 vtkmesh->SetPoints(vtkpoints);
105 output, vtkmesh,
range, datasetNo,
106 selection->GetArrayName(partId)
114 if (datasetNo) ++blockNo;
118 void Foam::vtkPVblockMesh::convertMeshEdges
120 vtkMultiBlockDataSet* output,
126 if (!meshPtr_.valid())
return;
128 vtkDataArraySelection* selection = reader_->GetCurvedEdgesSelection();
129 arrayRange&
range = arrayRangeEdges_;
131 range.block(blockNo);
134 const blockMesh& blkMesh = *meshPtr_;
138 const scalar scaleFactor = blkMesh.scaleFactor();
140 for (
int partId =
range.start(); partId <
range.end(); ++partId, ++edgeI)
142 if (!edgeStatus_[partId])
continue;
147 const blockDescriptor& blockDef = blkMesh[blockI];
149 edgeList blkEdges = blockDef.blockShape().edges();
154 blockDef.edgesPointsWeights(edgesPoints, edgesWeights);
157 label foundEdgeI = -1;
158 forAll(blkEdges, blkEdgeI)
160 if (edges[edgeI].compare(blkEdges[blkEdgeI]))
162 foundEdgeI = blkEdgeI;
167 if (foundEdgeI != -1)
169 const List<point>& edgePoints = edgesPoints[foundEdgeI];
174 vtkpoints->Allocate(edgePoints.size());
175 vtkmesh->Allocate(1);
189 vtkmesh->InsertNextCell
196 vtkmesh->SetPoints(vtkpoints);
201 output, vtkmesh,
range, datasetNo,
202 selection->GetArrayName(partId)
214 if (datasetNo) ++blockNo;
218 void Foam::vtkPVblockMesh::convertMeshCorners
220 vtkMultiBlockDataSet* output,
226 if (!meshPtr_.valid())
return;
228 arrayRange&
range = arrayRangeCorners_;
229 range.block(blockNo);
232 const pointField& blockPoints = meshPtr_->vertices();
233 const scalar& scaleFactor = meshPtr_->scaleFactor();
239 vtkpoints->Allocate(blockPoints.size());
240 vtkcells->Allocate(blockPoints.size());
242 vtkIdType pointId = 0;
252 vtkcells->InsertNextCell(1, &pointId);
256 vtkmesh->SetPoints(vtkpoints);
259 vtkmesh->SetVerts(vtkcells);
264 output, vtkmesh,
range, datasetNo,
265 arrayRangeCorners_.name()
272 if (datasetNo) ++blockNo;
#define forAll(list, i)
Loop across all elements in list.
Motion of the mesh specified as a list of pointMeshMovers.
#define DebugInFunction
Report an information message using Foam::Info.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
vectorField pointField
pointField is a vectorField.
List< scalar > scalarList
A List of scalars.
PtrList< blockEdge > blockEdgeList
A PtrList of blockEdges.
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
void vtkInsertNextOpenFOAMPoint(vtkPoints *points, const Foam::point &p)