mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
added noLagrangian option
This commit is contained in:
@ -51,6 +51,7 @@ int main(int argc, char *argv[])
|
|||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
# include "addRegionOption.H"
|
# include "addRegionOption.H"
|
||||||
argList::validOptions.insert("fields", "\"(list of fields)\"");
|
argList::validOptions.insert("fields", "\"(list of fields)\"");
|
||||||
|
argList::validOptions.insert("noLagrangian", "");
|
||||||
|
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
@ -61,6 +62,8 @@ int main(int argc, char *argv[])
|
|||||||
IStringStream(args.options()["fields"])() >> selectedFields;
|
IStringStream(args.options()["fields"])() >> selectedFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool noLagrangian = args.options().found("noLagrangian");
|
||||||
|
|
||||||
// determine the processor count directly
|
// determine the processor count directly
|
||||||
label nProcs = 0;
|
label nProcs = 0;
|
||||||
while (isDir(args.path()/(word("processor") + name(nProcs))))
|
while (isDir(args.path()/(word("processor") + name(nProcs))))
|
||||||
@ -269,118 +272,121 @@ int main(int argc, char *argv[])
|
|||||||
// the first processor that has them. They are in pass2 only used
|
// the first processor that has them. They are in pass2 only used
|
||||||
// for name and type (scalar, vector etc).
|
// for name and type (scalar, vector etc).
|
||||||
|
|
||||||
HashTable<IOobjectList> cloudObjects;
|
if (!noLagrangian)
|
||||||
|
|
||||||
forAll (databases, procI)
|
|
||||||
{
|
{
|
||||||
fileNameList cloudDirs
|
HashTable<IOobjectList> cloudObjects;
|
||||||
(
|
|
||||||
readDir
|
|
||||||
(
|
|
||||||
databases[procI].timePath()/regionPrefix/"lagrangian",
|
|
||||||
fileName::DIRECTORY
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll (cloudDirs, i)
|
forAll (databases, procI)
|
||||||
{
|
{
|
||||||
// Check if we already have cloud objects for this cloudname.
|
fileNameList cloudDirs
|
||||||
HashTable<IOobjectList>::const_iterator iter =
|
(
|
||||||
cloudObjects.find(cloudDirs[i]);
|
readDir
|
||||||
|
|
||||||
if (iter == cloudObjects.end())
|
|
||||||
{
|
|
||||||
// Do local scan for valid cloud objects.
|
|
||||||
IOobjectList sprayObjs
|
|
||||||
(
|
(
|
||||||
procMeshes.meshes()[procI],
|
databases[procI].timePath()/regionPrefix/"lagrangian",
|
||||||
databases[procI].timeName(),
|
fileName::DIRECTORY
|
||||||
"lagrangian"/cloudDirs[i]
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
IOobject* positionsPtr = sprayObjs.lookup("positions");
|
forAll (cloudDirs, i)
|
||||||
|
{
|
||||||
|
// Check if we already have cloud objects for this cloudname
|
||||||
|
HashTable<IOobjectList>::const_iterator iter =
|
||||||
|
cloudObjects.find(cloudDirs[i]);
|
||||||
|
|
||||||
if (positionsPtr)
|
if (iter == cloudObjects.end())
|
||||||
{
|
{
|
||||||
cloudObjects.insert(cloudDirs[i], sprayObjs);
|
// Do local scan for valid cloud objects
|
||||||
|
IOobjectList sprayObjs
|
||||||
|
(
|
||||||
|
procMeshes.meshes()[procI],
|
||||||
|
databases[procI].timeName(),
|
||||||
|
"lagrangian"/cloudDirs[i]
|
||||||
|
);
|
||||||
|
|
||||||
|
IOobject* positionsPtr = sprayObjs.lookup("positions");
|
||||||
|
|
||||||
|
if (positionsPtr)
|
||||||
|
{
|
||||||
|
cloudObjects.insert(cloudDirs[i], sprayObjs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (cloudObjects.size())
|
if (cloudObjects.size())
|
||||||
{
|
|
||||||
// Pass2: reconstruct the cloud
|
|
||||||
forAllConstIter(HashTable<IOobjectList>, cloudObjects, iter)
|
|
||||||
{
|
{
|
||||||
const word cloudName = string::validate<word>(iter.key());
|
// Pass2: reconstruct the cloud
|
||||||
|
forAllConstIter(HashTable<IOobjectList>, cloudObjects, iter)
|
||||||
|
{
|
||||||
|
const word cloudName = string::validate<word>(iter.key());
|
||||||
|
|
||||||
// Objects (on arbitrary processor)
|
// Objects (on arbitrary processor)
|
||||||
const IOobjectList& sprayObjs = iter();
|
const IOobjectList& sprayObjs = iter();
|
||||||
|
|
||||||
Info<< "Reconstructing lagrangian fields for cloud "
|
Info<< "Reconstructing lagrangian fields for cloud "
|
||||||
<< cloudName << nl << endl;
|
<< cloudName << nl << endl;
|
||||||
|
|
||||||
reconstructLagrangianPositions
|
reconstructLagrangianPositions
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
cloudName,
|
cloudName,
|
||||||
procMeshes.meshes(),
|
procMeshes.meshes(),
|
||||||
procMeshes.faceProcAddressing(),
|
procMeshes.faceProcAddressing(),
|
||||||
procMeshes.cellProcAddressing()
|
procMeshes.cellProcAddressing()
|
||||||
);
|
);
|
||||||
reconstructLagrangianFields<label>
|
reconstructLagrangianFields<label>
|
||||||
(
|
(
|
||||||
cloudName,
|
cloudName,
|
||||||
mesh,
|
mesh,
|
||||||
procMeshes.meshes(),
|
procMeshes.meshes(),
|
||||||
sprayObjs
|
sprayObjs
|
||||||
);
|
);
|
||||||
reconstructLagrangianFields<scalar>
|
reconstructLagrangianFields<scalar>
|
||||||
(
|
(
|
||||||
cloudName,
|
cloudName,
|
||||||
mesh,
|
mesh,
|
||||||
procMeshes.meshes(),
|
procMeshes.meshes(),
|
||||||
sprayObjs
|
sprayObjs
|
||||||
);
|
);
|
||||||
reconstructLagrangianFields<vector>
|
reconstructLagrangianFields<vector>
|
||||||
(
|
(
|
||||||
cloudName,
|
cloudName,
|
||||||
mesh,
|
mesh,
|
||||||
procMeshes.meshes(),
|
procMeshes.meshes(),
|
||||||
sprayObjs
|
sprayObjs
|
||||||
);
|
);
|
||||||
reconstructLagrangianFields<sphericalTensor>
|
reconstructLagrangianFields<sphericalTensor>
|
||||||
(
|
(
|
||||||
cloudName,
|
cloudName,
|
||||||
mesh,
|
mesh,
|
||||||
procMeshes.meshes(),
|
procMeshes.meshes(),
|
||||||
sprayObjs
|
sprayObjs
|
||||||
);
|
);
|
||||||
reconstructLagrangianFields<symmTensor>
|
reconstructLagrangianFields<symmTensor>
|
||||||
(
|
(
|
||||||
cloudName,
|
cloudName,
|
||||||
mesh,
|
mesh,
|
||||||
procMeshes.meshes(),
|
procMeshes.meshes(),
|
||||||
sprayObjs
|
sprayObjs
|
||||||
);
|
);
|
||||||
reconstructLagrangianFields<tensor>
|
reconstructLagrangianFields<tensor>
|
||||||
(
|
(
|
||||||
cloudName,
|
cloudName,
|
||||||
mesh,
|
mesh,
|
||||||
procMeshes.meshes(),
|
procMeshes.meshes(),
|
||||||
sprayObjs
|
sprayObjs
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info << "No lagrangian fields" << nl << endl;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info << "No lagrangian fields" << nl << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are any "uniform" directories copy them from
|
// If there are any "uniform" directories copy them from
|
||||||
// the master processor.
|
// the master processor
|
||||||
|
|
||||||
fileName uniformDir0 = databases[0].timePath()/"uniform";
|
fileName uniformDir0 = databases[0].timePath()/"uniform";
|
||||||
if (isDir(uniformDir0))
|
if (isDir(uniformDir0))
|
||||||
|
|||||||
Reference in New Issue
Block a user