COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Classes | Protected Member Functions | Private Attributes | List of all members
CommPattern Class Reference

#include <CommPattern.hpp>

Inherits Component.

Classes

class  dist_struct
 helper struct for setup function More...
 
class  temp_buffer_item
 typedef for the temporary buffer More...
 

Public Types

TYPEDEFS
enum  dist_struct_flags {
  NOFLAGS =0x0, GHOST =0x1, UPDATABLE =0x2, UNUSED =0x4,
  DELETED =0x8, ALLDELETE =0x16
}
 enum for flags in dist_struct More...
 
typedef int CPint
 type of integer to use internally in commpattern, to avoid mess of changing type when mpi allows unsigned ints More...
 
typedef std::vector< temp_buffer_itemtemp_buffer_array
 typedef for the temporary buffer array More...
 
- Public Types inherited from Component
typedef ComponentIterator< Componentiterator
 type of the iterator to Component More...
 
typedef ComponentIterator< Component const > const_iterator
 type of the iterator to constant Component More...
 
- Public Types inherited from SignalHandler
typedef std::vector< SignalPtrstorage_t
 storage type for signals More...
 

Public Member Functions

DATA REGISTRATION
template<typename T >
void insert (const std::string &name, T *&data, const int size, const unsigned int stride=1, const bool needs_update=true)
 
template<typename T >
void insert (const std::string &name, T **data, const int size, const unsigned int stride=1, const bool needs_update=true)
 
template<typename T >
void insert (const std::string &name, std::vector< T > &data, const unsigned int stride=1, const bool needs_update=true)
 
template<typename ValueT , std::size_t NDims>
void insert (const std::string &name, boost::multi_array< ValueT, NDims > &data, const bool needs_update=true)
 
template<typename T >
void insert (const std::string &name, std::vector< T > *data, const unsigned int stride=1, const bool needs_update=true)
 
void clear (const std::string &name)
 removes data by name More...
 
COMMPATTERN HANDLING
void setup (const Handle< CommWrapper > &gid, std::vector< Uint > &rank)
 
void setup (const Handle< CommWrapper > &gid, boost::multi_array< Uint, 1 > &rank)
 
void setup ()
 
void synchronize_all ()
 synchronize the all parallel objects More...
 
void synchronize (const std::string &name)
 
void synchronize (const CommWrapper &pobj)
 
void add_global (Uint gid, Uint rank)
 
Uint add_local (bool as_ghost=false)
 
void move_local (Uint lid, Uint rank, bool keep_as_ghost=true)
 
void remove_local (Uint lid, bool on_all_ranks=false)
 
ACCESSORS
bool isUpToDate () const
 
bool isFreeze () const
 
const Handle< CommWrappergid () const
 
std::vector< bool > & isUpdatable ()
 
int rank (const Uint lid) const
 Return the rank associated with the given local ID. More...
 
- Public Member Functions inherited from Component
 Component (const std::string &name)
 
virtual ~Component ()
 Virtual destructor. More...
 
const std::string & name () const
 Access the name of the component. More...
 
void rename (const std::string &name)
 Rename the component. More...
 
URI uri () const
 Construct the full path. More...
 
void complete_path (URI &path) const
 
Handle< Componentaccess_component (const URI &path) const
 
Handle< Componentaccess_component_checked (const URI &path)
 
Handle< Component const > access_component_checked (const URI &path) const
 
Handle< Componenthandle ()
 Get a handle to the component. More...
 
Handle< Component const > handle () const
 
template<typename ComponentT >
Handle< ComponentT > handle ()
 
template<typename ComponentT >
Handle< ComponentT const > handle () const
 
Handle< Componentparent () const
 
Handle< Component const > root () const
 
Handle< Componentroot ()
 
Handle< Componentget_child (const std::string &name)
 
Handle< Component const > get_child (const std::string &name) const
 
Handle< Componentget_child_checked (const std::string &name)
 
Handle< Component const > get_child_checked (const std::string &name) const
 
Handle< Componentcreate_component (const std::string &name, const std::string &builder)
 Build a (sub)component of this component using the extended type_name of the component. More...
 
template<typename T >
Handle< T > create_component (const std::string &name)
 Create a (sub)component of this component automatically cast to the specified type. More...
 
template<typename T >
Handle< T > create_static_component (const std::string &name)
 Create a static "always there" subcomponent. More...
 
Componentadd_component (const boost::shared_ptr< Component > &subcomp)
 Add the passed component as a subcomponent. More...
 
void add_link (Component &linked_component)
 
boost::shared_ptr< Componentremove_component (const std::string &name)
 Remove a (sub)component of this component. More...
 
boost::shared_ptr< Componentremove_component (Component &subcomp)
 Remove a (sub)component of this component. More...
 
void clear ()
 Remove all sub-components of this component, except for the static ones. More...
 
void move_to (Component &to_parent)
 
std::string tree (bool basic_mode=false, Uint depth=0, Uint recursion_level=0) const
 
std::string info (const std::string &what=std::string("cospt")) const
 
size_t count_children () const
 
virtual std::string derived_type_name () const =0
 
PropertyListproperties ()
 
const PropertyListproperties () const
 
OptionListoptions ()
 
const OptionListoptions () const
 
void reset_options ()
 Reset all options to their default value. More...
 
void configure_option_recursively (const std::string &optname, const boost::any &val)
 
Componentmark_basic ()
 marks this component as basic. More...
 
template<typename ComponentT >
void put_components (std::vector< boost::shared_ptr< ComponentT > > &vec, const bool recurse)
 
template<typename ComponentT >
void put_components (std::vector< boost::shared_ptr< ComponentT const > > &vec, const bool recurse) const
 
template<>
void put_components (std::vector< boost::shared_ptr< Component > > &vec, const bool recurse)
 
template<>
void put_components (std::vector< boost::shared_ptr< Component const > > &vec, const bool recurse) const
 
Component::iterator begin ()
 The begin iterator for a range containing Components. More...
 
Component::iterator end ()
 The end iterator for a range containing Components. More...
 
Component::const_iterator begin () const
 The begin iterator for a range containing Components (const version) More...
 
Component::const_iterator end () const
 The end iterator for a range containing Components (const version) More...
 
Component::iterator recursive_begin ()
 The begin iterator for a recursive range containing Components. More...
 
Component::iterator recursive_end ()
 The end iterator for a recursive range containing Components. More...
 
Component::const_iterator recursive_begin () const
 The begin iterator for a recursive range containing Components (const version) More...
 
Component::const_iterator recursive_end () const
 The end iterator for a recursive range containing Components (const version) More...
 
template<typename T >
Handle< T > create_component (const std::string &name, const std::string &builder)
 Create a component using the reduced builder name. More...
 
void signal_configure (SignalArgs &args)
 configures all the options on this class More...
 
void signal_create_component (SignalArgs &args)
 creates a component from this component More...
 
void signal_delete_component (SignalArgs &args)
 delete this component More...
 
void signal_move_component (SignalArgs &args)
 moves a component from this component to another More...
 
void signal_list_tree (SignalArgs &args) const
 lists the sub components and puts them on the xml_tree More...
 
void signal_list_tree_recursive (SignalArgs &args) const
 prints tree recursively More...
 
void signal_list_properties (SignalArgs &args) const
 lists the properties of this component More...
 
void signal_list_options (SignalArgs &args) const
 lists the properties of this component More...
 
void signal_list_options_recursive (SignalArgs &args) const
 prints all options recursive More...
 
void signal_list_signals (SignalArgs &args) const
 lists the signals of this component More...
 
void signal_list_signals_recursive (SignalArgs &args) const
 prints all signals recursive More...
 
void signal_print_info (SignalArgs &args) const
 gets info on this component More...
 
void signal_print_tree (SignalArgs &args) const
 signal to print the tree More...
 
void signature_print_tree (SignalArgs &args) const
 signature to signal_print_tree More...
 
void signal_rename_component (SignalArgs &args)
 renames this component More...
 
void signal_save_tree (SignalArgs &args)
 dumps the tree to a file More...
 
void signal_list_content (SignalArgs &args)
 gives information about this component such as options, signals, ... More...
 
void signal_signature (SignalArgs &args)
 Gives a signal signature, if any. More...
 
void signature_create_component (SignalArgs &args)
 
void signature_rename_component (SignalArgs &args)
 
void signature_move_component (SignalArgs &args)
 
void signal_store_timings (SignalArgs &args)
 Signal to store the timings (if enabled) into properties, i.e. for readout from python or the GUI. More...
 
void signal_clear (SignalArgs &args)
 Signal to remove all sub-components. More...
 
void signal_reset_options (SignalArgs &args)
 Signal to set all options to their default value. More...
 
void signal_add_tag (SignalArgs &args)
 Signal to add a tag. More...
 
void signature_add_tag (SignalArgs &args)
 
- Public Member Functions inherited from SignalHandler
 ~SignalHandler ()
 
const storage_tsignal_list () const
 
SignalPtr signal (const SignalID &sname)
 
SignalCPtr signal (const SignalID &sname) const
 
SignalRet call_signal (const SignalID &sname, SignalArgs &sinput)
 Calls the signal by providing its name and input. More...
 
SignalRet call_signal (const SignalID &sname, std::vector< std::string > &sinput)
 Calls the signal by providing its name and input. More...
 
bool signal_exists (const SignalID &sname) const
 Checks if a signal exists or not. More...
 
Signalregist_signal (const SignalID &sname)
 Regist signal. More...
 
void unregist_signal (const SignalID &sname)
 Unregist signal. More...
 
- Public Member Functions inherited from ConnectionManager
 ~ConnectionManager ()
 destructor closes all connections More...
 
Connectionconnection (const std::string &name)
 
Connectionmanage_connection (const std::string &name)
 manages a connection (creates if necessary) More...
 
- Public Member Functions inherited from TaggedObject
 TaggedObject ()
 Constructor. More...
 
bool has_tag (const std::string &tag) const
 
void add_tag (const std::string &tag)
 
std::vector< std::string > get_tags () const
 
void remove_tag (const std::string &tag)
 

Protected Member Functions

void synchronize_this (const CommWrapper &pobj, std::vector< unsigned char > &sndbuf, std::vector< unsigned char > &rcvbuf)
 
- Protected Member Functions inherited from Component
Componentadd_static_component (const boost::shared_ptr< Component > &subcomp)
 Add a static (sub)component of this component. More...
 
void raise_tree_updated_event ()
 raise event that the path has changed More...
 

Private Attributes

Handle< CommWrapperm_gid
 explicit shared_ptr to the gid wrapper More...
 
std::vector< bool > m_isUpdatable
 array holding the updatable info More...
 
std::vector< CPintm_sendCount
 this is the process-wise counter of sending communication pattern More...
 
std::vector< CPintm_sendMap
 this is the map of sending communication pattern More...
 
std::vector< CPintm_recvCount
 this is the process-wise counter of receiveing communication pattern More...
 
std::vector< CPintm_recvMap
 this is the map of receiveing communication pattern More...
 
std::vector< int > m_ranks
 Rank for all the gids in local index space. More...
 
PROPERTIES
bool m_isUpToDate
 flag telling if communication pattern is up-to-date (there are no items ) More...
 
bool m_isFreeze
 flag telling if pattern are set not to be allowed to change More...
 
BUFFERS HOLDING TEMPORARY DATA, TILL SETUP IS CALLED
temp_buffer_array m_add_buffer
 
temp_buffer_array m_mov_buffer
 
temp_buffer_array m_rem_buffer
 
std::vector< Uintm_free_lids
 temporary buffer storing the available local ids, which are scattered inside the already existing data More...
 

CONSTRUCTORS, DESTRUCTORS & OTHER BELONGINGS

 CommPattern (const std::string &name)
 
 ~CommPattern ()
 destructor More...
 
static std::string type_name ()
 Get the class name. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Component
static std::string type_name ()
 Get the class name. More...
 
- Public Attributes inherited from SignalHandler
storage_t m_signals
 storage of the signals More...
 

Detailed Description

Todo:

make possible to use compattern on non-registered data

when adding, how to give values to the newly createable elements?

add readonly properties (for example for coordinates, you want to keep it synchronous with commpattern but don't actually want to update it every time)

propagate CPint through mpiwrapper

gid registration: must be more straightforward to check if its really a CFuint single stride data

introduce allocate_component

Definition at line 41 of file CommPattern.hpp.

Member Typedef Documentation

typedef int CPint

type of integer to use internally in commpattern, to avoid mess of changing type when mpi allows unsigned ints

Definition at line 49 of file CommPattern.hpp.

typedef std::vector<temp_buffer_item> temp_buffer_array

typedef for the temporary buffer array

Definition at line 73 of file CommPattern.hpp.

Member Enumeration Documentation

enum for flags in dist_struct

Enumerator
NOFLAGS 
GHOST 
UPDATABLE 
UNUSED 
DELETED 
ALLDELETE 

Definition at line 75 of file CommPattern.hpp.

Constructor & Destructor Documentation

CommPattern ( const std::string &  name)

constructor

Parameters
nameunder this name will the component be registered

destructor

Member Function Documentation

void add_global ( Uint  gid,
Uint  rank 
)

add element to the commpattern when all changes done, all needs to be committed by calling setup if global id is not on current rank, then a ghost is automatically created on current rank if there is no updatable node on rank, an error is thrown

Parameters
gidglobal id
rankrank where given global node is to be updatable
See also
setup for committing changes
Uint add_local ( bool  as_ghost = false)

add element to the commpattern when all changes done, all needs to be committed by calling setup

Parameters
as_ghostdecision if node to be kept on from_rank as ghost
Returns
the local id assigned to the new node. After calling setup, the global id can be looked-up.
See also
setup for committing changes
void clear ( const std::string &  name)
inline

removes data by name

Definition at line 189 of file CommPattern.hpp.

const Handle<CommWrapper> gid ( ) const
inline

accessor to global indexing

Returns
const CommWrapper pointer to the data

Definition at line 278 of file CommPattern.hpp.

void insert ( const std::string &  name,
T *&  data,
const int  size,
const unsigned int  stride = 1,
const bool  needs_update = true 
)
inline

register data coming from naked pointer by reference

Parameters
namethe component will appear under this name
datapointer to data
sizelength of the data
stridenumber of array element grouping

Definition at line 139 of file CommPattern.hpp.

void insert ( const std::string &  name,
T **  data,
const int  size,
const unsigned int  stride = 1,
const bool  needs_update = true 
)
inline

register data coming from pointer to naked pointer

Parameters
namethe component will appear under this name
datapointer to data
sizelength of the data
stridenumber of array element grouping

Definition at line 150 of file CommPattern.hpp.

void insert ( const std::string &  name,
std::vector< T > &  data,
const unsigned int  stride = 1,
const bool  needs_update = true 
)
inline

register data coming from std::vector by reference

Parameters
namethe component will appear under this name
pointerto std::vector of data
stridenumber of array element grouping

Definition at line 160 of file CommPattern.hpp.

void insert ( const std::string &  name,
boost::multi_array< ValueT, NDims > &  data,
const bool  needs_update = true 
)
inline

register data coming from multiarrays by reference

Parameters
namethe component will appear under this name
dataMultiarray holding the data (not copied)
stridenumber of array element grouping

Definition at line 171 of file CommPattern.hpp.

void insert ( const std::string &  name,
std::vector< T > *  data,
const unsigned int  stride = 1,
const bool  needs_update = true 
)
inline

register data coming from pointer to std::vector

Parameters
namethe component will appear under this name
pointerto std::vector of data
stridenumber of array element grouping

Definition at line 182 of file CommPattern.hpp.

bool isFreeze ( ) const
inline

accessor to check if compattern is frozen or not

Returns
true or false, respectively

Definition at line 274 of file CommPattern.hpp.

std::vector<bool>& isUpdatable ( )
inline

accessor to the m_isUpdatable vector

Returns
vector of bools

Definition at line 282 of file CommPattern.hpp.

bool isUpToDate ( ) const
inline

accessor to check if setup is needed to call or not

Returns
true or false, respectively

Definition at line 270 of file CommPattern.hpp.

void move_local ( Uint  lid,
Uint  rank,
bool  keep_as_ghost = true 
)

move element along partitions when all changes done, all needs to be committed by calling setup

Parameters
lidlocal id
rankrank where the node is expected to be updatable
keep_as_ghostdecision if node to be kept on from_rank as ghost
See also
setup for committing changes
int rank ( const Uint  lid) const
inline

Return the rank associated with the given local ID.

Definition at line 285 of file CommPattern.hpp.

void remove_local ( Uint  lid,
bool  on_all_ranks = false 
)

delete element from the commpattern when all changes done, all needs to be committed by calling setup

Parameters
lidlocal id
on_all_ranksforce delete on all processes if true. If its false then depends if node is ghost or updatable on rank and deletes only on this rank or all ranks respectively.
See also
setup for committing changes
void setup ( const Handle< CommWrapper > &  gid,
std::vector< Uint > &  rank 
)

build and/or modify communication pattern - add nodes this function sets actually up the communication pattern beware: interprocess communication heavy this overload of setup is designed for making no callback functions, so all the registered data should match the size of current size + number of additions

Parameters
gidCommWrapper to a Uint tpye of data array
rankvector of ranks where given global ids are updatable to add
void setup ( const Handle< CommWrapper > &  gid,
boost::multi_array< Uint, 1 > &  rank 
)

build and/or modify communication pattern - add nodes this function sets actually up the communication pattern beware: interprocess communication heavy this overload of setup is designed for making no callback functions, so all the registered data should match the size of current size + number of additions

Parameters
gidCommWrapper to a Uint tpye of data array
rankvector of ranks where given global ids are updatable to add
void setup ( )

build and/or modify communication pattern - only incorporate actual buffers this function sets actually up the communication pattern beware: interprocess communication heavy

void synchronize ( const std::string &  name)

synchronize the parallel object designated by its name

Parameters
namethe name of the parallel object
void synchronize ( const CommWrapper pobj)

synchronize the parallel object designated by its commwrapper reference

Parameters
namethe name of the parallel object
void synchronize_all ( )

synchronize the all parallel objects

void synchronize_this ( const CommWrapper pobj,
std::vector< unsigned char > &  sndbuf,
std::vector< unsigned char > &  rcvbuf 
)
protected

function to synchronize this object useful for reusing in the different synchronize functions

Parameters
pobjreference to commwrapper object to synchronize to
sndbufvector for intermediate buffer for send
rcvbufvector for intermediate buffer for recieve
static std::string type_name ( )
inlinestatic

Get the class name.

Definition at line 127 of file CommPattern.hpp.

Member Data Documentation

temp_buffer_array m_add_buffer
private

temporary buffer of add id is global id

Definition at line 316 of file CommPattern.hpp.

std::vector<Uint> m_free_lids
private

temporary buffer storing the available local ids, which are scattered inside the already existing data

Definition at line 327 of file CommPattern.hpp.

Handle<CommWrapper> m_gid
private

explicit shared_ptr to the gid wrapper

Definition at line 332 of file CommPattern.hpp.

bool m_isFreeze
private

flag telling if pattern are set not to be allowed to change

Definition at line 307 of file CommPattern.hpp.

std::vector<bool> m_isUpdatable
private

array holding the updatable info

Definition at line 335 of file CommPattern.hpp.

bool m_isUpToDate
private

flag telling if communication pattern is up-to-date (there are no items )

Definition at line 304 of file CommPattern.hpp.

temp_buffer_array m_mov_buffer
private

temporary buffer of move id is local id

Definition at line 320 of file CommPattern.hpp.

std::vector<int> m_ranks
private

Rank for all the gids in local index space.

Definition at line 350 of file CommPattern.hpp.

std::vector< CPint > m_recvCount
private

this is the process-wise counter of receiveing communication pattern

Definition at line 344 of file CommPattern.hpp.

std::vector< CPint > m_recvMap
private

this is the map of receiveing communication pattern

Definition at line 347 of file CommPattern.hpp.

temp_buffer_array m_rem_buffer
private

temporary buffer of remove id is local id

Definition at line 324 of file CommPattern.hpp.

std::vector< CPint > m_sendCount
private

this is the process-wise counter of sending communication pattern

Definition at line 338 of file CommPattern.hpp.

std::vector< CPint > m_sendMap
private

this is the map of sending communication pattern

Definition at line 341 of file CommPattern.hpp.


The documentation for this class was generated from the following file:
Send comments to:
COOLFluiD Web Admin