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
|
||||
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
|
||||
- no parallel data.
|
||||
- writes to @a Ensight directory to avoid collisions with foamToEnsight.
|
||||
@ -70,6 +74,7 @@ int main(int argc, char *argv[])
|
||||
timeSelector::addOptions(true, false);
|
||||
argList::noParallel();
|
||||
argList::validOptions.insert("ascii", "");
|
||||
argList::validOptions.insert("index", "start");
|
||||
|
||||
const word volFieldTypes[] =
|
||||
{
|
||||
@ -104,6 +109,15 @@ int main(int argc, char *argv[])
|
||||
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 dataDir = ensightDir/"data";
|
||||
fileName caseFileName = "Ensight.case";
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
// Read time index from */uniform/time,
|
||||
// but treat 0 and constant specially
|
||||
// Read time index from */uniform/time, but treat 0 and constant specially
|
||||
// or simply increment from the '-index' option if it was supplied
|
||||
|
||||
label timeIndex = 0;
|
||||
|
||||
if
|
||||
if (optIndex)
|
||||
{
|
||||
timeIndex = indexingNumber++;
|
||||
}
|
||||
else if
|
||||
(
|
||||
runTime.timeName() != "constant"
|
||||
&& runTime.timeName() != "0"
|
||||
@ -22,19 +26,8 @@
|
||||
|
||||
if (io.headerOk())
|
||||
{
|
||||
IOdictionary timeObject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"time",
|
||||
runTime.timeName(),
|
||||
"uniform",
|
||||
runTime,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
io.readOpt() = IOobject::MUST_READ;
|
||||
IOdictionary timeObject(io);
|
||||
|
||||
timeObject.lookup("index") >> timeIndex;
|
||||
}
|
||||
|
||||
@ -1,28 +1,18 @@
|
||||
{
|
||||
IOobject ioPoints
|
||||
IOobject io
|
||||
(
|
||||
"points",
|
||||
"points",
|
||||
runTime.timeName(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh
|
||||
);
|
||||
|
||||
if (ioPoints.headerOk())
|
||||
|
||||
if (io.headerOk())
|
||||
{
|
||||
// Reading new points
|
||||
pointIOField newPoints
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
mesh.time().timeName(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
// Read new points
|
||||
io.readOpt() = IOobject::MUST_READ;
|
||||
pointIOField newPoints(io);
|
||||
|
||||
mesh.movePoints(newPoints);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,8 @@ forAllIter(HashTable<word>, volumeFields, fieldIter)
|
||||
const word& fieldName = fieldIter.key();
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user