Skip to content

Commit 1199477

Browse files
author
DENEL Bertrand
committed
clean
1 parent 3487249 commit 1199477

File tree

10 files changed

+64
-48
lines changed

10 files changed

+64
-48
lines changed

src/coreComponents/mesh/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ set( mesh_headers
104104
mpiCommunications/NoOpEngine.hpp
105105
mpiCommunications/PartitionerManager.hpp
106106
mpiCommunications/DomainPartitioner.hpp
107-
mpiCommunications/MeshPartitioner.hpp
108-
mpiCommunications/CellGraphPartitioner.hpp
109107
mpiCommunications/GeometricPartitioner.hpp
110108
mpiCommunications/CartesianPartitioner.hpp
111109
mpiCommunications/ParticleCartesianPartitioner.hpp
@@ -191,8 +189,6 @@ set( mesh_sources
191189
mpiCommunications/NoOpEngine.cpp
192190
mpiCommunications/PartitionerManager.cpp
193191
mpiCommunications/DomainPartitioner.cpp
194-
mpiCommunications/MeshPartitioner.cpp
195-
mpiCommunications/CellGraphPartitioner.cpp
196192
mpiCommunications/GeometricPartitioner.cpp
197193
mpiCommunications/CartesianPartitioner.cpp
198194
mpiCommunications/ParticleCartesianPartitioner.cpp
@@ -230,6 +226,9 @@ if( ENABLE_VTK )
230226
generators/VTKMeshGeneratorTools.hpp
231227
generators/VTKWellGenerator.hpp
232228
generators/VTKUtilities.hpp
229+
mpiCommunications/MeshPartitioner.hpp
230+
mpiCommunications/CellGraphPartitioner.hpp
231+
mpiCommunications/LayeredMeshPartitioner.hpp
233232
)
234233
set( mesh_sources ${mesh_sources}
235234
generators/CollocatedNodes.cpp
@@ -239,6 +238,9 @@ if( ENABLE_VTK )
239238
generators/VTKMeshGeneratorTools.cpp
240239
generators/VTKWellGenerator.cpp
241240
generators/VTKUtilities.cpp
241+
mpiCommunications/MeshPartitioner.cpp
242+
mpiCommunications/CellGraphPartitioner.cpp
243+
mpiCommunications/LayeredMeshPartitioner.cpp
242244
)
243245
list( APPEND tplDependencyList VTK::IOLegacy VTK::FiltersParallelDIY2 )
244246
if( ENABLE_MPI )

src/coreComponents/mesh/MeshManager.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,20 @@ void MeshManager::createDefaultPartitioner( PartitionerManager & partitionerMana
279279
}
280280
else if( hasExternalMesh )
281281
{
282-
GEOS_LOG_RANK_0( "No partitioner specified. "
283-
"Creating default CellGraphPartitioner for external mesh." );
284-
partitionerManager.createChild( "CellGraphPartitioner", "defaultPartitioner" );
282+
// Check if CellGraphPartitioner is available in the DomainPartitioner catalog, proxy for VTK availability
283+
auto const & catalog = DomainPartitioner::getCatalog();
284+
bool const hasCellGraphPartitioner = catalog.count( "CellGraphPartitioner" ) > 0;
285+
286+
if( hasCellGraphPartitioner )
287+
{
288+
GEOS_LOG_RANK_0( "No partitioner specified. "
289+
"Creating default CellGraphPartitioner for external mesh." );
290+
partitionerManager.createChild( "CellGraphPartitioner", "defaultPartitioner" );
291+
}
292+
else
293+
{
294+
GEOS_ERROR( "External mesh detected but VTK is not available. " );
295+
}
285296
}
286297
else
287298
{

src/coreComponents/mesh/generators/VTKMeshGenerator.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,6 @@ vtk::AllMeshes redistributeMeshes( integer const logLevel,
380380
if( minCellsOnAnyRank == 0 )
381381
{
382382
mesh = vtk::redistributeByKdTree( *mesh );
383-
384-
std::cout << "Rank " << MpiWrapper::commRank()
385-
<< ": After KdTree redistribution - Cells: " << mesh->GetNumberOfCells()<<std::endl;
386383
}
387384

388385
// ====================================================================
@@ -392,24 +389,14 @@ vtk::AllMeshes redistributeMeshes( integer const logLevel,
392389
{
393390
GEOS_WARNING( "Empty ranks detected after kdtree - redistributing to ensure all ranks have cells" );
394391
mesh = vtk::ensureNoEmptyRank( mesh, comm );
395-
396-
std::cout << "Rank " << MpiWrapper::commRank()
397-
<< ": After ensureNoEmptyRank - Cells: " << mesh->GetNumberOfCells()<<std::endl;
398392
}
399393

400394
// ====================================================================
401395
// STEP 7: Final partitioning using the configured partitioner
402396
// ====================================================================
403-
std::cout << "Rank " << MpiWrapper::commRank()
404-
<< ": Before final partitioning - Cells: " << mesh->GetNumberOfCells()<<std::endl;
405-
406397
vtk::AllMeshes input( mesh, namesToFractures );
407398
vtk::AllMeshes result = meshPartitioner->partitionMeshes( input, comm );
408399

409-
std::cout << "Rank " << MpiWrapper::commRank()
410-
<< ": After final partitioning - Cells: "
411-
<< result.getMainMesh()->GetNumberOfCells()<<std::endl;
412-
413400
// ====================================================================
414401
// STEP 8: Log redistribution statistics
415402
// ====================================================================

src/coreComponents/mesh/generators/VTKUtilities.hpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,6 @@ AllMeshes applyPartitioning( AllMeshes & input,
232232
arrayView1d< int64_t const > partitioning,
233233
MPI_Comm comm );
234234

235-
/**
236-
* @brief Exchange bounding boxes between MPI ranks
237-
*
238-
* @param mesh The mesh to compute and exchange bounding boxes for
239-
* @param comm MPI communicator
240-
* @return Vector of bounding boxes from all ranks
241-
*/
242-
stdVector< vtkBoundingBox > exchangeBoundingBoxes( vtkDataSet & mesh, MPI_Comm comm );
243-
244-
245235
/**
246236
* @brief Compute the rank neighbor candidate list.
247237
* @param[in] boundingBoxes the bounding boxes used by the VTK partitioner for all ranks

src/coreComponents/mesh/mpiCommunications/GraphPartitionEngine.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
/**
1717
* @file GraphPartitionEngine.hpp
18-
* @brief Low-level graph partitioning algorithms - NOT user-facing
1918
*/
2019

2120
#ifndef GEOS_PARTITIONER_GRAPHPARTITIONENGINE_HPP_

src/coreComponents/mesh/mpiCommunications/LayeredMeshPartitioner.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
1313
* ------------------------------------------------------------------------------------------------------------
1414
*/
15-
#include "LayeredMeshPartitioner.hpp"
15+
16+
#include "LayeredMeshPartitioner.hpp"
1617
#include "mesh/generators/VTKUtilities.hpp"
1718

1819
namespace geos
@@ -43,16 +44,15 @@ void LayeredMeshPartitioner::postInputInitialization()
4344
MeshPartitioner::postInputInitialization();
4445

4546
// Validate LayeredMeshPartitioner-specific parameters
46-
GEOS_ERROR_IF( m_indexArrayName.empty(),
47-
"LayeredMeshPartitioner requires 'indexArrayName' to be specified" );
47+
GEOS_THROW_IF( m_indexArrayName.empty(),
48+
"LayeredMeshPartitioner requires 'indexArrayName' to be specified", InputError );
4849

49-
GEOS_ERROR_IF_LE( m_numPartZ, 0,
50-
"LayeredMeshPartitioner requires 'numPartZ' > 0, got " << m_numPartZ );
50+
GEOS_THROW_IF_LE_MSG( m_numPartZ, 0,
51+
GEOS_FMT( "LayeredMeshPartitioner requires 'numPartZ' > 0, got {}", m_numPartZ ), InputError );
5152

5253
int const mpiSize = MpiWrapper::commSize( MPI_COMM_GEOS );
53-
GEOS_ERROR_IF_NE( mpiSize % m_numPartZ, 0,
54-
"Total MPI ranks (" << mpiSize << ") must be evenly divisible by "
55-
<< "numPartZ (" << m_numPartZ << ")" );
54+
GEOS_THROW_IF_NE_MSG( mpiSize % m_numPartZ, 0,
55+
GEOS_FMT( "Total MPI ranks ( {} ) must be evenly divisible by numPartZ ({})", mpiSize, m_numPartZ ), InputError );
5656

5757
GEOS_LOG_RANK_0( GEOS_FMT( "LayeredMeshPartitioner: {} ranks will be partitioned into {} area partitions x {} layer partitions",
5858
mpiSize, mpiSize / m_numPartZ, m_numPartZ ) );
@@ -90,9 +90,8 @@ void LayeredMeshPartitioner::processCommandLineOverrides( unsigned int const xpa
9090
// Default: partition into commSize parts
9191
int const mpiSize = MpiWrapper::commSize( MPI_COMM_GEOS );
9292

93-
GEOS_ERROR_IF_NE( mpiSize % m_numPartZ, 0,
94-
"Total MPI ranks (" << mpiSize << ") must be evenly divisible by "
95-
<< "numPartZ (" << m_numPartZ << ")" );
93+
GEOS_THROW_IF_NE_MSG( mpiSize % m_numPartZ, 0,
94+
GEOS_FMT( "Total MPI ranks ({}) must be evenly divisible by numPartZ ({})", mpiSize, m_numPartZ ), InputError );
9695

9796
int const areaPartitions = mpiSize / m_numPartZ;
9897
setPartitionCounts( 1, areaPartitions, m_numPartZ );

src/coreComponents/mesh/mpiCommunications/LayeredMeshPartitioner.hpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
/**
1717
* @class LayeredMeshPartitioner
1818
*/
19+
20+
#ifndef GEOS_PARTITIONER_LAYEREDMESHPARTITIONER_HPP_
21+
#define GEOS_PARTITIONER_LAYEREDMESHPARTITIONER_HPP_
22+
23+
#include "MeshPartitioner.hpp"
24+
25+
namespace geos
26+
{
27+
1928
class LayeredMeshPartitioner : public MeshPartitioner
2029
{
2130
public:
@@ -39,12 +48,6 @@ class LayeredMeshPartitioner : public MeshPartitioner
3948
*/
4049
static string catalogName() { return "LayeredMeshPartitioner"; }
4150

42-
/**
43-
* @brief Get the catalog name
44-
* @return The catalog key
45-
*/
46-
virtual string getCatalogName() const override { return catalogName(); }
47-
4851
/**
4952
* @brief Process command-line partition count overrides
5053
*
@@ -95,3 +98,8 @@ class LayeredMeshPartitioner : public MeshPartitioner
9598
/// Number of partitions in layer Z-direction
9699
int m_numPartZ;
97100
};
101+
102+
} // namespace geos
103+
104+
105+
#endif // GEOS_PARTITIONER_LAYEREDMESHPARTITIONER_HPP_

src/coreComponents/mesh/mpiCommunications/MeshPartitioner.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "MeshPartitioner.hpp"
2323
#include "GraphPartitionEngine.hpp"
2424

25+
#include "mesh/generators/VTKMeshGeneratorTools.hpp"
2526
#include <vtkBoundingBox.h>
2627

2728
#ifdef GEOS_USE_TRILINOS

src/coreComponents/schema/schema.xsd

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,10 @@
327327
<xsd:selector xpath="CellGraphPartitioner" />
328328
<xsd:field xpath="@name" />
329329
</xsd:unique>
330+
<xsd:unique name="PartitionerLayeredMeshPartitionerUniqueName">
331+
<xsd:selector xpath="LayeredMeshPartitioner" />
332+
<xsd:field xpath="@name" />
333+
</xsd:unique>
330334
<xsd:unique name="PartitionerParticleCartesianUniqueName">
331335
<xsd:selector xpath="ParticleCartesian" />
332336
<xsd:field xpath="@name" />
@@ -2678,6 +2682,7 @@ Information output from lower logLevels is added with the desired log level
26782682
<xsd:choice minOccurs="0" maxOccurs="unbounded">
26792683
<xsd:element name="CartesianPartitioner" type="CartesianPartitionerType" />
26802684
<xsd:element name="CellGraphPartitioner" type="CellGraphPartitionerType" />
2685+
<xsd:element name="LayeredMeshPartitioner" type="LayeredMeshPartitionerType" />
26812686
<xsd:element name="ParticleCartesian" type="ParticleCartesianType" />
26822687
</xsd:choice>
26832688
</xsd:complexType>
@@ -2695,6 +2700,18 @@ Information output from lower logLevels is added with the desired log level
26952700
<!--name => A name is required for any non-unique nodes-->
26962701
<xsd:attribute name="name" type="groupName" use="required" />
26972702
</xsd:complexType>
2703+
<xsd:complexType name="LayeredMeshPartitionerType">
2704+
<!--engine => Graph partitioning engine (parmetis, ptscotch, or noop)-->
2705+
<xsd:attribute name="engine" type="string" default="parmetis" />
2706+
<!--indexArrayName => Name of VTK cell data array containing [area, layer] indices-->
2707+
<xsd:attribute name="indexArrayName" type="string" use="required" />
2708+
<!--numPartZ => Number of partitions in layer Z-direction-->
2709+
<xsd:attribute name="numPartZ" type="integer" default="1" />
2710+
<!--numRefinements => Number of refinement iterations for graph partitioning (ParMETIS only, ignored by other engines)-->
2711+
<xsd:attribute name="numRefinements" type="integer" default="0" />
2712+
<!--name => A name is required for any non-unique nodes-->
2713+
<xsd:attribute name="name" type="groupName" use="required" />
2714+
</xsd:complexType>
26982715
<xsd:complexType name="ParticleCartesianType">
26992716
<!--partitionCounts => Number of partitions in each direction [nx, ny, nz]-->
27002717
<xsd:attribute name="partitionCounts" type="integer_array" default="{0}" />

src/coreComponents/schema/schema.xsd.other

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,13 @@
552552
<xsd:choice minOccurs="0" maxOccurs="unbounded">
553553
<xsd:element name="CartesianPartitioner" type="CartesianPartitionerType" />
554554
<xsd:element name="CellGraphPartitioner" type="CellGraphPartitionerType" />
555+
<xsd:element name="LayeredMeshPartitioner" type="LayeredMeshPartitionerType" />
555556
<xsd:element name="ParticleCartesian" type="ParticleCartesianType" />
556557
</xsd:choice>
557558
</xsd:complexType>
558559
<xsd:complexType name="CartesianPartitionerType" />
559560
<xsd:complexType name="CellGraphPartitionerType" />
561+
<xsd:complexType name="LayeredMeshPartitionerType" />
560562
<xsd:complexType name="ParticleCartesianType" />
561563
<xsd:complexType name="SolversType">
562564
<xsd:choice minOccurs="0" maxOccurs="unbounded">

0 commit comments

Comments
 (0)