ENH: -exclude-fields, -no-fields options for foamToEnsight, foamToVTK

- additional verbosity option for conversions

- ignore old `-finite-area` option and always convert available
  finiteArea mesh/fields unless `-no-finite-area` is specified (#2374)

ENH: simplify point offset handling for ensight output

- extend writing to include compact face/cell lists
This commit is contained in:
Mark Olesen
2022-03-07 15:15:21 +01:00
parent 730ce92b68
commit c4d4becbac
28 changed files with 642 additions and 240 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -26,27 +26,37 @@ forAll(meshes, regioni)
{
const auto& mesh = meshes[regioni];
IOobjectList objects(mesh, timeDirs.last().name());
IOobjectList objects(0);
if (!fieldPatterns.empty())
if (doConvertFields)
{
objects.filterObjects(fieldPatterns);
}
objects = IOobjectList(mesh, timeDirs.last().name());
// Remove "*_0" restart fields
objects.prune_0();
if (fieldSelector && !fieldSelector().empty())
{
objects.filterObjects(fieldSelector());
}
if (!doPointValues)
{
// Prune point fields if disabled
objects.filterClasses
(
[](const word& clsName)
{
return fieldTypes::point.found(clsName);
},
true // prune
);
if (fieldSelector && !fieldSelector().empty())
{
objects.filterObjects(fieldSelector());
}
// Remove "*_0" restart fields
objects.prune_0();
if (!doPointValues)
{
// Prune point fields if disabled
objects.filterClasses
(
[](const word& clsName)
{
return fieldTypes::point.found(clsName);
},
true // prune
);
}
}
wordList objectNames(objects.sortedNames());

View File

@ -55,6 +55,7 @@ PtrList<ensightFaMesh> ensightMeshesFa(regionNames.size());
regioni,
new ensightMesh(mesh, writeOpts)
);
ensightMeshes[regioni].verbose(optVerbose);
// New ensight case file, initialize header etc.
ensightCases.set
@ -87,6 +88,7 @@ PtrList<ensightFaMesh> ensightMeshesFa(regionNames.size());
regioni,
new ensightFaMesh(meshesFa[regioni])
);
ensightMeshesFa[regioni].verbose(optVerbose);
}
}
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -108,11 +108,11 @@ Usage
-patches '( front \".*back\" )'
\endverbatim
- \par -excludePatches NAME | LIST
- \par -exclude-patches NAME | LIST
Exclude single or multiple patches (name or regex) from writing.
For example,
\verbatim
-excludePatches '( inlet_1 inlet_2 "proc.*" )'
-exclude-patches '( inlet_1 inlet_2 "proc.*" )'
\endverbatim
\*---------------------------------------------------------------------------*/
@ -170,6 +170,8 @@ int main(int argc, char *argv[])
argList::setAdvanced("decomposeParDict");
argList::setAdvanced("noFunctionObjects");
argList::addVerboseOption("Additional verbosity");
#include "addAllRegionOptions.H"
argList::addBoolOption
@ -259,10 +261,15 @@ int main(int argc, char *argv[])
// );
argList::addBoolOption
(
"finite-area",
"Write finite area fields",
"no-finite-area",
"Suppress output of finite-area mesh/fields",
true // mark as an advanced option
);
argList::ignoreOptionCompat
(
{"finite-area", 2112}, // use -no-finite-area to disable
false // bool option, no argument
);
argList::addOption
(
@ -273,12 +280,14 @@ int main(int argc, char *argv[])
);
argList::addOption
(
"excludePatches",
"exclude-patches",
"wordRes",
"Exclude single or multiple patches from writing\n"
"Eg, 'outlet' or '( inlet \".*Wall\" )'"
, true // mark as an advanced option
);
argList::addOptionCompat("exclude-patches", {"excludePatches", 2112});
argList::addOption
(
"faceZones",
@ -293,6 +302,19 @@ int main(int argc, char *argv[])
"Specify single or multiple fields to write (all by default)\n"
"Eg, 'T' or '( \"U.*\" )'"
);
argList::addOption
(
"exclude-fields",
"wordRes",
"Exclude single or multiple fields",
true // mark as an advanced option
);
argList::addBoolOption
(
"no-fields",
"Suppress conversion of fields"
);
argList::addOption
(
"cellZones",
@ -315,11 +337,12 @@ int main(int argc, char *argv[])
: IOstreamOption::BINARY
);
const int optVerbose = args.verbose();
const bool doBoundary = !args.found("no-boundary");
const bool doInternal = !args.found("no-internal");
const bool doCellZones = !args.found("no-cellZones");
const bool doLagrangian = !args.found("no-lagrangian");
const bool doFiniteArea = args.found("finite-area");
const bool doFiniteArea = !args.found("no-finite-area");
const bool doPointValues = !args.found("no-point-data");
const bool nearCellValue = args.found("nearCellValue") && doBoundary;
@ -360,13 +383,14 @@ int main(int argc, char *argv[])
writeOpts.useInternalMesh(doInternal);
writeOpts.useCellZones(doCellZones);
// Patch selection/deselection
if (args.found("patches"))
{
writeOpts.patchSelection(args.getList<wordRe>("patches"));
}
if (args.found("excludePatches"))
if (args.found("exclude-patches"))
{
writeOpts.patchExclude(args.getList<wordRe>("excludePatches"));
writeOpts.patchExclude(args.getList<wordRe>("exclude-patches"));
}
if (args.found("faceZones"))
@ -381,8 +405,35 @@ int main(int argc, char *argv[])
// Report the setup
writeOpts.print(Info);
wordRes fieldPatterns;
args.readListIfPresent<wordRe>("fields", fieldPatterns);
// Field selection/deselection
wordRes includedFields, excludedFields;
autoPtr<wordRes::filter> fieldSelector(nullptr);
const bool doConvertFields = !args.found("no-fields");
if (doConvertFields)
{
bool resetFilter = false;
if (args.readListIfPresent<wordRe>("fields", includedFields))
{
resetFilter = true;
Info<< "Including fields "
<< flatOutput(includedFields) << nl << endl;
}
if (args.readListIfPresent<wordRe>("exclude-fields", excludedFields))
{
resetFilter = true;
Info<< "Excluding fields "
<< flatOutput(excludedFields) << nl << endl;
}
if (resetFilter)
{
fieldSelector =
autoPtr<wordRes::filter>::New(includedFields, excludedFields);
}
}
else if (doConvertFields)
{
Info<< "Field conversion disabled with the '-no-fields' option" << nl;
}
// ------------------------------------------------------------------------
@ -525,7 +576,6 @@ int main(int argc, char *argv[])
// Objects at this time
IOobjectList objects(mesh, runTime.timeName());
// Restrict to objects that are available for all times
objects.filterObjects
(
availableRegionObjectNames[regioni]

View File

@ -81,20 +81,16 @@ tmp<GeoField> getField
//- Convert an internal field to zero-gradient volume field
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>>
makeZeroGradientField
tmp<VolumeField<Type>> makeZeroGradientField
(
const tmp
<
typename GeometricField<Type, fvPatchField, volMesh>::Internal
>& tdf
const tmp<VolumeInternalField<Type>>& tdf
)
{
if (tdf)
{
auto& df = tdf.ref();
auto tfield = GeometricField<Type, fvPatchField, volMesh>::New
auto tfield = VolumeField<Type>::New
(
df.name(),
df.mesh(),
@ -119,17 +115,16 @@ makeZeroGradientField
//- Convert a volume field to zero-gradient volume field
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>>
makeZeroGradientField
tmp<VolumeField<Type>> makeZeroGradientField
(
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tdf
const tmp<VolumeField<Type>>& tdf
)
{
if (tdf)
{
auto& df = tdf.ref();
auto tfield = GeometricField<Type, fvPatchField, volMesh>::New
auto tfield = VolumeField<Type>::New
(
df.name(),
df.mesh(),

View File

@ -34,7 +34,7 @@ bool writeAreaField
(
ensightCase& ensCase,
const ensightFaMesh& ensMesh,
const tmp<GeometricField<Type, faPatchField, areaMesh>>& tfield
const tmp<AreaField<Type>>& tfield
)
{
if (!tfield)
@ -66,13 +66,13 @@ label writeAreaFields
const IOobjectList& objects
)
{
typedef GeometricField<Type, faPatchField, areaMesh> GeoField;
typedef AreaField<Type> FieldType;
const faMesh& mesh = ensMesh.mesh();
label count = 0;
for (const word& fieldName : objects.sortedNames<GeoField>())
for (const word& fieldName : objects.sortedNames<FieldType>())
{
if
(
@ -80,7 +80,7 @@ label writeAreaFields
(
ensCase,
ensMesh,
getField<GeoField>(objects.findObject(fieldName), mesh)
getField<FieldType>(objects.findObject(fieldName), mesh)
)
)
{

View File

@ -33,7 +33,7 @@ bool writeDimField
(
ensightCase& ensCase,
const ensightMesh& ensMesh,
const tmp<DimensionedField<Type, volMesh>>& tdf
const tmp<VolumeInternalField<Type>>& tdf
)
{
if (!tdf)
@ -63,17 +63,13 @@ label writeDimFields
const IOobjectList& objects
)
{
typedef typename
GeometricField
<
Type, fvPatchField, volMesh
>::Internal DimField;
typedef VolumeInternalField<Type> FieldType;
const fvMesh& mesh = dynamicCast<const fvMesh>(ensMesh.mesh());
label count = 0;
for (const word& fieldName : objects.sortedNames<DimField>())
for (const word& fieldName : objects.sortedNames<FieldType>())
{
if
(
@ -81,7 +77,7 @@ label writeDimFields
(
ensCase,
ensMesh,
getField<DimField>(objects.findObject(fieldName), mesh)
getField<FieldType>(objects.findObject(fieldName), mesh)
)
)
{

View File

@ -35,7 +35,7 @@ bool writePointField
(
ensightCase& ensCase,
const ensightMesh& ensMesh,
const tmp<GeometricField<Type, pointPatchField, pointMesh>>& tfield
const tmp<PointField<Type>>& tfield
)
{
if (!tfield)
@ -68,13 +68,13 @@ label writePointFields
const IOobjectList& objects
)
{
typedef GeometricField<Type, pointPatchField, pointMesh> GeoField;
typedef PointField<Type> FieldType;
const pointMesh& ptMesh = pointMesh::New(ensMesh.mesh());
label count = 0;
for (const word& fieldName : objects.sortedNames<GeoField>())
for (const word& fieldName : objects.sortedNames<FieldType>())
{
if
(
@ -82,7 +82,7 @@ label writePointFields
(
ensCase,
ensMesh,
getField<GeoField>(ptMesh, objects, fieldName)
getField<FieldType>(ptMesh, objects, fieldName)
)
)
{

View File

@ -34,7 +34,7 @@ bool writeVolField
(
ensightCase& ensCase,
const ensightMesh& ensMesh,
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfield,
const tmp<VolumeField<Type>>& tfield,
const bool nearCellValue = false
)
{
@ -86,13 +86,13 @@ label writeVolFields
const bool nearCellValue = false
)
{
typedef GeometricField<Type, fvPatchField, volMesh> GeoField;
typedef VolumeField<Type> FieldType;
const fvMesh& mesh = dynamicCast<const fvMesh>(ensMesh.mesh());
label count = 0;
for (const word& fieldName : objects.sortedNames<GeoField>())
for (const word& fieldName : objects.sortedNames<FieldType>())
{
if
(
@ -100,7 +100,7 @@ label writeVolFields
(
ensCase,
ensMesh,
getField<GeoField>(objects.findObject(fieldName), mesh),
getField<FieldType>(objects.findObject(fieldName), mesh),
nearCellValue
)
)

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -52,7 +52,6 @@ if (doLagrangian)
// Consistent order
Foam::sort(cloudNames);
for (const word& cloudName : cloudNames)
{
IOobjectList cloudObjs(mesh, runTime.timeName(), cloudPrefix/cloudName);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -43,12 +43,7 @@ Description
{
if (nSurfaceScalarField == -1)
{
sScalars = readFields<surfaceScalarField>
(
meshProxy,
objects,
selectedFields
);
sScalars = readFields<surfaceScalarField>(meshProxy, objects);
reportFields::print(" surfScalar :", Info, sScalars);
nSurfaceScalarField = sScalars.size();
@ -60,12 +55,7 @@ Description
if (nSurfaceVectorField == -1)
{
sVectors = readFields<surfaceVectorField>
(
meshProxy,
objects,
selectedFields
);
sVectors = readFields<surfaceVectorField>(meshProxy, objects);
reportFields::print(" surfVector :", Info, sVectors);
nSurfaceVectorField = sVectors.size();
@ -155,12 +145,7 @@ Description
{
if (nSurfaceScalarField == -1)
{
sScalars = readFields<surfaceScalarField>
(
meshProxy,
objects,
selectedFields
);
sScalars = readFields<surfaceScalarField>(meshProxy, objects);
nSurfaceScalarField = sScalars.size();
reportFields::print(" surfScalar :", Info, sScalars);
@ -172,12 +157,7 @@ Description
if (nSurfaceVectorField == -1)
{
sVectors = readFields<surfaceVectorField>
(
meshProxy,
objects,
selectedFields
);
sVectors = readFields<surfaceVectorField>(meshProxy, objects);
nSurfaceVectorField = sVectors.size();
reportFields::print(" surfVector :", Info, sVectors);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,7 +48,7 @@ Description
: 0
);
const label nPointFields =
label nPointFields =
(
doPointValues
? objects.count(stringListOps::foundOp<word>(fieldTypes::point))
@ -82,11 +82,6 @@ Description
if (doInternal)
{
if (doPointValues)
{
pInterp.reset(new volPointInterpolation(mesh));
}
if (vtuMeshCells.empty())
{
// Use the appropriate mesh (baseMesh or subMesh)
@ -119,6 +114,11 @@ Description
internalWriter->writeTimeValue(mesh.time().value());
internalWriter->writeGeometry();
if (doPointValues)
{
pInterp.reset(new volPointInterpolation(mesh));
}
}
@ -132,7 +132,7 @@ Description
labelList patchIds;
if (doBoundary)
{
patchIds = getSelectedPatches(patches, includePatches, excludePatches);
patchIds = getSelectedPatches(patches, patchSelector);
}
if (oneBoundary && patchIds.size())

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -112,11 +112,11 @@ Usage
-patches '( front \".*back\" )'
\endverbatim
- \par -excludePatches NAME | LIST
- \par -exclude-patches NAME | LIST
Exclude single or multiple patches (name or regex) from writing.
For example,
\verbatim
-excludePatches '( inlet_1 inlet_2 "proc.*")'
-exclude-patches '( inlet_1 inlet_2 "proc.*")'
\endverbatim
Note
@ -169,22 +169,28 @@ Note
labelList getSelectedPatches
(
const polyBoundaryMesh& patches,
const wordRes& allow,
const wordRes& deny
const autoPtr<wordRes::filter>& patchSelector
)
{
// Name-based selection
labelList indices
(
stringListOps::findMatching
(
patches,
allow,
deny,
nameOp<polyPatch>()
)
);
labelList indices;
if (patchSelector && !patchSelector().empty())
{
// Name-based selection
indices =
(
stringListOps::findMatching
(
patches,
patchSelector(),
nameOp<polyPatch>()
)
);
}
else
{
indices = identity(patches.size());
}
// Remove undesirable patches
@ -264,6 +270,8 @@ int main(int argc, char *argv[])
argList::setAdvanced("decomposeParDict");
argList::setAdvanced("noFunctionObjects");
argList::addVerboseOption("Additional verbosity");
argList::addBoolOption
(
"ascii",
@ -328,7 +336,6 @@ int main(int argc, char *argv[])
"Eg, 'cells' or '( slice \"mfp-.*\" )'.",
true // mark as an advanced option
);
argList::addOption
(
"fields",
@ -336,6 +343,18 @@ int main(int argc, char *argv[])
"Specify single or multiple fields to write (all by default)\n"
"Eg, 'T' or '(p T U \"alpha.*\")'"
);
argList::addOption
(
"exclude-fields",
"wordRes",
"Exclude single or multiple fields",
true // mark as an advanced option
);
argList::addBoolOption
(
"no-fields",
"Suppress conversion of fields"
);
argList::addBoolOption
(
@ -351,11 +370,21 @@ int main(int argc, char *argv[])
);
argList::addBoolOption
(
"finite-area",
"Write finite area fields",
"no-finite-area",
"Suppress output of finite-area mesh/fields",
true // mark as an advanced option
);
argList::addOptionCompat("finite-area", {"finiteAreaFields", 2012});
argList::ignoreOptionCompat
(
{"finite-area", 2112}, // use -no-finite-area to disable
false // bool option, no argument
);
argList::ignoreOptionCompat
(
{"finiteAreaFields", 2012}, // use -no-finite-area to disable
false // bool option, no argument
);
argList::addBoolOption
(
"nearCellValue",
@ -418,12 +447,14 @@ int main(int argc, char *argv[])
);
argList::addOption
(
"excludePatches",
"exclude-patches",
"wordRes",
"Exclude single or multiple patches from writing\n"
"Eg, 'outlet' or '( inlet \".*Wall\" )'",
true // mark as an advanced option
);
argList::addOptionCompat("exclude-patches", {"excludePatches", 2112});
argList::ignoreOptionCompat
(
{"noFaceZones", 1806}, // faceZones are only enabled on demand
@ -453,13 +484,13 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
/// const int optVerbose = args.verbose();
const bool decomposePoly = args.found("poly-decomp");
const bool doBoundary = !args.found("no-boundary");
const bool doInternal = !args.found("no-internal");
const bool doLagrangian = !args.found("no-lagrangian");
const bool doFiniteArea = args.found("finite-area");
const bool doFiniteArea = !args.found("no-finite-area");
const bool doSurfaceFields = args.found("surfaceFields");
const bool oneBoundary = args.found("one-boundary") && doBoundary;
const bool nearCellValue = args.found("nearCellValue") && doBoundary;
@ -494,7 +525,7 @@ int main(int argc, char *argv[])
<< nl << endl;
}
const bool doPointValues = !args.found("no-point-data");
bool doPointValues = !args.found("no-point-data");
if (!doPointValues)
{
Info<< "Point fields and interpolated point data"
@ -521,25 +552,74 @@ int main(int argc, char *argv[])
Info<< "Writing mesh ids (cell, patch, proc) requested" << nl;
}
wordRes includePatches, excludePatches;
// Patch selection/deselection
wordRes includedPatches, excludedPatches;
autoPtr<wordRes::filter> patchSelector(nullptr);
if (doBoundary)
{
if (args.readListIfPresent<wordRe>("patches", includePatches))
bool resetFilter = false;
if (args.readListIfPresent<wordRe>("patches", includedPatches))
{
Info<< "Including patches " << flatOutput(includePatches)
<< nl << endl;
resetFilter = true;
Info<< "Including patches "
<< flatOutput(includedPatches) << nl << endl;
}
if (args.readListIfPresent<wordRe>("excludePatches", excludePatches))
if (args.readListIfPresent<wordRe>("exclude-patches", excludedPatches))
{
Info<< "Excluding patches " << flatOutput(excludePatches)
<< nl << endl;
resetFilter = true;
Info<< "Excluding patches "
<< flatOutput(excludedPatches) << nl << endl;
}
if (resetFilter)
{
patchSelector =
autoPtr<wordRes::filter>::New(includedPatches, excludedPatches);
}
}
// Can be specified as empty (ie, no fields)
wordRes selectedFields;
const bool useFieldFilter =
args.readListIfPresent<wordRe>("fields", selectedFields);
// Field selection/deselection
wordRes includedFields, excludedFields;
autoPtr<wordRes::filter> fieldSelector(nullptr);
bool doConvertFields = !args.found("no-fields");
if (doConvertFields)
{
bool resetFilter = false;
if (args.readListIfPresent<wordRe>("fields", includedFields))
{
Info<< "Including fields "
<< flatOutput(includedFields) << nl << endl;
resetFilter = !includedFields.empty();
if (includedFields.empty())
{
// Compat: Can be specified as empty (ie, no fields)
// Same as "block everything"
doConvertFields = false;
Info<< "Field conversion disabled by '-fields ()' option" << nl
<< "Should use -no-fields instead" << endl;
}
}
if (args.readListIfPresent<wordRe>("exclude-fields", excludedFields))
{
resetFilter = true;
Info<< "Excluding fields "
<< flatOutput(excludedFields) << nl << endl;
}
if (resetFilter && doConvertFields)
{
fieldSelector =
autoPtr<wordRes::filter>::New(includedFields, excludedFields);
}
}
else if (doConvertFields)
{
Info<< "Field conversion disabled with the '-no-fields' option" << nl;
}
// Non-mandatory
const wordRes selectedFaceZones(args.getList<wordRe>("faceZones", false));
@ -709,28 +789,34 @@ int main(int argc, char *argv[])
}
}
// Search for list of objects for this time
IOobjectList objects(meshProxy.baseMesh(), runTime.timeName());
IOobjectList objects(0);
if (useFieldFilter)
if (doConvertFields)
{
objects.filterObjects(selectedFields);
}
// List of objects for this time
objects =
IOobjectList(meshProxy.baseMesh(), runTime.timeName());
// Prune restart fields
objects.prune_0();
if (fieldSelector && !fieldSelector().empty())
{
objects.filterObjects(fieldSelector());
}
if (!doPointValues)
{
// Prune point fields if disabled
objects.filterClasses
(
[](const word& clsName)
{
return fieldTypes::point.found(clsName);
},
true // prune
);
// Remove "*_0" restart fields
objects.prune_0();
if (!doPointValues)
{
// Prune point fields if disabled
objects.filterClasses
(
[](const word& clsName)
{
return fieldTypes::point.found(clsName);
},
true // prune
);
}
}
if (processorFieldsOnly)

View File

@ -94,19 +94,13 @@ template<class GeoField>
Foam::PtrList<const GeoField> Foam::readFields
(
const typename GeoField::Mesh& mesh,
const IOobjectList& objects,
const wordRes& selection
const IOobjectList& objects
)
{
const bool syncPar = true;
// Available fields of type GeoField, sorted order
const wordList fieldNames =
(
selection.empty()
? objects.sortedNames<GeoField>()
: objects.sortedNames<GeoField>(selection)
);
const wordList fieldNames(objects.sortedNames<GeoField>());
// Construct the fields
PtrList<const GeoField> fields(fieldNames.size());
@ -133,19 +127,13 @@ template<class GeoField>
Foam::PtrList<const GeoField> Foam::readFields
(
const fvMeshSubsetProxy& proxy,
const IOobjectList& objects,
const wordRes& selection
const IOobjectList& objects
)
{
const bool syncPar = true;
// Available fields of type GeoField, sorted order
const wordList fieldNames =
(
selection.empty()
? objects.sortedNames<GeoField>()
: objects.sortedNames<GeoField>(selection)
);
const wordList fieldNames(objects.sortedNames<GeoField>());
// Construct the fields
PtrList<const GeoField> fields(fieldNames.size());

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2018 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef readFields_H
#define readFields_H
#ifndef Foam_readFields_H
#define Foam_readFields_H
#include "fvMeshSubsetProxy.H"
#include "IOobjectList.H"
@ -94,8 +94,7 @@ template<class GeoField>
PtrList<const GeoField> readFields
(
const typename GeoField::Mesh& mesh,
const IOobjectList& objects,
const wordRes& selection
const IOobjectList& objects
);
@ -104,8 +103,7 @@ template<class GeoField>
PtrList<const GeoField> readFields
(
const fvMeshSubsetProxy& proxy,
const IOobjectList& objects,
const wordRes& selection
const IOobjectList& objects
);