Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
add_aspect_ratios.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: add_aspect_ratios.C,v 1.3 2008/12/06 08:45:25 mtcampbe Exp $
24 
25 #include "roccom.h"
26 #include "mapbasic.h"
27 #include "Rocblas.h"
28 #include <iostream>
29 #include <sstream>
30 #include <fstream>
31 
32 using namespace std;
33 
34 // Necessary for handling modules in static or dynamic fashion
38 COM_EXTERN_MODULE( Rocmap);
39 COM_EXTERN_MODULE( Roblas);
40 
41 // Get the MPI rank of the process
42 int get_comm_rank( MPI_Comm comm) {
43  int rank;
44  int ierr = MPI_Comm_rank( comm, &rank); assert( ierr == 0);
45  return rank;
46 }
47 
48 // Get the size of the MPI communicator
49 int get_comm_size( MPI_Comm comm) {
50  int size;
51  int ierr = MPI_Comm_size( comm, &size); assert( ierr == 0);
52  return size;
53 }
54 
55 
56 int main(int argc, char *argv[]) {
57  MPI_Init( &argc, &argv);
58 
59  if ( argc < 3) {
60  std::cout << "Usage: " << argv[0]
61  << " <Rocin input file> <material name>" << endl;
62  exit(-1);
63  }
64  string inputfname(argv[1]);
65  const string matname(argv[2]);
66 
67  MPI_Comm comm = MPI_COMM_WORLD;
68 
69  COM_init( &argc, &argv);
70 
71  // LOAD MODULES
75 
76  // GET FUNCTION HANDLES
77  int OUT_write = COM_get_function_handle( "OUT.write_attribute");
78  int IN_read = COM_get_function_handle( "IN.read_by_control_file");
79  int MOP_asp = COM_get_function_handle( "MOP.add_aspect_ratios");
80 
81  // SET OUTPUT LEVELS
82  COM_set_verbose(11);
84 
85  const string newfname("with_aspect_ratios");
86 
87  // READ IN FILES
88  COM_call_function( IN_read,
89  inputfname.c_str(),
90  matname.c_str(),
91  &comm);
92 
93  int MAT_all = COM_get_attribute_handle((matname+".all").c_str());
94  string MyString = "001";
95 
96  // CALCULATE ASPECT RATIOS
97  COM_call_function(MOP_asp, &MAT_all);
98 
99  // PRINT SMOOTHED WINDOW
100  COM_call_function( OUT_write,
101  newfname.c_str(), //filename_pre
102  &MAT_all, // attribute
103  matname.c_str(), // material
104  "001" // time
105  );
106 
107  COM_print_profile("", "");
108 
109  COM_finalize();
110  MPI_Finalize();
111 }
112 
113 
114 
115 
116 
117 
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_WORLD
int get_comm_rank(MPI_Comm comm)
Definition: pcommpartest.C:32
This file contains the prototypes for Roccom API.
A Roccom mesh optimization module.
Definition: Rocmop.h:41
void COM_set_verbose(int i)
Definition: roccom_c++.h:543
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
void COM_finalize()
Definition: roccom_c++.h:59
int get_comm_size(MPI_Comm comm)
Definition: pcommpartest.C:37
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
Definition for Rocblas API.
int main(int argc, char *argv[])
Definition: blastest.C:94
void COM_init(int *argc, char ***argv)
Definition: roccom_c++.h:57
static int rank
Definition: advectest.C:66
#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