Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Rocin.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: Rocin.h,v 1.13 2008/12/06 08:43:19 mtcampbe Exp $
24 
30 /* Author John Norris
31  * Initial date: March 19, 2004
32  */
33 /* Modified by Phillip Alexander
34  * April 8, 2004
35  * -updated to Roccom3 compliance
36  * -added support for use as a Roccom module
37  */
38 
39 
40 #ifndef _ROCIN_H_
41 #define _ROCIN_H_
42 
43 #include "roccom.h"
44 #include "HDF4.h"
45 #include "rocin_block.h"
46 #include "roccom_devel.h"
47 
48 #ifdef USE_CGNS
49 #include "cgnslib.h"
50 #define MODE_READ CG_MODE_READ
51 #endif // USE_CGNS
52 
56 extern "C" void Rocin_load_module( const char *name);
61 extern "C" void Rocin_unload_module( const char *name);
62 //\}
63 
64 class Rocin : public COM_Object {
65 public:
67  Rocin() : m_is_local( NULL), m_base(0), m_offset(0) {}
68 
70  typedef void (*RulesPtr)(const int &pane_id, const int &comm_rank,
71  const int &comm_size, int* is_local);
72 
89  void read_by_control_file( const char* control_file_name,
90  const char* window_name,
91  const MPI_Comm* comm=NULL,
92  char* time_level=NULL,
93  const int* str_len=NULL);
94 
112  void read_window( const char* filename_patterns,
113  const char* window_name,
114  const MPI_Comm* comm=NULL,
115  RulesPtr is_local=NULL,
116  char* time_level=NULL,
117  const int *str_len=NULL);
118 
142  void read_windows(const char* filename_patterns,
143  const char* window_prefix,
144  const char* material_names=NULL,
145  const MPI_Comm* comm=NULL,
146  RulesPtr is_local=NULL,
147  char* time_level=NULL,
148  const int *str_len=NULL);
149 
161  void obtain_attribute( const COM::Attribute *attribute_in,
162  COM::Attribute *user_attribute,
163  int *pane_id=NULL);
164 
181 void read_parameter_file( const char* file_name,
182  const char* window_name,
183  const MPI_Comm *comm = NULL);
184 
185  //\}
186 
187 protected:
191  typedef void (Rocin::*MemberRulePtr)(const int&, const int&,
192  const int&, int*);
193 
194  void explicit_local( const int& pid, const int& comm_rank,
195  const int& comm_size, int* il);
196 
197  void cyclic_local(const int& pid, const int& comm_rank,
198  const int& comm_size, int* il);
199 
200  void blockcyclic_local(const int& pid, const int& comm_rank,
201  const int& comm_size, int* il);
202 
203  void register_panes(BlockMM_HDF4::iterator hdf4,
204  const BlockMM_HDF4::iterator& hdf4End,
205 #ifdef USE_CGNS
206  BlockMM_CGNS::iterator cgns,
207  const BlockMM_CGNS::iterator& cgnsEnd,
208 #endif // USE_CGNS
209  const std::string& window, RulesPtr is_local,
210  const MPI_Comm* comm, int rank, int nprocs);
211 
212  //\}
213 
214 protected:
223  static
224  void init(const std::string &mname);
225 
229  static
230  void finalize(const std::string &mname);
231  //\}
232 
236  friend void Rocin_load_module( const char *name);
237  friend void Rocin_unload_module( const char *name);
238  //\}
239 
240 protected:
242  std::set<int> m_pane_ids;
243  int m_base;
244  int m_offset;
245 
246  std::map<int32, COM_Type> m_HDF2COM;
247 #ifdef USE_CGNS
248  std::map<DataType_t, COM_Type> m_CGNS2COM;
249 #endif // USE_CGNS
250 };
251 
252 #endif
253 
254 
255 
256 
257 
258 
void blockcyclic_local(const int &pid, const int &comm_rank, const int &comm_size, int *il)
Definition: Rocin.C:2458
void Rocin_load_module(const char *name)
Load the module Rocin into Roccom using the given module name.
Definition: Rocin.C:3063
void read_windows(const char *filename_patterns, const char *window_prefix, const char *material_names=NULL, const MPI_Comm *comm=NULL, RulesPtr is_local=NULL, char *time_level=NULL, const int *str_len=NULL)
Create a series of Roccom windows by reading in a list of files.
Definition: Rocin.C:2786
void read_window(const char *filename_patterns, const char *window_name, const MPI_Comm *comm=NULL, RulesPtr is_local=NULL, char *time_level=NULL, const int *str_len=NULL)
Create a single Roccom window by reading in a list of files.
Definition: Rocin.C:2750
static void finalize(const std::string &mname)
Finalize the module by deregistering it from Roccom.
Definition: Rocin.C:2417
int m_base
Definition: Rocin.h:243
This file contains the prototypes for Roccom API.
std::set< int > m_pane_ids
Definition: Rocin.h:242
friend void Rocin_unload_module(const char *name)
Unload the module Rocin from Roccom.
Definition: Rocin.C:3066
void(Rocin::* MemberRulePtr)(const int &, const int &, const int &, int *)
Definition: Rocin.h:191
void cyclic_local(const int &pid, const int &comm_rank, const int &comm_size, int *il)
Definition: Rocin.C:2452
void register_panes(BlockMM_HDF4::iterator hdf4, const BlockMM_HDF4::iterator &hdf4End, const std::string &window, RulesPtr is_local, const MPI_Comm *comm, int rank, int nprocs)
Definition: Rocin.C:2200
bool is_local(int pid, int comm_rank, int comm_size)
static void init(const std::string &mname)
Initialize the module by registering it to Roccom with the given module name.
Definition: Rocin.C:2351
void read_parameter_file(const char *file_name, const char *window_name, const MPI_Comm *comm=NULL)
Read in parameters from a given file into the given window.
Definition: Rocin.h:64
Rocin()
Default constructor.
Definition: Rocin.h:67
std::map< int32, COM_Type > m_HDF2COM
Definition: Rocin.h:246
void(* RulesPtr)(const int &pane_id, const int &comm_rank, const int &comm_size, int *is_local)
Pointer to a function to determine locality of a pane.
Definition: Rocin.h:70
void obtain_attribute(const COM::Attribute *attribute_in, COM::Attribute *user_attribute, int *pane_id=NULL)
Fill the destination (second) attribute from files using the data corresponding to the source (first)...
Definition: Rocin.C:2431
void explicit_local(const int &pid, const int &comm_rank, const int &comm_size, int *il)
Definition: Rocin.C:2446
void read_by_control_file(const char *control_file_name, const char *window_name, const MPI_Comm *comm=NULL, char *time_level=NULL, const int *str_len=NULL)
Create a single Roccom window by reading in the files specified by the given control file...
Definition: Rocin.C:2466
static int rank
Definition: advectest.C:66
MemberRulePtr m_is_local
Definition: Rocin.h:241
friend void Rocin_load_module(const char *name)
Load the module Rocin into Roccom using the given module name.
Definition: Rocin.C:3063
int m_offset
Definition: Rocin.h:244
void Rocin_unload_module(const char *name)
Unload the module Rocin from Roccom.
Definition: Rocin.C:3066