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

Go to the source code of this file.

Functions

 COM_EXTERN_MODULE (Rocin)
 A test program that reads in given input HDF files using Rocin and write out all the contents into one HDF file using Rocout with a given file prefix. More...
 
 COM_EXTERN_MODULE (Rocout)
 
int main (int argc, char *argv[])
 

Function Documentation

COM_EXTERN_MODULE ( Rocin  )

A test program that reads in given input HDF files using Rocin and write out all the contents into one HDF file using Rocout with a given file prefix.

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

Definition at line 43 of file intest1.C.

References COM_call_function(), COM_finalize(), COM_get_attribute_handle(), COM_get_function_handle(), COM_init(), COM_LOAD_MODULE_STATIC_DYNAMIC, COM_print_profile(), and COM_set_profiling().

43  {
44  COM_init( &argc, &argv);
45 
46  if ( argc < 3 || argc > 3 ) {
47  std::cout << "Usage: To test in serial: \n\t" << argv[0]
48  << " <input HDF file|Rocin control file> <winname>\n"
49  << "To test in parallel: \n\t" << argv[0]
50  << " -com-mpi <Rocin control file> <winname>\n"
51  << std::endl;
52  // Note: -com-mpi option will be eaten away by COM_init.
53  exit(-1);
54  }
55 
56  const char *HDF_in = argv[1];
57  const string winname(argv[2]);
58 
60 
63 
64  //===== Read in using Rocin
65  int IN_read;
66  int IN_obtain = COM_get_function_handle( "IN.obtain_attribute");
67 
68  const char *lastdot=std::strrchr( HDF_in, '.');
69  if ( lastdot && std::strcmp( lastdot, ".txt")==0) {
70  IN_read = COM_get_function_handle( "IN.read_by_control_file");
71  }
72  else {
73  IN_read = COM_get_function_handle( "IN.read_windows");
74  }
75 
76  COM_call_function( IN_read, HDF_in, winname.c_str());
77 
78  int NEW_all;
79  NEW_all = COM_get_attribute_handle ((winname+".all").c_str());
80 
81  COM_call_function( IN_obtain, &NEW_all, &NEW_all);
82 
83  //===== Write out using Rocout
84  int OUT_write = COM_get_function_handle( "OUT.write_attribute");
85  COM_call_function( OUT_write, winname.c_str(),
86  &NEW_all, winname.c_str(), "000");
87 
88  COM_print_profile("", "");
89  COM_finalize();
90 }
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
void COM_finalize()
Definition: roccom_c++.h:59
void COM_print_profile(const char *fname, const char *header)
Definition: roccom_c++.h:557
Definition: Rocin.h:64
Definition: Rocout.h:81
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_init(int *argc, char ***argv)
Definition: roccom_c++.h:57
#define COM_LOAD_MODULE_STATIC_DYNAMIC(moduleName, windowString)
Definition: roccom_basic.h:111
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428

Here is the call graph for this function: