Commit 9b0bebec authored by mattijs's avatar mattijs
Browse files

making overwrite work

parent 510a35b8
......@@ -464,6 +464,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
scalar minLen(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar angle(readScalar(IStringStream(args.additionalArgs()[1])()));
......@@ -587,8 +588,12 @@ int main(int argc, char *argv[])
{
runTime++;
}
else
{
mesh.setInstance(oldInstance);
}
Info << "Writing collapsed mesh to time " << runTime.value() << endl;
Info<< "Writing collapsed mesh to time " << runTime.timeName() << endl;
mesh.write();
}
......
......@@ -441,6 +441,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
......@@ -502,6 +503,11 @@ int main(int argc, char *argv[])
if (nChanged > 0)
{
if (overwrite)
{
mesh.setInstance(oldInstance);
}
Info<< "Writing morphed mesh to time " << runTime.timeName() << endl;
mesh.write();
......
......@@ -334,6 +334,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
bool overwrite = args.options().found("overwrite");
......@@ -553,9 +554,13 @@ int main(int argc, char *argv[])
{
runTime++;
}
else
{
mesh.setInstance(oldInstance);
}
// Write resulting mesh
Info << "Writing modified mesh to time " << runTime.value() << endl;
Info << "Writing modified mesh to time " << runTime.timeName() << endl;
mesh.write();
}
else if (edgeToPos.size())
......@@ -602,9 +607,13 @@ int main(int argc, char *argv[])
{
runTime++;
}
else
{
mesh.setInstance(oldInstance);
}
// Write resulting mesh
Info << "Writing modified mesh to time " << runTime.value() << endl;
Info << "Writing modified mesh to time " << runTime.timeName() << endl;
mesh.write();
}
else
......@@ -641,9 +650,13 @@ int main(int argc, char *argv[])
{
runTime++;
}
else
{
mesh.setInstance(oldInstance);
}
// Write resulting mesh
Info << "Writing modified mesh to time " << runTime.value() << endl;
Info << "Writing modified mesh to time " << runTime.timeName() << endl;
mesh.write();
}
......
......@@ -58,6 +58,8 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
# include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
pointMesh pMesh(mesh);
word cellSetName(args.args()[1]);
......@@ -177,6 +179,10 @@ int main(int argc, char *argv[])
Pout<< "Refined from " << returnReduce(map().nOldCells(), sumOp<label>())
<< " to " << mesh.globalData().nTotalCells() << " cells." << nl << endl;
if (overwrite)
{
mesh.setInstance(oldInstance);
}
Info<< "Writing mesh to " << runTime.timeName() << endl;
mesh.write();
......
......@@ -56,6 +56,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
word patchName(args.additionalArgs()[0]);
......@@ -226,8 +227,13 @@ int main(int argc, char *argv[])
// Update stored labels on meshCutter.
cutter.updateMesh(morphMap());
if (overwrite)
{
mesh.setInstance(oldInstance);
}
// Write resulting mesh
Info << "Writing refined morphMesh to time " << runTime.value() << endl;
Info << "Writing refined morphMesh to time " << runTime.timeName() << endl;
mesh.write();
......
......@@ -55,6 +55,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
# include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
bool overwrite = args.options().found("overwrite");
......@@ -167,6 +168,10 @@ int main(int argc, char *argv[])
{
runTime++;
}
else
{
mesh.setInstance(oldInstance);
}
// Take over refinement levels and write to new time directory.
Pout<< "Writing mesh to time " << runTime.timeName() << endl;
......
......@@ -534,6 +534,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
......@@ -693,7 +694,13 @@ int main(int argc, char *argv[])
Info<< "Remaining:" << cellsToCut.size() << endl;
// Write resulting mesh
Info << "Writing refined morphMesh to time " << runTime.value() << endl;
if (overwrite)
{
mesh.setInstance(oldInstance);
}
Info<< "Writing refined morphMesh to time " << runTime.timeName()
<< endl;
mesh.write();
}
......
......@@ -354,6 +354,7 @@ int main(int argc, char *argv[])
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
// Mark boundary edges and points.
// (Note: in 1.4.2 we can use the built-in mesh point ordering
......@@ -499,7 +500,10 @@ int main(int argc, char *argv[])
if (!overwrite)
{
runTime++;
mesh.setInstance(runTime.timeName());
}
else
{
mesh.setInstance(oldInstance);
}
Info<< "Writing dual mesh to " << runTime.timeName() << endl;
......
......@@ -63,6 +63,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
scalar thickness(readScalar(IStringStream(args.additionalArgs()[0])()));
bool overwrite = args.options().found("overwrite");
......@@ -182,6 +183,10 @@ int main(int argc, char *argv[])
{
runTime++;
}
else
{
mesh.setInstance(oldInstance);
}
// Take over refinement levels and write to new time directory.
Pout<< "Writing extruded mesh to time " << runTime.timeName() << nl
......
......@@ -48,6 +48,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
bool overwrite = args.options().found("overwrite");
......@@ -61,6 +62,10 @@ int main(int argc, char *argv[])
attachPolyTopoChanger(mesh).attach();
if (overwrite)
{
mesh.setInstance(oldInstance);
}
mesh.write();
Info<< "End\n" << endl;
......
......@@ -77,6 +77,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
Info<< "Mesh read in = "
<< runTime.cpuTimeIncrement()
......@@ -243,6 +244,10 @@ int main(int argc, char *argv[])
polyMeshRepatcher.repatch();
// Write resulting mesh
if (overwrite)
{
mesh.setInstance(oldInstance);
}
mesh.write();
......
......@@ -74,19 +74,7 @@ int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
Info<< "Reading mesh for time = " << runTime.value() << endl;
Info<< "Create mesh\n" << endl;
polyMesh mesh
(
IOobject
(
polyMesh::defaultRegion,
runTime.timeName(),
runTime
)
);
# include "createPolyMesh.H"
Info<< "Reading cellSetDict\n" << endl;
......
......@@ -60,6 +60,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
# include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
const polyBoundaryMesh& patches = mesh.boundaryMesh();
const faceZoneMesh& faceZones = mesh.faceZones();
......@@ -247,6 +248,10 @@ int main(int argc, char *argv[])
mesh.movePoints(map().preMotionPoints());
}
if (overwrite)
{
mesh.setInstance(oldInstance);
}
Pout<< "Writing mesh to " << runTime.timeName() << endl;
mesh.write();
......
......@@ -569,6 +569,7 @@ int main(int argc, char *argv[])
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
const polyBoundaryMesh& patches = mesh.boundaryMesh();
......@@ -909,6 +910,10 @@ int main(int argc, char *argv[])
{
runTime++;
}
else
{
mesh.setInstance(oldInstance);
}
// Write resulting mesh
Info<< "Writing repatched mesh to " << runTime.timeName() << nl << endl;
......
......@@ -74,19 +74,7 @@ int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
Info<< "Reading mesh for time = " << runTime.value() << endl;
Info<< "Create mesh\n" << endl;
polyMesh mesh
(
IOobject
(
polyMesh::defaultRegion,
runTime.timeName(),
runTime
)
);
# include "createPolyMesh.H"
Info<< "Reading faceSetDict\n" << endl;
......
......@@ -42,7 +42,7 @@ int main(int argc, char *argv[])
# include "setRoots.H"
# include "createTimes.H"
Info<< "Reading master mesh for time = " << runTimeMaster.value() << endl;
Info<< "Reading master mesh for time = " << runTimeMaster.timeName() << endl;
Info<< "Create mesh\n" << endl;
mergePolyMesh masterMesh
......@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
);
Info<< "Reading mesh to add for time = " << runTimeToAdd.value() << endl;
Info<< "Reading mesh to add for time = " << runTimeToAdd.timeName() << endl;
Info<< "Create mesh\n" << endl;
polyMesh meshToAdd
......@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
runTimeMaster++;
Info<< "Writing combined mesh to " << runTimeMaster.value() << endl;
Info<< "Writing combined mesh to " << runTimeMaster.timeName() << endl;
masterMesh.addMesh(meshToAdd);
masterMesh.merge();
......
......@@ -229,6 +229,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
# include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
bool split = args.options().found("split");
bool overwrite = args.options().found("overwrite");
......@@ -338,7 +339,10 @@ int main(int argc, char *argv[])
mesh.movePoints(map().preMotionPoints());
}
if (overwrite)
{
mesh.setInstance(oldInstance);
}
Pout<< "Writing mesh to time " << runTime.timeName() << endl;
mesh.write();
......
......@@ -74,19 +74,7 @@ int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
Info<< "Reading mesh for time = " << runTime.value() << endl;
Info<< "Create mesh\n" << endl;
polyMesh mesh
(
IOobject
(
polyMesh::defaultRegion,
runTime.timeName(),
runTime
)
);
# include "createPolyMesh.H"
Info<< "Reading pointSetDict\n" << endl;
......
......@@ -300,6 +300,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
printEdgeStats(mesh);
......@@ -427,6 +428,10 @@ int main(int argc, char *argv[])
// Write resulting mesh
if (overwrite)
{
mesh.setInstance(oldInstance);
}
mesh.write();
......
......@@ -383,9 +383,8 @@ int main(int argc, char *argv[])
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
const bool blockOrder = args.options().found("blockOrder");
......@@ -631,6 +630,11 @@ int main(int argc, char *argv[])
<< endl;
}
if (overwrite)
{
mesh.setInstance(oldInstance);
}
Info<< "Writing mesh to " << runTime.timeName() << endl;
mesh.write();
......
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