LoAdSG
abbrevi_common.h
1/**********************************************************************************
2* Author: Christoph Pflaum, Riccarda Scherner-Griesshammer
3 * Department Informatik Lehrstuhl 10 - Systemsimulation
4 * Friedrich-Alexander Universität Erlangen-Nürnberg
5 *
6*********************************************/
7
9// abbbreviations
11
12#ifndef ABBREVICOMMON_H_
13#define ABBREVICOMMON_H_
14
15#ifdef _MPI_PARALLEL
16#include <mpi.h>
17#endif
18
19#include <iostream>
20#include <fstream>
21using std::ofstream;
22using std::cout;
23using std::endl;
24
25#include <complex>
26#include <cmath>
27
28#include <map>
29#include <cassert>
30
31
32
33#ifndef M_PI
34#define M_PI 3.1415927
35#endif
36
37enum elementTyp { pointEl, edgeEl, rectangleEl, triangleEl, quadrangleEl, hexahedronEl };
38
39
40// 1D
41//-------------
42enum dir1D { Ldir1D, Rdir1D };
43enum Ort1D { LOrt, MOrt, ROrt };
44
45// 2D
46//-------------
47// directions in 2D
48enum dir2D { Wdir2D, Edir2D, Sdir2D, Ndir2D };
49// direction of sons in 2D
50enum dir2D_sons { SWdir2D, SEdir2D, NWdir2D, NEdir2D };
51// local directions of hexahedra with fixed SD-direction
52enum local_dir_of_hex2D{ ND, ST, NT };
53
54// 3D
55//-------------
56// directions in 3D
57enum dir3D { Wdir3D, Edir3D, Sdir3D, Ndir3D, Ddir3D, Tdir3D };
58// directions fuer Soehne, oder Ecken einer Zellen
59enum dir3D_sons { WSDdir3D, ESDdir3D, WNDdir3D, ENDdir3D, WSTdir3D, ESTdir3D, WNTdir3D, ENTdir3D };
60// local directions of hexahedra with fixed SWD-direction
61enum local_dir_of_hex3D{ SED, NWD, NED, SWT, SET, NWT, NET };
62// main_directions in 3D
63enum main_dir_3D { WE_dir, SN_dir, DT_dir };
64
65// edges of a cell
66enum Edges_cell { SDed, NDed, STed, NTed, WDed, EDed, WTed, ETed,
67 SWed, SEed, NWed, NEed };
68
69// gives back eta or xi or phi
70inline double find_p ( Edges_cell ed, double eta, double xi,double phi ) {
71 if ( ed<=NTed ) return eta;
72 if ( ed<=ETed ) return xi;
73 if ( ed>NEed ) cout << " error in find_p!" << endl;
74 return phi;
75}
76
77
78// corners of an edge of a cell
79//------------------------------
80inline dir3D_sons Transform(Edges_cell ec, dir1D d) {
81 enum dir3D dir;
82 dir = (dir3D) ((ec >> 2) << 1);
83 if(dir<Sdir3D) return (dir3D_sons)(d+4*((ec>>1)&1)+2*(ec&1));
84 if(dir>Ndir3D) return (dir3D_sons)(2*((ec>>1)&1)+(ec&1)+4*d);
85 return (dir3D_sons)(4*((ec>>1)&1)+2*d+(ec&1));
86}
87
88#endif // ABBREVICOMMON_H_