Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::ArcaneGeometricMeshPartitionerService Class Reference

Mesh geometric partitioning service. More...

Inheritance diagram for Arcane::ArcaneGeometricMeshPartitionerService:
Collaboration diagram for Arcane::ArcaneGeometricMeshPartitionerService:

Public Member Functions

 ArcaneGeometricMeshPartitionerService (const ServiceBuildInfo &sbi)
IMeshmesh () const override
 Mesh associated with the partitioner.
void build () override
 Build-level construction of the service.
void partitionMesh (bool initial_partition) override
void partitionMesh (bool initial_partition, Int32 nb_part) override
void notifyEndPartition () override
 Notification when a re-partitioning finishes (after entity exchange).
void setMaximumComputationTime (Real v) override
 Sets the proportion of computation time.
Real maximumComputationTime () const override
void setComputationTimes (RealConstArrayView v) override
 Computation time of this subdomain. The first element indicates the computation time of the subdomain corresponding to calculations whose cost is proportional to the cells. The following must be associated with a variable (to be done).
RealConstArrayView computationTimes () const override
void setImbalance (Real v) override
 Sets the computation time imbalance.
Real imbalance () const override
 Computation time imbalance.
void setMaxImbalance (Real v) override
 Sets the maximum allowed imbalance.
Real maxImbalance () const override
 Maximum allowed imbalance.
ArrayView< float > cellsWeight () const override
void setCellsWeight (ArrayView< float > weights, Integer nb_weight) override
 Allows defining the weights of objects to be partitioned: ILoadBalanceMng must now be used.
void setILoadBalanceMng (ILoadBalanceMng *) override
 Changes the ILoadBalanceMng to use.
ILoadBalanceMngloadBalanceMng () const override
Public Member Functions inherited from Arcane::ArcaneArcaneGeometricMeshPartitionerServiceObject
 ArcaneArcaneGeometricMeshPartitionerServiceObject (const Arcane::ServiceBuildInfo &sbi)
 Constructeur.
virtual ~ArcaneArcaneGeometricMeshPartitionerServiceObject ()
 Destructeur.
CaseOptionsArcaneGeometricMeshPartitionerServiceoptions () const
 Options du jeu de données du service.
Public Member Functions inherited from Arcane::BasicService
 ~BasicService () override
 Releases resources.
virtual ISubDomainsubDomain ()
Public Member Functions inherited from Arcane::AbstractService
 ~AbstractService () override
 Destructor.
IServiceInfoserviceInfo () const override
 Access to service information. See IServiceInfo for details.
IBaseserviceParent () const override
 Access to the base interface of main Arcane objects.
IServiceserviceInterface () override
 Returns the low-level IService interface of the service.
Public Member Functions inherited from Arcane::TraceAccessor
 TraceAccessor (ITraceMng *m)
 Constructs an accessor via the trace manager m.
 TraceAccessor (const TraceAccessor &rhs)
 Copy constructor.
TraceAccessoroperator= (const TraceAccessor &rhs)
 Copy assignment operator.
virtual ~TraceAccessor ()
 Frees resources.
ITraceMngtraceMng () const
 Trace manager.
TraceMessage info () const
 Flow for an information message.
TraceMessage pinfo () const
 Flow for a parallel information message.
TraceMessage info (char category) const
 Flow for an information message of a given category.
TraceMessage pinfo (char category) const
 Flow for a parallel information message of a given category.
TraceMessage info (bool v) const
 Flow for an information message.
TraceMessage warning () const
 Flow for a warning message.
TraceMessage pwarning () const
TraceMessage error () const
 Flow for an error message.
TraceMessage perror () const
TraceMessage log () const
 Flow for a log message.
TraceMessage plog () const
 Flow for a log message.
TraceMessage logdate () const
 Flow for a log message preceded by the date.
TraceMessage fatal () const
 Flow for a fatal error message.
TraceMessage pfatal () const
 Flow for a parallel fatal error message.
TraceMessageDbg debug (Trace::eDebugLevel=Trace::Medium) const
 Flow for a debug message.
Trace::eDebugLevel configDbgLevel () const
 Debug level of the configuration file.
TraceMessage info (Int32 verbose_level) const
 Flow for an information message of a given level.
TraceMessage linfo () const
 Flow for an information message with the local information level of this instance.
TraceMessage linfo (Int32 relative_level) const
 Flow for an information message with the local information level of this instance.
void fatalMessage (const StandaloneTraceMessage &o) const
Public Member Functions inherited from Arcane::IService
virtual ~IService ()
 Releases resources.
Public Member Functions inherited from Arcane::MeshAccessor
 MeshAccessor (ISubDomain *sd)
 MeshAccessor (IMesh *mesh)
 MeshAccessor (const MeshHandle &mesh_handle)
Integer nbCell () const
 Returns the number of cells in the mesh.
Integer nbFace () const
 Returns the number of faces in the mesh.
Integer nbEdge () const
 Returns the number of edges in the mesh.
Integer nbNode () const
 Returns the number of nodes in the mesh.
VariableNodeReal3nodesCoordinates () const
 Returns the coordinates of the mesh nodes.
NodeGroup allNodes () const
 Returns the group containing all nodes.
EdgeGroup allEdges () const
 Returns the group containing all edges.
FaceGroup allFaces () const
 Returns the group containing all faces.
CellGroup allCells () const
 Returns the group containing all cells.
FaceGroup outerFaces () const
 Returns the group containing all boundary faces.
NodeGroup ownNodes () const
 Returns the group containing all nodes specific to this domain.
CellGroup ownCells () const
 Returns the group containing all cells specific to this domain.
FaceGroup ownFaces () const
 Group containing all faces specific to this domain.
EdgeGroup ownEdges () const
 Group containing all edges specific to this domain.
IMeshmesh () const
const MeshHandlemeshHandle () const
Public Member Functions inherited from Arcane::CommonVariables
 CommonVariables (IModule *c)
 Constructs the references of the common variables for the module c.
 CommonVariables (IVariableMng *variable_mng)
 Constructs the references of the common variables for the manager variable_mng.
 CommonVariables (ISubDomain *sd)
 Constructs the references of the common variables for the subdomain sd.
virtual ~CommonVariables ()
 Releases resources.
Int32 globalIteration () const
 Current iteration number.
Real globalTime () const
 Current time.
Real globalOldTime () const
 Previous current time.
Real globalFinalTime () const
 Final time of the simulation.
Real globalDeltaT () const
 Current Delta T.
Real globalCPUTime () const
 CPU time used (in seconds).
Real globalOldCPUTime () const
 Previous CPU time used (in seconds).
Real globalElapsedTime () const
 Clock time (elapsed) used (in seconds).
Real globalOldElapsedTime () const
 Previous clock time (elapsed) used (in seconds).
Public Member Functions inherited from Arcane::IMeshPartitioner
virtual IPrimaryMeshprimaryMesh () override
 Associated mesh.
virtual void partitionMesh (bool initial_partition)=0
Public Member Functions inherited from Arcane::IMeshPartitionerBase
virtual ~IMeshPartitionerBase ()=default
 Releases resources.

Private Member Functions

Real3 _computeBarycenter (const VariableCellReal3 &cells_center, CellVectorView cells)
Real3x3 _computeInertiaTensor (Real3 center, const VariableCellReal3 &cells_center, CellVectorView cells)
Real3 _findPrincipalAxis (Real3x3 tensor)
void _partitionMesh2 ()
void _partitionMesh (bool initial_partition, Int32 nb_part)
bool _partitionMeshRecursive (const VariableCellReal3 &cells_center, CellVectorView cells, Int32 partition_index, Int32 &part_id)
void _partitionMeshRecursive2 (ConstArrayView< BinaryTree::TreeNode > tree_nodes, const VariableCellReal3 &cells_center, CellVectorView cells, Int32 partition_index)
void _printOwners ()
Real3 _computeEigenValuesAndVectors (ITraceMng *tm, Real3x3 tensor, Real3x3 &eigen_vectors, Real3 &eigen_values)

Private Attributes

Real m_imbalance = 0.0
Real m_max_imbalance = 0.0
Real m_max_computation_time = 0.0
Int32 m_nb_weight = 0
ArrayView< float > m_cells_weight
UniqueArray< Realm_computation_times
Int32 m_nb_part = 0

Additional Inherited Members

Static Public Member Functions inherited from Arcane::ArcaneArcaneGeometricMeshPartitionerServiceObject
template<typename ServiceClassType>
static void fillServiceInfo (Arcane::ServiceInfo *si)
Public Attributes inherited from Arcane::CommonVariables
VariableScalarInt32 m_global_iteration
 Current iteration.
VariableScalarReal m_global_time
 Current time.
VariableScalarReal m_global_deltat
 Global Delta T.
VariableScalarReal m_global_old_time
 Time previous to the current time.
VariableScalarReal m_global_old_deltat
 Delta T at the time previous to the global time.
VariableScalarReal m_global_final_time
 Final time of the case.
VariableScalarReal m_global_old_cpu_time
 Previous CPU time used (in seconds).
VariableScalarReal m_global_cpu_time
 CPU time used (in seconds).
VariableScalarReal m_global_old_elapsed_time
 Previous clock time used (in seconds).
VariableScalarReal m_global_elapsed_time
 Clock time used (in seconds).
Protected Member Functions inherited from Arcane::BasicService
 BasicService (const ServiceBuildInfo &)
Protected Member Functions inherited from Arcane::AbstractService
 AbstractService (const ServiceBuildInfo &)
 Constructor from a ServiceBuildInfo.
Protected Member Functions inherited from Arcane::TraceAccessor
void _setLocalVerboseLevel (Int32 v)
Int32 _localVerboseLevel () const
Protected Member Functions inherited from Arcane::IService
 IService ()
 Constructor.

Detailed Description

Mesh geometric partitioning service.

This service allows performing a geometric partitioning. Its primary goal is to allow parallel tests even if no specific partitioning service (like ParMetis) is available.

The algorithm is as follows:

  1. The partitioning is recursive, and at each iteration, a partition is split into two.
  2. To split a partition, the center of gravity of the partition, as well as the inertia tensor matrix, is calculated.
  3. From this matrix, the eigenvector corresponding to the smallest axis (the one corresponding to the smallest eigenvalue) is taken.
  4. The center of gravity and the eigenvector define a plane (or a line in 2D) which serves as a partition: elements on one side of the plane are in one partition and those on the other side are in another.
  5. This mechanism is applied to cut into the desired number of partitions.

The current algorithm and implementation are very simple and have the following limitations:

  • Element weights are not taken into account when calculating the partitioning
  • It is assumed that the number of partitions is a power of 2. If not, some partitions will be larger than others. For example, if we want to split into 3, we first create two identical partitions 1 and 2, then split partition 2 into two parts. Partition 1 will therefore theoretically be twice as large as partitions 2 and 3.
  • The partition is done according to a plane, which is probably not optimal for limiting the boundary. Using a circle would be more sensible.
  • The implementation is linear in the number of partitions and all ranks participate. Normally, if we want P partitions, then the number of recursions is N=log2(P) and it would be possible to perform all partitions of rank 1 to N simultaneously.

Currently, the algorithm used applies to cells, but only coordinates are used, which would allow it to be applied without mesh elements. This could be useful for an initial partitioning such as the one used in the parallel MSH reader.

Definition at line 332 of file ArcaneGeometricMeshPartitionerService.cc.

Constructor & Destructor Documentation

◆ ArcaneGeometricMeshPartitionerService()

Arcane::ArcaneGeometricMeshPartitionerService::ArcaneGeometricMeshPartitionerService ( const ServiceBuildInfo & sbi)
explicit

Definition at line 410 of file ArcaneGeometricMeshPartitionerService.cc.

Member Function Documentation

◆ _computeBarycenter()

Real3 Arcane::ArcaneGeometricMeshPartitionerService::_computeBarycenter ( const VariableCellReal3 & cells_center,
CellVectorView cells )
private

Definition at line 420 of file ArcaneGeometricMeshPartitionerService.cc.

◆ _computeInertiaTensor()

Real3x3 Arcane::ArcaneGeometricMeshPartitionerService::_computeInertiaTensor ( Real3 center,
const VariableCellReal3 & cells_center,
CellVectorView cells )
private

Definition at line 443 of file ArcaneGeometricMeshPartitionerService.cc.

◆ _findPrincipalAxis()

Real3 Arcane::ArcaneGeometricMeshPartitionerService::_findPrincipalAxis ( Real3x3 tensor)
private

Definition at line 479 of file ArcaneGeometricMeshPartitionerService.cc.

◆ _partitionMesh()

void Arcane::ArcaneGeometricMeshPartitionerService::_partitionMesh ( bool initial_partition,
Int32 nb_part )
private

Definition at line 820 of file ArcaneGeometricMeshPartitionerService.cc.

◆ _partitionMesh2()

void Arcane::ArcaneGeometricMeshPartitionerService::_partitionMesh2 ( )
private

Definition at line 506 of file ArcaneGeometricMeshPartitionerService.cc.

◆ _partitionMeshRecursive()

bool Arcane::ArcaneGeometricMeshPartitionerService::_partitionMeshRecursive ( const VariableCellReal3 & cells_center,
CellVectorView cells,
Int32 partition_index,
Int32 & part_id )
private

Definition at line 548 of file ArcaneGeometricMeshPartitionerService.cc.

◆ _partitionMeshRecursive2()

void Arcane::ArcaneGeometricMeshPartitionerService::_partitionMeshRecursive2 ( ConstArrayView< BinaryTree::TreeNode > tree_nodes,
const VariableCellReal3 & cells_center,
CellVectorView cells,
Int32 partition_index )
private

Definition at line 627 of file ArcaneGeometricMeshPartitionerService.cc.

◆ _printOwners()

void Arcane::ArcaneGeometricMeshPartitionerService::_printOwners ( )
private

Definition at line 849 of file ArcaneGeometricMeshPartitionerService.cc.

◆ build()

void Arcane::ArcaneGeometricMeshPartitionerService::build ( void )
inlineoverridevirtual

Build-level construction of the service.

This method is called right after the constructor.

Reimplemented from Arcane::AbstractService.

Definition at line 343 of file ArcaneGeometricMeshPartitionerService.cc.

◆ cellsWeight()

ArrayView< float > Arcane::ArcaneGeometricMeshPartitionerService::cellsWeight ( ) const
inlineoverridevirtual

◆ computationTimes()

RealConstArrayView Arcane::ArcaneGeometricMeshPartitionerService::computationTimes ( ) const
inlineoverridevirtual

◆ imbalance()

Real Arcane::ArcaneGeometricMeshPartitionerService::imbalance ( ) const
inlineoverridevirtual

Computation time imbalance.

Implements Arcane::IMeshPartitioner.

Definition at line 359 of file ArcaneGeometricMeshPartitionerService.cc.

◆ loadBalanceMng()

ILoadBalanceMng * Arcane::ArcaneGeometricMeshPartitionerService::loadBalanceMng ( ) const
inlineoverridevirtual

◆ maxImbalance()

Real Arcane::ArcaneGeometricMeshPartitionerService::maxImbalance ( ) const
inlineoverridevirtual

Maximum allowed imbalance.

Implements Arcane::IMeshPartitioner.

Definition at line 361 of file ArcaneGeometricMeshPartitionerService.cc.

◆ maximumComputationTime()

Real Arcane::ArcaneGeometricMeshPartitionerService::maximumComputationTime ( ) const
inlineoverridevirtual

◆ mesh()

IMesh * Arcane::ArcaneGeometricMeshPartitionerService::mesh ( ) const
inlineoverridevirtual

Mesh associated with the partitioner.

Implements Arcane::IMeshPartitioner.

Definition at line 342 of file ArcaneGeometricMeshPartitionerService.cc.

Referenced by partitionMesh().

Here is the caller graph for this function:

◆ notifyEndPartition()

void Arcane::ArcaneGeometricMeshPartitionerService::notifyEndPartition ( )
inlineoverridevirtual

Notification when a re-partitioning finishes (after entity exchange).

Implements Arcane::IMeshPartitionerBase.

Definition at line 350 of file ArcaneGeometricMeshPartitionerService.cc.

◆ partitionMesh() [1/2]

void Arcane::ArcaneGeometricMeshPartitionerService::partitionMesh ( bool initial_partition)
overridevirtual

Re-partitions the mesh mesh

This method changes the owners of the entities and fills the IItemFamily::itemsNewOwner() variable of each entity family of the mesh mesh with the number of the new owning subdomain.

Note
This method is reserved for Arcane developers. If a module wishes to perform a re-partitioning, it must call the method IMeshUtilities::partitionAndExchangeMeshWithReplication() which handles both the partitioning and the exchange of information and supports domain replication.

