Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
readsdv.C File Reference
#include "roccom.h"
#include <vector>
#include <iostream>
Include dependency graph for readsdv.C:

Go to the source code of this file.

Classes

struct  Subdiv
 

Functions

void Rocin_load_module (const char *)
 Load the module Rocin into Roccom using the given module name. More...
 
void Rocin_unload_module (const char *)
 Unload the module Rocin from Roccom. More...
 
void read_pane_sp (std::string &fname, const std::string &prefix, int pid, Subdiv &sd)
 
int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 137 of file readsdv.C.

References COM_finalize(), COM_init(), and read_pane_sp().

137  {
138  COM_init( &argc, &argv);
139 
140  if ( argc<3) {
141  std::cerr << "Usage: " << argv[0] << " <file-name> <prefix> <pane_id>\n"
142  << "Example: " << argv[0] << "A_101_sdv.hdf A 101" << std::endl;
143  exit(-1);
144  }
145 
146  std::string fname = argv[1], prefix = argv[2];
147  int pid = std::atoi(argv[3]);
148 
149  // Reading the given pane from the file into the structure.
150  Subdiv sd;
151  read_pane_sp( fname, prefix, pid, sd);
152 
153  COM_finalize();
154 }
void read_pane_sp(std::string &fname, const std::string &prefix, int pid, Subdiv &sd)
Definition: readsdv.C:52
Definition: readsdv.C:33
void COM_finalize()
Definition: roccom_c++.h:59
void COM_init(int *argc, char ***argv)
Definition: roccom_c++.h:57

Here is the call graph for this function:

void read_pane_sp ( std::string &  fname,
const std::string &  prefix,
int  pid,
Subdiv sd 
)

Definition at line 52 of file readsdv.C.

References COM_call_function(), COM_copy_array(), COM_delete_window(), COM_get_attribute_handle(), COM_get_function_handle(), COM_get_size(), MPI_COMM_SELF, Rocin_load_module(), Rocin_unload_module(), Subdiv::subface_counterparts, Subdiv::subface_nat_coors, Subdiv::subface_offsets, Subdiv::subface_parents, Subdiv::subfaces, Subdiv::subnode_counterparts, Subdiv::subnode_ncs, Subdiv::subnode_parents, and Subdiv::subnode_subIDs.

Referenced by main().

55  {
56 
57  // Load Rocin into Roccom
58  Rocin_load_module( "SDV_IN");
59 
60  // Obtain function handles to Rocin functions
61  int hdl_read = COM_get_function_handle( "SDV_IN.read_windows");
62  int hdl_obtain = COM_get_function_handle( "SDV_IN.obtain_attribute");
63 
64  // Define the base-window and sdv-window names
65  std::string bufprefix = "__BUF";
66  std::string sdv_material = prefix+"_sdv";
67  std::string sdv_wname = bufprefix+sdv_material;
68 
69  // Read the pane from the given file. Note that the file contains both
70  // the parent and the subdivided windows. Read only the subdivided one.
71  MPI_Comm comm_self = MPI_COMM_SELF;
72  COM_call_function( hdl_read, fname.c_str(), bufprefix.c_str(),
73  sdv_material.c_str(), &comm_self);
74  int hdl_all = COM_get_attribute_handle( (sdv_wname+".all").c_str());
75  COM_call_function( hdl_obtain, &hdl_all, &hdl_all, &pid);
76 
77  // Obtain number of sub-nodes, sub-faces, nodes, and faces
78  int nsubn, nsubf, nn, nf;
79  COM_get_size( (sdv_wname+".sn_parent_fcID").c_str(), pid, &nsubn);
80  COM_get_size( (sdv_wname+".:t3").c_str(), pid, &nsubf);
81 
82  COM_get_size( (sdv_wname+".sn_subID").c_str(), pid, &nn);
83  COM_get_size( (sdv_wname+".sf_offset").c_str(), pid, &nf);
84 
85  // Obtain the connectivity
86  sd.subfaces.resize( 3*nsubf);
87  COM_copy_array( (sdv_wname+".:t3").c_str(), pid, &sd.subfaces[0], 3);
88  // NOTE: The last argument (3) indicates that three sub-node IDs are stored
89  // consecutively for each sub-face. Use the number one (1) if the first
90  // sub-nodes of all sub-faces are stored together followed by the second
91  // sub-nodes and then third.
92 
93 
94  // Obtain subnode_parents, subnode_ncs, and subnode_counterparts
95  sd.subnode_parents.resize( nsubn);
96  COM_copy_array( (sdv_wname+".sn_parent_fcID").c_str(),
97  pid, &sd.subnode_parents[0]);
98 
99  sd.subnode_ncs.resize( 2*nsubn);
100  COM_copy_array( (sdv_wname+".sn_parent_ncs").c_str(), pid, &sd.subnode_ncs[0], 2);
101  // NOTE: The last argument (2) indicates that the two local coordinates are
102  // stored consecutively. Use the number one (1) if the first local parameter
103  // (xi) of all sub-nodes are stored together followed by the second one (eta).
104 
105  sd.subnode_subIDs.resize( nn);
106  COM_copy_array( (sdv_wname+".sn_subID").c_str(), pid, &sd.subnode_subIDs[0]);
107 
108  sd.subnode_counterparts.resize( nsubn);
109  COM_copy_array( (sdv_wname+".sn_cntpt_ndID").c_str(),
110  pid, &sd.subnode_counterparts[0]);
111 
112  sd.subface_parents.resize( nsubf);
113  COM_copy_array( (sdv_wname+".sf_parent").c_str(), pid, &sd.subface_parents[0]);
114 
115  sd.subface_nat_coors.resize( nsubf*6);
116  COM_copy_array( (sdv_wname+".sf_ncs").c_str(), pid,
117  &sd.subface_nat_coors[0], 6);
118  // NOTE: The last argument (6) indicates that the local coordinates are
119  // stored consecutively (xi1, eta1, xi2, eta2, xi3, eta3). Use the number
120  // one (1) if the xi1 for all nodes are stored together and then xi2, etc..
121 
122  // Obtain subface_offsets
123  sd.subface_offsets.resize( nf);
124  COM_copy_array( (sdv_wname+".sf_offset").c_str(), pid, &sd.subface_offsets[0]);
125 
126  sd.subface_counterparts.resize( nsubf);
127  COM_copy_array( (sdv_wname+".sf_cntpt_fcID").c_str(), pid,
128  &sd.subface_counterparts[0]);
129 
130  // Delete the window created by Rocin.
131  COM_delete_window( sdv_wname.c_str());
132 
133  // Unload Rocin from Roccom.
134  Rocin_unload_module( "SDV_IN");
135 }
void Rocin_load_module(const char *name)
Load the module Rocin into Roccom using the given module name.
Definition: Rocin.C:3063
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_COMM_SELF
void COM_delete_window(const char *wname)
Definition: roccom_c++.h:94
std::vector< int > subfaces
Definition: readsdv.C:34
std::vector< int > subface_offsets
Definition: readsdv.C:43
std::vector< float > subnode_ncs
Definition: readsdv.C:37
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
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
std::vector< int > subnode_parents
Definition: readsdv.C:36
std::vector< int > subface_counterparts
Definition: readsdv.C:44
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
std::vector< int > subface_parents
Definition: readsdv.C:41
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
std::vector< float > subface_nat_coors
Definition: readsdv.C:42
std::vector< int > subnode_counterparts
Definition: readsdv.C:39
std::vector< int > subnode_subIDs
Definition: readsdv.C:38
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428
void Rocin_unload_module(const char *name)
Unload the module Rocin from Roccom.
Definition: Rocin.C:3066

Here is the call graph for this function:

Here is the caller graph for this function:

void Rocin_load_module ( const char *  name)

Load the module Rocin into Roccom using the given module name.

This module provides three subroutines: "read_windows", "read_by_control_file", and "obtain_attribute".

Definition at line 3063 of file Rocin.C.

References Rocin::init().

3064 { Rocin::init( std::string(name)); }
static void init(const std::string &mname)
Initialize the module by registering it to Roccom with the given module name.
Definition: Rocin.C:2351

Here is the call graph for this function:

void Rocin_unload_module ( const char *  )

Unload the module Rocin from Roccom.

Definition at line 3066 of file Rocin.C.

References Rocin::finalize().

3067 { Rocin::finalize( std::string(name)); }
static void finalize(const std::string &mname)
Finalize the module by deregistering it from Roccom.
Definition: Rocin.C:2417

Here is the call graph for this function: