Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
roccom_c.h
Go to the documentation of this file.
1 /* *******************************************************************
2  * Rocstar Simulation Suite *
3  * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4  * *
5  * Illinois Rocstar LLC *
6  * Champaign, IL *
7  * www.illinoisrocstar.com *
8  * sales@illinoisrocstar.com *
9  * *
10  * License: See LICENSE file in top level of distribution package or *
11  * http://opensource.org/licenses/NCSA *
12  *********************************************************************/
13 /* *******************************************************************
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22  *********************************************************************/
23 /* $Id: roccom_c.h,v 1.26 2008/12/06 08:43:25 mtcampbe Exp $ */
24 
31 /* Author: Xiangmin Jiao
32  * Dates: Jan. 10, 2001
33  */
34 
35 #ifndef __ROCCOM_C_H__
36 #define __ROCCOM_C_H__
37 
38 #include "roccom_basic.h"
39 #include "commpi.h"
40 #include <string.h>
41 
42 /* C API of Roccom. */
43 #ifdef __cplusplus
44 extern "C" {
45 #endif /* __cplusplus */
46 
47 #define LOAD_MODULE_WRAPPER( mixed, lower, UPPER) \
48  \
49  void mixed ## _load_module( const char * mod) { \
50  extern void COM_F_FUNC2( lower ## _load_module, UPPER ## _LOAD_MODULE) \
51  ( const char *mod, long int len); \
52  \
53  long int len = strlen(mod); \
54  COM_F_FUNC2( lower ## _load_module, UPPER ## _LOAD_MODULE) \
55  ( mod, len); \
56  } \
57  \
58  void mixed ## _unload_module( const char * mod) { \
59  extern void COM_F_FUNC2( lower ## _unload_module, UPPER ## _UNLOAD_MODULE) \
60  ( const char *mod, long int len); \
61  \
62  long int len = strlen(mod); \
63  COM_F_FUNC2( lower ## _unload_module, UPPER ## _UNLOAD_MODULE) \
64  ( mod, len); \
65  }
66 
70  void COM_init( int *argc, char ***argv);
71  void COM_finalize();
72  int COM_initialized();
73  void COM_abort( int ierr);
74 
75  void COM_set_default_communicator( MPI_Comm comm);
82  void COM_load_module( const char *libname, const char *winname);
83  void COM_unload_module( const char *libname, const char *winname);
84 
90  /* Creation and deletion of a window. str specifies a window's name.
91  * The length of a string can be omitted for C/C++ code. For Fortran,
92  * the lengths are passed automatically by the compilers.
93  * (Same for all other routines.) */
94  void COM_new_window( const char *w_str, MPI_Comm c);
95  void COM_delete_window( const char *str);
96 
97  /* Deregistering a pane from Roccom
98  * w_str is a window's name.
99  * pane_id is the id of a pane which was created before. */
100  void COM_delete_pane( const char *w_str,
101  const int pane_id);
102 
103  /* This marks the end of the initialization of a window,
104  * w_str is a window's name. */
105  void COM_window_init_done( const char *w_str, int pane_changed);
106 
128  void COM_new_attribute( const char *wa_str,
129  const char loc,
130  const int type,
131  int ncomp,
132  const char *unit);
133 
135  void COM_delete_attribute( const char *wa_str);
136 
137 #ifndef C_ONLY
138 
141  void COM_set_size( const char *wa_str, int pane_id, int size, int ng);
142 
145  void COM_set_array( const char *wa_str, int pane_id,
146  void *addr, int strd, int cap);
147 
149  void COM_set_bounds( const char *wa_str, int pane_id,
150  const void *lbound, const void *ubound);
151 
155  void COM_allocate_array( const char *wa_str, int pane_id,
156  void **addr, int strd, int cap);
157 
163  void COM_resize_array( const char *wa_str, int pane_id,
164  void **addr, int strd, int cap);
165 
168  void COM_append_array( const char *wa_str, int pane_id,
169  const void *val, int v_strd, int v_size);
170 
173  void COM_use_attribute( const char *wname, const char *attr,
174  int with_ghost, const char *ptnname, int val);
175 
178  void COM_clone_attribute( const char *wname, const char *attr,
179  int with_ghost, const char *ptnname, int val);
180 
182  void COM_copy_attribute( const char *wname, const char *attr,
183  int with_ghost, const char *ptnname, int val);
184 
185  void COM_copy_attribute_handles( int trg_hdl, int src_hdl,
186  int with_ghost, int ptn_hdl, int val) ;
187 
190  void COM_deallocate_array( const char *wa_str, const int pid);
191 
193  void COM_get_size(const char *wa_str, int pane_id, int *size, int *ng);
194 
196  void COM_get_attribute(const char *wa_str, char *loc,
197  int *type, int *ncomp, char *unit, int n);
198 #endif
199 
201  void COM_get_array( const char *wa_str, int pane_id,
202  void **addr, int *strd, int *cap);
203 
205  void COM_copy_array( const char *wa_str, int pane_id,
206  void *val, int v_strd, int v_size, int offset);
207 
209  void COM_get_bounds( const char *wa_str, int pane_id,
210  void *lbound, void *ubound);
211 
213  int COM_check_bounds( const char *wa_str, int pane_id);
214 
217  void COM_get_attribute( const char *wa_str, char *loc,
218  int *type, int *ncomp, char *unit, int n);
224  void COM_get_communicator( const char *wname, MPI_Comm *comm);
225 
226  void COM_get_panes( const char *wname, int *npanes,
227  int **pane_ids, int rank);
228 
229  void COM_get_attributes( const char *wname, int *na, char **names);
230 
231  void COM_get_connectivities( const char *wname, int pane_id,
232  int *nc, char **names);
233 
234  void COM_get_parent( const char *waname, int pane_id, char **parent);
235 
236  void COM_free_buffer( char **buf);
237 
238  int COM_get_window_handle( const char *wname);
239  int COM_get_attribute_handle( const char *waname);
240  int COM_get_attribute_handle_const( const char *waname);
241  int COM_get_function_handle( const char *wfname);
242 
243  int COM_get_status( const char *waname, const int pane_id);
244 
251  /* Associate a function pointer with a name.
252  * The function can take up to seven arguments of void* type
253  * and return no value. */
254  void COM_set_function( const char *wf_str,
255  Func_ptr func,
256  const char *intents,
257  const COM_Type *types);
258 
259  void COM_set_member_function( const char *wf_str,
260  Func_ptr func,
261  const char *wa_str,
262  const char *intents,
263  const COM_Type *types);
264 
265  /* Invoke a function by a name registered to Roccom. */
266  void COM_call_function( const int wf, int argc, ...);
267 
268  /* Non-blocking invocation of a function by a name registered to Roccom. */
269  void COM_icall_function( const int wf, int argc, ...);
270 
271  void COM_wait( const int id);
272  int COM_test( const int id);
273 
279  void COM_set_verbose( int i);
280  void COM_set_debug( bool debug);
281  void COM_set_profiling( int i);
282  void COM_set_profiling_barrier( int hdl, MPI_Comm comm);
283  void COM_print_profile( const char *fname, const char *header);
284  /*\}*/
285 
289  int COM_get_sizeof( const COM_Type type, int c);
290  int COM_compatible_types( COM_Type type1, COM_Type type2);
291 
292  int COM_get_error_code();
293  /*\}*/
294 #ifdef __cplusplus
295 }
296 #endif /* __cplusplus */
297 
298 #endif /* __ROCCOM_C_H__ */
299 
300 
301 
302 
303 
304 
305 
void COM_wait(const int id)
Definition: roccom_c++.h:537
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
void COM_get_communicator(const char *wname, MPI_Comm *comm)
Definition: roccom_c++.h:346
void COM_set_debug(bool debug)
Definition: roccom_c++.h:546
void COM_abort(int ierr)
Definition: roccom_c++.h:64
void COM_delete_window(const char *wname)
Definition: roccom_c++.h:94
void COM_get_attribute(const std::string wa_str, char *loc, int *type, int *ncomp, std::string *unit)
Definition: roccom_c++.h:269
int COM_initialized()
Definition: roccom_c++.h:62
void COM_set_size(const char *wa_str, int pane_id, int size, int ng=0)
Set sizes of for a specific attribute.
Definition: roccom_c++.h:136
void COM_set_default_communicator(MPI_Comm comm)
Definition: roccom_c++.h:67
void COM_set_function(const char *wf_str, Func_ptr func, const char *intents, const COM_Type *types)
Definition: roccom_c++.h:323
void COM_get_array(const char *wa_str, int pane_id, void **addr, int *strd, int *cap)
Get the address for an attribute on a specific pane.
void COM_get_bounds(const char *wa_str, int pane_id, void *lbound, void *ubound)
Get the lower and upper bounds of an attribute.
Definition: roccom_c++.h:316
real *8 function offset(vNorm, x2, y2, z2)
Definition: PlaneNorm.f90:211
void COM_set_verbose(int i)
Definition: roccom_c++.h:543
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
This file contains some definitions of macros and constants for Roccoms.
void COM_delete_attribute(const char *wa_str)
Delete an existing attribute.
Definition: roccom_c++.h:128
void COM_copy_array(const char *wa_str, 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.
Definition: roccom_c++.h:311
void COM_deallocate_array(const char *wa_str, const int pid=0)
Deallocate space for an attribute in a pane, asuming the memory was allocated allocate_mesh or alloca...
Definition: roccom_c++.h:262
int COM_get_error_code()
Definition: roccom_c++.h:566
void COM_get_connectivities(const char *wname, int pane_id, int *nc, std::string &names)
Definition: roccom_c++.h:363
int COM_test(const int id)
Definition: roccom_c++.h:540
void COM_set_bounds(const char *wa_str, int pane_id, const void *lbound, const void *ubound)
Set the lower and upper bounds of an attribute.
Definition: roccom_c++.h:176
void COM_get_attributes(const char *wname, int *na, std::string &names)
Definition: roccom_c++.h:360
void COM_finalize()
Definition: roccom_c++.h:59
void COM_load_module(const char *libname, const char *winname)
Definition: roccom_c++.h:75
void COM_use_attribute(const char *wname, const char *attr, int wg=1, const char *ptnname=0, int val=0)
Use the subset of panes of another window of which the given pane attribute has value val...
Definition: roccom_c++.h:224
void COM_print_profile(const char *fname, const char *header)
Definition: roccom_c++.h:557
void(* Func_ptr)()
Pointer of functions.
Definition: roccom_basic.h:123
int COM_compatible_types(COM_Type type1, COM_Type type2)
Definition: roccom_c++.h:563
blockLoc i
Definition: read.cpp:79
int COM_check_bounds(const char *wa_str, int pane_id)
Check the lower and upper bounds of an attribute for a specific pane.
Definition: roccom_c++.h:320
Contains declarations of MPI subroutines used in Roccom.
void COM_set_profiling_barrier(int hdl, MPI_Comm comm)
Definition: roccom_c++.h:554
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
const NT & n
void COM_get_size(const char *wa_str, int pane_id, int *size, int *ng=0)
Get the sizes of an attribute.
Definition: roccom_c++.h:274
int COM_get_sizeof(const COM_Type type, int c)
Definition: roccom_c++.h:560
void COM_clone_attribute(const char *wname, const char *attr, int wg=1, const char *ptnname=0, int val=0)
Clone the subset of panes of another window of which the given pane attribute has value val...
Definition: roccom_c++.h:234
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
Definition: roccom_c++.h:86
void COM_set_profiling(int i)
Definition: roccom_c++.h:550
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
void COM_unload_module(const char *libname, const char *winname=NULL)
Definition: roccom_c++.h:78
void COM_allocate_array(const char *wa_str, 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...
Definition: roccom_c++.h:196
void COM_set_array(const char *wa_str, int pane_id, void *addr, int strd=0, int cap=0)
Associates an array with an attribute for a specific pane.
Definition: roccom_c++.h:156
int COM_get_attribute_handle_const(const char *waname)
Definition: roccom_c++.h:420
int COM_get_window_handle(const char *wname)
Definition: roccom_c++.h:404
void COM_delete_pane(const char *str, int pid)
Definition: roccom_c++.h:110
void COM_init(int *argc, char ***argv)
Definition: roccom_c++.h:57
void COM_get_parent(const char *waname, int pane_id, std::string &parent)
Definition: roccom_c++.h:367
void COM_copy_attribute_handles(int trg_hdl, int src_hdl, int with_ghost, int ptn_hdl, int val)
void COM_copy_attribute(const char *wname, const char *attr, int wg=1, const char *ptnname=0, int val=0)
Copy an attribute onto another.
Definition: roccom_c++.h:244
void COM_new_attribute(const char *wa_str, const char loc, const int type, int ncomp, const char *unit)
Registering an attribute type.
Definition: roccom_c++.h:118
void COM_get_panes(const char *wname, std::vector< int > &pane_ids, int rank=-2)
Definition: roccom_c++.h:350
void COM_free_buffer(int **buf)
Definition: roccom_c++.h:397
void COM_set_member_function(const char *wf_str, Member_func_ptr func, const char *wa_str, const char *intents, const COM_Type *types)
Definition: roccom_c++.h:330
static int rank
Definition: advectest.C:66
MPI_Comm COM_get_default_communicator()
Definition: roccom_c++.h:69
void COM_append_array(const char *wa_str, 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 ...
Definition: roccom_c++.h:214
void COM_icall_function(const int wf, int argc,...)
Definition: roccom_c.C:64
void COM_resize_array(const char *wa_str, 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.
Definition: roccom_c++.h:200
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428
int COM_get_status(const char *waname, const int pane_id)
Definition: roccom_c++.h:431