Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
bordertest_struc.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 #include "roccom.h"
24 #include <iostream>
25 #include <sstream>
26 
27 COM_EXTERN_MODULE(Rocmap);
29 
30 using namespace std;
31 
32 // ==== Routines for creating mesh information
33 //void init_structure_mesh( double coors_s[3][10][6][5]) {
34 void init_structure_mesh( double coors_s[5][6][10][3]) {
35 //void init_structure_mesh( double coors_s[3][5][6][10]) {
36 
37 for (int i=0; i<10; i++){
38  for (int j=0; j<6; j++){
39  for (int k=0; k<5; k++){
40  coors_s[k][j][i][0] = i*.02;
41  coors_s[k][j][i][1] = j*.02;
42  coors_s[k][j][i][2] = k*.02;
43  }
44  }
45 }
46 
47 }
48 
49 bool is_local( int pid, int comm_rank, int comm_size) {
50  return ( pid % comm_size == comm_rank);
51 }
52 
53 int main(int argc, char *argv[]) {
54  const int ni=10, nj=6, nk=5;
55  int total = ni*nj*nk;
56  double coors_s[nk][nj][ni][3];
57  int dims[3];
58  dims[0] = ni;
59  dims[1] = nj;
60  dims[2] = nk;
61  //int elmts[num_elmts][8];
62 
63  COM_init( &argc, &argv);
64  COM_LOAD_MODULE_STATIC_DYNAMIC(Rocmap, "MAP");
66 
67 
68  COM_new_window("str");
69  COM_new_attribute("str.borders", 'n', COM_INTEGER, 1, "");
70 
71  init_structure_mesh( coors_s);
72 
73  COM_set_array_const("str.:st3:actual", 1, dims);
74  COM_set_size("str.nc", 1, total);
75  COM_set_array("str.nc", 1, &coors_s[0][0][0][0], 3);
76 
77  COM_resize_array( "str.borders");
78  COM_window_init_done("str");
79 
80 
81  int mesh_hdl = COM_get_attribute_handle("str.mesh");
82 
83 
84  std::cout << "Get border nodes... " << endl;
85 
86  int MAP_border_nodes = COM_get_function_handle( "MAP.pane_border_nodes");
87 
88  int borders_hdl = COM_get_attribute_handle( "str.borders");
89  COM_call_function( MAP_border_nodes, &mesh_hdl, &borders_hdl);
90 
91  // Output solution into file.
92  int OUT_write = COM_get_function_handle( "OUT.write_attribute");
93 
94  COM_call_function( OUT_write, "strucmesh", &borders_hdl,
95  "strucmesh", "000");
96  //COM_call_function( OUT_write, "strucmesh1", &mesh_hdl,
97  //"strucmesh1", "000");
98 
99  COM_finalize();
100 }
101 
102 
103 
104 
105 
106 
j indices k indices k
Definition: Indexing.h:6
void COM_set_size(const char *wa_str, int pane_id, int size, int ng=0)
Set sizes of for a specific attribute.
Definition: roccom_c++.h:136
void init_structure_mesh(double coors_s[5][6][10][3])
This file contains the prototypes for Roccom API.
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
bool is_local(int pid, int comm_rank, int comm_size)
void COM_finalize()
Definition: roccom_c++.h:59
Definition: Rocout.h:81
blockLoc i
Definition: read.cpp:79
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
Definition: roccom_c++.h:86
void COM_set_array_const(const char *wa_str, int pane_id, const void *addr, int strd=0, int cap=0)
Definition: roccom_c++.h:160
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
void COM_set_array(const char *wa_str, int pane_id, void *addr, int strd=0, int cap=0)
Associates an array with an attribute for a specific pane.
Definition: roccom_c++.h:156
int main(int argc, char *argv[])
Definition: blastest.C:94
void int int * nk
Definition: read.cpp:74
j indices j
Definition: Indexing.h:6
void COM_init(int *argc, char ***argv)
Definition: roccom_c++.h:57
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
void COM_new_attribute(const char *wa_str, const char loc, const int type, int ncomp, const char *unit)
Registering an attribute type.
Definition: roccom_c++.h:118
void int * nj
Definition: read.cpp:74
double coors_s[total_npanes][num_nodes][3]
Definition: ex1.C:99
#define COM_LOAD_MODULE_STATIC_DYNAMIC(moduleName, windowString)
Definition: roccom_basic.h:111
void COM_resize_array(const char *wa_str, int pane_id=0, void **addr=NULL, int strd=-1, int cap=0)
Resize an attribute on a specific pane and return the address by setting addr.
Definition: roccom_c++.h:200
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428
#define COM_EXTERN_MODULE(moduleName)
Definition: roccom_basic.h:116