Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
blastest.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: blastest.C,v 1.8 2008/12/06 08:43:19 mtcampbe Exp $
24 
25 // Name: blastest.C
26 // Author: Greg Mackey and Xiangmin Jiao
27 // Date: 3/3/2002
28 //
29 // Testing program for Rocblas.
30 //
31 // Last modified by Xiangmin Jiao on 08/14/2002. Simplified the
32 // way of selecting test cases.
33 
34 #include <iostream>
35 #include <stdio.h>
36 #include <cassert>
37 #include "roccom.h"
38 #include "Rocblas.h"
39 
40 using namespace std;
41 
42 #define NPANE 2
43 #define NROW 2
44 #define NCOL 3
45 
46 //Function declarations.
47 void initData();
48 void printNodalData(const char *title);
49 void printStridedNodalData(const char *title);
50 void printBothNodalData(const char *title);
51 void printElementalData(const char *title);
52 void printStridedElementalData(const char *title);
53 void printBothElementalData(const char *title);
54 
55 //Nodal data.
56 double testxn[NPANE][NROW*NCOL][3];
57 double testyn[NPANE][NROW*NCOL][3];
58 double testzn[NPANE][NROW*NCOL][3];
59 
60 //Strided nodal data.
61 double testxns[NPANE][3][NROW*NCOL];
62 double testyns[NPANE][3][NROW*NCOL];
63 double testzns[NPANE][3][NROW*NCOL];
64 
65 //Elemental data.
66 double testxe[NPANE][(NROW-1)*(NCOL-1)][3];
67 double testye[NPANE][(NROW-1)*(NCOL-1)][3];
68 double testze[NPANE][(NROW-1)*(NCOL-1)][3];
69 
70 //Strided elemental data.
71 double testxes[NPANE][3][(NROW-1)*(NCOL-1)];
72 double testyes[NPANE][3][(NROW-1)*(NCOL-1)];
73 double testzes[NPANE][3][(NROW-1)*(NCOL-1)];
74 
75 //Panel data.
77 double paneTeste[NPANE][(NROW-1)*(NCOL-1)];
78 
79 //Scalar data.
80 double testscal = 10, s = 3;
81 double scalSPane[NPANE] = {4,6};
82 double scalWin[3] = {1,2,3};
83 double scalPane[NPANE][3] = {{1,2,3},{4,5,6}};
84 
85 //Coordinate data.
86 int coord[NPANE][NROW*NCOL][3];
87 
88 //Multiplicity data.
90 int emults[NPANE][(NROW-1)*(NCOL-1)];
91 
92 int doSwap = 1;
93 
94 int main(int argc, char *argv[]) {
95  int choice1, choice2, choice3=0, choice4=0;
96  int dims[2] = {NCOL, NROW};
97 
98  initData();
99 
100  std::cout << "Initializing Roccom" << std::endl;
101  COM_init(&argc, &argv);
102 
103  std::cout << "Creating window \"twin\"" << std::endl;
104  COM_new_window("twin");
105 
106  //Register normal attributes.
107  COM_new_attribute("twin.xn", 'n', COM_DOUBLE, 3, "m/s");
108  COM_new_attribute("twin.yn", 'n', COM_DOUBLE, 3, "m/s");
109  COM_new_attribute("twin.zn", 'n', COM_DOUBLE, 3, "m/s");
110  COM_new_attribute("twin.pn", 'n', COM_DOUBLE, 1, "m/s");
111  COM_new_attribute("twin.mn", 'n', COM_INTEGER, 1, "");
112  COM_new_attribute("twin.xe", 'e', COM_DOUBLE, 3, "m/s");
113  COM_new_attribute("twin.ye", 'e', COM_DOUBLE, 3, "m/s");
114  COM_new_attribute("twin.ze", 'e', COM_DOUBLE, 3, "m/s");
115  COM_new_attribute("twin.pe", 'e', COM_DOUBLE, 1, "m/s");
116  COM_new_attribute("twin.me", 'e', COM_INTEGER, 1, "");
117 
118  //Register staggered attributes.
119  COM_new_attribute("twin.xns", 'n', COM_DOUBLE, 3, "m/s");
120  COM_new_attribute("twin.yns", 'n', COM_DOUBLE, 3, "m/s");
121  COM_new_attribute("twin.zns", 'n', COM_DOUBLE, 3, "m/s");
122  COM_new_attribute("twin.xes", 'e', COM_DOUBLE, 3, "m/s");
123  COM_new_attribute("twin.yes", 'e', COM_DOUBLE, 3, "m/s");
124  COM_new_attribute("twin.zes", 'e', COM_DOUBLE, 3, "m/s");
125 
126  //Scalar attribute registration and initialization.
127  COM_new_attribute("twin.aw", 'w', COM_DOUBLE, 3, "m/s");
128  COM_new_attribute("twin.ap", 'p', COM_DOUBLE, 3, "m/s");
129  COM_new_attribute("twin.asw", 'w', COM_DOUBLE, 1, "m/s");
130  COM_new_attribute("twin.asp", 'p', COM_DOUBLE, 1, "m/s");
131 
132  COM_set_array("twin.aw", 0, &scalWin[0]);
133  COM_set_array("twin.asw", 0, &testscal);
134 
135  for(int pid = 0; pid < NPANE; pid++) {
136  //Initialize meshes.
137  COM_set_size("twin.nc", pid+1, NROW*NCOL);
138  COM_set_array("twin.nc", pid+1, &coord[pid][0][0]);
139  COM_set_array("twin.:st2:", pid+1, &dims[0]);
140 
141  //Initialize normal attributes.
142  COM_set_array("twin.xn", pid+1, &testxn[pid][0][0]);
143  COM_set_array("twin.yn", pid+1, &testyn[pid][0][0]);
144  COM_set_array("twin.zn", pid+1, &testzn[pid][0][0]);
145  COM_set_array("twin.pn", pid+1, &paneTestn[pid][0]);
146  COM_set_array("twin.mn", pid+1, &nmults[pid][0]);
147  COM_set_array("twin.xe", pid+1, &testxe[pid][0][0]);
148  COM_set_array("twin.ye", pid+1, &testye[pid][0][0]);
149  COM_set_array("twin.ze", pid+1, &testze[pid][0][0]);
150  COM_set_array("twin.pe", pid+1, &paneTeste[pid][0]);
151  COM_set_array("twin.me", pid+1, &emults[pid][0]);
152 
153  //Initialize staggered attributes.
154  COM_set_array("twin.xns", pid+1, &testxns[pid][0][0], 1);
155  COM_set_array("twin.yns", pid+1, &testyns[pid][0][0], 1);
156  COM_set_array("twin.zns", pid+1, &testzns[pid][0][0], 1);
157  COM_set_array("twin.xes", pid+1, &testxes[pid][0][0], 1);
158  COM_set_array("twin.yes", pid+1, &testyes[pid][0][0], 1);
159  COM_set_array("twin.zes", pid+1, &testzes[pid][0][0], 1);
160 
161  //Initialize scalar attributes.
162  COM_set_size("twin.ap", pid+1, 1);
163  COM_set_array("twin.ap", pid+1, &scalPane[pid][0]);
164  COM_set_size("twin.asp", pid+1, 1);
165  COM_set_array("twin.asp", pid+1, &scalSPane[pid]);
166  }
167 
168  COM_window_init_done("twin");
169 
170  Rocblas_load_module("TEST");
171 
172  std::string a1("twin.x"), a2("twin.y"), a3("twin.z"), ap("twin.p"),
173  aa("twin.a"), am("twin.m");
174 
175  //Output menus and read in choices.
176  cout << "\nChoose type of data:\n\n"
177  << "\t1) Nodal\n"
178  << "\t2) Elemental\n\n"
179  << "Enter your choice: ";
180 
181  cin >> choice1;
182  if ( choice1 == 1) {
183  a1.append("n"); a2.append("n"); a3.append("n");
184  ap.append("n"); am.append("n");
185  }
186  else if (choice1 == 2) {
187  a1.append("e"); a2.append("e"); a3.append("e");
188  ap.append("e"); am.append("e");
189  }
190 
191  cout << "\nChoose organization of data:\n\n"
192  << "\t1) Contiguous\n"
193  << "\t2) Strided\n"
194  << "\t3) Contiguous -> Strided\n"
195  << "\t4) Strided -> Contiguous\n\n"
196  << "Enter your choice: ";
197 
198  cin >> choice2;
199  if ( choice2 == 2)
200  { a1.append("s"); a2.append("s"); a3.append("s"); }
201  else if ( choice2 == 3)
202  { a3.append("s"); }
203  else if ( choice2 == 4)
204  { a1.append("s"); a2.append("s"); }
205 
206  if ( choice1 != 3) {
207  cout << "\nChoose data shape of second parameter:\n\n"
208  << "\t1) Vector / Matrix\n"
209  << "\t2) 1D Scalar (Windowed)\n"
210  << "\t3) 1D Scalar (Panel)\n"
211  << "\t4) 3D Scalar (Windowed)\n"
212  << "\t5) 3D Scalar (Panel)\n"
213  << "\t6) Scalar (Pointer)\n"
214  << "\t7) 1D Scalar (Windowed with multipliers)\n\n"
215  << "Enter your choice: ";
216 
217  cin >> choice3;
218  if ( choice3 == 2) aa.append( "sw");
219  else if ( choice3 == 3) aa.append( "sp");
220  else if ( choice3 == 4) aa.append( "w");
221  else if ( choice3 == 5) aa.append( "p");
222  else if ( choice3 == 7) aa.append( "w");
223 
224  cout << "\nChoose which operation:\n\n"
225  << "\t1) Addition\n"
226  << "\t2) Subtraction\n"
227  << "\t3) Multiplication\n"
228  << "\t4) Division\n"
229  << "\t5) Swap\n"
230  << "\t6) Assign\n"
231  << "\t7) Dot\n"
232  << "\t8) 2-Norm\n"
233  << "\t9) axpy\n\n"
234  << "Enter your choice: ";
235 
236  cin >> choice4;
237  }
238 
239  std::string op("TEST.");
240 
241  switch ( choice4) {
242  case 1: op.append("add"); break;
243  case 2: op.append("sub"); break;
244  case 3: op.append("mul"); break;
245  case 4: op.append("div"); break;
246  case 5: op.append("swap"); break;
247  case 6: op.append("copy"); break;
248  case 7: op.append("dot"); break;
249  case 8: op.append("nrm2"); break;
250  default: op.append("axpy");
251  }
252  if ( choice3 == 6) op.append("_scalar");
253 
254  // Write out initial data
255  if ( choice1 == 1 && choice2 == 1)
256  printNodalData("Before:");
257  else if ( choice1 == 1 && choice2 == 2)
258  printStridedNodalData("Before:");
259  else if ( choice1 == 1)
260  printBothNodalData("Before:");
261  else if ( choice1 == 2 && choice2 == 1)
262  printElementalData("Before:");
263  else if ( choice1 == 2 && choice2 == 2)
264  printStridedElementalData("Before:");
265  else if ( choice1 == 2)
266  printBothElementalData("Before:");
267  else {
268  printBothNodalData("Before:");
270  }
271 
272  std::cout << "Performing operation " << op << std::endl;
273 
274  int func = COM_get_function_handle( op.c_str()); assert(func);
275  int arg1 = COM_get_attribute_handle( a1.c_str()); assert(arg1);
276  int arg2 = COM_get_attribute_handle( a2.c_str()); assert(arg2);
277  int arg3 = COM_get_attribute_handle( a3.c_str()); assert(arg3);
278  int arga = COM_get_attribute_handle( aa.c_str());
279  int argm = COM_get_attribute_handle( am.c_str());
280  int argp = COM_get_attribute_handle( ap.c_str());
281 
282  switch ( choice4) {
283  case 0:
284  case 5:
285  COM_call_function( func, &arg1, &arg3); break;
286  case 1:
287  case 2:
288  case 3:
289  case 4:
290  if ( choice3 == 2 || choice3 == 3 || choice3 == 4 || choice3 == 5) {
291  COM_call_function( func, &arga, &arg1, &arg2);
292  COM_call_function( func, &arg1, &arga, &arg3);
293  }
294  else if ( choice3 == 6) {
295  COM_call_function( func, &arg1, &s, &arg2, &doSwap);
296  COM_call_function( func, &arg1, &s, &arg3, &doSwap);
297  }
298  else
299  COM_call_function( func, &arg1, &arg2, &arg3);
300  break;
301  case 6:
302  if ( choice3 == 2 || choice3 == 3 || choice3 == 4 || choice3 == 5) {
303  COM_call_function( func, &arga, &arg3);
304  }
305  else if ( choice3 == 6)
306  COM_call_function( func, &s, &arg3);
307  else {
308  COM_call_function( func, &arg1, &arg3);
309  }
310  break;
311  case 7:
312  if ( choice3 == 2 || choice3 == 3 || choice3 == 4 || choice3 == 5)
313  COM_call_function( func, &arg1, &arg2, &arga);
314  else if ( choice3 == 7)
315  COM_call_function( func, &arg1, &arg2, &arga, &argm);
316  else
317  { std::cout << "Unavailable option" << std::endl; exit(-1); }
318  break;
319  case 8:
320  if ( choice3 == 2 || choice3 == 3 || choice3 == 4 || choice3 == 5)
321  COM_call_function( func, &arg2, &arga);
322  else if ( choice3 == 7)
323  COM_call_function( func, &arg2, &arga, &argm);
324  else
325  COM_call_function( func, &arg2, &argp);
326  break;
327  case 9:
328  if ( choice3 == 2 || choice3 == 3 || choice3 == 4 || choice3 == 5)
329  COM_call_function( func, &arga, &arg1, &arg2, &arg3);
330  else if ( choice3 == 6)
331  COM_call_function( func, &s, &arg1, &arg2, &arg3);
332  else if ( choice3 == 1)
333  COM_call_function( func, &arg1, &arg1, &arg2, &arg3);
334  else
335  { std::cout << "Unavailable option" << std::endl; exit(-1); }
336  break;
337  }
338 
339  // Write out solution
340  if ( choice1 == 1 && choice2 == 1)
341  printNodalData("After:");
342  else if ( choice1 == 1 && choice2 == 2)
343  printStridedNodalData("After:");
344  else if ( choice1 == 1)
345  printBothNodalData("After:");
346  else if ( choice1 == 2 && choice2 == 1)
347  printElementalData("After:");
348  else if ( choice1 == 2 && choice2 == 2)
349  printStridedElementalData("After:");
350  else if ( choice1 == 2)
351  printBothElementalData("After:");
352  else {
353  printBothNodalData("After:");
355  }
356 
357  std::cout << "\nDeleting windows" << std::endl;
358  COM_delete_window("twin");
359 
360  Rocblas_unload_module( "TEST");
361  std::cout << "Finalizing Roccom" << std::endl;
362  COM_finalize();
363 }
364 
365 //Initializes data.
366 void initData() {
367  int i, j;
368 
369  for(i = 0; i < NPANE; i++) {
370  for(j = 0; j < NROW*NCOL; j++) {
371  //Initialize coordinate data.
372  coord[i][j][0] = (i * NROW * NCOL) + j;
373  coord[i][j][1] = j;
374  coord[i][j][2] = 1;
375 
376  //Initialize contiguous nodal data.
377  testxn[i][j][0] = j+1;
378  testxn[i][j][1] = j+2;
379  testxn[i][j][2] = j+3;
380  testyn[i][j][0] = j+4;
381  testyn[i][j][1] = j+5;
382  testyn[i][j][2] = j+6;
383  testzn[i][j][0] = 0;
384  testzn[i][j][1] = 0;
385  testzn[i][j][2] = 0;
386 
387  //Initialize staggered nodal data.
388  testxns[i][0][j] = j+1;
389  testxns[i][1][j] = j+2;
390  testxns[i][2][j] = j+3;
391  testyns[i][0][j] = j+4;
392  testyns[i][1][j] = j+5;
393  testyns[i][2][j] = j+6;
394  testzns[i][0][j] = 0;
395  testzns[i][1][j] = 0;
396  testzns[i][2][j] = 0;
397 
398  //Initialize panel nodal data.
399  paneTestn[i][j] = 4;
400 
401  //Initialize multiplicity data.
402  nmults[i][j] = 2;
403  //nmults[i][j] = i*NROW*NCOL + j + 1;
404  }
405 
406  for(j = 0; j < (NROW-1)*(NCOL-1); j++) {
407  //Initialize contiguous elemental data.
408  testxe[i][j][0] = j+1;
409  testxe[i][j][1] = j+2;
410  testxe[i][j][2] = j+3;
411  testye[i][j][0] = j+4;
412  testye[i][j][1] = j+5;
413  testye[i][j][2] = j+6;
414  testze[i][j][0] = 0;
415  testze[i][j][1] = 0;
416  testze[i][j][2] = 0;
417 
418  //Initialize staggered elemental data.
419  testxes[i][0][j] = j+1;
420  testxes[i][1][j] = j+2;
421  testxes[i][2][j] = j+3;
422  testyes[i][0][j] = j+4;
423  testyes[i][1][j] = j+5;
424  testyes[i][2][j] = j+6;
425  testzes[i][0][j] = 0;
426  testzes[i][1][j] = 0;
427  testzes[i][2][j] = 0;
428 
429  //Initialize panel elemental data.
430  paneTeste[i][j] = 4;
431 
432  //Initialize multiplicity data.
433  emults[i][j] = 2;
434  //emults[i][j] = i*(NROW-1)*(NCOL-1) + j + 1;
435  }
436  }
437 }
438 
439 //Prints contiguous nodal data.
440 void printNodalData(const char *title) {
441  int i, j, k;
442 
443  std::cout << "\n" << title << "\nx =\n";
444  for(i = 0; i < NPANE; i++) {
445  for(j = 0; j < NROW * NCOL; j++) {
446  for(k = 0; k < 3; k++)
447  std::cout << testxn[i][j][k] << " ";
448  std::cout << " ";
449  }
450  std::cout << "\n";
451  }
452 
453  std::cout << "\ny =\n";
454  for(i = 0; i < NPANE; i++) {
455  for(j = 0; j < NROW * NCOL; j++) {
456  for(k = 0; k < 3; k++)
457  std::cout << testyn[i][j][k] << " ";
458  std::cout << " ";
459  }
460  std::cout << "\n";
461  }
462 
463  std::cout << "\nz =\n";
464  for(i = 0; i < NPANE; i++) {
465  for(j = 0; j < NROW * NCOL; j++) {
466  for(k = 0; k < 3; k++)
467  std::cout << testzn[i][j][k] << " ";
468  std::cout << " ";
469  }
470  std::cout << "\n";
471  }
472 
473  std::cout << "\n\np =\n";
474  for(i = 0; i < NPANE; i++) {
475  for(j = 0; j < NROW * NCOL; j++)
476  std::cout << paneTestn[i][j] << " ";
477  std::cout << " ";
478  }
479 
480  std::cout << "\n\naw =\n";
481  for(i = 0; i < 3; i++)
482  std::cout << scalWin[i] << " ";
483 
484  std::cout << "\n\nap =\n";
485  for(i = 0; i < NPANE; i++) {
486  for(j = 0; j < 3; j++)
487  std::cout << scalPane[i][j] << " ";
488  std::cout << " ";
489  }
490 
491  std::cout << "\n\nasw = " << testscal << "\n";
492 
493  std::cout << "\nasp =\n";
494  for(i = 0; i < NPANE; i++)
495  std::cout << scalSPane[i] << " ";
496 
497  std::cout << "\n\ns = " << s << "\n";
498 }
499 
500 //Prints staggered nodal data.
501 void printStridedNodalData(const char *title) {
502  int i, j, k;
503 
504  std::cout << "\n" << title << "\nxs =\n";
505  for(i = 0; i < NPANE; i++) {
506  for(j = 0; j < 3; j++) {
507  for(k = 0; k < NROW * NCOL; k++)
508  std::cout << testxns[i][j][k] << " ";
509  std::cout << " ";
510  }
511  std::cout << "\n";
512  }
513 
514  std::cout << "\nys =\n";
515  for(i = 0; i < NPANE; i++) {
516  for(j = 0; j < 3; j++) {
517  for(k = 0; k < NROW * NCOL; k++)
518  std::cout << testyns[i][j][k] << " ";
519  std::cout << " ";
520  }
521  std::cout << "\n";
522  }
523 
524  std::cout << "\nzs =\n";
525  for(i = 0; i < NPANE; i++) {
526  for(j = 0; j < 3; j++) {
527  for(k = 0; k < NROW * NCOL; k++)
528  std::cout << testzns[i][j][k] << " ";
529  std::cout << " ";
530  }
531  std::cout << "\n";
532  }
533 
534  std::cout << "\n\np =\n";
535  for(i = 0; i < NPANE; i++) {
536  for(j = 0; j < NROW * NCOL; j++)
537  std::cout << paneTestn[i][j] << " ";
538  std::cout << " ";
539  }
540 
541  std::cout << "\n\naw =\n";
542  for(i = 0; i < 3; i++)
543  std::cout << scalWin[i] << " ";
544 
545  std::cout << "\n\nap =\n";
546  for(i = 0; i < NPANE; i++) {
547  for(j = 0; j < 3; j++)
548  std::cout << scalPane[i][j] << " ";
549  std::cout << " ";
550  }
551 
552  std::cout << "\n\nasw = " << testscal << "\n";
553 
554  std::cout << "\nasp =\n";
555  for(i = 0; i < NPANE; i++)
556  std::cout << scalSPane[i] << " ";
557 
558  std::cout << "\n\ns = " << s << "\n";
559 }
560 
561 //Prints both contiguous and staggered nodal data.
562 void printBothNodalData(const char *title) {
563  int i, j, k;
564 
565  std::cout << "\n" << title << "\nx =\n";
566  for(i = 0; i < NPANE; i++) {
567  for(j = 0; j < NROW * NCOL; j++) {
568  for(k = 0; k < 3; k++)
569  std::cout << testxn[i][j][k] << " ";
570  std::cout << " ";
571  }
572  std::cout << "\n";
573  }
574 
575  std::cout << "\ny =\n";
576  for(i = 0; i < NPANE; i++) {
577  for(j = 0; j < NROW * NCOL; j++) {
578  for(k = 0; k < 3; k++)
579  std::cout << testyn[i][j][k] << " ";
580  std::cout << " ";
581  }
582  std::cout << "\n";
583  }
584 
585  std::cout << "\nz =\n";
586  for(i = 0; i < NPANE; i++) {
587  for(j = 0; j < NROW * NCOL; j++) {
588  for(k = 0; k < 3; k++)
589  std::cout << testzn[i][j][k] << " ";
590  std::cout << " ";
591  }
592  std::cout << "\n";
593  }
594 
595  std::cout << "\n" << "\nxs =\n";
596  for(i = 0; i < NPANE; i++) {
597  for(j = 0; j < 3; j++) {
598  for(k = 0; k < NROW * NCOL; k++)
599  std::cout << testxns[i][j][k] << " ";
600  std::cout << " ";
601  }
602  std::cout << "\n";
603  }
604 
605  std::cout << "\nys =\n";
606  for(i = 0; i < NPANE; i++) {
607  for(j = 0; j < 3; j++) {
608  for(k = 0; k < NROW * NCOL; k++)
609  std::cout << testyns[i][j][k] << " ";
610  std::cout << " ";
611  }
612  std::cout << "\n";
613  }
614 
615  std::cout << "\nzs =\n";
616  for(i = 0; i < NPANE; i++) {
617  for(j = 0; j < 3; j++) {
618  for(k = 0; k < NROW * NCOL; k++)
619  std::cout << testzns[i][j][k] << " ";
620  std::cout << " ";
621  }
622  std::cout << "\n";
623  }
624 
625  std::cout << "\n\np =\n";
626  for(i = 0; i < NPANE; i++) {
627  for(j = 0; j < NROW * NCOL; j++)
628  std::cout << paneTestn[i][j] << " ";
629  std::cout << " ";
630  }
631 
632  std::cout << "\n\naw =\n";
633  for(i = 0; i < 3; i++)
634  std::cout << scalWin[i] << " ";
635 
636  std::cout << "\n\nap =\n";
637  for(i = 0; i < NPANE; i++) {
638  for(j = 0; j < 3; j++)
639  std::cout << scalPane[i][j] << " ";
640  std::cout << " ";
641  }
642 
643  std::cout << "\n\nasw = " << testscal << "\n";
644 
645  std::cout << "\nasp =\n";
646  for(i = 0; i < NPANE; i++)
647  std::cout << scalSPane[i] << " ";
648 
649  std::cout << "\n\ns = " << s << "\n";
650 }
651 
652 //Prints contiguous elemental data.
653 void printElementalData(const char *title) {
654  int i, j, k;
655 
656  std::cout << "\n" << title << "\nx =\n";
657  for(i = 0; i < NPANE; i++) {
658  for(j = 0; j < (NROW-1)*(NCOL-1); j++) {
659  for(k = 0; k < 3; k++)
660  std::cout << testxe[i][j][k] << " ";
661  std::cout << " ";
662  }
663  std::cout << "\n";
664  }
665 
666  std::cout << "\ny =\n";
667  for(i = 0; i < NPANE; i++) {
668  for(j = 0; j < (NROW-1)*(NCOL-1); j++) {
669  for(k = 0; k < 3; k++)
670  std::cout << testye[i][j][k] << " ";
671  std::cout << " ";
672  }
673  std::cout << "\n";
674  }
675 
676  std::cout << "\nz =\n";
677  for(i = 0; i < NPANE; i++) {
678  for(j = 0; j < (NROW-1)*(NCOL-1); j++) {
679  for(k = 0; k < 3; k++)
680  std::cout << testze[i][j][k] << " ";
681  std::cout << " ";
682  }
683  std::cout << "\n";
684  }
685 
686  std::cout << "\n\np =\n";
687  for(i = 0; i < NPANE; i++) {
688  for(j = 0; j < (NROW-1)*(NCOL-1); j++)
689  std::cout << paneTeste[i][j] << " ";
690  std::cout << " ";
691  }
692 
693  std::cout << "\n\naw =\n";
694  for(i = 0; i < 3; i++)
695  std::cout << scalWin[i] << " ";
696 
697  std::cout << "\n\nap =\n";
698  for(i = 0; i < NPANE; i++) {
699  for(j = 0; j < 3; j++)
700  std::cout << scalPane[i][j] << " ";
701  std::cout << " ";
702  }
703 
704  std::cout << "\n\nasw = " << testscal << "\n";
705 
706  std::cout << "\nasp =\n";
707  for(i = 0; i < NPANE; i++)
708  std::cout << scalSPane[i] << " ";
709 
710  std::cout << "\n\ns = " << s << "\n";
711 }
712 
713 //Prints staggered elemental data.
714 void printStridedElementalData(const char *title) {
715  int i, j, k;
716 
717  std::cout << "\n" << title << "\nxs =\n";
718  for(i = 0; i < NPANE; i++) {
719  for(j = 0; j < 3; j++) {
720  for(k = 0; k < (NROW-1)*(NCOL-1); k++)
721  std::cout << testxes[i][j][k] << " ";
722  std::cout << " ";
723  }
724  std::cout << "\n";
725  }
726 
727  std::cout << "\nys =\n";
728  for(i = 0; i < NPANE; i++) {
729  for(j = 0; j < 3; j++) {
730  for(k = 0; k < (NROW-1)*(NCOL-1); k++)
731  std::cout << testyes[i][j][k] << " ";
732  std::cout << " ";
733  }
734  std::cout << "\n";
735  }
736 
737  std::cout << "\nzs =\n";
738  for(i = 0; i < NPANE; i++) {
739  for(j = 0; j < 3; j++) {
740  for(k = 0; k < (NROW-1)*(NCOL-1); k++)
741  std::cout << testzes[i][j][k] << " ";
742  std::cout << " ";
743  }
744  std::cout << "\n";
745  }
746 
747  std::cout << "\n\np =\n";
748  for(i = 0; i < NPANE; i++) {
749  for(j = 0; j < (NROW-1)*(NCOL-1); j++)
750  std::cout << paneTeste[i][j] << " ";
751  std::cout << " ";
752  }
753 
754  std::cout << "\n\naw =\n";
755  for(i = 0; i < 3; i++)
756  std::cout << scalWin[i] << " ";
757 
758  std::cout << "\n\nap =\n";
759  for(i = 0; i < NPANE; i++) {
760  for(j = 0; j < 3; j++)
761  std::cout << scalPane[i][j] << " ";
762  std::cout << " ";
763  }
764 
765  std::cout << "\n\nasw = " << testscal << "\n";
766 
767  std::cout << "\nasp =\n";
768  for(i = 0; i < NPANE; i++)
769  std::cout << scalSPane[i] << " ";
770 
771  std::cout << "\n\ns = " << s << "\n";
772 }
773 
774 //Prints both contiguous and staggered elemental data.
775 void printBothElementalData(const char *title) {
776  int i, j, k;
777 
778  std::cout << "\n" << title << "\nx =\n";
779  for(i = 0; i < NPANE; i++) {
780  for(j = 0; j < (NROW-1)*(NCOL-1); j++) {
781  for(k = 0; k < 3; k++)
782  std::cout << testxe[i][j][k] << " ";
783  std::cout << " ";
784  }
785  std::cout << "\n";
786  }
787 
788  std::cout << "\ny =\n";
789  for(i = 0; i < NPANE; i++) {
790  for(j = 0; j < (NROW-1)*(NCOL-1); j++) {
791  for(k = 0; k < 3; k++)
792  std::cout << testye[i][j][k] << " ";
793  std::cout << " ";
794  }
795  std::cout << "\n";
796  }
797 
798  std::cout << "\nz =\n";
799  for(i = 0; i < NPANE; i++) {
800  for(j = 0; j < (NROW-1)*(NCOL-1); j++) {
801  for(k = 0; k < 3; k++)
802  std::cout << testze[i][j][k] << " ";
803  std::cout << " ";
804  }
805  std::cout << "\n";
806  }
807 
808  std::cout << "\n" << title << "\nxs =\n";
809  for(i = 0; i < NPANE; i++) {
810  for(j = 0; j < 3; j++) {
811  for(k = 0; k < (NROW-1)*(NCOL-1); k++)
812  std::cout << testxes[i][j][k] << " ";
813  std::cout << " ";
814  }
815  std::cout << "\n";
816  }
817 
818  std::cout << "\nys =\n";
819  for(i = 0; i < NPANE; i++) {
820  for(j = 0; j < 3; j++) {
821  for(k = 0; k < (NROW-1)*(NCOL-1); k++)
822  std::cout << testyes[i][j][k] << " ";
823  std::cout << " ";
824  }
825  std::cout << "\n";
826  }
827 
828  std::cout << "\nzs =\n";
829  for(i = 0; i < NPANE; i++) {
830  for(j = 0; j < 3; j++) {
831  for(k = 0; k < (NROW-1)*(NCOL-1); k++)
832  std::cout << testzes[i][j][k] << " ";
833  std::cout << " ";
834  }
835  std::cout << "\n";
836  }
837 
838  std::cout << "\n\np =\n";
839  for(i = 0; i < NPANE; i++) {
840  for(j = 0; j < (NROW-1)*(NCOL-1); j++)
841  std::cout << paneTeste[i][j] << " ";
842  std::cout << " ";
843  }
844 
845  std::cout << "\n\naw =\n";
846  for(i = 0; i < 3; i++)
847  std::cout << scalWin[i] << " ";
848 
849  std::cout << "\n\nap =\n";
850  for(i = 0; i < NPANE; i++) {
851  for(j = 0; j < 3; j++)
852  std::cout << scalPane[i][j] << " ";
853  std::cout << " ";
854  }
855 
856  std::cout << "\n\nasw = " << testscal << "\n";
857 
858  std::cout << "\nasp =\n";
859  for(i = 0; i < NPANE; i++)
860  std::cout << scalSPane[i] << " ";
861 
862  std::cout << "\n\ns = " << s << "\n";
863 }
864 
865 
866 
867 
868 
869 
void printBothNodalData(const char *title)
Definition: blastest.C:562
int nmults[NPANE][NROW *NCOL]
Definition: blastest.C:89
double testzns[NPANE][3][NROW *NCOL]
Definition: blastest.C:63
int emults[NPANE][(NROW-1)*(NCOL-1)]
Definition: blastest.C:90
void COM_delete_window(const char *wname)
Definition: roccom_c++.h:94
j indices k indices k
Definition: Indexing.h:6
double testxns[NPANE][3][NROW *NCOL]
Definition: blastest.C:61
double s
Definition: blastest.C:80
double scalSPane[NPANE]
Definition: blastest.C:81
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
#define NCOL
Definition: blastest.C:44
This file contains the prototypes for Roccom API.
double scalWin[3]
Definition: blastest.C:82
void printBothElementalData(const char *title)
Definition: blastest.C:775
int coord[NPANE][NROW *NCOL][3]
Definition: blastest.C:86
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
#define NROW
Definition: blastest.C:43
double testyns[NPANE][3][NROW *NCOL]
Definition: blastest.C:62
void initData()
Definition: blastest.C:366
void printStridedElementalData(const char *title)
Definition: blastest.C:714
void printElementalData(const char *title)
Definition: blastest.C:653
void COM_finalize()
Definition: roccom_c++.h:59
void Rocblas_unload_module(const char *name)
Definition: Rocblas.C:121
double testxn[NPANE][NROW *NCOL][3]
Definition: blastest.C:56
blockLoc i
Definition: read.cpp:79
double scalPane[NPANE][3]
Definition: blastest.C:83
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
double testzn[NPANE][NROW *NCOL][3]
Definition: blastest.C:58
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
Definition: roccom_c++.h:86
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
Definition for Rocblas API.
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
double testscal
Definition: blastest.C:80
double testyes[NPANE][3][(NROW-1)*(NCOL-1)]
Definition: blastest.C:72
double paneTeste[NPANE][(NROW-1)*(NCOL-1)]
Definition: blastest.C:77
double testze[NPANE][(NROW-1)*(NCOL-1)][3]
Definition: blastest.C:68
j indices j
Definition: Indexing.h:6
#define NPANE
Definition: blastest.C:42
double testzes[NPANE][3][(NROW-1)*(NCOL-1)]
Definition: blastest.C:73
double testyn[NPANE][NROW *NCOL][3]
Definition: blastest.C:57
void COM_init(int *argc, char ***argv)
Definition: roccom_c++.h:57
double testye[NPANE][(NROW-1)*(NCOL-1)][3]
Definition: blastest.C:67
void printNodalData(const char *title)
Definition: blastest.C:440
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
int doSwap
Definition: blastest.C:92
double testxes[NPANE][3][(NROW-1)*(NCOL-1)]
Definition: blastest.C:71
void printStridedNodalData(const char *title)
Definition: blastest.C:501
double testxe[NPANE][(NROW-1)*(NCOL-1)][3]
Definition: blastest.C:66
void Rocblas_load_module(const char *name)
Calls Rocblas initialization function.
Definition: Rocblas.C:118
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428
double paneTestn[NPANE][NROW *NCOL]
Definition: blastest.C:76