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

View File

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

View File

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

View File

@ -703,10 +703,14 @@ void Foam::refinementSurfaces::setMinLevelFields(const shellSurfaces& shells)
} }
} }
Info<< "For geometry " << geom.name() if (!dryRun_)
<< " detected " << returnReduce(nUncached, sumOp<label>()) {
<< " uncached triangles out of " << geom.globalSize() Info<< "For geometry " << geom.name()
<< endl; << " detected "
<< returnReduce(nUncached, sumOp<label>())
<< " uncached triangles out of " << geom.globalSize()
<< endl;
}
} }

View File

@ -109,13 +109,16 @@ void Foam::shellSurfaces::setAndCheckLevels
if (modes_[shellI] == DISTANCE) if (modes_[shellI] == DISTANCE)
{ {
Info<< "Refinement level according to distance to " if (!dryRun_)
<< shell.name() << endl;
forAll(levels_[shellI], j)
{ {
Info<< " level " << levels_[shellI][j] Info<< "Refinement level according to distance to "
<< " for all cells within " << distances_[shellI][j] << shell.name() << endl;
<< " metre." << endl; forAll(levels_[shellI], j)
{
Info<< " level " << levels_[shellI][j]
<< " for all cells within " << distances_[shellI][j]
<< " metre." << endl;
}
} }
} }
else else
@ -130,15 +133,18 @@ void Foam::shellSurfaces::setAndCheckLevels
<< exit(FatalError); << exit(FatalError);
} }
if (modes_[shellI] == INSIDE) if (!dryRun_)
{ {
Info<< "Refinement level " << levels_[shellI][0] if (modes_[shellI] == INSIDE)
<< " for all cells inside " << shell.name() << endl; {
} Info<< "Refinement level " << levels_[shellI][0]
else << " for all cells inside " << shell.name() << endl;
{ }
Info<< "Refinement level " << levels_[shellI][0] else
<< " for all cells outside " << shell.name() << endl; {
Info<< "Refinement level " << levels_[shellI][0]
<< " for all cells outside " << shell.name() << endl;
}
} }
} }
} }
@ -233,7 +239,7 @@ void Foam::shellSurfaces::orient()
true true
); );
if (anyFlipped) if (anyFlipped && !dryRun_)
{ {
// orientedSurface will have done a clearOut of the surface. // orientedSurface will have done a clearOut of the surface.
// we could do a clearout of the triSurfaceMeshes::trees() // we could do a clearout of the triSurfaceMeshes::trees()
@ -654,13 +660,19 @@ Foam::shellSurfaces::shellSurfaces
if (modes_[shellI] == INSIDE) if (modes_[shellI] == INSIDE)
{ {
Info<< "Additional directional refinement level" if (!dryRun_)
<< " for all cells inside " << geomName << endl; {
Info<< "Additional directional refinement level"
<< " for all cells inside " << geomName << endl;
}
} }
else if (modes_[shellI] == OUTSIDE) else if (modes_[shellI] == OUTSIDE)
{ {
Info<< "Additional directional refinement level" if (!dryRun_)
<< " for all cells outside " << geomName << endl; {
Info<< "Additional directional refinement level"
<< " for all cells outside " << geomName << endl;
}
} }
else else
{ {

View File

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

View File

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