mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
foamToEnsightParts: added -index option, streamlined IOobject usage, fixed typo
This commit is contained in:
@ -39,6 +39,10 @@ Usage
|
|||||||
@param -zeroTime \n
|
@param -zeroTime \n
|
||||||
Include the often incomplete initial conditions.
|
Include the often incomplete initial conditions.
|
||||||
|
|
||||||
|
@param -index \<start\>\n
|
||||||
|
Ignore the time index contained in the time file and use a
|
||||||
|
simple indexing when creating the @c Ensight/data/######## files.
|
||||||
|
|
||||||
Note
|
Note
|
||||||
- no parallel data.
|
- no parallel data.
|
||||||
- writes to @a Ensight directory to avoid collisions with foamToEnsight.
|
- writes to @a Ensight directory to avoid collisions with foamToEnsight.
|
||||||
@ -70,6 +74,7 @@ int main(int argc, char *argv[])
|
|||||||
timeSelector::addOptions(true, false);
|
timeSelector::addOptions(true, false);
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validOptions.insert("ascii", "");
|
argList::validOptions.insert("ascii", "");
|
||||||
|
argList::validOptions.insert("index", "start");
|
||||||
|
|
||||||
const word volFieldTypes[] =
|
const word volFieldTypes[] =
|
||||||
{
|
{
|
||||||
@ -104,6 +109,15 @@ int main(int argc, char *argv[])
|
|||||||
format = IOstream::ASCII;
|
format = IOstream::ASCII;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// control for renumbering iterations
|
||||||
|
bool optIndex = false;
|
||||||
|
label indexingNumber = 0;
|
||||||
|
if (args.options().found("index"))
|
||||||
|
{
|
||||||
|
optIndex = true;
|
||||||
|
indexingNumber = readLabel(IStringStream(args.options()["index"])());
|
||||||
|
}
|
||||||
|
|
||||||
fileName ensightDir = args.rootPath()/args.globalCaseName()/"Ensight";
|
fileName ensightDir = args.rootPath()/args.globalCaseName()/"Ensight";
|
||||||
fileName dataDir = ensightDir/"data";
|
fileName dataDir = ensightDir/"data";
|
||||||
fileName caseFileName = "Ensight.case";
|
fileName caseFileName = "Ensight.case";
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
// Read time index from */uniform/time,
|
// Read time index from */uniform/time, but treat 0 and constant specially
|
||||||
// but treat 0 and constant specially
|
// or simply increment from the '-index' option if it was supplied
|
||||||
|
|
||||||
label timeIndex = 0;
|
label timeIndex = 0;
|
||||||
|
|
||||||
if
|
if (optIndex)
|
||||||
|
{
|
||||||
|
timeIndex = indexingNumber++;
|
||||||
|
}
|
||||||
|
else if
|
||||||
(
|
(
|
||||||
runTime.timeName() != "constant"
|
runTime.timeName() != "constant"
|
||||||
&& runTime.timeName() != "0"
|
&& runTime.timeName() != "0"
|
||||||
@ -22,19 +26,8 @@
|
|||||||
|
|
||||||
if (io.headerOk())
|
if (io.headerOk())
|
||||||
{
|
{
|
||||||
IOdictionary timeObject
|
io.readOpt() = IOobject::MUST_READ;
|
||||||
(
|
IOdictionary timeObject(io);
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"time",
|
|
||||||
runTime.timeName(),
|
|
||||||
"uniform",
|
|
||||||
runTime,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
timeObject.lookup("index") >> timeIndex;
|
timeObject.lookup("index") >> timeIndex;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
IOobject ioPoints
|
IOobject io
|
||||||
(
|
(
|
||||||
"points",
|
"points",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
@ -7,21 +7,11 @@
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ioPoints.headerOk())
|
if (io.headerOk())
|
||||||
{
|
{
|
||||||
// Reading new points
|
// Read new points
|
||||||
pointIOField newPoints
|
io.readOpt() = IOobject::MUST_READ;
|
||||||
(
|
pointIOField newPoints(io);
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"points",
|
|
||||||
mesh.time().timeName(),
|
|
||||||
polyMesh::meshSubDir,
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
mesh.movePoints(newPoints);
|
mesh.movePoints(newPoints);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,8 @@ forAllIter(HashTable<word>, volumeFields, fieldIter)
|
|||||||
const word& fieldName = fieldIter.key();
|
const word& fieldName = fieldIter.key();
|
||||||
const word& fieldType = fieldIter();
|
const word& fieldType = fieldIter();
|
||||||
|
|
||||||
if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) != "_0")
|
// ignore _0 fields
|
||||||
|
if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0")
|
||||||
{
|
{
|
||||||
volumeFields.erase(fieldIter);
|
volumeFields.erase(fieldIter);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user