mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
GIT: Resolved conflicts arising from merge with develop branch
This commit is contained in:
@ -2,18 +2,47 @@
|
||||
// - could restrict to the selected times
|
||||
|
||||
bool hasMovingMesh = false;
|
||||
if (timeDirs.size() > 1)
|
||||
|
||||
if (timeDirs.size() > 1 && Pstream::master())
|
||||
{
|
||||
hasMovingMesh = true;
|
||||
for (label i=0; i < timeDirs.size() && hasMovingMesh; ++i)
|
||||
// We already loaded a mesh (usually from constant).
|
||||
// See if any other "polyMesh/points" files exist too.
|
||||
|
||||
const fileName& baseDir = mesh.time().path();
|
||||
|
||||
Info<< "Search for moving mesh ... " << flush;
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
hasMovingMesh = IOobject
|
||||
hasMovingMesh =
|
||||
(
|
||||
"points",
|
||||
timeDirs[i].name(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
).typeHeaderOk<pointIOField>(true);
|
||||
isDir(baseDir/timeDirs[timeI].name()/polyMesh::meshSubDir)
|
||||
&& IOobject
|
||||
(
|
||||
"points",
|
||||
timeDirs[timeI].name(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // no register
|
||||
).typeHeaderOk<pointIOField>(true)
|
||||
);
|
||||
|
||||
if (hasMovingMesh)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasMovingMesh)
|
||||
{
|
||||
Info<< "found." << nl
|
||||
<< " Writing meshes for every timestep." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "none detected." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(hasMovingMesh, orOp<bool>());
|
||||
|
||||
@ -58,35 +58,36 @@ forAllConstIter(HashTable<word>, volumeFields, fieldIter)
|
||||
|
||||
if (fieldType == volScalarField::typeName)
|
||||
{
|
||||
ensightType = "scalar";
|
||||
ensightType = ensightPTraits<scalar>::typeName;
|
||||
}
|
||||
else if (fieldType == volVectorField::typeName)
|
||||
{
|
||||
ensightType = "vector";
|
||||
ensightType = ensightPTraits<vector>::typeName;
|
||||
}
|
||||
else if (fieldType == volSphericalTensorField::typeName)
|
||||
{
|
||||
ensightType = "tensor symm";
|
||||
ensightType = ensightPTraits<sphericalTensor>::typeName;
|
||||
}
|
||||
else if (fieldType == volSymmTensorField::typeName)
|
||||
{
|
||||
ensightType = "tensor symm";
|
||||
ensightType = ensightPTraits<symmTensor>::typeName;
|
||||
}
|
||||
else if (fieldType == volTensorField::typeName)
|
||||
{
|
||||
ensightType = "tensor asym";
|
||||
ensightType = ensightPTraits<tensor>::typeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ensightType.size())
|
||||
{
|
||||
ensightCaseEntry
|
||||
(
|
||||
caseFile,
|
||||
ensightType,
|
||||
fieldName,
|
||||
dataMask
|
||||
);
|
||||
}
|
||||
ensightCaseEntry
|
||||
(
|
||||
caseFile,
|
||||
ensightType,
|
||||
fieldName,
|
||||
dataMask
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -104,30 +105,31 @@ forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
||||
|
||||
if (fieldType == scalarIOField::typeName)
|
||||
{
|
||||
ensightType = "scalar";
|
||||
ensightType = ensightPTraits<scalar>::typeName;
|
||||
}
|
||||
else if (fieldType == vectorIOField::typeName)
|
||||
{
|
||||
ensightType = "vector";
|
||||
ensightType = ensightPTraits<vector>::typeName;
|
||||
}
|
||||
else if (fieldType == tensorIOField::typeName)
|
||||
{
|
||||
ensightType = "tensor";
|
||||
ensightType = ensightPTraits<tensor>::typeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ensightType.size())
|
||||
{
|
||||
ensightCaseEntry
|
||||
(
|
||||
caseFile,
|
||||
ensightType,
|
||||
fieldName,
|
||||
dataMask,
|
||||
cloud::prefix/cloudName,
|
||||
cloudNo,
|
||||
2
|
||||
);
|
||||
}
|
||||
ensightCaseEntry
|
||||
(
|
||||
caseFile,
|
||||
ensightType,
|
||||
fieldName,
|
||||
dataMask,
|
||||
cloud::prefix/cloudName,
|
||||
cloudNo,
|
||||
2
|
||||
);
|
||||
}
|
||||
cloudNo++;
|
||||
}
|
||||
@ -162,7 +164,7 @@ if (fieldTimesUsed.size())
|
||||
count = 0;
|
||||
forAll(fieldTimesUsed, i)
|
||||
{
|
||||
const label& index = fieldTimesUsed[i];
|
||||
const label index = fieldTimesUsed[i];
|
||||
caseFile
|
||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
||||
|
||||
@ -203,7 +205,7 @@ if (geometryTimesUsed.size())
|
||||
count = 0;
|
||||
forAll(geometryTimesUsed, i)
|
||||
{
|
||||
const label& index = geometryTimesUsed[i];
|
||||
const label index = geometryTimesUsed[i];
|
||||
caseFile
|
||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
||||
|
||||
@ -249,7 +251,7 @@ forAllConstIter(HashTable<DynamicList<label>>, cloudTimesUsed, cloudIter)
|
||||
count = 0;
|
||||
forAll(timesUsed, i)
|
||||
{
|
||||
const label& index = timesUsed[i];
|
||||
const label index = timesUsed[i];
|
||||
caseFile
|
||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ensightOutputFunctions.H"
|
||||
#include "ensightPTraits.H"
|
||||
|
||||
#include "passiveParticle.H"
|
||||
#include "IOField.H"
|
||||
@ -171,11 +172,8 @@ void Foam::ensightLagrangianField
|
||||
// when writing positions
|
||||
|
||||
ensightFile os(dataDir, postFileName, format);
|
||||
os.write
|
||||
(
|
||||
// description
|
||||
string(postFileName + " with " + pTraits<Type>::typeName + " values")
|
||||
);
|
||||
// description
|
||||
os.write(string(postFileName + " <" + pTraits<Type>::typeName + ">"));
|
||||
os.newline();
|
||||
|
||||
IOField<Type> field(fieldObject);
|
||||
@ -187,21 +185,20 @@ void Foam::ensightLagrangianField
|
||||
{
|
||||
Type val = field[i];
|
||||
|
||||
if (mag(val) < 1.0e-90)
|
||||
if (mag(val) < 1e-90)
|
||||
{
|
||||
val = Zero;
|
||||
}
|
||||
|
||||
for (direction cmpt=0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
||||
{
|
||||
os.write( component(val, cmpt) );
|
||||
}
|
||||
label cmpt = ensightPTraits<Type>::componentOrder[d];
|
||||
os.write(component(val, cmpt));
|
||||
|
||||
count += pTraits<Type>::nComponents;
|
||||
|
||||
if (count % 6 == 0)
|
||||
{
|
||||
os.newline();
|
||||
if (++count % 6 == 0)
|
||||
{
|
||||
os.newline();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,10 @@ HashTable<HashTable<word>> cloudFields;
|
||||
|
||||
if (timeDirs.size())
|
||||
{
|
||||
IOobjectList objs(mesh, timeDirs.last().name());
|
||||
const fileName& cloudPrefix = regionPrefix/cloud::prefix;
|
||||
const word& lastTimeName = timeDirs.last().name();
|
||||
|
||||
IOobjectList objs(mesh, lastTimeName);
|
||||
|
||||
forAllConstIter(IOobjectList, objs, fieldIter)
|
||||
{
|
||||
@ -31,14 +34,17 @@ if (timeDirs.size())
|
||||
//
|
||||
// now check for lagrangian/<cloudName>
|
||||
//
|
||||
fileNameList cloudDirs = readDir
|
||||
(
|
||||
runTime.path()
|
||||
/ timeDirs.last().name()
|
||||
/ regionPrefix
|
||||
/ cloud::prefix,
|
||||
fileName::DIRECTORY
|
||||
);
|
||||
fileNameList cloudDirs;
|
||||
if (!noLagrangian)
|
||||
{
|
||||
cloudDirs = readDir
|
||||
(
|
||||
runTime.path()
|
||||
/ lastTimeName
|
||||
/ cloudPrefix,
|
||||
fileName::DIRECTORY
|
||||
);
|
||||
}
|
||||
|
||||
forAll(cloudDirs, cloudI)
|
||||
{
|
||||
@ -54,8 +60,8 @@ if (timeDirs.size())
|
||||
IOobjectList objs
|
||||
(
|
||||
mesh,
|
||||
timeDirs.last().name(),
|
||||
cloud::prefix/cloudName
|
||||
lastTimeName,
|
||||
cloudPrefix/cloudName
|
||||
);
|
||||
|
||||
bool hasPositions = false;
|
||||
@ -89,17 +95,27 @@ if (timeDirs.size())
|
||||
//
|
||||
for (label i=0; volumeFields.size() && i < timeDirs.size(); ++i)
|
||||
{
|
||||
IOobjectList objs(mesh, timeDirs[i].name());
|
||||
const word& timeName = timeDirs[i].name();
|
||||
|
||||
forAllIter(HashTable<word>, volumeFields, fieldIter)
|
||||
// Everything is potentially missing, unless we discover otherwise
|
||||
wordHashSet missing(volumeFields);
|
||||
|
||||
// Avoid -->> IOobjectList objs(mesh, timeName); <<--
|
||||
// Too much overhead when done so frequently.
|
||||
|
||||
fileNameList contents = readDir
|
||||
(
|
||||
runTime.path()
|
||||
/ timeName,
|
||||
fileName::FILE
|
||||
);
|
||||
|
||||
forAll(contents, fileI)
|
||||
{
|
||||
const word& fieldName = fieldIter.key();
|
||||
|
||||
if (!objs.found(fieldName))
|
||||
{
|
||||
volumeFields.erase(fieldIter);
|
||||
}
|
||||
missing.erase(contents[fileI].name());
|
||||
}
|
||||
|
||||
volumeFields.erase(missing);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -48,6 +48,13 @@ Usage
|
||||
Ignore the time index contained in the time file and use a
|
||||
simple indexing when creating the \c Ensight/data/######## files.
|
||||
|
||||
- \par -noLagrangian \n
|
||||
Suppress writing lagrangian positions and fields.
|
||||
|
||||
- \par -index \<start\>\n
|
||||
Ignore the time index contained in the time file and use a
|
||||
simple indexing when creating the \c Ensight/data/######## files.
|
||||
|
||||
- \par -noMesh
|
||||
Suppress writing the geometry. Can be useful for converting partial
|
||||
results for a static geometry.
|
||||
@ -83,8 +90,8 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// enable -constant
|
||||
// probably don't need -withZero though, since the fields are vetted
|
||||
// Enable -constant
|
||||
// Probably don't need -withZero though, since the fields are vetted
|
||||
// afterwards anyhow
|
||||
timeSelector::addOptions(true, false);
|
||||
argList::noParallel();
|
||||
@ -101,6 +108,11 @@ int main(int argc, char *argv[])
|
||||
"and use simple indexing when creating the files"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noLagrangian",
|
||||
"suppress writing lagrangian positions and fields"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noMesh",
|
||||
"suppress writing the geometry. "
|
||||
@ -120,7 +132,7 @@ int main(int argc, char *argv[])
|
||||
"width of Ensight data subdir"
|
||||
);
|
||||
|
||||
// the volume field types that we handle
|
||||
// The volume field types that we handle
|
||||
wordHashSet volFieldTypes;
|
||||
volFieldTypes.insert(volScalarField::typeName);
|
||||
volFieldTypes.insert(volVectorField::typeName);
|
||||
@ -128,7 +140,7 @@ int main(int argc, char *argv[])
|
||||
volFieldTypes.insert(volSymmTensorField::typeName);
|
||||
volFieldTypes.insert(volTensorField::typeName);
|
||||
|
||||
// the lagrangian field types that we handle
|
||||
// The lagrangian field types that we handle
|
||||
wordHashSet cloudFieldTypes;
|
||||
cloudFieldTypes.insert(scalarIOField::typeName);
|
||||
cloudFieldTypes.insert(vectorIOField::typeName);
|
||||
@ -145,30 +157,32 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "createTime.H"
|
||||
|
||||
// get times list
|
||||
// Get times list
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
// default to binary output, unless otherwise specified
|
||||
IOstream::streamFormat format = IOstream::BINARY;
|
||||
if (args.optionFound("ascii"))
|
||||
{
|
||||
format = IOstream::ASCII;
|
||||
}
|
||||
// Default to binary output, unless otherwise specified
|
||||
const IOstream::streamFormat format =
|
||||
(
|
||||
args.optionFound("ascii")
|
||||
? IOstream::ASCII
|
||||
: IOstream::BINARY
|
||||
);
|
||||
|
||||
// control for renumbering iterations
|
||||
// Control for renumbering iterations
|
||||
label indexingNumber = 0;
|
||||
bool optIndex = args.optionReadIfPresent("index", indexingNumber);
|
||||
const bool optIndex = args.optionReadIfPresent("index", indexingNumber);
|
||||
const bool noLagrangian = args.optionFound("noLagrangian");
|
||||
|
||||
// always write the geometry, unless the -noMesh option is specified
|
||||
// Always write the geometry, unless the -noMesh option is specified
|
||||
bool optNoMesh = args.optionFound("noMesh");
|
||||
|
||||
// adjust output width
|
||||
// Adjust output width
|
||||
if (args.optionFound("width"))
|
||||
{
|
||||
ensightFile::subDirWidth(args.optionRead<label>("width"));
|
||||
}
|
||||
|
||||
// define sub-directory name to use for Ensight data
|
||||
// Define sub-directory name to use for Ensight data
|
||||
fileName ensightDir = "Ensight";
|
||||
args.optionReadIfPresent("name", ensightDir);
|
||||
|
||||
@ -190,7 +204,7 @@ int main(int argc, char *argv[])
|
||||
<< " " << ensightDir << endl;
|
||||
}
|
||||
|
||||
// as per mkdir -p "Ensight/data"
|
||||
// As per mkdir -p "Ensight/data"
|
||||
mkDir(ensightDir);
|
||||
mkDir(dataDir);
|
||||
|
||||
@ -204,10 +218,15 @@ int main(int argc, char *argv[])
|
||||
regionPrefix = regionName;
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
Info<< "Converting " << timeDirs.size() << " time steps" << endl;
|
||||
}
|
||||
|
||||
// Construct the list of ensight parts for the entire mesh
|
||||
ensightParts partsList(mesh);
|
||||
|
||||
// write summary information
|
||||
// Write summary information
|
||||
{
|
||||
OFstream partsInfoFile(ensightDir/"partsInfo");
|
||||
|
||||
@ -226,7 +245,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
// map times used
|
||||
// Map times used
|
||||
Map<scalar> timeIndices;
|
||||
|
||||
// TODO: Track the time indices used by the geometry
|
||||
@ -244,6 +263,9 @@ int main(int argc, char *argv[])
|
||||
cloudTimesUsed.insert(cloudIter.key(), DynamicList<label>());
|
||||
}
|
||||
|
||||
Info<< "Startup in "
|
||||
<< timer.cpuTimeIncrement() << " s, "
|
||||
<< mem.update().size() << " kB" << nl << endl;
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
@ -251,15 +273,15 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "getTimeIndex.H"
|
||||
|
||||
// remember the time index for the volume fields
|
||||
// Remember the time index for the volume fields
|
||||
fieldTimesUsed.append(timeIndex);
|
||||
|
||||
// the data/ITER subdirectory must exist
|
||||
// The data/ITER subdirectory must exist
|
||||
// Note that data/ITER is indeed a valid ensight::FileName
|
||||
const fileName subDir = ensightFile::subDir(timeIndex);
|
||||
mkDir(dataDir/subDir);
|
||||
|
||||
// place a timestamp in the directory for future reference
|
||||
// Place a timestamp in the directory for future reference
|
||||
{
|
||||
OFstream timeStamp(dataDir/subDir/"time");
|
||||
timeStamp
|
||||
@ -280,7 +302,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (hasMovingMesh)
|
||||
{
|
||||
// remember the time index for the geometry
|
||||
// Remember the time index for the geometry
|
||||
geometryTimesUsed.append(timeIndex);
|
||||
}
|
||||
|
||||
@ -294,7 +316,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "write volume field (" << flush;
|
||||
Info<< "Write volume field (" << flush;
|
||||
|
||||
forAllConstIter(HashTable<word>, volumeFields, fieldIter)
|
||||
{
|
||||
@ -376,19 +398,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
Info<< " )" << endl;
|
||||
|
||||
// check for clouds
|
||||
// Check for clouds
|
||||
forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
||||
{
|
||||
const word& cloudName = cloudIter.key();
|
||||
const fileName& cloudPrefix = regionPrefix/cloud::prefix;
|
||||
|
||||
if
|
||||
(
|
||||
!isDir
|
||||
(
|
||||
runTime.timePath()/regionPrefix/
|
||||
cloud::prefix/cloudName
|
||||
)
|
||||
)
|
||||
if (!isDir(runTime.timePath()/cloudPrefix/cloudName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -397,28 +413,25 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
mesh,
|
||||
runTime.timeName(),
|
||||
cloud::prefix/cloudName
|
||||
cloudPrefix/cloudName
|
||||
);
|
||||
|
||||
// check that the positions field is present for this time
|
||||
IOobject* positionPtr = cloudObjs.lookup(word("positions"));
|
||||
if (positionPtr != nullptr)
|
||||
{
|
||||
ensightParticlePositions
|
||||
(
|
||||
mesh,
|
||||
dataDir,
|
||||
subDir,
|
||||
cloudName,
|
||||
format
|
||||
);
|
||||
}
|
||||
else
|
||||
// Check that the positions field is present for this time
|
||||
if (!cloudObjs.found("positions"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Info<< "write " << cloudName << " (" << flush;
|
||||
Info<< "Write " << cloudName << " ( positions" << flush;
|
||||
|
||||
ensightParticlePositions
|
||||
(
|
||||
mesh,
|
||||
dataDir,
|
||||
subDir,
|
||||
cloudName,
|
||||
format
|
||||
);
|
||||
|
||||
forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
|
||||
{
|
||||
@ -430,7 +443,7 @@ int main(int argc, char *argv[])
|
||||
if (!fieldObject)
|
||||
{
|
||||
Info<< "missing "
|
||||
<< runTime.timeName()/cloud::prefix/cloudName
|
||||
<< runTime.timeName()/cloudPrefix/cloudName
|
||||
/ fieldName
|
||||
<< endl;
|
||||
continue;
|
||||
@ -476,7 +489,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< " )" << endl;
|
||||
|
||||
// remember the time index
|
||||
// Remember the time index
|
||||
cloudTimesUsed[cloudName].append(timeIndex);
|
||||
}
|
||||
|
||||
|
||||
@ -39,5 +39,5 @@
|
||||
}
|
||||
|
||||
timeIndices.insert(timeIndex, timeDirs[timeI].value());
|
||||
Info<< "\nTime [" << timeIndex << "] = " << runTime.timeName() << nl;
|
||||
Info<< nl << "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user