ENH: snappyHexMesh: limit printing in dry-run. See #972.

This commit is contained in:
mattijs
2018-12-24 08:55:42 +00:00
parent 7bf4bcf4ba
commit 10da897275
7 changed files with 125 additions and 67 deletions

View File

@ -1362,6 +1362,8 @@ int main(int argc, char *argv[])
globalToMasterPatch.setSize(surfaces.nRegions(), -1);
globalToSlavePatch.setSize(surfaces.nRegions(), -1);
if (!dryRun)
{
Info<< setf(ios_base::left)
<< setw(6) << "Patch"
<< setw(20) << "Type"
@ -1369,6 +1371,7 @@ int main(int argc, char *argv[])
<< setw(6) << "-----"
<< setw(20) << "----"
<< setw(30) << "------" << endl;
}
const labelList& surfaceGeometry = surfaces.surfaces();
const PtrList<dictionary>& surfacePatchInfo = surfaces.patchInfo();
@ -1380,7 +1383,10 @@ int main(int argc, char *argv[])
const wordList& regNames = allGeometry.regionNames()[geomi];
if (!dryRun)
{
Info<< surfaces.names()[surfi] << ':' << nl << nl;
}
const word& fzName = surfaces.surfZones()[surfi].faceZoneName();
@ -1413,10 +1419,13 @@ int main(int argc, char *argv[])
);
}
if (!dryRun)
{
Info<< setf(ios_base::left)
<< setw(6) << patchi
<< setw(20) << pbm[patchi].type()
<< setw(30) << regNames[i] << nl;
}
globalToMasterPatch[globalRegioni] = patchi;
globalToSlavePatch[globalRegioni] = patchi;
@ -1453,10 +1462,13 @@ int main(int argc, char *argv[])
);
}
if (!dryRun)
{
Info<< setf(ios_base::left)
<< setw(6) << patchi
<< setw(20) << pbm[patchi].type()
<< setw(30) << regNames[i] << nl;
}
globalToMasterPatch[globalRegioni] = patchi;
}
@ -1485,10 +1497,13 @@ int main(int argc, char *argv[])
);
}
if (!dryRun)
{
Info<< setf(ios_base::left)
<< setw(6) << patchi
<< setw(20) << pbm[patchi].type()
<< setw(30) << slaveName << nl;
}
globalToSlavePatch[globalRegioni] = patchi;
}
@ -1510,8 +1525,11 @@ int main(int argc, char *argv[])
}
}
if (!dryRun)
{
Info<< nl;
}
}
Info<< "Added patches in = "
<< mesh.time().cpuTimeIncrement() << " s" << nl << endl;
}

View File

@ -285,11 +285,14 @@ void Foam::meshRefinement::updateIntersections(const labelList& changedFaces)
}
reduce(nChangedFaces, sumOp<label>());
if (!dryRun_)
{
Info<< "Edge intersection testing:" << nl
<< " Number of edges : " << nMasterFaces << nl
<< " Number of edges to retest : " << nChangedFaces
<< endl;
}
}
// Get boundary face centre and level. Coupled aware.
@ -342,7 +345,11 @@ void Foam::meshRefinement::updateIntersections(const labelList& changedFaces)
label nHits = countHits();
label nTotHits = returnReduce(nHits, sumOp<label>());
if (!dryRun_)
{
Info<< " Number of intersected edges : " << nTotHits << endl;
}
// Set files to same time as mesh
setInstance(mesh_.facesInstance());

View File

@ -77,10 +77,13 @@ void Foam::refinementFeatures::read
fName
);
if (!dryRun_)
{
Info<< "Read extendedFeatureEdgeMesh " << extFeatObj.name()
<< nl << incrIndent;
eMeshPtr().writeStats(Info);
Info<< decrIndent << endl;
}
set(featI, new extendedFeatureEdgeMesh(extFeatObj, eMeshPtr()));
}
@ -108,16 +111,17 @@ void Foam::refinementFeatures::read
<< exit(FatalIOError);
}
// Read as edgeMesh
autoPtr<edgeMesh> eMeshPtr = edgeMesh::New(fName);
const edgeMesh& eMesh = eMeshPtr();
if (!dryRun_)
{
Info<< "Read edgeMesh " << featObj.name() << nl
<< incrIndent;
eMesh.writeStats(Info);
Info<< decrIndent << endl;
}
// Analyse for feature points. These are all classified as mixed
// points for lack of anything better
@ -260,6 +264,8 @@ void Foam::refinementFeatures::read
distances_[featI] = scalarField(1, Zero);
}
if (!dryRun_)
{
Info<< "Refinement level according to distance to "
<< featFileName << " (" << eMesh.points().size() << " points, "
<< eMesh.edges().size() << " edges)." << endl;
@ -271,6 +277,7 @@ void Foam::refinementFeatures::read
}
}
}
}
void Foam::refinementFeatures::buildTrees(const label featI)

View File

@ -703,11 +703,15 @@ void Foam::refinementSurfaces::setMinLevelFields(const shellSurfaces& shells)
}
}
if (!dryRun_)
{
Info<< "For geometry " << geom.name()
<< " detected " << returnReduce(nUncached, sumOp<label>())
<< " detected "
<< returnReduce(nUncached, sumOp<label>())
<< " uncached triangles out of " << geom.globalSize()
<< endl;
}
}
// Combine overall level field with current shell level. Make sure

View File

@ -108,6 +108,8 @@ void Foam::shellSurfaces::setAndCheckLevels
}
if (modes_[shellI] == DISTANCE)
{
if (!dryRun_)
{
Info<< "Refinement level according to distance to "
<< shell.name() << endl;
@ -118,6 +120,7 @@ void Foam::shellSurfaces::setAndCheckLevels
<< " metre." << endl;
}
}
}
else
{
if (!shell.hasVolumeType())
@ -130,6 +133,8 @@ void Foam::shellSurfaces::setAndCheckLevels
<< exit(FatalError);
}
if (!dryRun_)
{
if (modes_[shellI] == INSIDE)
{
Info<< "Refinement level " << levels_[shellI][0]
@ -142,6 +147,7 @@ void Foam::shellSurfaces::setAndCheckLevels
}
}
}
}
void Foam::shellSurfaces::checkGapLevels
@ -233,7 +239,7 @@ void Foam::shellSurfaces::orient()
true
);
if (anyFlipped)
if (anyFlipped && !dryRun_)
{
// orientedSurface will have done a clearOut of the surface.
// we could do a clearout of the triSurfaceMeshes::trees()
@ -653,15 +659,21 @@ Foam::shellSurfaces::shellSurfaces
is.readEnd("levelIncrement");
if (modes_[shellI] == INSIDE)
{
if (!dryRun_)
{
Info<< "Additional directional refinement level"
<< " for all cells inside " << geomName << endl;
}
}
else if (modes_[shellI] == OUTSIDE)
{
if (!dryRun_)
{
Info<< "Additional directional refinement level"
<< " for all cells outside " << geomName << endl;
}
}
else
{
FatalIOErrorInFunction(shellsDict)

View File

@ -2095,6 +2095,11 @@ void Foam::snappySnapDriver::smoothDisplacement
motionSmoother& meshMover
) const
{
if (dryRun_)
{
return;
}
const fvMesh& mesh = meshRefiner_.mesh();
const indirectPrimitivePatch& pp = meshMover.patch();

View File

@ -3854,6 +3854,12 @@ Foam::vectorField Foam::snappySnapDriver::calcNearestSurfaceFeature
) const
{
if (dryRun_)
{
return nearestDisp;
}
const Switch implicitFeatureAttraction = snapParams.implicitFeatureSnap();
const Switch explicitFeatureAttraction = snapParams.explicitFeatureSnap();
const Switch multiRegionFeatureSnap = snapParams.multiRegionFeatureSnap();
@ -3864,7 +3870,6 @@ Foam::vectorField Foam::snappySnapDriver::calcNearestSurfaceFeature
<< " multi-patch features : " << multiRegionFeatureSnap << nl
<< endl;
const indirectPrimitivePatch& pp = meshMover.patch();
const pointField& localPoints = pp.localPoints();
const fvMesh& mesh = meshRefiner_.mesh();