29 #ifndef vtkPVFoamSurfaceField_H
30 #define vtkPVFoamSurfaceField_H
33 #include "vtkPVFoamReader.h"
44 #include "vtkCellData.h"
45 #include "vtkFloatArray.h"
46 #include "vtkMultiBlockDataSet.h"
47 #include "vtkPolyData.h"
52 void Foam::vtkPVFoam::convertSurfaceField
54 const VolField<Type>&
tf,
55 vtkMultiBlockDataSet* output,
56 const arrayRange&
range,
57 const label datasetNo,
62 const label nComp = pTraits<Type>::nComponents;
68 cellData->SetNumberOfTuples(faceLabels.size());
69 cellData->SetNumberOfComponents(nComp);
70 cellData->Allocate(nComp*faceLabels.size());
71 cellData->SetName(
tf.name().c_str());
74 <<
"Converting Surface field: " <<
tf.name()
75 <<
" size=" <<
tf.size() <<
" (" << faceLabels.size()
76 <<
"), nComp=" << nComp <<
endl;
84 const label facei = faceLabels[i];
85 if (facei < nInternalFaces)
87 const Type t = 0.5*(
tf[faceOwner[facei]] +
tf[faceNeigh[facei]]);
98 const Type& t =
tf.boundaryField()[
patchi][pFacei];
105 vtkOpenFOAMTupleRemap<Type>(vec);
107 cellData->InsertTuple(i, vec);
111 vtkPolyData::SafeDownCast
113 GetDataSetFromBlock(output,
range, datasetNo)
115 ->AddArray(cellData);
122 void Foam::vtkPVFoam::convertSurfaceField
124 const SurfaceField<Type>&
tf,
125 vtkMultiBlockDataSet* output,
126 const arrayRange&
range,
127 const label datasetNo,
132 const label nComp = pTraits<Type>::nComponents;
136 cellData->SetNumberOfTuples(faceLabels.size());
137 cellData->SetNumberOfComponents(nComp);
138 cellData->Allocate(nComp*faceLabels.size());
139 cellData->SetName(
tf.name().c_str());
142 <<
"Converting Surface field: " <<
tf.name()
143 <<
" size=" <<
tf.
size() <<
" (" << faceLabels.size()
144 <<
"), nComp=" << nComp <<
endl;
148 SubField<Type>(flatFld, nInternalFaces) =
tf.internalField();
151 const fvsPatchField<Type>& fvs =
tf.boundaryField()[
patchi];
163 const label facei = faceLabels[i];
170 vtkOpenFOAMTupleRemap<Type>(vec);
172 cellData->InsertTuple(i, vec);
175 vtkPolyData::SafeDownCast
177 GetDataSetFromBlock(output,
range, datasetNo)
179 ->AddArray(cellData);
186 void Foam::vtkPVFoam::convertSurfaceFields
189 vtkMultiBlockDataSet* output
195 if (iter()->headerClassName() != SurfaceField<Type>::typeName)
201 tmp<SurfaceField<Type>> ttf;
207 if (reader_->GetDecomposedCase())
209 if (!fvReconstructorPtr_.valid())
211 fvReconstructorPtr_.set
213 new fvFieldReconstructor
215 procMeshesPtr_->completeMesh(),
216 procMeshesPtr_->procMeshes(),
217 procMeshesPtr_->procFaceAddressing(),
218 procMeshesPtr_->procCellAddressing(),
219 procMeshesPtr_->procFaceAddressingBf()
226 ->reconstructFvSurfaceField<Type>(*iter());
231 new SurfaceField<Type>
234 procMeshesPtr_->completeMesh()
246 const SurfaceField<Type>&
tf = ttf();
251 int partId = arrayRangePatches_.start();
252 partId < arrayRangePatches_.end();
256 const word patchName = getPartName(partId);
257 const label datasetNo = partDataset_[partId];
258 const label patchId =
tf.mesh().boundaryMesh().findIndex(patchName);
260 if (!partStatus_[partId] || datasetNo < 0 ||
patchId < 0)
265 const fvsPatchField<Type>& ptf =
tf.boundaryField()[
patchId];
267 if (!
isType<emptyFvsPatchField<Type>>(ptf))
283 int partId = arrayRangeFaceZones_.start();
284 partId < arrayRangeFaceZones_.end();
288 const word zoneName = getPartName(partId);
289 const label datasetNo = partDataset_[partId];
291 if (!partStatus_[partId] || datasetNo < 0)
296 const faceZoneList& zMesh =
tf.mesh().faceZones();
297 const label zoneId = zMesh.findIndex(zoneName);
308 arrayRangeFaceZones_,
318 int partId = arrayRangeFaceSets_.start();
319 partId < arrayRangeFaceSets_.end();
323 const word selectName = getPartName(partId);
324 const label datasetNo = partDataset_[partId];
326 if (!partStatus_[partId] || datasetNo < 0)
331 const autoPtr<faceSet> fSetPtr =
332 reader_->GetDecomposedCase()
333 ? procMeshesPtr_->reconstructSet<faceSet>(selectName)
334 : autoPtr<faceSet>(
new faceSet(
tf.mesh(), selectName));
#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.
void size(const label)
Override size to be inconsistent with allocated storage.
void dontThrowExceptions()
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
virtual const labelList & faceOwner() const
Return face owner.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
label nInternalFaces() const
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define DebugInFunction
Report an information message using Foam::Info.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool isType(const Type &t)
Check the typeid.
void component(LagrangianPatchField< typename LagrangianPatchField< Type >::cmptType > &sf, const LagrangianPatchField< Type > &f, const direction d)