Implements Arcane::IMeshPartitionerBase.

Definition at line 867 of file ArcaneGeometricMeshPartitionerService.cc.

References mesh().

Here is the call graph for this function:

◆ partitionMesh() [2/2]

void Arcane::ArcaneGeometricMeshPartitionerService::partitionMesh ( bool initial_partition,
Int32 nb_part )
inlineoverridevirtual

◆ setCellsWeight()

void Arcane::ArcaneGeometricMeshPartitionerService::setCellsWeight ( ArrayView< float > weights,
Integer nb_weight )
inlineoverridevirtual

Allows defining the weights of objects to be partitioned: ILoadBalanceMng must now be used.

Implements Arcane::IMeshPartitioner.

Definition at line 365 of file ArcaneGeometricMeshPartitionerService.cc.

◆ setComputationTimes()

void Arcane::ArcaneGeometricMeshPartitionerService::setComputationTimes ( RealConstArrayView v)
inlineoverridevirtual

Computation time of this subdomain. The first element indicates the computation time of the subdomain corresponding to calculations whose cost is proportional to the cells. The following must be associated with a variable (to be done).

Implements Arcane::IMeshPartitioner.

Definition at line 356 of file ArcaneGeometricMeshPartitionerService.cc.

◆ setILoadBalanceMng()

void Arcane::ArcaneGeometricMeshPartitionerService::setILoadBalanceMng ( ILoadBalanceMng * mng)
inlineoverridevirtual

Changes the ILoadBalanceMng to use.

Implements Arcane::IMeshPartitioner.

Definition at line 371 of file ArcaneGeometricMeshPartitionerService.cc.

References ARCANE_THROW.

◆ setImbalance()

void Arcane::ArcaneGeometricMeshPartitionerService::setImbalance ( Real v)
inlineoverridevirtual

Sets the computation time imbalance.

Implements Arcane::IMeshPartitioner.

Definition at line 358 of file ArcaneGeometricMeshPartitionerService.cc.

◆ setMaxImbalance()

void Arcane::ArcaneGeometricMeshPartitionerService::setMaxImbalance ( Real v)
inlineoverridevirtual

Sets the maximum allowed imbalance.

Implements Arcane::IMeshPartitioner.

Definition at line 360 of file ArcaneGeometricMeshPartitionerService.cc.

◆ setMaximumComputationTime()

void Arcane::ArcaneGeometricMeshPartitionerService::setMaximumComputationTime ( Real v)
inlineoverridevirtual

Sets the proportion of computation time.

Proportion of computation time Computation time of the most heavily loaded subdomain

Implements Arcane::IMeshPartitioner.

Definition at line 354 of file ArcaneGeometricMeshPartitionerService.cc.

Member Data Documentation

◆ m_cells_weight

ArrayView<float> Arcane::ArcaneGeometricMeshPartitionerService::m_cells_weight
private

Definition at line 387 of file ArcaneGeometricMeshPartitionerService.cc.

◆ m_computation_times

UniqueArray<Real> Arcane::ArcaneGeometricMeshPartitionerService::m_computation_times
private

Definition at line 388 of file ArcaneGeometricMeshPartitionerService.cc.

◆ m_imbalance

Real Arcane::ArcaneGeometricMeshPartitionerService::m_imbalance = 0.0
private

Definition at line 383 of file ArcaneGeometricMeshPartitionerService.cc.

◆ m_max_computation_time

Real Arcane::ArcaneGeometricMeshPartitionerService::m_max_computation_time = 0.0
private

Definition at line 385 of file ArcaneGeometricMeshPartitionerService.cc.

◆ m_max_imbalance

Real Arcane::ArcaneGeometricMeshPartitionerService::m_max_imbalance = 0.0
private

Definition at line 384 of file ArcaneGeometricMeshPartitionerService.cc.

◆ m_nb_part

Int32 Arcane::ArcaneGeometricMeshPartitionerService::m_nb_part = 0
private

Definition at line 389 of file ArcaneGeometricMeshPartitionerService.cc.

◆ m_nb_weight

Int32 Arcane::ArcaneGeometricMeshPartitionerService::m_nb_weight = 0
private

Definition at line 386 of file ArcaneGeometricMeshPartitionerService.cc.


The documentation for this class was generated from the following file: