mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: allow wordHashSet filter for IOobjectList::names
- simplifies usage. Support syncPar check on names() to detect inconsistencies. - simplify readFields, ReadFields and other routines by using these new methods.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
@ -273,23 +273,20 @@ Foam::faFieldReconstructor::reconstructFaAreaField
|
||||
|
||||
// Now construct and write the field
|
||||
// setting the internalField and patchFields
|
||||
return tmp<GeometricField<Type, faPatchField, areaMesh>>
|
||||
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New
|
||||
(
|
||||
new GeometricField<Type, faPatchField, areaMesh>
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldIoObject.name(),
|
||||
mesh_.time().timeName(),
|
||||
mesh_(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
procFields[0].dimensions(),
|
||||
internalField,
|
||||
patchFields
|
||||
)
|
||||
fieldIoObject.name(),
|
||||
mesh_.time().timeName(),
|
||||
mesh_(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
procFields[0].dimensions(),
|
||||
internalField,
|
||||
patchFields
|
||||
);
|
||||
}
|
||||
|
||||
@ -553,23 +550,20 @@ Foam::faFieldReconstructor::reconstructFaEdgeField
|
||||
|
||||
// Now construct and write the field
|
||||
// setting the internalField and patchFields
|
||||
return tmp<GeometricField<Type, faePatchField, edgeMesh>>
|
||||
return tmp<GeometricField<Type, faePatchField, edgeMesh>>::New
|
||||
(
|
||||
new GeometricField<Type, faePatchField, edgeMesh>
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldIoObject.name(),
|
||||
mesh_.time().timeName(),
|
||||
mesh_(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
procFields[0].dimensions(),
|
||||
internalField,
|
||||
patchFields
|
||||
)
|
||||
fieldIoObject.name(),
|
||||
mesh_.time().timeName(),
|
||||
mesh_(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
procFields[0].dimensions(),
|
||||
internalField,
|
||||
patchFields
|
||||
);
|
||||
}
|
||||
|
||||
@ -581,31 +575,26 @@ void Foam::faFieldReconstructor::reconstructFaAreaFields
|
||||
const IOobjectList& objects
|
||||
)
|
||||
{
|
||||
const word& fieldClassName =
|
||||
const word& clsName =
|
||||
GeometricField<Type, faPatchField, areaMesh>::typeName;
|
||||
|
||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
||||
const wordList fieldNames = objects.sortedNames(clsName);
|
||||
|
||||
if (fields.size())
|
||||
if (fieldNames.size())
|
||||
{
|
||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
||||
|
||||
for
|
||||
(
|
||||
IOobjectList::const_iterator fieldIter = fields.begin();
|
||||
fieldIter != fields.end();
|
||||
++fieldIter
|
||||
)
|
||||
{
|
||||
Info << " " << fieldIter()->name() << endl;
|
||||
|
||||
reconstructFaAreaField<Type>(*fieldIter())().write();
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
Info<< " Reconstructing " << clsName << "s\n" << endl;
|
||||
}
|
||||
|
||||
for (const word& fieldName : fieldNames)
|
||||
{
|
||||
Info << " " << fieldName << endl;
|
||||
reconstructFaAreaField<Type>(*(objects[fieldName]))().write();
|
||||
}
|
||||
|
||||
if (fieldNames.size()) Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
// Reconstruct and write all edge fields
|
||||
template<class Type>
|
||||
void Foam::faFieldReconstructor::reconstructFaEdgeFields
|
||||
@ -613,29 +602,24 @@ void Foam::faFieldReconstructor::reconstructFaEdgeFields
|
||||
const IOobjectList& objects
|
||||
)
|
||||
{
|
||||
const word& fieldClassName =
|
||||
const word& clsName =
|
||||
GeometricField<Type, faePatchField, edgeMesh>::typeName;
|
||||
|
||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
||||
const wordList fieldNames = objects.sortedNames(clsName);
|
||||
|
||||
if (fields.size())
|
||||
if (fieldNames.size())
|
||||
{
|
||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
||||
|
||||
for
|
||||
(
|
||||
IOobjectList::const_iterator fieldIter = fields.begin();
|
||||
fieldIter != fields.end();
|
||||
++fieldIter
|
||||
)
|
||||
{
|
||||
Info<< " " << fieldIter()->name() << endl;
|
||||
|
||||
reconstructFaEdgeField<Type>(*fieldIter())().write();
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
Info<< " Reconstructing " << clsName << "s\n" << endl;
|
||||
}
|
||||
|
||||
for (const word& fieldName : fieldNames)
|
||||
{
|
||||
Info << " " << fieldName << endl;
|
||||
|
||||
reconstructFaEdgeField<Type>(*(objects[fieldName]))().write();
|
||||
}
|
||||
|
||||
if (fieldNames.size()) Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -780,18 +780,18 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
IOobjectList cSets(objects.lookupClass(cellSet::typeName));
|
||||
forAllConstIter(IOobjectList, cSets, iter)
|
||||
forAllConstIters(cSets, iter)
|
||||
{
|
||||
cSetNames.insert(iter.key(), cSetNames.size());
|
||||
}
|
||||
|
||||
IOobjectList fSets(objects.lookupClass(faceSet::typeName));
|
||||
forAllConstIter(IOobjectList, fSets, iter)
|
||||
forAllConstIters(fSets, iter)
|
||||
{
|
||||
fSetNames.insert(iter.key(), fSetNames.size());
|
||||
}
|
||||
IOobjectList pSets(objects.lookupClass(pointSet::typeName));
|
||||
forAllConstIter(IOobjectList, pSets, iter)
|
||||
forAllConstIters(pSets, iter)
|
||||
{
|
||||
pSetNames.insert(iter.key(), pSetNames.size());
|
||||
}
|
||||
@ -842,7 +842,7 @@ int main(int argc, char *argv[])
|
||||
objects.lookupClass(cellSet::typeName)
|
||||
);
|
||||
|
||||
forAllConstIter(IOobjectList, cSets, iter)
|
||||
forAllConstIters(cSets, iter)
|
||||
{
|
||||
// Load cellSet
|
||||
const cellSet procSet(*iter());
|
||||
@ -878,7 +878,7 @@ int main(int argc, char *argv[])
|
||||
objects.lookupClass(faceSet::typeName)
|
||||
);
|
||||
|
||||
forAllConstIter(IOobjectList, fSets, iter)
|
||||
forAllConstIters(fSets, iter)
|
||||
{
|
||||
// Load faceSet
|
||||
const faceSet procSet(*iter());
|
||||
@ -912,7 +912,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
objects.lookupClass(pointSet::typeName)
|
||||
);
|
||||
forAllConstIter(IOobjectList, pSets, iter)
|
||||
forAllConstIters(pSets, iter)
|
||||
{
|
||||
// Load pointSet
|
||||
const pointSet propSet(*iter());
|
||||
|
||||
Reference in New Issue
Block a user