Commit 1687a454 authored by sergio's avatar sergio
Browse files

Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

parents 66ca352f 3f4289c2
......@@ -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,20 +72,27 @@ 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;
Info<<"have: "
<<args.count({"label", "scalar"}) << " options" << 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;
label ival;
scalar sval;
......
......@@ -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
(
IOobject
io,
IOdictionary
(
"mirrorMeshDict",
time().system(),
*this,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
IOobject
(
"mirrorMeshDict",
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:
......@@ -325,7 +340,7 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
Info<< "Mirroring patches. Old patches: " << boundary().size()
<< " New patches: " << boundary().size() << endl;
Info<< "Mirroring cells. Old cells: " << oldCells.size()
Info<< "Mirroring cells. Old cells: " << oldCells.size()
<< " New cells: " << 2*oldCells.size() << endl;
cellList newCells(2*oldCells.size());
......
......@@ -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);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment