27 #include "vtkPVFoamReader.h"
44 const fileName& instance,
51 return IOobjectList(0);
59 forAllIter(IOobjectList, objectsConstant, iter)
65 *objectsConstant.HashPtrTable<IOobject>::remove(iter)
73 if (!selected.found(iter()->
name()))
83 void Foam::vtkPVFoam::convertFields(vtkMultiBlockDataSet* output)
85 if (reader_->GetDecomposedCase() && !procDbsPtr_->nProcs())
return;
88 getSelected(reader_->GetFieldSelection());
90 if (selectedFields.empty())
return;
99 reader_->GetDecomposedCase()
100 ? procMeshesPtr_->procMeshes().first()
101 : procMeshesPtr_->completeMesh(),
102 reader_->GetDecomposedCase()
103 ? procDbsPtr_->proc0Time().name()
104 : procDbsPtr_->completeTime().name()
111 <<
"Converting OpenFOAM volume fields" <<
endl;
115 <<
" " << iter()->name()
116 <<
" == " << iter()->objectPath(
false) <<
endl;
119 PtrList<PrimitivePatchInterpolation<primitivePatch>>
120 ppInterpList(procMeshesPtr_->completeMesh().boundaryMesh().size());
126 new PrimitivePatchInterpolation<primitivePatch>
128 procMeshesPtr_->completeMesh().boundaryMesh()[i]
133 bool interpFields = reader_->GetInterpolateVolFields();
135 #define CONVERT_VOL_FIELDS(Type, nullArg) \
136 convertVolFields<Type> \
144 #undef CONVERT_VOL_FIELDS
146 #define CONVERT_VOL_INTERNAL_FIELDS(Type, nullArg) \
147 convertVolInternalFields<Type>(objects, output);
149 #undef CONVERT_VOL_INTERNAL_FIELDS
151 #define CONVERT_SURFACE_FIELDS(Type, nullArg) \
152 convertSurfaceFields<Type>(objects, output);
154 #undef CONVERT_SURFACE_FIELDS
156 #define CONVERT_POINT_FIELDS(Type, nullArg) \
157 convertPointFields<Type>(objects, output);
159 #undef CONVERT_POINT_FIELDS
163 void Foam::vtkPVFoam::convertlagrangianFields(vtkMultiBlockDataSet* output)
165 const fileName lagrangianPrefix =
168 : meshRegion_/lagrangian::cloud::prefix;
170 arrayRange&
range = arrayRangelagrangian_;
174 reader_->GetlagrangianFieldSelection()
177 if (selectedFields.empty())
return;
179 for (
int partId =
range.start(); partId <
range.end(); ++partId)
181 const word lagrangianName = getPartName(partId);
182 const label datasetNo = partDataset_[partId];
184 if (!partStatus_[partId] || datasetNo < 0)
continue;
188 if (reader_->GetDecomposedCase())
190 forAll(procDbsPtr_->procTimes(), procj)
198 procDbsPtr_->procTimes()[procj].path()
199 /procDbsPtr_().completeTime().
name()
212 if (reader_->GetDecomposedCase() && proci == -1)
continue;
222 reader_->GetDecomposedCase()
223 ? procMeshesPtr_->procMeshes()[proci]
224 : procMeshesPtr_->completeMesh(),
225 procDbsPtr_().completeTime().
name(),
233 <<
"Converting OpenFOAM lagrangian fields" <<
endl;
237 <<
" " << iter()->name()
238 <<
" == " << iter()->objectPath(
false) <<
endl;
241 #define CONVERT_LAGRANGIAN_FIELDS(Type, nullArg) \
242 convertlagrangianFields<Type>(objects, output, datasetNo);
243 CONVERT_LAGRANGIAN_FIELDS(
label, );
245 #undef CONVERT_LAGRANGIAN_FIELDS
250 void Foam::vtkPVFoam::convertLagrangianFields(vtkMultiBlockDataSet* output)
252 arrayRange&
range = arrayRangeLagrangian_;
256 reader_->GetLagrangianFieldSelection()
259 if (selectedFields.empty())
return;
261 for (
int partId =
range.start(); partId <
range.end(); ++partId)
263 const word LagrangianName = getPartName(partId);
264 const label datasetNo = partDataset_[partId];
266 if (!partStatus_[partId] || datasetNo < 0)
continue;
276 reader_->GetDecomposedCase()
277 ? procMeshesPtr_->procMeshes().first()
278 : procMeshesPtr_->completeMesh(),
279 procDbsPtr_().completeTime().
name(),
287 <<
"Converting OpenFOAM Lagrangian fields" <<
endl;
291 <<
" " << iter()->name()
292 <<
" == " << iter()->objectPath(
false) <<
endl;
295 #define CONVERT_LAGRANGIAN_FIELDS(Type, GeoField) \
296 convertLagrangianFields<Type, GeoField>(objects, output, datasetNo);
301 #undef CONVERT_LAGRANGIAN_FIELDS
#define forAll(list, i)
Loop across all elements in list.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
List of IOobjects with searching and retrieving facilities.
static const word prefix
Instance prefix.
static const word & constant()
Return constant name.
static const word prefix
The prefix to local: lagrangian.
static word defaultRegion
Return the default region name.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define DebugInfo
Report an information message using Foam::Info.
#define DebugInFunction
Report an information message using Foam::Info.
const fileOperation & fileHandler()
Get current file handler.
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.
DimensionedField< Type, LagrangianMesh > LagrangianInternalField
bool isDir(const fileName &, const bool followLink=true)
Does the name exist as a directory in the file system?
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
HashSet wordHashSet
A HashSet with word keys.
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
GeometricField< Type, LagrangianMesh > LagrangianField