27 #include "vtkPV4blockMeshReader.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"
48 vtkMultiBlockDataSet* output,
52 vtkDataArraySelection* selection =
reader_->GetBlockSelection();
57 const blockMesh& blkMesh = *
meshPtr_;
62 Info<<
"<beg> Foam::vtkPV4blockMesh::convertMeshBlocks" <<
endl;
66 const scalar scaleFactor = blkMesh.scaleFactor();
70 int partId =
range.start();
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::vtkPV4blockMesh::convertMeshBlocks" <<
endl;
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)
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::vtkPV4blockMesh::convertMeshEdges" <<
endl;
251 vtkMultiBlockDataSet* output,
255 arrayRange&
range = arrayRangeCorners_;
256 range.block(blockNo);
259 const pointField& blockPoints = meshPtr_->blockPointField();
260 const scalar& scaleFactor = meshPtr_->scaleFactor();
264 Info<<
"<beg> Foam::vtkPV4blockMesh::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::vtkPV4blockMesh::convertMeshCorners" <<
endl;