rheolef  6.5
quadrangle_rotation_tst.cc
Go to the documentation of this file.
1 #include "rheolef/geo_element.h"
2 #include <boost/numeric/ublas/matrix.hpp>
3 using namespace std;
4 using namespace rheolef;
5 namespace ublas = boost::numeric::ublas;
6 
7 void dump (size_t order, int orient, size_t shift)
8 {
9  if (orient != 1 && orient != -1) {
10  cerr << "invalid orientation " << orient << endl;
11  exit (1);
12  }
13  if (shift > 3) {
14  cerr << "invalid shift " << shift << endl;
15  exit (1);
16  }
17  ublas::matrix<size_t> rot (order+1,order+1);
18  size_t coord[4];
19  for (size_t j = 1; j <= order-1; j++) {
20  for (size_t i = 1; i <= order-1; i++) {
21  size_t loc_iqua_j = (order-1)*(j-1) + (i-1);
22  rot(i,j) = geo_element::fix_quadrangle_indirect (orient, shift, order, loc_iqua_j);
23  }
24  }
25  cout << "order = "<<order<<", shift = " << shift << ", orientation = " << orient << endl;
26  for (size_t j = order-1; j >= 1; j--) {
27  for (size_t i = 1; i <= order-1; i++) {
28  cout << setw(5) << rot(i,j) << " ";
29  }
30  cout << endl;
31  }
32  cout << endl;
33 }
34 int main(int argc, char**argv) {
35  if (argc < 2) {
36  cerr << "usage: prog order orient shift" << endl;
37  exit (1);
38  }
39  size_t order = argc > 1 ? atoi(argv[1]) : 5;
40  for (size_t shift = 0; shift < 4; shift++) {
41  dump (order, 1, shift);
42  dump (order, -1, shift);
43  }
44 }
45