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 // Distribute the cells according to the given processor label
// Calculate the addressing information for the original mesh // 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 // Set references to the original mesh
const polyBoundaryMesh& patches = mesh_.boundaryMesh(); 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 // loop through the list of processor labels for the cell and add the
// cell shape to the list of cells for the appropriate processor // 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 // 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 // Loop through internal faces and decide which processor they belong to
// First visit all internal faces. If cells at both sides belong to the // 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); << exit(FatalError);
} }
Info<< "Preserving global face zone " << fzNames[nameI] if (debug)
<< endl; {
Pout<< "Preserving global face zone " << fzNames[nameI]
<< endl;
}
const faceZone& curFz = fz[zoneID]; const faceZone& curFz = fz[zoneID];
@ -953,7 +965,10 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
} // End for all processors } // End for all processors
} // End of memory management } // 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 // 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 // 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); 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 processor, loop through the list of faces for the processor.
// For every face, loop through the list of points and mark the point as // 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 // Declare name of the class and its debug switch
ClassName("domainDecomposition"); ClassName("domainDecomposition");
// Constructors // Constructors
//- Construct from mesh and dictionary //- Construct from mesh and dictionary

View file

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

View file

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

View file

@ -122,6 +122,10 @@ class processorMeshesReconstructor
public: public:
//- Declare name of the class and its debug switch
ClassName("processorMeshesReconstructor");
// Constructors // Constructors
//- Construct given name. Set meshes later //- 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 // Now that each processor has filled in its own part, combine the data
Pstream::gatherList(migratedCells); Pstream::gatherList(migratedCells);
Pstream::scatterList(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 // Reading through second index now tells how many cells will arrive
// from which processor // 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 if (procMeshes.set(procI))
<< " points " << procMeshes[procI].nPoints() {
<< " faces: " << procMeshes[procI].nFaces() Pout<< "procMesh " << procI
<< " internal: " << procMeshes[procI].nInternalFaces() << " points " << procMeshes[procI].nPoints()
<< " cells: " << procMeshes[procI].nCells() << " faces: " << procMeshes[procI].nFaces()
<< " patches: " << procMeshes[procI].boundary().size() << " internal: " << procMeshes[procI].nInternalFaces()
<< endl; << " cells: " << procMeshes[procI].nCells()
<< " patches: " << procMeshes[procI].boundary().size()
<< endl;
}
} }
} }
@ -577,15 +584,18 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
meshRecon.reconstructMesh(dummyTime); meshRecon.reconstructMesh(dummyTime);
fvMesh& reconMesh = reconstructedMeshPtr(); fvMesh& reconMesh = reconstructedMeshPtr();
Pout<< "Reconstructed mesh stats: " if (debug)
<< " nCells: " << reconMesh.nCells() {
<< " nFaces: " << reconMesh.nFaces() Pout<< "Reconstructed mesh stats: "
<< " nIntFaces: " << reconMesh.nInternalFaces() << " nCells: " << reconMesh.nCells()
<< " polyPatches: " << " nFaces: " << reconMesh.nFaces()
<< reconMesh.boundaryMesh().size() << " nIntFaces: " << reconMesh.nInternalFaces()
<< " patches: " << " polyPatches: "
<< reconMesh.boundary().size() << reconMesh.boundaryMesh().size()
<< endl; << " patches: "
<< reconMesh.boundary().size()
<< endl;
}
// Apply changes to the local mesh: // Apply changes to the local mesh:
// - refactor the boundary to match new patches. Note: processor // - 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]; 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 // Check name match. Note: there may be holes
word partName; word partName;
@ -266,11 +269,15 @@ void Foam::topoChangerFvMesh::rebuildFields
!= GeoField::GeoMeshType::size(masterField.mesh()) != GeoField::GeoMeshType::size(masterField.mesh())
) )
{ {
Pout<< "Resizing internal field: old size = " if (debug)
<< masterField.size() {
<< " new size = " Pout<< "Resizing internal field: old size = "
<< GeoField::GeoMeshType::size(masterField.mesh()) << masterField.size()
<< endl; << " new size = "
<< GeoField::GeoMeshType::size(masterField.mesh())
<< endl;
}
masterField.setSize masterField.setSize
( (
GeoField::GeoMeshType::size(masterField.mesh()) GeoField::GeoMeshType::size(masterField.mesh())
@ -283,9 +290,12 @@ void Foam::topoChangerFvMesh::rebuildFields
if (patchFields.size() != masterField.mesh().boundary().size()) if (patchFields.size() != masterField.mesh().boundary().size())
{ {
Pout<< "Resizing boundary field: " if (debug)
{
Pout<< "Resizing boundary field: "
<< masterField.mesh().boundary().size() << masterField.mesh().boundary().size()
<< endl; << endl;
}
patchFields.setSize(masterField.mesh().boundary().size()); patchFields.setSize(masterField.mesh().boundary().size());
} }
@ -296,9 +306,12 @@ void Foam::topoChangerFvMesh::rebuildFields
if (meshMap.resetPatchFlag()[patchI]) if (meshMap.resetPatchFlag()[patchI])
{ {
// Create a new constrained patch field // Create a new constrained patch field
Pout<< "Inserting constrained patch field for patch " if (debug)
<< masterField.mesh().boundary()[patchI].name() {
<< endl; Pout<< "Inserting constrained patch field for patch "
<< masterField.mesh().boundary()[patchI].name()
<< endl;
}
patchFields.set patchFields.set
( (
@ -325,12 +338,15 @@ void Foam::topoChangerFvMesh::rebuildFields
) )
{ {
// Resize patch field // Resize patch field
Pout<< "Resizing patch field for patch " if (debug)
<< masterField.mesh().boundary()[patchI].name() {
<< " old size: " << patchFields[patchI].size() Pout<< "Resizing patch field for patch "
<< " new size: " << masterField.mesh().boundary()[patchI].name()
<< masterField.mesh().boundary()[patchI].size() << " old size: " << patchFields[patchI].size()
<< endl; << " new size: "
<< masterField.mesh().boundary()[patchI].size()
<< endl;
}
// Reset patch field size // Reset patch field size
patchFields[patchI].autoMap patchFields[patchI].autoMap
@ -349,7 +365,11 @@ void Foam::topoChangerFvMesh::rebuildFields
// Increment field counter // Increment field counter
fieldI++; fieldI++;
Pout<< "... done" << endl;
if (debug)
{
Pout<< "... done" << endl;
}
} }
// HR 14.12.18: We create new processor boundary faces from internal // HR 14.12.18: We create new processor boundary faces from internal