31 #ifndef __ROCCOM_BASE_H__
32 #define __ROCCOM_BASE_H__
65 static void init(
int *argc,
char ***argv)
throw(
int);
67 static
void abort(
int ierr);
90 const std::string &wname)
throw(
int);
94 const std::string &wname,
int dodl=1) throw(
int);
102 MPI_Comm comm) throw(
int);
109 bool panechanged = true) throw(
int);
112 void delete_pane(const std::
string &wname, const
int pid) throw(
int);
121 const
int data_type,
int size,
122 const std::
string &unit) throw(
int);
129 void set_size( const std::
string &wa_str,
130 int pane_id,
int nitems,
int ng=0) throw(
int);
133 void set_object( const std::
string &wa, const
int pane_id,
134 void *obj_addr,
void *casted_obj) throw(
int);
137 void get_object( const std::
string &wa, const
int pane_id,
138 void **ptr) throw(
int);
141 void set_array( const std::
string &wa, const
int pane_id,
142 void *addr,
int strd=0,
int cap=0,
143 bool is_const=false) throw(
int);
147 T lbnd, T ubnd) throw(
int)
148 {
set_bounds( wa, pane_id, (
const void*)&lbnd, (
const void*)&ubnd); }
152 const T* lbnd,
const T* ubnd)
throw(
int)
153 {
set_bounds( wa, pane_id, (
const void*)&lbnd, (
const void*)&ubnd); }
155 void set_bounds(
const std::string &wa,
const int pane_id,
156 const void *lbnd,
const void *ubnd)
throw(
int);
158 void get_bounds(
const std::string &wa,
const int pane_id,
159 void *lbnd,
void *ubnd)
throw(
int);
161 int check_bounds(
const std::string &wa,
int pane_id)
throw(
int);
167 void **addr=NULL,
int strd=0,
int cap=0) throw(
int);
174 void resize_array( const std::
string &wa, const
int pane_id=0,
175 void **addr=NULL,
int strd=-1,
int cap=0) throw(
int);
179 void append_array( const std::
string &wa, const
int pane_id,
180 const
void *val,
int v_strd,
int v_size) throw(
int);
185 const std::
string &pwname,
187 const
char *cndname=NULL,
188 int val=0) throw(
int);
193 const std::
string &pwname,
195 const
char *cndname=NULL,
196 int val=0) throw(
int);
200 const std::
string &pwname,
202 const
char *cndname=NULL,
203 int val=0) throw(
int);
210 int val=0) throw(
int);
215 const
int pid=0) throw(
int);
219 void get_attribute( const std::
string &wa_str,
char *loc,
int *type,
220 int *size, std::
string *unit) throw(
int);
223 void get_size( const std::
string &wa_str,
int pane_id,
224 int *size,
int *ng=0) throw(
int);
239 int get_status( const std::
string &wa_str,
int pane_id) throw(
int);
242 void get_array( const std::
string &wa, const
int pane_id,
243 void **addr,
int *strd=NULL,
244 int *cap=0,
bool is_const=false) throw(
int);
247 void get_array( const std::
string &wa, const
int pane_id,
249 int *cap=0,
bool is_const=false) throw(
int);
252 void copy_array( const std::
string &wa, const
int pane_id,
253 void *val,
int v_strd=0,
int v_size=0,
269 void get_windows(std::vector<std::
string> &) throw(
int);
272 void get_modules(std::vector<std::
string> &) throw(
int);
277 void get_panes( const std::
string &wname, std::vector<
int> &paneids_vec,
278 int rank=-2,
int **pane_ids=NULL) throw(
int);
283 std::
string &str,
char **names=NULL) throw(
int);
287 std::
string &str,
char **names=NULL) throw(
int);
291 void get_parent( const std::
string &waname,
int pane_id,
292 std::
string &str,
char **name=NULL) throw(
int);
323 const std::string &intents,
325 bool ff=
false) throw(
int);
329 const std::
string &wa,
330 const std::
string &intents,
332 bool ff=false) throw(
int);
336 const std::
string &wa,
337 const std::
string &intents,
339 bool ff=false) throw(
int);
354 const
int *lens=NULL,
355 bool from_c=true) throw(
int);
365 int *reqid, const
int *lens=NULL) throw(
int)
399 void print_profile(
const std::string &fname,
const std::string &header);
422 const std::string &wa,
423 const std::string &intents,
425 bool ff=
false) throw(
int);
460 int split_name( const std::
string &wa, std::
string &wname,
461 std::
string &aname,
bool tothrow=true) throw(COM_exception);
463 void proc_exception( const COM_exception &, const std::
string &) throw(
int);
525 extern bool use_tcharm_global;
527 return ! use_tcharm_global ?
528 roccom_base : (COM::Roccom_base *)TCHARM_Get_global(COMGLOB_ROCCOM);
538 { COM::Roccom_base *roccom=COM::Roccom_base::get_roccom();
540 "Roccom must be initialized before any Roccom calls.");
545 { COM::Roccom_base::set_roccom(p); }
547 #endif // __ROCCOM_BASE_H__
void use_attribute(const std::string &wname, const std::string &pwname, int withghost=1, const char *cndname=NULL, int val=0)
Use the subset of panes of another window of which the given pane attribute has value val...
void get_attribute(const std::string &wa_str, char *loc, int *type, int *size, std::string *unit)
Information retrieval Get the information about an attribute.
static void abort(int ierr)
void delete_window(const std::string &wname)
Deletes a window with given name.
void copy_array(const std::string &wa, const int pane_id, void *val, int v_strd=0, int v_size=0, int offset=0)
Copy an array from an attribute on a specific pane into a given buffer.
int COM_Type
Indices for derived data types.
int get_debug() const
Determines whether verbose is on.
A Function object corresponds to a function member of a window.
int _depth
Depth of procedure calls.
void set_bounds(const std::string &wa, const int pane_id, const T *lbnd, const T *ubnd)
const Window * get_window_object(const std::string &wname) const
void set_function(const std::string &wf, Func_ptr ptr, const std::string &intents, const COM_Type *types, bool ff=false)
Registers a function to the window.
Roccom_map< Window * > Window_map
Window & get_window(const std::string &wname)
Obtains a reference to the Window object from its name.
void get_attributes(const std::string &wname, int *na, std::string &str, char **names=NULL)
Obtain the user-defined attributes of the given window.
int get_error_code() const
Get the error code.
An Attribute object is a data member of a window.
int _f90_mangling
Encoding name mangling.
#define COM_assertion_msg(EX, msg)
Roccom_map< Attribute * > Attribute_map
void load_module(const std::string &lname, const std::string &wname)
Load a module.
int get_num_arguments(const std::string &wf)
Get the number of arguments of a given function "window.function".
void get_size(const std::string &wa_str, int pane_id, int *size, int *ng=0)
Get the sizes of an attribute. The opposite of set_size.
A Window object contains multiple panes and multiple data attributes.
void deallocate_array(const std::string &wa, const int pid=0)
Deallocate space for an attribute in a pane, asuming the memory was allocated allocate_mesh or alloca...
std::pair< int, int > get_f90pntoffsets(const Attribute *a)
Contains declaration of mappings for module, window, function, attribute.
int get_window_handle(const std::string &wname)
void unload_module(const std::string &lname, const std::string &wname, int dodl=1)
Unload a module.
void proc_exception(const COM_exception &, const std::string &)
static void init(int *argc, char ***argv)
bool _exception_on
Indicates whether Roccom should throw exception.
real *8 function offset(vNorm, x2, y2, z2)
void COM_set_roccom(COM::Roccom_base *p)
std::string _libdir
Library directory.
int get_attribute_handle(const std::string &waname)
Encapsulates the states of an exception.
void free_buffer(int **buf)
void set_member_function(const std::string &wf, Func_ptr ptr, const std::string &wa, const std::string &intents, const COM_Type *types, bool ff=false)
void delete_pane(const std::string &wname, const int pid)
Deletes a pane and its associated data.
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS 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 v
int _verb1
Indicates whether to print detailed information.
void resize_array(const std::string &wa, const int pane_id=0, void **addr=NULL, int strd=-1, int cap=0)
Resize an attribute on a specific pane and return the address by setting addr.
void set_size(const std::string &wa_str, int pane_id, int nitems, int ng=0)
Set the sizes of an attribute.
void print_profile(const std::string &fname, const std::string &header)
Window * get_window_object(int hdl)
MPI_Comm get_communicator(const std::string &wname)
int get_verbose() const
Determines whether verbose is on.
void delete_attribute(const std::string &wa)
Delete an existing attribute from a window.
int _f90ptr_treat
Treatement of F90 pointers.
Roccom_map< std::pair< void *, std::set< std::string > > > Module_map
void get_panes(const std::string &wname, std::vector< int > &paneids_vec, int rank=-2, int **pane_ids=NULL)
Obtain the panes of a given window on a specific process.
void set_object(const std::string &wa, const int pane_id, void *obj_addr, void *casted_obj)
Associates an object with a specific window.
void wait(int)
Wait for the completion of a nonblocking call.
void(* Func_ptr)()
Pointer of functions.
static bool initialized()
Checks whether Roccom has been initialized.
void get_connectivities(const std::string &wname, int pane_id, int *nc, std::string &str, char **names=NULL)
Obtain the connectivity tables of a pane of the given window.
void call_function(int wf, int count, void **args, const int *lens=NULL, bool from_c=true)
Invoke a function with given arguments.
MPI_Comm _comm
Default communicator of Roccom.
int get_status(const std::string &wa_str, int pane_id)
Get the status of an attribute.
void set_member_function_helper(const std::string &wf, T ptr, const std::string &wa, const std::string &intents, const COM_Type *types, bool ff=false)
void get_windows(std::vector< std::string > &)
Obtain a list of all window names.
void get_parent(const std::string &waname, int pane_id, std::string &str, char **name=NULL)
Obtain the parent attribute's name of a given attribute on a given pane.
bool _profile_on
Indicates whether should profile.
void new_window(const std::string &wname, MPI_Comm comm)
Creates a window with given name.
void clone_attribute(const std::string &wname, const std::string &pwname, int withghost=1, const char *cndname=NULL, int val=0)
Clone the subset of panes of another window of which the given pane attribute has value val...
void get_object(const std::string &wa, const int pane_id, void **ptr)
Associates an object with a specific window.
static Roccom_base * roccom_base
void set_verbose(int v)
Changes the verbose setting.
Function & get_function(const int)
Obtains a reference to an attribute from its handle.
void get_bounds(const std::string &wa, const int pane_id, void *lbnd, void *ubnd)
~Roccom_base()
Destructor.
int get_attribute_handle_const(const std::string &waname)
int _errorcode
Error code.
void set_debug(bool debug)
Turns on debuging messages.
void get_f90pointer(const std::string &waname, void *ptr, Func_ptr f, long int l)
static void set_roccom(Roccom_base *)
Set the Roccom pointer to the given object.
int _verbose
Indicates whether verbose is on.
void set_function_verbose(int i, int level)
void append_array(const std::string &wa, const int pane_id, const void *val, int v_strd, int v_size)
Append an array to the end of the attribute on a specific pane and return the new address by setting ...
Window::Pointer_descriptor Pointer_descriptor
std::vector< double > _timer
Timers for function calls.
static MPI_Comm get_default_communicator()
Get the default communicator of Roccom.
This file indirectly includes the following files: iostream, map, string, vector, and roccom_basic...
void set_profiling_barrier(int hdl, MPI_Comm comm)
int test(int)
Test whether a nonblocking call has finished.
void set_bounds(const std::string &wa, const int pane_id, T lbnd, T ubnd)
void window_init_done(const std::string &wname, bool panechanged=true)
Marks the end of the registration of a window.
bool _debug
Indicated whether debug mode is on.
void set_f90pointer(const std::string &waname, void *ptr, Func_ptr f, long int l)
bool _mpi_initialized
Indicates whether MPI was initialized by Roccom.
void turn_off_exception()
int check_bounds(const std::string &wa, int pane_id)
static void set_default_communicator(MPI_Comm comm)
Set the default communicator of Roccom.
COM_END_NAME_SPACE COM::Roccom_base * COM_get_roccom()
static Roccom_base * get_roccom()
Get a pointer to the Roccom object.
int split_name(const std::string &wa, std::string &wname, std::string &aname, bool tothrow=true)
Extracts the window and attribute names from "window.attribute".
void get_modules(std::vector< std::string > &)
Obtain a list of all module names.
void set_array(const std::string &wa, const int pane_id, void *addr, int strd=0, int cap=0, bool is_const=false)
Associates an array with an attribute for a specific pane.
int _cppobj_casting
Treatement of C++ objects.
void copy_attribute(const std::string &wname, const std::string &pwname, int withghost=1, const char *cndname=NULL, int val=0)
Copy an attribute onto another.
void get_array(const std::string &wa, const int pane_id, void **addr, int *strd=NULL, int *cap=0, bool is_const=false)
Get the address for an attribute on a specific pane.
void new_attribute(const std::string &wa, const char loc, const int data_type, int size, const std::string &unit)
Creates a new attribute for a window.
void allocate_array(const std::string &wa, const int pane_id=0, void **addr=NULL, int strd=0, int cap=0)
Allocate space for an attribute on a specific pane and return the address by setting addr...
static int get_sizeof(COM_Type type, int count=1)
Gets the size of the data type given by its index.
void set_profiling(int i)
This subroutine turns on (or off) profiling if i==1 (or ==0).
void icall_function(int wf, int count, void *args[], int *reqid, const int *lens=NULL)
Nonblockingly invoke a function with given arguments.
int get_function_handle(const std::string &wfname)