Commit 69bcc1ba authored by Mark Olesen's avatar Mark Olesen
Browse files

Merge commit 'OpenCFD/master' into olesenm

parents 7f4a9992 0d45add4
......@@ -312,7 +312,7 @@ label collapseHighAspectFaces
if (lengths[1] > edgeRatio*lengths[0])
{
edgeI = fEdges[lengths.indices()[0]];
}
}
}
......@@ -456,6 +456,7 @@ label simplifyFaces
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validOptions.insert("overwrite", "");
argList::validArgs.append("edge length [m]");
argList::validArgs.append("merge angle (degrees)");
......@@ -465,6 +466,7 @@ int main(int argc, char *argv[])
scalar minLen(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar angle(readScalar(IStringStream(args.additionalArgs()[1])()));
bool overwrite = args.options().found("overwrite");
scalar maxCos = Foam::cos(angle*180/mathematicalConstant::pi);
......@@ -580,7 +582,10 @@ int main(int argc, char *argv[])
if (meshChanged)
{
// Write resulting mesh
runTime++;
if (!overwrite)
{
runTime++;
}
Info << "Writing collapsed mesh to time " << runTime.value() << endl;
......
......@@ -92,7 +92,7 @@ void checkSnapMesh
scalar relMinVol(readScalar(snapDict.lookup("minVol")));
const scalar minCellVol = min(mesh.cellVolumes());
const scalar minPyrVol = relMinVol*minCellVol;
// Min area
// Min area
scalar minArea(readScalar(snapDict.lookup("minArea")));
if (maxNonOrtho < 180.0-SMALL)
......@@ -435,6 +435,7 @@ int main(int argc, char *argv[])
argList::validArgs.append("feature angle [0..180]");
argList::validOptions.insert("concaveAngle", "[0..180]");
argList::validOptions.insert("snapMesh", "");
argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
......@@ -457,6 +458,7 @@ int main(int argc, char *argv[])
scalar concaveSin = Foam::sin(concaveAngle*mathematicalConstant::pi/180.0);
bool snapMeshDict = args.options().found("snapMesh");
bool overwrite = args.options().found("overwrite");
Info<< "Merging all faces of a cell" << nl
<< " - which are on the same patch" << nl
......@@ -468,7 +470,10 @@ int main(int argc, char *argv[])
<< " (sin:" << concaveSin << ')' << nl
<< endl;
runTime++;
if (!overwrite)
{
runTime++;
}
// Merge faces on same patch
label nChanged = mergePatchFaces
......
......@@ -328,10 +328,14 @@ label findCell(const primitiveMesh& mesh, const point& nearPoint)
int main(int argc, char *argv[])
{
argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
# include "createPolyMesh.H"
bool overwrite = args.options().found("overwrite");
Info<< "Reading modifyMeshDict\n" << endl;
IOdictionary dict
......@@ -366,7 +370,7 @@ int main(int argc, char *argv[])
bool cellsToSplit = cellsToPyramidise.size() > 0;
//List<Tuple<pointField,point> >
//List<Tuple<pointField,point> >
// cellsToCreate(dict.lookup("cellsToCreate"));
Info<< "Read from " << dict.name() << nl
......@@ -541,7 +545,10 @@ int main(int argc, char *argv[])
cutter.updateMesh(morphMap());
runTime++;
if (!overwrite)
{
runTime++;
}
// Write resulting mesh
Info << "Writing modified mesh to time " << runTime.value() << endl;
......@@ -572,7 +579,7 @@ int main(int argc, char *argv[])
// Topo change container
polyTopoChange meshMod(mesh);
// Insert
// Insert
cutter.setRefinement(meshMod);
// Do changes
......@@ -587,7 +594,10 @@ int main(int argc, char *argv[])
//cutter.updateMesh(morphMap());
runTime++;
if (!overwrite)
{
runTime++;
}
// Write resulting mesh
Info << "Writing modified mesh to time " << runTime.value() << endl;
......@@ -623,7 +633,10 @@ int main(int argc, char *argv[])
cutter.updateMesh(morphMap());
runTime++;
if (!overwrite)
{
runTime++;
}
// Write resulting mesh
Info << "Writing modified mesh to time " << runTime.value() << endl;
......
......@@ -52,6 +52,7 @@ using namespace Foam;
// Main program:
int main(int argc, char *argv[])
{
argList::validOptions.insert("overwrite", "");
argList::validArgs.append("cellSet");
# include "setRootCase.H"
# include "createTime.H"
......@@ -59,6 +60,7 @@ int main(int argc, char *argv[])
pointMesh pMesh(mesh);
word cellSetName(args.args()[1]);
bool overwrite = args.options().found("overwrite");
Info<< "Reading cells to refine from cellSet " << cellSetName
<< nl << endl;
......@@ -110,7 +112,7 @@ int main(int argc, char *argv[])
// Read point fields
PtrList<pointScalarField> psFlds;
ReadFields(pMesh, objects, psFlds);
PtrList<pointVectorField> pvFlds;
ReadFields(pMesh, objects, pvFlds);
......@@ -149,7 +151,10 @@ int main(int argc, char *argv[])
// Play refinement commands into mesh changer.
meshCutter.setRefinement(newCellsToRefine, meshMod);
runTime++;
if (!overwrite)
{
runTime++;
}
// Create mesh, return map from old to new mesh.
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
......
......@@ -50,6 +50,7 @@ int main(int argc, char *argv[])
Foam::argList::validArgs.append("patchName");
Foam::argList::validArgs.append("edgeWeight");
Foam::argList::validOptions.insert("useSet", "cellSet");
Foam::argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
......@@ -57,7 +58,8 @@ int main(int argc, char *argv[])
word patchName(args.additionalArgs()[0]);
scalar weight(readScalar(IStringStream(args.additionalArgs()[1])()));
scalar weight(readScalar(IStringStream(args.additionalArgs()[1])()));
bool overwrite = args.options().found("overwrite");
label patchID = mesh.boundaryMesh().findPatchID(patchName);
......@@ -212,7 +214,10 @@ int main(int argc, char *argv[])
// Do all changes
Info<< "Morphing ..." << endl;
runTime++;
if (!overwrite)
{
runTime++;
}
autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(mesh, false);
......
......@@ -48,12 +48,15 @@ using namespace Foam;
int main(int argc, char *argv[])
{
Foam::argList::validOptions.insert("overwrite", "");
Foam::argList::validArgs.append("faceSet");
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
bool overwrite = args.options().found("overwrite");
word setName(args.additionalArgs()[0]);
// Read faces
......@@ -159,7 +162,10 @@ int main(int argc, char *argv[])
// Update numbering of cells/vertices.
faceRemover.updateMesh(morphMap);
runTime++;
if (!overwrite)
{
runTime++;
}
// Take over refinement levels and write to new time directory.
Pout<< "Writing mesh to time " << runTime.timeName() << endl;
......
......@@ -527,6 +527,7 @@ int main(int argc, char *argv[])
argList::validOptions.insert("set", "cellSet name");
argList::validOptions.insert("geometry", "");
argList::validOptions.insert("tol", "edge snap tolerance");
argList::validOptions.insert("overwrite", "");
argList::validArgs.append("edge angle [0..360]");
# include "setRootCase.H"
......@@ -541,6 +542,7 @@ int main(int argc, char *argv[])
bool readSet = args.options().found("set");
bool geometry = args.options().found("geometry");
bool overwrite = args.options().found("overwrite");
scalar edgeTol = 0.2;
......@@ -574,7 +576,7 @@ int main(int argc, char *argv[])
// Cell circumference cutter
geomCellLooper cellCutter(mesh);
// Snap all edge cuts close to endpoints to vertices.
geomCellLooper::setSnapTol(edgeTol);
geomCellLooper::setSnapTol(edgeTol);
// Candidate cells to cut
cellSet cellsToCut(mesh, "cellsToCut", mesh.nCells()/100);
......@@ -612,7 +614,7 @@ int main(int argc, char *argv[])
minCos,
minSin,
cellsToCut,
cutCells,
cellLoops,
cellEdgeWeights
......@@ -669,7 +671,10 @@ int main(int argc, char *argv[])
// Do all changes
Info<< "Morphing ..." << endl;
runTime++;
if (!overwrite)
{
runTime++;
}
autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(mesh, false);
......
......@@ -89,11 +89,13 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::validArgs.append("Neutral file");
argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
fileName neuFile(args.additionalArgs()[0]);
bool overwrite = args.options().found("overwrite");
IFstream str(neuFile);
......@@ -298,7 +300,10 @@ int main(int argc, char *argv[])
}
runTime++;
if (!overwrite)
{
runTime++;
}
polyMesh mesh
(
......@@ -321,7 +326,7 @@ int main(int argc, char *argv[])
Info<< "Writing mesh to " << runTime.constant() << endl << endl;
mesh.write();
Info<< "End\n" << endl;
......
......@@ -43,12 +43,14 @@ int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.append("feature angle[0-180]");
argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
# include "createPolyMesh.H"
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
bool overwrite = args.options().found("overwrite");
scalar minCos = Foam::cos(featureAngle * mathematicalConstant::pi/180.0);
......@@ -58,7 +60,10 @@ int main(int argc, char *argv[])
polyDualMesh dualMesh(mesh, minCos);
runTime++;
if (!overwrite)
{
runTime++;
}
Pout<< "Writing dualMesh to " << runTime.timeName() << endl;
......
......@@ -75,12 +75,14 @@ int main(int argc, char *argv[])
{
argList::validArgs.append("file prefix");
argList::validOptions.insert("noFaceFile", "");
argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
bool readFaceFile = !args.options().found("noFaceFile");
bool overwrite = args.options().found("overwrite");
fileName prefix(args.additionalArgs()[0]);
......@@ -244,7 +246,7 @@ int main(int argc, char *argv[])
<< "Element attributes (third elemenent in .ele header)"
<< " not used" << endl;
}
const cellModel& tet = *(cellModeller::lookup("tet"));
......@@ -438,7 +440,7 @@ int main(int argc, char *argv[])
word defaultFacesType = polyPatch::typeName;
wordList patchPhysicalTypes(nPatches, polyPatch::typeName);
if (readFaceFile)
{
// Sort boundaryFaces by patch using boundaryPatch.
......@@ -464,7 +466,10 @@ int main(int argc, char *argv[])
Info<< endl;
}
runTime++;
if (!overwrite)
{
runTime++;
}
polyMesh mesh
(
......@@ -487,7 +492,7 @@ int main(int argc, char *argv[])
Info<< "Writing mesh to " << runTime.constant() << endl << endl;
mesh.write();
Info<< "End\n" << endl;
......
......@@ -58,11 +58,13 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::validArgs.append("thickness");
argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
# include "createPolyMesh.H"
scalar thickness(readScalar(IStringStream(args.additionalArgs()[0])()));
bool overwrite = args.options().found("overwrite");
// Check that mesh is 2D
......@@ -164,7 +166,7 @@ int main(int argc, char *argv[])
// Insert changes into meshMod
extruder.setRefinement
(
extrudeDir,
extrudeDir,
thickness,
frontPatchI,
meshMod
......@@ -175,7 +177,10 @@ int main(int argc, char *argv[])
mesh.updateMesh(morphMap);
runTime++;
if (!overwrite)
{
runTime++;
}
// Take over refinement levels and write to new time directory.
Pout<< "Writing extruded mesh to time " << runTime.timeName() << nl
......
......@@ -42,12 +42,18 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::noParallel();
# include "setRootCase.H"
argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
# include "createPolyMesh.H"
runTime++;
bool overwrite = args.options().found("overwrite");
if (!overwrite)
{
runTime++;
}
Info<< "Time = " << runTime.timeName() << nl
<< "Attaching sliding interface" << endl;
......
......@@ -71,6 +71,7 @@ int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.append("feature angle[0-180]");
argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
......@@ -88,6 +89,7 @@ int main(int argc, char *argv[])
boundaryMesh bMesh;
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
bool overwrite = args.options().found("overwrite");
scalar minCos = Foam::cos(featureAngle * mathematicalConstant::pi/180.0);
......@@ -106,7 +108,7 @@ int main(int argc, char *argv[])
collectFeatureEdges(bMesh, markedEdges);
// (new) patch ID for every face in mesh.
labelList patchIDs(bMesh.mesh().size(), -1);
......@@ -209,15 +211,18 @@ int main(int argc, char *argv[])
newPatchI,
mesh.boundaryMesh()
).ptr();
newPatchI++;
}
runTime++;
if (!overwrite)
{
runTime++;
}
// Change patches
repatchPolyTopoChanger polyMeshRepatcher(mesh);
repatchPolyTopoChanger polyMeshRepatcher(mesh);
polyMeshRepatcher.changePatches(newPatchPtrList);
......
......@@ -54,6 +54,7 @@ int main(int argc, char *argv[])
{
argList::validArgs.append("set");
argList::validArgs.append("patch");
argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
......@@ -81,6 +82,8 @@ int main(int argc, char *argv[])
<< "Cannot find patch " << patchName << exit(FatalError);
}
bool overwrite = args.options().found("overwrite");
// Read objects in time directory
IOobjectList objects(mesh, runTime.timeName());
......@@ -226,7 +229,10 @@ int main(int argc, char *argv[])
Pout<< "Converted locally " << nBaffled
<< " faces into boundary faces on patch " << patchName << nl << endl;
runTime++;
if (!overwrite)
{
runTime++;
}
// Change the mesh. Change points directly (no inflation).
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
......
......@@ -154,11 +154,13 @@ void filterPatches(polyMesh& mesh)
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
# include "createPolyMesh.H"
bool overwrite = args.options().found("overwrite");
Info<< "Reading createPatchDict\n" << endl;
......@@ -355,7 +357,10 @@ int main(int argc, char *argv[])
// Set the precision of the points data to 10
IOstream::defaultPrecision(10);
runTime++;
if (!overwrite)
{
runTime++;
}
// Write resulting mesh
Info<< "Writing repatched mesh to " << runTime.timeName() << endl;
......
......@@ -251,11 +251,13 @@ labelList getAllNonManifoldPoints
int main(int argc, char *argv[])
{
argList::validOptions.insert("split", "");
argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
bool split = args.options().found("split");
bool overwrite = args.options().found("overwrite");
// Collect all boundary faces
labelList boundaryFaces(mesh.nFaces() - mesh.nInternalFaces());
......@@ -402,7 +404,10 @@ int main(int argc, char *argv[])
insertDuplicateMerge(mesh, duplicates, meshMod);
}
runTime++;
if (!overwrite)
{
runTime++;
}
// Change the mesh. No inflation.
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
......
......@@ -294,6 +294,7 @@ label twoDNess(const polyMesh& mesh)
int main(int argc, char *argv[])
{
Foam::argList::validOptions.insert("dict", "");
Foam::argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
......@@ -307,6 +308,7 @@ int main(int argc, char *argv[])
//
bool readDict = args.options().found("dict");
bool overwrite = args.options().found("overwrite");
// List of cells to refine
labelList refCells;
......@@ -413,7 +415,10 @@ int main(int argc, char *argv[])
string oldTimeName(runTime.timeName());
runTime++;
if (!overwrite)
{
runTime++;
}