Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
intest1.C
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: intest1.C,v 1.11 2008/12/06 08:43:20 mtcampbe Exp $
24 
29 #include "Rocin.h"
30 #include "Roccom_base.h"
31 #include "roccom.h"
32 #include "roccom_devel.h"
33 
34 #include <iostream>
35 #include <cstring>
36 #include <string>
37 
40 
41 using namespace std;
42 
43 int main(int argc, char *argv[]) {
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 }
91 
92 
93 
94 
95 
96 
This file contains the prototypes for Roccom API.
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
Rocin creates a series of Roccom windows by reading in a list of files.
int main(int argc, char *argv[])
Definition: blastest.C:94
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
#define COM_EXTERN_MODULE(moduleName)
Definition: roccom_basic.h:116
Contains declaration of the base class for Roccom implementations.