Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Window Class Reference

A Window object contains multiple panes and multiple data attributes. More...

#include <Window.h>

Collaboration diagram for Window:

Classes

class  Pane_friend
 
struct  Pointer_descriptor
 

Public Types

typedef std::map< int, int > Proc_map
 

Public Member Functions

Constructor and destructor
 Window (const std::string &name, MPI_Comm c)
 Create a window with a given name and MPI communicator. More...
 
virtual ~Window ()
 Destructor. More...
 
Identity
const std::string & name () const
 Obtain the window's name. More...
 
MPI_Comm get_communicator () const
 Obtain the communicator of the window. More...
 
Function and data management
void set_function (const std::string &fname, Func_ptr func, const std::string &intents, const COM_Type *types, Attribute *a, bool if_f90=false) throw (COM_exception)
 Initialize a Function record. More...
 
void set_function (const std::string &fname, Member_func_ptr func, const std::string &intents, const COM_Type *types, Attribute *a, bool if_f90=false) throw (COM_exception)
 Initialize a Function record. More...
 
Attributenew_attribute (const std::string &aname, const char loc, const int type, int ncomp, const std::string &unit) throw (COM_exception)
 Create a new Attribute object with given properties. More...
 
void delete_attribute (const std::string &aname) throw (COM_exception)
 Delete an existing Attribute object. More...
 
void set_size (const std::string &aname, int pane_id, int nitems, int ng=0) throw ( COM_exception)
 Set the sizes of an attribute for a specific pane. More...
 
void set_array (const std::string &aname, const int pane_id, void *addr, int strd=0, int cap=0, bool is_const=false) throw (COM_exception)
 Associate an array with an attribute for a specific pane. More...
 
void alloc_array (const std::string &aname, const int pane_id, void **addr, int strd=0, int cap=0) throw (COM_exception)
 Allocate memory for an attribute for a specific pane and set addr to the address. More...
 
void resize_array (const std::string &aname, const int pane_id, void **addr, int strd=-1, int cap=0) throw (COM_exception)
 Resize memory for an attribute for a specific pane and set addr to the address. More...
 
void resize_array (Attribute *a, void **addr, int strd=-1, int cap=0) throw (COM_exception)
 
void resize_array (Connectivity *c, void **addr, int strd=-1, int cap=0) throw (COM_exception)
 
void append_array (const std::string &aname, const int pane_id, const void *val, int v_strd, int v_size) throw (COM_exception)
 Append the given array to the end of the attribute on a specific pane, and reallocate memory for the attribute if necessary. More...
 
void dealloc_array (const std::string &aname, const int pane_id=0) throw (COM_exception)
 Deallocate memory for an attribute for a specific pane if allocated by Roccom. More...
 
void dealloc_array (Attribute *a) throw (COM_exception)
 
void dealloc_array (Connectivity *c) throw (COM_exception)
 
Attributeinherit (Attribute *from, const std::string &aname, int inherit_mode, bool withghost, const Attribute *cond, int val) throw (COM_exception)
 Inherit the attributes of another window with a different name. More...
 
void copy_attribute (const Attribute *from, Attribute *to) throw (COM_exception)
 Copy an attribute object onto another. More...
 
Attributeget_attribute (const std::string &aname, char *l, int *t, int *n, std::string *u) const throw (COM_exception)
 Get the meta-information about an attribute. More...
 
void get_size (const std::string &aname, int pane_id, int *nitems, int *ng) const throw ( COM_exception)
 Get the sizes of an attribute for a specific pane. More...
 
int get_status (const std::string &aname, int pane_id) const throw (COM_exception)
 Get the status of an attribute or pane. More...
 
void get_parent (const std::string &aname, int pane_id, std::string &name) const throw (COM_exception)
 Get the parent name of an attribute and load into name. More...
 
void get_array (const std::string &aname, const int pane_id, Pointer_descriptor &addr, int *strd=NULL, int *cap=NULL, bool is_const=false) throw (COM_exception)
 Get the address associated with an attribute for a specific pane. More...
 
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 throw (COM_exception)
 Copy an attribute on a specific pane into a given array. More...
 
void init_done (bool pane_changed=true) throw (COM_exception)
 Perform some final checking of the window. More...
 
Pane management
int size_of_panes () const
 Obtain the number of local panes in the window. More...
 
int size_of_panes_global () const
 Obtain the total number of panes in the window on all processes. More...
 
int owner_rank (const int pane_id) const
 Obtain the process rank that owns a given pane. More...
 
int last_attribute_id () const
 Return the last attribute id. More...
 
const Proc_mapproc_map () const
 Obtain the process map. More...
 
void delete_pane (const int pane_id) throw (COM_exception)
 Remove the pane with given ID. More...
 
Miscellaneous
Panepane (const int pane_id, bool insert=false) throw (COM_exception)
 Find the pane with given ID. If not found, insert a pane with given ID. More...
 
const Panepane (const int pane_id) const throw (COM_exception)
 
void panes (std::vector< int > &ps, int rank=-2)
 Obtain all the local panes of the window. More...
 
void panes (std::vector< Pane * > &ps)
 Obtain all the local panes of the window. More...
 
void panes (std::vector< const Pane * > &ps) const
 Obtain all the local panes of the window. More...
 
void attributes (std::vector< Attribute * > &as)
 Obtain all the attributes of the pane. More...
 
void attributes (std::vector< const Attribute * > &as) const
 Obtain all the attributes of the pane. More...
 
Attributeattribute (const std::string &a) throw (COM_exception)
 Obtain a pointer to the attribute metadata from its name. More...
 
const Attributeattribute (const std::string &a) const throw (COM_exception)
 
Attributeattribute (int i) throw (COM_exception)
 Obtain a pointer to the attribute metadata from its index. More...
 
const Attributeattribute (int i) const throw (COM_exception)
 
Functionfunction (const std::string &f)
 Obtain the function pointer from its name. More...
 
const Functionfunction (const std::string &f) const
 

Protected Types

enum  { STATUS_SHRUNK, STATUS_CHANGED, STATUS_NOCHANGE }
 

Protected Member Functions

void reinit_attr (Attribute *attr, OP_Init op, void **addr=NULL, int strd=0, int cap=0) throw (COM_exception)
 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. More...
 
void reinit_conn (Connectivity *con, OP_Init op, int **addr=NULL, int strd=0, int cap=0) throw (COM_exception)
 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. More...
 

Protected Attributes

Pane _dummy
 Dummy pane. More...
 
std::string _name
 Name of the window. More...
 
Attr_map _attr_map
 Map from attribute names to their metadata. More...
 
Func_map _func_map
 Map from function names to their metadata. More...
 
Pane_map _pane_map
 Map from pane ID to their metadata. More...
 
Proc_map _proc_map
 Map from pane ID to process ranks. More...
 
int _last_id
 The last used attribute index. More...
 
MPI_Comm _comm
 the MPI communicator of the window. More...
 
int _status
 Status of the window. More...
 

Private Types

typedef std::map< std::string,
Function
Func_map
 
typedef std::map< std::string,
Attribute * > 
Attr_map
 
typedef std::map< int, Pane * > Pane_map
 
typedef Pane::OP_Init OP_Init
 

Private Member Functions

 Window (const Window &)
 
Windowoperator= (const Window &)
 

Detailed Description

A Window object contains multiple panes and multiple data attributes.

Definition at line 42 of file Window.h.

Member Typedef Documentation

typedef std::map< std::string, Attribute*> Attr_map
private

Definition at line 44 of file Window.h.

typedef std::map< std::string, Function> Func_map
private

Definition at line 43 of file Window.h.

typedef Pane::OP_Init OP_Init
private

Definition at line 58 of file Window.h.

typedef std::map< int, Pane*> Pane_map
private

Definition at line 45 of file Window.h.

typedef std::map<int,int> Proc_map

Definition at line 61 of file Window.h.

Member Enumeration Documentation

anonymous enum
protected
Enumerator
STATUS_SHRUNK 
STATUS_CHANGED 
STATUS_NOCHANGE 

Definition at line 388 of file Window.h.

Constructor & Destructor Documentation

COM_BEGIN_NAME_SPACE Window ( const std::string &  name,
MPI_Comm  c 
)

Create a window with a given name and MPI communicator.

Parameters
namename of the window
cMPI communicator where the window resides

Definition at line 42 of file Window.C.

References _attr_map, _dummy, Pane::attribute(), COM_NUM_KEYWORDS, i, Attribute::is_digit(), and Attribute::name().

43  : _dummy( this, 0), _name( s), _last_id(COM_NUM_KEYWORDS),
45 {
46  // Insert keywords into _attr_map
47  for ( int i=0; i<COM_NUM_KEYWORDS; ++i) {
49  if ( !Attribute::is_digit(a->name()[0])) _attr_map[ a->name()] = a;
50  }
51 }
int _last_id
The last used attribute index.
Definition: Window.h:385
An Attribute object is a data member of a window.
Definition: Attribute.h:51
static bool is_digit(char c)
Definition: Attribute.h:264
double s
Definition: blastest.C:80
int _status
Status of the window.
Definition: Window.h:389
MPI_Comm _comm
the MPI communicator of the window.
Definition: Window.h:387
Attribute * attribute(const std::string &a)
Obtain the attribute from given name.
Definition: Pane.C:148
Attr_map _attr_map
Map from attribute names to their metadata.
Definition: Window.h:379
const std::string & name() const
Obtain the name of the attribute.
Definition: Attribute.h:113
blockLoc i
Definition: read.cpp:79
std::string _name
Name of the window.
Definition: Window.h:378
Pane _dummy
Dummy pane.
Definition: Window.h:377

Here is the call graph for this function:

~Window ( )
virtual

Destructor.

Definition at line 53 of file Window.C.

References _pane_map.

54 {
55  for ( Pane_map::iterator it=_pane_map.begin(); it!=_pane_map.end(); ++it)
56  delete it->second;
57 }
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382
Window ( const Window )
private

Member Function Documentation

void alloc_array ( const std::string &  aname,
const int  pane_id,
void **  addr,
int  strd = 0,
int  cap = 0 
)
throw (COM_exception
)

Allocate memory for an attribute for a specific pane and set addr to the address.

alloc_array, resize_array, append_array

Definition at line 238 of file Window.C.

References append_frame, COM_ERR_ATTRIBUTE_NOTEXIST, Connectivity::is_element_name(), and Pane::OP_ALLOC.

240 {
241  if ( Connectivity::is_element_name( aname)) {
242  Pane &pn = pane(pane_id,true);
243  Connectivity *con = ((Pane_friend&)pn).connectivity( aname);
244 
245  if ( con==NULL)
247  (name()+"."+aname,Window::alloc_array));
248 
249  reinit_conn( con, Pane::OP_ALLOC, (int**)addr, strd, cap);
250  }
251  else {
252  Attribute *a = pane( pane_id,true).attribute( aname);
253 
254  if ( a==NULL)
256  (name()+"."+aname,Window::alloc_array));
257  reinit_attr( a, Pane::OP_ALLOC, addr, strd, cap);
258  }
259 }
A Pane object contains a mesh, pane attribute, and field variables.
Definition: Pane.h:43
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. ...
Definition: Window.C:238
An Attribute object is a data member of a window.
Definition: Attribute.h:51
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
Encapsulates the states of an exception.
Attribute * attribute(const std::string &a)
Obtain the attribute from given name.
Definition: Pane.C:148
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.
Definition: Window.C:747
static bool is_element_name(const std::string &aname)
Definition: Connectivity.h:228
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.
Definition: Window.C:717
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769
Encapsulates an element-connectivity of a mesh.
Definition: Connectivity.h:41

Here is the call graph for this function:

void append_array ( const std::string &  aname,
const int  pane_id,
const void *  val,
int  v_strd,
int  v_size 
)
throw (COM_exception
)

Append the given array to the end of the attribute on a specific pane, and reallocate memory for the attribute if necessary.

set_array, alloc_array, resize_array

Definition at line 284 of file Window.C.

References Attribute::append_array(), append_frame, COM_assertion_msg, COM_ERR_ATTRIBUTE_NOTEXIST, Connectivity::is_element_name(), COM_exception::msg, Pane::OP_RESIZE, Attribute::set_size(), Attribute::size_of_items(), Attribute::size_set(), and Attribute::stride().

286 {
288  "append_array supports only window and pane attributes");
289 
290  Attribute *a = pane( pane_id,true).attribute( aname);
291 
292  if ( a==NULL)
294  (name()+"."+aname,Window::append_array));
295  try {
296  // Set size to 0 if not yet set.
297  if ( !a->size_set()) a->set_size(0);
298  // resize the target attribute.
299  reinit_attr( a, Pane::OP_RESIZE, NULL, a->stride(),
300  a->size_of_items()+v_size);
301  }
302  catch ( COM_exception ex) {
304  throw ex;
305  }
306 
307  // copy the array to the back of the target array
308  a->append_array( val, v_strd, v_size);
309 }
bool size_set() const
Returns whether the size for the attribute has been set.
Definition: Attribute.C:99
An Attribute object is a data member of a window.
Definition: Attribute.h:51
#define COM_assertion_msg(EX, msg)
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
Encapsulates the states of an exception.
Attribute * attribute(const std::string &a)
Obtain the attribute from given name.
Definition: Pane.C:148
std::string msg
Error message.
static bool is_element_name(const std::string &aname)
Definition: Connectivity.h:228
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.
Definition: Window.C:717
int stride() const
Obtain the stride of the attribute in base datatype.
Definition: Attribute.h:233
void set_size(int nitems, int ngitems=0)
Set the size of items and ghost items.
Definition: Attribute.C:191
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 ...
Definition: Window.C:284
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769
int size_of_items() const
Obtain the number of items in the attribute.
Definition: Attribute.C:111
void append_array(const void *from, int strd, int nitem)
Definition: Attribute.C:334

Here is the call graph for this function:

Attribute * attribute ( const std::string &  a)
throw (COM_exception
)

Obtain a pointer to the attribute metadata from its name.

Definition at line 842 of file Window.C.

References append_frame, COM_ERR_INVALID_ATTRIBUTE_NAME, i, Attribute::id(), Attribute::is_digit(), and Attribute::size_of_components().

Referenced by Pane::attribute(), and attribute().

843 {
844  if ( !Attribute::is_digit(aname[0])) {
845  Attr_map::iterator it = _attr_map.find( aname);
846  if ( it == _attr_map.end())
847  return NULL;
848  else
849  return it->second;
850  }
851  else {
852  std::string::size_type start = aname.find( '-');
853  if ( start == aname.npos)
855  (_name+"."+aname,Window::attribute));
856 
857  Attr_map::iterator it = _attr_map.find( &aname[start+1]);
858 
859  if ( it != _attr_map.end()) {
860  Attribute *att = it->second;
861  if ( att->size_of_components()>1) {
862  // Get the subcomponent
863  int i = std::atoi( aname.c_str());
864 
865  if ( i<=0 || i>att->size_of_components())
867  (_name+"."+aname,Window::attribute));
868  return attribute( att->id()+i);
869  }
870  }
871 
872  return NULL;
873  }
874 }
An Attribute object is a data member of a window.
Definition: Attribute.h:51
static bool is_digit(char c)
Definition: Attribute.h:264
Encapsulates the states of an exception.
Attr_map _attr_map
Map from attribute names to their metadata.
Definition: Window.h:379
blockLoc i
Definition: read.cpp:79
std::string _name
Name of the window.
Definition: Window.h:378
Attribute * attribute(const std::string &a)
Obtain a pointer to the attribute metadata from its name.
Definition: Window.C:842
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
int id() const
Obtain the id (or index) of the attribute.
Definition: Attribute.h:120
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

Here is the caller graph for this function:

const Attribute* attribute ( const std::string &  a) const
throw (COM_exception
)
inline

Definition at line 336 of file Window.h.

References attribute().

337  { return const_cast<Window*>(this)->attribute( a); }
A Window object contains multiple panes and multiple data attributes.
Definition: Window.h:42
Attribute * attribute(const std::string &a)
Obtain a pointer to the attribute metadata from its name.
Definition: Window.C:842

Here is the call graph for this function:

Attribute* attribute ( int  i)
throw (COM_exception
)
inline

Obtain a pointer to the attribute metadata from its index.

Definition at line 340 of file Window.h.

References _dummy, Pane::attribute(), and i.

341  { return _dummy.attribute( i); }
Attribute * attribute(const std::string &a)
Obtain the attribute from given name.
Definition: Pane.C:148
blockLoc i
Definition: read.cpp:79
Pane _dummy
Dummy pane.
Definition: Window.h:377

Here is the call graph for this function:

const Attribute* attribute ( int  i) const
throw (COM_exception
)
inline

Definition at line 342 of file Window.h.

References _dummy, Pane::attribute(), and i.

343  { return _dummy.attribute( i); }
Attribute * attribute(const std::string &a)
Obtain the attribute from given name.
Definition: Pane.C:148
blockLoc i
Definition: read.cpp:79
Pane _dummy
Dummy pane.
Definition: Window.h:377

Here is the call graph for this function:

void attributes ( std::vector< Attribute * > &  as)
inline

Obtain all the attributes of the pane.

Definition at line 328 of file Window.h.

References _dummy, and Pane::attributes().

Referenced by Rocblas::copy(), Rocblas::rand(), and Rocblas::swap().

329  { _dummy.attributes( as); }
Pane _dummy
Dummy pane.
Definition: Window.h:377
void attributes(std::vector< Attribute * > &as)
Obtain all the attributes of the pane.
Definition: Pane.C:165

Here is the call graph for this function:

Here is the caller graph for this function:

void attributes ( std::vector< const Attribute * > &  as) const
inline

Obtain all the attributes of the pane.

Definition at line 331 of file Window.h.

References _dummy, and Pane::attributes().

332  { _dummy.attributes( as); }
Pane _dummy
Dummy pane.
Definition: Window.h:377
void attributes(std::vector< Attribute * > &as)
Obtain all the attributes of the pane.
Definition: Pane.C:165

Here is the call graph for this function:

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
throw (COM_exception
)

Copy an attribute on a specific pane into a given array.

Parameters
anameattribute name
pane_idpane ID
valaddress of the user array
v_strdstride of user array. 0 (the default) indicates number of components.
v_sizenumber of items to be copied. 0 (the default) indicates number of items of the attribute.
offsetstarting item to be copied in the attribute. alloc_array, resize_array, get_array

Definition at line 685 of file Window.C.

References append_frame, Pane::attribute(), COM_ERR_ATTRIBUTE_NOTEXIST, Pane::connectivity(), copy_array_common(), Connectivity::is_element_name(), COM_exception::msg, and offset().

688 {
689  const Pane_friend *pn;
690  try { pn = &(Pane_friend&)pane(pane_id); }
691  catch ( COM_exception ex) {
693  throw ex;
694  }
695 
696  if ( Connectivity::is_element_name( aname)) {
697  const Connectivity *conn = pn->connectivity( aname);
698  if ( conn == NULL)
700  (name()+"."+aname, Window::copy_array));
701 
702  copy_array_common( conn, pane_id,
703  val, v_strd, v_size, offset);
704  }
705  else {
706  const Attribute *attr = pn->attribute( aname);
707  if ( attr == NULL)
709  (name()+"."+aname, Window::copy_array));
710 
711  copy_array_common( attr, pane_id,
712  val, v_strd, v_size, offset);
713  }
714 }
An Attribute object is a data member of a window.
Definition: Attribute.h:51
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.
Definition: Window.C:685
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
real *8 function offset(vNorm, x2, y2, z2)
Definition: PlaneNorm.f90:211
Encapsulates the states of an exception.
std::string msg
Error message.
void copy_array_common(const Attr *a, int pid, void *val, int v_strd, int v_size, int offset)
Definition: Window.C:674
static bool is_element_name(const std::string &aname)
Definition: Connectivity.h:228
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769
Encapsulates an element-connectivity of a mesh.
Definition: Connectivity.h:41

Here is the call graph for this function:

void copy_attribute ( const Attribute from,
Attribute to 
)
throw (COM_exception
)
inline

Copy an attribute object onto another.

Definition at line 207 of file Window.h.

References inherit(), and Pane::INHERIT_COPY.

208  {
209  inherit( const_cast<Attribute*>(from), to->name(),
210  Pane::INHERIT_COPY, true, NULL, 0);
211  }
const std::string & name() const
Obtain the name of the attribute.
Definition: Attribute.h:113
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.
Definition: Window.C:334

Here is the call graph for this function:

void dealloc_array ( const std::string &  aname,
const int  pane_id = 0 
)
throw (COM_exception
)

Deallocate memory for an attribute for a specific pane if allocated by Roccom.

alloc_array, resize_array

Definition at line 311 of file Window.C.

References append_frame, COM_ERR_ATTRIBUTE_NOTEXIST, Connectivity::is_element_name(), and Pane::OP_DEALLOC.

313 {
314  if ( Connectivity::is_element_name( aname)) {
315  Pane &pn = pane(pane_id);
316  Connectivity *con = ((Pane_friend&)pn).connectivity( aname);
317 
318  if ( con==NULL)
320  (name()+"."+aname,Window::dealloc_array));
321 
323  }
324  else {
325  Attribute *a = pane( pane_id).attribute( aname);
326 
327  if ( a==NULL)
329  (name()+"."+aname,Window::dealloc_array));
331  }
332 }
A Pane object contains a mesh, pane attribute, and field variables.
Definition: Pane.h:43
An Attribute object is a data member of a window.
Definition: Attribute.h:51
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
Encapsulates the states of an exception.
Attribute * attribute(const std::string &a)
Obtain the attribute from given name.
Definition: Pane.C:148
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.
Definition: Window.C:747
static bool is_element_name(const std::string &aname)
Definition: Connectivity.h:228
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.
Definition: Window.C:311
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.
Definition: Window.C:717
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769
Encapsulates an element-connectivity of a mesh.
Definition: Connectivity.h:41

Here is the call graph for this function:

void dealloc_array ( Attribute a)
throw (COM_exception
)
inline

Definition at line 188 of file Window.h.

References Pane::OP_DEALLOC, and reinit_attr().

189  { reinit_attr( a, Pane::OP_DEALLOC); }
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.
Definition: Window.C:717

Here is the call graph for this function:

void dealloc_array ( Connectivity c)
throw (COM_exception
)
inline

Definition at line 191 of file Window.h.

References Pane::OP_DEALLOC, and reinit_conn().

192  { reinit_conn( c, Pane::OP_DEALLOC); }
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.
Definition: Window.C:747

Here is the call graph for this function:

void delete_attribute ( const std::string &  aname)
throw (COM_exception
)

Delete an existing Attribute object.

Definition at line 137 of file Window.C.

References append_frame, COM_ATTS, COM_ERR_ATTRIBUTE_NOTEXIST, COM_ERR_INVALID_ATTRIBUTE_NAME, COM_NUM_KEYWORDS, Pane::delete_attribute(), i, id(), Attribute::id(), Attribute::is_digit(), Attribute::name(), and Attribute::size_of_components().

138 {
139  Attr_map::iterator it = _attr_map.find( aname);
140  if ( it == _attr_map.end())
142  (_name+"."+aname,Window::delete_attribute));
143 
144  Attribute *attr = it->second;
145  int id = attr->id(), ncomp=attr->size_of_components();
146 
147  if ( id < COM_NUM_KEYWORDS && id != COM_ATTS)
149  (_name+"."+aname,Window::delete_attribute));
150 
151  // Remove the object from both the set
152  ((Pane_friend&)_dummy).delete_attribute( id);
153 
154  // Remove from all panes.
155  for (Pane_map::iterator it=_pane_map.begin(); it!=_pane_map.end(); ++it) {
156  Pane_friend *pn = (Pane_friend*)it->second;
157  pn->delete_attribute( id);
158  }
159 
160  // Update last id
161  if (id != COM_ATTS) {
162  _attr_map.erase( it); // Remove from _attr_map
163  if ( _last_id == id + ncomp+(ncomp>1)) {
164  _last_id = id;
166  }
167  else
169  }
170  else if (_last_id>COM_NUM_KEYWORDS) {
171  _attr_map.clear();
172  for ( int i=0; i<COM_NUM_KEYWORDS; ++i) {
173  Attribute *a = _dummy.attribute(i);
174  if ( !Attribute::is_digit(a->name()[0])) _attr_map[ a->name()] = a;
175  }
176 
179  }
180 }
void delete_attribute(const std::string &aname)
Delete an existing Attribute object.
Definition: Window.C:137
int _last_id
The last used attribute index.
Definition: Window.h:385
An Attribute object is a data member of a window.
Definition: Attribute.h:51
static bool is_digit(char c)
Definition: Attribute.h:264
int _status
Status of the window.
Definition: Window.h:389
Encapsulates the states of an exception.
Attribute * attribute(const std::string &a)
Obtain the attribute from given name.
Definition: Pane.C:148
Attr_map _attr_map
Map from attribute names to their metadata.
Definition: Window.h:379
const std::string & name() const
Obtain the name of the attribute.
Definition: Attribute.h:113
blockLoc i
Definition: read.cpp:79
std::string _name
Name of the window.
Definition: Window.h:378
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
unsigned long id(const Leda_like_handle &x)
Definition: Handle.h:107
Pane _dummy
Dummy pane.
Definition: Window.h:377
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382
int id() const
Obtain the id (or index) of the attribute.
Definition: Attribute.h:120
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

void delete_pane ( const int  pane_id)
throw (COM_exception
)
inline

Remove the pane with given ID.

Definition at line 297 of file Window.h.

References _pane_map, and COM_ERR_PANE_NOTEXIST.

297  {
298  if ( pane_id == 0) { // delete all panes
299  _pane_map.clear();
300  }
301  else {
302  Pane_map::iterator it = _pane_map.find( pane_id);
303  if ( it == _pane_map.end()) throw COM_exception(COM_ERR_PANE_NOTEXIST);
304  delete it->second;
305  _pane_map.erase( it);
306  }
307  }
Encapsulates the states of an exception.
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382
Function * function ( const std::string &  f)

Obtain the function pointer from its name.

Definition at line 877 of file Window.C.

References _func_map.

878 {
879  Func_map::iterator it = _func_map.find( fname);
880  if ( it == _func_map.end())
881  return NULL;
882  else
883  return &it->second;
884 }
Func_map _func_map
Map from function names to their metadata.
Definition: Window.h:381
const Function* function ( const std::string &  f) const
inline

Definition at line 347 of file Window.h.

348  { return const_cast<Window*>(this)->function( f); }
A Window object contains multiple panes and multiple data attributes.
Definition: Window.h:42
void get_array ( const std::string &  aname,
const int  pane_id,
Pointer_descriptor addr,
int *  strd = NULL,
int *  cap = NULL,
bool  is_const = false 
)
throw (COM_exception
)

Get the address associated with an attribute for a specific pane.

Parameters
anameattribute name
pane_idpane ID
addraddress of the array
strdStride between two items of each component
capcapacity of the array alloc_array, resize_array, copy_array

Definition at line 641 of file Window.C.

References append_frame, Pane::attribute(), COM_ERR_ATTRIBUTE_NOTEXIST, Pane::connectivity(), get_array_common(), Connectivity::is_element_name(), and COM_exception::msg.

Referenced by get_array_common().

644 {
645  Pane_friend *pn;
646  try { pn = &(Pane_friend&)pane(pane_id); }
647  catch ( COM_exception ex) {
649  throw ex;
650  }
651 
652  if ( Connectivity::is_element_name( aname)) {
653  // Define as const reference to avoid exception.
654  const Connectivity *con=pn->connectivity( aname);
655 
656  if ( con==NULL)
658  (name()+"."+aname,Window::get_array));
659 
660  get_array_common( con, pane_id, addr, strd, cap, is_const);
661  }
662  else {
663  // Define as const reference to avoid exception.
664  const Attribute *a = pn->attribute( aname);
665 
666  if ( a==NULL)
668  (name()+"."+aname,Window::get_array));
669  get_array_common( a, pane_id, addr, strd, cap, is_const);
670  }
671 }
An Attribute object is a data member of a window.
Definition: Attribute.h:51
void get_array_common(const Attr *a, int pid, Window::Pointer_descriptor &addr, int *strd, int *cap, bool is_const)
Definition: Window.C:602
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
Encapsulates the states of an exception.
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.
Definition: Window.C:641
std::string msg
Error message.
static bool is_element_name(const std::string &aname)
Definition: Connectivity.h:228
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769
Encapsulates an element-connectivity of a mesh.
Definition: Connectivity.h:41

Here is the call graph for this function:

Here is the caller graph for this function:

Attribute * get_attribute ( const std::string &  aname,
char *  l,
int *  t,
int *  n,
std::string *  u 
) const
throw (COM_exception
)

Get the meta-information about an attribute.

Parameters
anameattribute name
llocation
tdata type
nnumber of components
uunit

Definition at line 462 of file Window.C.

References append_frame, COM_ERR_ATTRIBUTE_NOTEXIST, COM_INT, Attribute::data_type(), Connectivity::get_size_info(), Connectivity::is_element_name(), Attribute::location(), Connectivity::SIZE_NNODES, Attribute::size_of_components(), and Attribute::unit().

463  {
464  // Special handing for connectivity tables
465  if ( Connectivity::is_element_name( aname)) {
466  // Set the arguments if not NULL.
467  if ( loc) *loc = 'p';
468  if ( type) *type = COM_INT;
469  // Return the number of nodes.
470  if ( ncomp) *ncomp = Connectivity::get_size_info(aname)
472  if ( unit) *unit = "";
473  return NULL; // A connectivity is not defined in Window scope.
474  }
475  else {
476  // Obtain reference to the attribute
477  Attr_map::const_iterator it = _attr_map.find( aname);
478  if ( it == _attr_map.end())
480  (_name+"."+aname,Window::get_attribute));
481  Attribute &a = *it->second;
482 
483  // Set the arguments if not NULL.
484  if ( loc) *loc = a.location();
485  if ( type) *type = a.data_type();
486  if ( ncomp) *ncomp = a.size_of_components();
487  if ( unit) *unit = a.unit();
488  return &a;
489  }
490 }
An Attribute object is a data member of a window.
Definition: Attribute.h:51
Shorter_size location() const
Obtain the location of the attribute.
Definition: Attribute.h:186
static const int * get_size_info(const std::string &aname)
Obtain the size info of pre-defined connectivity.
Definition: Connectivity.C:234
Encapsulates the states of an exception.
const std::string & unit() const
Obtain the unit of the attribute.
Definition: Attribute.h:200
Attribute * get_attribute(const std::string &aname, char *l, int *t, int *n, std::string *u) const
Get the meta-information about an attribute.
Definition: Window.C:462
Attr_map _attr_map
Map from attribute names to their metadata.
Definition: Window.h:379
static bool is_element_name(const std::string &aname)
Definition: Connectivity.h:228
std::string _name
Name of the window.
Definition: Window.h:378
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

MPI_Comm get_communicator ( ) const
inline

Obtain the communicator of the window.

Definition at line 95 of file Window.h.

References _comm.

Referenced by Roccom_base::get_communicator(), and Rocout::write_attr_internal().

95 { return _comm; }
MPI_Comm _comm
the MPI communicator of the window.
Definition: Window.h:387

Here is the caller graph for this function:

void get_parent ( const std::string &  aname,
int  pane_id,
std::string &  name 
) const
throw (COM_exception
)

Get the parent name of an attribute and load into name.

If the attribute has no parent, then name is empty.

Definition at line 566 of file Window.C.

References append_frame, Pane::attribute(), COM_ERR_ATTRIBUTE_NOTEXIST, Pane::connectivity(), Connectivity::is_element_name(), and COM_exception::msg.

567  {
568 
569  const Pane_friend *pn;
570  try {
571  pn = &(Pane_friend&)pane(pid);
572 
573  // Special handing for connectivity
574  if ( Connectivity::is_element_name( aname)) {
575  // Get the corresponding attribute object.
576  const COM::Connectivity *conn = pn->connectivity( aname);
577  if ( conn==NULL)
579  (name()+"."+aname,Window::get_parent));
580 
581  conn = conn->parent();
582  if ( conn==NULL) parent.clear();
583  else parent = conn->fullname();
584  }
585  else {
586  // Get the corresponding attribute object.
587  const COM::Attribute *attr = pn->attribute( aname);
588  if ( attr==NULL)
590  (name()+"."+aname,Window::get_parent));
591 
592  if ( attr==NULL) parent.clear();
593  else parent = attr->fullname();
594  }
595  } catch ( COM_exception ex) {
597  throw ex;
598  }
599 }
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
Encapsulates the states of an exception.
std::string msg
Error message.
static bool is_element_name(const std::string &aname)
Definition: Connectivity.h:228
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.
Definition: Window.C:566
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769

Here is the call graph for this function:

void get_size ( const std::string &  aname,
int  pane_id,
int *  nitems,
int *  ng 
) const
throw (COM_exception
)

Get the sizes of an attribute for a specific pane.

Parameters
anameattribute name
pane_idpane ID
nitemstotal number of items (including ghosts)
ngnumber of ghosts

Definition at line 505 of file Window.C.

References append_frame, Pane::attribute(), COM_ERR_ATTRIBUTE_NOTEXIST, Pane::connectivity(), get_size_common(), Connectivity::is_element_name(), and COM_exception::msg.

Referenced by get_size_common().

506  {
507  const Pane_friend *pn;
508  try { pn = &(Pane_friend&)pane(pid); }
509  catch ( COM_exception ex) {
511  throw ex;
512  }
513 
514  // Special handing for connectivity
515  if ( Connectivity::is_element_name( aname)) {
516  // Get the corresponding attribute object.
517  const COM::Connectivity *conn = pn->connectivity( aname);
518  if ( conn==NULL)
520  ( name()+"."+aname, Window::get_size));
521  get_size_common( conn, pid, nitem, ng);
522  }
523  else {
524  // Get the corresponding attribute object.
525  const COM::Attribute *attr = pn->attribute( aname);
526  if ( attr==NULL)
528  ( name()+"."+aname, Window::get_size));
529 
530  get_size_common( attr, pid, nitem, ng);
531  }
532 }
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.
Definition: Window.C:505
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
Encapsulates the states of an exception.
std::string msg
Error message.
void get_size_common(const Attr *a, int pid, int *nitem, int *ng)
Definition: Window.C:493
static bool is_element_name(const std::string &aname)
Definition: Connectivity.h:228
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769

Here is the call graph for this function:

Here is the caller graph for this function:

int get_status ( const std::string &  aname,
int  pane_id 
) const
throw (COM_exception
)

Get the status of an attribute or pane.

Roccom_base::get_status()

Definition at line 535 of file Window.C.

References append_frame, Pane::attribute(), Pane::connectivity(), Connectivity::is_element_name(), COM_exception::msg, and Attribute::status().

Referenced by Roccom_base::get_status().

535  {
536  // If aname is empty, then check the status of the pane.
537  if ( aname.empty()) {
538  Pane_map::const_iterator pit = _pane_map.find( pid);
539  if ( pit == _pane_map.end()) return -1;
540  else return 0;
541  }
542 
543  const Pane_friend *pn;
544  try { pn = &(Pane_friend&)pane(pid); }
545  catch ( COM_exception ex) {
547  throw ex;
548  }
549 
550  // Special handing for connectivity
551  if ( Connectivity::is_element_name( aname)) {
552  // Get the corresponding attribute object.
553  const COM::Connectivity *conn = pn->connectivity( aname);
554  if ( conn==NULL) return -1;
555  else return conn->status();
556  }
557  else {
558  // Get the corresponding attribute object.
559  const COM::Attribute *attr = pn->attribute( aname);
560  if ( attr==NULL) return -1;
561  else return attr->status();
562  }
563 }
int get_status(const std::string &aname, int pane_id) const
Get the status of an attribute or pane.
Definition: Window.C:535
Encapsulates the states of an exception.
std::string msg
Error message.
static bool is_element_name(const std::string &aname)
Definition: Connectivity.h:228
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382

Here is the call graph for this function:

Here is the caller graph for this function:

Attribute * inherit ( Attribute from,
const std::string &  aname,
int  inherit_mode,
bool  withghost,
const Attribute cond,
int  val 
)
throw (COM_exception
)

Inherit the attributes of another window with a different name.

Returns the corresponding value.

Parameters
fromattribute being copied from
anamenew name of the attribute
condan integer pane-attribute
valvalue to be compared against cond
inherit_modemode of inheritance
withghostwheather ghost nodes/elements should be ignored

Definition at line 334 of file Window.C.

References _pane_map, append_frame, Pane::attribute(), COM_ALL, COM_CONN, COM_ERR_INCOMPATIBLE_ATTRS, COM_MESH, COM_PMESH, Pane::id(), Attribute::inherit(), Pane::inherit(), Pane::INHERIT_COPY, Attribute::pointer(), and Attribute::window().

Referenced by Roccom_base::copy_attribute(), copy_attribute(), and Rocout::write_attr_internal().

338 {
339  Attribute *a = ((Pane_friend&)_dummy).inherit(from, aname, mode, withghost);
340  if ( from->is_windowed()) return a;
341 
342  // Copy the panes
343  Pane_map &ps = from->window()->_pane_map;
344 
345  bool with_conn = from->id()==COM_CONN || from->id()==COM_MESH ||
346  from->id()==COM_PMESH || from->id()==COM_ALL;
347 
348  bool insert_pane = (mode != Pane::INHERIT_COPY) && with_conn;
349 
350  if ( with_conn && aname.size() && from->name() != aname)
352  (from->fullname()+" and " +aname,
353  Window::inherit));
354 
355  if ( cond && cond->window()!=from->window()) {
357  (from->fullname()+" and "+cond->fullname(),
358  Window::inherit));
359  }
360 
361  for ( Pane_map::iterator ppit = ps.begin(); ppit!=ps.end(); ++ppit) {
362  Pane *ppn=ppit->second;
363  const int *cnd = NULL;
364  if ( cond) {
365  const Attribute *cond_pn = ppn->attribute( cond->id());
366  cnd = (const int*)cond_pn->pointer();
367  }
368 
369  // Inherit the pane if the condition was set to an variable (cnd!=NULL),
370  // or set to to pane ID (cnd==NULL && val!=0), or not set.
371  if ( !cond && (val==0 || val==ppn->id()) || cnd && *cnd == val) {
372  // Create new panes only when we are inheriting the mesh.
373  Pane_friend *pn;
374  if ( insert_pane)
375  pn = (Pane_friend*)( &pane( ppit->first, true));
376  else {
377  Pane_map::iterator it = _pane_map.find( ppit->first);
378  pn = ( it!=_pane_map.end())?(Pane_friend*)(it->second):NULL;
379  }
380 
381  if ( pn)
382  pn->inherit( ppn->attribute( from->id()), aname, mode, withghost);
383  }
384  }
385  return a;
386 }
void inherit(Attribute *a, bool clone, bool withghost, int depth=0)
Inherit from parent. If depth&gt;0, then the procedure is for the subcomponents.
Definition: Attribute.C:426
A Pane object contains a mesh, pane attribute, and field variables.
Definition: Pane.h:43
An Attribute object is a data member of a window.
Definition: Attribute.h:51
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
std::map< int, Pane * > Pane_map
Definition: Window.h:45
const Window * window() const
Obtain a constant pointer to the parent window of the attribute.
Definition: Attribute.C:80
Encapsulates the states of an exception.
Attribute * attribute(const std::string &a)
Obtain the attribute from given name.
Definition: Pane.C:148
const void * pointer() const
Obtain a constant pointer to the physical address.
Definition: Attribute.h:150
const std::string & name() const
Obtain the name of the attribute.
Definition: Attribute.h:113
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769
Pane _dummy
Dummy pane.
Definition: Window.h:377
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382
int id() const
Obtain the id (or index) of the attribute.
Definition: Attribute.h:120
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.
Definition: Window.C:334
int id() const
Get the ID of the pane.
Definition: Pane.h:96
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82

Here is the call graph for this function:

Here is the caller graph for this function:

void init_done ( bool  pane_changed = true)
throw (COM_exception
)

Perform some final checking of the window.

Definition at line 388 of file Window.C.

References append_frame, COM_ERR_INIT_DONE_PANEMAP, i, j, and max().

388  {
389  // Loop through the attributes.
390  if ( _status == STATUS_SHRUNK) {
391  int max_id=0;
392  for (Attr_map::iterator it=_attr_map.begin(); it!=_attr_map.end(); ++it) {
393  int id = it->second->id(), ncomp=it->second->size_of_components();
394  max_id = std::max( max_id, id+ncomp+(ncomp>1));
395  }
396  if (max_id < _last_id) _last_id = max_id;
397  }
398 
399  int npanes = _pane_map.size();
400  std::vector< int> pane_ids; pane_ids.reserve(npanes);
401 
402  for (Pane_map::iterator it=_pane_map.begin(); it!=_pane_map.end(); ++it) {
403  it->second->init_done();
404  pane_ids.push_back( it->second->id());
405  }
406 
408 
409  if ( !pane_changed) {
410  if ( npanes>int(_pane_map.size())) {
413  }
414  return;
415  }
416 
417  // communicate pane mapping
418  int flag; MPI_Initialized( &flag);
419  if ( _comm == MPI_COMM_NULL) flag = 0;
420 
421  // Compute proc_map
422  int nprocs;
423  if ( flag) MPI_Comm_size( _comm, &nprocs); else nprocs = 1;
424 
425  // Obtain the number of panes.
426  std::vector<int> npanes_all(nprocs);
427  if ( flag)
428  MPI_Allgather( &npanes, 1, MPI_INT, &npanes_all[0], 1, MPI_INT, _comm);
429  else
430  npanes_all[0] = npanes;
431 
432  std::vector<int> disps(nprocs+1);
433  disps[0]=0;
434  for ( int i=0; i<nprocs; ++i) disps[i+1] = disps[i]+npanes_all[i];
435 
436  std::vector<int> pane_ids_all( disps[nprocs]);
437  if ( flag)
438  MPI_Allgatherv( &pane_ids[0], npanes, MPI_INT, &pane_ids_all[0],
439  &npanes_all[0], &disps[0], MPI_INT, _comm);
440  else
441  pane_ids_all = pane_ids;
442 
443  // Build process map
444  _proc_map.clear();
445  for ( int p=0; p<nprocs; ++p) {
446  for ( int j=disps[p], jn=disps[p+1]; j<jn; ++j)
447  _proc_map[ pane_ids_all[j]] = p;
448  }
449 }
int _last_id
The last used attribute index.
Definition: Window.h:385
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
int _status
Status of the window.
Definition: Window.h:389
MPI_Comm _comm
the MPI communicator of the window.
Definition: Window.h:387
Encapsulates the states of an exception.
Proc_map _proc_map
Map from pane ID to process ranks.
Definition: Window.h:383
Attr_map _attr_map
Map from attribute names to their metadata.
Definition: Window.h:379
blockLoc i
Definition: read.cpp:79
void init_done(bool pane_changed=true)
Perform some final checking of the window.
Definition: Window.C:388
std::string _name
Name of the window.
Definition: Window.h:378
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
j indices j
Definition: Indexing.h:6
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382

Here is the call graph for this function:

int last_attribute_id ( ) const
inline

Return the last attribute id.

Definition at line 291 of file Window.h.

References _last_id.

Referenced by Pane::init_done().

291 { return _last_id; }
int _last_id
The last used attribute index.
Definition: Window.h:385

Here is the caller graph for this function:

const std::string& name ( ) const
inline

Obtain the window's name.

Definition at line 92 of file Window.h.

Referenced by Rocblas::axpy_gen(), Rocblas::calc(), Rocblas::calcDot(), Roccom_base::call_function(), Rocblas::copy(), Attribute::fullname(), Rocblas::gen2arg(), Rocblas::rand(), Pane::refresh_connectivity(), Rocblas::swap(), and Rocout::write_attr_internal().

92 { return _name; }
std::string _name
Name of the window.
Definition: Window.h:378

Here is the caller graph for this function:

Attribute * new_attribute ( const std::string &  aname,
const char  loc,
const int  type,
int  ncomp,
const std::string &  unit 
)
throw (COM_exception
)

Create a new Attribute object with given properties.

Parameters
anameattribute name.
loclocation ('w', 'p', 'n', or 'e').
typebase data type.
ncompnumber of components.
unitunit of the attribute.

Definition at line 86 of file Window.C.

References append_frame, COM_assertion_msg, COM_ERR_INVALID_ATTRIBUTE_NAME, COM_ERR_INVALID_DIMENSION, COM_ERR_UNKNOWN_DATATYPE, COM_ERR_UNKNOWN_KEYWORD, COM_MAX_TYPEID, COM_NUM_KEYWORDS, Attribute::is_digit(), Connectivity::is_element_name(), and Pane::new_attribute().

88 {
89  // Special handing for connectivity
90  if ( Connectivity::is_element_name( aname) ||
91  Attribute::is_digit(aname[0]))
93  (_name+"."+aname,Window::new_attribute));
94  if ( ncomp<=0)
96  (_name+"."+aname,Window::new_attribute));
97 
98  if ( loc != 'w' && loc != 'p' && loc != 'e' && loc != 'n' && loc != 'c')
100  (_name+"."+aname,Window::new_attribute));
101 
102  if ( type<COM_MIN_TYPEID || type > COM_MAX_TYPEID)
104  (_name+"."+aname,Window::new_attribute));
105 
106  // Redefine an attribute if it pre-exists, but ncomp cannot be increased.
107  Attr_map::const_iterator it = _attr_map.find( aname);
108 
109  if ( it != _attr_map.end() && ncomp > it->second->size_of_components()) {
110  COM_assertion_msg( it->second->id()>=COM_NUM_KEYWORDS,
111  "Cannot increase size of keywords");
112  delete_attribute( it->first);
113  it = _attr_map.end();
114  }
115 
116  int id = (it==_attr_map.end())?_last_id:it->second->id();
117 
118  // Insert the object into both the set and the map.
119  Attribute *a = ((Pane_friend&)_dummy).
120  new_attribute( aname, id, loc, type, ncomp, unit);
121  _attr_map[aname] = a;
122 
123  // Propagete onto all existing panes.
124  for (Pane_map::iterator it=_pane_map.begin(); it!=_pane_map.end(); ++it) {
125  Pane_friend *pn = (Pane_friend*)it->second;
126  pn->new_attribute( aname, id, loc, type, ncomp, unit);
127  }
128 
129  // Update last available id
130  if ( it == _attr_map.end()) _last_id = id+ncomp+(ncomp>1);
131 
133  return a;
134 }
void delete_attribute(const std::string &aname)
Delete an existing Attribute object.
Definition: Window.C:137
int _last_id
The last used attribute index.
Definition: Window.h:385
An Attribute object is a data member of a window.
Definition: Attribute.h:51
static bool is_digit(char c)
Definition: Attribute.h:264
#define COM_assertion_msg(EX, msg)
int _status
Status of the window.
Definition: Window.h:389
Encapsulates the states of an exception.
Attr_map _attr_map
Map from attribute names to their metadata.
Definition: Window.h:379
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.
Definition: Window.C:86
static bool is_element_name(const std::string &aname)
Definition: Connectivity.h:228
std::string _name
Name of the window.
Definition: Window.h:378
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane _dummy
Dummy pane.
Definition: Window.h:377
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382

Here is the call graph for this function:

Window& operator= ( const Window )
private
int owner_rank ( const int  pane_id) const

Obtain the process rank that owns a given pane.

Returns -1 if the pane cannot be found in the process map.

Definition at line 452 of file Window.C.

References _pane_map, _proc_map, and COM_assertion_msg.

452  {
453  COM_assertion_msg( _pane_map.size()<=_proc_map.size(),
454  "init_done must be called before owner_rank is called");
455 
456  Proc_map::const_iterator it = _proc_map.find( pane_id);
457  if ( it==_proc_map.end()) return -1;
458  else return it->second;
459 }
#define COM_assertion_msg(EX, msg)
Proc_map _proc_map
Map from pane ID to process ranks.
Definition: Window.h:383
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382
Pane & pane ( const int  pane_id,
bool  insert = false 
)
throw (COM_exception
)

Find the pane with given ID. If not found, insert a pane with given ID.

Definition at line 769 of file Window.C.

References append_frame, COM_assertion, and COM_ERR_PANE_NOTEXIST.

Referenced by pane(), write_attr_CGNS(), and write_attr_HDF4().

770 {
771  if ( pid==0) return _dummy;
772 
773  COM_assertion( pid>0);
774  Pane_map::iterator pit = _pane_map.find( pid);
775  if ( pit == _pane_map.end()) {
776  if (insert)
777  return *(_pane_map[pid] = new Pane( &_dummy, pid));
778  else {
779  // print missing pane ID and known IDs in the pane map
780  std::cerr << "No such Pane ID: " << pid << std::endl;
781  std::cerr << "While the known Pane IDs are: [ ";
782  Pane_map::iterator pit;
783  for ( pit=_pane_map.begin(); pit != _pane_map.end(); ++pit)
784  std::cerr << pit->first << " ";
785  std::cerr << "]" << std::endl;
787  (_name,Window::pane));
788  }
789  }
790 
791  return *pit->second;
792 }
A Pane object contains a mesh, pane attribute, and field variables.
Definition: Pane.h:43
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
Encapsulates the states of an exception.
std::string _name
Name of the window.
Definition: Window.h:378
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769
Pane _dummy
Dummy pane.
Definition: Window.h:377
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382

Here is the caller graph for this function:

const Pane & pane ( const int  pane_id) const
throw (COM_exception
)

Definition at line 794 of file Window.C.

References append_frame, COM_assertion, COM_ERR_PANE_NOTEXIST, and pane().

795 {
796  if ( pid==0) return _dummy;
797 
798  COM_assertion( pid>0);
799  Pane_map::const_iterator pit = _pane_map.find( pid);
800  if ( pit == _pane_map.end()) {
802  (_name,Window::pane));
803  }
804 
805  return *pit->second;
806 }
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
Encapsulates the states of an exception.
std::string _name
Name of the window.
Definition: Window.h:378
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769
Pane _dummy
Dummy pane.
Definition: Window.h:377
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382

Here is the call graph for this function:

void panes ( std::vector< int > &  ps,
int  rank = -2 
)

Obtain all the local panes of the window.

Definition at line 809 of file Window.C.

References _pane_map, _proc_map, _status, COM_assertion_msg, iend, and STATUS_NOCHANGE.

Referenced by Rocblas::axpy_gen(), Rocblas::calc(), Rocblas::calcDot(), Rocblas::gen2arg(), and panes().

810 {
811 
812  pane_ids.clear();
813 
814  if ( rank == -2) {
815  pane_ids.reserve( _pane_map.size());
816 
817  for ( Pane_map::iterator it=_pane_map.begin(); it != _pane_map.end(); ++it)
818  pane_ids.push_back( it->first);
819  }
820  else {
822  "Can only obtain panes after calling window_init_done");
823 
824  std::map<int,int>::const_iterator it, iend;
825  for ( it=_proc_map.begin(), iend=_proc_map.end(); it!= iend; ++it) {
826  if ( rank==-1 || it->second == rank)
827  pane_ids.push_back( it->first);
828  }
829  }
830 }
#define COM_assertion_msg(EX, msg)
int _status
Status of the window.
Definition: Window.h:389
Proc_map _proc_map
Map from pane ID to process ranks.
Definition: Window.h:383
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
static int rank
Definition: advectest.C:66
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382

Here is the caller graph for this function:

void panes ( std::vector< Pane * > &  ps)

Obtain all the local panes of the window.

Definition at line 833 of file Window.C.

References _pane_map.

834 {
835  ps.reserve( _pane_map.size());
836  Pane_map::iterator it=_pane_map.begin();
837  for ( ; it != _pane_map.end(); ++it)
838  ps.push_back( it->second);
839 }
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382
void panes ( std::vector< const Pane * > &  ps) const
inline

Obtain all the local panes of the window.

Definition at line 324 of file Window.h.

References panes().

325  { const_cast<Window*>(this)->panes( (std::vector<Pane*> &)ps); }
A Window object contains multiple panes and multiple data attributes.
Definition: Window.h:42
void panes(std::vector< int > &ps, int rank=-2)
Obtain all the local panes of the window.
Definition: Window.C:809

Here is the call graph for this function:

const Proc_map& proc_map ( ) const
inline

Obtain the process map.

Definition at line 294 of file Window.h.

References _proc_map.

294 { return _proc_map; }
Proc_map _proc_map
Map from pane ID to process ranks.
Definition: Window.h:383
void reinit_attr ( Attribute attr,
OP_Init  op,
void **  addr = NULL,
int  strd = 0,
int  cap = 0 
)
throw (COM_exception
)
protected

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.

Parameters
attrattribute
opOperation (OP_SET, OP_SET_CONST, OP_ALLOC, OP_RESIZE)
addraddress
strdstride
capcapacity

Definition at line 717 of file Window.C.

References COM_ALL, COM_assertion, COM_ATTS, Pane::id(), iend, Pane::OP_SET, Pane::OP_SET_CONST, and Pane::reinit_attr().

Referenced by dealloc_array(), and resize_array().

719 {
720  int aid = a->id();
721 
722  if ( a->location()=='w')
723  // Initialize window attributes in dummy pane
724  ((Pane_friend&)_dummy).reinit_attr( aid, op, addr, strd, cap);
725  else {
726  // Initialize other attributes in regular panes
727  Pane *pn = a->pane();
728  if ( pn->id()>0)
729  ((Pane_friend*)pn)->reinit_attr( aid, op, addr, strd, cap);
730  else {
731  if ( aid == COM_ALL || aid == COM_ATTS)
732  ((Pane_friend&)_dummy).reinit_attr( aid, op, addr, strd, cap);
733 
735  // Loop through the panes to initialize each pane
736  for (Pane_map::iterator it=_pane_map.begin(), iend=_pane_map.end();
737  it != iend; ++it) {
738  ((Pane_friend*)it->second)->reinit_attr( aid, op, NULL, strd, cap);
739  }
740  if ( addr) *addr= NULL; // Do not return any address.
741  return;
742  }
743  }
744 }
A Pane object contains a mesh, pane attribute, and field variables.
Definition: Pane.h:43
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
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.
Definition: Window.C:717
Pane _dummy
Dummy pane.
Definition: Window.h:377
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382
int id() const
Get the ID of the pane.
Definition: Pane.h:96

Here is the call graph for this function:

Here is the caller graph for this function:

void reinit_conn ( Connectivity con,
OP_Init  op,
int **  addr = NULL,
int  strd = 0,
int  cap = 0 
)
throw (COM_exception
)
protected

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.

Parameters
attrconnectivity table
opOperation (OP_SET, OP_SET_CONST, OP_ALLOC, OP_RESIZE)
addraddress
strdstride
capcapacity

Definition at line 747 of file Window.C.

References COM_assertion, Pane::id(), iend, Pane::OP_SET, Pane::OP_SET_CONST, and Connectivity::parent().

Referenced by dealloc_array(), and resize_array().

749 {
750 
751  Pane *pn = con->pane();
752  if ( pn->id()==0) {
754  // Loop through the panes to proecess the connectivity in each pane.
755  for (Pane_map::iterator it=_pane_map.begin(), iend=_pane_map.end();
756  it != iend; ++it) {
757  Connectivity *c=((Pane_friend*)it->second)->connectivity( con->name());
758  if ( c && !c->parent())
759  ((Pane_friend*)it->second)->reinit_conn( c, op, NULL, strd, cap);
760  }
761  if ( addr) *addr= NULL; // Do not return address.
762  return;
763  }
764  else {
765  ((Pane_friend*)pn)->reinit_conn( con, op, addr, strd, cap);
766  }
767 }
A Pane object contains a mesh, pane attribute, and field variables.
Definition: Pane.h:43
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
Connectivity * parent()
Parent attribute being used.
Definition: Connectivity.h:108
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.
Definition: Window.C:747
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
const std::string & name() const
Obtain the name of the attribute.
Definition: Attribute.h:113
const Pane * pane() const
Obtain a constant pointer to the owner pane of the attribute.
Definition: Attribute.h:172
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382
Encapsulates an element-connectivity of a mesh.
Definition: Connectivity.h:41
int id() const
Get the ID of the pane.
Definition: Pane.h:96

Here is the call graph for this function:

Here is the caller graph for this function:

void resize_array ( const std::string &  aname,
const int  pane_id,
void **  addr,
int  strd = -1,
int  cap = 0 
)
throw (COM_exception
)

Resize memory for an attribute for a specific pane and set addr to the address.

set_array, alloc_array, append_array

Definition at line 261 of file Window.C.

References append_frame, COM_ERR_ATTRIBUTE_NOTEXIST, Connectivity::is_element_name(), and Pane::OP_RESIZE.

263 {
264  if ( Connectivity::is_element_name( aname)) {
265  Pane &pn = pane(pane_id,true);
266  Connectivity *con = ((Pane_friend&)pn).connectivity( aname);
267 
268  if ( con==NULL)
270  (name()+"."+aname,Window::resize_array));
271 
272  reinit_conn( con, Pane::OP_RESIZE, (int**)addr, strd, cap);
273  }
274  else {
275  Attribute *a = pane( pane_id,true).attribute( aname);
276 
277  if ( a==NULL)
279  (name()+"."+aname,Window::resize_array));
280  reinit_attr( a, Pane::OP_RESIZE, addr, strd, cap);
281  }
282 }
A Pane object contains a mesh, pane attribute, and field variables.
Definition: Pane.h:43
An Attribute object is a data member of a window.
Definition: Attribute.h:51
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
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.
Definition: Window.C:261
Encapsulates the states of an exception.
Attribute * attribute(const std::string &a)
Obtain the attribute from given name.
Definition: Pane.C:148
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.
Definition: Window.C:747
static bool is_element_name(const std::string &aname)
Definition: Connectivity.h:228
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.
Definition: Window.C:717
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769
Encapsulates an element-connectivity of a mesh.
Definition: Connectivity.h:41

Here is the call graph for this function:

void resize_array ( Attribute a,
void **  addr,
int  strd = -1,
int  cap = 0 
)
throw (COM_exception
)
inline

Definition at line 166 of file Window.h.

References Pane::OP_RESIZE, and reinit_attr().

168  { reinit_attr( a, Pane::OP_RESIZE, addr, strd, cap); }
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.
Definition: Window.C:717

Here is the call graph for this function:

void resize_array ( Connectivity c,
void **  addr,
int  strd = -1,
int  cap = 0 
)
throw (COM_exception
)
inline

Definition at line 170 of file Window.h.

References Pane::OP_RESIZE, and reinit_conn().

172  { reinit_conn( c, Pane::OP_RESIZE, (int**)addr, strd, cap); }
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.
Definition: Window.C:747

Here is the call graph for this function:

void set_array ( const std::string &  aname,
const int  pane_id,
void *  addr,
int  strd = 0,
int  cap = 0,
bool  is_const = false 
)
throw (COM_exception
)

Associate an array with an attribute for a specific pane.

Parameters
anameattribute name
pane_idpane ID
addraddress of the array
strdStride between two items of each component
capcapacity of the array alloc_array, resize_array

Definition at line 212 of file Window.C.

References append_frame, COM_ERR_ATTRIBUTE_NOTEXIST, Connectivity::is_element_name(), Pane::OP_SET, and Pane::OP_SET_CONST.

215 {
216  if ( Connectivity::is_element_name( aname)) {
217  Pane &pn = pane(pane_id,true);
218  Connectivity *con = ((Pane_friend&)pn).connectivity( aname,true);
219 
220  if ( con==NULL)
222  (name()+"."+aname,Window::set_array));
223 
225  &(int*&)addr, strd, cap);
226  }
227  else {
228  Attribute *a = pane( pane_id,true).attribute( aname);
229  if ( a==NULL)
231  (name()+"."+aname,Window::set_array));
232 
234  &addr, strd, cap);
235  }
236 }
A Pane object contains a mesh, pane attribute, and field variables.
Definition: Pane.h:43
An Attribute object is a data member of a window.
Definition: Attribute.h:51
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.
Definition: Window.C:212
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
Encapsulates the states of an exception.
Attribute * attribute(const std::string &a)
Obtain the attribute from given name.
Definition: Pane.C:148
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.
Definition: Window.C:747
static bool is_element_name(const std::string &aname)
Definition: Connectivity.h:228
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.
Definition: Window.C:717
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769
Encapsulates an element-connectivity of a mesh.
Definition: Connectivity.h:41

Here is the call graph for this function:

void set_function ( const std::string &  fname,
Func_ptr  func,
const std::string &  intents,
const COM_Type types,
Attribute a,
bool  if_f90 = false 
)
throw (COM_exception
)

Initialize a Function record.

Definition at line 59 of file Window.C.

References append_frame, and COM_WARN_DUP_FUNC.

64  {
65  if ( _func_map.find( fname) != _func_map.end())
67  (_name+"."+fname,Window::init_function));
68 
69  _func_map[fname] = Function( func, intents, types, a, is_f90);
70 }
A Function object corresponds to a function member of a window.
Definition: Function.h:49
Encapsulates the states of an exception.
std::string _name
Name of the window.
Definition: Window.h:378
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Func_map _func_map
Map from function names to their metadata.
Definition: Window.h:381
void set_function ( const std::string &  fname,
Member_func_ptr  func,
const std::string &  intents,
const COM_Type types,
Attribute a,
bool  if_f90 = false 
)
throw (COM_exception
)

Initialize a Function record.

Definition at line 72 of file Window.C.

References _func_map, _name, append_frame, and COM_WARN_DUP_FUNC.

77  {
78  if ( _func_map.find( fname) != _func_map.end())
80  (_name+"."+fname,Window::init_function));
81 
82  _func_map[fname] = Function( func, intents, types, a);
83 }
A Function object corresponds to a function member of a window.
Definition: Function.h:49
Encapsulates the states of an exception.
std::string _name
Name of the window.
Definition: Window.h:378
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Func_map _func_map
Map from function names to their metadata.
Definition: Window.h:381
void set_size ( const std::string &  aname,
int  pane_id,
int  nitems,
int  ng = 0 
)
throw (COM_exception
)

Set the sizes of an attribute for a specific pane.

Parameters
anameattribute name
pane_idpane ID
nitemstotal number of items (including ghosts)
ngnumber of ghosts

Definition at line 182 of file Window.C.

References append_frame, COM_ERR_ATTRIBUTE_NOTEXIST, Pane::connectivity(), Attribute::id(), iend, Connectivity::is_element_name(), Attribute::is_windowed(), and Pane::set_size().

184 {
185  if ( Connectivity::is_element_name( aname)) {
186  Pane_friend &pn = (Pane_friend&)pane(pid,true);
187  Connectivity *con = pn.connectivity( aname,true);
188  pn.set_size( con, nitems, ng);
189  }
190  else {
191  Attribute *a = attribute(aname);
192 
193  if ( a == NULL)
195  (_name+"."+aname,Window::set_size));
196 
197  if ( a->is_windowed())
198  ((Pane_friend&)_dummy).set_size( a, nitems, ng);
199  else if ( pid==0) {
200  // Loop through the panes to set the sizes.
201  for (Pane_map::iterator it=_pane_map.begin(), iend=_pane_map.end();
202  it != iend; ++it) {
203  ((Pane_friend*)it->second)->set_size
204  ( it->second->attribute( a->id()), nitems, ng);
205  }
206  }
207  else
208  ((Pane_friend&)pane(pid,true)).set_size( a, nitems, ng);
209  }
210 }
An Attribute object is a data member of a window.
Definition: Attribute.h:51
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
Encapsulates the states of an exception.
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
static bool is_element_name(const std::string &aname)
Definition: Connectivity.h:228
std::string _name
Name of the window.
Definition: Window.h:378
Attribute * attribute(const std::string &a)
Obtain a pointer to the attribute metadata from its name.
Definition: Window.C:842
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
Pane & pane(const int pane_id, bool insert=false)
Find the pane with given ID. If not found, insert a pane with given ID.
Definition: Window.C:769
Pane _dummy
Dummy pane.
Definition: Window.h:377
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.
Definition: Window.C:182
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382
int id() const
Obtain the id (or index) of the attribute.
Definition: Attribute.h:120
Encapsulates an element-connectivity of a mesh.
Definition: Connectivity.h:41

Here is the call graph for this function:

int size_of_panes ( ) const
inline

Obtain the number of local panes in the window.

Definition at line 281 of file Window.h.

281 { return _pane_map.size(); }
Pane_map _pane_map
Map from pane ID to their metadata.
Definition: Window.h:382
int size_of_panes_global ( ) const
inline

Obtain the total number of panes in the window on all processes.

Definition at line 284 of file Window.h.

References _proc_map.

284 { return _proc_map.size(); }
Proc_map _proc_map
Map from pane ID to process ranks.
Definition: Window.h:383

Member Data Documentation

Attr_map _attr_map
protected

Map from attribute names to their metadata.

It does not contain individual components.

Definition at line 379 of file Window.h.

Referenced by Window().

MPI_Comm _comm
protected

the MPI communicator of the window.

Definition at line 387 of file Window.h.

Referenced by get_communicator().

Pane _dummy
protected

Dummy pane.

Definition at line 377 of file Window.h.

Referenced by attribute(), attributes(), and Window().

Func_map _func_map
protected

Map from function names to their metadata.

Definition at line 381 of file Window.h.

Referenced by function(), and set_function().

int _last_id
protected

The last used attribute index.

The next available one is _last_id+1.

Definition at line 385 of file Window.h.

Referenced by last_attribute_id().

std::string _name
protected

Name of the window.

Definition at line 378 of file Window.h.

Referenced by set_function().

Pane_map _pane_map
protected

Map from pane ID to their metadata.

Definition at line 382 of file Window.h.

Referenced by delete_pane(), inherit(), owner_rank(), panes(), and ~Window().

Proc_map _proc_map
protected

Map from pane ID to process ranks.

Definition at line 383 of file Window.h.

Referenced by owner_rank(), panes(), proc_map(), and size_of_panes_global().

int _status
protected

Status of the window.

Definition at line 389 of file Window.h.

Referenced by panes().


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