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)
{
Pout<< "Preserving global face zone " << fzNames[nameI]
<< endl; << 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();
if (debug)
{
Pout<< "Dump mesh " << fvmId << endl; 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
if (debug)
{
Pout<< "Dump mesh " << procI Pout<< "Dump mesh " << procI
<< " cell offset: " << cellOffset[procI] << " cell offset: " << cellOffset[procI]
<< endl; << 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
if (!Pstream::parRun())
{
Info<< "Global mesh size (final): " << nl Info<< "Global mesh size (final): " << nl
<< " nPoints = " << reconPoints.size() << nl << " nPoints = " << reconPoints.size() << nl
<< " nFaces = " << reconFaces.size() << nl << " nFaces = " << reconFaces.size() << nl
<< " nCells = " << nReconCells << nl << " nCells = " << nReconCells << nl
<< " nPatches = " << reconPatchSizes.size() << nl << " nPatches = " << reconPatchSizes.size() << nl
<< " nPatchFaces = " << reconPatchSizes << endl; << " 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);
if (debug)
{
Info<< "Migrated cells per processor: " << migratedCells << endl; 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,6 +562,8 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
} }
} }
if (debug)
{
forAll (procMeshes, procI) forAll (procMeshes, procI)
{ {
if (procMeshes.set(procI)) if (procMeshes.set(procI))
@ -571,12 +577,15 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
<< endl; << endl;
} }
} }
}
// Create the reconstructed mesh // Create the reconstructed mesh
autoPtr<fvMesh> reconstructedMeshPtr = autoPtr<fvMesh> reconstructedMeshPtr =
meshRecon.reconstructMesh(dummyTime); meshRecon.reconstructMesh(dummyTime);
fvMesh& reconMesh = reconstructedMeshPtr(); fvMesh& reconMesh = reconstructedMeshPtr();
if (debug)
{
Pout<< "Reconstructed mesh stats: " Pout<< "Reconstructed mesh stats: "
<< " nCells: " << reconMesh.nCells() << " nCells: " << reconMesh.nCells()
<< " nFaces: " << reconMesh.nFaces() << " nFaces: " << reconMesh.nFaces()
@ -586,6 +595,7 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
<< " patches: " << " patches: "
<< reconMesh.boundary().size() << reconMesh.boundary().size()
<< endl; << 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];
if (debug)
{
Pout<< "Rebuilding field " << masterField.name() << endl; 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;
@ -265,12 +268,16 @@ void Foam::topoChangerFvMesh::rebuildFields
masterField.size() masterField.size()
!= GeoField::GeoMeshType::size(masterField.mesh()) != GeoField::GeoMeshType::size(masterField.mesh())
) )
{
if (debug)
{ {
Pout<< "Resizing internal field: old size = " Pout<< "Resizing internal field: old size = "
<< masterField.size() << masterField.size()
<< " new size = " << " new size = "
<< GeoField::GeoMeshType::size(masterField.mesh()) << GeoField::GeoMeshType::size(masterField.mesh())
<< endl; << endl;
}
masterField.setSize masterField.setSize
( (
GeoField::GeoMeshType::size(masterField.mesh()) GeoField::GeoMeshType::size(masterField.mesh())
@ -282,10 +289,13 @@ void Foam::topoChangerFvMesh::rebuildFields
masterField.boundaryFieldNoStoreOldTimes(); masterField.boundaryFieldNoStoreOldTimes();
if (patchFields.size() != masterField.mesh().boundary().size()) if (patchFields.size() != masterField.mesh().boundary().size())
{
if (debug)
{ {
Pout<< "Resizing boundary field: " 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
if (debug)
{
Pout<< "Inserting constrained patch field for patch " Pout<< "Inserting constrained patch field for patch "
<< masterField.mesh().boundary()[patchI].name() << masterField.mesh().boundary()[patchI].name()
<< endl; << endl;
}
patchFields.set patchFields.set
( (
@ -325,12 +338,15 @@ void Foam::topoChangerFvMesh::rebuildFields
) )
{ {
// Resize patch field // Resize patch field
if (debug)
{
Pout<< "Resizing patch field for patch " Pout<< "Resizing patch field for patch "
<< masterField.mesh().boundary()[patchI].name() << masterField.mesh().boundary()[patchI].name()
<< " old size: " << patchFields[patchI].size() << " old size: " << patchFields[patchI].size()
<< " new size: " << " new size: "
<< masterField.mesh().boundary()[patchI].size() << masterField.mesh().boundary()[patchI].size()
<< endl; << endl;
}
// Reset patch field size // Reset patch field size
patchFields[patchI].autoMap patchFields[patchI].autoMap
@ -349,8 +365,12 @@ void Foam::topoChangerFvMesh::rebuildFields
// Increment field counter // Increment field counter
fieldI++; fieldI++;
if (debug)
{
Pout<< "... done" << endl; 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
// faces. The values on these faces could be initialised by interpolation. // faces. The values on these faces could be initialised by interpolation.