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); globalToMasterPatch.setSize(surfaces.nRegions(), -1);
globalToSlavePatch.setSize(surfaces.nRegions(), -1); globalToSlavePatch.setSize(surfaces.nRegions(), -1);
if (!dryRun)
{
Info<< setf(ios_base::left) Info<< setf(ios_base::left)
<< setw(6) << "Patch" << setw(6) << "Patch"
<< setw(20) << "Type" << setw(20) << "Type"
@ -1369,6 +1371,7 @@ int main(int argc, char *argv[])
<< setw(6) << "-----" << setw(6) << "-----"
<< setw(20) << "----" << setw(20) << "----"
<< setw(30) << "------" << endl; << 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];
if (!dryRun)
{
Info<< surfaces.names()[surfi] << ':' << nl << nl; 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[])
); );
} }
if (!dryRun)
{
Info<< setf(ios_base::left) Info<< setf(ios_base::left)
<< setw(6) << patchi << setw(6) << patchi
<< setw(20) << pbm[patchi].type() << setw(20) << pbm[patchi].type()
<< setw(30) << regNames[i] << nl; << 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[])
); );
} }
if (!dryRun)
{
Info<< setf(ios_base::left) Info<< setf(ios_base::left)
<< setw(6) << patchi << setw(6) << patchi
<< setw(20) << pbm[patchi].type() << setw(20) << pbm[patchi].type()
<< setw(30) << regNames[i] << nl; << setw(30) << regNames[i] << nl;
}
globalToMasterPatch[globalRegioni] = patchi; globalToMasterPatch[globalRegioni] = patchi;
} }
@ -1485,10 +1497,13 @@ int main(int argc, char *argv[])
); );
} }
if (!dryRun)
{
Info<< setf(ios_base::left) Info<< setf(ios_base::left)
<< setw(6) << patchi << setw(6) << patchi
<< setw(20) << pbm[patchi].type() << setw(20) << pbm[patchi].type()
<< setw(30) << slaveName << nl; << setw(30) << slaveName << nl;
}
globalToSlavePatch[globalRegioni] = patchi; globalToSlavePatch[globalRegioni] = patchi;
} }
@ -1510,8 +1525,11 @@ int main(int argc, char *argv[])
} }
} }
if (!dryRun)
{
Info<< nl; 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,11 +285,14 @@ void Foam::meshRefinement::updateIntersections(const labelList& changedFaces)
} }
reduce(nChangedFaces, sumOp<label>()); reduce(nChangedFaces, sumOp<label>());
if (!dryRun_)
{
Info<< "Edge intersection testing:" << nl Info<< "Edge intersection testing:" << nl
<< " Number of edges : " << nMasterFaces << nl << " Number of edges : " << nMasterFaces << nl
<< " Number of edges to retest : " << nChangedFaces << " Number of edges to retest : " << nChangedFaces
<< endl; << endl;
} }
}
// Get boundary face centre and level. Coupled aware. // Get boundary face centre and level. Coupled aware.
@ -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>());
if (!dryRun_)
{
Info<< " Number of intersected edges : " << nTotHits << endl; 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
); );
if (!dryRun_)
{
Info<< "Read extendedFeatureEdgeMesh " << extFeatObj.name() Info<< "Read extendedFeatureEdgeMesh " << extFeatObj.name()
<< nl << incrIndent; << nl << incrIndent;
eMeshPtr().writeStats(Info); eMeshPtr().writeStats(Info);
Info<< decrIndent << endl; 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();
if (!dryRun_)
{
Info<< "Read edgeMesh " << featObj.name() << nl Info<< "Read edgeMesh " << featObj.name() << nl
<< incrIndent; << incrIndent;
eMesh.writeStats(Info); eMesh.writeStats(Info);
Info<< decrIndent << endl; 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,6 +264,8 @@ void Foam::refinementFeatures::read
distances_[featI] = scalarField(1, Zero); distances_[featI] = scalarField(1, Zero);
} }
if (!dryRun_)
{
Info<< "Refinement level according to distance to " Info<< "Refinement level according to distance to "
<< featFileName << " (" << eMesh.points().size() << " points, " << featFileName << " (" << eMesh.points().size() << " points, "
<< eMesh.edges().size() << " edges)." << endl; << eMesh.edges().size() << " edges)." << endl;
@ -271,6 +277,7 @@ void Foam::refinementFeatures::read
} }
} }
} }
}
void Foam::refinementFeatures::buildTrees(const label featI) 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() Info<< "For geometry " << geom.name()
<< " detected " << returnReduce(nUncached, sumOp<label>()) << " detected "
<< returnReduce(nUncached, sumOp<label>())
<< " uncached triangles out of " << geom.globalSize() << " uncached triangles out of " << geom.globalSize()
<< endl; << endl;
} }
}
// Combine overall level field with current shell level. Make sure // 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 (modes_[shellI] == DISTANCE)
{
if (!dryRun_)
{ {
Info<< "Refinement level according to distance to " Info<< "Refinement level according to distance to "
<< shell.name() << endl; << shell.name() << endl;
@ -118,6 +120,7 @@ void Foam::shellSurfaces::setAndCheckLevels
<< " metre." << endl; << " metre." << endl;
} }
} }
}
else else
{ {
if (!shell.hasVolumeType()) if (!shell.hasVolumeType())
@ -130,6 +133,8 @@ void Foam::shellSurfaces::setAndCheckLevels
<< exit(FatalError); << exit(FatalError);
} }
if (!dryRun_)
{
if (modes_[shellI] == INSIDE) if (modes_[shellI] == INSIDE)
{ {
Info<< "Refinement level " << levels_[shellI][0] Info<< "Refinement level " << levels_[shellI][0]
@ -142,6 +147,7 @@ void Foam::shellSurfaces::setAndCheckLevels
} }
} }
} }
}
void Foam::shellSurfaces::checkGapLevels void Foam::shellSurfaces::checkGapLevels
@ -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()
@ -653,15 +659,21 @@ Foam::shellSurfaces::shellSurfaces
is.readEnd("levelIncrement"); is.readEnd("levelIncrement");
if (modes_[shellI] == INSIDE) if (modes_[shellI] == INSIDE)
{
if (!dryRun_)
{ {
Info<< "Additional directional refinement level" Info<< "Additional directional refinement level"
<< " for all cells inside " << geomName << endl; << " for all cells inside " << geomName << endl;
} }
}
else if (modes_[shellI] == OUTSIDE) else if (modes_[shellI] == OUTSIDE)
{
if (!dryRun_)
{ {
Info<< "Additional directional refinement level" Info<< "Additional directional refinement level"
<< " for all cells outside " << geomName << endl; << " for all cells outside " << geomName << endl;
} }
}
else else
{ {
FatalIOErrorInFunction(shellsDict) FatalIOErrorInFunction(shellsDict)

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();