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:
@ -54,7 +54,7 @@ void RotateFields
|
|||||||
// Objects of field type
|
// Objects of field type
|
||||||
IOobjectList fields(objects.lookupClass(GeometricField::typeName));
|
IOobjectList fields(objects.lookupClass(GeometricField::typeName));
|
||||||
|
|
||||||
forAllIter(IOobjectList, fields, fieldIter)
|
forAllConstIters(fields, fieldIter)
|
||||||
{
|
{
|
||||||
Info<< " Rotating " << fieldIter()->name() << endl;
|
Info<< " Rotating " << fieldIter()->name() << endl;
|
||||||
|
|
||||||
|
|||||||
@ -193,7 +193,7 @@ void printAllSets(const polyMesh& mesh, Ostream& os)
|
|||||||
if (cellSets.size())
|
if (cellSets.size())
|
||||||
{
|
{
|
||||||
os << "cellSets:" << endl;
|
os << "cellSets:" << endl;
|
||||||
forAllConstIter(IOobjectList, cellSets, iter)
|
forAllConstIters(cellSets, iter)
|
||||||
{
|
{
|
||||||
cellSet set(*iter());
|
cellSet set(*iter());
|
||||||
os << '\t' << set.name() << "\tsize:" << set.size() << endl;
|
os << '\t' << set.name() << "\tsize:" << set.size() << endl;
|
||||||
@ -203,7 +203,7 @@ void printAllSets(const polyMesh& mesh, Ostream& os)
|
|||||||
if (faceSets.size())
|
if (faceSets.size())
|
||||||
{
|
{
|
||||||
os << "faceSets:" << endl;
|
os << "faceSets:" << endl;
|
||||||
forAllConstIter(IOobjectList, faceSets, iter)
|
forAllConstIters(faceSets, iter)
|
||||||
{
|
{
|
||||||
faceSet set(*iter());
|
faceSet set(*iter());
|
||||||
os << '\t' << set.name() << "\tsize:" << set.size() << endl;
|
os << '\t' << set.name() << "\tsize:" << set.size() << endl;
|
||||||
@ -213,7 +213,7 @@ void printAllSets(const polyMesh& mesh, Ostream& os)
|
|||||||
if (pointSets.size())
|
if (pointSets.size())
|
||||||
{
|
{
|
||||||
os << "pointSets:" << endl;
|
os << "pointSets:" << endl;
|
||||||
forAllConstIter(IOobjectList, pointSets, iter)
|
forAllConstIters(pointSets, iter)
|
||||||
{
|
{
|
||||||
pointSet set(*iter());
|
pointSet set(*iter());
|
||||||
os << '\t' << set.name() << "\tsize:" << set.size() << endl;
|
os << '\t' << set.name() << "\tsize:" << set.size() << endl;
|
||||||
@ -224,9 +224,8 @@ void printAllSets(const polyMesh& mesh, Ostream& os)
|
|||||||
if (cellZones.size())
|
if (cellZones.size())
|
||||||
{
|
{
|
||||||
os << "cellZones:" << endl;
|
os << "cellZones:" << endl;
|
||||||
forAll(cellZones, i)
|
for (const cellZone& zone : cellZones)
|
||||||
{
|
{
|
||||||
const cellZone& zone = cellZones[i];
|
|
||||||
os << '\t' << zone.name() << "\tsize:" << zone.size() << endl;
|
os << '\t' << zone.name() << "\tsize:" << zone.size() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,9 +233,8 @@ void printAllSets(const polyMesh& mesh, Ostream& os)
|
|||||||
if (faceZones.size())
|
if (faceZones.size())
|
||||||
{
|
{
|
||||||
os << "faceZones:" << endl;
|
os << "faceZones:" << endl;
|
||||||
forAll(faceZones, i)
|
for (const faceZone& zone : faceZones)
|
||||||
{
|
{
|
||||||
const faceZone& zone = faceZones[i];
|
|
||||||
os << '\t' << zone.name() << "\tsize:" << zone.size() << endl;
|
os << '\t' << zone.name() << "\tsize:" << zone.size() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,9 +242,8 @@ void printAllSets(const polyMesh& mesh, Ostream& os)
|
|||||||
if (pointZones.size())
|
if (pointZones.size())
|
||||||
{
|
{
|
||||||
os << "pointZones:" << endl;
|
os << "pointZones:" << endl;
|
||||||
forAll(pointZones, i)
|
for (const pointZone& zone : pointZones)
|
||||||
{
|
{
|
||||||
const pointZone& zone = pointZones[i];
|
|
||||||
os << '\t' << zone.name() << "\tsize:" << zone.size() << endl;
|
os << '\t' << zone.name() << "\tsize:" << zone.size() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -107,7 +107,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//Pout<< "pointSets:" << pointObjects.names() << endl;
|
//Pout<< "pointSets:" << pointObjects.names() << endl;
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, pointObjects, iter)
|
forAllConstIters(pointObjects, iter)
|
||||||
{
|
{
|
||||||
// Not in memory. Load it.
|
// Not in memory. Load it.
|
||||||
pointSet set(*iter());
|
pointSet set(*iter());
|
||||||
@ -143,7 +143,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//Pout<< "faceSets:" << faceObjects.names() << endl;
|
//Pout<< "faceSets:" << faceObjects.names() << endl;
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, faceObjects, iter)
|
forAllConstIters(faceObjects, iter)
|
||||||
{
|
{
|
||||||
// Not in memory. Load it.
|
// Not in memory. Load it.
|
||||||
faceSet set(*iter());
|
faceSet set(*iter());
|
||||||
@ -269,7 +269,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//Pout<< "cellSets:" << cellObjects.names() << endl;
|
//Pout<< "cellSets:" << cellObjects.names() << endl;
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, cellObjects, iter)
|
forAllConstIters(cellObjects, iter)
|
||||||
{
|
{
|
||||||
if (!slaveCellSets.found(iter.key()))
|
if (!slaveCellSets.found(iter.key()))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -286,7 +286,7 @@ template<class TopoSet>
|
|||||||
void subsetTopoSets
|
void subsetTopoSets
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const IOobjectList& objectsList,
|
const IOobjectList& objects,
|
||||||
const labelList& map,
|
const labelList& map,
|
||||||
const fvMesh& subMesh,
|
const fvMesh& subMesh,
|
||||||
PtrList<TopoSet>& subSets
|
PtrList<TopoSet>& subSets
|
||||||
@ -294,7 +294,7 @@ void subsetTopoSets
|
|||||||
{
|
{
|
||||||
// Read original sets
|
// Read original sets
|
||||||
PtrList<TopoSet> sets;
|
PtrList<TopoSet> sets;
|
||||||
ReadFields<TopoSet>(objectsList, sets);
|
ReadFields<TopoSet>(objects, sets);
|
||||||
|
|
||||||
subSets.setSize(sets.size());
|
subSets.setSize(sets.size());
|
||||||
forAll(sets, i)
|
forAll(sets, i)
|
||||||
|
|||||||
@ -351,7 +351,7 @@ int main(int argc, char *argv[])
|
|||||||
// Get list of objects from the database
|
// Get list of objects from the database
|
||||||
IOobjectList objects(runTime, runTime.timeName(), regionPrefix);
|
IOobjectList objects(runTime, runTime.timeName(), regionPrefix);
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
forAllConstIters(objects, iter)
|
||||||
{
|
{
|
||||||
const word& headerClassName = iter()->headerClassName();
|
const word& headerClassName = iter()->headerClassName();
|
||||||
|
|
||||||
|
|||||||
@ -81,9 +81,10 @@ int main(int argc, char *argv[])
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const wordList objNames
|
||||||
const IOobjectList fieldObjs(mesh, runTime.timeName());
|
(
|
||||||
const wordList objNames = fieldObjs.names();
|
IOobjectList(mesh, runTime.timeName()).sortedNames()
|
||||||
|
);
|
||||||
|
|
||||||
PtrList<volScalarField> vsf(objNames.size());
|
PtrList<volScalarField> vsf(objNames.size());
|
||||||
PtrList<volVectorField> vvf(objNames.size());
|
PtrList<volVectorField> vvf(objNames.size());
|
||||||
|
|||||||
@ -173,21 +173,21 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
|
|||||||
IOobjectList objects(*this, facesInstance(), "polyMesh/sets");
|
IOobjectList objects(*this, facesInstance(), "polyMesh/sets");
|
||||||
{
|
{
|
||||||
IOobjectList cSets(objects.lookupClass(cellSet::typeName));
|
IOobjectList cSets(objects.lookupClass(cellSet::typeName));
|
||||||
forAllConstIter(IOobjectList, cSets, iter)
|
forAllConstIters(cSets, iter)
|
||||||
{
|
{
|
||||||
cellSets.append(new cellSet(*iter()));
|
cellSets.append(new cellSet(*iter()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IOobjectList fSets(objects.lookupClass(faceSet::typeName));
|
IOobjectList fSets(objects.lookupClass(faceSet::typeName));
|
||||||
forAllConstIter(IOobjectList, fSets, iter)
|
forAllConstIters(fSets, iter)
|
||||||
{
|
{
|
||||||
faceSets.append(new faceSet(*iter()));
|
faceSets.append(new faceSet(*iter()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IOobjectList pSets(objects.lookupClass(pointSet::typeName));
|
IOobjectList pSets(objects.lookupClass(pointSet::typeName));
|
||||||
forAllConstIter(IOobjectList, pSets, iter)
|
forAllConstIters(pSets, iter)
|
||||||
{
|
{
|
||||||
pointSets.append(new pointSet(*iter()));
|
pointSets.append(new pointSet(*iter()));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,7 @@ void Foam::lagrangianFieldDecomposer::readFields
|
|||||||
);
|
);
|
||||||
|
|
||||||
label lagrangianFieldi = 0;
|
label lagrangianFieldi = 0;
|
||||||
forAllIter(IOobjectList, lagrangianTypeObjects, iter)
|
forAllConstIters(lagrangianTypeObjects, iter)
|
||||||
{
|
{
|
||||||
lagrangianFields[cloudI].set
|
lagrangianFields[cloudI].set
|
||||||
(
|
(
|
||||||
@ -97,7 +97,7 @@ void Foam::lagrangianFieldDecomposer::readFieldFields
|
|||||||
|
|
||||||
label lagrangianFieldi = 0;
|
label lagrangianFieldi = 0;
|
||||||
|
|
||||||
forAllIter(IOobjectList, lagrangianTypeObjectsA, iter)
|
forAllConstIters(lagrangianTypeObjectsA, iter)
|
||||||
{
|
{
|
||||||
lagrangianFields[cloudI].set
|
lagrangianFields[cloudI].set
|
||||||
(
|
(
|
||||||
@ -106,7 +106,7 @@ void Foam::lagrangianFieldDecomposer::readFieldFields
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAllIter(IOobjectList, lagrangianTypeObjectsB, iter)
|
forAllConstIters(lagrangianTypeObjectsB, iter)
|
||||||
{
|
{
|
||||||
lagrangianFields[cloudI].set
|
lagrangianFields[cloudI].set
|
||||||
(
|
(
|
||||||
@ -129,9 +129,7 @@ Foam::lagrangianFieldDecomposer::decomposeField
|
|||||||
Field<Type> procField(field, particleIndices_);
|
Field<Type> procField(field, particleIndices_);
|
||||||
|
|
||||||
// Create the field for the processor
|
// Create the field for the processor
|
||||||
return tmp<IOField<Type>>
|
return tmp<IOField<Type>>::New
|
||||||
(
|
|
||||||
new IOField<Type>
|
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
@ -144,7 +142,6 @@ Foam::lagrangianFieldDecomposer::decomposeField
|
|||||||
false
|
false
|
||||||
),
|
),
|
||||||
procField
|
procField
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,9 +158,7 @@ Foam::lagrangianFieldDecomposer::decomposeFieldField
|
|||||||
Field<Field<Type>> procField(field, particleIndices_);
|
Field<Field<Type>> procField(field, particleIndices_);
|
||||||
|
|
||||||
// Create the field for the processor
|
// Create the field for the processor
|
||||||
return tmp<CompactIOField<Field<Type>, Type>>
|
return tmp<CompactIOField<Field<Type>, Type>>::New
|
||||||
(
|
|
||||||
new CompactIOField<Field<Type>, Type>
|
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
@ -176,7 +171,6 @@ Foam::lagrangianFieldDecomposer::decomposeFieldField
|
|||||||
false
|
false
|
||||||
),
|
),
|
||||||
procField
|
procField
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,14 +39,14 @@ void Foam::readFields
|
|||||||
{
|
{
|
||||||
typedef GeometricField<Type, PatchField, GeoMesh> GeoField;
|
typedef GeometricField<Type, PatchField, GeoMesh> GeoField;
|
||||||
|
|
||||||
// Search list of objects for fields of type GeomField
|
// Search list of objects for fields of type GeoField
|
||||||
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
||||||
|
|
||||||
// Remove the cellDist field
|
// Remove the cellDist field
|
||||||
IOobjectList::iterator celDistIter = fieldObjects.find("cellDist");
|
auto iter = fieldObjects.find("cellDist");
|
||||||
if (celDistIter != fieldObjects.end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
fieldObjects.erase(celDistIter);
|
fieldObjects.erase(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get sorted set of names (different processors might read objects in
|
// Get sorted set of names (different processors might read objects in
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2016-2017 Wikki Ltd
|
| Copyright (C) 2016-2017 Wikki Ltd
|
||||||
@ -273,9 +273,7 @@ Foam::faFieldReconstructor::reconstructFaAreaField
|
|||||||
|
|
||||||
// Now construct and write the field
|
// Now construct and write the field
|
||||||
// setting the internalField and patchFields
|
// 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
|
||||||
(
|
(
|
||||||
@ -289,7 +287,6 @@ Foam::faFieldReconstructor::reconstructFaAreaField
|
|||||||
procFields[0].dimensions(),
|
procFields[0].dimensions(),
|
||||||
internalField,
|
internalField,
|
||||||
patchFields
|
patchFields
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,9 +550,7 @@ Foam::faFieldReconstructor::reconstructFaEdgeField
|
|||||||
|
|
||||||
// Now construct and write the field
|
// Now construct and write the field
|
||||||
// setting the internalField and patchFields
|
// 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
|
||||||
(
|
(
|
||||||
@ -569,7 +564,6 @@ Foam::faFieldReconstructor::reconstructFaEdgeField
|
|||||||
procFields[0].dimensions(),
|
procFields[0].dimensions(),
|
||||||
internalField,
|
internalField,
|
||||||
patchFields
|
patchFields
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -581,31 +575,26 @@ void Foam::faFieldReconstructor::reconstructFaAreaFields
|
|||||||
const IOobjectList& objects
|
const IOobjectList& objects
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word& fieldClassName =
|
const word& clsName =
|
||||||
GeometricField<Type, faPatchField, areaMesh>::typeName;
|
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;
|
Info<< " Reconstructing " << clsName << "s\n" << endl;
|
||||||
|
|
||||||
for
|
|
||||||
(
|
|
||||||
IOobjectList::const_iterator fieldIter = fields.begin();
|
|
||||||
fieldIter != fields.end();
|
|
||||||
++fieldIter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Info << " " << fieldIter()->name() << endl;
|
|
||||||
|
|
||||||
reconstructFaAreaField<Type>(*fieldIter())().write();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< 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
|
// Reconstruct and write all edge fields
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::faFieldReconstructor::reconstructFaEdgeFields
|
void Foam::faFieldReconstructor::reconstructFaEdgeFields
|
||||||
@ -613,29 +602,24 @@ void Foam::faFieldReconstructor::reconstructFaEdgeFields
|
|||||||
const IOobjectList& objects
|
const IOobjectList& objects
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word& fieldClassName =
|
const word& clsName =
|
||||||
GeometricField<Type, faePatchField, edgeMesh>::typeName;
|
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;
|
Info<< " Reconstructing " << clsName << "s\n" << endl;
|
||||||
|
|
||||||
for
|
|
||||||
(
|
|
||||||
IOobjectList::const_iterator fieldIter = fields.begin();
|
|
||||||
fieldIter != fields.end();
|
|
||||||
++fieldIter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Info<< " " << fieldIter()->name() << endl;
|
|
||||||
|
|
||||||
reconstructFaEdgeField<Type>(*fieldIter())().write();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< 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));
|
IOobjectList cSets(objects.lookupClass(cellSet::typeName));
|
||||||
forAllConstIter(IOobjectList, cSets, iter)
|
forAllConstIters(cSets, iter)
|
||||||
{
|
{
|
||||||
cSetNames.insert(iter.key(), cSetNames.size());
|
cSetNames.insert(iter.key(), cSetNames.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
IOobjectList fSets(objects.lookupClass(faceSet::typeName));
|
IOobjectList fSets(objects.lookupClass(faceSet::typeName));
|
||||||
forAllConstIter(IOobjectList, fSets, iter)
|
forAllConstIters(fSets, iter)
|
||||||
{
|
{
|
||||||
fSetNames.insert(iter.key(), fSetNames.size());
|
fSetNames.insert(iter.key(), fSetNames.size());
|
||||||
}
|
}
|
||||||
IOobjectList pSets(objects.lookupClass(pointSet::typeName));
|
IOobjectList pSets(objects.lookupClass(pointSet::typeName));
|
||||||
forAllConstIter(IOobjectList, pSets, iter)
|
forAllConstIters(pSets, iter)
|
||||||
{
|
{
|
||||||
pSetNames.insert(iter.key(), pSetNames.size());
|
pSetNames.insert(iter.key(), pSetNames.size());
|
||||||
}
|
}
|
||||||
@ -842,7 +842,7 @@ int main(int argc, char *argv[])
|
|||||||
objects.lookupClass(cellSet::typeName)
|
objects.lookupClass(cellSet::typeName)
|
||||||
);
|
);
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, cSets, iter)
|
forAllConstIters(cSets, iter)
|
||||||
{
|
{
|
||||||
// Load cellSet
|
// Load cellSet
|
||||||
const cellSet procSet(*iter());
|
const cellSet procSet(*iter());
|
||||||
@ -878,7 +878,7 @@ int main(int argc, char *argv[])
|
|||||||
objects.lookupClass(faceSet::typeName)
|
objects.lookupClass(faceSet::typeName)
|
||||||
);
|
);
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fSets, iter)
|
forAllConstIters(fSets, iter)
|
||||||
{
|
{
|
||||||
// Load faceSet
|
// Load faceSet
|
||||||
const faceSet procSet(*iter());
|
const faceSet procSet(*iter());
|
||||||
@ -912,7 +912,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
objects.lookupClass(pointSet::typeName)
|
objects.lookupClass(pointSet::typeName)
|
||||||
);
|
);
|
||||||
forAllConstIter(IOobjectList, pSets, iter)
|
forAllConstIters(pSets, iter)
|
||||||
{
|
{
|
||||||
// Load pointSet
|
// Load pointSet
|
||||||
const pointSet propSet(*iter());
|
const pointSet propSet(*iter());
|
||||||
|
|||||||
@ -159,7 +159,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
|
|||||||
|
|
||||||
if (!haveMesh)
|
if (!haveMesh)
|
||||||
{
|
{
|
||||||
bool oldParRun = Pstream::parRun();
|
const bool oldParRun = Pstream::parRun();
|
||||||
Pstream::parRun() = false;
|
Pstream::parRun() = false;
|
||||||
|
|
||||||
|
|
||||||
@ -383,17 +383,17 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
|
|||||||
|
|
||||||
if (!haveMesh)
|
if (!haveMesh)
|
||||||
{
|
{
|
||||||
forAll(pointSetNames, i)
|
for (const word& setName : pointSetNames)
|
||||||
{
|
{
|
||||||
pointSet(mesh, pointSetNames[i], 0).write();
|
pointSet(mesh, setName, 0).write();
|
||||||
}
|
}
|
||||||
forAll(faceSetNames, i)
|
for (const word& setName : faceSetNames)
|
||||||
{
|
{
|
||||||
faceSet(mesh, faceSetNames[i], 0).write();
|
faceSet(mesh, setName, 0).write();
|
||||||
}
|
}
|
||||||
forAll(cellSetNames, i)
|
for (const word& setName : cellSetNames)
|
||||||
{
|
{
|
||||||
cellSet(mesh, cellSetNames[i], 0).write();
|
cellSet(mesh, setName, 0).write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -66,15 +66,12 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeInternalField
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
tmp<DimensionedField<Type, volMesh>> tfield
|
auto tfield = tmp<DimensionedField<Type, volMesh>>::New
|
||||||
(
|
|
||||||
new DimensionedField<Type, volMesh>
|
|
||||||
(
|
(
|
||||||
baseIO,
|
baseIO,
|
||||||
baseMesh_,
|
baseMesh_,
|
||||||
fld.dimensions(),
|
fld.dimensions(),
|
||||||
internalField
|
internalField
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
tfield.ref().oriented() = fld.oriented();
|
tfield.ref().oriented() = fld.oriented();
|
||||||
@ -213,16 +210,13 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeField
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh>> tfield
|
auto tfield = tmp<GeometricField<Type, fvPatchField, volMesh>>::New
|
||||||
(
|
|
||||||
new GeometricField<Type, fvPatchField, volMesh>
|
|
||||||
(
|
(
|
||||||
baseIO,
|
baseIO,
|
||||||
baseMesh_,
|
baseMesh_,
|
||||||
fld.dimensions(),
|
fld.dimensions(),
|
||||||
internalField,
|
internalField,
|
||||||
basePatchFields
|
basePatchFields
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
tfield.ref().oriented()= fld.oriented();
|
tfield.ref().oriented()= fld.oriented();
|
||||||
@ -380,16 +374,13 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tfield
|
auto tfield = tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>::New
|
||||||
(
|
|
||||||
new GeometricField<Type, fvsPatchField, surfaceMesh>
|
|
||||||
(
|
(
|
||||||
baseIO,
|
baseIO,
|
||||||
baseMesh_,
|
baseMesh_,
|
||||||
fld.dimensions(),
|
fld.dimensions(),
|
||||||
internalField,
|
internalField,
|
||||||
basePatchFields
|
basePatchFields
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
tfield.ref().oriented() = fld.oriented();
|
tfield.ref().oriented() = fld.oriented();
|
||||||
@ -423,37 +414,37 @@ void Foam::parFvFieldReconstructor::reconstructFvVolumeInternalFields
|
|||||||
const wordHashSet& selectedFields
|
const wordHashSet& selectedFields
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const word& fieldClassName = DimensionedField<Type, volMesh>::typeName;
|
typedef DimensionedField<Type, volMesh> FieldType;
|
||||||
|
const word& clsName = FieldType::typeName;
|
||||||
|
|
||||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
// Available fields, sorted order
|
||||||
|
const wordList fieldNames =
|
||||||
if (fields.size())
|
|
||||||
{
|
|
||||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
(
|
||||||
selectedFields.empty()
|
selectedFields.empty()
|
||||||
|| selectedFields.found(fieldIter()->name())
|
? objects.sortedNames(clsName)
|
||||||
)
|
: objects.sortedNames(clsName, selectedFields)
|
||||||
{
|
|
||||||
Info<< " " << fieldIter()->name() << endl;
|
|
||||||
|
|
||||||
tmp<DimensionedField<Type, volMesh>> tfld
|
|
||||||
(
|
|
||||||
reconstructFvVolumeInternalField<Type>(*fieldIter())
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (fieldNames.size())
|
||||||
|
{
|
||||||
|
Info<< " Reconstructing " << clsName << "s\n" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const word& fieldName : fieldNames)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldName << endl;
|
||||||
|
|
||||||
|
tmp<FieldType> tfld
|
||||||
|
(
|
||||||
|
reconstructFvVolumeInternalField<Type>(*(objects[fieldName]))
|
||||||
|
);
|
||||||
if (isWriteProc_)
|
if (isWriteProc_)
|
||||||
{
|
{
|
||||||
tfld().write();
|
tfld().write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Info<< endl;
|
if (fieldNames.size()) Info<< endl;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -464,39 +455,41 @@ void Foam::parFvFieldReconstructor::reconstructFvVolumeFields
|
|||||||
const wordHashSet& selectedFields
|
const wordHashSet& selectedFields
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const word& fieldClassName =
|
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
|
||||||
GeometricField<Type, fvPatchField, volMesh>::typeName;
|
const word& clsName = FieldType::typeName;
|
||||||
|
|
||||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
// Available fields, sorted order
|
||||||
|
const wordList fieldNames =
|
||||||
if (fields.size())
|
|
||||||
{
|
|
||||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
|
||||||
{
|
|
||||||
const word& name = fieldIter()->name();
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
(
|
||||||
(selectedFields.empty() || selectedFields.found(name))
|
selectedFields.empty()
|
||||||
&& name != "cellDist"
|
? objects.sortedNames(clsName)
|
||||||
)
|
: objects.sortedNames(clsName, selectedFields)
|
||||||
{
|
);
|
||||||
Info<< " " << name << endl;
|
|
||||||
|
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh>> tfld
|
if (fieldNames.size())
|
||||||
|
{
|
||||||
|
Info<< " Reconstructing " << clsName << "s\n" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const word& fieldName : fieldNames)
|
||||||
|
{
|
||||||
|
if ("cellDist" == fieldName)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Info<< " " << fieldName << endl;
|
||||||
|
|
||||||
|
tmp<FieldType> tfld
|
||||||
(
|
(
|
||||||
reconstructFvVolumeField<Type>(*fieldIter())
|
reconstructFvVolumeField<Type>(*(objects[fieldName]))
|
||||||
);
|
);
|
||||||
if (isWriteProc_)
|
if (isWriteProc_)
|
||||||
{
|
{
|
||||||
tfld().write();
|
tfld().write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Info<< endl;
|
if (fieldNames.size()) Info<< endl;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -507,37 +500,37 @@ void Foam::parFvFieldReconstructor::reconstructFvSurfaceFields
|
|||||||
const wordHashSet& selectedFields
|
const wordHashSet& selectedFields
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const word& fieldClassName =
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> FieldType;
|
||||||
GeometricField<Type, fvsPatchField, surfaceMesh>::typeName;
|
const word& clsName = FieldType::typeName;
|
||||||
|
|
||||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
// Available fields, sorted order
|
||||||
|
const wordList fieldNames =
|
||||||
if (fields.size())
|
|
||||||
{
|
|
||||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
(
|
||||||
selectedFields.empty()
|
selectedFields.empty()
|
||||||
|| selectedFields.found(fieldIter()->name())
|
? objects.sortedNames(clsName)
|
||||||
)
|
: objects.sortedNames(clsName, selectedFields)
|
||||||
{
|
);
|
||||||
Info<< " " << fieldIter()->name() << endl;
|
|
||||||
|
|
||||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tfld
|
if (fieldNames.size())
|
||||||
|
{
|
||||||
|
Info<< " Reconstructing " << clsName << "s\n" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const word& fieldName : fieldNames)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldName << endl;
|
||||||
|
|
||||||
|
tmp<FieldType> tfld
|
||||||
(
|
(
|
||||||
reconstructFvSurfaceField<Type>(*fieldIter())
|
reconstructFvSurfaceField<Type>(*(objects[fieldName]))
|
||||||
);
|
);
|
||||||
if (isWriteProc_)
|
if (isWriteProc_)
|
||||||
{
|
{
|
||||||
tfld().write();
|
tfld().write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Info<< endl;
|
if (fieldNames.size()) Info<< endl;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,25 +40,20 @@ Foam::wordList Foam::parLagrangianRedistributor::filterObjects
|
|||||||
const wordHashSet& selectedFields
|
const wordHashSet& selectedFields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word fieldClassName(Container::typeName);
|
|
||||||
|
|
||||||
// Parallel synchronise
|
// Parallel synchronise
|
||||||
wordList fieldNames(objects.names(fieldClassName));
|
wordList fieldNames =
|
||||||
|
(
|
||||||
|
selectedFields.empty()
|
||||||
|
? objects.names(Container::typeName)
|
||||||
|
: objects.names(Container::typeName, selectedFields)
|
||||||
|
);
|
||||||
|
|
||||||
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
|
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
|
||||||
Pstream::combineScatter(fieldNames);
|
Pstream::combineScatter(fieldNames);
|
||||||
|
|
||||||
if (!selectedFields.empty())
|
// Ensure order is consistent
|
||||||
{
|
Foam::sort(fieldNames);
|
||||||
DynamicList<word> selectedNames(fieldNames.size());
|
|
||||||
forAll(fieldNames, i)
|
|
||||||
{
|
|
||||||
if (selectedFields.found(fieldNames[i]))
|
|
||||||
{
|
|
||||||
selectedNames.append(fieldNames[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNames.transfer(selectedNames);
|
|
||||||
}
|
|
||||||
return fieldNames;
|
return fieldNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,6 +67,8 @@ void Foam::parLagrangianRedistributor::redistributeLagrangianFields
|
|||||||
const wordHashSet& selectedFields
|
const wordHashSet& selectedFields
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
const word fieldClassName(IOField<Type>::typeName);
|
||||||
|
|
||||||
const wordList objectNames
|
const wordList objectNames
|
||||||
(
|
(
|
||||||
filterObjects<IOField<Type>>
|
filterObjects<IOField<Type>>
|
||||||
@ -83,21 +80,20 @@ void Foam::parLagrangianRedistributor::redistributeLagrangianFields
|
|||||||
|
|
||||||
if (objectNames.size())
|
if (objectNames.size())
|
||||||
{
|
{
|
||||||
const word fieldClassName(IOField<Type>::typeName);
|
|
||||||
|
|
||||||
Info<< " Redistributing lagrangian "
|
Info<< " Redistributing lagrangian "
|
||||||
<< fieldClassName << "s\n" << endl;
|
<< fieldClassName << "s\n" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
forAll(objectNames, i)
|
for (const word& objectName : objectNames)
|
||||||
{
|
{
|
||||||
Info<< " " << objectNames[i] << endl;
|
Info<< " " << objectName << endl;
|
||||||
|
|
||||||
// Read if present
|
// Read if present
|
||||||
IOField<Type> field
|
IOField<Type> field
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
objectNames[i],
|
objectName,
|
||||||
srcMesh_.time().timeName(),
|
srcMesh_.time().timeName(),
|
||||||
cloud::prefix/cloudName,
|
cloud::prefix/cloudName,
|
||||||
srcMesh_,
|
srcMesh_,
|
||||||
@ -117,7 +113,7 @@ void Foam::parLagrangianRedistributor::redistributeLagrangianFields
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
objectNames[i],
|
objectName,
|
||||||
tgtMesh_.time().timeName(),
|
tgtMesh_.time().timeName(),
|
||||||
cloud::prefix/cloudName,
|
cloud::prefix/cloudName,
|
||||||
tgtMesh_,
|
tgtMesh_,
|
||||||
@ -130,8 +126,7 @@ void Foam::parLagrangianRedistributor::redistributeLagrangianFields
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< endl;
|
if (objectNames.size()) Info<< endl;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -144,6 +139,8 @@ void Foam::parLagrangianRedistributor::redistributeLagrangianFieldFields
|
|||||||
const wordHashSet& selectedFields
|
const wordHashSet& selectedFields
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
const word fieldClassName(CompactIOField<Field<Type>, Type>::typeName);
|
||||||
|
|
||||||
wordList objectNames
|
wordList objectNames
|
||||||
(
|
(
|
||||||
filterObjects<CompactIOField<Field<Type>, Type>>
|
filterObjects<CompactIOField<Field<Type>, Type>>
|
||||||
@ -153,9 +150,9 @@ void Foam::parLagrangianRedistributor::redistributeLagrangianFieldFields
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Append IOField names
|
// Append IOField Field names
|
||||||
{
|
{
|
||||||
const wordList ioFieldNames
|
wordList ioFieldNames
|
||||||
(
|
(
|
||||||
filterObjects<IOField<Field<Type>>>
|
filterObjects<IOField<Field<Type>>>
|
||||||
(
|
(
|
||||||
@ -169,21 +166,20 @@ void Foam::parLagrangianRedistributor::redistributeLagrangianFieldFields
|
|||||||
|
|
||||||
if (objectNames.size())
|
if (objectNames.size())
|
||||||
{
|
{
|
||||||
const word fieldClassName(CompactIOField<Field<Type>, Type>::typeName);
|
|
||||||
|
|
||||||
Info<< " Redistributing lagrangian "
|
Info<< " Redistributing lagrangian "
|
||||||
<< fieldClassName << "s\n" << endl;
|
<< fieldClassName << "s\n" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
forAll(objectNames, i)
|
for (const word& objectName : objectNames)
|
||||||
{
|
{
|
||||||
Info<< " " << objectNames[i] << endl;
|
Info<< " " << objectName << endl;
|
||||||
|
|
||||||
// Read if present
|
// Read if present
|
||||||
CompactIOField<Field<Type>, Type> field
|
CompactIOField<Field<Type>, Type> field
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
objectNames[i],
|
objectName,
|
||||||
srcMesh_.time().timeName(),
|
srcMesh_.time().timeName(),
|
||||||
cloud::prefix/cloudName,
|
cloud::prefix/cloudName,
|
||||||
srcMesh_,
|
srcMesh_,
|
||||||
@ -204,7 +200,7 @@ void Foam::parLagrangianRedistributor::redistributeLagrangianFieldFields
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
objectNames[i],
|
objectName,
|
||||||
tgtMesh_.time().timeName(),
|
tgtMesh_.time().timeName(),
|
||||||
cloud::prefix/cloudName,
|
cloud::prefix/cloudName,
|
||||||
tgtMesh_,
|
tgtMesh_,
|
||||||
@ -216,7 +212,6 @@ void Foam::parLagrangianRedistributor::redistributeLagrangianFieldFields
|
|||||||
).write();
|
).write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -228,6 +223,8 @@ void Foam::parLagrangianRedistributor::readLagrangianFields
|
|||||||
const wordHashSet& selectedFields
|
const wordHashSet& selectedFields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
const word fieldClassName(Container::typeName);
|
||||||
|
|
||||||
const wordList objectNames
|
const wordList objectNames
|
||||||
(
|
(
|
||||||
filterObjects<Container>
|
filterObjects<Container>
|
||||||
@ -239,21 +236,20 @@ void Foam::parLagrangianRedistributor::readLagrangianFields
|
|||||||
|
|
||||||
if (objectNames.size())
|
if (objectNames.size())
|
||||||
{
|
{
|
||||||
const word fieldClassName(Container::typeName);
|
|
||||||
|
|
||||||
Info<< " Reading lagrangian "
|
Info<< " Reading lagrangian "
|
||||||
<< fieldClassName << "s\n" << endl;
|
<< fieldClassName << "s\n" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
forAll(objectNames, i)
|
for (const word& objectName : objectNames)
|
||||||
{
|
{
|
||||||
Info<< " " << objectNames[i] << endl;
|
Info<< " " << objectName << endl;
|
||||||
|
|
||||||
// Read if present
|
// Read if present
|
||||||
Container* fieldPtr = new Container
|
Container* fieldPtr = new Container
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
objectNames[i],
|
objectName,
|
||||||
cloud.time().timeName(),
|
cloud.time().timeName(),
|
||||||
cloud,
|
cloud,
|
||||||
IOobject::READ_IF_PRESENT,
|
IOobject::READ_IF_PRESENT,
|
||||||
@ -264,7 +260,6 @@ void Foam::parLagrangianRedistributor::readLagrangianFields
|
|||||||
|
|
||||||
fieldPtr->store();
|
fieldPtr->store();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -275,6 +270,8 @@ void Foam::parLagrangianRedistributor::redistributeStoredLagrangianFields
|
|||||||
passivePositionParticleCloud& cloud
|
passivePositionParticleCloud& cloud
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
const word fieldClassName(Container::typeName);
|
||||||
|
|
||||||
HashTable<Container*> fields
|
HashTable<Container*> fields
|
||||||
(
|
(
|
||||||
cloud.lookupClass<Container>()
|
cloud.lookupClass<Container>()
|
||||||
@ -282,14 +279,13 @@ void Foam::parLagrangianRedistributor::redistributeStoredLagrangianFields
|
|||||||
|
|
||||||
if (fields.size())
|
if (fields.size())
|
||||||
{
|
{
|
||||||
const word fieldClassName(Container::typeName);
|
|
||||||
|
|
||||||
Info<< " Redistributing lagrangian "
|
Info<< " Redistributing lagrangian "
|
||||||
<< fieldClassName << "s\n" << endl;
|
<< fieldClassName << "s\n" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
forAllIter(typename HashTable<Container*>, fields, iter)
|
forAllIters(fields, iter)
|
||||||
{
|
{
|
||||||
Container& field = *iter();
|
Container& field = *(*iter);
|
||||||
|
|
||||||
Info<< " " << field.name() << endl;
|
Info<< " " << field.name() << endl;
|
||||||
|
|
||||||
@ -313,7 +309,6 @@ void Foam::parLagrangianRedistributor::redistributeStoredLagrangianFields
|
|||||||
).write();
|
).write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -636,11 +636,11 @@ void readFields
|
|||||||
if (haveMesh[Pstream::myProcNo()] && objectNames != masterNames)
|
if (haveMesh[Pstream::myProcNo()] && objectNames != masterNames)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "differing fields of type " << GeoField::typeName
|
<< "Objects not synchronised across processors." << nl
|
||||||
<< " on processors." << nl
|
<< "Master has " << flatOutput(masterNames) << nl
|
||||||
<< "Master has:" << masterNames << endl
|
<< "Processor " << Pstream::myProcNo()
|
||||||
<< Pstream::myProcNo() << " has:" << objectNames
|
<< " has " << flatOutput(objectNames)
|
||||||
<< abort(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
fields.setSize(masterNames.size());
|
fields.setSize(masterNames.size());
|
||||||
|
|||||||
@ -109,51 +109,49 @@ int main(int argc, char *argv[])
|
|||||||
IOobjectList objects(mesh, runTime.timeName());
|
IOobjectList objects(mesh, runTime.timeName());
|
||||||
|
|
||||||
|
|
||||||
// Converting volScalarField
|
// volScalarField
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
for
|
||||||
|
(
|
||||||
// Search list of objects for volScalarFields
|
const word& fieldName
|
||||||
IOobjectList scalarFields(objects.lookupClass("volScalarField"));
|
: objects.sortedNames(volScalarField::typeName)
|
||||||
|
)
|
||||||
forAllIter(IOobjectList, scalarFields, iter)
|
|
||||||
{
|
{
|
||||||
// Read field
|
// Lookup field from dictionary and convert field
|
||||||
volScalarField field(*iter(), mesh);
|
|
||||||
|
|
||||||
// lookup field from dictionary and convert field
|
|
||||||
label unitNumber;
|
label unitNumber;
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
foamDataToFluentDict.readIfPresent(field.name(), unitNumber)
|
foamDataToFluentDict.readIfPresent(fieldName, unitNumber)
|
||||||
&& unitNumber > 0
|
&& unitNumber > 0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< " Converting field " << field.name() << endl;
|
// Read field
|
||||||
|
volScalarField field(*(objects[fieldName]), mesh);
|
||||||
|
|
||||||
|
Info<< " Converting field " << fieldName << nl;
|
||||||
writeFluentField(field, unitNumber, fluentDataFile);
|
writeFluentField(field, unitNumber, fluentDataFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Converting volVectorField
|
// volVectorField
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
for
|
||||||
|
(
|
||||||
// Search list of objects for volVectorFields
|
const word& fieldName
|
||||||
IOobjectList vectorFields(objects.lookupClass("volVectorField"));
|
: objects.sortedNames(volVectorField::typeName)
|
||||||
|
)
|
||||||
forAllIter(IOobjectList, vectorFields, iter)
|
|
||||||
{
|
{
|
||||||
// Read field
|
// Lookup field from dictionary and convert field
|
||||||
volVectorField field(*iter(), mesh);
|
|
||||||
|
|
||||||
// lookup field from dictionary and convert field
|
|
||||||
label unitNumber;
|
label unitNumber;
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
foamDataToFluentDict.readIfPresent(field.name(), unitNumber)
|
foamDataToFluentDict.readIfPresent(fieldName, unitNumber)
|
||||||
&& unitNumber > 0
|
&& unitNumber > 0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< " Converting field " << field.name() << endl;
|
// Read field
|
||||||
|
volVectorField field(*(objects[fieldName]), mesh);
|
||||||
|
|
||||||
|
Info<< " Converting field " << fieldName << nl;
|
||||||
writeFluentField(field, unitNumber, fluentDataFile);
|
writeFluentField(field, unitNumber, fluentDataFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -316,7 +316,7 @@ int main(int argc, char *argv[])
|
|||||||
// and doesn't cost much) and simultaneously remove all
|
// and doesn't cost much) and simultaneously remove all
|
||||||
// "*_0" restart fields
|
// "*_0" restart fields
|
||||||
|
|
||||||
for (auto fieldType : volFieldTypes)
|
for (const word& fieldType : volFieldTypes)
|
||||||
{
|
{
|
||||||
usableObjects
|
usableObjects
|
||||||
(
|
(
|
||||||
@ -360,7 +360,7 @@ int main(int argc, char *argv[])
|
|||||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Info<< "Write volume field (";
|
Info<< "Write volume field (";
|
||||||
|
|
||||||
for (auto fieldType : volFieldTypes)
|
for (const word& fieldType : volFieldTypes)
|
||||||
{
|
{
|
||||||
// For convenience, just force each field-type into existence.
|
// For convenience, just force each field-type into existence.
|
||||||
// This simplifies code logic and doesn't cost much at all.
|
// This simplifies code logic and doesn't cost much at all.
|
||||||
|
|||||||
@ -13,7 +13,7 @@ if (timeDirs.size())
|
|||||||
|
|
||||||
IOobjectList objs(mesh, lastTimeName);
|
IOobjectList objs(mesh, lastTimeName);
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, objs, fieldIter)
|
forAllConstIters(objs, fieldIter)
|
||||||
{
|
{
|
||||||
const IOobject& obj = *fieldIter();
|
const IOobject& obj = *fieldIter();
|
||||||
const word& fieldName = obj.name();
|
const word& fieldName = obj.name();
|
||||||
|
|||||||
@ -49,13 +49,13 @@ Description
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
const label nTypes = 4;
|
const label nTypes = 4;
|
||||||
const word fieldTypes[] =
|
const wordList fieldTypes
|
||||||
{
|
({
|
||||||
"volScalarField",
|
"volScalarField",
|
||||||
"volVectorField",
|
"volVectorField",
|
||||||
"surfaceScalarField",
|
"surfaceScalarField",
|
||||||
cloud::prefix
|
cloud::prefix
|
||||||
};
|
});
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,14 @@
|
|||||||
for (label i=0; i < nTypes; i++)
|
for (const word& fieldType : fieldTypes)
|
||||||
{
|
{
|
||||||
wordList fieldNames = objects.names(fieldTypes[i]);
|
const wordList fieldNames = objects.sortedNames(fieldType);
|
||||||
|
|
||||||
if (fieldTypes[i] == "volScalarField")
|
if (fieldType == "volScalarField")
|
||||||
{
|
{
|
||||||
gmvFile << "variable" << nl;
|
gmvFile << "variable" << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(fieldNames, j)
|
for (const word& fieldName : fieldNames)
|
||||||
{
|
{
|
||||||
const word& fieldName = fieldNames[j];
|
|
||||||
|
|
||||||
IOobject fieldObject
|
IOobject fieldObject
|
||||||
(
|
(
|
||||||
fieldName,
|
fieldName,
|
||||||
@ -20,18 +18,18 @@ for (label i=0; i < nTypes; i++)
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
if (fieldTypes[i] == "volScalarField")
|
if (fieldType == "volScalarField")
|
||||||
{
|
{
|
||||||
volScalarField fld(fieldObject, mesh);
|
volScalarField fld(fieldObject, mesh);
|
||||||
gmvFile << fieldName << " 0" << nl;
|
gmvFile << fieldName << " 0" << nl;
|
||||||
for (label indx=0;indx<mesh.nCells();indx++)
|
for (label indx=0; indx<mesh.nCells(); ++indx)
|
||||||
{
|
{
|
||||||
gmvFile << fld[indx] << " ";
|
gmvFile << fld[indx] << " ";
|
||||||
}
|
}
|
||||||
gmvFile << nl;
|
gmvFile << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fieldTypes[i] == "volVectorField")
|
if (fieldType == "volVectorField")
|
||||||
{
|
{
|
||||||
if (fieldName == vComp)
|
if (fieldName == vComp)
|
||||||
{
|
{
|
||||||
@ -53,14 +51,14 @@ for (label i=0; i < nTypes; i++)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fieldTypes[i] == "surfaceScalarField")
|
if (fieldType == "surfaceScalarField")
|
||||||
{
|
{
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fieldTypes[i] == cloud::prefix)
|
if (fieldType == cloud::prefix)
|
||||||
{
|
{
|
||||||
IOobject positionsHeader
|
IOobject positionsHeader
|
||||||
(
|
(
|
||||||
@ -96,8 +94,8 @@ for (label i=0; i < nTypes; i++)
|
|||||||
|
|
||||||
IOobjectList objects(mesh, runTime.timeName(), cloud::prefix);
|
IOobjectList objects(mesh, runTime.timeName(), cloud::prefix);
|
||||||
|
|
||||||
wordList lagrangianScalarNames = objects.names("scalarField");
|
wordList lagrangianScalarNames(objects.sortedNames("scalarField"));
|
||||||
wordList lagrangianVectorNames = objects.names("vectorField");
|
wordList lagrangianVectorNames(objects.sortedNames("vectorField"));
|
||||||
|
|
||||||
if (particles.size())
|
if (particles.size())
|
||||||
{
|
{
|
||||||
@ -106,7 +104,7 @@ for (label i=0; i < nTypes; i++)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fieldTypes[i] == "volScalarField")
|
if (fieldType == "volScalarField")
|
||||||
{
|
{
|
||||||
gmvFile << "endvars" << nl;
|
gmvFile << "endvars" << nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,10 +17,8 @@ forAllConstIter(Cloud<passiveParticle>, particles, iter)
|
|||||||
}
|
}
|
||||||
gmvFile << nl;
|
gmvFile << nl;
|
||||||
|
|
||||||
forAll(lagrangianScalarNames, i)
|
for (const word& name : lagrangianScalarNames)
|
||||||
{
|
{
|
||||||
const word& name = lagrangianScalarNames[i];
|
|
||||||
|
|
||||||
IOField<scalar> fld
|
IOField<scalar> fld
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -48,10 +46,8 @@ forAll(lagrangianScalarNames, i)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(lagrangianVectorNames, i)
|
for (const word& name : lagrangianVectorNames)
|
||||||
{
|
{
|
||||||
const word& name = lagrangianVectorNames[i];
|
|
||||||
|
|
||||||
IOField<vector> fld
|
IOField<vector> fld
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
|
|||||||
@ -62,7 +62,7 @@ void ReadAndMapFields
|
|||||||
tetFields.setSize(fieldObjects.size());
|
tetFields.setSize(fieldObjects.size());
|
||||||
|
|
||||||
label i = 0;
|
label i = 0;
|
||||||
forAllConstIter(IOobjectList, fieldObjects, iter)
|
forAllConstIters(fieldObjects, iter)
|
||||||
{
|
{
|
||||||
Info<< "Converting " << ReadGeoField::typeName << ' ' << iter.key()
|
Info<< "Converting " << ReadGeoField::typeName << ' ' << iter.key()
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -138,8 +138,6 @@ void ReadAndMapFields
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#include "addOverwriteOption.H"
|
#include "addOverwriteOption.H"
|
||||||
@ -152,7 +150,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "checkTimeOptions.H"
|
#include "checkTimeOptions.H"
|
||||||
runTime.setTime(Times[startTime], startTime);
|
runTime.setTime(Times[startTime], startTime);
|
||||||
|
|
||||||
|
|
||||||
// Read the mesh
|
// Read the mesh
|
||||||
#include "createNamedMesh.H"
|
#include "createNamedMesh.H"
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "readFields.H"
|
#include "readFields.H"
|
||||||
#include "IOobjectList.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -43,17 +42,20 @@ label readFields
|
|||||||
PtrList<const GeoField>& fields
|
PtrList<const GeoField>& fields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
label nFields = 0;
|
// Available fields of type GeoField, sorted order
|
||||||
|
const wordList fieldNames =
|
||||||
// Available fields of type GeomField
|
(
|
||||||
const wordList fieldNames = objects.sortedNames(GeoField::typeName);
|
selectedFields.empty()
|
||||||
|
? objects.sortedNames(GeoField::typeName)
|
||||||
fields.setSize(fieldNames.size());
|
: objects.sortedNames(GeoField::typeName, selectedFields)
|
||||||
|
);
|
||||||
|
|
||||||
// Construct the fields
|
// Construct the fields
|
||||||
|
fields.resize(fieldNames.size());
|
||||||
|
|
||||||
|
label nFields = 0;
|
||||||
|
|
||||||
for (const word& fieldName : fieldNames)
|
for (const word& fieldName : fieldNames)
|
||||||
{
|
|
||||||
if (selectedFields.empty() || selectedFields.found(fieldName))
|
|
||||||
{
|
{
|
||||||
fields.set
|
fields.set
|
||||||
(
|
(
|
||||||
@ -64,16 +66,13 @@ label readFields
|
|||||||
).ptr()
|
).ptr()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fields.setSize(nFields);
|
|
||||||
|
|
||||||
return nFields;
|
return nFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
void readFields
|
label readFields
|
||||||
(
|
(
|
||||||
const typename GeoField::Mesh& mesh,
|
const typename GeoField::Mesh& mesh,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
@ -81,26 +80,29 @@ void readFields
|
|||||||
PtrList<const GeoField>& fields
|
PtrList<const GeoField>& fields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Search list of objects for fields of type GeomField
|
// Available fields of type GeoField, sorted order
|
||||||
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
const wordList fieldNames =
|
||||||
|
(
|
||||||
|
selectedFields.empty()
|
||||||
|
? objects.sortedNames(GeoField::typeName)
|
||||||
|
: objects.sortedNames(GeoField::typeName, selectedFields)
|
||||||
|
);
|
||||||
|
|
||||||
// Construct the fields
|
// Construct the fields
|
||||||
fields.setSize(fieldObjects.size());
|
fields.resize(fieldNames.size());
|
||||||
|
|
||||||
label nFields = 0;
|
label nFields = 0;
|
||||||
|
|
||||||
forAllIters(fieldObjects, iter)
|
for (const word& fieldName : fieldNames)
|
||||||
{
|
|
||||||
if (selectedFields.empty() || selectedFields.found(iter()->name()))
|
|
||||||
{
|
{
|
||||||
fields.set
|
fields.set
|
||||||
(
|
(
|
||||||
nFields++,
|
nFields++,
|
||||||
new GeoField(*iter(), mesh)
|
new GeoField(*(objects[fieldName]), mesh)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fields.setSize(nFields);
|
return nFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,16 +35,16 @@ SourceFiles
|
|||||||
#define readFields_H
|
#define readFields_H
|
||||||
|
|
||||||
#include "fvMeshSubsetProxy.H"
|
#include "fvMeshSubsetProxy.H"
|
||||||
|
#include "HashSet.H"
|
||||||
#include "PtrList.H"
|
#include "PtrList.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "HashSet.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Read the fields, optionally subset, and place on the pointer list
|
//- Read the fields, optionally subset, and place on the pointer list
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
label readFields
|
label readFields
|
||||||
(
|
(
|
||||||
@ -55,6 +55,18 @@ label readFields
|
|||||||
PtrList<const GeoField>& fields
|
PtrList<const GeoField>& fields
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Read the fields, and place on the pointer list
|
||||||
|
template<class GeoField>
|
||||||
|
label readFields
|
||||||
|
(
|
||||||
|
const typename GeoField::Mesh& mesh,
|
||||||
|
const IOobjectList& objects,
|
||||||
|
const wordHashSet& selectedFields,
|
||||||
|
PtrList<const GeoField>& fields
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -194,7 +194,6 @@ void Foam::vtkPVFoam::convertAreaFields()
|
|||||||
// Get objects (fields) for this time - only keep selected fields
|
// Get objects (fields) for this time - only keep selected fields
|
||||||
// the region name is already in the mesh db
|
// the region name is already in the mesh db
|
||||||
IOobjectList objects(mesh.mesh(), dbPtr_().timeName());
|
IOobjectList objects(mesh.mesh(), dbPtr_().timeName());
|
||||||
|
|
||||||
objects.filterKeys(selectedFields);
|
objects.filterKeys(selectedFields);
|
||||||
|
|
||||||
if (objects.empty())
|
if (objects.empty())
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -53,7 +53,7 @@ class fieldInterpolator
|
|||||||
Time& runTime_;
|
Time& runTime_;
|
||||||
const fvMesh& mesh_;
|
const fvMesh& mesh_;
|
||||||
const IOobjectList& objects_;
|
const IOobjectList& objects_;
|
||||||
const wordHashSet& selectedFields_;
|
const wordRes& selectedFields_;
|
||||||
instant ti_;
|
instant ti_;
|
||||||
instant ti1_;
|
instant ti1_;
|
||||||
const interpolationWeights& interpolator_;
|
const interpolationWeights& interpolator_;
|
||||||
@ -67,7 +67,7 @@ public:
|
|||||||
Time& runTime,
|
Time& runTime,
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const wordHashSet& selectedFields,
|
const wordRes& selectedFields,
|
||||||
const instant& ti,
|
const instant& ti,
|
||||||
const instant& ti1,
|
const instant& ti1,
|
||||||
const interpolationWeights& interpolator,
|
const interpolationWeights& interpolator,
|
||||||
@ -94,25 +94,25 @@ public:
|
|||||||
template<class GeoFieldType>
|
template<class GeoFieldType>
|
||||||
void fieldInterpolator::interpolate()
|
void fieldInterpolator::interpolate()
|
||||||
{
|
{
|
||||||
const word& fieldClassName = GeoFieldType::typeName;
|
const word& clsName = GeoFieldType::typeName;
|
||||||
|
|
||||||
IOobjectList fields = objects_.lookupClass(fieldClassName);
|
const wordList fieldNames =
|
||||||
|
|
||||||
if (fields.size())
|
|
||||||
{
|
|
||||||
Info<< " " << fieldClassName << "s:";
|
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
(
|
||||||
selectedFields_.empty()
|
selectedFields_.empty()
|
||||||
|| selectedFields_.found(fieldIter()->name())
|
? objects_.sortedNames(clsName)
|
||||||
)
|
: objects_.sortedNames(clsName, selectedFields_)
|
||||||
{
|
);
|
||||||
Info<< " " << fieldIter()->name() << '(';
|
|
||||||
|
|
||||||
scalar deltaT = (ti1_.value() - ti_.value())/(divisions_ + 1);
|
if (fieldNames.size())
|
||||||
|
{
|
||||||
|
Info<< " " << clsName << 's';
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const word& fieldName : fieldNames)
|
||||||
|
{
|
||||||
|
Info<< ' ' << fieldName << '(';
|
||||||
|
|
||||||
|
const scalar deltaT = (ti1_.value() - ti_.value())/(divisions_ + 1);
|
||||||
|
|
||||||
for (int j=0; j<divisions_; j++)
|
for (int j=0; j<divisions_; j++)
|
||||||
{
|
{
|
||||||
@ -150,7 +150,7 @@ void fieldInterpolator::interpolate()
|
|||||||
// Read on the objectRegistry all the required fields
|
// Read on the objectRegistry all the required fields
|
||||||
ReadFields<GeoFieldType>
|
ReadFields<GeoFieldType>
|
||||||
(
|
(
|
||||||
fieldIter()->name(),
|
fieldName,
|
||||||
mesh_,
|
mesh_,
|
||||||
selectedTimeNames
|
selectedTimeNames
|
||||||
);
|
);
|
||||||
@ -161,14 +161,14 @@ void fieldInterpolator::interpolate()
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fieldIter()->name(),
|
fieldName,
|
||||||
runTime_.timeName(),
|
runTime_.timeName(),
|
||||||
fieldIter()->db(),
|
objects_[fieldName]->db(),
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
fieldIter()->name(),
|
fieldName,
|
||||||
selectedTimeNames,
|
selectedTimeNames,
|
||||||
weights
|
weights
|
||||||
)
|
)
|
||||||
@ -179,10 +179,8 @@ void fieldInterpolator::interpolate()
|
|||||||
|
|
||||||
Info<< ')';
|
Info<< ')';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Info<< endl;
|
if (fieldNames.size()) Info<< endl;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -195,9 +193,9 @@ int main(int argc, char *argv[])
|
|||||||
argList::addOption
|
argList::addOption
|
||||||
(
|
(
|
||||||
"fields",
|
"fields",
|
||||||
"list",
|
"wordRes",
|
||||||
"specify a list of fields to be interpolated. Eg, '(U T p)' - "
|
"the fields (or field) to be interpolated."
|
||||||
"regular expressions not currently supported"
|
" Eg, '(U T p \"Y.*\")' or a single field 'U'"
|
||||||
);
|
);
|
||||||
argList::addOption
|
argList::addOption
|
||||||
(
|
(
|
||||||
@ -216,24 +214,22 @@ int main(int argc, char *argv[])
|
|||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
runTime.functionObjects().off();
|
runTime.functionObjects().off();
|
||||||
|
|
||||||
wordHashSet selectedFields;
|
wordRes selectedFields;
|
||||||
args.readIfPresent("fields", selectedFields);
|
args.readListIfPresent<wordRe>("fields", selectedFields);
|
||||||
|
|
||||||
if (selectedFields.size())
|
if (selectedFields.empty())
|
||||||
{
|
{
|
||||||
Info<< "Interpolating fields " << selectedFields << nl << endl;
|
Info<< "Interpolating all fields" << nl << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "Interpolating all fields" << nl << endl;
|
Info<< "Interpolating fields " << flatOutput(selectedFields)
|
||||||
|
<< nl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int divisions = 1;
|
int divisions = 1;
|
||||||
if (args.found("divisions"))
|
args.readIfPresent("divisions", divisions);
|
||||||
{
|
|
||||||
args.lookup("divisions")() >> divisions;
|
|
||||||
}
|
|
||||||
Info<< "Using " << divisions << " per time interval" << nl << endl;
|
Info<< "Using " << divisions << " per time interval" << nl << endl;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -298,10 +298,10 @@ void rewriteField
|
|||||||
|
|
||||||
label nChanged = 0;
|
label nChanged = 0;
|
||||||
|
|
||||||
forAllConstIter(HashTable<word>, thisNames, iter)
|
forAllConstIters(thisNames, iter)
|
||||||
{
|
{
|
||||||
const word& patchName = iter.key();
|
const word& patchName = iter.key();
|
||||||
const word& newName = iter();
|
const word& newName = iter.object();
|
||||||
|
|
||||||
Info<< "Looking for entry for patch " << patchName << endl;
|
Info<< "Looking for entry for patch " << patchName << endl;
|
||||||
|
|
||||||
@ -376,13 +376,13 @@ void rewriteFields
|
|||||||
const HashTable<word>& nbrNames
|
const HashTable<word>& nbrNames
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
forAll(fieldNames, i)
|
for (const word& fieldName : fieldNames)
|
||||||
{
|
{
|
||||||
rewriteField
|
rewriteField
|
||||||
(
|
(
|
||||||
isTestRun,
|
isTestRun,
|
||||||
runTime,
|
runTime,
|
||||||
fieldNames[i],
|
fieldName,
|
||||||
thisNames,
|
thisNames,
|
||||||
nbrNames
|
nbrNames
|
||||||
);
|
);
|
||||||
|
|||||||
@ -51,7 +51,7 @@ void MapConsistentVolFields
|
|||||||
|
|
||||||
IOobjectList fields = objects.lookupClass(fieldType::typeName);
|
IOobjectList fields = objects.lookupClass(fieldType::typeName);
|
||||||
|
|
||||||
forAllIter(IOobjectList, fields, fieldIter)
|
forAllConstIters(fields, fieldIter)
|
||||||
{
|
{
|
||||||
Info<< " interpolating " << fieldIter()->name()
|
Info<< " interpolating " << fieldIter()->name()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|||||||
@ -60,7 +60,7 @@ void MapLagrangianFields
|
|||||||
{
|
{
|
||||||
IOobjectList fields = objects.lookupClass(IOField<Type>::typeName);
|
IOobjectList fields = objects.lookupClass(IOField<Type>::typeName);
|
||||||
|
|
||||||
forAllIter(IOobjectList, fields, fieldIter)
|
forAllConstIters(fields, fieldIter)
|
||||||
{
|
{
|
||||||
Info<< " mapping lagrangian field "
|
Info<< " mapping lagrangian field "
|
||||||
<< fieldIter()->name() << endl;
|
<< fieldIter()->name() << endl;
|
||||||
@ -98,7 +98,7 @@ void MapLagrangianFields
|
|||||||
IOobjectList fieldFields =
|
IOobjectList fieldFields =
|
||||||
objects.lookupClass(IOField<Field<Type>>::typeName);
|
objects.lookupClass(IOField<Field<Type>>::typeName);
|
||||||
|
|
||||||
forAllIter(IOobjectList, fieldFields, fieldIter)
|
forAllConstIters(fieldFields, fieldIter)
|
||||||
{
|
{
|
||||||
Info<< " mapping lagrangian fieldField "
|
Info<< " mapping lagrangian fieldField "
|
||||||
<< fieldIter()->name() << endl;
|
<< fieldIter()->name() << endl;
|
||||||
@ -137,7 +137,7 @@ void MapLagrangianFields
|
|||||||
IOobjectList fieldFields =
|
IOobjectList fieldFields =
|
||||||
objects.lookupClass(CompactIOField<Field<Type>, Type>::typeName);
|
objects.lookupClass(CompactIOField<Field<Type>, Type>::typeName);
|
||||||
|
|
||||||
forAllIter(IOobjectList, fieldFields, fieldIter)
|
forAllConstIters(fieldFields, fieldIter)
|
||||||
{
|
{
|
||||||
Info<< " mapping lagrangian fieldField "
|
Info<< " mapping lagrangian fieldField "
|
||||||
<< fieldIter()->name() << endl;
|
<< fieldIter()->name() << endl;
|
||||||
|
|||||||
@ -51,7 +51,7 @@ void MapVolFields
|
|||||||
|
|
||||||
IOobjectList fields = objects.lookupClass(fieldType::typeName);
|
IOobjectList fields = objects.lookupClass(fieldType::typeName);
|
||||||
|
|
||||||
forAllIter(IOobjectList, fields, fieldIter)
|
forAllConstIters(fields, fieldIter)
|
||||||
{
|
{
|
||||||
IOobject fieldTargetIOobject
|
IOobject fieldTargetIOobject
|
||||||
(
|
(
|
||||||
|
|||||||
@ -39,7 +39,7 @@ void UnMapped(const IOobjectList& objects)
|
|||||||
{
|
{
|
||||||
IOobjectList fields = objects.lookupClass(Type::typeName);
|
IOobjectList fields = objects.lookupClass(Type::typeName);
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
forAllConstIters(fields, fieldIter)
|
||||||
{
|
{
|
||||||
mvBak(fieldIter()->objectPath(), "unmapped");
|
mvBak(fieldIter()->objectPath(), "unmapped");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,7 +58,7 @@ void MapLagrangianFields
|
|||||||
{
|
{
|
||||||
IOobjectList fields = objects.lookupClass(IOField<Type>::typeName);
|
IOobjectList fields = objects.lookupClass(IOField<Type>::typeName);
|
||||||
|
|
||||||
forAllIter(IOobjectList, fields, fieldIter)
|
forAllConstIters(fields, fieldIter)
|
||||||
{
|
{
|
||||||
const word& fieldName = fieldIter()->name();
|
const word& fieldName = fieldIter()->name();
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ void MapLagrangianFields
|
|||||||
IOobjectList fieldFields =
|
IOobjectList fieldFields =
|
||||||
objects.lookupClass(IOField<Field<Type>>::typeName);
|
objects.lookupClass(IOField<Field<Type>>::typeName);
|
||||||
|
|
||||||
forAllIter(IOobjectList, fieldFields, fieldIter)
|
forAllConstIters(fieldFields, fieldIter)
|
||||||
{
|
{
|
||||||
const word& fieldName = fieldIter()->name();
|
const word& fieldName = fieldIter()->name();
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ void MapLagrangianFields
|
|||||||
IOobjectList fieldFields =
|
IOobjectList fieldFields =
|
||||||
objects.lookupClass(CompactIOField<Field<Type>, Type>::typeName);
|
objects.lookupClass(CompactIOField<Field<Type>, Type>::typeName);
|
||||||
|
|
||||||
forAllIter(IOobjectList, fieldFields, fieldIter)
|
forAllConstIters(fieldFields, fieldIter)
|
||||||
{
|
{
|
||||||
const word& fieldName = fieldIter()->name();
|
const word& fieldName = fieldIter()->name();
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -131,15 +131,17 @@ void MapVolFields
|
|||||||
const fvMesh& meshSource = static_cast<const fvMesh&>(interp.srcRegion());
|
const fvMesh& meshSource = static_cast<const fvMesh&>(interp.srcRegion());
|
||||||
const fvMesh& meshTarget = static_cast<const fvMesh&>(interp.tgtRegion());
|
const fvMesh& meshTarget = static_cast<const fvMesh&>(interp.tgtRegion());
|
||||||
|
|
||||||
IOobjectList fields = objects.lookupClass(fieldType::typeName);
|
// Available fields, sorted order
|
||||||
|
const wordList fieldNames =
|
||||||
|
(
|
||||||
|
selectedFields.empty()
|
||||||
|
? objects.sortedNames(fieldType::typeName)
|
||||||
|
: objects.sortedNames(fieldType::typeName, selectedFields)
|
||||||
|
);
|
||||||
|
|
||||||
forAllIter(IOobjectList, fields, fieldIter)
|
for (const word& fieldName : fieldNames)
|
||||||
{
|
{
|
||||||
const word& fieldName = fieldIter()->name();
|
const fieldType fieldSource(*(objects[fieldName]), meshSource);
|
||||||
|
|
||||||
if (selectedFields.empty() || selectedFields.found(fieldName))
|
|
||||||
{
|
|
||||||
const fieldType fieldSource(*fieldIter(), meshSource);
|
|
||||||
|
|
||||||
IOobject targetIO
|
IOobject targetIO
|
||||||
(
|
(
|
||||||
@ -153,6 +155,7 @@ void MapVolFields
|
|||||||
{
|
{
|
||||||
Info<< " interpolating onto existing field "
|
Info<< " interpolating onto existing field "
|
||||||
<< fieldName << endl;
|
<< fieldName << endl;
|
||||||
|
|
||||||
fieldType fieldTarget(targetIO, meshTarget);
|
fieldType fieldTarget(targetIO, meshTarget);
|
||||||
|
|
||||||
interp.mapSrcToTgt(fieldSource, cop, fieldTarget);
|
interp.mapSrcToTgt(fieldSource, cop, fieldTarget);
|
||||||
@ -168,8 +171,10 @@ void MapVolFields
|
|||||||
|
|
||||||
targetIO.readOpt() = IOobject::NO_READ;
|
targetIO.readOpt() = IOobject::NO_READ;
|
||||||
|
|
||||||
tmp<fieldType>
|
tmp<fieldType> tfieldTarget
|
||||||
tfieldTarget(interp.mapSrcToTgt(fieldSource, cop));
|
(
|
||||||
|
interp.mapSrcToTgt(fieldSource, cop)
|
||||||
|
);
|
||||||
|
|
||||||
fieldType fieldTarget(targetIO, tfieldTarget);
|
fieldType fieldTarget(targetIO, tfieldTarget);
|
||||||
|
|
||||||
@ -178,7 +183,6 @@ void MapVolFields
|
|||||||
fieldTarget.write();
|
fieldTarget.write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ void UnMapped(const IOobjectList& objects)
|
|||||||
{
|
{
|
||||||
IOobjectList fields = objects.lookupClass(Type::typeName);
|
IOobjectList fields = objects.lookupClass(Type::typeName);
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
forAllConstIters(fields, fieldIter)
|
||||||
{
|
{
|
||||||
mvBak(fieldIter()->objectPath(), "unmapped");
|
mvBak(fieldIter()->objectPath(), "unmapped");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -690,8 +690,6 @@ $(derivedPointPatchFields)/codedFixedValue/codedFixedValuePointPatchFields.C
|
|||||||
|
|
||||||
fields/GeometricFields/pointFields/pointFields.C
|
fields/GeometricFields/pointFields/pointFields.C
|
||||||
|
|
||||||
fields/ReadFields/ReadFields.C
|
|
||||||
|
|
||||||
meshes/bandCompression/bandCompression.C
|
meshes/bandCompression/bandCompression.C
|
||||||
meshes/preservePatchTypes/preservePatchTypes.C
|
meshes/preservePatchTypes/preservePatchTypes.C
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ License
|
|||||||
#include "IOList.H"
|
#include "IOList.H"
|
||||||
#include "predicates.H"
|
#include "predicates.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
@ -45,18 +45,48 @@ namespace Foam
|
|||||||
|
|
||||||
forAllConstIters(list, iter)
|
forAllConstIters(list, iter)
|
||||||
{
|
{
|
||||||
if (matcher(iter.key()))
|
const word& key = iter.key();
|
||||||
|
const IOobject* io = iter.object();
|
||||||
|
|
||||||
|
if (matcher(key))
|
||||||
{
|
{
|
||||||
if (IOobject::debug)
|
if (IOobject::debug)
|
||||||
{
|
{
|
||||||
InfoInFunction << "Found " << iter.key() << endl;
|
InfoInFunction << "Found " << key << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
results.set
|
results.set(key, new IOobject(*io));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Templated implementation for lookupClass() - file-scope
|
||||||
|
template<class UnaryMatchPredicate>
|
||||||
|
static IOobjectList lookupClassImpl
|
||||||
(
|
(
|
||||||
iter.key(),
|
const IOobjectList& list,
|
||||||
new IOobject(*(iter.object()))
|
const word& clsName,
|
||||||
);
|
const UnaryMatchPredicate& matcher
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IOobjectList results(list.size());
|
||||||
|
|
||||||
|
forAllConstIters(list, iter)
|
||||||
|
{
|
||||||
|
const word& key = iter.key();
|
||||||
|
const IOobject* io = iter.object();
|
||||||
|
|
||||||
|
if (clsName == io->headerClassName() && matcher(key))
|
||||||
|
{
|
||||||
|
if (IOobject::debug)
|
||||||
|
{
|
||||||
|
InfoInFunction << "Found " << key << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
results.set(key, new IOobject(*io));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,10 +107,13 @@ namespace Foam
|
|||||||
// Summary (key,val) = (class-name, object-names)
|
// Summary (key,val) = (class-name, object-names)
|
||||||
forAllConstIters(list, iter)
|
forAllConstIters(list, iter)
|
||||||
{
|
{
|
||||||
if (matcher(iter.key()))
|
const word& key = iter.key();
|
||||||
|
const IOobject* io = iter.object();
|
||||||
|
|
||||||
|
if (matcher(key))
|
||||||
{
|
{
|
||||||
// Create entry (if needed) and insert
|
// Create entry (if needed) and insert
|
||||||
summary(iter.object()->headerClassName()).insert(iter.key());
|
summary(io->headerClassName()).insert(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,13 +136,17 @@ namespace Foam
|
|||||||
label count = 0;
|
label count = 0;
|
||||||
forAllConstIters(list, iter)
|
forAllConstIters(list, iter)
|
||||||
{
|
{
|
||||||
if (iter()->headerClassName() == clsName && matcher(iter.key()))
|
const word& key = iter.key();
|
||||||
|
const IOobject* io = iter.object();
|
||||||
|
|
||||||
|
if (clsName == io->headerClassName() && matcher(key))
|
||||||
{
|
{
|
||||||
objNames[count++] = iter.key();
|
objNames[count] = key;
|
||||||
|
++count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
objNames.setSize(count);
|
objNames.resize(count);
|
||||||
|
|
||||||
if (doSort)
|
if (doSort)
|
||||||
{
|
{
|
||||||
@ -118,7 +155,39 @@ namespace Foam
|
|||||||
|
|
||||||
return objNames;
|
return objNames;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// With syncPar = true, check that object names are the same on
|
||||||
|
// all processors. Trigger FatalError if not.
|
||||||
|
//
|
||||||
|
// The object names are sorted as a side-effect, since this is
|
||||||
|
// required for consistent ordering across all processors.
|
||||||
|
static bool checkNames(wordList& masterNames, const bool syncPar)
|
||||||
|
{
|
||||||
|
Foam::sort(masterNames);
|
||||||
|
|
||||||
|
if (syncPar && Pstream::parRun())
|
||||||
|
{
|
||||||
|
const wordList localNames(masterNames);
|
||||||
|
Pstream::scatter(masterNames);
|
||||||
|
|
||||||
|
if (localNames != masterNames)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Objects not synchronised across processors." << nl
|
||||||
|
<< "Master has " << flatOutput(masterNames) << nl
|
||||||
|
<< "Processor " << Pstream::myProcNo()
|
||||||
|
<< " has " << flatOutput(localNames)
|
||||||
|
<< exit(FatalError);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -272,28 +341,15 @@ Foam::IOobjectList Foam::IOobjectList::lookup(const wordRes& matcher) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::IOobjectList Foam::IOobjectList::lookup(const wordHashSet& matcher) const
|
||||||
|
{
|
||||||
|
return lookupImpl(*this, matcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::IOobjectList Foam::IOobjectList::lookupClass(const word& clsName) const
|
Foam::IOobjectList Foam::IOobjectList::lookupClass(const word& clsName) const
|
||||||
{
|
{
|
||||||
IOobjectList results(size());
|
return lookupClassImpl(*this, clsName, predicates::always());
|
||||||
|
|
||||||
forAllConstIters(*this, iter)
|
|
||||||
{
|
|
||||||
if (iter()->headerClassName() == clsName)
|
|
||||||
{
|
|
||||||
if (IOobject::debug)
|
|
||||||
{
|
|
||||||
InfoInFunction << "Found " << iter.key() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
results.set
|
|
||||||
(
|
|
||||||
iter.key(),
|
|
||||||
new IOobject(*(iter.object()))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -317,6 +373,13 @@ Foam::IOobjectList::classes(const wordRes& matcher) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::HashTable<Foam::wordHashSet>
|
||||||
|
Foam::IOobjectList::classes(const wordHashSet& matcher) const
|
||||||
|
{
|
||||||
|
return classesImpl(*this, matcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::wordList Foam::IOobjectList::names() const
|
Foam::wordList Foam::IOobjectList::names() const
|
||||||
{
|
{
|
||||||
return HashPtrTable<IOobject>::toc();
|
return HashPtrTable<IOobject>::toc();
|
||||||
@ -329,6 +392,15 @@ Foam::wordList Foam::IOobjectList::sortedNames() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::IOobjectList::names(const bool syncPar) const
|
||||||
|
{
|
||||||
|
wordList objNames(HashPtrTable<IOobject>::toc());
|
||||||
|
|
||||||
|
checkNames(objNames, syncPar);
|
||||||
|
return objNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::wordList Foam::IOobjectList::names
|
Foam::wordList Foam::IOobjectList::names
|
||||||
(
|
(
|
||||||
const word& clsName
|
const word& clsName
|
||||||
@ -338,26 +410,6 @@ Foam::wordList Foam::IOobjectList::names
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::wordList Foam::IOobjectList::names
|
|
||||||
(
|
|
||||||
const word& clsName,
|
|
||||||
const wordRe& matcher
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return namesImpl(*this, clsName, matcher, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::wordList Foam::IOobjectList::names
|
|
||||||
(
|
|
||||||
const word& clsName,
|
|
||||||
const wordRes& matcher
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return namesImpl(*this, clsName, matcher, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::wordList Foam::IOobjectList::sortedNames
|
Foam::wordList Foam::IOobjectList::sortedNames
|
||||||
(
|
(
|
||||||
const word& clsName
|
const word& clsName
|
||||||
@ -367,6 +419,29 @@ Foam::wordList Foam::IOobjectList::sortedNames
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::IOobjectList::names
|
||||||
|
(
|
||||||
|
const word& clsName,
|
||||||
|
const bool syncPar
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
wordList objNames(namesImpl(*this, clsName, predicates::always(), false));
|
||||||
|
|
||||||
|
checkNames(objNames, syncPar);
|
||||||
|
return objNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::IOobjectList::names
|
||||||
|
(
|
||||||
|
const word& clsName,
|
||||||
|
const wordRe& matcher
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return namesImpl(*this, clsName, matcher, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::wordList Foam::IOobjectList::sortedNames
|
Foam::wordList Foam::IOobjectList::sortedNames
|
||||||
(
|
(
|
||||||
const word& clsName,
|
const word& clsName,
|
||||||
@ -377,6 +452,30 @@ Foam::wordList Foam::IOobjectList::sortedNames
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::IOobjectList::names
|
||||||
|
(
|
||||||
|
const word& clsName,
|
||||||
|
const wordRe& matcher,
|
||||||
|
const bool syncPar
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
wordList objNames(namesImpl(*this, clsName, matcher, false));
|
||||||
|
|
||||||
|
checkNames(objNames, syncPar);
|
||||||
|
return objNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::IOobjectList::names
|
||||||
|
(
|
||||||
|
const word& clsName,
|
||||||
|
const wordRes& matcher
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return namesImpl(*this, clsName, matcher, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::wordList Foam::IOobjectList::sortedNames
|
Foam::wordList Foam::IOobjectList::sortedNames
|
||||||
(
|
(
|
||||||
const word& clsName,
|
const word& clsName,
|
||||||
@ -387,6 +486,54 @@ Foam::wordList Foam::IOobjectList::sortedNames
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::IOobjectList::names
|
||||||
|
(
|
||||||
|
const word& clsName,
|
||||||
|
const wordRes& matcher,
|
||||||
|
const bool syncPar
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
wordList objNames(namesImpl(*this, clsName, matcher, false));
|
||||||
|
|
||||||
|
checkNames(objNames, syncPar);
|
||||||
|
return objNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::IOobjectList::names
|
||||||
|
(
|
||||||
|
const word& clsName,
|
||||||
|
const wordHashSet& matcher
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return namesImpl(*this, clsName, matcher, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::IOobjectList::sortedNames
|
||||||
|
(
|
||||||
|
const word& clsName,
|
||||||
|
const wordHashSet& matcher
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return namesImpl(*this, clsName, matcher, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::IOobjectList::names
|
||||||
|
(
|
||||||
|
const word& clsName,
|
||||||
|
const wordHashSet& matcher,
|
||||||
|
const bool syncPar
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
wordList objNames(namesImpl(*this, clsName, matcher, false));
|
||||||
|
|
||||||
|
checkNames(objNames, syncPar);
|
||||||
|
return objNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::IOobjectList::operator=(IOobjectList&& list)
|
void Foam::IOobjectList::operator=(IOobjectList&& list)
|
||||||
|
|||||||
@ -118,6 +118,9 @@ public:
|
|||||||
//- The list of all IOobjects with matching names
|
//- The list of all IOobjects with matching names
|
||||||
IOobjectList lookup(const wordRes& matcher) const;
|
IOobjectList lookup(const wordRes& matcher) const;
|
||||||
|
|
||||||
|
//- The list of all IOobjects with matching names
|
||||||
|
IOobjectList lookup(const wordHashSet& matcher) const;
|
||||||
|
|
||||||
//- The list of all IOobjects with the given class name
|
//- The list of all IOobjects with the given class name
|
||||||
IOobjectList lookupClass(const word& clsName) const;
|
IOobjectList lookupClass(const word& clsName) const;
|
||||||
|
|
||||||
@ -201,6 +204,10 @@ public:
|
|||||||
// restricted to objects with names that satisfy the input matcher
|
// restricted to objects with names that satisfy the input matcher
|
||||||
HashTable<wordHashSet> classes(const wordRes& matcher) const;
|
HashTable<wordHashSet> classes(const wordRes& matcher) const;
|
||||||
|
|
||||||
|
//- A summary hash of classes used and their associated object names
|
||||||
|
// restricted to objects with names that satisfy the input matcher
|
||||||
|
HashTable<wordHashSet> classes(const wordHashSet& matcher) const;
|
||||||
|
|
||||||
|
|
||||||
// Summary of names
|
// Summary of names
|
||||||
|
|
||||||
@ -211,13 +218,61 @@ public:
|
|||||||
wordList names(const word& clsName) const;
|
wordList names(const word& clsName) const;
|
||||||
|
|
||||||
//- The names of IOobjects with the given class name that also
|
//- The names of IOobjects with the given class name that also
|
||||||
// have a name satisfying the input matcher
|
//- have a name satisfying the input matcher
|
||||||
wordList names(const word& clsName, const wordRe& matcher) const;
|
wordList names(const word& clsName, const wordRe& matcher) const;
|
||||||
|
|
||||||
//- The names of IOobjects with the given class name that also
|
//- The names of IOobjects with the given class name that also
|
||||||
// have a name satisfying the input matcher
|
//- have a name satisfying the input matcher
|
||||||
wordList names(const word& clsName, const wordRes& matcher) const;
|
wordList names(const word& clsName, const wordRes& matcher) const;
|
||||||
|
|
||||||
|
//- The names of IOobjects with the given class name that also
|
||||||
|
//- have a name satisfying the input matcher
|
||||||
|
wordList names(const word& clsName, const wordHashSet& matcher) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- A sorted list of names of the IOobjects.
|
||||||
|
// With syncPar = true, triggers FatalError if the names are
|
||||||
|
// not consistent on all processors.
|
||||||
|
wordList names(const bool syncPar) const;
|
||||||
|
|
||||||
|
//- A sorted list of names of the IOobjects
|
||||||
|
// With syncPar = true, triggers FatalError if the names are
|
||||||
|
// not consistent on all processors.
|
||||||
|
wordList names(const word& clsName, const bool syncPar) const;
|
||||||
|
|
||||||
|
//- The sorted names of IOobjects with the given class name that also
|
||||||
|
//- have a name satisfying the input matcher
|
||||||
|
// With syncPar = true, triggers FatalError if the names are
|
||||||
|
// not consistent on all processors.
|
||||||
|
wordList names
|
||||||
|
(
|
||||||
|
const word& clsName,
|
||||||
|
const wordRe& matcher,
|
||||||
|
const bool syncPar
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- The sorted names of IOobjects with the given class name that also
|
||||||
|
//- have a name satisfying the input matcher
|
||||||
|
// With syncPar = true, triggers FatalError if the names are
|
||||||
|
// not consistent on all processors.
|
||||||
|
wordList names
|
||||||
|
(
|
||||||
|
const word& clsName,
|
||||||
|
const wordRes& matcher,
|
||||||
|
const bool syncPar
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- The sorted names of IOobjects with the given class name that also
|
||||||
|
//- have a name satisfying the input matcher
|
||||||
|
// With syncPar = true, triggers FatalError if the names are
|
||||||
|
// not consistent on all processors.
|
||||||
|
wordList names
|
||||||
|
(
|
||||||
|
const word& cls,
|
||||||
|
const wordHashSet& matcher,
|
||||||
|
const bool syncPar
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Summary of names (sorted)
|
// Summary of names (sorted)
|
||||||
|
|
||||||
@ -228,13 +283,21 @@ public:
|
|||||||
wordList sortedNames(const word& clsName) const;
|
wordList sortedNames(const word& clsName) const;
|
||||||
|
|
||||||
//- The sorted names of IOobjects with the given class name that also
|
//- The sorted names of IOobjects with the given class name that also
|
||||||
// have a name satisfying the input matcher
|
//- have a name satisfying the input matcher
|
||||||
wordList sortedNames(const word& clsName, const wordRe& matcher) const;
|
wordList sortedNames(const word& clsName, const wordRe& matcher) const;
|
||||||
|
|
||||||
//- The sorted names of IOobjects with the given class name that also
|
//- The sorted names of IOobjects with the given class name that also
|
||||||
// have a name satisfying the input matcher
|
//- have a name satisfying the input matcher
|
||||||
wordList sortedNames(const word& clsName, const wordRes& matcher) const;
|
wordList sortedNames(const word& clsName, const wordRes& matcher) const;
|
||||||
|
|
||||||
|
//- The sorted names of IOobjects with the given class name that also
|
||||||
|
//- have a name satisfying the input matcher
|
||||||
|
wordList sortedNames
|
||||||
|
(
|
||||||
|
const word& clsName,
|
||||||
|
const wordHashSet& matcher
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -133,6 +133,13 @@ Foam::objectRegistry::classes(const wordRes& matcher) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::HashTable<Foam::wordHashSet>
|
||||||
|
Foam::objectRegistry::classes(const wordHashSet& matcher) const
|
||||||
|
{
|
||||||
|
return classesImpl(*this, matcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::wordList Foam::objectRegistry::names() const
|
Foam::wordList Foam::objectRegistry::names() const
|
||||||
{
|
{
|
||||||
return HashTable<regIOobject*>::toc();
|
return HashTable<regIOobject*>::toc();
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -160,13 +160,17 @@ public:
|
|||||||
HashTable<wordHashSet> classes() const;
|
HashTable<wordHashSet> classes() const;
|
||||||
|
|
||||||
//- A summary hash of classes used and their associated object names
|
//- A summary hash of classes used and their associated object names
|
||||||
// restricted to objects with names that satisfy the input matcher
|
//- restricted to objects with names that satisfy the input matcher
|
||||||
HashTable<wordHashSet> classes(const wordRe& matcher) const;
|
HashTable<wordHashSet> classes(const wordRe& matcher) const;
|
||||||
|
|
||||||
//- A summary hash of classes used and their associated object names
|
//- A summary hash of classes used and their associated object names
|
||||||
// restricted to objects with names that satisfy the input matcher
|
//- restricted to objects with names that satisfy the input matcher
|
||||||
HashTable<wordHashSet> classes(const wordRes& matcher) const;
|
HashTable<wordHashSet> classes(const wordRes& matcher) const;
|
||||||
|
|
||||||
|
//- A summary hash of classes used and their associated object names
|
||||||
|
//- restricted to objects with names that satisfy the input matcher
|
||||||
|
HashTable<wordHashSet> classes(const wordHashSet& matcher) const;
|
||||||
|
|
||||||
|
|
||||||
// Summary of names
|
// Summary of names
|
||||||
|
|
||||||
@ -181,15 +185,20 @@ public:
|
|||||||
wordList names() const;
|
wordList names() const;
|
||||||
|
|
||||||
//- The names of objects with the given type that also
|
//- The names of objects with the given type that also
|
||||||
// have a name satisfying the input matcher
|
//- have a name satisfying the input matcher
|
||||||
template<class Type>
|
template<class Type>
|
||||||
wordList names(const wordRe& matcher) const;
|
wordList names(const wordRe& matcher) const;
|
||||||
|
|
||||||
//- The names of objects with the given type that also
|
//- The names of objects with the given type that also
|
||||||
// have a name satisfying the input matcher
|
//- have a name satisfying the input matcher
|
||||||
template<class Type>
|
template<class Type>
|
||||||
wordList names(const wordRes& matcher) const;
|
wordList names(const wordRes& matcher) const;
|
||||||
|
|
||||||
|
//- The names of objects with the given type that also
|
||||||
|
//- have a name satisfying the input matcher
|
||||||
|
template<class Type>
|
||||||
|
wordList names(const wordHashSet& matcher) const;
|
||||||
|
|
||||||
|
|
||||||
// Summary of names (sorted)
|
// Summary of names (sorted)
|
||||||
|
|
||||||
@ -204,15 +213,20 @@ public:
|
|||||||
wordList sortedNames() const;
|
wordList sortedNames() const;
|
||||||
|
|
||||||
//- The sorted names of objects with the given type that also
|
//- The sorted names of objects with the given type that also
|
||||||
// have a name satisfying the input matcher
|
//- have a name satisfying the input matcher
|
||||||
template<class Type>
|
template<class Type>
|
||||||
wordList sortedNames(const wordRe& matcher) const;
|
wordList sortedNames(const wordRe& matcher) const;
|
||||||
|
|
||||||
//- The sorted names of objects with the given type that also
|
//- The sorted names of objects with the given type that also
|
||||||
// have a name satisfying the input matcher
|
//- have a name satisfying the input matcher
|
||||||
template<class Type>
|
template<class Type>
|
||||||
wordList sortedNames(const wordRes& matcher) const;
|
wordList sortedNames(const wordRes& matcher) const;
|
||||||
|
|
||||||
|
//- The sorted names of objects with the given type that also
|
||||||
|
//- have a name satisfying the input matcher
|
||||||
|
template<class Type>
|
||||||
|
wordList sortedNames(const wordHashSet& matcher) const;
|
||||||
|
|
||||||
|
|
||||||
// Lookup
|
// Lookup
|
||||||
|
|
||||||
@ -319,12 +333,11 @@ public:
|
|||||||
|
|
||||||
// Writing
|
// Writing
|
||||||
|
|
||||||
//- writeData function required by regIOobject but not used
|
//- writeData function required by regIOobject but not used.
|
||||||
// for this class, write is used instead
|
// For this class, write is used instead
|
||||||
virtual bool writeData(Ostream&) const
|
virtual bool writeData(Ostream&) const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -69,7 +69,8 @@ Foam::wordList Foam::objectRegistry::namesImpl
|
|||||||
{
|
{
|
||||||
if (isA<Type>(*iter()) && matcher(iter()->name()))
|
if (isA<Type>(*iter()) && matcher(iter()->name()))
|
||||||
{
|
{
|
||||||
objNames[count++] = iter()->name();
|
objNames[count] = iter()->name();
|
||||||
|
++count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,10 +102,14 @@ Foam::wordList Foam::objectRegistry::names(const wordRe& matcher) const
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::wordList Foam::objectRegistry::names
|
Foam::wordList Foam::objectRegistry::names(const wordRes& matcher) const
|
||||||
(
|
{
|
||||||
const wordRes& matcher
|
return namesImpl<Type>(*this, matcher, false);
|
||||||
) const
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::wordList Foam::objectRegistry::names(const wordHashSet& matcher) const
|
||||||
{
|
{
|
||||||
return namesImpl<Type>(*this, matcher, false);
|
return namesImpl<Type>(*this, matcher, false);
|
||||||
}
|
}
|
||||||
@ -118,10 +123,14 @@ Foam::wordList Foam::objectRegistry::sortedNames() const
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::wordList Foam::objectRegistry::sortedNames
|
Foam::wordList Foam::objectRegistry::sortedNames(const wordRe& matcher) const
|
||||||
(
|
{
|
||||||
const wordRe& matcher
|
return namesImpl<Type>(*this, matcher, true);
|
||||||
) const
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::wordList Foam::objectRegistry::sortedNames(const wordRes& matcher) const
|
||||||
{
|
{
|
||||||
return namesImpl<Type>(*this, matcher, true);
|
return namesImpl<Type>(*this, matcher, true);
|
||||||
}
|
}
|
||||||
@ -130,7 +139,7 @@ Foam::wordList Foam::objectRegistry::sortedNames
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::wordList Foam::objectRegistry::sortedNames
|
Foam::wordList Foam::objectRegistry::sortedNames
|
||||||
(
|
(
|
||||||
const wordRes& matcher
|
const wordHashSet& matcher
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return namesImpl<Type>(*this, matcher, true);
|
return namesImpl<Type>(*this, matcher, true);
|
||||||
@ -198,10 +207,8 @@ bool Foam::objectRegistry::foundObject
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,87 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "ReadFields.H"
|
|
||||||
#include "IOobjectList.H"
|
|
||||||
#include "objectRegistry.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// Read all fields of type. Returns names of fields read. Guarantees all
|
|
||||||
// processors to read fields in same order.
|
|
||||||
Foam::wordList Foam::fieldNames
|
|
||||||
(
|
|
||||||
const IOobjectList& fieldObjects,
|
|
||||||
const bool syncPar
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Get sorted field names. Sorting needed in parallel since different
|
|
||||||
// processors (using different file servers) might pick up the files
|
|
||||||
// in different order.
|
|
||||||
wordList masterNames(fieldObjects.sortedNames());
|
|
||||||
|
|
||||||
if (syncPar && Pstream::parRun())
|
|
||||||
{
|
|
||||||
// Check that I have the same fields as the master
|
|
||||||
const wordList localNames(masterNames);
|
|
||||||
Pstream::scatter(masterNames);
|
|
||||||
|
|
||||||
wordHashSet localNamesSet(localNames);
|
|
||||||
|
|
||||||
forAll(masterNames, i)
|
|
||||||
{
|
|
||||||
const word& masterFld = masterNames[i];
|
|
||||||
|
|
||||||
wordHashSet::iterator iter = localNamesSet.find(masterFld);
|
|
||||||
|
|
||||||
if (iter == localNamesSet.end())
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Fields not synchronised across processors." << endl
|
|
||||||
<< "Master has fields " << masterNames
|
|
||||||
<< " processor " << Pstream::myProcNo()
|
|
||||||
<< " has fields " << localNames << exit(FatalError);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
localNamesSet.erase(iter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localNamesSet.size())
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Fields not synchronised across processors." << endl
|
|
||||||
<< "Master has fields " << masterNames
|
|
||||||
<< " processor " << Pstream::myProcNo()
|
|
||||||
<< " has fields " << localNames << exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return masterNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -51,11 +51,9 @@ class regIOobject;
|
|||||||
class IOobjectList;
|
class IOobjectList;
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
|
|
||||||
//- Get sorted names of fields of type. If syncPar and running in parallel
|
//- Read Geometric fields of templated type.
|
||||||
// check for identical names
|
// \return sorted names of fields read.
|
||||||
wordList fieldNames(const IOobjectList& objects, const bool syncPar);
|
// \note All processors guaranteed to read fields in same order.
|
||||||
|
|
||||||
//- Read Geometric fields
|
|
||||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
wordList ReadFields
|
wordList ReadFields
|
||||||
(
|
(
|
||||||
@ -66,9 +64,10 @@ wordList ReadFields
|
|||||||
const bool readOldTime = false
|
const bool readOldTime = false
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Read all fields of the specified type.
|
|
||||||
// Returns names of fields read.
|
//- Read fields of the templated type.
|
||||||
// Guarantees all processors read fields in same order.
|
// \return sorted names of fields read.
|
||||||
|
// \note All processors guaranteed to read fields in same order.
|
||||||
template<class GeoField, class Mesh>
|
template<class GeoField, class Mesh>
|
||||||
wordList ReadFields
|
wordList ReadFields
|
||||||
(
|
(
|
||||||
@ -78,7 +77,9 @@ wordList ReadFields
|
|||||||
const bool syncPar = true
|
const bool syncPar = true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Read non-mesh fields, e.g. uniformDimensionedField like 'g'
|
//- Read non-mesh fields (uniformDimensionedField like 'g').
|
||||||
|
// \return sorted names of fields read.
|
||||||
|
// \note All processors guaranteed to read fields in same order.
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
wordList ReadFields
|
wordList ReadFields
|
||||||
(
|
(
|
||||||
@ -87,8 +88,8 @@ wordList ReadFields
|
|||||||
const bool syncPar = true
|
const bool syncPar = true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Read all GeometricFields of the specified type.
|
//- Read all GeometricFields of the templated type.
|
||||||
// The fieldsCache is an objectRegistry of all stored fields
|
// \param fieldsCache is an objectRegistry of all stored fields
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
static void ReadFields
|
static void ReadFields
|
||||||
(
|
(
|
||||||
@ -98,8 +99,8 @@ static void ReadFields
|
|||||||
objectRegistry& fieldsCache
|
objectRegistry& fieldsCache
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Read all GeometricFields of the specified type.
|
//- Read all GeometricFields of the templated type.
|
||||||
// The fieldsCache is an objectRegistry of all stored fields
|
// \param fieldsCache is the objectRegistry name where fields are stored
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
static void ReadFields
|
static void ReadFields
|
||||||
(
|
(
|
||||||
@ -109,9 +110,9 @@ static void ReadFields
|
|||||||
const word& registryName = "fieldsCache"
|
const word& registryName = "fieldsCache"
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Read the selected GeometricFields of the specified type.
|
//- Read the selected GeometricFields of the templated type.
|
||||||
// The fields are transferred to the objectRegistry and a list of them is
|
// The fields are transferred to the objectRegistry and a list of them is
|
||||||
// returned as a stack for later clean-up
|
// returned as a stack for later cleanup
|
||||||
template<class GeoFieldType>
|
template<class GeoFieldType>
|
||||||
void readFields
|
void readFields
|
||||||
(
|
(
|
||||||
@ -122,9 +123,9 @@ void readFields
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Read the selected UniformDimensionedFields of the specified type.
|
//- Read the selected UniformDimensionedFields of the templated type.
|
||||||
// The fields are transferred to the objectRegistry and a list of them is
|
// The fields are transferred to the objectRegistry and a list of them is
|
||||||
// returned as a stack for later clean-up
|
// returned as a stack for later cleanup
|
||||||
template<class GeoFieldType>
|
template<class GeoFieldType>
|
||||||
void readUniformFields
|
void readUniformFields
|
||||||
(
|
(
|
||||||
|
|||||||
@ -29,8 +29,6 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Read all GeometricFields of type. Returns names of fields read. Guarantees
|
|
||||||
// all processors to read fields in same order.
|
|
||||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
Foam::wordList Foam::ReadFields
|
Foam::wordList Foam::ReadFields
|
||||||
(
|
(
|
||||||
@ -43,25 +41,27 @@ Foam::wordList Foam::ReadFields
|
|||||||
{
|
{
|
||||||
typedef GeometricField<Type, PatchField, GeoMesh> GeoField;
|
typedef GeometricField<Type, PatchField, GeoMesh> GeoField;
|
||||||
|
|
||||||
// Search list of objects for wanted type
|
// Names of GeoField objects, sorted order.
|
||||||
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
const wordList fieldNames(objects.names(GeoField::typeName, syncPar));
|
||||||
|
|
||||||
const wordList masterNames(fieldNames(fieldObjects, syncPar));
|
// Construct the fields - reading in consistent (master) order.
|
||||||
|
fields.resize(fieldNames.size());
|
||||||
|
|
||||||
fields.setSize(masterNames.size());
|
label nFields = 0;
|
||||||
|
|
||||||
// Make sure to read in masterNames order.
|
for (const word& fieldName : fieldNames)
|
||||||
|
|
||||||
forAll(masterNames, i)
|
|
||||||
{
|
{
|
||||||
Info<< "Reading " << GeoField::typeName << ' ' << masterNames[i]
|
if (!nFields)
|
||||||
<< endl;
|
{
|
||||||
|
Info<< "Reading " << GeoField::typeName << ':';
|
||||||
|
}
|
||||||
|
Info<< ' ' << fieldName;
|
||||||
|
|
||||||
const IOobject& io = *fieldObjects[masterNames[i]];
|
const IOobject& io = *objects[fieldName];
|
||||||
|
|
||||||
fields.set
|
fields.set
|
||||||
(
|
(
|
||||||
i,
|
nFields++,
|
||||||
new GeoField
|
new GeoField
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -79,12 +79,13 @@ Foam::wordList Foam::ReadFields
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return masterNames;
|
|
||||||
|
if (nFields) Info<< endl;
|
||||||
|
|
||||||
|
return fieldNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Read all fields of type. Returns names of fields read. Guarantees all
|
|
||||||
// processors to read fields in same order.
|
|
||||||
template<class GeoField, class Mesh>
|
template<class GeoField, class Mesh>
|
||||||
Foam::wordList Foam::ReadFields
|
Foam::wordList Foam::ReadFields
|
||||||
(
|
(
|
||||||
@ -94,25 +95,27 @@ Foam::wordList Foam::ReadFields
|
|||||||
const bool syncPar
|
const bool syncPar
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Search list of objects for wanted type
|
// Names of GeoField objects, sorted order.
|
||||||
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
const wordList fieldNames(objects.names(GeoField::typeName, syncPar));
|
||||||
|
|
||||||
const wordList masterNames(fieldNames(fieldObjects, syncPar));
|
// Construct the fields - reading in consistent (master) order.
|
||||||
|
fields.resize(fieldNames.size());
|
||||||
|
|
||||||
fields.setSize(masterNames.size());
|
label nFields = 0;
|
||||||
|
|
||||||
// Make sure to read in masterNames order.
|
for (const word& fieldName : fieldNames)
|
||||||
|
|
||||||
forAll(masterNames, i)
|
|
||||||
{
|
{
|
||||||
Info<< "Reading " << GeoField::typeName << ' ' << masterNames[i]
|
if (!nFields)
|
||||||
<< endl;
|
{
|
||||||
|
Info<< "Reading " << GeoField::typeName << ':';
|
||||||
|
}
|
||||||
|
Info<< ' ' << fieldName;
|
||||||
|
|
||||||
const IOobject& io = *fieldObjects[masterNames[i]];
|
const IOobject& io = *objects[fieldName];
|
||||||
|
|
||||||
fields.set
|
fields.set
|
||||||
(
|
(
|
||||||
i,
|
nFields++,
|
||||||
new GeoField
|
new GeoField
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -129,12 +132,13 @@ Foam::wordList Foam::ReadFields
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return masterNames;
|
|
||||||
|
if (nFields) Info<< endl;
|
||||||
|
|
||||||
|
return fieldNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Read all (non-mesh) fields of type. Returns names of fields read. Guarantees
|
|
||||||
// all processors to read fields in same order.
|
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
Foam::wordList Foam::ReadFields
|
Foam::wordList Foam::ReadFields
|
||||||
(
|
(
|
||||||
@ -143,25 +147,27 @@ Foam::wordList Foam::ReadFields
|
|||||||
const bool syncPar
|
const bool syncPar
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Search list of objects for wanted type
|
// Names of GeoField objects, sorted order.
|
||||||
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
const wordList fieldNames(objects.names(GeoField::typeName, syncPar));
|
||||||
|
|
||||||
const wordList masterNames(fieldNames(fieldObjects, syncPar));
|
// Construct the fields - reading in consistent (master) order.
|
||||||
|
fields.resize(fieldNames.size());
|
||||||
|
|
||||||
fields.setSize(masterNames.size());
|
label nFields = 0;
|
||||||
|
|
||||||
// Make sure to read in masterNames order.
|
for (const word& fieldName : fieldNames)
|
||||||
|
|
||||||
forAll(masterNames, i)
|
|
||||||
{
|
{
|
||||||
Info<< "Reading " << GeoField::typeName << ' ' << masterNames[i]
|
if (!nFields)
|
||||||
<< endl;
|
{
|
||||||
|
Info<< "Reading " << GeoField::typeName << ':';
|
||||||
|
}
|
||||||
|
Info<< ' ' << fieldName;
|
||||||
|
|
||||||
const IOobject& io = *fieldObjects[masterNames[i]];
|
const IOobject& io = *objects[fieldName];
|
||||||
|
|
||||||
fields.set
|
fields.set
|
||||||
(
|
(
|
||||||
i,
|
nFields++,
|
||||||
new GeoField
|
new GeoField
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -177,7 +183,10 @@ Foam::wordList Foam::ReadFields
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return masterNames;
|
|
||||||
|
if (nFields) Info<< endl;
|
||||||
|
|
||||||
|
return fieldNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -190,51 +199,38 @@ void Foam::ReadFields
|
|||||||
objectRegistry& fieldsCache
|
objectRegistry& fieldsCache
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Collect all times that are no longer used
|
// Unload times that are no longer used
|
||||||
{
|
{
|
||||||
wordHashSet usedTimes(timeNames);
|
wordHashSet unusedTimes(fieldsCache.toc());
|
||||||
|
unusedTimes.erase(timeNames);
|
||||||
DynamicList<word> unusedTimes(fieldsCache.size());
|
|
||||||
|
|
||||||
forAllIter(objectRegistry, fieldsCache, timeIter)
|
|
||||||
{
|
|
||||||
const word& tm = timeIter.key();
|
|
||||||
if (!usedTimes.found(tm))
|
|
||||||
{
|
|
||||||
unusedTimes.append(tm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Info<< "Unloading times " << unusedTimes << endl;
|
//Info<< "Unloading times " << unusedTimes << endl;
|
||||||
|
|
||||||
forAll(unusedTimes, i)
|
for (const word& timeName : unusedTimes)
|
||||||
{
|
{
|
||||||
objectRegistry& timeCache = const_cast<objectRegistry&>
|
objectRegistry& timeCache =
|
||||||
(
|
fieldsCache.lookupObjectRef<objectRegistry>(timeName);
|
||||||
fieldsCache.lookupObject<objectRegistry>(unusedTimes[i])
|
|
||||||
);
|
|
||||||
fieldsCache.checkOut(timeCache);
|
fieldsCache.checkOut(timeCache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Load any new fields
|
// Load any new fields
|
||||||
forAll(timeNames, i)
|
for (const word& timeName : timeNames)
|
||||||
{
|
{
|
||||||
const word& tm = timeNames[i];
|
|
||||||
|
|
||||||
// Create if not found
|
// Create if not found
|
||||||
if (!fieldsCache.found(tm))
|
if (!fieldsCache.found(timeName))
|
||||||
{
|
{
|
||||||
//Info<< "Creating registry for time " << tm << endl;
|
//Info<< "Creating registry for time " << timeName << endl;
|
||||||
|
|
||||||
// Create objectRegistry if not found
|
// Create objectRegistry if not found
|
||||||
objectRegistry* timeCachePtr = new objectRegistry
|
objectRegistry* timeCachePtr = new objectRegistry
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
tm,
|
timeName,
|
||||||
tm,
|
timeName,
|
||||||
fieldsCache,
|
fieldsCache,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
@ -245,27 +241,24 @@ void Foam::ReadFields
|
|||||||
|
|
||||||
// Obtain cache for current time
|
// Obtain cache for current time
|
||||||
const objectRegistry& timeCache =
|
const objectRegistry& timeCache =
|
||||||
fieldsCache.lookupObject<objectRegistry>
|
fieldsCache.lookupObject<objectRegistry>(timeName);
|
||||||
(
|
|
||||||
tm
|
|
||||||
);
|
|
||||||
|
|
||||||
// Store field if not found
|
// Store field if not found
|
||||||
if (!timeCache.found(fieldName))
|
if (!timeCache.found(fieldName))
|
||||||
{
|
{
|
||||||
//Info<< "Loading field " << fieldName
|
//Info<< "Loading field " << fieldName
|
||||||
// << " for time " << tm << endl;
|
// << " for time " << timeName << endl;
|
||||||
|
|
||||||
GeoField loadedFld
|
GeoField loadedFld
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fieldName,
|
fieldName,
|
||||||
tm,
|
timeName,
|
||||||
mesh.thisDb(),
|
mesh.thisDb(),
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
false
|
false // do not register
|
||||||
),
|
),
|
||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
@ -276,7 +269,7 @@ void Foam::ReadFields
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fieldName,
|
fieldName,
|
||||||
tm,
|
timeName,
|
||||||
timeCache,
|
timeCache,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
@ -320,25 +313,27 @@ void Foam::readFields
|
|||||||
LIFOStack<regIOobject*>& storedObjects
|
LIFOStack<regIOobject*>& storedObjects
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IOobjectList fields(objects.lookupClass(GeoFieldType::typeName));
|
// Names of GeoField objects, sorted order. Not synchronised.
|
||||||
if (!fields.size()) return;
|
const wordList fieldNames
|
||||||
|
(
|
||||||
|
objects.sortedNames
|
||||||
|
(
|
||||||
|
GeoFieldType::typeName,
|
||||||
|
selectedFields // Only permit these
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
bool firstField = true;
|
label nFields = 0;
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
for (const word& fieldName : fieldNames)
|
||||||
{
|
{
|
||||||
const IOobject& io = *fieldIter();
|
const IOobject& io = *objects[fieldName];
|
||||||
const word& fieldName = io.name();
|
|
||||||
|
|
||||||
if (selectedFields.found(fieldName))
|
if (!nFields)
|
||||||
{
|
{
|
||||||
if (firstField)
|
Info<< " " << GeoFieldType::typeName << ':';
|
||||||
{
|
|
||||||
Info<< " " << GeoFieldType::typeName << "s:";
|
|
||||||
firstField = false;
|
|
||||||
}
|
}
|
||||||
|
Info<< ' ' << fieldName;
|
||||||
Info<< " " << fieldName;
|
|
||||||
|
|
||||||
GeoFieldType* fieldPtr = new GeoFieldType
|
GeoFieldType* fieldPtr = new GeoFieldType
|
||||||
(
|
(
|
||||||
@ -355,13 +350,11 @@ void Foam::readFields
|
|||||||
);
|
);
|
||||||
fieldPtr->store();
|
fieldPtr->store();
|
||||||
storedObjects.push(fieldPtr);
|
storedObjects.push(fieldPtr);
|
||||||
}
|
|
||||||
|
++nFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!firstField)
|
if (nFields) Info<< endl;
|
||||||
{
|
|
||||||
Info<< endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -374,66 +367,28 @@ void Foam::readUniformFields
|
|||||||
const bool syncPar
|
const bool syncPar
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Search list of objects for wanted type
|
// Names of UniformField objects, sorted order.
|
||||||
IOobjectList fields(objects.lookupClass(UniformFieldType::typeName));
|
const wordList fieldNames
|
||||||
if (!fields.size()) return;
|
(
|
||||||
|
objects.names
|
||||||
|
(
|
||||||
|
UniformFieldType::typeName,
|
||||||
|
selectedFields, // Only permit these
|
||||||
|
syncPar
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
wordList masterNames(fields.names());
|
label nFields = 0;
|
||||||
|
|
||||||
if (syncPar && Pstream::parRun())
|
for (const word& fieldName : fieldNames)
|
||||||
{
|
{
|
||||||
// Check that I have the same fields as the master
|
const IOobject& io = *objects[fieldName];
|
||||||
const wordList localNames(masterNames);
|
|
||||||
Pstream::scatter(masterNames);
|
|
||||||
|
|
||||||
wordHashSet localNamesSet(localNames);
|
if (!nFields)
|
||||||
|
|
||||||
forAll(masterNames, i)
|
|
||||||
{
|
{
|
||||||
const word& masterFld = masterNames[i];
|
Info<< " " << UniformFieldType::typeName << ':';
|
||||||
|
|
||||||
wordHashSet::iterator iter = localNamesSet.find(masterFld);
|
|
||||||
|
|
||||||
if (iter == localNamesSet.end())
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Fields not synchronised across processors." << endl
|
|
||||||
<< "Master has fields " << masterNames
|
|
||||||
<< " processor " << Pstream::myProcNo()
|
|
||||||
<< " has fields " << localNames << exit(FatalError);
|
|
||||||
}
|
}
|
||||||
else
|
Info<< ' ' << fieldName;
|
||||||
{
|
|
||||||
localNamesSet.erase(iter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localNamesSet.size())
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Fields not synchronised across processors." << endl
|
|
||||||
<< "Master has fields " << masterNames
|
|
||||||
<< " processor " << Pstream::myProcNo()
|
|
||||||
<< " has fields " << localNames << exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool firstField = true;
|
|
||||||
|
|
||||||
forAll(masterNames, i)
|
|
||||||
{
|
|
||||||
const IOobject& io = *fields[masterNames[i]];
|
|
||||||
const word& fieldName = io.name();
|
|
||||||
|
|
||||||
if (selectedFields.found(fieldName))
|
|
||||||
{
|
|
||||||
if (firstField)
|
|
||||||
{
|
|
||||||
Info<< " " << UniformFieldType::typeName << "s:";
|
|
||||||
firstField = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Info<< " " << fieldName;
|
|
||||||
|
|
||||||
UniformFieldType* fieldPtr = new UniformFieldType
|
UniformFieldType* fieldPtr = new UniformFieldType
|
||||||
(
|
(
|
||||||
@ -449,10 +404,11 @@ void Foam::readUniformFields
|
|||||||
);
|
);
|
||||||
fieldPtr->store();
|
fieldPtr->store();
|
||||||
storedObjects.push(fieldPtr);
|
storedObjects.push(fieldPtr);
|
||||||
}
|
|
||||||
|
++nFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< endl;
|
if (nFields) Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,6 @@ License
|
|||||||
#include "fvPatchFieldMapper.H"
|
#include "fvPatchFieldMapper.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "IOobjectList.H"
|
|
||||||
#include "turbulentFluidThermoModel.H"
|
#include "turbulentFluidThermoModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -52,7 +52,7 @@ void Foam::polyMeshFilter::updateSets(const mapPolyMesh& map)
|
|||||||
|
|
||||||
IOobjectList fileSets(Objects.lookupClass(SetType::typeName));
|
IOobjectList fileSets(Objects.lookupClass(SetType::typeName));
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fileSets, iter)
|
forAllConstIters(fileSets, iter)
|
||||||
{
|
{
|
||||||
if (!sets.found(iter.key()))
|
if (!sets.found(iter.key()))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -72,7 +72,7 @@ void Foam::setUpdater::updateSets(const mapPolyMesh& morphMap) const
|
|||||||
|
|
||||||
IOobjectList fileSets(Objects.lookupClass(Type::typeName));
|
IOobjectList fileSets(Objects.lookupClass(Type::typeName));
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fileSets, iter)
|
forAllConstIters(fileSets, iter)
|
||||||
{
|
{
|
||||||
if (!memSets.found(iter.key()))
|
if (!memSets.found(iter.key()))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,15 +56,12 @@ Foam::fvFieldReconstructor::reconstructFvVolumeInternalField
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp<DimensionedField<Type, volMesh>> tfield
|
auto tfield = tmp<DimensionedField<Type, volMesh>>::New
|
||||||
(
|
|
||||||
new DimensionedField<Type, volMesh>
|
|
||||||
(
|
(
|
||||||
fieldIoObject,
|
fieldIoObject,
|
||||||
mesh_,
|
mesh_,
|
||||||
procFields[0].dimensions(),
|
procFields[0].dimensions(),
|
||||||
internalField
|
internalField
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
tfield.ref().oriented() = procFields[0].oriented();
|
tfield.ref().oriented() = procFields[0].oriented();
|
||||||
@ -106,7 +103,6 @@ Foam::fvFieldReconstructor::reconstructFvVolumeInternalField
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return reconstructFvVolumeInternalField
|
return reconstructFvVolumeInternalField
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -286,16 +282,13 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
|
|||||||
|
|
||||||
// Now construct and write the field
|
// Now construct and write the field
|
||||||
// setting the internalField and patchFields
|
// setting the internalField and patchFields
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh>> tfield
|
auto tfield = tmp<GeometricField<Type, fvPatchField, volMesh>>::New
|
||||||
(
|
|
||||||
new GeometricField<Type, fvPatchField, volMesh>
|
|
||||||
(
|
(
|
||||||
fieldIoObject,
|
fieldIoObject,
|
||||||
mesh_,
|
mesh_,
|
||||||
procFields[0].dimensions(),
|
procFields[0].dimensions(),
|
||||||
internalField,
|
internalField,
|
||||||
patchFields
|
patchFields
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
tfield.ref().oriented() = procFields[0].oriented();
|
tfield.ref().oriented() = procFields[0].oriented();
|
||||||
@ -531,16 +524,13 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
|
|||||||
|
|
||||||
// Now construct and write the field
|
// Now construct and write the field
|
||||||
// setting the internalField and patchFields
|
// setting the internalField and patchFields
|
||||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tfield
|
auto tfield = tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>::New
|
||||||
(
|
|
||||||
new GeometricField<Type, fvsPatchField, surfaceMesh>
|
|
||||||
(
|
(
|
||||||
fieldIoObject,
|
fieldIoObject,
|
||||||
mesh_,
|
mesh_,
|
||||||
procFields[0].dimensions(),
|
procFields[0].dimensions(),
|
||||||
internalField,
|
internalField,
|
||||||
patchFields
|
patchFields
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
tfield.ref().oriented() = procFields[0].oriented();
|
tfield.ref().oriented() = procFields[0].oriented();
|
||||||
@ -604,31 +594,30 @@ void Foam::fvFieldReconstructor::reconstructFvVolumeInternalFields
|
|||||||
const wordHashSet& selectedFields
|
const wordHashSet& selectedFields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word& fieldClassName = DimensionedField<Type, volMesh>::typeName;
|
const word& clsName = DimensionedField<Type, volMesh>::typeName;
|
||||||
|
|
||||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
const wordList fieldNames =
|
||||||
|
|
||||||
if (fields.size())
|
|
||||||
{
|
|
||||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
(
|
||||||
selectedFields.empty()
|
selectedFields.empty()
|
||||||
|| selectedFields.found(fieldIter()->name())
|
? objects.sortedNames(clsName)
|
||||||
)
|
: objects.sortedNames(clsName, selectedFields)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (fieldNames.size())
|
||||||
{
|
{
|
||||||
Info<< " " << fieldIter()->name() << endl;
|
Info<< " Reconstructing " << clsName << "s\n" << nl;
|
||||||
|
}
|
||||||
|
|
||||||
reconstructFvVolumeInternalField<Type>(*fieldIter())().write();
|
for (const word& fieldName : fieldNames)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldName << endl;
|
||||||
|
|
||||||
nReconstructed_++;
|
reconstructFvVolumeInternalField<Type>(*(objects[fieldName]))().write();
|
||||||
}
|
|
||||||
}
|
++nReconstructed_;
|
||||||
Info<< endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fieldNames.size()) Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -639,32 +628,31 @@ void Foam::fvFieldReconstructor::reconstructFvVolumeFields
|
|||||||
const wordHashSet& selectedFields
|
const wordHashSet& selectedFields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word& fieldClassName =
|
const word& clsName =
|
||||||
GeometricField<Type, fvPatchField, volMesh>::typeName;
|
GeometricField<Type, fvPatchField, volMesh>::typeName;
|
||||||
|
|
||||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
const wordList fieldNames =
|
||||||
|
|
||||||
if (fields.size())
|
|
||||||
{
|
|
||||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
(
|
||||||
selectedFields.empty()
|
selectedFields.empty()
|
||||||
|| selectedFields.found(fieldIter()->name())
|
? objects.sortedNames(clsName)
|
||||||
)
|
: objects.sortedNames(clsName, selectedFields)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (fieldNames.size())
|
||||||
{
|
{
|
||||||
Info<< " " << fieldIter()->name() << endl;
|
Info<< " Reconstructing " << clsName << "s\n" << nl;
|
||||||
|
}
|
||||||
|
|
||||||
reconstructFvVolumeField<Type>(*fieldIter())().write();
|
for (const word& fieldName : fieldNames)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldName << endl;
|
||||||
|
|
||||||
nReconstructed_++;
|
reconstructFvVolumeField<Type>(*(objects[fieldName]))().write();
|
||||||
}
|
|
||||||
}
|
++nReconstructed_;
|
||||||
Info<< endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fieldNames.size()) Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -675,32 +663,31 @@ void Foam::fvFieldReconstructor::reconstructFvSurfaceFields
|
|||||||
const wordHashSet& selectedFields
|
const wordHashSet& selectedFields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word& fieldClassName =
|
const word& clsName =
|
||||||
GeometricField<Type, fvsPatchField, surfaceMesh>::typeName;
|
GeometricField<Type, fvsPatchField, surfaceMesh>::typeName;
|
||||||
|
|
||||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
const wordList fieldNames =
|
||||||
|
|
||||||
if (fields.size())
|
|
||||||
{
|
|
||||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
(
|
||||||
selectedFields.empty()
|
selectedFields.empty()
|
||||||
|| selectedFields.found(fieldIter()->name())
|
? objects.sortedNames(clsName)
|
||||||
)
|
: objects.sortedNames(clsName, selectedFields)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (fieldNames.size())
|
||||||
{
|
{
|
||||||
Info<< " " << fieldIter()->name() << endl;
|
Info<< " Reconstructing " << clsName << "s\n" << nl;
|
||||||
|
}
|
||||||
|
|
||||||
reconstructFvSurfaceField<Type>(*fieldIter())().write();
|
for (const word& fieldName : fieldNames)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldName << endl;
|
||||||
|
|
||||||
nReconstructed_++;
|
reconstructFvSurfaceField<Type>(*(objects[fieldName]))().write();
|
||||||
}
|
|
||||||
}
|
++nReconstructed_;
|
||||||
Info<< endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fieldNames.size()) Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -117,9 +117,7 @@ Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
|
|||||||
|
|
||||||
// Construct and write the field
|
// Construct and write the field
|
||||||
// setting the internalField and patchFields
|
// setting the internalField and patchFields
|
||||||
return tmp<GeometricField<Type, pointPatchField, pointMesh>>
|
return tmp<GeometricField<Type, pointPatchField, pointMesh>>::New
|
||||||
(
|
|
||||||
new GeometricField<Type, pointPatchField, pointMesh>
|
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
@ -133,7 +131,6 @@ Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
|
|||||||
procFields[0].dimensions(),
|
procFields[0].dimensions(),
|
||||||
internalField,
|
internalField,
|
||||||
patchFields
|
patchFields
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,33 +143,29 @@ void Foam::pointFieldReconstructor::reconstructFields
|
|||||||
const wordHashSet& selectedFields
|
const wordHashSet& selectedFields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
word fieldClassName
|
const word& clsName =
|
||||||
|
GeometricField<Type, pointPatchField, pointMesh>::typeName;
|
||||||
|
|
||||||
|
const wordList fieldNames =
|
||||||
(
|
(
|
||||||
GeometricField<Type, pointPatchField, pointMesh>::typeName
|
selectedFields.empty()
|
||||||
|
? objects.sortedNames(clsName)
|
||||||
|
: objects.sortedNames(clsName, selectedFields)
|
||||||
);
|
);
|
||||||
|
|
||||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
if (fieldNames.size())
|
||||||
|
|
||||||
if (fields.size())
|
|
||||||
{
|
{
|
||||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
Info<< " Reconstructing " << clsName << "s\n" << nl;
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!selectedFields.size()
|
|
||||||
|| selectedFields.found(fieldIter()->name())
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Info<< " " << fieldIter()->name() << endl;
|
|
||||||
|
|
||||||
reconstructField<Type>(*fieldIter())().write();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< endl;
|
for (const word& fieldName : fieldNames)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldName << endl;
|
||||||
|
|
||||||
|
reconstructField<Type>(*(objects[fieldName]))().write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fieldNames.size()) Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,8 +27,8 @@ InClass
|
|||||||
Description
|
Description
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
reconstructLagrangianPositions.C
|
|
||||||
reconstructLagrangianFields.C
|
reconstructLagrangianFields.C
|
||||||
|
reconstructLagrangianPositions.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,9 +39,7 @@ Foam::tmp<Foam::IOField<Type>> Foam::reconstructLagrangianField
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Construct empty field on mesh
|
// Construct empty field on mesh
|
||||||
tmp<IOField<Type>> tfield
|
auto tfield = tmp<IOField<Type>>::New
|
||||||
(
|
|
||||||
new IOField<Type>
|
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
@ -53,33 +51,32 @@ Foam::tmp<Foam::IOField<Type>> Foam::reconstructLagrangianField
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
Field<Type>(0)
|
Field<Type>(0)
|
||||||
)
|
|
||||||
);
|
);
|
||||||
Field<Type>& field = tfield.ref();
|
auto& field = tfield.ref();
|
||||||
|
|
||||||
forAll(meshes, i)
|
for (const fvMesh& localMesh : meshes)
|
||||||
{
|
{
|
||||||
// Check object on local mesh
|
// Check object on local mesh
|
||||||
IOobject localIOobject
|
IOobject localIOobject
|
||||||
(
|
(
|
||||||
fieldName,
|
fieldName,
|
||||||
meshes[i].time().timeName(),
|
localMesh.time().timeName(),
|
||||||
cloud::prefix/cloudName,
|
cloud::prefix/cloudName,
|
||||||
meshes[i],
|
localMesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
if (localIOobject.typeHeaderOk<IOField<Type>>(true))
|
if (localIOobject.typeHeaderOk<IOField<Type>>(true))
|
||||||
{
|
{
|
||||||
IOField<Type> fieldi(localIOobject);
|
IOField<Type> localField(localIOobject);
|
||||||
|
|
||||||
label offset = field.size();
|
const label offset = field.size();
|
||||||
field.setSize(offset + fieldi.size());
|
field.setSize(offset + localField.size());
|
||||||
|
|
||||||
forAll(fieldi, j)
|
forAll(localField, j)
|
||||||
{
|
{
|
||||||
field[offset + j] = fieldi[j];
|
field[offset + j] = localField[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,9 +96,7 @@ Foam::reconstructLagrangianFieldField
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Construct empty field on mesh
|
// Construct empty field on mesh
|
||||||
tmp<CompactIOField<Field<Type>, Type >> tfield
|
auto tfield = tmp<CompactIOField<Field<Type>, Type>>::New
|
||||||
(
|
|
||||||
new CompactIOField<Field<Type>, Type>
|
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
@ -113,19 +108,18 @@ Foam::reconstructLagrangianFieldField
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
Field<Field<Type>>(0)
|
Field<Field<Type>>(0)
|
||||||
)
|
|
||||||
);
|
);
|
||||||
Field<Field<Type>>& field = tfield.ref();
|
auto& field = tfield.ref();
|
||||||
|
|
||||||
forAll(meshes, i)
|
for (const fvMesh& localMesh : meshes)
|
||||||
{
|
{
|
||||||
// Check object on local mesh
|
// Check object on local mesh
|
||||||
IOobject localIOobject
|
IOobject localIOobject
|
||||||
(
|
(
|
||||||
fieldName,
|
fieldName,
|
||||||
meshes[i].time().timeName(),
|
localMesh.time().timeName(),
|
||||||
cloud::prefix/cloudName,
|
cloud::prefix/cloudName,
|
||||||
meshes[i],
|
localMesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
);
|
);
|
||||||
@ -139,14 +133,14 @@ Foam::reconstructLagrangianFieldField
|
|||||||
|| localIOobject.typeHeaderOk<IOField<Field<Type>>>(false)
|
|| localIOobject.typeHeaderOk<IOField<Field<Type>>>(false)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CompactIOField<Field<Type>, Type> fieldi(localIOobject);
|
CompactIOField<Field<Type>, Type> localField(localIOobject);
|
||||||
|
|
||||||
label offset = field.size();
|
const label offset = field.size();
|
||||||
field.setSize(offset + fieldi.size());
|
field.setSize(offset + localField.size());
|
||||||
|
|
||||||
forAll(fieldi, j)
|
forAll(localField, j)
|
||||||
{
|
{
|
||||||
field[offset + j] = fieldi[j];
|
field[offset + j] = localField[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,7 +149,6 @@ Foam::reconstructLagrangianFieldField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::reconstructLagrangianFields
|
void Foam::reconstructLagrangianFields
|
||||||
(
|
(
|
||||||
@ -166,36 +159,34 @@ void Foam::reconstructLagrangianFields
|
|||||||
const wordHashSet& selectedFields
|
const wordHashSet& selectedFields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word fieldClassName(IOField<Type>::typeName);
|
const word& clsName = IOField<Type>::typeName;
|
||||||
|
|
||||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
const wordList fieldNames =
|
||||||
|
|
||||||
if (fields.size())
|
|
||||||
{
|
|
||||||
Info<< " Reconstructing lagrangian "
|
|
||||||
<< fieldClassName << "s\n" << endl;
|
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
(
|
||||||
selectedFields.empty()
|
selectedFields.empty()
|
||||||
|| selectedFields.found(fieldIter()->name())
|
? objects.sortedNames(clsName)
|
||||||
)
|
: objects.sortedNames(clsName, selectedFields)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (fieldNames.size())
|
||||||
{
|
{
|
||||||
Info<< " " << fieldIter()->name() << endl;
|
Info<< " Reconstructing lagrangian " << clsName << "s\n" << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const word& fieldName : fieldNames)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldName << endl;
|
||||||
|
|
||||||
reconstructLagrangianField<Type>
|
reconstructLagrangianField<Type>
|
||||||
(
|
(
|
||||||
cloudName,
|
cloudName,
|
||||||
mesh,
|
mesh,
|
||||||
meshes,
|
meshes,
|
||||||
fieldIter()->name()
|
fieldName
|
||||||
)().write();
|
)().write();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Info<< endl;
|
if (fieldNames.size()) Info<< endl;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -210,69 +201,65 @@ void Foam::reconstructLagrangianFieldFields
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
const word fieldClassName(CompactIOField<Field<Type>, Type>::typeName);
|
const word& clsName = CompactIOField<Field<Type>,Type>::typeName;
|
||||||
|
|
||||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
const wordList fieldNames =
|
||||||
|
|
||||||
if (fields.size())
|
|
||||||
{
|
|
||||||
Info<< " Reconstructing lagrangian "
|
|
||||||
<< fieldClassName << "s\n" << endl;
|
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
(
|
||||||
selectedFields.empty()
|
selectedFields.empty()
|
||||||
|| selectedFields.found(fieldIter()->name())
|
? objects.sortedNames(clsName)
|
||||||
)
|
: objects.sortedNames(clsName, selectedFields)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (fieldNames.size())
|
||||||
{
|
{
|
||||||
Info<< " " << fieldIter()->name() << endl;
|
Info<< " Reconstructing lagrangian " << clsName << "s\n" << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const word& fieldName : fieldNames)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldName << endl;
|
||||||
|
|
||||||
reconstructLagrangianFieldField<Type>
|
reconstructLagrangianFieldField<Type>
|
||||||
(
|
(
|
||||||
cloudName,
|
cloudName,
|
||||||
mesh,
|
mesh,
|
||||||
meshes,
|
meshes,
|
||||||
fieldIter()->name()
|
fieldName
|
||||||
)().write();
|
)().write();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Info<< endl;
|
if (fieldNames.size()) Info<< endl;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const word fieldClassName(IOField<Field<Type>>::typeName);
|
const word& clsName = IOField<Field<Type>>::typeName;
|
||||||
|
|
||||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
const wordList fieldNames =
|
||||||
|
|
||||||
if (fields.size())
|
|
||||||
{
|
|
||||||
Info<< " Reconstructing lagrangian "
|
|
||||||
<< fieldClassName << "s\n" << endl;
|
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
(
|
||||||
selectedFields.empty()
|
selectedFields.empty()
|
||||||
|| selectedFields.found(fieldIter()->name())
|
? objects.sortedNames(clsName)
|
||||||
)
|
: objects.sortedNames(clsName, selectedFields)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (fieldNames.size())
|
||||||
{
|
{
|
||||||
Info<< " " << fieldIter()->name() << endl;
|
Info<< " Reconstructing lagrangian " << clsName << "s\n" << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const word& fieldName : fieldNames)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldName << endl;
|
||||||
|
|
||||||
reconstructLagrangianFieldField<Type>
|
reconstructLagrangianFieldField<Type>
|
||||||
(
|
(
|
||||||
cloudName,
|
cloudName,
|
||||||
mesh,
|
mesh,
|
||||||
meshes,
|
meshes,
|
||||||
fieldIter()->name()
|
fieldName
|
||||||
)().write();
|
)().write();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Info<< endl;
|
if (fieldNames.size()) Info<< endl;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -45,12 +45,12 @@ void Foam::reconstructLagrangianPositions
|
|||||||
IDLList<passiveParticle>()
|
IDLList<passiveParticle>()
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll(meshes, i)
|
forAll(meshes, meshi)
|
||||||
{
|
{
|
||||||
const labelList& cellMap = cellProcAddressing[i];
|
const labelList& cellMap = cellProcAddressing[meshi];
|
||||||
const labelList& faceMap = faceProcAddressing[i];
|
const labelList& faceMap = faceProcAddressing[meshi];
|
||||||
|
|
||||||
Cloud<passiveParticle> lpi(meshes[i], cloudName, false);
|
Cloud<passiveParticle> lpi(meshes[meshi], cloudName, false);
|
||||||
|
|
||||||
forAllConstIter(Cloud<passiveParticle>, lpi, iter)
|
forAllConstIter(Cloud<passiveParticle>, lpi, iter)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user