mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,11 +38,13 @@ using namespace Foam;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noBanner();
|
||||
argList::noParallel();
|
||||
argList::noCheckProcessorDirectories(); // parallel OK, but without checks
|
||||
|
||||
// argList::noFunctionObjects();
|
||||
argList::addOption("label", "value", "Test parsing of label");
|
||||
argList::addOption("scalar", "value", "Test parsing of scalar");
|
||||
argList::addOption("string", "value", "Test string lookup");
|
||||
argList::addOption("relative", "PATH", "Test relativePath");
|
||||
|
||||
// These are actually lies (never had -parseLabel, -parseScalar etc),
|
||||
// but good for testing...
|
||||
@ -70,18 +72,25 @@ int main(int argc, char *argv[])
|
||||
argList::addArgument("label");
|
||||
argList::noMandatoryArgs();
|
||||
|
||||
argList args(argc, argv);
|
||||
#include "setRootCase.H"
|
||||
|
||||
Info<< "command-line ("
|
||||
Pout<< "command-line ("
|
||||
<< args.options().size() << " options, "
|
||||
<< args.args().size() << " args)" << nl
|
||||
<< " " << args.commandLine().c_str() << nl << nl;
|
||||
|
||||
Info<< "rootPath: " << args.rootPath() << nl
|
||||
Pout<< "rootPath: " << args.rootPath() << nl
|
||||
<< "globalCase: " << args.globalCaseName() << nl
|
||||
<< "globalPath: " << args.globalPath() << nl
|
||||
<< nl;
|
||||
|
||||
if (args.found("relative"))
|
||||
{
|
||||
Pout<< "input path: " << args["relative"] << nl
|
||||
<< "relative : " << args.relativePath(args["relative"], true) << nl
|
||||
<< nl;
|
||||
}
|
||||
|
||||
Info<< "have: "
|
||||
<< args.count({"label", "scalar"}) << " options" << nl;
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ Description
|
||||
|
||||
#include "argList.H"
|
||||
#include "IOstreams.H"
|
||||
#include "TimePaths.H"
|
||||
#include "Time.H"
|
||||
#include "timeSelector.H"
|
||||
|
||||
using namespace Foam;
|
||||
@ -58,13 +58,31 @@ bool print(const instantList& instants)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote("Test timeSelector");
|
||||
argList::addNote("Test timeSelector and TimePaths");
|
||||
|
||||
timeSelector::addOptions(true, true);
|
||||
argList::noLibs();
|
||||
argList::noFunctionObjects();
|
||||
|
||||
argList::addOption("relative", "PATH", "Test relativePath");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
Pout<< "Time" << nl
|
||||
<< "rootPath: " << runTime.rootPath() << nl
|
||||
<< "path: " << runTime.path() << nl
|
||||
<< "globalCase: " << runTime.globalCaseName() << nl
|
||||
<< "globalPath: " << runTime.globalPath() << nl
|
||||
<< nl;
|
||||
|
||||
if (args.found("relative"))
|
||||
{
|
||||
Pout<< "input path: " << args["relative"] << nl
|
||||
<< "relative : " << runTime.relativePath(args["relative"], true)
|
||||
<< nl
|
||||
<< nl;
|
||||
}
|
||||
|
||||
autoPtr<TimePaths> timePaths;
|
||||
|
||||
|
||||
@ -82,7 +82,8 @@ int main(int argc, char *argv[])
|
||||
"Collapse faces that are in the supplied face set"
|
||||
);
|
||||
|
||||
#include "addDictOption.H"
|
||||
argList::addOption("dict", "file", "Use alternative collapseDict");
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
@ -342,7 +342,7 @@ int main(int argc, char *argv[])
|
||||
"For example, moving points, splitting/collapsing edges etc."
|
||||
);
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addDictOption.H"
|
||||
argList::addOption("dict", "file", "Use alternative modifyMeshDict");
|
||||
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
|
||||
@ -1469,7 +1469,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "addRegionOption.H"
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addDictOption.H"
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"dict", "file", "Use alternative extrudeToRegionMeshDict"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
@ -684,6 +684,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "addRegionOption.H"
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addProfilingOption.H"
|
||||
argList::addBoolOption
|
||||
(
|
||||
"checkGeometry",
|
||||
@ -707,8 +708,7 @@ int main(int argc, char *argv[])
|
||||
"file",
|
||||
"Name of the file to save the simplified surface to"
|
||||
);
|
||||
#include "addProfilingOption.H"
|
||||
#include "addDictOption.H"
|
||||
argList::addOption("dict", "file", "Use alternative snappyHexMeshDict");
|
||||
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
|
||||
@ -441,9 +441,8 @@ int main(int argc, char *argv[])
|
||||
"Does not duplicate points."
|
||||
);
|
||||
|
||||
#include "addDictOption.H"
|
||||
argList::addOption("dict", "file", "Use alternative createBafflesDict");
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addDictOption.H"
|
||||
#include "addRegionOption.H"
|
||||
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
@ -518,7 +518,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addRegionOption.H"
|
||||
#include "addDictOption.H"
|
||||
argList::addOption("dict", "file", "Use alternative createPatchDict");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"writeObj",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,24 +31,37 @@ License
|
||||
|
||||
Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
||||
:
|
||||
fvMesh(io),
|
||||
mirrorMeshDict_
|
||||
mirrorFvMesh
|
||||
(
|
||||
io,
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"mirrorMeshDict",
|
||||
time().system(),
|
||||
*this,
|
||||
io.time().system(),
|
||||
io.time(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
Foam::mirrorFvMesh::mirrorFvMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const IOdictionary& mirrorDict
|
||||
)
|
||||
:
|
||||
fvMesh(io)
|
||||
{
|
||||
plane mirrorPlane(mirrorMeshDict_);
|
||||
plane mirrorPlane(mirrorDict);
|
||||
|
||||
const scalar planeTolerance
|
||||
(
|
||||
mirrorMeshDict_.get<scalar>("planeTolerance")
|
||||
mirrorDict.get<scalar>("planeTolerance")
|
||||
);
|
||||
|
||||
const pointField& oldPoints = points();
|
||||
@ -57,6 +70,9 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
||||
const label nOldInternalFaces = nInternalFaces();
|
||||
const polyPatchList& oldPatches = boundaryMesh();
|
||||
|
||||
Info<< "Mirroring mesh at origin:" << mirrorPlane.origin()
|
||||
<< " normal:" << mirrorPlane.normal() << nl;
|
||||
|
||||
// Mirror the points
|
||||
Info<< "Mirroring points. Old points: " << oldPoints.size();
|
||||
|
||||
@ -66,15 +82,15 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
||||
labelList mirrorPointLookup(oldPoints.size(), -1);
|
||||
|
||||
// Grab the old points
|
||||
forAll(oldPoints, pointi)
|
||||
for (const point& pt : oldPoints)
|
||||
{
|
||||
newPoints[nNewPoints] = oldPoints[pointi];
|
||||
nNewPoints++;
|
||||
newPoints[nNewPoints] = pt;
|
||||
++nNewPoints;
|
||||
}
|
||||
|
||||
forAll(oldPoints, pointi)
|
||||
{
|
||||
scalar alpha =
|
||||
const scalar alpha =
|
||||
mirrorPlane.normalIntersect
|
||||
(
|
||||
oldPoints[pointi],
|
||||
@ -121,7 +137,6 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Info<< "Mirroring faces. Old faces: " << oldFaces.size();
|
||||
|
||||
// Algorithm:
|
||||
|
||||
@ -51,9 +51,6 @@ class mirrorFvMesh
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Mirror dictionary
|
||||
IOdictionary mirrorMeshDict_;
|
||||
|
||||
//- Mirrored mesh
|
||||
autoPtr<fvMesh> mirrorMeshPtr_;
|
||||
|
||||
@ -77,8 +74,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject
|
||||
mirrorFvMesh(const IOobject& io);
|
||||
//- Construct from IOobject, using system mirrorMeshDict
|
||||
explicit mirrorFvMesh(const IOobject& io);
|
||||
|
||||
//- Construct from IOobject and specified mirrorMeshDict
|
||||
mirrorFvMesh(const IOobject& io, const IOdictionary& mirrorDict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,12 +49,23 @@ int main(int argc, char *argv[])
|
||||
"Mirrors a mesh around a given plane."
|
||||
);
|
||||
|
||||
argList::addOption("dict", "file", "Use alternative mirrorMeshDict");
|
||||
argList::setAdvanced("decomposeParDict");
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
const bool overwrite = args.found("overwrite");
|
||||
|
||||
const word dictName("mirrorMeshDict");
|
||||
|
||||
#include "setSystemRunTimeDictionaryIO.H"
|
||||
|
||||
Info<< "Reading " << dictName << "\n" << endl;
|
||||
|
||||
const IOdictionary mirrorDict(dictIO);
|
||||
|
||||
mirrorFvMesh mesh
|
||||
(
|
||||
IOobject
|
||||
@ -62,7 +73,8 @@ int main(int argc, char *argv[])
|
||||
mirrorFvMesh::defaultRegion,
|
||||
runTime.constant(),
|
||||
runTime
|
||||
)
|
||||
),
|
||||
mirrorDict
|
||||
);
|
||||
|
||||
hexRef8Data refData
|
||||
|
||||
@ -162,7 +162,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addRegionOption.H"
|
||||
#include "addDictOption.H"
|
||||
|
||||
argList::addOption("dict", "file", "Use alternative refineMeshDict");
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
|
||||
@ -617,7 +617,8 @@ int main(int argc, char *argv[])
|
||||
#include "addRegionOption.H"
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addTimeOptions.H"
|
||||
#include "addDictOption.H"
|
||||
|
||||
argList::addOption("dict", "file", "Use alternative renumberMeshDict");
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
|
||||
@ -115,7 +115,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addRegionOption.H"
|
||||
#include "addDictOption.H"
|
||||
|
||||
argList::addOption("dict", "file", "Use alternative stitchMeshDict");
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
|
||||
@ -207,7 +207,9 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
timeSelector::addOptions(true, false); // constant(true), zero(false)
|
||||
#include "addDictOption.H"
|
||||
|
||||
argList::addOption("dict", "file", "Use alternative topoSetDict");
|
||||
|
||||
#include "addRegionOption.H"
|
||||
argList::addBoolOption
|
||||
(
|
||||
|
||||
@ -94,7 +94,7 @@ if (doLagrangian)
|
||||
);
|
||||
|
||||
Info<< " Lagrangian: "
|
||||
<< writer.output().relative(runTime.globalPath()) << nl;
|
||||
<< runTime.relativePath(writer.output()) << nl;
|
||||
|
||||
writer.writeTimeValue(mesh.time().value());
|
||||
writer.writeGeometry();
|
||||
|
||||
@ -107,7 +107,7 @@ Description
|
||||
);
|
||||
|
||||
Info<< " Surface : "
|
||||
<< writer.output().relative(runTime.globalPath()) << nl;
|
||||
<< runTime.relativePath(writer.output()) << nl;
|
||||
|
||||
|
||||
writer.writeTimeValue(timeValue);
|
||||
@ -211,7 +211,7 @@ Description
|
||||
);
|
||||
|
||||
Info<< " FaceZone : "
|
||||
<< writer.output().relative(runTime.globalPath()) << nl;
|
||||
<< runTime.relativePath(writer.output()) << nl;
|
||||
|
||||
|
||||
writer.beginFile(fz.name());
|
||||
|
||||
@ -42,7 +42,7 @@ if (faceSetName.size())
|
||||
);
|
||||
|
||||
Info<< " faceSet : "
|
||||
<< outputName.relative(runTime.globalPath()) << nl;
|
||||
<< runTime.relativePath(outputName) << nl;
|
||||
|
||||
vtk::writeFaceSet
|
||||
(
|
||||
@ -70,7 +70,7 @@ if (pointSetName.size())
|
||||
);
|
||||
|
||||
Info<< " pointSet : "
|
||||
<< outputName.relative(runTime.globalPath()) << nl;
|
||||
<< runTime.relativePath(outputName) << nl;
|
||||
|
||||
vtk::writePointSet
|
||||
(
|
||||
|
||||
@ -113,7 +113,7 @@ Description
|
||||
);
|
||||
|
||||
Info<< " Internal : "
|
||||
<< internalWriter->output().relative(runTime.globalPath()) << nl;
|
||||
<< runTime.relativePath(internalWriter->output()) << nl;
|
||||
|
||||
internalWriter->writeTimeValue(mesh.time().value());
|
||||
internalWriter->writeGeometry();
|
||||
@ -163,7 +163,7 @@ Description
|
||||
);
|
||||
|
||||
Info<< " Boundaries: "
|
||||
<< writer->output().relative(runTime.globalPath()) << nl;
|
||||
<< runTime.relativePath(writer->output()) << nl;
|
||||
|
||||
writer->writeTimeValue(timeValue);
|
||||
writer->writeGeometry();
|
||||
@ -229,7 +229,7 @@ Description
|
||||
);
|
||||
|
||||
Info<< " Boundary : "
|
||||
<< writer->output().relative(runTime.globalPath()) << nl;
|
||||
<< runTime.relativePath(writer->output()) << nl;
|
||||
|
||||
writer->writeTimeValue(timeValue);
|
||||
writer->writeGeometry();
|
||||
|
||||
@ -650,7 +650,7 @@ int main(int argc, char *argv[])
|
||||
if (args.found("overwrite") && isDir(regionDir))
|
||||
{
|
||||
Info<< "Removing old directory "
|
||||
<< regionDir.relative(runTime.globalPath())
|
||||
<< runTime.relativePath(regionDir)
|
||||
<< nl << endl;
|
||||
rmDir(regionDir);
|
||||
}
|
||||
|
||||
@ -109,7 +109,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
argList::noCheckProcessorDirectories();
|
||||
|
||||
#include "addDictOption.H"
|
||||
argList::addOption("dict", "file", "Use alternative noiseDict");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
|
||||
@ -396,7 +396,8 @@ int main(int argc, char *argv[])
|
||||
" (such as the patch type for fields and polyMesh/boundary files)."
|
||||
);
|
||||
|
||||
#include "addDictOption.H"
|
||||
argList::addOption("dict", "file", "Use alternative changeDictionaryDict");
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"subDict",
|
||||
|
||||
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"commsDir",
|
||||
"dir",
|
||||
"Specify alternate communications directory (default is 'comms')"
|
||||
"Specify communications directory (default is 'comms')"
|
||||
);
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -59,8 +59,9 @@ int main(int argc, char *argv[])
|
||||
" algorithm. Writes a map of fine to coarse grid."
|
||||
);
|
||||
|
||||
argList::addOption("dict", "file", "Use alternative viewFactorsDict");
|
||||
#include "addRegionOption.H"
|
||||
#include "addDictOption.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
@ -401,7 +401,8 @@ int main(int argc, char *argv[])
|
||||
"Set values on a selected set of cells/patch-faces via a dictionary"
|
||||
);
|
||||
|
||||
#include "addDictOption.H"
|
||||
argList::addOption("dict", "file", "Use alternative setFieldsDict");
|
||||
|
||||
#include "addRegionOption.H"
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -693,8 +693,7 @@ int main(int argc, char *argv[])
|
||||
vtkWriter->writeGeometry();
|
||||
|
||||
Info<< "Writing VTK to "
|
||||
<< ((vtkOutputDir/outputName).ext(vtkWriter->ext()))
|
||||
.relative(runTime.globalPath()) << nl;
|
||||
<< runTime.relativePath(vtkWriter->output()) << nl;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -274,8 +274,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
argList::noParallel();
|
||||
argList::addArgument("hookTolerance", "The point merge tolerance");
|
||||
|
||||
#include "addDictOption.H"
|
||||
argList::addOption("dict", "file", "Use alternative surfaceHookUpDict");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -100,7 +100,8 @@ int main(int argc, char *argv[])
|
||||
"factor",
|
||||
"Geometry scaling factor on output"
|
||||
);
|
||||
#include "addDictOption.H"
|
||||
argList::addOption("dict", "file", "Use alternative coordinateSystems");
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"from",
|
||||
|
||||
@ -107,7 +107,8 @@ int main(int argc, char *argv[])
|
||||
"factor",
|
||||
"Geometry scaling factor on output - default is 1"
|
||||
);
|
||||
#include "addDictOption.H"
|
||||
argList::addOption("dict", "file", "Use alternative coordinateSystems");
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"from",
|
||||
|
||||
@ -49,7 +49,7 @@ Usage
|
||||
Specify a scaling factor when writing files.
|
||||
|
||||
- \par -dict \<dictionary\>
|
||||
Specify an alternative dictionary for constant/coordinateSystems.
|
||||
Use alternative dictionary for constant/coordinateSystems.
|
||||
|
||||
- \par -from \<coordinateSystem\>
|
||||
Specify a coordinate system when reading files.
|
||||
@ -107,7 +107,8 @@ int main(int argc, char *argv[])
|
||||
"factor",
|
||||
"Geometry scaling factor on output - default is 1"
|
||||
);
|
||||
#include "addDictOption.H"
|
||||
argList::addOption("dict", "file", "Use alternative coordinateSystems");
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"from",
|
||||
|
||||
@ -28,16 +28,15 @@ Group
|
||||
grpSurfaceUtilities
|
||||
|
||||
Description
|
||||
Extracts surface from a polyMesh. Depending on output surface format
|
||||
triangulates faces.
|
||||
Extract patch or faceZone surfaces from a polyMesh.
|
||||
Depending on output surface format triangulates faces.
|
||||
|
||||
Region numbers on faces cannot be guaranteed to be the same as the patch
|
||||
indices.
|
||||
Region numbers on faces no guaranteed to be the same as the patch indices.
|
||||
|
||||
Optionally only triangulates named patches.
|
||||
Optionally only extracts named patches.
|
||||
|
||||
If run in parallel the processor patches get filtered out by default and
|
||||
the mesh gets merged (based on topology).
|
||||
If run in parallel, processor patches get filtered out by default and
|
||||
the mesh is merged (based on topology).
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -62,7 +61,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"Extract surface from a polyMesh"
|
||||
"Extract patch or faceZone surfaces from a polyMesh."
|
||||
" The name is historical, it only triangulates faces"
|
||||
" when the output format requires it."
|
||||
);
|
||||
timeSelector::addOptions();
|
||||
|
||||
@ -77,14 +78,16 @@ int main(int argc, char *argv[])
|
||||
argList::addOption
|
||||
(
|
||||
"patches",
|
||||
"(patch0 .. patchN)",
|
||||
"Only triangulate selected patches (wildcards supported)"
|
||||
"wordRes"
|
||||
"Specify single patch or multiple patches to extract.\n"
|
||||
"Eg, 'top' or '( front \".*back\" )'"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"faceZones",
|
||||
"(fz0 .. fzN)",
|
||||
"Triangulate selected faceZones (wildcards supported)"
|
||||
"wordRes",
|
||||
"Specify single or multiple faceZones to extract\n"
|
||||
"Eg, 'cells' or '( slice \"mfp-.*\" )'"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
@ -99,8 +102,7 @@ int main(int argc, char *argv[])
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Info<< "Extracting surface from boundaryMesh ..."
|
||||
<< endl << endl;
|
||||
Info<< "Extracting surface from boundaryMesh ..." << nl << nl;
|
||||
|
||||
const bool includeProcPatches =
|
||||
!(
|
||||
@ -134,7 +136,6 @@ int main(int argc, char *argv[])
|
||||
if (timeDirs.size() == 1)
|
||||
{
|
||||
outFileName = userOutFileName;
|
||||
Info<< nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -144,15 +145,11 @@ int main(int argc, char *argv[])
|
||||
Info<<" ... no mesh change." << nl;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< nl;
|
||||
}
|
||||
|
||||
// The filename based on the original, but with additional
|
||||
// time information. The extension was previously checked that
|
||||
// it exists
|
||||
std::string::size_type dot = userOutFileName.rfind('.');
|
||||
const auto dot = userOutFileName.rfind('.');
|
||||
|
||||
outFileName =
|
||||
userOutFileName.substr(0, dot) + "_"
|
||||
@ -160,6 +157,8 @@ int main(int argc, char *argv[])
|
||||
+ userOutFileName.ext();
|
||||
}
|
||||
|
||||
Info<< nl;
|
||||
|
||||
// Create local surface from:
|
||||
// - explicitly named patches only (-patches (at your option)
|
||||
// - all patches (default in sequential mode)
|
||||
@ -170,37 +169,39 @@ int main(int argc, char *argv[])
|
||||
// Construct table of patches to include.
|
||||
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
|
||||
|
||||
labelHashSet includePatches(bMesh.size());
|
||||
labelList includePatches;
|
||||
|
||||
if (args.found("patches"))
|
||||
{
|
||||
includePatches = bMesh.patchSet(args.getList<wordRe>("patches"));
|
||||
includePatches =
|
||||
bMesh.patchSet(args.getList<wordRe>("patches")).sortedToc();
|
||||
}
|
||||
else if (includeProcPatches)
|
||||
{
|
||||
includePatches = identity(bMesh.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(bMesh, patchi)
|
||||
{
|
||||
const polyPatch& patch = bMesh[patchi];
|
||||
|
||||
if (includeProcPatches || !isA<processorPolyPatch>(patch))
|
||||
{
|
||||
includePatches.insert(patchi);
|
||||
}
|
||||
}
|
||||
includePatches = identity(bMesh.nNonProcessor());
|
||||
}
|
||||
|
||||
|
||||
labelList includeFaceZones;
|
||||
|
||||
const faceZoneMesh& fzm = mesh.faceZones();
|
||||
labelHashSet includeFaceZones(fzm.size());
|
||||
|
||||
if (args.found("faceZones"))
|
||||
{
|
||||
wordReList zoneNames(args.getList<wordRe>("faceZones"));
|
||||
const wordList allZoneNames(fzm.names());
|
||||
|
||||
const wordRes zoneNames(args.getList<wordRe>("faceZones"));
|
||||
|
||||
labelHashSet hashed(2*fzm.size());
|
||||
|
||||
for (const wordRe& zoneName : zoneNames)
|
||||
{
|
||||
labelList zoneIDs = findStrings(zoneName, allZoneNames);
|
||||
includeFaceZones.insert(zoneIDs);
|
||||
hashed.insert(zoneIDs);
|
||||
|
||||
if (zoneIDs.empty())
|
||||
{
|
||||
@ -209,17 +210,15 @@ int main(int argc, char *argv[])
|
||||
<< zoneName << endl;
|
||||
}
|
||||
}
|
||||
Info<< "Additionally triangulating faceZones "
|
||||
<< UIndirectList<word>
|
||||
(
|
||||
allZoneNames,
|
||||
includeFaceZones.sortedToc()
|
||||
)
|
||||
|
||||
includeFaceZones = hashed.sortedToc();
|
||||
|
||||
Info<< "Additionally extracting faceZones "
|
||||
<< UIndirectList<word>(allZoneNames, includeFaceZones)
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// From (name of) patch to compact 'zone' index
|
||||
HashTable<label> compactZoneID(1024);
|
||||
// Mesh face and compact zone indx
|
||||
@ -252,18 +251,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Allocate compact numbering for all patches/faceZones
|
||||
forAllConstIter(HashTable<label>, patchSize, iter)
|
||||
forAllConstIters(patchSize, iter)
|
||||
{
|
||||
label sz = compactZoneID.size();
|
||||
compactZoneID.insert(iter.key(), sz);
|
||||
compactZoneID.insert(iter.key(), compactZoneID.size());
|
||||
}
|
||||
|
||||
forAllConstIter(HashTable<label>, zoneSize, iter)
|
||||
forAllConstIters(zoneSize, iter)
|
||||
{
|
||||
label sz = compactZoneID.size();
|
||||
//Info<< "For faceZone " << iter.key() << " allocating zoneID "
|
||||
// << sz << endl;
|
||||
compactZoneID.insert(iter.key(), sz);
|
||||
compactZoneID.insert(iter.key(), compactZoneID.size());
|
||||
}
|
||||
|
||||
|
||||
@ -273,7 +268,7 @@ int main(int argc, char *argv[])
|
||||
// Rework HashTable into labelList just for speed of conversion
|
||||
labelList patchToCompactZone(bMesh.size(), -1);
|
||||
labelList faceZoneToCompactZone(bMesh.size(), -1);
|
||||
forAllConstIter(HashTable<label>, compactZoneID, iter)
|
||||
forAllConstIters(compactZoneID, iter)
|
||||
{
|
||||
label patchi = bMesh.findPatchID(iter.key());
|
||||
if (patchi != -1)
|
||||
|
||||
@ -57,7 +57,7 @@ int main(int argc, char *argv[])
|
||||
"Add patches (regions) to a surface with a user-selectable method"
|
||||
);
|
||||
argList::noParallel();
|
||||
#include "addDictOption.H"
|
||||
argList::addOption("dict", "file", "Use alternative surfacePatchDict");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -25,6 +25,9 @@
|
||||
# For USERMPI, the user is responsible for supplying an appropriate
|
||||
# wmake/rules/General/mplibUSERMPI file and managing all settings
|
||||
#
|
||||
# For INTELMPI, note that the (I_MPI_CC, I_MPI_CCX) environment variables
|
||||
# define the underlying compiler to be used
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
unsetenv MPI_ARCH_PATH MPI_HOME
|
||||
setenv FOAM_MPI dummy # Fallback value
|
||||
|
||||
@ -138,7 +138,7 @@ _of_complete_cache_[mergeOrSplitBaffles]="-case -decomposeParDict -dict -fileHan
|
||||
_of_complete_cache_[mergeSurfacePatches]="-case -fileHandler -output -patchIdRange -patchIds -patchNames | -keep -noFunctionObjects -doc -doc-source -help"
|
||||
_of_complete_cache_[meshToFPMA]="-case -decomposeParDict -fileHandler | -noFunctionObjects -parallel -doc -doc-source -help"
|
||||
_of_complete_cache_[mhdFoam]="-case -decomposeParDict -fileHandler | -dry-run -dry-run-write -listFunctionObjects -listRegisteredSwitches -listScalarBCs -listSwitches -listUnsetSwitches -listVectorBCs -noFunctionObjects -parallel -postProcess -doc -doc-source -help"
|
||||
_of_complete_cache_[mirrorMesh]="-case -decomposeParDict -fileHandler | -noFunctionObjects -overwrite -parallel -doc -doc-source -help"
|
||||
_of_complete_cache_[mirrorMesh]="-case -dict -decomposeParDict -fileHandler | -noFunctionObjects -overwrite -parallel -doc -doc-source -help"
|
||||
_of_complete_cache_[mixtureAdiabaticFlameT]="-case -fileHandler | -doc -doc-source -help"
|
||||
_of_complete_cache_[modifyMesh]="-case -decomposeParDict -dict -fileHandler | -overwrite -parallel -doc -doc-source -help"
|
||||
_of_complete_cache_[moveDynamicMesh]="-case -decomposeParDict -fileHandler -region | -checkAMI -noFunctionObjects -parallel -doc -doc-source -help"
|
||||
|
||||
@ -25,6 +25,9 @@
|
||||
# For USERMPI, the user is responsible for supplying an appropriate
|
||||
# wmake/rules/General/mplibUSERMPI file and managing all settings
|
||||
#
|
||||
# For INTELMPI, note that the (I_MPI_CC, I_MPI_CCX) environment variables
|
||||
# define the underlying compiler to be used
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
unset MPI_ARCH_PATH MPI_HOME
|
||||
export FOAM_MPI=dummy # Fallback value
|
||||
|
||||
@ -35,11 +35,12 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy<IOobject>& ip)
|
||||
|
||||
os << "IOobject: "
|
||||
<< io.type() << token::SPACE
|
||||
<< io.name() << token::SPACE
|
||||
<< "readOpt:" << token::SPACE << io.readOpt() << token::SPACE
|
||||
<< "writeOpt:" << token::SPACE << io.writeOpt() << token::SPACE
|
||||
<< "globalObject:" << token::SPACE << io.globalObject() << token::SPACE
|
||||
<< io.path() << endl;
|
||||
<< io.name()
|
||||
<< " local: " << io.local()
|
||||
<< " readOpt: " << io.readOpt()
|
||||
<< " writeOpt: " << io.writeOpt()
|
||||
<< " globalObject: " << io.globalObject()
|
||||
<< token::SPACE << io.path() << endl;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -133,28 +133,6 @@ Foam::TimePaths::TimePaths
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fileName Foam::TimePaths::caseSystem() const
|
||||
{
|
||||
if (processorCase_)
|
||||
{
|
||||
return ".."/system();
|
||||
}
|
||||
|
||||
return system();
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::TimePaths::caseConstant() const
|
||||
{
|
||||
if (processorCase_)
|
||||
{
|
||||
return ".."/constant();
|
||||
}
|
||||
|
||||
return constant();
|
||||
}
|
||||
|
||||
|
||||
Foam::instantList Foam::TimePaths::findTimes
|
||||
(
|
||||
const fileName& directory,
|
||||
|
||||
@ -108,86 +108,64 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- True if case running with parallel distributed directories
|
||||
//- (ie. not NFS mounted)
|
||||
inline bool distributed() const;
|
||||
|
||||
//- Return true if this is a processor case
|
||||
bool processorCase() const
|
||||
{
|
||||
return processorCase_;
|
||||
}
|
||||
inline bool processorCase() const;
|
||||
|
||||
//- Return root path
|
||||
const fileName& rootPath() const
|
||||
{
|
||||
return rootPath_;
|
||||
}
|
||||
inline const fileName& rootPath() const;
|
||||
|
||||
//- Return global case name
|
||||
const fileName& globalCaseName() const
|
||||
{
|
||||
return globalCaseName_;
|
||||
}
|
||||
inline const fileName& globalCaseName() const;
|
||||
|
||||
//- Return case name
|
||||
const fileName& caseName() const
|
||||
{
|
||||
return case_;
|
||||
}
|
||||
inline const fileName& caseName() const;
|
||||
|
||||
//- Return case name
|
||||
fileName& caseName()
|
||||
{
|
||||
return case_;
|
||||
}
|
||||
//- The case name for modification (use with caution)
|
||||
inline fileName& caseName();
|
||||
|
||||
//- Return system name
|
||||
const word& system() const
|
||||
{
|
||||
return system_;
|
||||
}
|
||||
//- Return path for the case
|
||||
inline fileName path() const;
|
||||
|
||||
//- Return global path for the case
|
||||
inline fileName globalPath() const;
|
||||
|
||||
//- Return the input relative to the globalPath by stripping off
|
||||
//- a leading value of the globalPath
|
||||
//
|
||||
// \param input the directory or filename to make case-relative
|
||||
// \param caseTag replace globalPath with \<case\> for later
|
||||
// use with expand(), or prefix \<case\> if the file name was
|
||||
// not an absolute location
|
||||
inline fileName relativePath
|
||||
(
|
||||
const fileName& input,
|
||||
const bool caseTag = false
|
||||
) const;
|
||||
|
||||
//- Return the system name for the case, which is
|
||||
//- \c ../system() for parallel runs.
|
||||
fileName caseSystem() const;
|
||||
|
||||
//- Return constant name
|
||||
const word& constant() const
|
||||
{
|
||||
return constant_;
|
||||
}
|
||||
inline const word& constant() const;
|
||||
|
||||
//- Is case running with parallel distributed directories
|
||||
// (i.e. not NFS mounted)
|
||||
bool distributed() const
|
||||
{
|
||||
return distributed_;
|
||||
}
|
||||
//- Return system name
|
||||
inline const word& system() const;
|
||||
|
||||
//- Return the constant name for the case, which is
|
||||
//- \c ../constant() for parallel runs.
|
||||
fileName caseConstant() const;
|
||||
inline fileName caseConstant() const;
|
||||
|
||||
//- Return path for the case
|
||||
fileName path() const
|
||||
{
|
||||
return rootPath()/caseName();
|
||||
}
|
||||
|
||||
//- Return global path for the case
|
||||
fileName globalPath() const
|
||||
{
|
||||
return rootPath()/globalCaseName();
|
||||
}
|
||||
|
||||
//- Return system path
|
||||
fileName systemPath() const
|
||||
{
|
||||
return path()/system();
|
||||
}
|
||||
//- Return the system name for the case, which is
|
||||
//- \c ../system() for parallel runs.
|
||||
inline fileName caseSystem() const;
|
||||
|
||||
//- Return constant path
|
||||
fileName constantPath() const
|
||||
{
|
||||
return path()/constant();
|
||||
}
|
||||
inline fileName constantPath() const;
|
||||
|
||||
//- Return system path
|
||||
inline fileName systemPath() const;
|
||||
|
||||
|
||||
// Searching
|
||||
@ -223,6 +201,10 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "TimePathsI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
132
src/OpenFOAM/db/Time/TimePathsI.H
Normal file
132
src/OpenFOAM/db/Time/TimePathsI.H
Normal file
@ -0,0 +1,132 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::TimePaths::distributed() const
|
||||
{
|
||||
return distributed_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::TimePaths::processorCase() const
|
||||
{
|
||||
return processorCase_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::fileName& Foam::TimePaths::rootPath() const
|
||||
{
|
||||
return rootPath_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::fileName& Foam::TimePaths::globalCaseName() const
|
||||
{
|
||||
return globalCaseName_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::fileName& Foam::TimePaths::caseName() const
|
||||
{
|
||||
return case_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName& Foam::TimePaths::caseName()
|
||||
{
|
||||
return case_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName Foam::TimePaths::path() const
|
||||
{
|
||||
return rootPath()/caseName();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName Foam::TimePaths::globalPath() const
|
||||
{
|
||||
return rootPath()/globalCaseName();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName Foam::TimePaths::relativePath
|
||||
(
|
||||
const fileName& input,
|
||||
const bool caseTag
|
||||
) const
|
||||
{
|
||||
return input.relative(globalPath(), caseTag);
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::word& Foam::TimePaths::constant() const
|
||||
{
|
||||
return constant_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::word& Foam::TimePaths::system() const
|
||||
{
|
||||
return system_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName Foam::TimePaths::caseConstant() const
|
||||
{
|
||||
if (processorCase_)
|
||||
{
|
||||
return ".."/constant();
|
||||
}
|
||||
|
||||
return constant();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName Foam::TimePaths::caseSystem() const
|
||||
{
|
||||
if (processorCase_)
|
||||
{
|
||||
return ".."/system();
|
||||
}
|
||||
|
||||
return system();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName Foam::TimePaths::constantPath() const
|
||||
{
|
||||
return path()/constant();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName Foam::TimePaths::systemPath() const
|
||||
{
|
||||
return path()/system();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -25,7 +25,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
inline Foam::scalar Foam::TimeState::timeOutputValue() const
|
||||
{
|
||||
return timeToUserTime(value());
|
||||
|
||||
@ -142,7 +142,7 @@ void Foam::timeSelector::addOptions
|
||||
(
|
||||
"time",
|
||||
"ranges",
|
||||
"Comma-separated time ranges - eg, ':10,20,40:70,1000:'"
|
||||
"List of ranges. Eg, ':10,20 40:70 1000:', 'none', etc"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "dynamicCode.H"
|
||||
#include "dynamicCodeContext.H"
|
||||
#include "argList.H"
|
||||
#include "stringOps.H"
|
||||
#include "Fstream.H"
|
||||
#include "IOstreams.H"
|
||||
@ -64,10 +65,10 @@ void Foam::dynamicCode::checkSecurity
|
||||
if (isAdministrator())
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "This code should not be executed by someone with administrator"
|
||||
<< " rights due to security reasons." << nl
|
||||
<< "(it writes a shared library which then gets loaded "
|
||||
<< "using dlopen)"
|
||||
<< "This code should not be executed by someone"
|
||||
<< " with administrator rights for security reasons." << nl
|
||||
<< "It generates a shared library which is loaded using dlopen"
|
||||
<< nl << endl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -292,8 +293,8 @@ bool Foam::dynamicCode::writeDigest(const std::string& sha1) const
|
||||
|
||||
Foam::dynamicCode::dynamicCode(const word& codeName, const word& codeDirName)
|
||||
:
|
||||
codeRoot_(stringOps::expand("<case>")/topDirName),
|
||||
libSubDir_(stringOps::expand("platforms/$WM_OPTIONS/lib")),
|
||||
codeRoot_(argList::envGlobalPath()/topDirName),
|
||||
libSubDir_(stringOps::expand("platforms/${WM_OPTIONS}/lib")),
|
||||
codeName_(codeName),
|
||||
codeDirName_(codeDirName)
|
||||
{
|
||||
|
||||
@ -40,6 +40,7 @@ bool Foam::functionObject::postProcess(false);
|
||||
|
||||
Foam::word Foam::functionObject::outputPrefix("postProcessing");
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::functionObject::scopedName(const word& name) const
|
||||
@ -68,10 +69,9 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
||||
{
|
||||
const word functionType(dict.get<word>("type"));
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Selecting function " << functionType << endl;
|
||||
}
|
||||
DebugInfo
|
||||
<< "Selecting function " << functionType << endl;
|
||||
|
||||
|
||||
// Load any additional libraries
|
||||
{
|
||||
@ -122,12 +122,6 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObject::~functionObject()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word& Foam::functionObject::name() const
|
||||
@ -179,4 +173,48 @@ void Foam::functionObject::movePoints(const polyMesh&)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * unavailableFunctionObject * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObject::unavailableFunctionObject::unavailableFunctionObject
|
||||
(
|
||||
const word& name
|
||||
)
|
||||
:
|
||||
functionObject(name)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObject::unavailableFunctionObject::carp
|
||||
(
|
||||
std::string message
|
||||
) const
|
||||
{
|
||||
FatalError
|
||||
<< "####" << nl
|
||||
<< " " << type() << " not available" << nl
|
||||
<< "####" << nl;
|
||||
|
||||
if (message.size())
|
||||
{
|
||||
FatalError
|
||||
<< message.c_str() << nl;
|
||||
}
|
||||
|
||||
FatalError
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObject::unavailableFunctionObject::execute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObject::unavailableFunctionObject::write()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -127,7 +127,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
// Forward declarations
|
||||
class Time;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
@ -144,15 +144,6 @@ class functionObject
|
||||
const word name_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
functionObject(const functionObject&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const functionObject&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
@ -163,6 +154,9 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
// Forward declarations
|
||||
class unavailableFunctionObject;
|
||||
|
||||
//- Runtime type information
|
||||
virtual const word& type() const = 0;
|
||||
|
||||
@ -209,13 +203,13 @@ public:
|
||||
static autoPtr<functionObject> New
|
||||
(
|
||||
const word& name,
|
||||
const Time&,
|
||||
const dictionary&
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~functionObject();
|
||||
virtual ~functionObject() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -243,7 +237,7 @@ public:
|
||||
virtual bool write() = 0;
|
||||
|
||||
//- Called when Time::run() determines that the time-loop exits.
|
||||
// By default it simply calls execute().
|
||||
// The base implementation is a no-op.
|
||||
virtual bool end();
|
||||
|
||||
//- Called at the end of Time::adjustDeltaT() if adjustTime is true
|
||||
@ -262,6 +256,37 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class functionObject::unavailableFunctionObject Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
//- Abstract functionObject to report when a real version is unavailable.
|
||||
class functionObject::unavailableFunctionObject
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
//- Construct with name
|
||||
unavailableFunctionObject(const word& name);
|
||||
|
||||
//- Report it is unavailable, emitting a FatalError for try/catch
|
||||
//- in the caller
|
||||
void carp(std::string message = "") const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- No nothing
|
||||
virtual bool execute();
|
||||
|
||||
//- No nothing
|
||||
virtual bool write();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -463,6 +463,14 @@ bool Foam::argList::postProcess(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::fileName Foam::argList::envGlobalPath()
|
||||
{
|
||||
return Foam::getEnv("FOAM_CASE");
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::argList::optionCompat(const word& optName)
|
||||
|
||||
@ -272,6 +272,18 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Environment
|
||||
|
||||
//- Global case (directory) from environment variable
|
||||
//
|
||||
// Returns the contents of the \c FOAM_CASE variable,
|
||||
// which has previously been set by argList or by Time.
|
||||
//
|
||||
// This will normally be identical to the value of globalPath(),
|
||||
// but obtained via the environment.
|
||||
static fileName envGlobalPath();
|
||||
|
||||
|
||||
// Low-level
|
||||
|
||||
//- Scan for -help, -doc options etc prior to checking the validity
|
||||
@ -304,6 +316,19 @@ public:
|
||||
// \note This is guaranteed to be an absolute path
|
||||
inline fileName globalPath() const;
|
||||
|
||||
//- Return the input relative to the globalPath by stripping off
|
||||
//- a leading value of the globalPath
|
||||
//
|
||||
// \param input the directory or filename to make case-relative
|
||||
// \param caseTag replace globalPath with \<case\> for later
|
||||
// use with expand(), or prefix \<case\> if the file name was
|
||||
// not an absolute location
|
||||
inline fileName relativePath
|
||||
(
|
||||
const fileName& input,
|
||||
const bool caseTag = false
|
||||
) const;
|
||||
|
||||
//- Return distributed flag
|
||||
//- (i.e. are rootPaths different on different machines)
|
||||
inline bool distributed() const;
|
||||
|
||||
@ -87,6 +87,16 @@ inline Foam::fileName Foam::argList::globalPath() const
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName Foam::argList::relativePath
|
||||
(
|
||||
const fileName& input,
|
||||
const bool caseTag
|
||||
) const
|
||||
{
|
||||
return input.relative(globalPath(), caseTag);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::argList::distributed() const
|
||||
{
|
||||
return parRunControl_.distributed();
|
||||
|
||||
@ -96,7 +96,7 @@ namespace Foam
|
||||
//- OpenFOAM version (name or stringified number) as a std::string
|
||||
extern const std::string version;
|
||||
|
||||
//- Test if the patch string appeared to be in use,
|
||||
//- Test if the patch string appears to be in use,
|
||||
//- which is when it is defined (non-zero).
|
||||
bool patched();
|
||||
|
||||
|
||||
@ -498,17 +498,8 @@ whichPoint
|
||||
const label gp
|
||||
) const
|
||||
{
|
||||
Map<label>::const_iterator fnd = meshPointMap().find(gp);
|
||||
|
||||
if (fnd != meshPointMap().end())
|
||||
{
|
||||
return fnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not found
|
||||
return -1;
|
||||
}
|
||||
// The point found, or -1 if not found
|
||||
return meshPointMap().lookup(gp, -1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -153,7 +153,7 @@ private:
|
||||
mutable labelList* meshPointsPtr_;
|
||||
|
||||
//- Mesh point map. Given the global point index find its
|
||||
//location in the patch
|
||||
//- location in the patch
|
||||
mutable Map<label>* meshPointMapPtr_;
|
||||
|
||||
//- Outside edge loops
|
||||
@ -301,7 +301,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Access functions for demand driven data
|
||||
// Access functions for demand-driven data
|
||||
|
||||
// Topological data; no mesh required.
|
||||
|
||||
@ -329,8 +329,7 @@ public:
|
||||
return edgei < nInternalEdges();
|
||||
}
|
||||
|
||||
//- Return list of boundary points,
|
||||
// address into LOCAL point list
|
||||
//- Return list of boundary points, address into LOCAL point list
|
||||
const labelList& boundaryPoints() const;
|
||||
|
||||
//- Return face-face addressing
|
||||
@ -354,13 +353,13 @@ public:
|
||||
|
||||
// Addressing into mesh
|
||||
|
||||
//- Return labelList of mesh points in patch. They are constructed
|
||||
// walking through the faces in incremental order and not sorted
|
||||
// anymore.
|
||||
//- Return labelList of mesh points in patch.
|
||||
// They are constructed by walking through the faces in
|
||||
// incremental order and not sorted anymore.
|
||||
const labelList& meshPoints() const;
|
||||
|
||||
//- Mesh point map. Given the global point index find its
|
||||
// location in the patch
|
||||
//- Mesh point map.
|
||||
// Given the global point index find its location in the patch
|
||||
const Map<label>& meshPointMap() const;
|
||||
|
||||
//- Return pointField of points in patch
|
||||
@ -374,11 +373,11 @@ public:
|
||||
label whichPoint(const label gp) const;
|
||||
|
||||
//- Given an edge in local point labels, return its
|
||||
// index in the edge list. If the edge is not found, return -1
|
||||
//- index in the edge list. If the edge is not found, return -1
|
||||
label whichEdge(const edge&) const;
|
||||
|
||||
//- Return labels of patch edges in the global edge list using
|
||||
// cell addressing
|
||||
//- cell addressing
|
||||
labelList meshEdges
|
||||
(
|
||||
const edgeList& allEdges,
|
||||
@ -387,7 +386,7 @@ public:
|
||||
) const;
|
||||
|
||||
//- Return labels of patch edges in the global edge list using
|
||||
// basic edge addressing.
|
||||
//- basic edge addressing.
|
||||
labelList meshEdges
|
||||
(
|
||||
const edgeList& allEdges,
|
||||
@ -410,6 +409,14 @@ public:
|
||||
const Field<PointType>& pointNormals() const;
|
||||
|
||||
|
||||
// Storage Management
|
||||
|
||||
inline bool hasFaceAreas() const { return faceAreasPtr_; }
|
||||
inline bool hasFaceCentres() const { return faceCentresPtr_; }
|
||||
inline bool hasFaceNormals() const { return faceNormalsPtr_; }
|
||||
inline bool hasPointNormals() const { return pointNormalsPtr_; }
|
||||
|
||||
|
||||
// Other patch operations
|
||||
|
||||
//- Project vertices of patch onto another patch
|
||||
@ -475,7 +482,7 @@ public:
|
||||
virtual void movePoints(const Field<PointType>&);
|
||||
|
||||
|
||||
// Member operators
|
||||
// Member Operators
|
||||
|
||||
//- Assignment
|
||||
void operator=
|
||||
|
||||
@ -60,8 +60,7 @@ calcAddressing() const
|
||||
|
||||
if (edgesPtr_ || faceFacesPtr_ || edgeFacesPtr_ || faceEdgesPtr_)
|
||||
{
|
||||
// it is considered an error to attempt to recalculate
|
||||
// if already allocated
|
||||
// An error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "addressing already calculated"
|
||||
<< abort(FatalError);
|
||||
|
||||
@ -46,10 +46,9 @@ calcBdryPoints() const
|
||||
|
||||
if (boundaryPointsPtr_)
|
||||
{
|
||||
// it is considered an error to attempt to recalculate
|
||||
// if already allocated
|
||||
// Error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "edge types already calculated"
|
||||
<< "boundaryPoints already calculated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -50,8 +50,7 @@ calcEdgeLoops() const
|
||||
|
||||
if (edgeLoopsPtr_)
|
||||
{
|
||||
// it is considered an error to attempt to recalculate
|
||||
// if already allocated
|
||||
// An error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "edge loops already calculated"
|
||||
<< abort(FatalError);
|
||||
|
||||
@ -56,8 +56,7 @@ calcLocalPointOrder() const
|
||||
|
||||
if (localPointOrderPtr_)
|
||||
{
|
||||
// it is considered an error to attempt to recalculate
|
||||
// if already allocated
|
||||
// An error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "local point order already calculated"
|
||||
<< abort(FatalError);
|
||||
|
||||
@ -47,10 +47,9 @@ calcMeshData() const
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// It is considered an error to attempt to recalculate meshPoints
|
||||
// if they have already been calculated.
|
||||
if (meshPointsPtr_ || localFacesPtr_)
|
||||
{
|
||||
// An error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "meshPointsPtr_ or localFacesPtr_ already allocated"
|
||||
<< abort(FatalError);
|
||||
@ -157,10 +156,9 @@ calcMeshPointMap() const
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// It is considered an error to attempt to recalculate meshPoints
|
||||
// if they have already been calculated.
|
||||
if (meshPointMapPtr_)
|
||||
{
|
||||
// An error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "meshPointMapPtr_ already allocated"
|
||||
<< abort(FatalError);
|
||||
@ -205,10 +203,9 @@ calcLocalPoints() const
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// It is considered an error to attempt to recalculate localPoints
|
||||
// if they have already been calculated.
|
||||
if (localPointsPtr_)
|
||||
{
|
||||
// An error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "localPointsPtr_ already allocated"
|
||||
<< abort(FatalError);
|
||||
@ -254,10 +251,9 @@ calcPointNormals() const
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// It is considered an error to attempt to recalculate pointNormals
|
||||
// if they have already been calculated.
|
||||
if (pointNormalsPtr_)
|
||||
{
|
||||
// An error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "pointNormalsPtr_ already allocated"
|
||||
<< abort(FatalError);
|
||||
@ -318,10 +314,9 @@ calcFaceCentres() const
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// It is considered an error to attempt to recalculate faceCentres
|
||||
// if they have already been calculated.
|
||||
if (faceCentresPtr_)
|
||||
{
|
||||
// An error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "faceCentresPtr_ already allocated"
|
||||
<< abort(FatalError);
|
||||
@ -365,9 +360,9 @@ calcMagFaceAreas() const
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// It is an error to calculate these more than once.
|
||||
if (magFaceAreasPtr_)
|
||||
{
|
||||
// An error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "magFaceAreasPtr_ already allocated"
|
||||
<< abort(FatalError);
|
||||
@ -410,10 +405,9 @@ calcFaceAreas() const
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// It is considered an error to attempt to recalculate faceNormals
|
||||
// if they have already been calculated.
|
||||
if (faceAreasPtr_)
|
||||
{
|
||||
// An error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "faceAreasPtr_ already allocated"
|
||||
<< abort(FatalError);
|
||||
@ -457,10 +451,9 @@ calcFaceNormals() const
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// It is considered an error to attempt to recalculate faceNormals
|
||||
// if they have already been calculated.
|
||||
if (faceNormalsPtr_)
|
||||
{
|
||||
// An error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "faceNormalsPtr_ already allocated"
|
||||
<< abort(FatalError);
|
||||
|
||||
@ -51,8 +51,7 @@ calcPointEdges() const
|
||||
|
||||
if (pointEdgesPtr_)
|
||||
{
|
||||
// it is considered an error to attempt to recalculate
|
||||
// if already allocated
|
||||
// An error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "pointEdges already calculated"
|
||||
<< abort(FatalError);
|
||||
@ -89,8 +88,7 @@ calcPointFaces() const
|
||||
|
||||
if (pointFacesPtr_)
|
||||
{
|
||||
// it is considered an error to attempt to recalculate
|
||||
// if already allocated
|
||||
// An error to recalculate if already allocated
|
||||
FatalErrorInFunction
|
||||
<< "pointFaces already calculated"
|
||||
<< abort(FatalError);
|
||||
|
||||
@ -32,6 +32,9 @@ Description
|
||||
Note
|
||||
This class is still subject to larger changes (2018-11) as it matures.
|
||||
|
||||
SeeAlso
|
||||
Foam::scalarRange, Foam::scalarRanges
|
||||
|
||||
SourceFiles
|
||||
scalarPredicates.C
|
||||
scalarPredicatesI.H
|
||||
@ -233,7 +236,10 @@ public:
|
||||
using List<unary>::List;
|
||||
|
||||
//- Construct from an initializer list of (opName opValue) tuples
|
||||
explicit scalars(std::initializer_list<std::pair<word, scalar>> entries);
|
||||
explicit scalars
|
||||
(
|
||||
std::initializer_list<std::pair<word, scalar>> entries
|
||||
);
|
||||
|
||||
//- Copy construct from a list of (opName opValue) tuples
|
||||
explicit scalars(const UList<Tuple2<word, scalar>>& entries);
|
||||
|
||||
@ -37,6 +37,14 @@ bool Foam::scalarRange::parse(const std::string& str, scalarRange& range)
|
||||
|
||||
if (colon == std::string::npos)
|
||||
{
|
||||
// No colon
|
||||
|
||||
if (str == "none")
|
||||
{
|
||||
// "none" is an empty (inverse) range
|
||||
return true;
|
||||
}
|
||||
|
||||
// "VALUE"
|
||||
scalar val;
|
||||
if (readScalar(str, val))
|
||||
@ -119,11 +127,11 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const scalarRange& range)
|
||||
break;
|
||||
|
||||
case scalarRange::GE_LE:
|
||||
os << range.min_ << ":" << range.max_;
|
||||
os << range.min_ << ':' << range.max_;
|
||||
break;
|
||||
|
||||
default:
|
||||
os << "false";
|
||||
os << "none";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -30,6 +30,12 @@ Description
|
||||
The bound can be specified as an "MIN:MAX" range, as a "MIN:" or ":MAX"
|
||||
bound or simply as a single "VALUE".
|
||||
|
||||
When defined via the parse() method, the special string "none" can be
|
||||
used to define an empty (inverse) range.
|
||||
|
||||
SeeAlso
|
||||
Foam::predicates::scalars
|
||||
|
||||
SourceFiles
|
||||
scalarRange.C
|
||||
|
||||
@ -103,6 +109,10 @@ public:
|
||||
//- Construct by parsing string content.
|
||||
// A colon (:) is used as a range marker or when specifying
|
||||
// greater-than or less-than bounds.
|
||||
//
|
||||
// \note The special string "none" can be used define an empty
|
||||
// (inverse) range
|
||||
//
|
||||
// \return True if no parse problems were encountered.
|
||||
static bool parse(const std::string& str, scalarRange& range);
|
||||
|
||||
@ -150,10 +160,13 @@ public:
|
||||
// For GE, LE bounds it is the min/max value, respectively.
|
||||
inline scalar value() const;
|
||||
|
||||
//- True if the value matches the condition.
|
||||
inline bool match(const scalar& value) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Unary predicate to test if the value is within the bounds
|
||||
//- Identical to match(), for use as a predicate.
|
||||
inline bool operator()(const scalar& value) const;
|
||||
|
||||
inline bool operator==(const scalarRange& rhs) const;
|
||||
|
||||
@ -152,23 +152,29 @@ inline Foam::scalar Foam::scalarRange::value() const
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::scalarRange::operator()(const scalar& value) const
|
||||
inline bool Foam::scalarRange::match(const scalar& value) const
|
||||
{
|
||||
switch (type_)
|
||||
{
|
||||
case EQ: return equal(value, min_);
|
||||
case GE: return value >= min_;
|
||||
case GT: return value > min_;
|
||||
case LE: return value <= max_;
|
||||
case LT: return value < max_;
|
||||
case GE_LE: return value >= min_ && value <= max_;
|
||||
case GE: return (value >= min_);
|
||||
case GT: return (value > min_);
|
||||
case LE: return (value <= max_);
|
||||
case LT: return (value < max_);
|
||||
case GE_LE: return (value >= min_ && value <= max_);
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::scalarRange::operator()(const scalar& value) const
|
||||
{
|
||||
return match(value);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::scalarRange::operator==(const scalarRange& rhs) const
|
||||
{
|
||||
return (type_ == rhs.type_ && min_ == rhs.min_ && max_ == rhs.max_);
|
||||
|
||||
@ -26,33 +26,39 @@ License
|
||||
#include "scalarRanges.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalarRanges::scalarRanges(const std::string& str)
|
||||
:
|
||||
List<scalarRange>()
|
||||
Foam::scalarRanges Foam::scalarRanges::parse
|
||||
(
|
||||
const std::string& str,
|
||||
bool verbose
|
||||
)
|
||||
{
|
||||
const SubStrings<std::string> items = stringOps::splitAny(str, " ,;");
|
||||
|
||||
setSize(items.size());
|
||||
scalarRanges ranges(items.size());
|
||||
|
||||
label nItems = 0;
|
||||
label n = 0;
|
||||
|
||||
for (const auto& item : items)
|
||||
{
|
||||
const std::string s = item.str();
|
||||
|
||||
if (scalarRange::parse(s, operator[](nItems)))
|
||||
scalarRange& range = ranges[n];
|
||||
|
||||
if (scalarRange::parse(s, range))
|
||||
{
|
||||
++nItems;
|
||||
++n;
|
||||
}
|
||||
else
|
||||
else if (verbose)
|
||||
{
|
||||
Info<< "Bad scalar-range while parsing: " << s << endl;
|
||||
}
|
||||
}
|
||||
|
||||
setSize(nItems);
|
||||
ranges.resize(n);
|
||||
|
||||
return ranges;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -27,6 +27,9 @@ Class
|
||||
Description
|
||||
A collection of scalar bounds to be used as a unary predicate.
|
||||
|
||||
SeeAlso
|
||||
Foam::predicates::scalars
|
||||
|
||||
SourceFiles
|
||||
scalarRanges.C
|
||||
|
||||
@ -55,17 +58,35 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Inherit constructors from List of scalarRange
|
||||
using List<scalarRange>::List;
|
||||
|
||||
//- Construct null
|
||||
inline scalarRanges();
|
||||
|
||||
//- Construct by parsing a string for scalar ranges
|
||||
//- Construct by parsing string for scalar ranges
|
||||
// The individual items are space, comma or semicolon delimited.
|
||||
scalarRanges(const std::string& str);
|
||||
// Optionally report when any range failed to parse
|
||||
inline scalarRanges(const std::string& str, bool verbose = true);
|
||||
|
||||
|
||||
// Static Constructors
|
||||
|
||||
//- Construct by parsing string for scalar ranges
|
||||
// The individual items are space, comma or semicolon delimited.
|
||||
static scalarRanges parse(const std::string& str, bool verbose = true);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Match any condition in the list.
|
||||
// \return True if the value matches any condition in the list.
|
||||
inline bool match(const scalar& value) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Unary predicate to test if the value is within any of the ranges
|
||||
//- Identical to match(), for use as a predicate.
|
||||
inline bool operator()(const scalar& value) const;
|
||||
|
||||
};
|
||||
|
||||
@ -31,9 +31,15 @@ inline Foam::scalarRanges::scalarRanges()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
inline Foam::scalarRanges::scalarRanges(const std::string& str, bool verbose)
|
||||
:
|
||||
List<scalarRange>(scalarRanges::parse(str, verbose))
|
||||
{}
|
||||
|
||||
inline bool Foam::scalarRanges::operator()(const scalar& value) const
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::scalarRanges::match(const scalar& value) const
|
||||
{
|
||||
for (const scalarRange& range : *this)
|
||||
{
|
||||
@ -47,4 +53,12 @@ inline bool Foam::scalarRanges::operator()(const scalar& value) const
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::scalarRanges::operator()(const scalar& value) const
|
||||
{
|
||||
return match(value);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -367,7 +367,7 @@ std::string Foam::fileName::nameLessExt(const std::string& str)
|
||||
Foam::fileName Foam::fileName::relative
|
||||
(
|
||||
const fileName& parent,
|
||||
const bool caseRelative
|
||||
const bool caseTag
|
||||
) const
|
||||
{
|
||||
const auto top = parent.size();
|
||||
@ -383,7 +383,7 @@ Foam::fileName Foam::fileName::relative
|
||||
&& f.startsWith(parent)
|
||||
)
|
||||
{
|
||||
if (caseRelative)
|
||||
if (caseTag)
|
||||
{
|
||||
return "<case>"/f.substr(top+1);
|
||||
}
|
||||
@ -392,7 +392,7 @@ Foam::fileName Foam::fileName::relative
|
||||
return f.substr(top+1);
|
||||
}
|
||||
}
|
||||
else if (caseRelative && f.size() && !f.isAbsolute())
|
||||
else if (caseTag && f.size() && !f.isAbsolute())
|
||||
{
|
||||
return "<case>"/f;
|
||||
}
|
||||
|
||||
@ -294,13 +294,13 @@ public:
|
||||
//- where possible.
|
||||
//
|
||||
// \param parent the parent directory
|
||||
// \param caseRelative replace the parent with \<case\> for later
|
||||
// \param caseTag replace the parent with \<case\> for later
|
||||
// use with expand(), or prefix \<case\> if the file name was
|
||||
// not an absolute location
|
||||
fileName relative
|
||||
(
|
||||
const fileName& parent,
|
||||
const bool caseRelative = false
|
||||
const bool caseTag = false
|
||||
) const;
|
||||
|
||||
//- Return file name without extension (part before last .)
|
||||
|
||||
@ -65,11 +65,11 @@ template<class PatchType>
|
||||
vtkSmartPointer<vtkCellArray>
|
||||
Foam::vtk::Tools::Patch::faces(const PatchType& p)
|
||||
{
|
||||
// Faces as polygons
|
||||
const faceList& fcs = p.localFaces();
|
||||
// List of faces or triFaces
|
||||
const auto& fcs = p.localFaces();
|
||||
|
||||
label nAlloc = fcs.size();
|
||||
for (const face& f : fcs)
|
||||
for (const auto& f : fcs)
|
||||
{
|
||||
nAlloc += f.size();
|
||||
}
|
||||
@ -81,7 +81,7 @@ Foam::vtk::Tools::Patch::faces(const PatchType& p)
|
||||
// Cell connectivity for polygons
|
||||
// [size, verts..., size, verts... ]
|
||||
auto iter = list.begin();
|
||||
for (const face& f : fcs)
|
||||
for (const auto& f : fcs)
|
||||
{
|
||||
*(iter++) = f.size();
|
||||
|
||||
@ -118,16 +118,25 @@ Foam::vtk::Tools::Patch::faceNormals(const PatchType& p)
|
||||
array->SetNumberOfTuples(p.size());
|
||||
|
||||
// Unit normals for patch faces.
|
||||
// If not already cached, could be more memory efficient to loop over
|
||||
// the individual faces instead.
|
||||
|
||||
const vectorField& norms = p.faceNormals();
|
||||
// Cached values if available or loop over faces (avoid triggering cache)
|
||||
|
||||
vtkIdType faceId = 0;
|
||||
for (const vector& n : norms)
|
||||
|
||||
if (p.hasFaceNormals())
|
||||
{
|
||||
for (const vector& n : p.faceNormals())
|
||||
{
|
||||
array->SetTuple(faceId++, n.v_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const auto& f : p)
|
||||
{
|
||||
const vector n(f.unitNormal(p.points()));
|
||||
array->SetTuple(faceId++, n.v_);
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
@ -786,7 +786,7 @@ bool Foam::functionObjects::streamLineBase::writeToFile()
|
||||
propsDict.add
|
||||
(
|
||||
"file",
|
||||
scalarVtkFile.relative(time_.globalPath(), true)
|
||||
time_.relativePath(scalarVtkFile, true)
|
||||
);
|
||||
setProperty(fieldName, propsDict);
|
||||
}
|
||||
@ -798,7 +798,7 @@ bool Foam::functionObjects::streamLineBase::writeToFile()
|
||||
propsDict.add
|
||||
(
|
||||
"file",
|
||||
vectorVtkFile.relative(time_.globalPath(), true)
|
||||
time_.relativePath(vectorVtkFile, true)
|
||||
);
|
||||
setProperty(fieldName, propsDict);
|
||||
}
|
||||
|
||||
@ -2,10 +2,12 @@
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions # Source wmake functions
|
||||
|
||||
# Cleanup library
|
||||
# This cleanup handles both cmake runTimePostProcessing and the dummy version
|
||||
|
||||
# Cleanup library files with .so version endings
|
||||
rm -f $FOAM_LIBBIN/librunTimePostProcessing* 2>/dev/null
|
||||
|
||||
# Cleanup generated files - remove entire top-level
|
||||
removeObjectDir $PWD
|
||||
removeObjectDir "$PWD"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -6,9 +6,9 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
echo "======================================================================"
|
||||
echo "${PWD##*/} : $PWD"
|
||||
echo
|
||||
|
||||
unset depend
|
||||
|
||||
if [ -d "$VTK_DIR" ]
|
||||
then
|
||||
depend="VTK_DIR=$VTK_DIR"
|
||||
@ -17,9 +17,13 @@ then
|
||||
depend="ParaView_DIR=$ParaView_DIR"
|
||||
fi
|
||||
|
||||
if [ -n "$depend" ]
|
||||
# Or force use of dummy only
|
||||
# unset depend
|
||||
|
||||
if [ "$targetType" = objects ]
|
||||
then
|
||||
if [ "$targetType" != objects ]
|
||||
depend=ignore
|
||||
elif [ -n "$depend" ]
|
||||
then
|
||||
if command -v cmake > /dev/null 2>&1
|
||||
then
|
||||
@ -27,15 +31,22 @@ then
|
||||
echo
|
||||
echo " WARNING: incomplete build of VTK-based post-processing"
|
||||
echo
|
||||
depend="dummy"
|
||||
}
|
||||
else
|
||||
echo "WARNING: skipped - needs cmake"
|
||||
fi
|
||||
echo "==> skip runTimePostProcessing (needs cmake)"
|
||||
depend="dummy"
|
||||
fi
|
||||
else
|
||||
echo "WARNING: skipped - needs a VTK or a ParaView installation"
|
||||
echo " - For ParaView : export the 'ParaView_DIR' variable"
|
||||
echo " - For VTK : export the 'VTK_DIR' variable"
|
||||
echo "WARNING: skip runTimePostProcessing (no VTK or ParaView)"
|
||||
echo " - ParaView : export the 'ParaView_DIR' variable"
|
||||
echo " - VTK : export the 'VTK_DIR' variable"
|
||||
fi
|
||||
|
||||
if [ "${depend:-dummy}" = dummy ]
|
||||
then
|
||||
echo "==> dummy runTimePostProcessing"
|
||||
wmakeVersioned "vtk=dummy" $PWD dummy
|
||||
fi
|
||||
|
||||
echo "======================================================================"
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
runTimePostProcessingDummy.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/librunTimePostProcessing
|
||||
@ -0,0 +1,2 @@
|
||||
/* EXE_INC = */
|
||||
/* LIB_LIBS = */
|
||||
@ -0,0 +1,67 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 "runTimePostProcessingDummy.H"
|
||||
#include "dictionary.H"
|
||||
#include "Time.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(runTimePostProcessingDummy, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
runTimePostProcessingDummy,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimePostProcessingDummy::runTimePostProcessingDummy
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObject::unavailableFunctionObject(name)
|
||||
{
|
||||
carp
|
||||
(
|
||||
"VTK libraries were not available at compilation time"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,85 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjects::runTimePostProcessingDummy
|
||||
|
||||
Group
|
||||
grpGraphicsFunctionObjects
|
||||
|
||||
Description
|
||||
Dummy implementation of Foam::functionObjects::runTimePostProcessing
|
||||
to report when the real version is unavailable.
|
||||
|
||||
SourceFiles
|
||||
runTimePostProcessingDummy.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjects_runTimePostProcessingDummy_H
|
||||
#define functionObjects_runTimePostProcessingDummy_H
|
||||
|
||||
#include "functionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class runTimePostProcessingDummy Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class runTimePostProcessingDummy
|
||||
:
|
||||
public functionObject::unavailableFunctionObject
|
||||
{
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("runTimePostProcessing");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
runTimePostProcessingDummy
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,9 +49,11 @@ License
|
||||
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::functionObjects::fieldVisualisationBase::colourByType
|
||||
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||
colourByType
|
||||
>
|
||||
Foam::functionObjects::fieldVisualisationBase::colourByTypeNames
|
||||
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||
colourByTypeNames
|
||||
({
|
||||
{ colourByType::cbColour, "colour" },
|
||||
{ colourByType::cbField, "field" },
|
||||
@ -59,9 +61,11 @@ Foam::functionObjects::fieldVisualisationBase::colourByTypeNames
|
||||
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::functionObjects::fieldVisualisationBase::colourMapType
|
||||
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||
colourMapType
|
||||
>
|
||||
Foam::functionObjects::fieldVisualisationBase::colourMapTypeNames
|
||||
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||
colourMapTypeNames
|
||||
({
|
||||
{ colourMapType::cmRainbow, "rainbow" },
|
||||
{ colourMapType::cmBlueWhiteRed, "blueWhiteRed" },
|
||||
@ -72,7 +76,8 @@ Foam::functionObjects::fieldVisualisationBase::colourMapTypeNames
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::fieldVisualisationBase::setColourMap
|
||||
void Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||
setColourMap
|
||||
(
|
||||
vtkLookupTable* lut
|
||||
) const
|
||||
@ -130,7 +135,8 @@ void Foam::functionObjects::fieldVisualisationBase::setColourMap
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldVisualisationBase::addScalarBar
|
||||
void Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||
addScalarBar
|
||||
(
|
||||
const scalar position,
|
||||
vtkRenderer* renderer,
|
||||
@ -239,7 +245,8 @@ void Foam::functionObjects::fieldVisualisationBase::addScalarBar
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldVisualisationBase::setField
|
||||
void Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||
setField
|
||||
(
|
||||
const scalar position,
|
||||
const word& colourFieldName,
|
||||
@ -272,11 +279,11 @@ void Foam::functionObjects::fieldVisualisationBase::setField
|
||||
// Note: if both point and cell data exists, preferentially
|
||||
// choosing point data. This is often the case when using
|
||||
// glyphs
|
||||
if (pData->GetPointData()->HasArray(fieldName) == 1)
|
||||
if (pData->GetPointData()->HasArray(fieldName))
|
||||
{
|
||||
mapper->SetScalarModeToUsePointFieldData();
|
||||
}
|
||||
else if (pData->GetCellData()->HasArray(fieldName) == 1)
|
||||
else if (pData->GetCellData()->HasArray(fieldName))
|
||||
{
|
||||
mapper->SetScalarModeToUseCellFieldData();
|
||||
}
|
||||
@ -302,8 +309,8 @@ void Foam::functionObjects::fieldVisualisationBase::setField
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldVisualisationBase::addGlyphs
|
||||
void Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||
addGlyphs
|
||||
(
|
||||
const scalar position,
|
||||
const word& scaleFieldName,
|
||||
@ -320,20 +327,49 @@ void Foam::functionObjects::fieldVisualisationBase::addGlyphs
|
||||
|
||||
glyph->SetInputData(data);
|
||||
glyph->ScalingOn();
|
||||
bool ok = true;
|
||||
|
||||
bool needPointData = false;
|
||||
|
||||
// Determine whether we have scalar or vector data
|
||||
// and if we need to convert CellData -> PointData
|
||||
|
||||
label nComponents = -1;
|
||||
const char* scaleFieldNameChar = scaleFieldName.c_str();
|
||||
if (data->GetPointData()->HasArray(scaleFieldNameChar) == 1)
|
||||
if (data->GetPointData()->HasArray(scaleFieldNameChar))
|
||||
{
|
||||
nComponents =
|
||||
data->GetPointData()->GetArray(scaleFieldNameChar)
|
||||
->GetNumberOfComponents();
|
||||
}
|
||||
else if (data->GetCellData()->HasArray(scaleFieldNameChar) == 1)
|
||||
else if (data->GetCellData()->HasArray(scaleFieldNameChar))
|
||||
{
|
||||
// Need to convert CellData to PointData
|
||||
needPointData = true;
|
||||
|
||||
nComponents =
|
||||
data->GetCellData()->GetArray(scaleFieldNameChar)
|
||||
->GetNumberOfComponents();
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot add glyphs. No such cell or point field: "
|
||||
<< scaleFieldName << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const bool ok = (nComponents == 1 || nComponents == 3);
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Glyphs can only be added to scalar or vector data. "
|
||||
<< "Unable to process field " << scaleFieldName << endl;
|
||||
return;
|
||||
}
|
||||
else if (needPointData)
|
||||
{
|
||||
// Need to convert cell data to point data
|
||||
auto cellToPoint = vtkSmartPointer<vtkCellDataToPointData>::New();
|
||||
cellToPoint->SetInputData(data);
|
||||
cellToPoint->Update();
|
||||
@ -342,16 +378,8 @@ void Foam::functionObjects::fieldVisualisationBase::addGlyphs
|
||||
|
||||
// Store in main vtkPolyData
|
||||
data->GetPointData()->AddArray(pData);
|
||||
}
|
||||
|
||||
nComponents = pData->GetNumberOfComponents();
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Glyphs can only be added to scalar or vector data. "
|
||||
<< "Unable to process field " << scaleFieldName << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (nComponents == 1)
|
||||
{
|
||||
@ -367,18 +395,16 @@ void Foam::functionObjects::fieldVisualisationBase::addGlyphs
|
||||
|
||||
if (maxGlyphLength > 0)
|
||||
{
|
||||
double range[2];
|
||||
// Can get range from point data:
|
||||
|
||||
// Can use values to find range
|
||||
// double range[2];
|
||||
// vtkDataArray* values =
|
||||
// data->GetPointData()->GetScalars(scaleFieldNameChar);
|
||||
// values->GetRange(range);
|
||||
|
||||
// Set range according to user-supplied limits
|
||||
range[0] = range_.first();
|
||||
range[1] = range_.second();
|
||||
glyph->ClampingOn();
|
||||
glyph->SetRange(range);
|
||||
glyph->SetRange(range_.first(), range_.second());
|
||||
|
||||
// If range[0] != min(value), maxGlyphLength behaviour will not
|
||||
// be correct...
|
||||
@ -450,15 +476,7 @@ void Foam::functionObjects::fieldVisualisationBase::addGlyphs
|
||||
scaleFieldNameChar
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Glyphs can only be added to scalar and vector fields."
|
||||
<< " Field " << scaleFieldName << " has " << nComponents
|
||||
<< " components" << endl;
|
||||
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
@ -477,10 +495,11 @@ void Foam::functionObjects::fieldVisualisationBase::addGlyphs
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
|
||||
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||
fieldVisualisationBase
|
||||
(
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
)
|
||||
:
|
||||
colours_(colours),
|
||||
@ -504,16 +523,17 @@ Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
|
||||
|
||||
colourMapTypeNames.readIfPresent("colourMap", dict, colourMap_);
|
||||
|
||||
const dictionary& sbarDict = dict.subDict("scalarBar");
|
||||
sbarDict.readEntry("visible", scalarBar_.visible_);
|
||||
const dictionary& sbDict = dict.subDict("scalarBar");
|
||||
sbDict.readEntry("visible", scalarBar_.visible_);
|
||||
|
||||
if (scalarBar_.visible_)
|
||||
{
|
||||
sbarDict.readEntry("vertical", scalarBar_.vertical_);
|
||||
sbarDict.readEntry("position", scalarBar_.position_);
|
||||
sbarDict.readEntry("title", scalarBar_.title_);
|
||||
sbarDict.readEntry("fontSize", scalarBar_.fontSize_);
|
||||
sbarDict.readEntry("labelFormat", scalarBar_.labelFormat_);
|
||||
sbarDict.readEntry("numberOfLabels", scalarBar_.numberOfLabels_);
|
||||
sbDict.readEntry("vertical", scalarBar_.vertical_);
|
||||
sbDict.readEntry("position", scalarBar_.position_);
|
||||
sbDict.readEntry("title", scalarBar_.title_);
|
||||
sbDict.readEntry("fontSize", scalarBar_.fontSize_);
|
||||
sbDict.readEntry("labelFormat", scalarBar_.labelFormat_);
|
||||
sbDict.readEntry("numberOfLabels", scalarBar_.numberOfLabels_);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -523,21 +543,23 @@ Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::fieldVisualisationBase::~fieldVisualisationBase()
|
||||
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||
~fieldVisualisationBase()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::HashPtrTable<Foam::Function1<Foam::vector>, Foam::word>&
|
||||
Foam::functionObjects::fieldVisualisationBase::colours() const
|
||||
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::colours() const
|
||||
{
|
||||
return colours_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::word&
|
||||
Foam::functionObjects::fieldVisualisationBase::fieldName() const
|
||||
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::fieldName()
|
||||
const
|
||||
{
|
||||
return fieldName_;
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjects::fieldVisualisationBase
|
||||
Foam::functionObjects::runTimePostPro::fieldVisualisationBase
|
||||
|
||||
Description
|
||||
Base class for scene objects
|
||||
@ -42,26 +42,29 @@ SourceFiles
|
||||
#include "HashPtrTable.H"
|
||||
#include "Function1.H"
|
||||
|
||||
// VTK includes
|
||||
#include "vtkSmartPointer.h"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward declarations
|
||||
class vtkActor;
|
||||
class vtkLookupTable;
|
||||
class vtkMapper;
|
||||
class vtkPolyData;
|
||||
class vtkPolyDataMapper;
|
||||
class vtkRenderer;
|
||||
|
||||
|
||||
class vtkMapper;
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
class runTimePostProcessing;
|
||||
|
||||
namespace runTimePostPro
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fieldVisualisationBase Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -91,20 +94,9 @@ public:
|
||||
static const Enum<colourMapType> colourMapTypeNames;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
fieldVisualisationBase(const fieldVisualisationBase&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const fieldVisualisationBase&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
// Protected Data
|
||||
|
||||
struct scalarBar
|
||||
{
|
||||
@ -118,7 +110,7 @@ protected:
|
||||
};
|
||||
|
||||
//- Colours
|
||||
const HashPtrTable<Function1<vector>, word>& colours_;
|
||||
const HashPtrTable<Function1<vector>>& colours_;
|
||||
|
||||
//- Field name
|
||||
word fieldName_;
|
||||
@ -171,6 +163,12 @@ protected:
|
||||
vtkRenderer* renderer
|
||||
) const;
|
||||
|
||||
//- No copy construct
|
||||
fieldVisualisationBase(const fieldVisualisationBase&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const fieldVisualisationBase&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -180,7 +178,7 @@ public:
|
||||
fieldVisualisationBase
|
||||
(
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
);
|
||||
|
||||
|
||||
@ -193,7 +191,7 @@ public:
|
||||
// Access
|
||||
|
||||
//- Return the colours
|
||||
const HashPtrTable<Function1<vector>, word>& colours() const;
|
||||
const HashPtrTable<Function1<vector>>& colours() const;
|
||||
|
||||
//- Return the field name
|
||||
const word& fieldName() const;
|
||||
@ -202,6 +200,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace runTimePostPro
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ Foam::functionObjects::runTimePostPro::functionObjectBase::functionObjectBase
|
||||
(
|
||||
const stateFunctionObject& state,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
)
|
||||
:
|
||||
fieldVisualisationBase(dict, colours),
|
||||
|
||||
@ -109,13 +109,13 @@ protected:
|
||||
// \note does not change the stateFunctionObject
|
||||
bool removeFile(const word& keyword, const word& subDictName);
|
||||
|
||||
|
||||
//- No copy construct
|
||||
functionObjectBase(const functionObjectBase&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const functionObjectBase&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Run-time type information
|
||||
@ -129,7 +129,7 @@ public:
|
||||
(
|
||||
const stateFunctionObject& state,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -35,10 +35,12 @@ License
|
||||
#include "vtkSmartPointer.h"
|
||||
#include "vtkPolyData.h"
|
||||
#include "vtkPolyDataMapper.h"
|
||||
#include "vtkXMLPolyDataReader.h"
|
||||
#include "vtkPolyDataReader.h"
|
||||
#include "vtkProperty.h"
|
||||
|
||||
// VTK Readers
|
||||
#include "vtkPolyDataReader.h"
|
||||
#include "vtkXMLPolyDataReader.h"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -60,7 +62,7 @@ Foam::functionObjects::runTimePostPro::functionObjectCloud::functionObjectCloud
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
)
|
||||
:
|
||||
pointData(parent, dict, colours),
|
||||
@ -101,7 +103,6 @@ addGeometryToScene
|
||||
// containing all fields.
|
||||
|
||||
inputFileName_ = getFileName("file", cloudName_);
|
||||
inputFileName_.expand();
|
||||
|
||||
if (inputFileName_.empty())
|
||||
{
|
||||
@ -113,6 +114,7 @@ addGeometryToScene
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
vtkSmartPointer<vtkPolyData> dataset;
|
||||
|
||||
if (inputFileName_.hasExt("vtp"))
|
||||
@ -128,9 +130,17 @@ addGeometryToScene
|
||||
// Invalid name - ignore.
|
||||
// Don't support VTK legacy format at all - it is too wasteful
|
||||
// and cumbersome.
|
||||
|
||||
WarningInFunction
|
||||
<< "Could not read "<< inputFileName_ << nl
|
||||
<< "Only VTK (.vtp) files are supported"
|
||||
<< ". Cloud will not be processed"
|
||||
<< endl;
|
||||
|
||||
inputFileName_.clear();
|
||||
}
|
||||
|
||||
|
||||
if (dataset)
|
||||
{
|
||||
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
|
||||
@ -56,20 +56,9 @@ class functionObjectCloud
|
||||
public pointData,
|
||||
public functionObjectBase
|
||||
{
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
functionObjectCloud(const functionObjectCloud&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const functionObjectCloud&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
// Protected Data
|
||||
|
||||
//- Name of functionObjectCloud
|
||||
word cloudName_;
|
||||
@ -83,6 +72,16 @@ protected:
|
||||
//- Actor
|
||||
vtkSmartPointer<vtkActor> actor_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- No copy construct
|
||||
functionObjectCloud(const functionObjectCloud&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const functionObjectCloud&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Run-time type information
|
||||
@ -96,7 +95,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,11 +30,15 @@ License
|
||||
|
||||
// VTK includes
|
||||
#include "vtkActor.h"
|
||||
#include "vtkPolyData.h"
|
||||
#include "vtkPolyDataMapper.h"
|
||||
#include "vtkProperty.h"
|
||||
#include "vtkRenderer.h"
|
||||
#include "vtkSmartPointer.h"
|
||||
#include "vtkPolyDataMapper.h"
|
||||
|
||||
// VTK Readers
|
||||
#include "vtkPolyDataReader.h"
|
||||
#include "vtkProperty.h"
|
||||
#include "vtkXMLPolyDataReader.h"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -51,13 +55,51 @@ namespace runTimePostPro
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
static vtkSmartPointer<vtkPolyData> getPolyDataFile(const Foam::fileName& fName)
|
||||
{
|
||||
// Not extremely elegant...
|
||||
vtkSmartPointer<vtkPolyData> dataset;
|
||||
|
||||
if (fName.ext() == "vtk")
|
||||
{
|
||||
auto reader = vtkSmartPointer<vtkPolyDataReader>::New();
|
||||
|
||||
reader->SetFileName(fName.c_str());
|
||||
reader->Update();
|
||||
dataset = reader->GetOutput();
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
if (fName.ext() == "vtp")
|
||||
{
|
||||
auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
|
||||
|
||||
reader->SetFileName(fName.c_str());
|
||||
reader->Update();
|
||||
dataset = reader->GetOutput();
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
} // End anonymous namespace
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimePostPro::functionObjectLine::functionObjectLine
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
)
|
||||
:
|
||||
pathline(parent, dict, colours),
|
||||
@ -99,22 +141,29 @@ addGeometryToScene
|
||||
return;
|
||||
}
|
||||
|
||||
if (fName.hasExt("vtk"))
|
||||
|
||||
auto polyData = getPolyDataFile(fName);
|
||||
|
||||
if (!polyData || polyData->GetNumberOfPoints() == 0)
|
||||
{
|
||||
auto lines = vtkSmartPointer<vtkPolyDataReader>::New();
|
||||
lines->SetFileName(fName.c_str());
|
||||
lines->Update();
|
||||
WarningInFunction
|
||||
<< "Could not read "<< fName << nl
|
||||
<< "Only VTK (.vtp, .vtk) files are supported"
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
setField(position, fieldName_, mapper, renderer, lines->GetOutput());
|
||||
|
||||
setField(position, fieldName_, mapper, renderer, polyData);
|
||||
|
||||
actor_->SetMapper(mapper);
|
||||
|
||||
addLines(position, actor_, lines->GetOutput());
|
||||
addLines(position, actor_, polyData);
|
||||
|
||||
renderer->AddActor(actor_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::runTimePostPro::functionObjectLine::updateActors
|
||||
@ -126,6 +175,7 @@ void Foam::functionObjects::runTimePostPro::functionObjectLine::updateActors
|
||||
actor_->GetProperty()->SetOpacity(opacity(position));
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::runTimePostPro::functionObjectLine::clear()
|
||||
{
|
||||
if (functionObjectBase::clear())
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -56,9 +56,15 @@ class functionObjectLine
|
||||
public pathline,
|
||||
public functionObjectBase
|
||||
{
|
||||
private:
|
||||
protected:
|
||||
|
||||
// Private Member Functions
|
||||
// Protected Data
|
||||
|
||||
//- Actor
|
||||
vtkSmartPointer<vtkActor> actor_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- No copy construct
|
||||
functionObjectLine(const functionObjectLine&) = delete;
|
||||
@ -67,14 +73,6 @@ private:
|
||||
void operator=(const functionObjectLine&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Actor
|
||||
vtkSmartPointer<vtkActor> actor_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Run-time type information
|
||||
@ -88,7 +86,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -30,12 +30,16 @@ License
|
||||
|
||||
// VTK includes
|
||||
#include "vtkActor.h"
|
||||
#include "vtkPolyData.h"
|
||||
#include "vtkPolyDataMapper.h"
|
||||
#include "vtkPolyDataReader.h"
|
||||
#include "vtkProperty.h"
|
||||
#include "vtkRenderer.h"
|
||||
#include "vtkSmartPointer.h"
|
||||
|
||||
// VTK Readers
|
||||
#include "vtkPolyDataReader.h"
|
||||
#include "vtkXMLPolyDataReader.h"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -51,6 +55,44 @@ namespace runTimePostPro
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
static vtkSmartPointer<vtkPolyData> getPolyDataFile(const Foam::fileName& fName)
|
||||
{
|
||||
// Not extremely elegant...
|
||||
vtkSmartPointer<vtkPolyData> dataset;
|
||||
|
||||
if (fName.ext() == "vtk")
|
||||
{
|
||||
auto reader = vtkSmartPointer<vtkPolyDataReader>::New();
|
||||
|
||||
reader->SetFileName(fName.c_str());
|
||||
reader->Update();
|
||||
dataset = reader->GetOutput();
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
if (fName.ext() == "vtp")
|
||||
{
|
||||
auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
|
||||
|
||||
reader->SetFileName(fName.c_str());
|
||||
reader->Update();
|
||||
dataset = reader->GetOutput();
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
} // End anonymous namespace
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimePostPro::functionObjectSurface::
|
||||
@ -58,7 +100,7 @@ functionObjectSurface
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
)
|
||||
:
|
||||
geometrySurface(parent, dict, colours, List<fileName>()),
|
||||
@ -99,37 +141,38 @@ addGeometryToScene
|
||||
}
|
||||
|
||||
|
||||
auto polyData = getPolyDataFile(fName);
|
||||
|
||||
if (!polyData || polyData->GetNumberOfPoints() == 0)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Could not read "<< fName << nl
|
||||
<< "Only VTK (.vtp, .vtk) files are supported"
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (representation_ == rtGlyph)
|
||||
{
|
||||
auto surf = vtkSmartPointer<vtkPolyDataReader>::New();
|
||||
surf->SetFileName(fName.c_str());
|
||||
surf->Update();
|
||||
|
||||
addGlyphs
|
||||
(
|
||||
position,
|
||||
fieldName_,
|
||||
fieldName_,
|
||||
maxGlyphLength_,
|
||||
surf->GetOutput(),
|
||||
polyData,
|
||||
surfaceActor_,
|
||||
renderer
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fName.hasExt("vtk"))
|
||||
else
|
||||
{
|
||||
auto surf = vtkSmartPointer<vtkPolyDataReader>::New();
|
||||
surf->SetFileName(fName.c_str());
|
||||
surf->Update();
|
||||
|
||||
addFeatureEdges(renderer, surf->GetOutput());
|
||||
addFeatureEdges(renderer, polyData);
|
||||
|
||||
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(surf->GetOutputPort());
|
||||
mapper->SetInputData(polyData);
|
||||
|
||||
setField(position, fieldName_, mapper, renderer, surf->GetOutput());
|
||||
setField(position, fieldName_, mapper, renderer, polyData);
|
||||
|
||||
surfaceActor_->SetMapper(mapper);
|
||||
|
||||
@ -137,12 +180,6 @@ addGeometryToScene
|
||||
|
||||
renderer->AddActor(surfaceActor_);
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Only VTK file types are supported"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -56,10 +56,9 @@ class functionObjectSurface
|
||||
public geometrySurface,
|
||||
public functionObjectBase
|
||||
{
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
// Protected Member Functions
|
||||
|
||||
//- No copy construct
|
||||
functionObjectSurface(const functionObjectSurface&) = delete;
|
||||
@ -81,7 +80,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "runTimePostProcessing.H"
|
||||
#include "Constant.H"
|
||||
|
||||
// VTK includes
|
||||
#include "vtkActor.h"
|
||||
#include "vtkProperty.h"
|
||||
|
||||
@ -81,7 +82,7 @@ Foam::functionObjects::runTimePostPro::geometryBase::geometryBase
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
)
|
||||
:
|
||||
parent_(parent),
|
||||
@ -96,7 +97,7 @@ Foam::functionObjects::runTimePostPro::geometryBase::geometryBase
|
||||
{
|
||||
if (dict.found("opacity"))
|
||||
{
|
||||
opacity_.reset(Function1<scalar>::New("opacity", dict).ptr());
|
||||
opacity_.reset(Function1<scalar>::New("opacity", dict));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,7 +25,15 @@ Class
|
||||
Foam::functionObjects::runTimePostPro::geometryBase
|
||||
|
||||
Description
|
||||
Base class for surface handling
|
||||
Base class for surface, text handling
|
||||
|
||||
Dictionary controls
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
visible | Display the object | yes |
|
||||
renderMode | Shading (flat/gouraud/phong) | no | gouraud
|
||||
opacity | Object opacity | no | 1.0
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
geometryBase.C
|
||||
@ -43,6 +51,7 @@ SourceFiles
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward declarations
|
||||
class vtkRenderer;
|
||||
class vtkActor;
|
||||
|
||||
@ -51,6 +60,7 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
class runTimePostProcessing;
|
||||
|
||||
namespace runTimePostPro
|
||||
@ -78,17 +88,6 @@ public:
|
||||
static const Enum<renderModeType> renderModeTypeNames;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
geometryBase(const geometryBase&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const geometryBase&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
@ -109,7 +108,7 @@ protected:
|
||||
autoPtr<Function1<scalar>> opacity_;
|
||||
|
||||
//- Reference to the colours
|
||||
const HashPtrTable<Function1<vector>, word>& colours_;
|
||||
const HashPtrTable<Function1<vector>>& colours_;
|
||||
|
||||
|
||||
// Protected functions
|
||||
@ -117,6 +116,12 @@ protected:
|
||||
//- Initialise actor
|
||||
void initialiseActor(vtkActor* actor) const;
|
||||
|
||||
//- No copy construct
|
||||
geometryBase(const geometryBase&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const geometryBase&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -127,7 +132,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent_,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
);
|
||||
|
||||
|
||||
@ -152,9 +157,11 @@ public:
|
||||
scalar opacity(const scalar position) const;
|
||||
|
||||
//- Return reference to the colours
|
||||
const HashPtrTable<Function1<vector>, word>& colours() const;
|
||||
const HashPtrTable<Function1<vector>>& colours() const;
|
||||
|
||||
|
||||
// Scene interaction
|
||||
|
||||
//- Add geometry to scene
|
||||
virtual void addGeometryToScene
|
||||
(
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,7 +26,8 @@ License
|
||||
// OpenFOAM includes
|
||||
#include "geometrySurface.H"
|
||||
#include "stringOps.H"
|
||||
#include "triSurface.H"
|
||||
#include "foamVtkTools.H"
|
||||
#include "MeshedSurfaces.H"
|
||||
#include "runTimePostProcessing.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
@ -42,7 +43,12 @@ License
|
||||
#include "vtkProperty.h"
|
||||
#include "vtkRenderer.h"
|
||||
#include "vtkSmartPointer.h"
|
||||
#include "vtkTriangle.h"
|
||||
|
||||
// VTK Readers
|
||||
#include "vtkOBJReader.h"
|
||||
#include "vtkSTLReader.h"
|
||||
#include "vtkPolyDataReader.h"
|
||||
#include "vtkXMLPolyDataReader.h"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -58,6 +64,78 @@ namespace runTimePostPro
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
static vtkSmartPointer<vtkPolyData> getPolyDataFile(const Foam::fileName& fName)
|
||||
{
|
||||
// Not extremely elegant...
|
||||
vtkSmartPointer<vtkPolyData> dataset;
|
||||
|
||||
if (fName.ext() == "vtk")
|
||||
{
|
||||
auto reader = vtkSmartPointer<vtkPolyDataReader>::New();
|
||||
|
||||
reader->SetFileName(fName.c_str());
|
||||
reader->Update();
|
||||
dataset = reader->GetOutput();
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
if (fName.ext() == "vtp")
|
||||
{
|
||||
auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
|
||||
|
||||
reader->SetFileName(fName.c_str());
|
||||
reader->Update();
|
||||
dataset = reader->GetOutput();
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
if (fName.ext() == "obj")
|
||||
{
|
||||
auto reader = vtkSmartPointer<vtkOBJReader>::New();
|
||||
|
||||
reader->SetFileName(fName.c_str());
|
||||
reader->Update();
|
||||
dataset = reader->GetOutput();
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
if (fName.ext() == "stl" || fName.ext() == "stlb")
|
||||
{
|
||||
auto reader = vtkSmartPointer<vtkSTLReader>::New();
|
||||
|
||||
reader->SetFileName(fName.c_str());
|
||||
reader->Update();
|
||||
dataset = reader->GetOutput();
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
|
||||
// Fallback to using OpenFOAM to read the surface and convert afterwards
|
||||
Foam::meshedSurface surf(fName);
|
||||
|
||||
dataset = Foam::vtk::Tools::Patch::mesh(surf);
|
||||
|
||||
dataset->GetCellData()->SetNormals
|
||||
(
|
||||
Foam::vtk::Tools::Patch::faceNormals(surf)
|
||||
);
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
} // End anonymous namespace
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::runTimePostPro::geometrySurface::addGeometryToScene
|
||||
@ -74,53 +152,22 @@ void Foam::functionObjects::runTimePostPro::geometrySurface::addGeometryToScene
|
||||
<< " object" << exit(FatalError);
|
||||
}
|
||||
|
||||
triSurface surf(fName);
|
||||
auto surf = getPolyDataFile(fName);
|
||||
|
||||
const Field<point>& surfPoints = surf.points();
|
||||
const Field<vector>& surfFaceNormals = surf.faceNormals();
|
||||
|
||||
auto points = vtkSmartPointer<vtkPoints>::New();
|
||||
auto triangles = vtkSmartPointer<vtkCellArray>::New();
|
||||
auto faceNormals = vtkSmartPointer<vtkDoubleArray>::New();
|
||||
|
||||
faceNormals->SetNumberOfComponents(3);
|
||||
|
||||
forAll(surfPoints, i)
|
||||
if (!surf || surf->GetNumberOfPoints() == 0)
|
||||
{
|
||||
const point& pt = surfPoints[i];
|
||||
points->InsertNextPoint(pt.x(), pt.y(), pt.z());
|
||||
FatalErrorInFunction
|
||||
<< "Could not read "<< fName << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
forAll(surf, i)
|
||||
{
|
||||
const Foam::face& f = surf[i];
|
||||
|
||||
auto triangle = vtkSmartPointer<vtkTriangle>::New();
|
||||
triangle->GetPointIds()->SetId(0, f[0]);
|
||||
triangle->GetPointIds()->SetId(1, f[1]);
|
||||
triangle->GetPointIds()->SetId(2, f[2]);
|
||||
triangles->InsertNextCell(triangle);
|
||||
|
||||
double n[3];
|
||||
n[0] = surfFaceNormals[i].x();
|
||||
n[1] = surfFaceNormals[i].y();
|
||||
n[2] = surfFaceNormals[i].z();
|
||||
|
||||
faceNormals->InsertNextTuple(n);
|
||||
}
|
||||
|
||||
surf.clearOut();
|
||||
|
||||
auto polyData = vtkSmartPointer<vtkPolyData>::New();
|
||||
polyData->SetPoints(points);
|
||||
polyData->SetPolys(triangles);
|
||||
polyData->GetCellData()->SetNormals(faceNormals);
|
||||
|
||||
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->ScalarVisibilityOff();
|
||||
mapper->SetInputData(polyData);
|
||||
|
||||
addFeatureEdges(renderer, polyData);
|
||||
mapper->ScalarVisibilityOff();
|
||||
|
||||
mapper->SetInputData(surf);
|
||||
|
||||
addFeatureEdges(renderer, surf);
|
||||
|
||||
surfaceActor_->SetMapper(mapper);
|
||||
|
||||
@ -136,7 +183,7 @@ Foam::functionObjects::runTimePostPro::geometrySurface::geometrySurface
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
)
|
||||
:
|
||||
surface(parent, dict, colours),
|
||||
@ -150,7 +197,7 @@ Foam::functionObjects::runTimePostPro::geometrySurface::geometrySurface
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours,
|
||||
const HashPtrTable<Function1<vector>>& colours,
|
||||
const List<fileName>& fileNames
|
||||
)
|
||||
:
|
||||
@ -159,12 +206,6 @@ Foam::functionObjects::runTimePostPro::geometrySurface::geometrySurface
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimePostPro::geometrySurface::~geometrySurface()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::runTimePostPro::geometrySurface::addGeometryToScene
|
||||
@ -178,10 +219,10 @@ void Foam::functionObjects::runTimePostPro::geometrySurface::addGeometryToScene
|
||||
return;
|
||||
}
|
||||
|
||||
forAll(fileNames_, i)
|
||||
for (fileName f : fileNames_) // Use a copy
|
||||
{
|
||||
fileName fName = fileNames_[i].expand();
|
||||
addGeometryToScene(position, renderer, fName);
|
||||
f.expand();
|
||||
addGeometryToScene(position, renderer, f);
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,8 +251,8 @@ void Foam::functionObjects::runTimePostPro::geometrySurface::updateActors
|
||||
|
||||
bool Foam::functionObjects::runTimePostPro::geometrySurface::clear()
|
||||
{
|
||||
// Note: not removing geometry files
|
||||
// - these are usually static files that are used e.g. for meshing
|
||||
// Note: do not remove geometry files
|
||||
// - often static files used for other purposes as well (eg meshing)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::geometrySurface
|
||||
Foam::functionObjects::runTimePostPro::geometrySurface
|
||||
|
||||
Description
|
||||
Visualisation of surface geometry data
|
||||
@ -39,6 +39,7 @@ SourceFiles
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward declarations
|
||||
class vtkPolyData;
|
||||
|
||||
namespace Foam
|
||||
@ -56,17 +57,6 @@ class geometrySurface
|
||||
:
|
||||
public surface
|
||||
{
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
geometrySurface(const geometrySurface&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const geometrySurface&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
@ -85,6 +75,12 @@ protected:
|
||||
const fileName& fName
|
||||
) const;
|
||||
|
||||
//- No copy construct
|
||||
geometrySurface(const geometrySurface&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const geometrySurface&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -99,7 +95,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
@ -107,18 +103,18 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours,
|
||||
const HashPtrTable<Function1<vector>>& colours,
|
||||
const List<fileName>& fileNames
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~geometrySurface();
|
||||
virtual ~geometrySurface() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Add surface(s) to scene
|
||||
//- Add geometry surface(s) to scene
|
||||
virtual void addGeometryToScene
|
||||
(
|
||||
const scalar position,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -123,7 +123,7 @@ Foam::functionObjects::runTimePostPro::pathline::pathline
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
)
|
||||
:
|
||||
geometryBase(parent, dict, colours),
|
||||
@ -136,7 +136,7 @@ Foam::functionObjects::runTimePostPro::pathline::pathline
|
||||
{
|
||||
if (dict.found("lineColour"))
|
||||
{
|
||||
lineColour_.reset(Function1<vector>::New("lineColour", dict).ptr());
|
||||
lineColour_.reset(Function1<vector>::New("lineColour", dict));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -174,7 +174,7 @@ Foam::functionObjects::runTimePostPro::pathline::New
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours,
|
||||
const HashPtrTable<Function1<vector>>& colours,
|
||||
const word& pathlineType
|
||||
)
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -22,9 +22,10 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::pathline
|
||||
Foam::functionObjects::runTimePostPro::pathline
|
||||
|
||||
Description
|
||||
Visualisation of line data (eg, streamlines)
|
||||
|
||||
SourceFiles
|
||||
pathline.C
|
||||
@ -40,6 +41,7 @@ SourceFiles
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward declarations
|
||||
class vtkActor;
|
||||
class vtkPolyData;
|
||||
class vtkPolyDataMapper;
|
||||
@ -74,17 +76,6 @@ public:
|
||||
static const Enum<representationType> representationTypeNames;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
pathline(const pathline&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const pathline&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
@ -109,6 +100,12 @@ protected:
|
||||
vtkPolyData* data
|
||||
) const;
|
||||
|
||||
//- No copy construct
|
||||
pathline(const pathline&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const pathline&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -126,7 +123,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
),
|
||||
(parent, dict, colours)
|
||||
);
|
||||
@ -139,7 +136,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
);
|
||||
|
||||
|
||||
@ -150,7 +147,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours,
|
||||
const HashPtrTable<Function1<vector>>& colours,
|
||||
const word& pathlineName
|
||||
);
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -93,7 +93,7 @@ Foam::functionObjects::runTimePostPro::pointData::pointData
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
)
|
||||
:
|
||||
geometryBase(parent, dict, colours),
|
||||
@ -106,7 +106,7 @@ Foam::functionObjects::runTimePostPro::pointData::pointData
|
||||
{
|
||||
if (dict.found("pointColour"))
|
||||
{
|
||||
pointColour_.reset(Function1<vector>::New("pointColour", dict).ptr());
|
||||
pointColour_.reset(Function1<vector>::New("pointColour", dict));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -135,7 +135,7 @@ Foam::functionObjects::runTimePostPro::pointData::New
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours,
|
||||
const HashPtrTable<Function1<vector>>& colours,
|
||||
const word& pointDataType
|
||||
)
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,6 +25,7 @@ Class
|
||||
Foam::functionObjects::runTimePostPro::pointData
|
||||
|
||||
Description
|
||||
Visualisation of point data
|
||||
|
||||
SourceFiles
|
||||
pointData.C
|
||||
@ -40,6 +41,7 @@ SourceFiles
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward declarations
|
||||
class vtkActor;
|
||||
class vtkPolyData;
|
||||
class vtkPolyDataMapper;
|
||||
@ -72,17 +74,6 @@ public:
|
||||
static const Enum<representationType> representationTypeNames;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
pointData(const pointData&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const pointData&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
@ -108,6 +99,12 @@ protected:
|
||||
vtkPolyData* data
|
||||
) const;
|
||||
|
||||
//- No copy construct
|
||||
pointData(const pointData&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const pointData&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -125,7 +122,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
),
|
||||
(parent, dict, colours)
|
||||
);
|
||||
@ -138,7 +135,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
);
|
||||
|
||||
|
||||
@ -149,7 +146,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours,
|
||||
const HashPtrTable<Function1<vector>>& colours,
|
||||
const word& pointDataName
|
||||
);
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,7 +39,6 @@ License
|
||||
#include "vtkRenderer.h"
|
||||
#include "vtkRenderWindow.h"
|
||||
#include "vtkSmartPointer.h"
|
||||
|
||||
#include "vtkLight.h"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -60,6 +59,48 @@ namespace functionObjects
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template<class Type>
|
||||
static void addGeometryToScene
|
||||
(
|
||||
PtrList<Type>& objects,
|
||||
const scalar position,
|
||||
vtkRenderer* renderer
|
||||
)
|
||||
{
|
||||
for (Type& obj : objects)
|
||||
{
|
||||
obj.addGeometryToScene(position, renderer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
static void updateActors(PtrList<Type>& objects, const scalar position)
|
||||
{
|
||||
for (Type& obj : objects)
|
||||
{
|
||||
obj.updateActors(position);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
static void cleanup(PtrList<Type>& objects)
|
||||
{
|
||||
for (Type& obj : objects)
|
||||
{
|
||||
obj.clear();
|
||||
}
|
||||
}
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimePostProcessing::runTimePostProcessing
|
||||
@ -80,12 +121,6 @@ Foam::functionObjects::runTimePostProcessing::runTimePostProcessing
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimePostProcessing::~runTimePostProcessing()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::runTimePostProcessing::read(const dictionary& dict)
|
||||
@ -101,7 +136,6 @@ bool Foam::functionObjects::runTimePostProcessing::read(const dictionary& dict)
|
||||
outputDict.readEntry("width", output_.width_);
|
||||
outputDict.readEntry("height", output_.height_);
|
||||
|
||||
|
||||
readObjects(dict.subOrEmptyDict("points"), points_);
|
||||
readObjects(dict.subOrEmptyDict("lines"), lines_);
|
||||
readObjects(dict.subOrEmptyDict("surfaces"), surfaces_);
|
||||
@ -113,16 +147,19 @@ bool Foam::functionObjects::runTimePostProcessing::read(const dictionary& dict)
|
||||
if (!dEntry.isDict())
|
||||
{
|
||||
FatalIOErrorInFunction(textDict)
|
||||
<< textDict.dictName()
|
||||
<< "text must be specified in dictionary format"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
const dictionary& objectDict = dEntry.dict();
|
||||
|
||||
text_.append
|
||||
(
|
||||
new runTimePostPro::text
|
||||
(
|
||||
*this,
|
||||
dEntry.dict(),
|
||||
objectDict,
|
||||
scene_.colours()
|
||||
)
|
||||
);
|
||||
@ -173,76 +210,27 @@ bool Foam::functionObjects::runTimePostProcessing::write()
|
||||
|
||||
renderWindow->AddRenderer(renderer);
|
||||
|
||||
// Add the points
|
||||
forAll(points_, i)
|
||||
{
|
||||
points_[i].addGeometryToScene(0, renderer);
|
||||
}
|
||||
|
||||
// Add the lines
|
||||
forAll(lines_, i)
|
||||
{
|
||||
lines_[i].addGeometryToScene(0, renderer);
|
||||
}
|
||||
|
||||
// Add the surfaces
|
||||
forAll(surfaces_, i)
|
||||
{
|
||||
surfaces_[i].addGeometryToScene(0, renderer);
|
||||
}
|
||||
|
||||
// Add the text
|
||||
forAll(text_, i)
|
||||
{
|
||||
text_[i].addGeometryToScene(0, renderer);
|
||||
}
|
||||
addGeometryToScene(points_, 0, renderer);
|
||||
addGeometryToScene(lines_, 0, renderer);
|
||||
addGeometryToScene(surfaces_, 0, renderer);
|
||||
addGeometryToScene(text_, 0, renderer);
|
||||
|
||||
while (scene_.loop(renderer))
|
||||
{
|
||||
scalar position = scene_.position();
|
||||
const scalar position = scene_.position();
|
||||
|
||||
// Update the text
|
||||
forAll(text_, i)
|
||||
{
|
||||
text_[i].updateActors(position);
|
||||
}
|
||||
|
||||
// Update the points
|
||||
forAll(points_, i)
|
||||
{
|
||||
points_[i].updateActors(position);
|
||||
}
|
||||
|
||||
// Update the lines
|
||||
forAll(lines_, i)
|
||||
{
|
||||
lines_[i].updateActors(position);
|
||||
}
|
||||
|
||||
// Update the surfaces
|
||||
forAll(surfaces_, i)
|
||||
{
|
||||
surfaces_[i].updateActors(position);
|
||||
}
|
||||
updateActors(text_, position);
|
||||
updateActors(points_, position);
|
||||
updateActors(lines_, position);
|
||||
updateActors(surfaces_, position);
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
forAll(text_, i)
|
||||
{
|
||||
text_[i].clear();
|
||||
}
|
||||
forAll(points_, i)
|
||||
{
|
||||
points_[i].clear();
|
||||
}
|
||||
forAll(lines_, i)
|
||||
{
|
||||
lines_[i].clear();
|
||||
}
|
||||
forAll(surfaces_, i)
|
||||
{
|
||||
surfaces_[i].clear();
|
||||
}
|
||||
cleanup(text_);
|
||||
cleanup(points_);
|
||||
cleanup(lines_);
|
||||
cleanup(surfaces_);
|
||||
|
||||
|
||||
// Instead of relying on the destructor, manually restore the previous
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -21,8 +21,15 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Namespace
|
||||
Foam::functionObjects::runTimePostPro
|
||||
|
||||
Description
|
||||
Classes and objects used in the implementation of
|
||||
Foam::functionObjects::runTimePostProcessing
|
||||
|
||||
Class
|
||||
Foam::functionObjects::runTimePostPro::runTimePostProcessing
|
||||
Foam::functionObjects::runTimePostProcessing
|
||||
|
||||
Group
|
||||
grpGraphicsFunctionObjects
|
||||
@ -34,9 +41,9 @@ Description
|
||||
which provide a broad set of functionality for scene composition and
|
||||
manipulation.
|
||||
|
||||
Images are generated using a combination of function object output, and
|
||||
additional data e.gg triangulated surfaces and text. Current capabilities
|
||||
include support for:
|
||||
Images are generated using a combination of function object output
|
||||
and additional data - eg, surfaces and text.
|
||||
Current capabilities include support for:
|
||||
- Camera
|
||||
- Objects
|
||||
- Points
|
||||
@ -45,6 +52,8 @@ Description
|
||||
- Scalar bars
|
||||
- Annotations
|
||||
- Selection of colour maps
|
||||
.
|
||||
|
||||
Scene configuration is performed using standard OpenFOAM dictionaries, using
|
||||
the main headings of: output=, camera, colours, points, lines,
|
||||
surfaces and text.
|
||||
@ -65,6 +74,7 @@ SourceFiles
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward declarations
|
||||
class vtkRenderer;
|
||||
class vtkRenderWindow;
|
||||
|
||||
@ -74,6 +84,7 @@ namespace functionObjects
|
||||
{
|
||||
namespace runTimePostPro
|
||||
{
|
||||
// Forward declarations
|
||||
class pointData;
|
||||
class pathline;
|
||||
class surface;
|
||||
@ -123,11 +134,7 @@ private:
|
||||
|
||||
//- Helper function to read scene objects
|
||||
template<class Type>
|
||||
void readObjects
|
||||
(
|
||||
const dictionary& dict,
|
||||
PtrList<Type>& objects
|
||||
) const;
|
||||
void readObjects(const dictionary& dict, PtrList<Type>& objects) const;
|
||||
|
||||
|
||||
public:
|
||||
@ -148,7 +155,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~runTimePostProcessing();
|
||||
virtual ~runTimePostProcessing() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -158,8 +165,8 @@ public:
|
||||
return mesh_;
|
||||
}
|
||||
|
||||
//- Read the field min/max data
|
||||
virtual bool read(const dictionary&);
|
||||
//- Read the post-processing controls
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual bool execute();
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -38,7 +38,6 @@ License
|
||||
#include "vtkRenderWindow.h"
|
||||
#include "vtkWindowToImageFilter.h"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::runTimePostPro::scene::readCamera
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -70,6 +70,7 @@ SourceFiles
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward declarations
|
||||
class vtkActor;
|
||||
class vtkRenderer;
|
||||
class vtkRenderWindow;
|
||||
@ -123,7 +124,7 @@ protected:
|
||||
// Protected data
|
||||
|
||||
//- Colours
|
||||
HashPtrTable<Function1<vector>, word> colours_;
|
||||
HashPtrTable<Function1<vector>> colours_;
|
||||
|
||||
|
||||
// Camera settings
|
||||
@ -200,7 +201,7 @@ public:
|
||||
// Access
|
||||
|
||||
//- Return the colours
|
||||
const HashPtrTable<Function1<vector>, word>& colours() const;
|
||||
const HashPtrTable<Function1<vector>>& colours() const;
|
||||
|
||||
//- Return the current frame index
|
||||
label frameIndex() const;
|
||||
@ -208,6 +209,7 @@ public:
|
||||
//- Return the current position (in range 0-1)
|
||||
scalar position() const;
|
||||
|
||||
|
||||
void read(const dictionary& dict);
|
||||
|
||||
void initialise(vtkRenderer* renderer, const word& outputName);
|
||||
|
||||
@ -83,7 +83,7 @@ void Foam::functionObjects::runTimePostPro::surface::setRepresentation
|
||||
}
|
||||
case rtWireframe:
|
||||
{
|
||||
// note: colour is set using general SetColour, not setEdgeColor
|
||||
// note: colour is set using general SetColor, not SetEdgeColor
|
||||
actor->GetProperty()->SetRepresentationToWireframe();
|
||||
break;
|
||||
}
|
||||
@ -143,7 +143,7 @@ Foam::functionObjects::runTimePostPro::surface::surface
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
)
|
||||
:
|
||||
geometryBase(parent, dict, colours),
|
||||
@ -163,10 +163,7 @@ Foam::functionObjects::runTimePostPro::surface::surface
|
||||
|
||||
if (dict.found("surfaceColour"))
|
||||
{
|
||||
surfaceColour_.reset
|
||||
(
|
||||
Function1<vector>::New("surfaceColour", dict).ptr()
|
||||
);
|
||||
surfaceColour_.reset(Function1<vector>::New("surfaceColour", dict));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -175,7 +172,7 @@ Foam::functionObjects::runTimePostPro::surface::surface
|
||||
|
||||
if (dict.found("edgeColour"))
|
||||
{
|
||||
edgeColour_.reset(Function1<vector>::New("edgeColour", dict).ptr());
|
||||
edgeColour_.reset(Function1<vector>::New("edgeColour", dict));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -200,7 +197,7 @@ Foam::functionObjects::runTimePostPro::surface::New
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours,
|
||||
const HashPtrTable<Function1<vector>>& colours,
|
||||
const word& surfaceType
|
||||
)
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,6 +25,7 @@ Class
|
||||
Foam::functionObjects::runTimePostPro::surface
|
||||
|
||||
Description
|
||||
Visualisation of surface data
|
||||
|
||||
SourceFiles
|
||||
surface.C
|
||||
@ -37,11 +38,11 @@ SourceFiles
|
||||
#include "geometryBase.H"
|
||||
#include "Enum.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
#include "vtkSmartPointer.h"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward declarations
|
||||
class vtkActor;
|
||||
class vtkRenderer;
|
||||
class vtkPolyData;
|
||||
@ -77,17 +78,6 @@ public:
|
||||
static const Enum<representationType> representationTypeNames;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
surface(const surface&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const surface&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
@ -126,6 +116,12 @@ protected:
|
||||
vtkPolyData* data
|
||||
) const;
|
||||
|
||||
//- No copy construct
|
||||
surface(const surface&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const surface&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -143,7 +139,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
),
|
||||
(parent, dict, colours)
|
||||
);
|
||||
@ -156,7 +152,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
);
|
||||
|
||||
|
||||
@ -167,7 +163,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours,
|
||||
const HashPtrTable<Function1<vector>>& colours,
|
||||
const word& surfaceName
|
||||
);
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,13 +34,28 @@ License
|
||||
#include "vtkTextActor.h"
|
||||
#include "vtkTextProperty.h"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::functionObjects::runTimePostPro::text::halignType
|
||||
>
|
||||
Foam::functionObjects::runTimePostPro::text::halignTypeNames
|
||||
({
|
||||
{ halignType::LEFT, "left" },
|
||||
{ halignType::CENTER, "center" },
|
||||
{ halignType::CENTER, "centre" },
|
||||
{ halignType::RIGHT, "right" },
|
||||
});
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimePostPro::text::text
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
)
|
||||
:
|
||||
geometryBase(parent, dict, colours),
|
||||
@ -48,14 +63,20 @@ Foam::functionObjects::runTimePostPro::text::text
|
||||
position_(),
|
||||
size_(dict.get<scalar>("size")),
|
||||
colour_(nullptr),
|
||||
halign_
|
||||
(
|
||||
halignTypeNames.lookupOrDefault("halign", dict, halignType::LEFT)
|
||||
),
|
||||
bold_(dict.get<bool>("bold")),
|
||||
italic_(dict.lookupOrDefault("italic", false)),
|
||||
shadow_(dict.lookupOrDefault("shadow", false)),
|
||||
timeStamp_(dict.lookupOrDefault("timeStamp", false))
|
||||
{
|
||||
dict.readEntry("position", position_);
|
||||
|
||||
if (dict.found("colour"))
|
||||
{
|
||||
colour_.reset(Function1<vector>::New("colour", dict).ptr());
|
||||
colour_.reset(Function1<vector>::New("colour", dict));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -86,21 +107,28 @@ void Foam::functionObjects::runTimePostPro::text::addGeometryToScene
|
||||
auto actor = vtkSmartPointer<vtkTextActor>::New();
|
||||
|
||||
// Concatenate string with timeStamp if true
|
||||
string textAndTime = string_;
|
||||
string str = string_;
|
||||
if (timeStamp_)
|
||||
{
|
||||
textAndTime =
|
||||
textAndTime + " " + geometryBase::parent_.mesh().time().timeName();
|
||||
str += " " + geometryBase::parent_.mesh().time().timeName();
|
||||
}
|
||||
actor->SetInput(textAndTime.c_str());
|
||||
actor->GetTextProperty()->SetFontFamilyToArial();
|
||||
actor->GetTextProperty()->SetFontSize(size_);
|
||||
actor->GetTextProperty()->SetJustificationToLeft();
|
||||
actor->GetTextProperty()->SetVerticalJustificationToBottom();
|
||||
actor->GetTextProperty()->SetBold(bold_);
|
||||
actor->SetInput(str.c_str());
|
||||
|
||||
vtkTextProperty* prop = actor->GetTextProperty();
|
||||
|
||||
prop->SetFontFamilyToArial();
|
||||
prop->SetFontSize(size_);
|
||||
prop->SetJustification(int(halign_));
|
||||
prop->SetVerticalJustificationToBottom();
|
||||
prop->SetBold(bold_);
|
||||
prop->SetItalic(italic_);
|
||||
prop->SetShadow(shadow_);
|
||||
|
||||
const vector colour = colour_->value(position);
|
||||
actor->GetTextProperty()->SetColor(colour[0], colour[1], colour[2]);
|
||||
|
||||
prop->SetColor(colour[0], colour[1], colour[2]);
|
||||
prop->SetOpacity(opacity(position));
|
||||
|
||||
actor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
|
||||
actor->GetPositionCoordinate()->SetValue
|
||||
(
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,6 +25,8 @@ Class
|
||||
Foam::functionObjects::runTimePostPro::text
|
||||
|
||||
Description
|
||||
Define text element for runTimePostProcessing
|
||||
|
||||
Example of text object specification:
|
||||
\verbatim
|
||||
text1
|
||||
@ -32,7 +34,11 @@ Description
|
||||
string "text to display";
|
||||
position (0.1 0.05);
|
||||
size 18;
|
||||
// halign left; // (left | centre | right)
|
||||
bold yes;
|
||||
// Optional entry
|
||||
|
||||
shadow false;
|
||||
visible yes;
|
||||
|
||||
// Optionally override default colour
|
||||
@ -43,6 +49,27 @@ Description
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Dictionary controls
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
string | Text to display | yes |
|
||||
position | The (x y) viewport position | yes |
|
||||
size | The font size in points | yes |
|
||||
halign | Text justification (left/centre/ right) | no | left
|
||||
bold | Use bold font | yes |
|
||||
italic | Use italic font | no | false
|
||||
shadow | Add text shadow | no | false
|
||||
colour | Override default text colour | no |
|
||||
timeStamp | Append solution timeName to string | no | false
|
||||
\endtable
|
||||
|
||||
Inherited controls
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
visible | Display the object | yes |
|
||||
opacity | Object opacity | no | 1.0
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
text.C
|
||||
|
||||
@ -56,6 +83,7 @@ SourceFiles
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward declarations
|
||||
class vtkRenderer;
|
||||
|
||||
namespace Foam
|
||||
@ -73,20 +101,25 @@ class text
|
||||
:
|
||||
public geometryBase
|
||||
{
|
||||
private:
|
||||
public:
|
||||
|
||||
// Private Member Functions
|
||||
// Public enumerations
|
||||
|
||||
//- No copy construct
|
||||
text(const text&) = delete;
|
||||
//- Horizontal alignment type
|
||||
enum halignType
|
||||
{
|
||||
LEFT = 0, //!< Left-justified text - default ("left")
|
||||
CENTER = 1, //!< Centred text ("center", "centre")
|
||||
RIGHT = 2 //!< Right-justified text ("right")
|
||||
};
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const text&) = delete;
|
||||
//- Horizontal alignment names (includes "center" and "centre")
|
||||
static const Enum<halignType> halignTypeNames;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
// Protected Data
|
||||
|
||||
//- Text
|
||||
string string_;
|
||||
@ -100,13 +133,31 @@ protected:
|
||||
//- Colour
|
||||
autoPtr<Function1<vector>> colour_;
|
||||
|
||||
//- Horizontal alignment
|
||||
halignType halign_;
|
||||
|
||||
//- Bold flag
|
||||
bool bold_;
|
||||
|
||||
//- Italic flag
|
||||
bool italic_;
|
||||
|
||||
//- Shadow flag
|
||||
bool shadow_;
|
||||
|
||||
//- Time stamp flag
|
||||
bool timeStamp_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- No copy construct
|
||||
text(const text&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const text&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
@ -116,7 +167,7 @@ public:
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
const dictionary& dict,
|
||||
const HashPtrTable<Function1<vector>, word>& colours
|
||||
const HashPtrTable<Function1<vector>>& colours
|
||||
);
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user