mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use objectRegistry/IOobjectList sorted instead of lookupClass
- in most cases a parallel-consistent order is required. Even when the order is not important, it will generally require fewer allocations to create a UPtrList of entries instead of a HashTable or even a wordList.
This commit is contained in:
@ -52,7 +52,9 @@ namespace Foam
|
||||
const Foam::volScalarField&
|
||||
Foam::radiation::localDensityAbsorptionEmission::alpha(word alphaName) const
|
||||
{
|
||||
if (!mesh_.foundObject<volScalarField>(alphaName))
|
||||
const volScalarField* ptr = mesh_.cfindObject<volScalarField>(alphaName);
|
||||
|
||||
if (!ptr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unable to retrieve density field " << alphaName << " from "
|
||||
@ -60,7 +62,7 @@ Foam::radiation::localDensityAbsorptionEmission::alpha(word alphaName) const
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return mesh_.lookupObject<volScalarField>(alphaName);
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -131,40 +131,56 @@ void modifyOrAddFace
|
||||
|
||||
|
||||
template<class Type>
|
||||
void subsetVolFields
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh>> subsetVolFields
|
||||
(
|
||||
const fvMeshSubset& subsetter,
|
||||
const IOobjectList& objects,
|
||||
const label patchi,
|
||||
const Type& exposedValue,
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh>>& subFields
|
||||
const Type& exposedValue
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> GeoField;
|
||||
|
||||
const fvMesh& baseMesh = subsetter.baseMesh();
|
||||
|
||||
const UPtrList<const IOobject> fieldObjects
|
||||
(
|
||||
objects.csorted<GeoField>()
|
||||
);
|
||||
|
||||
PtrList<GeoField> subFields(fieldObjects.size());
|
||||
|
||||
label nFields = 0;
|
||||
|
||||
for (const word& fieldName : objects.sortedNames<GeoField>())
|
||||
for (const IOobject& io : fieldObjects)
|
||||
{
|
||||
const IOobject* ioptr = objects.findObject(fieldName);
|
||||
|
||||
if (!nFields)
|
||||
{
|
||||
Info<< "Subsetting " << GeoField::typeName << nl;
|
||||
Info<< "Subsetting " << GeoField::typeName << " (";
|
||||
}
|
||||
Info<< " " << fieldName << endl;
|
||||
else
|
||||
{
|
||||
Info<< ' ';
|
||||
}
|
||||
Info<< " " << io.name() << endl;
|
||||
|
||||
GeoField origField(*ioptr, baseMesh);
|
||||
// Read unregistered
|
||||
IOobject rio(io, IOobjectOption::NO_REGISTER);
|
||||
GeoField origField(rio, baseMesh);
|
||||
|
||||
subFields.set(nFields, subsetter.interpolate(origField));
|
||||
auto& subField = subFields[nFields];
|
||||
++nFields;
|
||||
|
||||
|
||||
// Subsetting adds 'subset' prefix. Rename field to be like original.
|
||||
subField.rename(io.name());
|
||||
subField.writeOpt(IOobjectOption::AUTO_WRITE);
|
||||
|
||||
|
||||
// Explicitly set exposed faces (in patchi) to exposedValue.
|
||||
if (patchi >= 0)
|
||||
{
|
||||
fvPatchField<Type>& fld =
|
||||
subFields[nFields].boundaryFieldRef()[patchi];
|
||||
fvPatchField<Type>& fld = subField.boundaryFieldRef()[patchi];
|
||||
|
||||
const label newStart = fld.patch().patch().start();
|
||||
const label oldPatchi = subsetter.patchMap()[patchi];
|
||||
@ -195,48 +211,68 @@ void subsetVolFields
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
++nFields;
|
||||
}
|
||||
}
|
||||
|
||||
if (nFields)
|
||||
{
|
||||
Info<< ')' << nl;
|
||||
}
|
||||
|
||||
return subFields;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void subsetSurfaceFields
|
||||
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>> subsetSurfaceFields
|
||||
(
|
||||
const fvMeshSubset& subsetter,
|
||||
const IOobjectList& objects,
|
||||
const label patchi,
|
||||
const Type& exposedValue,
|
||||
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& subFields
|
||||
const Type& exposedValue
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> GeoField;
|
||||
|
||||
const fvMesh& baseMesh = subsetter.baseMesh();
|
||||
|
||||
const UPtrList<const IOobject> fieldObjects
|
||||
(
|
||||
objects.csorted<GeoField>()
|
||||
);
|
||||
|
||||
PtrList<GeoField> subFields(fieldObjects.size());
|
||||
|
||||
label nFields = 0;
|
||||
|
||||
for (const word& fieldName : objects.sortedNames<GeoField>())
|
||||
for (const IOobject& io : fieldObjects)
|
||||
{
|
||||
const IOobject* ioptr = objects.findObject(fieldName);
|
||||
|
||||
if (!nFields)
|
||||
{
|
||||
Info<< "Subsetting " << GeoField::typeName << nl;
|
||||
Info<< "Subsetting " << GeoField::typeName << " (";
|
||||
}
|
||||
Info<< " " << fieldName << endl;
|
||||
else
|
||||
{
|
||||
Info<< ' ';
|
||||
}
|
||||
Info<< io.name();
|
||||
|
||||
GeoField origField(*ioptr, baseMesh);
|
||||
// Read unregistered
|
||||
IOobject rio(io, IOobjectOption::NO_REGISTER);
|
||||
GeoField origField(rio, baseMesh);
|
||||
|
||||
subFields.set(nFields, subsetter.interpolate(origField));
|
||||
auto& subField = subFields[nFields];
|
||||
++nFields;
|
||||
|
||||
// Subsetting adds 'subset' prefix. Rename field to be like original.
|
||||
subField.rename(io.name());
|
||||
subField.writeOpt(IOobjectOption::AUTO_WRITE);
|
||||
|
||||
|
||||
// Explicitly set exposed faces (in patchi) to exposedValue.
|
||||
if (patchi >= 0)
|
||||
{
|
||||
fvsPatchField<Type>& fld =
|
||||
subFields[nFields].boundaryFieldRef()[patchi];
|
||||
fvsPatchField<Type>& fld = subField.boundaryFieldRef()[patchi];
|
||||
|
||||
const label newStart = fld.patch().patch().start();
|
||||
const label oldPatchi = subsetter.patchMap()[patchi];
|
||||
@ -268,9 +304,14 @@ void subsetSurfaceFields
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
++nFields;
|
||||
}
|
||||
|
||||
if (nFields)
|
||||
{
|
||||
Info<< ')' << nl;
|
||||
}
|
||||
|
||||
return subFields;
|
||||
}
|
||||
|
||||
|
||||
@ -284,16 +325,9 @@ void initCreatedPatches
|
||||
const typename GeoField::value_type initValue
|
||||
)
|
||||
{
|
||||
HashTable<const GeoField*> fields
|
||||
(
|
||||
mesh.objectRegistry::lookupClass<GeoField>()
|
||||
);
|
||||
|
||||
forAllIters(fields, fieldIter)
|
||||
for (const GeoField& field : mesh.objectRegistry::csorted<GeoField>())
|
||||
{
|
||||
GeoField& field = const_cast<GeoField&>(*fieldIter());
|
||||
|
||||
auto& fieldBf = field.boundaryFieldRef();
|
||||
auto& fieldBf = const_cast<GeoField&>(field).boundaryFieldRef();
|
||||
|
||||
forAll(fieldBf, patchi)
|
||||
{
|
||||
@ -326,43 +360,36 @@ void subsetTopoSets
|
||||
PtrList<TopoSet> sets;
|
||||
ReadFields<TopoSet>(objects, sets);
|
||||
|
||||
subSets.resize(sets.size());
|
||||
subSets.resize_null(sets.size());
|
||||
|
||||
forAll(sets, seti)
|
||||
{
|
||||
TopoSet& set = sets[seti];
|
||||
const TopoSet& set = sets[seti];
|
||||
|
||||
Info<< "Subsetting " << set.type() << " " << set.name() << endl;
|
||||
Info<< "Subsetting " << set.type() << ' ' << set.name() << endl;
|
||||
|
||||
labelHashSet subset(2*min(set.size(), map.size()));
|
||||
|
||||
// Map the data
|
||||
bitSet isSet(set.maxSize(mesh));
|
||||
for (const label id : set)
|
||||
forAll(map, i)
|
||||
{
|
||||
isSet.set(id);
|
||||
}
|
||||
|
||||
label nSet = 0;
|
||||
for (const label id : map)
|
||||
{
|
||||
if (isSet.test(id))
|
||||
if (set.contains(map[i]))
|
||||
{
|
||||
++nSet;
|
||||
subset.insert(i);
|
||||
}
|
||||
}
|
||||
|
||||
subSets.set
|
||||
(
|
||||
seti,
|
||||
new TopoSet(subMesh, set.name(), nSet, IOobject::AUTO_WRITE)
|
||||
new TopoSet
|
||||
(
|
||||
subMesh,
|
||||
set.name(),
|
||||
std::move(subset),
|
||||
IOobjectOption::AUTO_WRITE
|
||||
)
|
||||
);
|
||||
TopoSet& subSet = subSets[seti];
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
if (isSet.test(map[i]))
|
||||
{
|
||||
subSet.insert(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -613,6 +640,7 @@ label findPatch(const polyBoundaryMesh& patches, const word& patchName)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -844,138 +872,117 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read vol fields and subset.
|
||||
|
||||
wordList scalarNames(objects.sortedNames<volScalarField>());
|
||||
PtrList<volScalarField> scalarFlds(scalarNames.size());
|
||||
subsetVolFields
|
||||
PtrList<volScalarField> scalarFlds
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
scalar(Zero),
|
||||
scalarFlds
|
||||
subsetVolFields<scalar>
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
scalar(Zero)
|
||||
)
|
||||
);
|
||||
|
||||
wordList vectorNames(objects.sortedNames<volVectorField>());
|
||||
PtrList<volVectorField> vectorFlds(vectorNames.size());
|
||||
subsetVolFields
|
||||
PtrList<volVectorField> vectorFlds
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
vector(Zero),
|
||||
vectorFlds
|
||||
subsetVolFields<vector>
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
vector(Zero)
|
||||
)
|
||||
);
|
||||
|
||||
wordList sphTensorNames
|
||||
(
|
||||
objects.sortedNames<volSphericalTensorField>()
|
||||
);
|
||||
PtrList<volSphericalTensorField> sphTensorFlds
|
||||
(
|
||||
sphTensorNames.size()
|
||||
);
|
||||
subsetVolFields
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
sphericalTensor(Zero),
|
||||
sphTensorFlds
|
||||
subsetVolFields<sphericalTensor>
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
sphericalTensor(Zero)
|
||||
)
|
||||
);
|
||||
|
||||
wordList symmTensorNames(objects.sortedNames<volSymmTensorField>());
|
||||
PtrList<volSymmTensorField> symmTensorFlds(symmTensorNames.size());
|
||||
subsetVolFields
|
||||
PtrList<volSymmTensorField> symmTensorFlds
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
symmTensor(Zero),
|
||||
symmTensorFlds
|
||||
subsetVolFields<symmTensor>
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
symmTensor(Zero)
|
||||
)
|
||||
);
|
||||
|
||||
wordList tensorNames(objects.sortedNames<volTensorField>());
|
||||
PtrList<volTensorField> tensorFlds(tensorNames.size());
|
||||
subsetVolFields
|
||||
PtrList<volTensorField> tensorFlds
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
tensor(Zero),
|
||||
tensorFlds
|
||||
subsetVolFields<tensor>
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
tensor(Zero)
|
||||
)
|
||||
);
|
||||
|
||||
// Read surface fields and subset.
|
||||
|
||||
wordList surfScalarNames(objects.sortedNames<surfaceScalarField>());
|
||||
PtrList<surfaceScalarField> surfScalarFlds(surfScalarNames.size());
|
||||
subsetSurfaceFields
|
||||
PtrList<surfaceScalarField> surfScalarFlds
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
scalar(Zero),
|
||||
surfScalarFlds
|
||||
subsetSurfaceFields<scalar>
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
scalar(Zero)
|
||||
)
|
||||
);
|
||||
|
||||
wordList surfVectorNames(objects.sortedNames<surfaceVectorField>());
|
||||
PtrList<surfaceVectorField> surfVectorFlds(surfVectorNames.size());
|
||||
subsetSurfaceFields
|
||||
PtrList<surfaceVectorField> surfVectorFlds
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
vector(Zero),
|
||||
surfVectorFlds
|
||||
subsetSurfaceFields<vector>
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
vector(Zero)
|
||||
)
|
||||
);
|
||||
|
||||
wordList surfSphTensorNames
|
||||
(
|
||||
objects.sortedNames<surfaceSphericalTensorField>()
|
||||
);
|
||||
PtrList<surfaceSphericalTensorField> surfSphericalTensorFlds
|
||||
(
|
||||
surfSphTensorNames.size()
|
||||
);
|
||||
subsetSurfaceFields
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
sphericalTensor(Zero),
|
||||
surfSphericalTensorFlds
|
||||
);
|
||||
|
||||
wordList surfSymmTensorNames
|
||||
(
|
||||
objects.sortedNames<surfaceSymmTensorField>()
|
||||
subsetSurfaceFields<sphericalTensor>
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
sphericalTensor(Zero)
|
||||
)
|
||||
);
|
||||
|
||||
PtrList<surfaceSymmTensorField> surfSymmTensorFlds
|
||||
(
|
||||
surfSymmTensorNames.size()
|
||||
subsetSurfaceFields<symmTensor>
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
symmTensor(Zero)
|
||||
)
|
||||
);
|
||||
|
||||
subsetSurfaceFields
|
||||
PtrList<surfaceTensorField> surfTensorFlds
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
symmTensor(Zero),
|
||||
surfSymmTensorFlds
|
||||
);
|
||||
|
||||
wordList surfTensorNames(objects.sortedNames<surfaceTensorField>());
|
||||
PtrList<surfaceTensorField> surfTensorFlds(surfTensorNames.size());
|
||||
subsetSurfaceFields
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
tensor(Zero),
|
||||
surfTensorFlds
|
||||
subsetSurfaceFields<tensor>
|
||||
(
|
||||
subsetter,
|
||||
objects,
|
||||
defaultPatchi,
|
||||
tensor(Zero)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -1017,62 +1024,8 @@ int main(int argc, char *argv[])
|
||||
++runTime;
|
||||
}
|
||||
|
||||
Info<< "Writing mesh without blockedCells to time " << runTime.value()
|
||||
<< endl;
|
||||
|
||||
// Subsetting adds 'subset' prefix. Rename field to be like original.
|
||||
forAll(scalarFlds, i)
|
||||
{
|
||||
scalarFlds[i].rename(scalarNames[i]);
|
||||
scalarFlds[i].writeOpt(IOobject::AUTO_WRITE);
|
||||
}
|
||||
forAll(vectorFlds, i)
|
||||
{
|
||||
vectorFlds[i].rename(vectorNames[i]);
|
||||
vectorFlds[i].writeOpt(IOobject::AUTO_WRITE);
|
||||
}
|
||||
forAll(sphTensorFlds, i)
|
||||
{
|
||||
sphTensorFlds[i].rename(sphTensorNames[i]);
|
||||
sphTensorFlds[i].writeOpt(IOobject::AUTO_WRITE);
|
||||
}
|
||||
forAll(symmTensorFlds, i)
|
||||
{
|
||||
symmTensorFlds[i].rename(symmTensorNames[i]);
|
||||
symmTensorFlds[i].writeOpt(IOobject::AUTO_WRITE);
|
||||
}
|
||||
forAll(tensorFlds, i)
|
||||
{
|
||||
tensorFlds[i].rename(tensorNames[i]);
|
||||
tensorFlds[i].writeOpt(IOobject::AUTO_WRITE);
|
||||
}
|
||||
|
||||
// Surface ones.
|
||||
forAll(surfScalarFlds, i)
|
||||
{
|
||||
surfScalarFlds[i].rename(surfScalarNames[i]);
|
||||
surfScalarFlds[i].writeOpt(IOobject::AUTO_WRITE);
|
||||
}
|
||||
forAll(surfVectorFlds, i)
|
||||
{
|
||||
surfVectorFlds[i].rename(surfVectorNames[i]);
|
||||
surfVectorFlds[i].writeOpt(IOobject::AUTO_WRITE);
|
||||
}
|
||||
forAll(surfSphericalTensorFlds, i)
|
||||
{
|
||||
surfSphericalTensorFlds[i].rename(surfSphTensorNames[i]);
|
||||
surfSphericalTensorFlds[i].writeOpt(IOobject::AUTO_WRITE);
|
||||
}
|
||||
forAll(surfSymmTensorFlds, i)
|
||||
{
|
||||
surfSymmTensorFlds[i].rename(surfSymmTensorNames[i]);
|
||||
surfSymmTensorFlds[i].writeOpt(IOobject::AUTO_WRITE);
|
||||
}
|
||||
forAll(surfTensorNames, i)
|
||||
{
|
||||
surfTensorFlds[i].rename(surfTensorNames[i]);
|
||||
surfTensorFlds[i].writeOpt(IOobject::AUTO_WRITE);
|
||||
}
|
||||
Info<< "Writing mesh without blockedCells to time "
|
||||
<< runTime.value() << endl;
|
||||
|
||||
subsetter.subMesh().write();
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -55,12 +55,9 @@ void ReadAndRotateFields
|
||||
const dimensionedTensor& rotT
|
||||
)
|
||||
{
|
||||
// Objects of field type
|
||||
IOobjectList fields(objects.lookupClass<GeoField>());
|
||||
|
||||
forAllConstIters(fields, fieldIter)
|
||||
for (const IOobject& io : objects.csorted<GeoField>())
|
||||
{
|
||||
GeoField fld(*fieldIter(), mesh);
|
||||
GeoField fld(io, mesh);
|
||||
Info<< " Rotating " << fld.name() << endl;
|
||||
transform(fld, rotT, fld);
|
||||
fld.write();
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -164,14 +164,8 @@ void subsetVolFields
|
||||
{
|
||||
const labelList patchMap(identity(mesh.boundaryMesh().size()));
|
||||
|
||||
HashTable<const GeoField*> fields
|
||||
(
|
||||
mesh.objectRegistry::lookupClass<GeoField>()
|
||||
);
|
||||
forAllConstIters(fields, iter)
|
||||
for (const GeoField& fld : mesh.objectRegistry::csorted<GeoField>())
|
||||
{
|
||||
const GeoField& fld = *iter.val();
|
||||
|
||||
Info<< "Mapping field " << fld.name() << endl;
|
||||
|
||||
tmp<GeoField> tSubFld
|
||||
@ -192,8 +186,7 @@ void subsetVolFields
|
||||
{
|
||||
if (addedPatches.found(patchi))
|
||||
{
|
||||
tSubFld.ref().boundaryFieldRef()[patchi] ==
|
||||
typename GeoField::value_type(Zero);
|
||||
tSubFld.ref().boundaryFieldRef()[patchi] == Zero;
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,14 +211,8 @@ void subsetSurfaceFields
|
||||
{
|
||||
const labelList patchMap(identity(mesh.boundaryMesh().size()));
|
||||
|
||||
HashTable<const GeoField*> fields
|
||||
(
|
||||
mesh.objectRegistry::lookupClass<GeoField>()
|
||||
);
|
||||
forAllConstIters(fields, iter)
|
||||
for (const GeoField& fld : mesh.objectRegistry::csorted<GeoField>())
|
||||
{
|
||||
const GeoField& fld = *iter.val();
|
||||
|
||||
Info<< "Mapping field " << fld.name() << endl;
|
||||
|
||||
tmp<GeoField> tSubFld
|
||||
@ -246,8 +233,7 @@ void subsetSurfaceFields
|
||||
{
|
||||
if (addedPatches.found(patchi))
|
||||
{
|
||||
tSubFld.ref().boundaryFieldRef()[patchi] ==
|
||||
typename GeoField::value_type(Zero);
|
||||
tSubFld.ref().boundaryFieldRef()[patchi] == Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -149,178 +149,127 @@ labelList nearestPatch(const polyMesh& mesh, const labelList& patchIDs)
|
||||
|
||||
|
||||
//
|
||||
// Subset field-type, availability information cached
|
||||
// in the availableFields hashtable.
|
||||
// Subset DimensionedField/GeometricField
|
||||
//
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void subsetFields
|
||||
template<class FieldType>
|
||||
PtrList<FieldType> subsetFields
|
||||
(
|
||||
const fvMeshSubset& subsetter,
|
||||
HashTable<wordHashSet>& availableFields,
|
||||
PtrList<GeometricField<Type, PatchField, GeoMesh>>& subFields
|
||||
const IOobjectList& objects
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, PatchField, GeoMesh> FieldType;
|
||||
const word fieldType = FieldType::typeName;
|
||||
|
||||
const wordList fieldNames = availableFields(fieldType).sortedToc();
|
||||
subFields.setSize(fieldNames.size());
|
||||
|
||||
const fvMesh& baseMesh = subsetter.baseMesh();
|
||||
|
||||
const UPtrList<const IOobject> fieldObjects
|
||||
(
|
||||
objects.csorted<FieldType>()
|
||||
);
|
||||
|
||||
PtrList<FieldType> subFields(fieldObjects.size());
|
||||
|
||||
label nFields = 0;
|
||||
for (const word& fieldName : fieldNames)
|
||||
for (const IOobject& io : fieldObjects)
|
||||
{
|
||||
if (!nFields)
|
||||
{
|
||||
Info<< "Subsetting " << fieldType << " (";
|
||||
Info<< "Subsetting " << FieldType::typeName << " (";
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< ' ';
|
||||
}
|
||||
Info<< fieldName;
|
||||
Info<< io.name();
|
||||
|
||||
FieldType fld
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
io.name(),
|
||||
baseMesh.time().timeName(),
|
||||
baseMesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
baseMesh
|
||||
);
|
||||
|
||||
subFields.set(nFields, subsetter.interpolate(fld));
|
||||
auto& subField = subFields[nFields];
|
||||
++nFields;
|
||||
|
||||
// Subsetting adds 'subset' prefix - rename to match original.
|
||||
subFields[nFields].rename(fieldName);
|
||||
|
||||
++nFields;
|
||||
subField.rename(io.name());
|
||||
}
|
||||
|
||||
if (nFields)
|
||||
{
|
||||
Info<< ')' << nl;
|
||||
}
|
||||
|
||||
return subFields;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void subsetPointFields
|
||||
// Subset point fields
|
||||
template<class FieldType>
|
||||
PtrList<FieldType> subsetFields
|
||||
(
|
||||
const fvMeshSubset& subsetter,
|
||||
const pointMesh& pMesh,
|
||||
HashTable<wordHashSet>& availableFields,
|
||||
PtrList<GeometricField<Type, pointPatchField, pointMesh>>& subFields
|
||||
const IOobjectList& objects,
|
||||
const pointMesh& pMesh
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, pointPatchField, pointMesh> FieldType;
|
||||
const word fieldType = FieldType::typeName;
|
||||
|
||||
const wordList fieldNames = availableFields(fieldType).sortedToc();
|
||||
subFields.setSize(fieldNames.size());
|
||||
|
||||
const fvMesh& baseMesh = subsetter.baseMesh();
|
||||
|
||||
const UPtrList<const IOobject> fieldObjects
|
||||
(
|
||||
objects.csorted<FieldType>()
|
||||
);
|
||||
|
||||
PtrList<FieldType> subFields(fieldObjects.size());
|
||||
|
||||
label nFields = 0;
|
||||
for (const word& fieldName : fieldNames)
|
||||
for (const IOobject& io : fieldObjects)
|
||||
{
|
||||
if (!nFields)
|
||||
{
|
||||
Info<< "Subsetting " << fieldType << " (";
|
||||
Info<< "Subsetting " << FieldType::typeName << " (";
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< ' ';
|
||||
}
|
||||
Info<< fieldName;
|
||||
Info<< io.name();
|
||||
|
||||
FieldType fld
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
io.name(),
|
||||
baseMesh.time().timeName(),
|
||||
baseMesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
pMesh
|
||||
);
|
||||
|
||||
subFields.set(nFields, subsetter.interpolate(fld));
|
||||
auto& subField = subFields[nFields];
|
||||
++nFields;
|
||||
|
||||
// Subsetting adds 'subset' prefix - rename to match original.
|
||||
subFields[nFields].rename(fieldName);
|
||||
|
||||
++nFields;
|
||||
subField.rename(io.name());
|
||||
}
|
||||
|
||||
if (nFields)
|
||||
{
|
||||
Info<< ')' << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void subsetDimensionedFields
|
||||
(
|
||||
const fvMeshSubset& subsetter,
|
||||
HashTable<wordHashSet>& availableFields,
|
||||
PtrList<DimensionedField<Type, volMesh>>& subFields
|
||||
)
|
||||
{
|
||||
typedef DimensionedField<Type, volMesh> FieldType;
|
||||
const word fieldType = FieldType::typeName;
|
||||
|
||||
const wordList fieldNames = availableFields(fieldType).sortedToc();
|
||||
subFields.setSize(fieldNames.size());
|
||||
|
||||
const fvMesh& baseMesh = subsetter.baseMesh();
|
||||
|
||||
label nFields = 0;
|
||||
for (const word& fieldName : fieldNames)
|
||||
{
|
||||
if (!nFields)
|
||||
{
|
||||
Info<< "Subsetting " << fieldType << " (";
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< ' ';
|
||||
}
|
||||
Info<< fieldName;
|
||||
|
||||
FieldType fld
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
baseMesh.time().timeName(),
|
||||
baseMesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
baseMesh
|
||||
);
|
||||
|
||||
subFields.set(nFields, subsetter.interpolate(fld));
|
||||
|
||||
// Subsetting adds 'subset' prefix - rename to match original.
|
||||
subFields[nFields].rename(fieldName);
|
||||
|
||||
++nFields;
|
||||
}
|
||||
|
||||
if (nFields)
|
||||
{
|
||||
Info<< ')' << nl;
|
||||
}
|
||||
return subFields;
|
||||
}
|
||||
|
||||
|
||||
@ -338,7 +287,8 @@ void subsetTopoSets
|
||||
PtrList<TopoSet> sets;
|
||||
ReadFields<TopoSet>(objects, sets);
|
||||
|
||||
subSets.setSize(sets.size());
|
||||
subSets.resize_null(sets.size());
|
||||
|
||||
forAll(sets, seti)
|
||||
{
|
||||
const TopoSet& set = sets[seti];
|
||||
@ -347,6 +297,7 @@ void subsetTopoSets
|
||||
|
||||
labelHashSet subset(2*min(set.size(), map.size()));
|
||||
|
||||
// Map the data
|
||||
forAll(map, i)
|
||||
{
|
||||
if (set.found(map[i]))
|
||||
@ -363,13 +314,14 @@ void subsetTopoSets
|
||||
subMesh,
|
||||
set.name(),
|
||||
std::move(subset),
|
||||
IOobject::AUTO_WRITE
|
||||
IOobjectOption::AUTO_WRITE
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -568,54 +520,51 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
}
|
||||
|
||||
Info<< "Subset "
|
||||
<< returnReduce(subsetter.subMesh().nCells(), sumOp<label>())
|
||||
<< " of "
|
||||
<< returnReduce(mesh.nCells(), sumOp<label>())
|
||||
FixedList<label, 2> cellCount;
|
||||
cellCount[0] = subsetter.subMesh().nCells();
|
||||
cellCount[1] = mesh.nCells();
|
||||
reduce(cellCount, sumOp<label>());
|
||||
|
||||
Info<< "Subset " << cellCount[0] << " of " << cellCount[1]
|
||||
<< " cells" << nl << nl;
|
||||
}
|
||||
|
||||
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
HashTable<wordHashSet> availableFields = objects.classes();
|
||||
|
||||
|
||||
// Read fields and subset
|
||||
#undef createSubsetFields
|
||||
#define createSubsetFields(FieldType, Variable) \
|
||||
PtrList<FieldType> Variable \
|
||||
( \
|
||||
subsetFields<FieldType>(subsetter, objects) \
|
||||
);
|
||||
|
||||
|
||||
// Read vol fields and subset
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
PtrList<volScalarField> vScalarFlds;
|
||||
subsetFields(subsetter, availableFields, vScalarFlds);
|
||||
|
||||
PtrList<volVectorField> vVectorFlds;
|
||||
subsetFields(subsetter, availableFields, vVectorFlds);
|
||||
|
||||
PtrList<volSphericalTensorField> vSphTensorFlds;
|
||||
subsetFields(subsetter, availableFields, vSphTensorFlds);
|
||||
|
||||
PtrList<volSymmTensorField> vSymmTensorFlds;
|
||||
subsetFields(subsetter, availableFields, vSymmTensorFlds);
|
||||
|
||||
PtrList<volTensorField> vTensorFlds;
|
||||
subsetFields(subsetter, availableFields, vTensorFlds);
|
||||
|
||||
createSubsetFields(volScalarField, vScalarFlds);
|
||||
createSubsetFields(volVectorField, vVectorFlds);
|
||||
createSubsetFields(volSphericalTensorField, vSphTensorFlds);
|
||||
createSubsetFields(volSymmTensorField, vSymmTensorFlds);
|
||||
createSubsetFields(volTensorField, vTensorFlds);
|
||||
|
||||
// Read surface fields and subset
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
createSubsetFields(surfaceScalarField, sScalarFlds);
|
||||
createSubsetFields(surfaceVectorField, sVectorFlds);
|
||||
createSubsetFields(surfaceSphericalTensorField, sSphTensorFlds);
|
||||
createSubsetFields(surfaceSymmTensorField, sSymmTensorFlds);
|
||||
createSubsetFields(surfaceTensorField, sTensorFlds);
|
||||
|
||||
PtrList<surfaceScalarField> sScalarFlds;
|
||||
subsetFields(subsetter, availableFields, sScalarFlds);
|
||||
|
||||
PtrList<surfaceVectorField> sVectorFlds;
|
||||
subsetFields(subsetter, availableFields, sVectorFlds);
|
||||
|
||||
PtrList<surfaceSphericalTensorField> sSphTensorFlds;
|
||||
subsetFields(subsetter, availableFields, sSphTensorFlds);
|
||||
|
||||
PtrList<surfaceSymmTensorField> sSymmTensorFlds;
|
||||
subsetFields(subsetter, availableFields, sSymmTensorFlds);
|
||||
|
||||
PtrList<surfaceTensorField> sTensorFlds;
|
||||
subsetFields(subsetter, availableFields, sTensorFlds);
|
||||
// Read dimensioned fields and subset
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
createSubsetFields(volScalarField::Internal, dScalarFlds);
|
||||
createSubsetFields(volVectorField::Internal, dVectorFlds);
|
||||
createSubsetFields(volSphericalTensorField::Internal, dSphTensorFlds);
|
||||
createSubsetFields(volSymmTensorField::Internal, dSymmTensorFlds);
|
||||
createSubsetFields(volTensorField::Internal, dTensorFlds);
|
||||
|
||||
|
||||
// Read point fields and subset
|
||||
@ -623,39 +572,20 @@ int main(int argc, char *argv[])
|
||||
|
||||
const pointMesh& pMesh = pointMesh::New(mesh);
|
||||
|
||||
PtrList<pointScalarField> pScalarFlds;
|
||||
subsetPointFields(subsetter, pMesh, availableFields, pScalarFlds);
|
||||
#undef createSubsetFields
|
||||
#define createSubsetFields(FieldType, Variable) \
|
||||
PtrList<FieldType> Variable \
|
||||
( \
|
||||
subsetFields<FieldType>(subsetter, objects, pMesh) \
|
||||
);
|
||||
|
||||
PtrList<pointVectorField> pVectorFlds;
|
||||
subsetPointFields(subsetter, pMesh, availableFields, pVectorFlds);
|
||||
createSubsetFields(pointScalarField, pScalarFlds);
|
||||
createSubsetFields(pointVectorField, pVectorFlds);
|
||||
createSubsetFields(pointSphericalTensorField, pSphTensorFlds);
|
||||
createSubsetFields(pointSymmTensorField, pSymmTensorFlds);
|
||||
createSubsetFields(pointTensorField, pTensorFlds);
|
||||
|
||||
PtrList<pointSphericalTensorField> pSphTensorFlds;
|
||||
subsetPointFields(subsetter, pMesh, availableFields, pSphTensorFlds);
|
||||
|
||||
PtrList<pointSymmTensorField> pSymmTensorFlds;
|
||||
subsetPointFields(subsetter, pMesh, availableFields, pSymmTensorFlds);
|
||||
|
||||
PtrList<pointTensorField> pTensorFlds;
|
||||
subsetPointFields(subsetter, pMesh, availableFields, pTensorFlds);
|
||||
|
||||
|
||||
// Read dimensioned fields and subset
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
PtrList<volScalarField::Internal> dScalarFlds;
|
||||
subsetDimensionedFields(subsetter, availableFields, dScalarFlds);
|
||||
|
||||
PtrList<volVectorField::Internal> dVectorFlds;
|
||||
subsetDimensionedFields(subsetter, availableFields, dVectorFlds);
|
||||
|
||||
PtrList<volSphericalTensorField::Internal> dSphTensorFlds;
|
||||
subsetDimensionedFields(subsetter, availableFields, dSphTensorFlds);
|
||||
|
||||
PtrList<volSymmTensorField::Internal> dSymmTensorFlds;
|
||||
subsetDimensionedFields(subsetter, availableFields, dSymmTensorFlds);
|
||||
|
||||
PtrList<volTensorField::Internal> dTensorFlds;
|
||||
subsetDimensionedFields(subsetter, availableFields, dTensorFlds);
|
||||
#undef createSubsetFields
|
||||
|
||||
|
||||
// Read topoSets and subset
|
||||
@ -735,13 +665,6 @@ int main(int argc, char *argv[])
|
||||
for (const auto& fld : sSymmTensorFlds) { fld.write(); }
|
||||
for (const auto& fld : sTensorFlds) { fld.write(); }
|
||||
|
||||
// Point fields
|
||||
for (const auto& fld : pScalarFlds) { fld.write(); }
|
||||
for (const auto& fld : pVectorFlds) { fld.write(); }
|
||||
for (const auto& fld : pSphTensorFlds) { fld.write(); }
|
||||
for (const auto& fld : pSymmTensorFlds) { fld.write(); }
|
||||
for (const auto& fld : pTensorFlds) { fld.write(); }
|
||||
|
||||
// Dimensioned fields
|
||||
for (const auto& fld : dScalarFlds) { fld.write(); }
|
||||
for (const auto& fld : dVectorFlds) { fld.write(); }
|
||||
@ -749,6 +672,13 @@ int main(int argc, char *argv[])
|
||||
for (const auto& fld : dSymmTensorFlds) { fld.write(); }
|
||||
for (const auto& fld : dTensorFlds) { fld.write(); }
|
||||
|
||||
// Point fields
|
||||
for (const auto& fld : pScalarFlds) { fld.write(); }
|
||||
for (const auto& fld : pVectorFlds) { fld.write(); }
|
||||
for (const auto& fld : pSphTensorFlds) { fld.write(); }
|
||||
for (const auto& fld : pSymmTensorFlds) { fld.write(); }
|
||||
for (const auto& fld : pTensorFlds) { fld.write(); }
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -89,50 +90,41 @@ int main(int argc, char *argv[])
|
||||
<< endl;
|
||||
}
|
||||
|
||||
const wordList objNames
|
||||
(
|
||||
IOobjectList(mesh, runTime.timeName()).sortedNames()
|
||||
const IOobjectList objects(mesh, runTime.timeName());
|
||||
|
||||
Info<< "Reading fields:" << endl;
|
||||
|
||||
// Read fields
|
||||
#undef createFields
|
||||
#define createFields(FieldType, Variable) \
|
||||
PtrList<FieldType> Variable \
|
||||
( \
|
||||
readFields<FieldType>(objects, mesh) \
|
||||
);
|
||||
|
||||
PtrList<volScalarField> vsf(objNames.size());
|
||||
PtrList<volVectorField> vvf(objNames.size());
|
||||
PtrList<volSphericalTensorField> vsptf(objNames.size());
|
||||
PtrList<volSymmTensorField> vsytf(objNames.size());
|
||||
PtrList<volTensorField> vtf(objNames.size());
|
||||
createFields(volScalarField, vsf);
|
||||
createFields(volVectorField, vvf);
|
||||
createFields(volSphericalTensorField, vsptf);
|
||||
createFields(volSymmTensorField, vsytf);
|
||||
createFields(volTensorField, vtf);
|
||||
|
||||
PtrList<pointScalarField> psf(objNames.size());
|
||||
PtrList<pointVectorField> pvf(objNames.size());
|
||||
PtrList<pointSphericalTensorField> psptf(objNames.size());
|
||||
PtrList<pointSymmTensorField> psytf(objNames.size());
|
||||
PtrList<pointTensorField> ptf(objNames.size());
|
||||
// Point fields
|
||||
const pointMesh& pMesh = pointMesh::New(mesh);
|
||||
|
||||
Info<< "Valid fields:" << endl;
|
||||
#undef createFields
|
||||
#define createFields(FieldType, Variable) \
|
||||
PtrList<FieldType> Variable \
|
||||
( \
|
||||
readFields<FieldType>(objects, pMesh) \
|
||||
);
|
||||
|
||||
forAll(objNames, objI)
|
||||
{
|
||||
IOobject obj
|
||||
(
|
||||
objNames[objI],
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
createFields(pointScalarField, psf);
|
||||
createFields(pointVectorField, pvf);
|
||||
createFields(pointSphericalTensorField, psptf);
|
||||
createFields(pointSymmTensorField, psytf);
|
||||
createFields(pointTensorField, ptf);
|
||||
|
||||
if (obj.typeHeaderOk<volScalarField>(false))
|
||||
{
|
||||
addToFieldList(vsf, obj, objI, mesh);
|
||||
addToFieldList(vvf, obj, objI, mesh);
|
||||
addToFieldList(vsptf, obj, objI, mesh);
|
||||
addToFieldList(vsytf, obj, objI, mesh);
|
||||
addToFieldList(vtf, obj, objI, mesh);
|
||||
|
||||
addToFieldList(psf, obj, objI, pointMesh::New(mesh));
|
||||
addToFieldList(pvf, obj, objI, pointMesh::New(mesh));
|
||||
addToFieldList(psptf, obj, objI, pointMesh::New(mesh));
|
||||
addToFieldList(psytf, obj, objI, pointMesh::New(mesh));
|
||||
addToFieldList(ptf, obj, objI, pointMesh::New(mesh));
|
||||
}
|
||||
}
|
||||
#undef createFields
|
||||
|
||||
Info<< endl;
|
||||
|
||||
@ -144,6 +136,7 @@ int main(int argc, char *argv[])
|
||||
forAll(bm, patchi)
|
||||
{
|
||||
Info<< bm[patchi].type() << "\t: " << bm[patchi].name() << nl;
|
||||
|
||||
outputFieldList(vsf, patchi);
|
||||
outputFieldList(vvf, patchi);
|
||||
outputFieldList(vsptf, patchi);
|
||||
@ -167,6 +160,7 @@ int main(int argc, char *argv[])
|
||||
DynamicList<HashTable<word>> fieldToTypes(bm.size());
|
||||
// Per 'group' the patches
|
||||
DynamicList<DynamicList<label>> groupToPatches(bm.size());
|
||||
|
||||
forAll(bm, patchi)
|
||||
{
|
||||
HashTable<word> fieldToType;
|
||||
@ -208,40 +202,39 @@ int main(int argc, char *argv[])
|
||||
labelHashSet nonGroupPatches;
|
||||
bm.matchGroups(patchIDs, groups, nonGroupPatches);
|
||||
|
||||
const labelList sortedPatches(nonGroupPatches.sortedToc());
|
||||
forAll(sortedPatches, i)
|
||||
for (const label patchi : nonGroupPatches.sortedToc())
|
||||
{
|
||||
Info<< bm[sortedPatches[i]].type()
|
||||
<< "\t: " << bm[sortedPatches[i]].name() << nl;
|
||||
Info<< bm[patchi].type()
|
||||
<< "\t: " << bm[patchi].name() << nl;
|
||||
}
|
||||
if (groups.size())
|
||||
for (const word& groupName : groups)
|
||||
{
|
||||
forAll(groups, i)
|
||||
{
|
||||
Info<< "group\t: " << groups[i] << nl;
|
||||
}
|
||||
Info<< "group\t: " << groupName << nl;
|
||||
}
|
||||
outputFieldList(vsf, patchIDs[0]);
|
||||
outputFieldList(vvf, patchIDs[0]);
|
||||
outputFieldList(vsptf, patchIDs[0]);
|
||||
outputFieldList(vsytf, patchIDs[0]);
|
||||
outputFieldList(vtf, patchIDs[0]);
|
||||
|
||||
outputFieldList(psf, patchIDs[0]);
|
||||
outputFieldList(pvf, patchIDs[0]);
|
||||
outputFieldList(psptf, patchIDs[0]);
|
||||
outputFieldList(psytf, patchIDs[0]);
|
||||
outputFieldList(ptf, patchIDs[0]);
|
||||
const label patchi = patchIDs[0];
|
||||
|
||||
outputFieldList(vsf, patchi);
|
||||
outputFieldList(vvf, patchi);
|
||||
outputFieldList(vsptf, patchi);
|
||||
outputFieldList(vsytf, patchi);
|
||||
outputFieldList(vtf, patchi);
|
||||
|
||||
outputFieldList(psf, patchi);
|
||||
outputFieldList(pvf, patchi);
|
||||
outputFieldList(psptf, patchi);
|
||||
outputFieldList(psytf, patchi);
|
||||
outputFieldList(ptf, patchi);
|
||||
Info<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No group.
|
||||
forAll(patchIDs, i)
|
||||
for (const label patchi : patchIDs)
|
||||
{
|
||||
label patchi = patchIDs[i];
|
||||
Info<< bm[patchi].type()
|
||||
<< "\t: " << bm[patchi].name() << nl;
|
||||
|
||||
outputFieldList(vsf, patchi);
|
||||
outputFieldList(vvf, patchi);
|
||||
outputFieldList(vsptf, patchi);
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,30 +32,49 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class GeoField>
|
||||
void Foam::addToFieldList
|
||||
Foam::PtrList<GeoField> Foam::readFields
|
||||
(
|
||||
PtrList<GeoField>& fieldList,
|
||||
const IOobject& obj,
|
||||
const label fieldi,
|
||||
const IOobjectList& objects,
|
||||
const typename GeoField::Mesh& mesh
|
||||
)
|
||||
{
|
||||
if (obj.isHeaderClass<GeoField>())
|
||||
const UPtrList<const IOobject> fieldObjects
|
||||
(
|
||||
objects.csorted<GeoField>()
|
||||
);
|
||||
|
||||
PtrList<GeoField> fields(fieldObjects.size());
|
||||
|
||||
label nFields = 0;
|
||||
for (const IOobject& io : fieldObjects)
|
||||
{
|
||||
fieldList.set
|
||||
(
|
||||
fieldi,
|
||||
new GeoField(obj, mesh)
|
||||
);
|
||||
Info<< " " << GeoField::typeName << tab << obj.name() << endl;
|
||||
if (!nFields)
|
||||
{
|
||||
Info<< " " << GeoField::typeName << " (";
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< ' ';
|
||||
}
|
||||
Info<< io.name();
|
||||
|
||||
fields.emplace_set(nFields, io, mesh);
|
||||
++nFields;
|
||||
}
|
||||
|
||||
if (nFields)
|
||||
{
|
||||
Info<< ')' << nl;
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
|
||||
template<class GeoField>
|
||||
void Foam::outputFieldList
|
||||
(
|
||||
const PtrList<GeoField>& fieldList,
|
||||
const UPtrList<GeoField>& fieldList,
|
||||
const label patchi
|
||||
)
|
||||
{
|
||||
@ -74,7 +94,7 @@ void Foam::outputFieldList
|
||||
template<class GeoField>
|
||||
void Foam::collectFieldList
|
||||
(
|
||||
const PtrList<GeoField>& fieldList,
|
||||
const UPtrList<GeoField>& fieldList,
|
||||
const label patchi,
|
||||
HashTable<word>& fieldToType
|
||||
)
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,39 +26,39 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef patchSummaryTemplates_H
|
||||
#define patchSummaryTemplates_H
|
||||
#ifndef Foam_patchSummaryTemplates_H
|
||||
#define Foam_patchSummaryTemplates_H
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "volFields.H"
|
||||
#include "IOobjectList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<class GeoField>
|
||||
void addToFieldList
|
||||
(
|
||||
PtrList<GeoField>& fieldList,
|
||||
const IOobject& obj,
|
||||
const label fieldi,
|
||||
const typename GeoField::Mesh& mesh
|
||||
);
|
||||
|
||||
template<class GeoField>
|
||||
void outputFieldList
|
||||
(
|
||||
const PtrList<GeoField>& fieldList,
|
||||
const label patchi
|
||||
);
|
||||
template<class GeoField>
|
||||
PtrList<GeoField> readFields
|
||||
(
|
||||
const IOobjectList& objects,
|
||||
const typename GeoField::Mesh& mesh
|
||||
);
|
||||
|
||||
template<class GeoField>
|
||||
void outputFieldList
|
||||
(
|
||||
const UPtrList<GeoField>& fieldList,
|
||||
const label patchi
|
||||
);
|
||||
|
||||
template<class GeoField>
|
||||
void collectFieldList
|
||||
(
|
||||
const UPtrList<GeoField>& fieldList,
|
||||
const label patchi,
|
||||
HashTable<word>& fieldToType
|
||||
);
|
||||
|
||||
template<class GeoField>
|
||||
void collectFieldList
|
||||
(
|
||||
const PtrList<GeoField>& fieldList,
|
||||
const label patchi,
|
||||
HashTable<word>& fieldToType
|
||||
);
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -186,26 +186,17 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
|
||||
{
|
||||
// Read sets
|
||||
IOobjectList objects(*this, facesInstance(), "polyMesh/sets");
|
||||
for (const IOobject& io : objects.csorted<cellSet>())
|
||||
{
|
||||
IOobjectList sets(objects.lookupClass<cellSet>());
|
||||
forAllConstIters(sets, iter)
|
||||
{
|
||||
cellSets.append(new cellSet(*(iter.val())));
|
||||
}
|
||||
cellSets.emplace_back(io);
|
||||
}
|
||||
for (const IOobject& io : objects.csorted<faceSet>())
|
||||
{
|
||||
IOobjectList sets(objects.lookupClass<faceSet>());
|
||||
forAllConstIters(sets, iter)
|
||||
{
|
||||
faceSets.append(new faceSet(*(iter.val())));
|
||||
}
|
||||
faceSets.emplace_back(io);
|
||||
}
|
||||
for (const IOobject& io : objects.csorted<pointSet>())
|
||||
{
|
||||
IOobjectList sets(objects.lookupClass<pointSet>());
|
||||
forAllConstIters(sets, iter)
|
||||
{
|
||||
pointSets.append(new pointSet(*(iter.val())));
|
||||
}
|
||||
pointSets.emplace_back(io);
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,9 +210,9 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
|
||||
facesInstance(),
|
||||
polyMesh::meshSubDir,
|
||||
*this,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
IOobjectOption::READ_IF_PRESENT,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -597,19 +597,19 @@ int main(int argc, char *argv[])
|
||||
polyMesh::meshSubDir/"sets"
|
||||
);
|
||||
|
||||
for (const word& setName : objects.sortedNames<cellSet>())
|
||||
for (const IOobject& io : objects.csorted<cellSet>())
|
||||
{
|
||||
cSetNames.insert(setName, cSetNames.size());
|
||||
cSetNames.insert(io.name(), cSetNames.size());
|
||||
}
|
||||
|
||||
for (const word& setName : objects.sortedNames<faceSet>())
|
||||
for (const IOobject& io : objects.csorted<faceSet>())
|
||||
{
|
||||
fSetNames.insert(setName, fSetNames.size());
|
||||
fSetNames.insert(io.name(), fSetNames.size());
|
||||
}
|
||||
|
||||
for (const word& setName : objects.sortedNames<pointSet>())
|
||||
for (const IOobject& io : objects.csorted<pointSet>())
|
||||
{
|
||||
pSetNames.insert(setName, pSetNames.size());
|
||||
pSetNames.insert(io.name(), pSetNames.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -405,20 +405,20 @@ Foam::label Foam::parFvFieldDistributor::distributeInternalFields
|
||||
{
|
||||
typedef DimensionedField<Type, volMesh> fieldType;
|
||||
|
||||
// Available fields, sorted order
|
||||
const wordList fieldNames =
|
||||
(
|
||||
selectedFields.empty()
|
||||
? objects.sortedNames<fieldType>()
|
||||
: objects.sortedNames<fieldType>(selectedFields)
|
||||
);
|
||||
|
||||
label nFields = 0;
|
||||
for (const word& fieldName : fieldNames)
|
||||
for
|
||||
(
|
||||
const IOobject& io :
|
||||
(
|
||||
selectedFields.empty()
|
||||
? objects.csorted<fieldType>()
|
||||
: objects.csorted<fieldType>(selectedFields)
|
||||
)
|
||||
)
|
||||
{
|
||||
if ("cellDist" == fieldName)
|
||||
if ("cellDist" == io.name())
|
||||
{
|
||||
// There is an odd chance this is an internal field
|
||||
// Ignore cellDist (internal or volume) field
|
||||
continue;
|
||||
}
|
||||
if (verbose_)
|
||||
@ -428,13 +428,13 @@ Foam::label Foam::parFvFieldDistributor::distributeInternalFields
|
||||
Info<< " Reconstructing "
|
||||
<< fieldType::typeName << "s\n" << nl;
|
||||
}
|
||||
Info<< " " << fieldName << nl;
|
||||
Info<< " " << io.name() << nl;
|
||||
}
|
||||
++nFields;
|
||||
|
||||
tmp<fieldType> tfld
|
||||
(
|
||||
distributeInternalField<Type>(*(objects[fieldName]))
|
||||
distributeInternalField<Type>(io)
|
||||
);
|
||||
|
||||
if (isWriteProc_.good())
|
||||
@ -470,19 +470,20 @@ Foam::label Foam::parFvFieldDistributor::distributeVolumeFields
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||
|
||||
// Available fields, sorted order
|
||||
const wordList fieldNames =
|
||||
(
|
||||
selectedFields.empty()
|
||||
? objects.sortedNames<fieldType>()
|
||||
: objects.sortedNames<fieldType>(selectedFields)
|
||||
);
|
||||
|
||||
label nFields = 0;
|
||||
for (const word& fieldName : fieldNames)
|
||||
for
|
||||
(
|
||||
const IOobject& io :
|
||||
(
|
||||
selectedFields.empty()
|
||||
? objects.csorted<fieldType>()
|
||||
: objects.csorted<fieldType>(selectedFields)
|
||||
)
|
||||
)
|
||||
{
|
||||
if ("cellDist" == fieldName)
|
||||
if ("cellDist" == io.name())
|
||||
{
|
||||
// Ignore cellDist (internal or volume) field
|
||||
continue;
|
||||
}
|
||||
if (verbose_)
|
||||
@ -492,13 +493,13 @@ Foam::label Foam::parFvFieldDistributor::distributeVolumeFields
|
||||
Info<< " Reconstructing "
|
||||
<< fieldType::typeName << "s\n" << nl;
|
||||
}
|
||||
Info<< " " << fieldName << nl;
|
||||
Info<< " " << io.name() << nl;
|
||||
}
|
||||
++nFields;
|
||||
|
||||
tmp<fieldType> tfld
|
||||
(
|
||||
distributeVolumeField<Type>(*(objects[fieldName]))
|
||||
distributeVolumeField<Type>(io)
|
||||
);
|
||||
|
||||
if (isWriteProc_.good())
|
||||
@ -534,16 +535,16 @@ Foam::label Foam::parFvFieldDistributor::distributeSurfaceFields
|
||||
{
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> fieldType;
|
||||
|
||||
// Available fields, sorted order
|
||||
const wordList fieldNames =
|
||||
(
|
||||
selectedFields.empty()
|
||||
? objects.sortedNames<fieldType>()
|
||||
: objects.sortedNames<fieldType>(selectedFields)
|
||||
);
|
||||
|
||||
label nFields = 0;
|
||||
for (const word& fieldName : fieldNames)
|
||||
for
|
||||
(
|
||||
const IOobject& io :
|
||||
(
|
||||
selectedFields.empty()
|
||||
? objects.csorted<fieldType>()
|
||||
: objects.csorted<fieldType>(selectedFields)
|
||||
)
|
||||
)
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
@ -552,13 +553,13 @@ Foam::label Foam::parFvFieldDistributor::distributeSurfaceFields
|
||||
Info<< " Reconstructing "
|
||||
<< fieldType::typeName << "s\n" << nl;
|
||||
}
|
||||
Info<< " " << fieldName << nl;
|
||||
Info<< " " << io.name() << nl;
|
||||
}
|
||||
++nFields;
|
||||
|
||||
tmp<fieldType> tfld
|
||||
(
|
||||
distributeSurfaceField<Type>(*(objects[fieldName]))
|
||||
distributeSurfaceField<Type>(io)
|
||||
);
|
||||
|
||||
if (isWriteProc_.good())
|
||||
|
||||
@ -82,7 +82,7 @@ void Foam::parLagrangianDistributor::findClouds
|
||||
)
|
||||
);
|
||||
|
||||
cloudNames.setSize(localCloudDirs.size());
|
||||
cloudNames.resize_nocopy(localCloudDirs.size());
|
||||
forAll(localCloudDirs, i)
|
||||
{
|
||||
cloudNames[i] = localCloudDirs[i];
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -324,18 +324,11 @@ Foam::label Foam::parLagrangianDistributor::distributeStoredFields
|
||||
passivePositionParticleCloud& cloud
|
||||
) const
|
||||
{
|
||||
HashTable<Container*> fields
|
||||
(
|
||||
cloud.lookupClass<Container>()
|
||||
);
|
||||
|
||||
bool reconstruct = false;
|
||||
|
||||
label nFields = 0;
|
||||
forAllIters(fields, iter)
|
||||
{
|
||||
Container& field = *(iter.val());
|
||||
|
||||
for (Container& field : cloud.sorted<Container>())
|
||||
{
|
||||
if (!nFields)
|
||||
{
|
||||
// Performing an all-to-one (reconstruct)?
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -105,8 +106,9 @@ int main(int argc, char *argv[])
|
||||
"foamDataToFluentDict",
|
||||
runTime.system(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
)
|
||||
);
|
||||
|
||||
@ -115,44 +117,21 @@ int main(int argc, char *argv[])
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
|
||||
|
||||
// volScalarField
|
||||
for (const word& fieldName : objects.sortedNames<volScalarField>())
|
||||
{
|
||||
// Lookup field from dictionary and convert field
|
||||
label unitNumber;
|
||||
if
|
||||
(
|
||||
foamDataToFluentDict.readIfPresent(fieldName, unitNumber)
|
||||
&& unitNumber > 0
|
||||
)
|
||||
{
|
||||
// Read field
|
||||
volScalarField field(*(objects[fieldName]), mesh);
|
||||
readFieldsAndWriteFluent<volScalarField>
|
||||
(
|
||||
foamDataToFluentDict,
|
||||
objects,
|
||||
mesh,
|
||||
fluentDataFile
|
||||
);
|
||||
|
||||
Info<< " Converting field " << fieldName << nl;
|
||||
writeFluentField(field, unitNumber, fluentDataFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// volVectorField
|
||||
for (const word& fieldName : objects.sortedNames<volVectorField>())
|
||||
{
|
||||
// Lookup field from dictionary and convert field
|
||||
label unitNumber;
|
||||
if
|
||||
(
|
||||
foamDataToFluentDict.readIfPresent(fieldName, unitNumber)
|
||||
&& unitNumber > 0
|
||||
)
|
||||
{
|
||||
// Read field
|
||||
volVectorField field(*(objects[fieldName]), mesh);
|
||||
|
||||
Info<< " Converting field " << fieldName << nl;
|
||||
writeFluentField(field, unitNumber, fluentDataFile);
|
||||
}
|
||||
}
|
||||
readFieldsAndWriteFluent<volVectorField>
|
||||
(
|
||||
foamDataToFluentDict,
|
||||
objects,
|
||||
mesh,
|
||||
fluentDataFile
|
||||
);
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
@ -28,10 +28,12 @@ InClass
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef writeFluentFields_H
|
||||
#define writeFluentFields_H
|
||||
#ifndef Foam_writeFluentFields_H
|
||||
#define Foam_writeFluentFields_H
|
||||
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "Ostream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -43,16 +45,48 @@ void writeFluentField
|
||||
(
|
||||
const volScalarField& phi,
|
||||
const label fluentFieldIdentifier,
|
||||
Ostream& stream
|
||||
Ostream& os
|
||||
);
|
||||
|
||||
void writeFluentField
|
||||
(
|
||||
const volVectorField& phi,
|
||||
const label fluentFieldIdentifier,
|
||||
Ostream& stream
|
||||
Ostream& os
|
||||
);
|
||||
|
||||
|
||||
template<class GeoField>
|
||||
void readFieldsAndWriteFluent
|
||||
(
|
||||
const dictionary& dict,
|
||||
const IOobjectList& objects,
|
||||
const fvMesh& mesh,
|
||||
Ostream& os
|
||||
)
|
||||
{
|
||||
for (const IOobject& io : objects.csorted<GeoField>())
|
||||
{
|
||||
// Lookup field from dictionary and convert field
|
||||
const word& fieldName = io.name();
|
||||
label unitNumber;
|
||||
if
|
||||
(
|
||||
dict.readIfPresent(fieldName, unitNumber)
|
||||
&& unitNumber > 0
|
||||
)
|
||||
{
|
||||
// Read field
|
||||
GeoField field(io, mesh);
|
||||
|
||||
Info<< " Converting field " << fieldName << nl;
|
||||
writeFluentField(field, unitNumber, os);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,12 +36,7 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void writeFluentField
|
||||
void Foam::writeFluentField
|
||||
(
|
||||
const volScalarField& phi,
|
||||
const label fluentFieldIdentifier,
|
||||
@ -58,15 +54,15 @@ void writeFluentField
|
||||
<< "1 " // Number of components (scalar=1, vector=3)
|
||||
<< "0 0 " // Unused
|
||||
<< "1 " << phiInternal.size() // Start and end of list
|
||||
<< ")(" << endl;
|
||||
<< ")(" << nl;
|
||||
|
||||
forAll(phiInternal, celli)
|
||||
for (const scalar val : phiInternal)
|
||||
{
|
||||
stream << phiInternal[celli] << endl;
|
||||
stream << val << nl;
|
||||
}
|
||||
|
||||
stream
|
||||
<< "))" << endl;
|
||||
<< "))" << nl;
|
||||
|
||||
label nWrittenFaces = phiInternal.size();
|
||||
|
||||
@ -92,13 +88,13 @@ void writeFluentField
|
||||
<< "0 0 " // Unused
|
||||
<< nWrittenFaces + 1 << " "
|
||||
<< nWrittenFaces + emptyFaceCells.size()// Start and end of list
|
||||
<< ")(" << endl;
|
||||
<< ")(" << nl;
|
||||
|
||||
nWrittenFaces += emptyFaceCells.size();
|
||||
|
||||
forAll(emptyFaceCells, facei)
|
||||
{
|
||||
stream << phiInternal[emptyFaceCells[facei]] << endl;
|
||||
stream << phiInternal[emptyFaceCells[facei]] << nl;
|
||||
}
|
||||
|
||||
stream
|
||||
@ -120,13 +116,13 @@ void writeFluentField
|
||||
<< "0 0 " // Unused
|
||||
<< nWrittenFaces + 1 << " " << nWrittenFaces + patchPhi.size()
|
||||
// Start and end of list
|
||||
<< ")(" << endl;
|
||||
<< ")(" << nl;
|
||||
|
||||
nWrittenFaces += patchPhi.size();
|
||||
|
||||
forAll(patchPhi, facei)
|
||||
for (const scalar val : patchPhi)
|
||||
{
|
||||
stream << patchPhi[facei] << endl;
|
||||
stream << val << nl;
|
||||
}
|
||||
|
||||
stream
|
||||
@ -136,8 +132,4 @@ void writeFluentField
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,12 +35,7 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void writeFluentField
|
||||
void Foam::writeFluentField
|
||||
(
|
||||
const volVectorField& phi,
|
||||
const label fluentFieldIdentifier,
|
||||
@ -57,19 +53,16 @@ void writeFluentField
|
||||
<< "3 " // Number of components (scalar=1, vector=3)
|
||||
<< "0 0 " // Unused
|
||||
<< "1 " << phiInternal.size() // Start and end of list
|
||||
<< ")(" << endl;
|
||||
<< ")(" << nl;
|
||||
|
||||
forAll(phiInternal, celli)
|
||||
for (const vector& val : phiInternal)
|
||||
{
|
||||
stream
|
||||
<< phiInternal[celli].x() << " "
|
||||
<< phiInternal[celli].y() << " "
|
||||
<< phiInternal[celli].z() << " "
|
||||
<< endl;
|
||||
<< val.x() << ' ' << val.y() << ' ' << val.z() << nl;
|
||||
}
|
||||
|
||||
stream
|
||||
<< "))" << endl;
|
||||
<< "))" << nl;
|
||||
|
||||
label nWrittenFaces = phiInternal.size();
|
||||
|
||||
@ -87,17 +80,14 @@ void writeFluentField
|
||||
<< "0 0 " // Unused
|
||||
<< nWrittenFaces + 1 << " " << nWrittenFaces + patchPhi.size()
|
||||
// Start and end of list
|
||||
<< ")(" << endl;
|
||||
<< ")(" << nl;
|
||||
|
||||
nWrittenFaces += patchPhi.size();
|
||||
|
||||
forAll(patchPhi, facei)
|
||||
for (const vector& val : patchPhi)
|
||||
{
|
||||
stream
|
||||
<< patchPhi[facei].x() << " "
|
||||
<< patchPhi[facei].y() << " "
|
||||
<< patchPhi[facei].z() << " "
|
||||
<< endl;
|
||||
<< val.x() << ' ' << val.y() << ' ' << val.z() << nl;
|
||||
}
|
||||
|
||||
stream
|
||||
@ -106,6 +96,4 @@ void writeFluentField
|
||||
}
|
||||
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -28,9 +28,9 @@ forAll(meshes, regioni)
|
||||
|
||||
IOobjectList objects(0);
|
||||
|
||||
if (doConvertFields)
|
||||
if (doConvertFields && !timeDirs.empty())
|
||||
{
|
||||
objects = IOobjectList(mesh, timeDirs.last().name());
|
||||
objects = IOobjectList(mesh, timeDirs.back().name());
|
||||
|
||||
if (fieldSelector && !fieldSelector().empty())
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,18 +35,30 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef readFields_H
|
||||
#define readFields_H
|
||||
#ifndef ensight_readFields_H
|
||||
#define ensight_readFields_H
|
||||
|
||||
#include "instantList.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "fvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
//- Get the field or FatalError
|
||||
template<class GeoField>
|
||||
tmp<GeoField> getField
|
||||
(
|
||||
const IOobject& io,
|
||||
const typename GeoField::Mesh& mesh
|
||||
)
|
||||
{
|
||||
return tmp<GeoField>::New(io, mesh);
|
||||
}
|
||||
|
||||
|
||||
//- Get the field or return nullptr
|
||||
template<class GeoField>
|
||||
tmp<GeoField> getField
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -72,7 +72,7 @@ label writeAreaFields
|
||||
|
||||
label count = 0;
|
||||
|
||||
for (const word& fieldName : objects.sortedNames<FieldType>())
|
||||
for (const IOobject& io : objects.csorted<FieldType>())
|
||||
{
|
||||
if
|
||||
(
|
||||
@ -80,11 +80,11 @@ label writeAreaFields
|
||||
(
|
||||
ensCase,
|
||||
ensMesh,
|
||||
getField<FieldType>(objects.findObject(fieldName), mesh)
|
||||
getField<FieldType>(io, mesh)
|
||||
)
|
||||
)
|
||||
{
|
||||
Info<< ' ' << fieldName;
|
||||
Info<< ' ' << io.name();
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -69,7 +69,7 @@ label writeDimFields
|
||||
|
||||
label count = 0;
|
||||
|
||||
for (const word& fieldName : objects.sortedNames<FieldType>())
|
||||
for (const IOobject& io : objects.csorted<FieldType>())
|
||||
{
|
||||
if
|
||||
(
|
||||
@ -77,11 +77,11 @@ label writeDimFields
|
||||
(
|
||||
ensCase,
|
||||
ensMesh,
|
||||
getField<FieldType>(objects.findObject(fieldName), mesh)
|
||||
getField<FieldType>(io, mesh)
|
||||
)
|
||||
)
|
||||
{
|
||||
Info<< ' ' << fieldName;
|
||||
Info<< ' ' << io.name();
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -70,11 +70,11 @@ label writePointFields
|
||||
{
|
||||
typedef PointField<Type> FieldType;
|
||||
|
||||
const pointMesh& ptMesh = pointMesh::New(ensMesh.mesh());
|
||||
const pointMesh& pMesh = pointMesh::New(ensMesh.mesh());
|
||||
|
||||
label count = 0;
|
||||
|
||||
for (const word& fieldName : objects.sortedNames<FieldType>())
|
||||
for (const IOobject& io : objects.csorted<FieldType>())
|
||||
{
|
||||
if
|
||||
(
|
||||
@ -82,11 +82,11 @@ label writePointFields
|
||||
(
|
||||
ensCase,
|
||||
ensMesh,
|
||||
getField<FieldType>(ptMesh, objects, fieldName)
|
||||
getField<FieldType>(io, pMesh)
|
||||
)
|
||||
)
|
||||
{
|
||||
Info<< ' ' << fieldName;
|
||||
Info<< ' ' << io.name();
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -92,7 +92,7 @@ label writeVolFields
|
||||
|
||||
label count = 0;
|
||||
|
||||
for (const word& fieldName : objects.sortedNames<FieldType>())
|
||||
for (const IOobject& io : objects.csorted<FieldType>())
|
||||
{
|
||||
if
|
||||
(
|
||||
@ -100,12 +100,12 @@ label writeVolFields
|
||||
(
|
||||
ensCase,
|
||||
ensMesh,
|
||||
getField<FieldType>(objects.findObject(fieldName), mesh),
|
||||
getField<FieldType>(io, mesh),
|
||||
nearCellValue
|
||||
)
|
||||
)
|
||||
{
|
||||
Info<< ' ' << fieldName;
|
||||
Info<< ' ' << io.name();
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -58,18 +59,21 @@ void ReadAndMapFields
|
||||
{
|
||||
typedef typename MappedGeoField::value_type Type;
|
||||
|
||||
// Search list of objects for wanted type
|
||||
IOobjectList fieldObjects(objects.lookupClass(ReadGeoField::typeName));
|
||||
// Objects of wanted type
|
||||
const UPtrList<const IOobject> fieldObjects
|
||||
(
|
||||
objects.csorted<ReadGeoField>()
|
||||
);
|
||||
|
||||
tetFields.setSize(fieldObjects.size());
|
||||
tetFields.resize(fieldObjects.size());
|
||||
|
||||
label i = 0;
|
||||
forAllConstIters(fieldObjects, iter)
|
||||
for (const IOobject& io : fieldObjects)
|
||||
{
|
||||
Info<< "Converting " << ReadGeoField::typeName << ' ' << iter.key()
|
||||
<< endl;
|
||||
Info<< "Converting "
|
||||
<< ReadGeoField::typeName << ' ' << io.name() << endl;
|
||||
|
||||
ReadGeoField readField(*iter(), mesh);
|
||||
ReadGeoField readField(io, mesh);
|
||||
|
||||
tetFields.set
|
||||
(
|
||||
@ -82,8 +86,8 @@ void ReadAndMapFields
|
||||
readField.instance(),
|
||||
readField.local(),
|
||||
tetDualMesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE,
|
||||
IOobjectOption::NO_READ,
|
||||
IOobjectOption::AUTO_WRITE,
|
||||
readField.registerObject()
|
||||
),
|
||||
pointMesh::New(tetDualMesh),
|
||||
|
||||
@ -79,8 +79,8 @@ Foam::tmp<GeoField> Foam::getField
|
||||
{
|
||||
// Move field to the cache
|
||||
IOobject newIO(tfield(), *cache);
|
||||
newIO.readOpt(IOobject::NO_READ);
|
||||
newIO.writeOpt(IOobject::NO_WRITE);
|
||||
newIO.readOpt(IOobjectOption::NO_READ);
|
||||
newIO.writeOpt(IOobjectOption::NO_WRITE);
|
||||
|
||||
tfield.ref().checkOut(); // Paranoid
|
||||
cache->store(new GeoField(newIO, tfield));
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -108,24 +108,12 @@ void Foam::processFields
|
||||
const IOobjectList& cloudObjects
|
||||
)
|
||||
{
|
||||
for (const word& fldName : cloudObjects.sortedNames<IOField<Type>>())
|
||||
for (const IOobject& io : cloudObjects.csorted<IOField<Type>>())
|
||||
{
|
||||
const IOobject* io = cloudObjects.cfindObject<IOField<Type>>(fldName);
|
||||
Info<< " reading field " << io.name() << endl;
|
||||
IOField<Type> field(io);
|
||||
|
||||
if (!io)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Could not read field:" << fldName
|
||||
<< " type:" << IOField<Type>::typeName
|
||||
<< abort(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " reading field " << fldName << endl;
|
||||
IOField<Type> field(*io);
|
||||
|
||||
writeVTKField<Type>(os, field, addr);
|
||||
}
|
||||
writeVTKField<Type>(os, field, addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -97,22 +97,24 @@ public:
|
||||
template<class GeoFieldType>
|
||||
void fieldInterpolator::interpolate()
|
||||
{
|
||||
const word& clsName = GeoFieldType::typeName;
|
||||
|
||||
const wordList fieldNames =
|
||||
label nFields = 0;
|
||||
for
|
||||
(
|
||||
selectedFields_.empty()
|
||||
? objects_.sortedNames(clsName)
|
||||
: objects_.sortedNames(clsName, selectedFields_)
|
||||
);
|
||||
|
||||
if (fieldNames.size())
|
||||
const IOobject& io :
|
||||
(
|
||||
selectedFields_.empty()
|
||||
? objects_.csorted<GeoFieldType>()
|
||||
: objects_.csorted<GeoFieldType>(selectedFields_)
|
||||
)
|
||||
)
|
||||
{
|
||||
Info<< " " << clsName << 's';
|
||||
}
|
||||
const word& fieldName = io.name();
|
||||
|
||||
if (!nFields)
|
||||
{
|
||||
Info<< " " << GeoFieldType::typeName << 's';
|
||||
}
|
||||
|
||||
for (const word& fieldName : fieldNames)
|
||||
{
|
||||
Info<< ' ' << fieldName << '(';
|
||||
|
||||
const scalar deltaT = (ti1_.value() - ti_.value())/(divisions_ + 1);
|
||||
@ -166,7 +168,7 @@ void fieldInterpolator::interpolate()
|
||||
(
|
||||
fieldName,
|
||||
runTime_.timeName(),
|
||||
objects_[fieldName]->db(),
|
||||
io.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
@ -181,9 +183,10 @@ void fieldInterpolator::interpolate()
|
||||
}
|
||||
|
||||
Info<< ')';
|
||||
++nFields;
|
||||
}
|
||||
|
||||
if (fieldNames.size()) Info<< endl;
|
||||
if (nFields) Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -285,7 +285,7 @@ void rewriteField
|
||||
fieldName,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
)
|
||||
@ -369,29 +369,7 @@ void rewriteField
|
||||
}
|
||||
|
||||
|
||||
void rewriteFields
|
||||
(
|
||||
const bool dryrun,
|
||||
const Time& runTime,
|
||||
const wordList& fieldNames,
|
||||
const HashTable<word>& thisNames,
|
||||
const HashTable<word>& nbrNames
|
||||
)
|
||||
{
|
||||
for (const word& fieldName : fieldNames)
|
||||
{
|
||||
rewriteField
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
fieldName,
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -473,9 +451,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Convert any fields
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
forAll(timeDirs, timei)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
runTime.setTime(timeDirs[timei], timei);
|
||||
|
||||
Info<< "Time: " << runTime.timeName() << endl;
|
||||
|
||||
@ -514,139 +492,44 @@ int main(int argc, char *argv[])
|
||||
entry::disableFunctionEntries = 1;
|
||||
}
|
||||
|
||||
// Rewriting of fields:
|
||||
|
||||
#undef rewriteFields
|
||||
#define rewriteFields(FieldType) \
|
||||
for (const word& fieldName : objects.sortedNames<FieldType>()) \
|
||||
{ \
|
||||
rewriteField(dryrun, runTime, fieldName, thisNames, nbrNames); \
|
||||
}
|
||||
|
||||
// volFields
|
||||
// ~~~~~~~~~
|
||||
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(volScalarField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(volVectorField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(volSphericalTensorField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(volSymmTensorField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(volTensorField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
|
||||
rewriteFields(volScalarField);
|
||||
rewriteFields(volVectorField);
|
||||
rewriteFields(volSphericalTensorField);
|
||||
rewriteFields(volSymmTensorField);
|
||||
rewriteFields(volTensorField);
|
||||
|
||||
// pointFields
|
||||
// ~~~~~~~~~~~
|
||||
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(pointScalarField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(pointVectorField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(pointSphericalTensorField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(pointSymmTensorField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(pointTensorField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields(pointScalarField);
|
||||
rewriteFields(pointVectorField);
|
||||
rewriteFields(pointSphericalTensorField);
|
||||
rewriteFields(pointSymmTensorField);
|
||||
rewriteFields(pointTensorField);
|
||||
|
||||
|
||||
// surfaceFields
|
||||
// ~~~~~~~~~~~
|
||||
// ~~~~~~~~~~~~~
|
||||
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(surfaceScalarField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(surfaceVectorField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(surfaceSphericalTensorField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(surfaceSymmTensorField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields
|
||||
(
|
||||
dryrun,
|
||||
runTime,
|
||||
objects.names(surfaceTensorField::typeName),
|
||||
thisNames,
|
||||
nbrNames
|
||||
);
|
||||
rewriteFields(surfaceScalarField);
|
||||
rewriteFields(surfaceVectorField);
|
||||
rewriteFields(surfaceSphericalTensorField);
|
||||
rewriteFields(surfaceSymmTensorField);
|
||||
rewriteFields(surfaceTensorField);
|
||||
|
||||
#undef rewriteFields
|
||||
|
||||
entry::disableFunctionEntries = oldFlag;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,23 +52,20 @@ void MapConsistentVolFields
|
||||
const fvMesh& meshSource = meshToMesh0Interp.fromMesh();
|
||||
const fvMesh& meshTarget = meshToMesh0Interp.toMesh();
|
||||
|
||||
IOobjectList fields = objects.lookupClass(fieldType::typeName);
|
||||
|
||||
forAllConstIters(fields, fieldIter)
|
||||
for (const IOobject& io : objects.csorted<fieldType>())
|
||||
{
|
||||
Info<< " interpolating " << (*fieldIter)->name()
|
||||
<< endl;
|
||||
Info<< " interpolating " << io.name() << endl;
|
||||
|
||||
// Read field. Do not auto-load old-time field
|
||||
fieldType fieldSource(*fieldIter(), meshSource, false);
|
||||
fieldType fieldSource(io, meshSource, false);
|
||||
|
||||
IOobject fieldTargetIOobject
|
||||
(
|
||||
(*fieldIter)->name(),
|
||||
io.name(),
|
||||
meshTarget.time().timeName(),
|
||||
meshTarget,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::AUTO_WRITE
|
||||
);
|
||||
|
||||
if (fieldTargetIOobject.typeHeaderOk<fieldType>(true))
|
||||
@ -90,7 +87,7 @@ void MapConsistentVolFields
|
||||
}
|
||||
else
|
||||
{
|
||||
fieldTargetIOobject.readOpt(IOobject::NO_READ);
|
||||
fieldTargetIOobject.readOpt(IOobjectOption::NO_READ);
|
||||
|
||||
// Interpolate field
|
||||
fieldType fieldTarget
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -33,8 +33,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MapLagrangianFields_H
|
||||
#define MapLagrangianFields_H
|
||||
#ifndef Foam_MapLagrangianFields_H
|
||||
#define Foam_MapLagrangianFields_H
|
||||
|
||||
#include "cloud.H"
|
||||
#include "GeometricField.H"
|
||||
@ -47,6 +47,59 @@ Description
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
//- Gets the indices of (source)particles that have been appended to the
|
||||
// target cloud and maps the lagrangian fields accordingly.
|
||||
template<class SourceIOFieldType, class TargetIOFieldType>
|
||||
void MapLagrangianFields
|
||||
(
|
||||
const string& cloudName,
|
||||
const IOobjectList& objects,
|
||||
const meshToMesh0& meshToMesh0Interp,
|
||||
const labelList& addParticles,
|
||||
const char* msg
|
||||
)
|
||||
{
|
||||
const fvMesh& meshTarget = meshToMesh0Interp.toMesh();
|
||||
|
||||
for (const IOobject& io : objects.csorted<SourceIOFieldType>())
|
||||
{
|
||||
Info<< " mapping lagrangian " << msg << ' ' << io.name() << endl;
|
||||
|
||||
// Read field (does not need mesh)
|
||||
// Note: some fieldFields are 0 size (e.g. collision records)
|
||||
// if not used, so catch any of those for Field as well
|
||||
|
||||
SourceIOFieldType fieldSource(io);
|
||||
|
||||
// Map
|
||||
TargetIOFieldType fieldTarget
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
io.name(),
|
||||
meshTarget.time().timeName(),
|
||||
cloud::prefix/cloudName,
|
||||
meshTarget,
|
||||
IOobjectOption::NO_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
min(fieldSource.size(), addParticles.size()) // handle 0 size
|
||||
);
|
||||
|
||||
if (!fieldSource.empty())
|
||||
{
|
||||
forAll(addParticles, i)
|
||||
{
|
||||
fieldTarget[i] = fieldSource[addParticles[i]];
|
||||
}
|
||||
}
|
||||
|
||||
fieldTarget.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- Gets the indices of (source)particles that have been appended to the
|
||||
// target cloud and maps the lagrangian fields accordingly.
|
||||
template<class Type>
|
||||
@ -60,119 +113,46 @@ void MapLagrangianFields
|
||||
{
|
||||
const fvMesh& meshTarget = meshToMesh0Interp.toMesh();
|
||||
|
||||
{
|
||||
IOobjectList fields = objects.lookupClass(IOField<Type>::typeName);
|
||||
MapLagrangianFields
|
||||
<
|
||||
IOField<Type>,
|
||||
IOField<Type>
|
||||
>
|
||||
(
|
||||
cloudName,
|
||||
objects,
|
||||
meshToMesh0Interp,
|
||||
addParticles,
|
||||
"Field"
|
||||
);
|
||||
|
||||
forAllConstIters(fields, fieldIter)
|
||||
{
|
||||
Info<< " mapping lagrangian field "
|
||||
<< (*fieldIter)->name() << endl;
|
||||
// Target is CompactIOField to automatically write in
|
||||
// compact form for binary format.
|
||||
MapLagrangianFields
|
||||
<
|
||||
IOField<Field<Type>>,
|
||||
CompactIOField<Field<Type>, Type>
|
||||
>
|
||||
(
|
||||
cloudName,
|
||||
objects,
|
||||
meshToMesh0Interp,
|
||||
addParticles,
|
||||
"FieldField"
|
||||
);
|
||||
|
||||
// Read field (does not need mesh)
|
||||
IOField<Type> fieldSource(*fieldIter());
|
||||
|
||||
// Map
|
||||
IOField<Type> fieldTarget
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
(*fieldIter)->name(),
|
||||
meshTarget.time().timeName(),
|
||||
cloud::prefix/cloudName,
|
||||
meshTarget,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
addParticles.size()
|
||||
);
|
||||
|
||||
forAll(addParticles, i)
|
||||
{
|
||||
fieldTarget[i] = fieldSource[addParticles[i]];
|
||||
}
|
||||
|
||||
// Write field
|
||||
fieldTarget.write();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
IOobjectList fieldFields =
|
||||
objects.lookupClass(IOField<Field<Type>>::typeName);
|
||||
|
||||
forAllConstIters(fieldFields, fieldIter)
|
||||
{
|
||||
Info<< " mapping lagrangian fieldField "
|
||||
<< (*fieldIter)->name() << endl;
|
||||
|
||||
// Read field (does not need mesh)
|
||||
IOField<Field<Type>> fieldSource(*fieldIter());
|
||||
|
||||
// Map - use CompactIOField to automatically write in
|
||||
// compact form for binary format.
|
||||
CompactIOField<Field<Type>, Type> fieldTarget
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
(*fieldIter)->name(),
|
||||
meshTarget.time().timeName(),
|
||||
cloud::prefix/cloudName,
|
||||
meshTarget,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
addParticles.size()
|
||||
);
|
||||
|
||||
forAll(addParticles, i)
|
||||
{
|
||||
fieldTarget[i] = fieldSource[addParticles[i]];
|
||||
}
|
||||
|
||||
// Write field
|
||||
fieldTarget.write();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
IOobjectList fieldFields =
|
||||
objects.lookupClass(CompactIOField<Field<Type>, Type>::typeName);
|
||||
|
||||
forAllConstIters(fieldFields, fieldIter)
|
||||
{
|
||||
Info<< " mapping lagrangian fieldField "
|
||||
<< (*fieldIter)->name() << endl;
|
||||
|
||||
// Read field (does not need mesh)
|
||||
CompactIOField<Field<Type>, Type> fieldSource(*fieldIter());
|
||||
|
||||
// Map
|
||||
CompactIOField<Field<Type>, Type> fieldTarget
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
(*fieldIter)->name(),
|
||||
meshTarget.time().timeName(),
|
||||
cloud::prefix/cloudName,
|
||||
meshTarget,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
addParticles.size()
|
||||
);
|
||||
|
||||
forAll(addParticles, i)
|
||||
{
|
||||
fieldTarget[i] = fieldSource[addParticles[i]];
|
||||
}
|
||||
|
||||
// Write field
|
||||
fieldTarget.write();
|
||||
}
|
||||
}
|
||||
MapLagrangianFields
|
||||
<
|
||||
CompactIOField<Field<Type>, Type>,
|
||||
CompactIOField<Field<Type>, Type>
|
||||
>
|
||||
(
|
||||
cloudName,
|
||||
objects,
|
||||
meshToMesh0Interp,
|
||||
addParticles,
|
||||
"FieldField"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -51,25 +52,23 @@ void MapVolFields
|
||||
const fvMesh& meshSource = meshToMesh0Interp.fromMesh();
|
||||
const fvMesh& meshTarget = meshToMesh0Interp.toMesh();
|
||||
|
||||
IOobjectList fields = objects.lookupClass(fieldType::typeName);
|
||||
|
||||
forAllConstIters(fields, fieldIter)
|
||||
for (const IOobject& io : objects.csorted<fieldType>())
|
||||
{
|
||||
IOobject fieldTargetIOobject
|
||||
(
|
||||
(*fieldIter)->name(),
|
||||
io.name(),
|
||||
meshTarget.time().timeName(),
|
||||
meshTarget,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::AUTO_WRITE
|
||||
);
|
||||
|
||||
if (fieldTargetIOobject.typeHeaderOk<fieldType>(true))
|
||||
{
|
||||
Info<< " interpolating " << (*fieldIter)->name() << endl;
|
||||
Info<< " interpolating " << io.name() << endl;
|
||||
|
||||
// Read field fieldSource. Do not auto-load old-time fields
|
||||
fieldType fieldSource(*fieldIter(), meshSource, false);
|
||||
fieldType fieldSource(io, meshSource, false);
|
||||
|
||||
// Read fieldTarget. Do not auto-load old-time fields
|
||||
fieldType fieldTarget
|
||||
|
||||
@ -40,11 +40,9 @@ namespace Foam
|
||||
template<class Type>
|
||||
void UnMapped(const IOobjectList& objects)
|
||||
{
|
||||
IOobjectList fields = objects.lookupClass(Type::typeName);
|
||||
|
||||
forAllConstIters(fields, fieldIter)
|
||||
for (const IOobject& io : objects.csorted<Type>())
|
||||
{
|
||||
mvBak((*fieldIter)->objectPath(), "unmapped");
|
||||
mvBak(io.objectPath(), "unmapped");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -33,8 +33,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MapLagrangianFields_H
|
||||
#define MapLagrangianFields_H
|
||||
#ifndef Foam_MapLagrangianFields_H
|
||||
#define Foam_MapLagrangianFields_H
|
||||
|
||||
#include "cloud.H"
|
||||
#include "GeometricField.H"
|
||||
@ -47,6 +47,63 @@ Description
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
//- Gets the indices of (source)particles that have been appended to the
|
||||
// target cloud and maps the lagrangian fields accordingly.
|
||||
template<class SourceIOFieldType, class TargetIOFieldType>
|
||||
void MapLagrangianFields
|
||||
(
|
||||
const string& cloudName,
|
||||
const IOobjectList& objects,
|
||||
const polyMesh& meshTarget,
|
||||
const labelList& addParticles,
|
||||
const char* msg
|
||||
)
|
||||
{
|
||||
for (const IOobject& io : objects.csorted<SourceIOFieldType>())
|
||||
{
|
||||
Info<< " mapping lagrangian " << msg << ' ' << io.name() << endl;
|
||||
|
||||
// Read field (does not need mesh)
|
||||
// Note: some fieldFields are 0 size (e.g. collision records)
|
||||
// if not used, so catch any of those for Field as well
|
||||
|
||||
SourceIOFieldType fieldSource(io);
|
||||
|
||||
// Map
|
||||
TargetIOFieldType fieldTarget
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
io.name(),
|
||||
meshTarget.time().timeName(),
|
||||
cloud::prefix/cloudName,
|
||||
meshTarget,
|
||||
IOobjectOption::NO_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
min(fieldSource.size(), addParticles.size()) // handle 0 size
|
||||
);
|
||||
|
||||
if (!fieldSource.empty())
|
||||
{
|
||||
forAll(addParticles, i)
|
||||
{
|
||||
fieldTarget[i] = fieldSource[addParticles[i]];
|
||||
}
|
||||
}
|
||||
else if (cloud::debug && !addParticles.empty())
|
||||
{
|
||||
Pout<< "Not mapping " << io.name()
|
||||
<< " since source size = 0 and cloud size = "
|
||||
<< addParticles.size() << endl;
|
||||
}
|
||||
|
||||
fieldTarget.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- Gets the indices of (source)particles that have been appended to the
|
||||
// target cloud and maps the lagrangian fields accordingly.
|
||||
template<class Type>
|
||||
@ -58,144 +115,46 @@ void MapLagrangianFields
|
||||
const labelList& addParticles
|
||||
)
|
||||
{
|
||||
{
|
||||
IOobjectList fields = objects.lookupClass(IOField<Type>::typeName);
|
||||
MapLagrangianFields
|
||||
<
|
||||
IOField<Type>,
|
||||
IOField<Type>
|
||||
>
|
||||
(
|
||||
cloudName,
|
||||
objects,
|
||||
meshTarget,
|
||||
addParticles,
|
||||
"Field"
|
||||
);
|
||||
|
||||
forAllConstIters(fields, fieldIter)
|
||||
{
|
||||
const word& fieldName = (*fieldIter)->name();
|
||||
// Target is CompactIOField to automatically write in
|
||||
// compact form for binary format.
|
||||
MapLagrangianFields
|
||||
<
|
||||
IOField<Field<Type>>,
|
||||
CompactIOField<Field<Type>, Type>
|
||||
>
|
||||
(
|
||||
cloudName,
|
||||
objects,
|
||||
meshTarget,
|
||||
addParticles,
|
||||
"FieldField"
|
||||
);
|
||||
|
||||
Info<< " mapping lagrangian field " << fieldName << endl;
|
||||
|
||||
// Read field (does not need mesh)
|
||||
IOField<Type> fieldSource(*fieldIter());
|
||||
|
||||
// Map
|
||||
IOField<Type> fieldTarget
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
meshTarget.time().timeName(),
|
||||
cloud::prefix/cloudName,
|
||||
meshTarget,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
addParticles.size()
|
||||
);
|
||||
|
||||
forAll(addParticles, i)
|
||||
{
|
||||
fieldTarget[i] = fieldSource[addParticles[i]];
|
||||
}
|
||||
|
||||
// Write field
|
||||
fieldTarget.write();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
IOobjectList fieldFields =
|
||||
objects.lookupClass(IOField<Field<Type>>::typeName);
|
||||
|
||||
forAllConstIters(fieldFields, fieldIter)
|
||||
{
|
||||
const word& fieldName = (*fieldIter)->name();
|
||||
|
||||
Info<< " mapping lagrangian fieldField " << fieldName << endl;
|
||||
|
||||
// Read field (does not need mesh)
|
||||
// Note: some fieldFields are 0 size (e.g. collision records) if
|
||||
// not used
|
||||
IOField<Field<Type>> fieldSource(*fieldIter());
|
||||
|
||||
// Map - use CompactIOField to automatically write in
|
||||
// compact form for binary format.
|
||||
CompactIOField<Field<Type>, Type> fieldTarget
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
meshTarget.time().timeName(),
|
||||
cloud::prefix/cloudName,
|
||||
meshTarget,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
min(fieldSource.size(), addParticles.size()) // handle 0 size
|
||||
);
|
||||
|
||||
if (fieldSource.size())
|
||||
{
|
||||
forAll(addParticles, i)
|
||||
{
|
||||
fieldTarget[i] = fieldSource[addParticles[i]];
|
||||
}
|
||||
}
|
||||
else if (cloud::debug)
|
||||
{
|
||||
Pout<< "Not mapping " << fieldName << " since source size "
|
||||
<< fieldSource.size() << " different to"
|
||||
<< " cloud size " << addParticles.size()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Write field
|
||||
fieldTarget.write();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
IOobjectList fieldFields =
|
||||
objects.lookupClass(CompactIOField<Field<Type>, Type>::typeName);
|
||||
|
||||
forAllConstIters(fieldFields, fieldIter)
|
||||
{
|
||||
const word& fieldName = (*fieldIter)->name();
|
||||
|
||||
Info<< " mapping lagrangian fieldField " << fieldName << endl;
|
||||
|
||||
// Read field (does not need mesh)
|
||||
CompactIOField<Field<Type>, Type> fieldSource(*fieldIter());
|
||||
|
||||
// Map
|
||||
CompactIOField<Field<Type>, Type> fieldTarget
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
meshTarget.time().timeName(),
|
||||
cloud::prefix/cloudName,
|
||||
meshTarget,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
min(fieldSource.size(), addParticles.size()) // handle 0 size
|
||||
);
|
||||
|
||||
if (fieldSource.size())
|
||||
{
|
||||
forAll(addParticles, i)
|
||||
{
|
||||
fieldTarget[i] = fieldSource[addParticles[i]];
|
||||
}
|
||||
}
|
||||
else if (cloud::debug)
|
||||
{
|
||||
Pout<< "Not mapping " << fieldName << " since source size "
|
||||
<< fieldSource.size() << " different to"
|
||||
<< " cloud size " << addParticles.size()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Write field
|
||||
fieldTarget.write();
|
||||
}
|
||||
}
|
||||
MapLagrangianFields
|
||||
<
|
||||
CompactIOField<Field<Type>, Type>,
|
||||
CompactIOField<Field<Type>, Type>
|
||||
>
|
||||
(
|
||||
cloudName,
|
||||
objects,
|
||||
meshTarget,
|
||||
addParticles,
|
||||
"FieldField"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -132,20 +132,21 @@ void MapVolFields
|
||||
const fvMesh& meshTarget = static_cast<const fvMesh&>(interp.tgtRegion());
|
||||
|
||||
// Available fields, sorted order
|
||||
const wordList fieldNames =
|
||||
for
|
||||
(
|
||||
selectedFields.empty()
|
||||
? objects.sortedNames<fieldType>()
|
||||
: objects.sortedNames<fieldType>(selectedFields)
|
||||
);
|
||||
|
||||
for (const word& fieldName : fieldNames)
|
||||
const IOobject& io :
|
||||
(
|
||||
selectedFields.empty()
|
||||
? objects.csorted<fieldType>()
|
||||
: objects.csorted<fieldType>(selectedFields)
|
||||
)
|
||||
)
|
||||
{
|
||||
const fieldType fieldSource(*(objects[fieldName]), meshSource, false);
|
||||
const fieldType fieldSource(io, meshSource, false);
|
||||
|
||||
IOobject targetIO
|
||||
(
|
||||
fieldName,
|
||||
io.name(),
|
||||
meshTarget.time().timeName(),
|
||||
meshTarget,
|
||||
IOobject::MUST_READ
|
||||
@ -154,7 +155,7 @@ void MapVolFields
|
||||
if (targetIO.typeHeaderOk<fieldType>(true))
|
||||
{
|
||||
Info<< " interpolating onto existing field "
|
||||
<< fieldName << endl;
|
||||
<< targetIO.name() << endl;
|
||||
|
||||
fieldType fieldTarget(targetIO, meshTarget, false);
|
||||
|
||||
@ -167,7 +168,7 @@ void MapVolFields
|
||||
else
|
||||
{
|
||||
Info<< " creating new field "
|
||||
<< fieldName << endl;
|
||||
<< targetIO.name() << endl;
|
||||
|
||||
targetIO.readOpt(IOobject::NO_READ);
|
||||
|
||||
|
||||
@ -40,11 +40,9 @@ namespace Foam
|
||||
template<class Type>
|
||||
void UnMapped(const IOobjectList& objects)
|
||||
{
|
||||
IOobjectList fields = objects.lookupClass(Type::typeName);
|
||||
|
||||
forAllConstIters(fields, fieldIter)
|
||||
for (const IOobject& io : objects.csorted<Type>())
|
||||
{
|
||||
mvBak((*fieldIter)->objectPath(), "unmapped");
|
||||
mvBak(io.objectPath(), "unmapped");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user