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.
List of all members
Kratos::GlobalPointerUtilities Class Reference

This class is used to manage global pointers. Overall, the GlobalPointerUtilities class provides a useful utility for retrieving global pointers to entities in a distributed Kratos simulation. More...

#include <global_pointer_utilities.h>

Collaboration diagram for Kratos::GlobalPointerUtilities:

Public Member Functions

Type Definitions
 KRATOS_CLASS_POINTER_DEFINITION (GlobalPointerUtilities)
 Pointer definition of GlobalPointerUtilities. More...
 
Input and output
virtual std::string Info () const
 Turn back information as a string. More...
 
virtual void PrintInfo (std::ostream &rOStream) const
 Print information about this object. More...
 
virtual void PrintData (std::ostream &rOStream) const
 Print object's data. More...
 

Life Cycle

 GlobalPointerUtilities ()
 Default constructor. More...
 
virtual ~GlobalPointerUtilities ()
 Destructor. More...
 
template<class TContainerType >
static std::unordered_map< int, GlobalPointer< typename TContainerType::value_type > > RetrieveGlobalIndexedPointersMap (const TContainerType &rContainer, const std::vector< int > &rIdList, const DataCommunicator &rDataCommunicator)
 Retrieves a map of global pointers corresponding to the given entity ids, where the global pointers point to the entities in the container and are tagged with their global rank. More...
 
template<class TContainerType >
static GlobalPointersVector< typename TContainerType::value_type > LocalRetrieveGlobalPointers (const TContainerType &rContainer, const DataCommunicator &rDataCommunicator)
 Retrieve global pointers for entities in container, given a data communicator. Only local entities are retrieved. More...
 
template<class TContainerType >
static GlobalPointersVector< typename TContainerType::value_type > GlobalRetrieveGlobalPointers (const TContainerType &rContainer, const DataCommunicator &rDataCommunicator)
 Retrieve global pointers for entities in container, given a data communicator. All entities are retrieved. More...
 
template<class TContainerType >
static GlobalPointersVector< typename TContainerType::value_type > RetrieveGlobalIndexedPointers (const TContainerType &rContainer, const std::vector< int > &rIdList, const DataCommunicator &rDataCommunicator)
 Retrieve global indexed pointers from container and data communicator. More...
 

Detailed Description

This class is used to manage global pointers. Overall, the GlobalPointerUtilities class provides a useful utility for retrieving global pointers to entities in a distributed Kratos simulation.

The class provides a method GetGlobalPointers that retrieves a map of global pointers corresponding to the given entity ids. The GetGlobalPointers method takes a reference to a container rContainer that holds the entities, a const reference to a vector of ids rIdList for the entities we need to retrieve, and a reference to a DataCommunicator object rDataCommunicator. The method returns an unordered map of global pointers corresponding to the given entity ids. The method first checks if the execution is distributed, and if so, it finds the rank of the node that owns the entity if it is remote, and gathers everything onto the master_rank processor. It then creates a map of global pointers corresponding to the given entity ids, where the global pointers point to the entities in the container and are tagged with their global rank.

See also
GlobalPointer
GlobalPointersVector
GlobalPointersUnorderedMap
Author
Riccardo Rossi

Constructor & Destructor Documentation

◆ GlobalPointerUtilities()

Kratos::GlobalPointerUtilities::GlobalPointerUtilities ( )
inline

Default constructor.

◆ ~GlobalPointerUtilities()

virtual Kratos::GlobalPointerUtilities::~GlobalPointerUtilities ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ GlobalRetrieveGlobalPointers()

template<class TContainerType >
static GlobalPointersVector< typename TContainerType::value_type > Kratos::GlobalPointerUtilities::GlobalRetrieveGlobalPointers ( const TContainerType &  rContainer,
const DataCommunicator rDataCommunicator 
)
inlinestatic

Retrieve global pointers for entities in container, given a data communicator. All entities are retrieved.

Parameters
rContainercontainer of entities from which to retrieve pointers
rDataCommunicatordata communicator to use for retrieval
Returns
vector of global pointers to entities in container

◆ Info()

virtual std::string Kratos::GlobalPointerUtilities::Info ( ) const
inlinevirtual

Turn back information as a string.

◆ KRATOS_CLASS_POINTER_DEFINITION()

Kratos::GlobalPointerUtilities::KRATOS_CLASS_POINTER_DEFINITION ( GlobalPointerUtilities  )

Pointer definition of GlobalPointerUtilities.

◆ LocalRetrieveGlobalPointers()

template<class TContainerType >
static GlobalPointersVector< typename TContainerType::value_type > Kratos::GlobalPointerUtilities::LocalRetrieveGlobalPointers ( const TContainerType &  rContainer,
const DataCommunicator rDataCommunicator 
)
inlinestatic

Retrieve global pointers for entities in container, given a data communicator. Only local entities are retrieved.

Parameters
rContainercontainer of entities from which to retrieve pointers
rDataCommunicatordata communicator to use for retrieval
Returns
vector of global pointers to entities in container

◆ PrintData()

virtual void Kratos::GlobalPointerUtilities::PrintData ( std::ostream &  rOStream) const
inlinevirtual

Print object's data.

◆ PrintInfo()

virtual void Kratos::GlobalPointerUtilities::PrintInfo ( std::ostream &  rOStream) const
inlinevirtual

Print information about this object.

◆ RetrieveGlobalIndexedPointers()

template<class TContainerType >
static GlobalPointersVector< typename TContainerType::value_type > Kratos::GlobalPointerUtilities::RetrieveGlobalIndexedPointers ( const TContainerType &  rContainer,
const std::vector< int > &  rIdList,
const DataCommunicator rDataCommunicator 
)
inlinestatic

Retrieve global indexed pointers from container and data communicator.

Parameters
rContainerContainer to retrieve pointers from
rIdListList of ids to retrieve pointers for
rDataCommunicatorCommunicator to retrieve data from
Returns
GlobalPointersVector containing pointers for all ids in rIdList
Exceptions
KRATOS_ERRORif an id in rIdList is not found for the current processor rank

◆ RetrieveGlobalIndexedPointersMap()

template<class TContainerType >
static std::unordered_map< int, GlobalPointer<typename TContainerType::value_type> > Kratos::GlobalPointerUtilities::RetrieveGlobalIndexedPointersMap ( const TContainerType &  rContainer,
const std::vector< int > &  rIdList,
const DataCommunicator rDataCommunicator 
)
inlinestatic

Retrieves a map of global pointers corresponding to the given entity ids, where the global pointers point to the entities in the container and are tagged with their global rank.

If the execution is distributed, it finds the rank of the node that owns the entity if it is remote, and gathers everything onto the master_rank processor.

Parameters
rContainera reference to the container that holds the entities
rIdLista const reference to a vector of ids for the entities we need to retrieve
rDataCommunicatora reference to a DataCommunicator object
Returns
the unordered map of global pointers corresponding to the given entity ids in (id, global_pointer) pairs

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