29 #ifndef vtkPVFoamVolFields_H
30 #define vtkPVFoamVolFields_H
33 #include "vtkPVFoamReader.h"
47 #include "vtkFloatArray.h"
48 #include "vtkUnstructuredGrid.h"
53 void Foam::vtkPVFoam::convertVolFields
55 const PtrList<PrimitivePatchInterpolation<primitivePatch>>& ppInterpList,
57 const bool interpFields,
58 vtkMultiBlockDataSet* output
61 const polyBoundaryMesh&
patches =
62 procMeshesPtr_->completeMesh().poly().boundary();
73 tmp<VolField<Type>> ttf;
79 if (reader_->GetDecomposedCase())
81 if (!fvReconstructorPtr_.valid())
83 fvReconstructorPtr_.set
85 new fvFieldReconstructor
87 procMeshesPtr_->completeMesh(),
88 procMeshesPtr_->procMeshes(),
89 procMeshesPtr_->procFaceAddressing(),
90 procMeshesPtr_->procCellAddressing(),
91 procMeshesPtr_->procFaceAddressingBf()
98 ->reconstructVolField<Type>(*iter());
102 ttf =
new VolField<Type>
105 procMeshesPtr_->completeMesh()
117 const VolField<Type>&
tf = ttf();
120 autoPtr<PointField<Type>> ptfPtr;
124 <<
"Interpolating field " <<
tf.name() <<
endl;
148 arrayRangeCellZones_,
166 int partId = arrayRangePatches_.start();
167 partId < arrayRangePatches_.end();
171 const word patchName = getPartName(partId);
172 const label datasetNo = partDataset_[partId];
175 if (!partStatus_[partId] || datasetNo < 0 ||
patchId < 0)
continue;
177 const fvPatchField<Type>& ptf =
tf.boundaryField()[
patchId];
181 isType<emptyFvPatchField<Type>>(ptf)
184 reader_->GetExtrapolatePatches()
189 fvPatch
p(ptf.patch().poly(),
tf.mesh().boundary());
191 tmp<Field<Type>> tpptf
193 fvPatchField<Type>(
p,
tf).patchInternalField()
207 convertPatchPointField
210 ppInterpList[
patchId].faceToPointInterpolate(tpptf)(),
230 convertPatchPointField
233 ppInterpList[
patchId].faceToPointInterpolate(ptf)(),
245 int partId = arrayRangeFaceZones_.start();
246 partId < arrayRangeFaceZones_.end();
250 const word zoneName = getPartName(partId);
251 const label datasetNo = partDataset_[partId];
253 if (!partStatus_[partId] || datasetNo < 0)
continue;
255 const faceZoneList& zMesh =
tf.mesh().faceZones();
256 const label zoneId = zMesh.findIndex(zoneName);
258 if (zoneId < 0)
continue;
264 arrayRangeFaceZones_,
274 int partId = arrayRangeFaceSets_.start();
275 partId < arrayRangeFaceSets_.end();
279 const word selectName = getPartName(partId);
280 const label datasetNo = partDataset_[partId];
282 if (!partStatus_[partId] || datasetNo < 0)
continue;
284 const autoPtr<faceSet> fSetPtr =
285 reader_->GetDecomposedCase()
286 ? procMeshesPtr_->reconstructSet<faceSet>(selectName)
287 : autoPtr<faceSet>(
new faceSet(
tf.mesh(), selectName));
304 void Foam::vtkPVFoam::convertVolInternalFields
307 vtkMultiBlockDataSet* output
319 tmp<VolInternalField<Type>> ttf;
325 if (reader_->GetDecomposedCase())
327 if (!fvReconstructorPtr_.valid())
329 fvReconstructorPtr_.set
331 new fvFieldReconstructor
333 procMeshesPtr_->completeMesh(),
334 procMeshesPtr_->procMeshes(),
335 procMeshesPtr_->procFaceAddressing(),
336 procMeshesPtr_->procCellAddressing(),
337 procMeshesPtr_->procFaceAddressingBf()
344 ->reconstructVolInternalField<Type>(*iter());
349 new VolInternalField<Type>
352 procMeshesPtr_->completeMesh()
364 const VolInternalField<Type>&
tf = ttf();
367 convertVolInternalFieldBlock<Type>
376 convertVolInternalFieldBlock<Type>
380 arrayRangeCellZones_,
385 convertVolInternalFieldBlock<Type>
397 void Foam::vtkPVFoam::convertVolFieldBlock
399 const VolField<Type>&
tf,
400 autoPtr<PointField<Type>>& ptfPtr,
401 vtkMultiBlockDataSet* output,
402 const arrayRange&
range,
406 for (
int partId =
range.start(); partId <
range.end(); ++partId)
408 const label datasetNo = partDataset_[partId];
410 if (datasetNo >= 0 && partStatus_[partId])
412 convertVolInternalField<Type>
439 void Foam::vtkPVFoam::convertVolInternalFieldBlock
442 vtkMultiBlockDataSet* output,
443 const arrayRange&
range,
447 for (
int partId =
range.start(); partId <
range.end(); ++partId)
449 const label datasetNo = partDataset_[partId];
451 if (datasetNo >= 0 && partStatus_[partId])
453 convertVolInternalField<Type>
467 void Foam::vtkPVFoam::convertVolInternalField
470 vtkMultiBlockDataSet* output,
471 const arrayRange&
range,
472 const label datasetNo,
473 const polyDecomp& decompInfo
477 const labelList& superCells = decompInfo.superCells();
480 celldata->SetNumberOfTuples(superCells.
size());
481 celldata->SetNumberOfComponents(nComp);
482 celldata->Allocate(nComp*superCells.
size());
483 celldata->SetName(
tf.name().c_str());
486 <<
"Converting Vol field: " <<
tf.name()
487 <<
" size=" <<
tf.
size() <<
" (" << superCells.
size()
488 <<
"), nComp=" << nComp <<
endl;
493 const Type& t =
tf[superCells[i]];
498 vtkOpenFOAMTupleRemap<Type>(vec);
500 celldata->InsertTuple(i, vec);
503 vtkUnstructuredGrid::SafeDownCast
505 GetDataSetFromBlock(output,
range, datasetNo)
507 ->AddArray(celldata);
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
static volPointInterpolation & New(const word &name, const fvMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
void size(const label)
Override size to be inconsistent with allocated storage.
void dontThrowExceptions()
Traits class for primitives.
Motion of the mesh specified as a list of pointMeshMovers.
tmp< PointField< Type > > interpolate(const VolField< Type > &) const
Interpolate volField using inverse distance weighting.
const fvPatchList & patches
#define DebugInFunction
Report an information message using Foam::Info.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
bool isType(const Type &t)
Check the typeid.
void component(GeometricField< typename GeometricField< Type, GeoMesh, PrimitiveField1 >::cmptType, GeoMesh, PrimitiveField1 > &gcf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf, const direction d)
typename VolField< Type >::Internal VolInternalField
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)