Container for objects shared between two distributed data elements.
More...
#include <shambase/include/shambase/DistributedDataShared.hpp>
|
| std::multimap< std::pair< u64, u64 >, T > & | get_native () |
| | Get direct access to the underlying multimap container.
|
| |
| const std::multimap< std::pair< u64, u64 >, T > & | get_native () const |
| | const version
|
| |
| auto | begin () |
| | iterator forwarding
|
| |
| auto | end () |
| | iterator forwarding
|
| |
| auto | begin () const |
| | iterator forwarding
|
| |
| auto | end () const |
| | iterator forwarding
|
| |
| auto | cbegin () const |
| | iterator forwarding
|
| |
| auto | cend () const |
| | iterator forwarding
|
| |
| iterator | add_obj (u64 left_id, u64 right_id, T &&obj) |
| | Add an object associated with a patch pair.
|
| |
| void | for_each (std::function< void(u64, u64, T &)> &&f) |
| | Apply a function to all stored objects.
|
| |
| void | for_each (std::function< void(u64, u64, const T &)> &&f) const |
| | const version
|
| |
| void | tranfer_all (std::function< bool(u64, u64)> cd, DistributedDataShared &other) |
| | Transfer objects to another container based on a condition.
|
| |
| bool | has_key (u64 left_id, u64 right_id) const |
| | Check if a patch pair exists in the container.
|
| |
| u64 | get_element_count () const |
| | Get the total number of objects in the container.
|
| |
| template<class Tmap > |
| DistributedDataShared< Tmap > | map (std::function< Tmap(u64, u64, T &)> map_func) |
| | Transform all objects to a new type using a mapping function.
|
| |
| template<class Tmap > |
| DistributedDataShared< Tmap > | map (std::function< Tmap(u64, u64, const T &)> map_func) const |
| | const version
|
| |
| void | reset () |
| | Clear all objects from the container.
|
| |
| bool | is_empty () const |
| | Check if the container is empty.
|
| |
template<
class T>
class shambase::DistributedDataShared< T >
Container for objects shared between two distributed data elements.
This class manages objects that are associated with pairs of patch identifiers, typically representing interfaces or shared boundaries between computational domains. It uses a multimap to allow multiple objects for the same patch pair (typically for ghost zones with periodic boundaries).
- Template Parameters
-
| T | Type of objects to be stored in the container |
});
std::uint64_t u64
64 bit unsigned integer
Container for objects shared between two distributed data elements.
iterator add_obj(u64 left_id, u64 right_id, T &&obj)
Add an object associated with a patch pair.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
Definition at line 52 of file DistributedDataShared.hpp.
◆ add_obj()
Add an object associated with a patch pair.
- Parameters
-
| left_id | Identifier of the first patch |
| right_id | Identifier of the second patch |
| obj | Object to be associated with the patch pair (moved) |
- Returns
- Iterator pointing to the inserted element
Definition at line 95 of file DistributedDataShared.hpp.
◆ begin() [1/2]
◆ begin() [2/2]
◆ cbegin()
◆ cend()
◆ end() [1/2]
◆ end() [2/2]
◆ for_each() [1/2]
◆ for_each() [2/2]
Apply a function to all stored objects.
- Parameters
-
| f | Function to apply, receives (left_id, right_id, object_reference) |
Definition at line 110 of file DistributedDataShared.hpp.
◆ get_element_count()
Get the total number of objects in the container.
- Returns
- Number of stored objects across all patch pairs
Definition at line 180 of file DistributedDataShared.hpp.
◆ get_native() [1/2]
Get direct access to the underlying multimap container.
- Returns
- Reference to the internal multimap storing patch pair to object mappings
Definition at line 64 of file DistributedDataShared.hpp.
◆ get_native() [2/2]
◆ has_key()
Check if a patch pair exists in the container.
- Parameters
-
| left_id | Identifier of the first patch |
| right_id | Identifier of the second patch |
- Returns
- True if at least one object exists for the given patch pair
Definition at line 171 of file DistributedDataShared.hpp.
◆ is_empty()
Check if the container is empty.
- Returns
- True if no objects are stored in the container
Definition at line 230 of file DistributedDataShared.hpp.
◆ map() [1/2]
◆ map() [2/2]
Transform all objects to a new type using a mapping function.
- Template Parameters
-
| Tmap | Type of the transformed objects |
- Parameters
-
| map_func | Transformation function that takes (left_id, right_id, object_reference) and returns transformed object |
- Returns
- New container with transformed objects maintaining the same patch pair associations
[](
u64 left,
u64 right,
int& value) {
return std::to_string(value);
}
);
DistributedDataShared< Tmap > map(std::function< Tmap(u64, u64, T &)> map_func)
Transform all objects to a new type using a mapping function.
Definition at line 201 of file DistributedDataShared.hpp.
◆ reset()
◆ tranfer_all()
Transfer objects to another container based on a condition.
Moves objects from this container to another container if they satisfy the provided condition function. The objects are removed from this container.
- Parameters
-
| cd | Condition function that takes (left_id, right_id) and returns true for objects to transfer |
| other | Destination container to receive the transferred objects |
void tranfer_all(std::function< bool(u64, u64)> cd, DistributedDataShared &other)
Transfer objects to another container based on a condition.
Definition at line 139 of file DistributedDataShared.hpp.
The documentation for this class was generated from the following file: