KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
Public Member Functions | List of all members
Kratos::ParallelEnvironment Class Reference

Holder for general data related to MPI (or suitable serial equivalents for non-MPI runs). More...

#include <parallel_environment.h>

Collaboration diagram for Kratos::ParallelEnvironment:

Public Member Functions

template<>
void RegisterFillCommunicatorFactoryDetail (std::function< FillCommunicator::Pointer(ModelPart &, const std::string &)> FillCommunicatorFactory)
 
template<>
void RegisterFillCommunicatorFactoryDetail (std::function< FillCommunicator::Pointer(ModelPart &, const DataCommunicator &)> FillCommunicatorFactory)
 
template<>
void RegisterCommunicatorFactoryDetail (std::function< Communicator::UniquePointer(ModelPart &, const std::string &)> CommunicatorFactory)
 
template<>
void RegisterCommunicatorFactoryDetail (std::function< Communicator::UniquePointer(ModelPart &, const DataCommunicator &)> CommunicatorFactory)
 

Static Public Member Functions

Access
static DataCommunicatorGetDataCommunicator (const std::string &rName)
 Retrieve a registered DataCommunicator instance. More...
 
static DataCommunicatorGetDefaultDataCommunicator ()
 Retrieve the default DataCommunicator instance. More...
 
static void SetDefaultDataCommunicator (const std::string &rName)
 Set a new default DataCommunicator instance. More...
 
static int GetDefaultRank ()
 Get the rank of the current process, as given by the default DataCommunicator. More...
 
static int GetDefaultSize ()
 Get the MPI Comm size, as given by the default DataCommunicator. More...
 
static std::string RetrieveRegisteredName (const DataCommunicator &rComm)
 Get the MPI Comm size, as given by the default DataCommunicator. More...
 
Operations
static void SetUpMPIEnvironment (EnvironmentManager::Pointer pEnvironmentManager)
 
template<class TDataCommunicatorInputType >
static void RegisterFillCommunicatorFactory (std::function< FillCommunicator::Pointer(ModelPart &, TDataCommunicatorInputType &)> FillCommunicatorFactory)
 Registers the fill communicator factory This method takes the provided fill communicator pointer factory and saves it to be used later on. More...
 
template<class TDataCommunicatorInputType >
static void RegisterCommunicatorFactory (std::function< Communicator::UniquePointer(ModelPart &, TDataCommunicatorInputType &)> CommunicatorFactory)
 Registers the communicator factory This method takes the provided communicator pointer factory and saves it to be used later on. More...
 
static FillCommunicator::Pointer CreateFillCommunicator (ModelPart &rModelPart)
 Create a fill communicator object This method uses the previously registered fill communicator factory for the creation of a new fill communicator pointer. More...
 
static FillCommunicator::Pointer CreateFillCommunicatorFromGlobalParallelism (ModelPart &rModelPart, const std::string &rDataCommunicatorName)
 Create a fill communicator object This method uses the previously registered fill communicator factory for the creation of a new fill communicator pointer. More...
 
static FillCommunicator::Pointer CreateFillCommunicatorFromGlobalParallelism (ModelPart &rModelPart, const DataCommunicator &rDataCommunicator)
 Create a fill communicator object This method uses the previously registered fill communicator factory for the creation of a new fill communicator pointer. More...
 
static Communicator::UniquePointer CreateCommunicatorFromGlobalParallelism (ModelPart &rModelPart, const std::string &rDataCommunicatorName)
 Create a Communicator object This method uses the previously registered communicator factory for the creation of a new communicator pointer. More...
 
static Communicator::UniquePointer CreateCommunicatorFromGlobalParallelism (ModelPart &rModelPart, const DataCommunicator &rDataCommunicator)
 Create a Communicator object This method uses the previously registered communicator factory for the creation of a new communicator pointer. More...
 
static void RegisterDataCommunicator (const std::string &rName, DataCommunicator::UniquePointer pPrototype, const bool Default=DoNotMakeDefault)
 Add a new DataCommunicator instance to the ParallelEnvironment. More...
 
static void UnregisterDataCommunicator (const std::string &rName)
 Remove a DataCommunicator instance from the ParallelEnvironment. More...
 
Inquiry
static bool HasDataCommunicator (const std::string &rName)
 Check if a DataCommunicator is registered as rName. More...
 
static std::string GetDefaultDataCommunicatorName ()
 Get the registered name of the current default. More...
 
static bool MPIIsInitialized ()
 
static bool MPIIsFinalized ()
 
Input and output
static std::string Info ()
 Turn back information as a string. More...
 
static void PrintInfo (std::ostream &rOStream)
 Print information about this object. More...
 
static void PrintData (std::ostream &rOStream)
 Print object's data. More...
 

Static Public Attributes

Type Definitions
constexpr static bool MakeDefault = true
 
constexpr static bool DoNotMakeDefault = false
 

Detailed Description

Holder for general data related to MPI (or suitable serial equivalents for non-MPI runs).

This class manages a registry of DataCommunicators, which can be used to perform MPI communication.

See also
DataCommunicator, MPIDataCommunicator.

Member Function Documentation

◆ CreateCommunicatorFromGlobalParallelism() [1/2]

Communicator::UniquePointer Kratos::ParallelEnvironment::CreateCommunicatorFromGlobalParallelism ( ModelPart rModelPart,
const DataCommunicator rDataCommunicator 
)
static

Create a Communicator object This method uses the previously registered communicator factory for the creation of a new communicator pointer.

Parameters
rModelPartModel part required to retrieve the variables list from it
rDataCommunicatorreference to the data communicator to be used for the communicator construction
Returns
Communicator::UniquePointer Unique pointer to the new communicator

◆ CreateCommunicatorFromGlobalParallelism() [2/2]

Communicator::UniquePointer Kratos::ParallelEnvironment::CreateCommunicatorFromGlobalParallelism ( ModelPart rModelPart,
const std::string &  rDataCommunicatorName 
)
static

Create a Communicator object This method uses the previously registered communicator factory for the creation of a new communicator pointer.

Parameters
rModelPartModel part required to retrieve the variables list from it
rDataCommunicatorNameName of the data communicator to be retrieved for the communicator construction
Returns
Communicator::UniquePointer Unique pointer to the new communicator

◆ CreateFillCommunicator()

FillCommunicator::Pointer Kratos::ParallelEnvironment::CreateFillCommunicator ( ModelPart rModelPart)
static

Create a fill communicator object This method uses the previously registered fill communicator factory for the creation of a new fill communicator pointer.

Parameters
rModelPartModel part to which the fill communicator will be applied
Returns
FillCommunicator::Pointer Pointer to the new fill communicator instance

◆ CreateFillCommunicatorFromGlobalParallelism() [1/2]

FillCommunicator::Pointer Kratos::ParallelEnvironment::CreateFillCommunicatorFromGlobalParallelism ( ModelPart rModelPart,
const DataCommunicator rDataCommunicator 
)
static

Create a fill communicator object This method uses the previously registered fill communicator factory for the creation of a new fill communicator pointer.

Parameters
rModelPartModel part to which the fill communicator will be applied
rDataCommunicatorreference to the data communicator to be used for the fill communicator construction
Returns
FillCommunicator::Pointer Pointer to the new fill communicator instance

◆ CreateFillCommunicatorFromGlobalParallelism() [2/2]

FillCommunicator::Pointer Kratos::ParallelEnvironment::CreateFillCommunicatorFromGlobalParallelism ( ModelPart rModelPart,
const std::string &  rDataCommunicatorName 
)
static

Create a fill communicator object This method uses the previously registered fill communicator factory for the creation of a new fill communicator pointer.

Parameters
rModelPartModel part to which the fill communicator will be applied
rDataCommunicatorNameName of the data communicator to be retrieved for the fill communicator construction
Returns
FillCommunicator::Pointer Pointer to the new fill communicator instance

◆ GetDataCommunicator()

DataCommunicator & Kratos::ParallelEnvironment::GetDataCommunicator ( const std::string &  rName)
static

Retrieve a registered DataCommunicator instance.

Parameters
rNameThe name used to register the string.

◆ GetDefaultDataCommunicator()

DataCommunicator & Kratos::ParallelEnvironment::GetDefaultDataCommunicator ( )
static

Retrieve the default DataCommunicator instance.

◆ GetDefaultDataCommunicatorName()

std::string Kratos::ParallelEnvironment::GetDefaultDataCommunicatorName ( )
static

Get the registered name of the current default.

This is a convenience function to help with temporarily changing the default DataCommunicator.

◆ GetDefaultRank()

int Kratos::ParallelEnvironment::GetDefaultRank ( )
static

Get the rank of the current process, as given by the default DataCommunicator.

◆ GetDefaultSize()

int Kratos::ParallelEnvironment::GetDefaultSize ( )
static

Get the MPI Comm size, as given by the default DataCommunicator.

◆ HasDataCommunicator()

bool Kratos::ParallelEnvironment::HasDataCommunicator ( const std::string &  rName)
static

Check if a DataCommunicator is registered as rName.

◆ Info()

std::string Kratos::ParallelEnvironment::Info ( )
static

Turn back information as a string.

◆ MPIIsFinalized()

bool Kratos::ParallelEnvironment::MPIIsFinalized ( )
static

◆ MPIIsInitialized()

bool Kratos::ParallelEnvironment::MPIIsInitialized ( )
static

◆ PrintData()

void Kratos::ParallelEnvironment::PrintData ( std::ostream &  rOStream)
static

Print object's data.

◆ PrintInfo()

void Kratos::ParallelEnvironment::PrintInfo ( std::ostream &  rOStream)
static

Print information about this object.

◆ RegisterCommunicatorFactory()

template<class TDataCommunicatorInputType >
template void Kratos::ParallelEnvironment::RegisterCommunicatorFactory< const DataCommunicator > ( std::function< Communicator::UniquePointer(ModelPart &, TDataCommunicatorInputType &)>  CommunicatorFactory)
static

Registers the communicator factory This method takes the provided communicator pointer factory and saves it to be used later on.

Parameters
CommunicatorFactoryFactory function returning a pointer to a (parallel or serial) communicator

◆ RegisterCommunicatorFactoryDetail() [1/2]

template<>
void Kratos::ParallelEnvironment::RegisterCommunicatorFactoryDetail ( std::function< Communicator::UniquePointer(ModelPart &, const DataCommunicator &)>  CommunicatorFactory)

◆ RegisterCommunicatorFactoryDetail() [2/2]

template<>
void Kratos::ParallelEnvironment::RegisterCommunicatorFactoryDetail ( std::function< Communicator::UniquePointer(ModelPart &, const std::string &)>  CommunicatorFactory)

◆ RegisterDataCommunicator()

void Kratos::ParallelEnvironment::RegisterDataCommunicator ( const std::string &  rName,
DataCommunicator::UniquePointer  pPrototype,
const bool  Default = DoNotMakeDefault 
)
static

Add a new DataCommunicator instance to the ParallelEnvironment.

Parameters
rNameThe name to be used to identify the DataCommunicator within ParallelEnvironment.
rPrototypeThe DataCommunicator instance.
DefaultIf set to ParallelEnvironment::MakeDefault (a.k.a. true), the provided DataCommunicator will also be made default.

◆ RegisterFillCommunicatorFactory()

template<class TDataCommunicatorInputType >
template void Kratos::ParallelEnvironment::RegisterFillCommunicatorFactory< const DataCommunicator > ( std::function< FillCommunicator::Pointer(ModelPart &, TDataCommunicatorInputType &)>  FillCommunicatorFactory)
static

Registers the fill communicator factory This method takes the provided fill communicator pointer factory and saves it to be used later on.

Parameters
CommunicatorFactoryFactory function returning a pointer to a (parallel or serial) fill communicator

◆ RegisterFillCommunicatorFactoryDetail() [1/2]

template<>
void Kratos::ParallelEnvironment::RegisterFillCommunicatorFactoryDetail ( std::function< FillCommunicator::Pointer(ModelPart &, const DataCommunicator &)>  FillCommunicatorFactory)

◆ RegisterFillCommunicatorFactoryDetail() [2/2]

template<>
void Kratos::ParallelEnvironment::RegisterFillCommunicatorFactoryDetail ( std::function< FillCommunicator::Pointer(ModelPart &, const std::string &)>  FillCommunicatorFactory)

◆ RetrieveRegisteredName()

std::string Kratos::ParallelEnvironment::RetrieveRegisteredName ( const DataCommunicator rComm)
static

Get the MPI Comm size, as given by the default DataCommunicator.

◆ SetDefaultDataCommunicator()

void Kratos::ParallelEnvironment::SetDefaultDataCommunicator ( const std::string &  rName)
static

Set a new default DataCommunicator instance.

Parameters
rNameThe name the new default DataCommunicator was registered with.

◆ SetUpMPIEnvironment()

void Kratos::ParallelEnvironment::SetUpMPIEnvironment ( EnvironmentManager::Pointer  pEnvironmentManager)
static

◆ UnregisterDataCommunicator()

void Kratos::ParallelEnvironment::UnregisterDataCommunicator ( const std::string &  rName)
static

Remove a DataCommunicator instance from the ParallelEnvironment.

Parameters
rNameThe name used to register the DataCommunicator within ParallelEnvironment.

Member Data Documentation

◆ DoNotMakeDefault

constexpr static bool Kratos::ParallelEnvironment::DoNotMakeDefault = false
staticconstexpr

◆ MakeDefault

constexpr static bool Kratos::ParallelEnvironment::MakeDefault = true
staticconstexpr

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