31 #ifndef __ROCCOM_WINDOW_H__
32 #define __ROCCOM_WINDOW_H__
43 typedef std::map< std::string, Function>
Func_map;
44 typedef std::map< std::string, Attribute*>
Attr_map;
91 const std::string &
name()
const {
return _name; }
104 const std::string &intents,
111 Member_func_ptr func,
112 const std::
string &intents,
115 bool if_f90=false) throw(COM_exception);
125 const
int type,
int ncomp,
126 const std::
string &unit) throw(COM_exception);
137 void set_size( const std::
string &aname,
int pane_id,
138 int nitems,
int ng=0) throw( COM_exception);
148 void set_array( const std::
string &aname, const
int pane_id,
149 void *addr,
int strd=0,
int cap=0,
bool is_const=false)
150 throw(COM_exception);
156 void alloc_array( const std::
string &aname, const
int pane_id,
157 void **addr,
int strd=0,
int cap=0) throw(COM_exception);
163 void resize_array( const std::
string &aname, const
int pane_id,
164 void **addr,
int strd=-1,
int cap=0) throw(COM_exception);
167 int strd=-1,
int cap=0) throw(COM_exception)
178 void append_array(
const std::string &aname,
const int pane_id,
179 const void *val,
int v_strd,
int v_size)
throw(
COM_exception);
203 int inherit_mode,
bool withghost,
209 inherit( const_cast<Attribute*>(from), to->name(),
229 void get_size(
const std::string &aname,
int pane_id,
235 int get_status(
const std::string &aname,
int pane_id)
const
241 void get_parent(
const std::string &aname,
int pane_id,
252 void get_array(
const std::string &aname,
const int pane_id,
253 Pointer_descriptor &addr,
254 int *strd=NULL,
int *cap=NULL,
bool is_const=
false)
268 void copy_array( const std::
string &aname, const
int pane_id,
269 void *val,
int v_strd=0,
int v_size=0,
270 int offset=0) const throw(COM_exception);
273 void init_done(
bool pane_changed=true) throw(COM_exception);
302 Pane_map::iterator it =
_pane_map.find( pane_id);
314 Pane &
pane(
const int pane_id,
bool insert=
false) throw(COM_exception);
316 const
Pane &
pane( const
int pane_id) const throw(COM_exception);
319 void panes( std::vector<
int> &ps,
int rank=-2);
325 {
const_cast<Window*
>(
this)->
panes( (std::vector<Pane*> &)ps); }
346 Function *
function(
const std::string &f);
347 const Function *
function(
const std::string &f)
const
348 {
return const_cast<Window*
>(
this)->
function( f); }
362 int strd=0,
int cap=0) throw(COM_exception);
374 int strd=0,
int cap=0) throw(COM_exception);
int COM_Type
Indices for derived data types.
A Pane object contains a mesh, pane attribute, and field variables.
void delete_attribute(const std::string &aname)
Delete an existing Attribute object.
void alloc_array(const std::string &aname, const int pane_id, void **addr, int strd=0, int cap=0)
Allocate memory for an attribute for a specific pane and set addr to the address. ...
A Function object corresponds to a function member of a window.
void dealloc_array(Connectivity *c)
int _last_id
The last used attribute index.
void resize_array(Connectivity *c, void **addr, int strd=-1, int cap=0)
Contains the prototypes for the Pane object.
An Attribute object is a data member of a window.
int get_status(const std::string &aname, int pane_id) const
Get the status of an attribute or pane.
void set_array(const std::string &aname, const int pane_id, void *addr, int strd=0, int cap=0, bool is_const=false)
Associate an array with an attribute for a specific pane.
void copy_array(const std::string &aname, const int pane_id, void *val, int v_strd=0, int v_size=0, int offset=0) const
Copy an attribute on a specific pane into a given array.
void get_size(const std::string &aname, int pane_id, int *nitems, int *ng) const
Get the sizes of an attribute for a specific pane.
int _status
Status of the window.
void reinit_conn(Connectivity *con, OP_Init op, int **addr, int strd, int cap)
A Window object contains multiple panes and multiple data attributes.
const Attribute * attribute(const std::string &a) const
void set_size(Attribute *a, int nitems, int ng)
Set the size of an attribute.
std::map< std::string, Attribute * > Attr_map
std::map< int, Pane * > Pane_map
void delete_attribute(int id)
Delete an existing attribute with given id.
const std::string & name() const
Obtain the window's name.
real *8 function offset(vNorm, x2, y2, z2)
void resize_array(const std::string &aname, const int pane_id, void **addr, int strd=-1, int cap=0)
Resize memory for an attribute for a specific pane and set addr to the address.
Window & operator=(const Window &)
MPI_Comm _comm
the MPI communicator of the window.
Encapsulates the states of an exception.
Attribute * attribute(const std::string &a)
Obtain the attribute from given name.
void attributes(std::vector< Attribute * > &as)
Obtain all the attributes of the pane.
void copy_attribute(const Attribute *from, Attribute *to)
Copy an attribute object onto another.
void get_array(const std::string &aname, const int pane_id, Pointer_descriptor &addr, int *strd=NULL, int *cap=NULL, bool is_const=false)
Get the address associated with an attribute for a specific pane.
Attribute * get_attribute(const std::string &aname, char *l, int *t, int *n, std::string *u) const
Get the meta-information about an attribute.
void reinit_conn(Connectivity *con, OP_Init op, int **addr=NULL, int strd=0, int cap=0)
Template implementation for setting (op==OP_SET or OP_SET_CONST), allocating (op==OP_ALLOC), resizing (op==OP_RESIZE) and deallocating (op==OP_DEALLOC) an array for a specific connectivity table.
Proc_map _proc_map
Map from pane ID to process ranks.
Attr_map _attr_map
Map from attribute names to their metadata.
void attributes(std::vector< const Attribute * > &as) const
Obtain all the attributes of the pane.
void delete_pane(const int pane_id)
Remove the pane with given ID.
Attribute * new_attribute(const std::string &aname, const char loc, const int type, int ncomp, const std::string &unit)
Create a new Attribute object with given properties.
MPI_Comm get_communicator() const
Obtain the communicator of the window.
void(* Func_ptr)()
Pointer of functions.
int size_of_panes_global() const
Obtain the total number of panes in the window on all processes.
Pointer_descriptor(void *p, int d=-1)
void reinit_attr(int aid, OP_Init op, void **addr, int strd, int cap)
Window(const std::string &name, MPI_Comm c)
Create a window with a given name and MPI communicator.
void init_done(bool pane_changed=true)
Perform some final checking of the window.
void dealloc_array(const std::string &aname, const int pane_id=0)
Deallocate memory for an attribute for a specific pane if allocated by Roccom.
void reinit_attr(Attribute *attr, OP_Init op, void **addr=NULL, int strd=0, int cap=0)
Implementation for setting (op==OP_SET or OP_SET_CONST), allocating (op==OP_ALLOC), resizing (op==OP_RESIZE) and deallocating (op==OP_DEALLOC) an array for a specific attribute.
void get_parent(const std::string &aname, int pane_id, std::string &name) const
Get the parent name of an attribute and load into name.
int owner_rank(const int pane_id) const
Obtain the process rank that owns a given pane.
int size_of_panes() const
Obtain the number of local panes in the window.
std::map< std::string, Function > Func_map
std::string _name
Name of the window.
const Proc_map & proc_map() const
Obtain the process map.
void append_array(const std::string &aname, const int pane_id, const void *val, int v_strd, int v_size)
Append the given array to the end of the attribute on a specific pane, and reallocate memory for the ...
Attribute * attribute(const std::string &a)
Obtain a pointer to the attribute metadata from its name.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
int last_attribute_id() const
Return the last attribute id.
std::map< int, int > Proc_map
Contains the prototypes and implementation for the Funcion object.
Connectivity * connectivity(Size i)
Obtain the connectivity table containing the element with the given ID.
void set_size(const std::string &aname, int pane_id, int nitems, int ng=0)
Set the sizes of an attribute for a specific pane.
Func_map _func_map
Map from function names to their metadata.
const Attribute * attribute(int i) const
Attribute * new_attribute(const std::string &aname, int aid, const char loc, const int type, int ncomp, const std::string &unit)
Attribute * inherit(Attribute *from, const std::string &aname, int mode, bool withghost)
Inherit an attribute from another pane onto the current pane:
virtual ~Window()
Destructor.
Pane_map _pane_map
Map from pane ID to their metadata.
Attribute * attribute(int i)
Obtain a pointer to the attribute metadata from its index.
void attributes(std::vector< Attribute * > &as)
Obtain all the attributes of the pane.
void panes(std::vector< int > &ps, int rank=-2)
Obtain all the local panes of the window.
Attribute * inherit(Attribute *from, const std::string &aname, int inherit_mode, bool withghost, const Attribute *cond, int val)
Inherit the attributes of another window with a different name.
Encapsulates an element-connectivity of a mesh.
void set_function(const std::string &fname, Func_ptr func, const std::string &intents, const COM_Type *types, Attribute *a, bool if_f90=false)
Initialize a Function record.