Wrapped DLB output around if (debug)

This commit is contained in:
Vuko Vukcevic 2019-02-20 12:06:25 +01:00
parent 7f08269ab2
commit 0efa19e651
7 changed files with 130 additions and 53 deletions

View file

@ -123,7 +123,10 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
// Distribute the cells according to the given processor label
// Calculate the addressing information for the original mesh
Info<< "\nCalculating original mesh data" << endl;
if (debug)
{
Pout<< "\nCalculating original mesh data" << endl;
}
// Set references to the original mesh
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
@ -136,7 +139,10 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
// loop through the list of processor labels for the cell and add the
// cell shape to the list of cells for the appropriate processor
Info<< "\nDistributing cells to processors" << endl;
if (debug)
{
Pout<< "\nDistributing cells to processors" << endl;
}
// Memory management
{
@ -164,7 +170,10 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
}
}
Info << "\nDistributing faces to processors" << endl;
if (debug)
{
Pout << "\nDistributing faces to processors" << endl;
}
// Loop through internal faces and decide which processor they belong to
// First visit all internal faces. If cells at both sides belong to the
@ -753,8 +762,11 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
<< exit(FatalError);
}
Info<< "Preserving global face zone " << fzNames[nameI]
<< endl;
if (debug)
{
Pout<< "Preserving global face zone " << fzNames[nameI]
<< endl;
}
const faceZone& curFz = fz[zoneID];
@ -953,7 +965,10 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
} // End for all processors
} // End of memory management
Info << "\nCalculating processor boundary addressing" << endl;
if (debug)
{
Pout << "\nCalculating processor boundary addressing" << endl;
}
// For every patch of processor boundary, find the index of the original
// patch. Mis-alignment is caused by the fact that patches with zero size
@ -1023,7 +1038,10 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
curBoundaryAddressing.setSize(nPatches);
}
Info << "\nDistributing points to processors" << endl;
if (debug)
{
Pout << "\nDistributing points to processors" << endl;
}
// For every processor, loop through the list of faces for the processor.
// For every face, loop through the list of points and mark the point as

View file

@ -163,6 +163,7 @@ public:
// Declare name of the class and its debug switch
ClassName("domainDecomposition");
// Constructors
//- Construct from mesh and dictionary

View file

@ -805,7 +805,11 @@ Foam::processorMeshesReconstructor::reconstructMesh(const Time& db)
// Dump first valid mesh without checking
{
const label fvmId = firstValidMesh();
Pout<< "Dump mesh " << fvmId << endl;
if (debug)
{
Pout<< "Dump mesh " << fvmId << endl;
}
cellOffset[fvmId] = 0;
@ -1060,9 +1064,12 @@ Foam::processorMeshesReconstructor::reconstructMesh(const Time& db)
else
{
// Valid mesh, combine it
Pout<< "Dump mesh " << procI
<< " cell offset: " << cellOffset[procI]
<< endl;
if (debug)
{
Pout<< "Dump mesh " << procI
<< " cell offset: " << cellOffset[procI]
<< endl;
}
const polyMesh& curMesh = meshes_[procI];
const polyBoundaryMesh& procPatches = curMesh.boundaryMesh();
@ -1542,12 +1549,24 @@ Foam::processorMeshesReconstructor::reconstructMesh(const Time& db)
// Mesh assembly completed
Info<< "Global mesh size (final): " << nl
<< " nPoints = " << reconPoints.size() << nl
<< " nFaces = " << reconFaces.size() << nl
<< " nCells = " << nReconCells << nl
<< " nPatches = " << reconPatchSizes.size() << nl
<< " nPatchFaces = " << reconPatchSizes << endl;
if (!Pstream::parRun())
{
Info<< "Global mesh size (final): " << nl
<< " nPoints = " << reconPoints.size() << nl
<< " nFaces = " << reconFaces.size() << nl
<< " nCells = " << nReconCells << nl
<< " nPatches = " << reconPatchSizes.size() << nl
<< " nPatchFaces = " << reconPatchSizes << endl;
}
else if (debug)
{
Pout<< "Local mesh size (final): " << nl
<< " nPoints = " << reconPoints.size() << nl
<< " nFaces = " << reconFaces.size() << nl
<< " nCells = " << nReconCells << nl
<< " nPatches = " << reconPatchSizes.size() << nl
<< " nPatchFaces = " << reconPatchSizes << endl;
}
// Renumber the face-processor addressing list for all pieces
// now that the number of internal faces is known

View file

@ -25,6 +25,11 @@ License
#include "processorMeshesReconstructor.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::processorMeshesReconstructor, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::processorMeshesReconstructor::readMeshes(PtrList<Time>& databases)

View file

@ -122,6 +122,10 @@ class processorMeshesReconstructor
public:
//- Declare name of the class and its debug switch
ClassName("processorMeshesReconstructor");
// Constructors
//- Construct given name. Set meshes later

View file

@ -105,7 +105,11 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
// Now that each processor has filled in its own part, combine the data
Pstream::gatherList(migratedCells);
Pstream::scatterList(migratedCells);
Info<< "Migrated cells per processor: " << migratedCells << endl;
if (debug)
{
Info<< "Migrated cells per processor: " << migratedCells << endl;
}
// Reading through second index now tells how many cells will arrive
// from which processor
@ -558,17 +562,20 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
}
}
forAll (procMeshes, procI)
if (debug)
{
if (procMeshes.set(procI))
forAll (procMeshes, procI)
{
Pout<< "procMesh " << procI
<< " points " << procMeshes[procI].nPoints()
<< " faces: " << procMeshes[procI].nFaces()
<< " internal: " << procMeshes[procI].nInternalFaces()
<< " cells: " << procMeshes[procI].nCells()
<< " patches: " << procMeshes[procI].boundary().size()
<< endl;
if (procMeshes.set(procI))
{
Pout<< "procMesh " << procI
<< " points " << procMeshes[procI].nPoints()
<< " faces: " << procMeshes[procI].nFaces()
<< " internal: " << procMeshes[procI].nInternalFaces()
<< " cells: " << procMeshes[procI].nCells()
<< " patches: " << procMeshes[procI].boundary().size()
<< endl;
}
}
}
@ -577,15 +584,18 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
meshRecon.reconstructMesh(dummyTime);
fvMesh& reconMesh = reconstructedMeshPtr();
Pout<< "Reconstructed mesh stats: "
<< " nCells: " << reconMesh.nCells()
<< " nFaces: " << reconMesh.nFaces()
<< " nIntFaces: " << reconMesh.nInternalFaces()
<< " polyPatches: "
<< reconMesh.boundaryMesh().size()
<< " patches: "
<< reconMesh.boundary().size()
<< endl;
if (debug)
{
Pout<< "Reconstructed mesh stats: "
<< " nCells: " << reconMesh.nCells()
<< " nFaces: " << reconMesh.nFaces()
<< " nIntFaces: " << reconMesh.nInternalFaces()
<< " polyPatches: "
<< reconMesh.boundaryMesh().size()
<< " patches: "
<< reconMesh.boundary().size()
<< endl;
}
// Apply changes to the local mesh:
// - refactor the boundary to match new patches. Note: processor

View file

@ -180,7 +180,10 @@ void Foam::topoChangerFvMesh::rebuildFields
const PtrList<GeoField>& partFields = receivedFields[fieldI];
Pout<< "Rebuilding field " << masterField.name() << endl;
if (debug)
{
Pout<< "Rebuilding field " << masterField.name() << endl;
}
// Check name match. Note: there may be holes
word partName;
@ -266,11 +269,15 @@ void Foam::topoChangerFvMesh::rebuildFields
!= GeoField::GeoMeshType::size(masterField.mesh())
)
{
Pout<< "Resizing internal field: old size = "
<< masterField.size()
<< " new size = "
<< GeoField::GeoMeshType::size(masterField.mesh())
<< endl;
if (debug)
{
Pout<< "Resizing internal field: old size = "
<< masterField.size()
<< " new size = "
<< GeoField::GeoMeshType::size(masterField.mesh())
<< endl;
}
masterField.setSize
(
GeoField::GeoMeshType::size(masterField.mesh())
@ -283,9 +290,12 @@ void Foam::topoChangerFvMesh::rebuildFields
if (patchFields.size() != masterField.mesh().boundary().size())
{
Pout<< "Resizing boundary field: "
if (debug)
{
Pout<< "Resizing boundary field: "
<< masterField.mesh().boundary().size()
<< endl;
}
patchFields.setSize(masterField.mesh().boundary().size());
}
@ -296,9 +306,12 @@ void Foam::topoChangerFvMesh::rebuildFields
if (meshMap.resetPatchFlag()[patchI])
{
// Create a new constrained patch field
Pout<< "Inserting constrained patch field for patch "
<< masterField.mesh().boundary()[patchI].name()
<< endl;
if (debug)
{
Pout<< "Inserting constrained patch field for patch "
<< masterField.mesh().boundary()[patchI].name()
<< endl;
}
patchFields.set
(
@ -325,12 +338,15 @@ void Foam::topoChangerFvMesh::rebuildFields
)
{
// Resize patch field
Pout<< "Resizing patch field for patch "
<< masterField.mesh().boundary()[patchI].name()
<< " old size: " << patchFields[patchI].size()
<< " new size: "
<< masterField.mesh().boundary()[patchI].size()
<< endl;
if (debug)
{
Pout<< "Resizing patch field for patch "
<< masterField.mesh().boundary()[patchI].name()
<< " old size: " << patchFields[patchI].size()
<< " new size: "
<< masterField.mesh().boundary()[patchI].size()
<< endl;
}
// Reset patch field size
patchFields[patchI].autoMap
@ -349,7 +365,11 @@ void Foam::topoChangerFvMesh::rebuildFields
// Increment field counter
fieldI++;
Pout<< "... done" << endl;
if (debug)
{
Pout<< "... done" << endl;
}
}
// HR 14.12.18: We create new processor boundary faces from internal