ElInfo3d.cc 39.8 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.


13
14
#include <typeinfo>

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "ElInfo3d.h"
#include "BasisFunction.h"
#include "Element.h"
#include "Line.h"
#include "Triangle.h"
#include "Tetrahedron.h"
#include "FiniteElemSpace.h"
#include "Flag.h"
#include "MacroElement.h"
#include "Mesh.h"
#include "Global.h"
#include "FixVec.h"
#include "DOFVector.h"

namespace AMDiS {

31
32
33
34
35
36
37
38
39
40
41
  double ElInfo3d::mat_d1_left_val[4][4] = {{1.0, 0.0, 0.0, 0.5}, 
					    {0.0, 0.0, 0.0, 0.5},
					    {0.0, 1.0, 0.0, 0.0},
					    {0.0, 0.0, 1.0, 0.0}};
  mtl::dense2D<double> ElInfo3d::mat_d1_left(mat_d1_left_val);

  
  double ElInfo3d::mat_d1_l0_right_val[4][4] = {{0.0, 0.0, 0.0, 0.5}, 
						{1.0, 0.0, 0.0, 0.5},
						{0.0, 0.0, 1.0, 0.0},
						{0.0, 1.0, 0.0, 0.0}};
42
43
  mtl::dense2D<double> ElInfo3d::mat_d1_l0_right(mat_d1_l0_right_val);

44
45
46
47
48
49
50
  double ElInfo3d::mat_d1_l12_right_val[4][4] = {{0.0, 0.0, 0.0, 0.5}, 
						 {1.0, 0.0, 0.0, 0.5},
						 {0.0, 1.0, 0.0, 0.0},
						 {0.0, 0.0, 1.0, 0.0}};
  mtl::dense2D<double> ElInfo3d::mat_d1_l12_right(mat_d1_l12_right_val);


51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173

  double ElInfo3d::mat_d4_left_val[35][35] = 
    {
      {1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.273437, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.023437, 0.0, 0.0, 0.0, 0.0, 0.023438},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.0, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.093750, 1.0, 0.468750, 0.0, 0.0, 0.0, 0.031250, 0.0, 0.0, 0.031250, 0.0, 0.0, 0.031250, 0.031250, 0.0, 0.156250, 0.0, 0.0, 0.156250, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.703125, 0.0, 0.0, 0.0, 0.015625, 0.0, 0.140625, 0.015625, 0.0, 0.140625, 0.015625, 0.015625, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.218750, 0.0, 0.0, 0.0, 0.0, 0.0, 0.031250, 0.0, 0.0, 0.031250, 0.0, 0.0, 0.031250, 0.031250, 0.0, 0.156250, 0.093750, 0.0, 0.156250, 0.093750, 0.0, 0.0, 0.0, 0.0, 0.093750},
      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1875, 0.0, 0.0, 0.0, 0.0, 0.0, 0.125, 0.0625, 0.0, 0.0, 0.0, 0.0, 0.3125, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.375, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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.0, 0.0, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.75, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.75}
    };
  mtl::dense2D<double> ElInfo3d::mat_d4_left(mat_d4_left_val);

  double ElInfo3d::mat_d4_l0_right_val[35][35] = 
    {
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.023437, 0.0, 0.0, 0.0, 0.0, 0.0, 0.023437, 0.0, 0.0, 0.023437, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.273437, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.0, 0.0, 0.023438},
      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.218750, 0.0, 0.0, 0.0, 0.0, 0.0, 0.031250, 0.0, 0.0, 0.031250, 0.0, 0.0, 0.031250, 0.031250, 0.0, 0.156250, 0.093750, 0.0, 0.156250, 0.093750, 0.0, 0.0, 0.0, 0.0, 0.093750},
      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.703125, 0.0, 0.0, 0.0, 0.015625, 0.0, 0.140625, 0.015625, 0.0, 0.140625, 0.015625, 0.015625, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.093750, 1.0, 0.468750, 0.0, 0.0, 0.0, 0.031250, 0.0, 0.0, 0.031250, 0.0, 0.0, 0.031250, 0.031250, 0.0, 0.156250, 0.0, 0.0, 0.156250, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1875, 0.0, 0.0, 0.0625, 0.125, 0.0, 0.0625, 0.125, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0625},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,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 0.0, 0.5625, 0.0, 0.0, 0.0, 0.9375, 0.375, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1875},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.75, 1.0, 0.0, 0.0, 0.25, 0.0, 0.0, 0.75, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.75}
    };
  mtl::dense2D<double> ElInfo3d::mat_d4_l0_right(mat_d4_l0_right_val);

  double ElInfo3d::mat_d4_l12_right_val[35][35] = 
    {
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.023437, 0.0, 0.0, 0.0, 0.0, 0.0, 0.023437, 0.0, 0.0, 0.023437, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.273438, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.023438, 0.0, 0.0, 0.0, 0.0, 0.023438},
      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.218750, 0.0, 0.0, 0.0, 0.0, 0.0, 0.031250, 0.0, 0.0, 0.031250, 0.0, 0.0, 0.031250, 0.031250, 0.0, 0.156250, 0.093750, 0.0, 0.156250, 0.093750, 0.0, 0.0, 0.0, 0.0, 0.093750},
      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.703125, 0.0, 0.0, 0.0, 0.015625, 0.0, 0.140625, 0.015625, 0.0, 0.140625, 0.015625, 0.015625, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.093750, 1.0, 0.468750, 0.0, 0.0, 0.0, 0.031250, 0.0, 0.0, 0.031250, 0.0, 0.0, 0.031250, 0.031250, 0.0, 0.156250, 0.0, 0.0, 0.156250, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1875, 0.0, 0.0, 0.0, 0.0, 0.0, 0.125, 0.0625, 0.0, 0.0, 0.0, 0.0, 0.0625, 0.125, 0.0, 0.0, 0.0, 0.0, 0.0625},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0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 0.5625, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5625, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.9375, 0.375, 1.0, 0.0, 0.0, 0.0, 0.1875},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.75, 1.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.75, 0.0, 0.0, 0.0, 0.0, 0.0},
      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.75},      
    };
  mtl::dense2D<double> ElInfo3d::mat_d4_l12_right(mat_d4_l12_right_val);



174
175
  void ElInfo3d::fillMacroInfo(const MacroElement * mel)
  {
176
    FUNCNAME("ElInfo3d::fillMacroInfo()");
177
178
179

    TEST_EXIT_DBG(mel)("No macro element given!\n");

180
    Element *nb;
181
    MacroElement *mnb;
182
    Flag fill_opp_coords;
183

184
    macroElement = const_cast<MacroElement*>(mel);
185
    element = const_cast<Element*>(mel->getElement());
Thomas Witkowski's avatar
Thomas Witkowski committed
186
    parent = NULL;
187
    level = 0;
188
    elType = const_cast<MacroElement*>(mel)->getElType();
189

Thomas Witkowski's avatar
Thomas Witkowski committed
190
    int vertices = mesh->getGeo(VERTEX);
191

Thomas Witkowski's avatar
Thomas Witkowski committed
192
193
    if (fillFlag.isSet(Mesh::FILL_COORDS) || 
	fillFlag.isSet(Mesh::FILL_DET) ||
194
	fillFlag.isSet(Mesh::FILL_GRD_LAMBDA))
195
      for (int i = 0; i < vertices; i++)
Thomas Witkowski's avatar
Thomas Witkowski committed
196
	coord[i] = mel->coord[i];
197

Thomas Witkowski's avatar
Thomas Witkowski committed
198
    int neighbours = mesh->getGeo(NEIGH);
199

Thomas Witkowski's avatar
Thomas Witkowski committed
200
201
    if (fillFlag.isSet(Mesh::FILL_OPP_COORDS) || 
        fillFlag.isSet(Mesh::FILL_NEIGH)) {
202

Thomas Witkowski's avatar
Thomas Witkowski committed
203
      fill_opp_coords.setFlags(fillFlag & Mesh::FILL_OPP_COORDS);
204
      for (int i = 0; i < neighbours; i++) {
205
206
207
	if ((mnb = const_cast<MacroElement*>(mel->getNeighbour(i)))) {
	  neighbour[i] = const_cast<Element*>(mel->getNeighbour(i)->getElement());
	  nb = const_cast<Element*>(neighbour[i]);
208
	  int k;
209
	  k = oppVertex[i] = mel->getOppVertex(i);
210
211

	  if (nb->getChild(0) && (k < 2)) {   /*make nb nearest element.*/
212
	    if (k == 1) {
213
214
	      neighbour[i] = const_cast<Element*>(nb->getChild(0));
	      nb = const_cast<Element*>(neighbour[i]);
215
	    } else {
216
217
	      neighbour[i] = const_cast<Element*>(nb->getChild(1));
	      nb = const_cast<Element*>(neighbour[i]);
218
	    }
219
	    k = oppVertex[i] = 3;
220
221
222
	    if (fill_opp_coords.isAnySet()) {
	      /* always edge between vertices 0 and 1 is bisected! */
	      if (mnb->getElement()->isNewCoordSet())
Thomas Witkowski's avatar
Thomas Witkowski committed
223
		oppCoord[i] = *(mnb->getElement()->getNewCoord());
224
	      else
Thomas Witkowski's avatar
Thomas Witkowski committed
225
		oppCoord[i] = (mnb->coord[0] + mnb->coord[1]) * 0.5;
226
227
	    }
	  } else {
228
	    if  (fill_opp_coords.isAnySet()) {
Thomas Witkowski's avatar
Thomas Witkowski committed
229
	      oppCoord[i] = mnb->coord[k];
230
231
	    }
	  }
232
	} else {
Thomas Witkowski's avatar
Thomas Witkowski committed
233
	  neighbour[i] = NULL;
234
235
236
237
	}
      }
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
238
239
240
    if (fillFlag.isSet(Mesh::FILL_BOUND)) {
      for (int i = 0; i < element->getGeo(BOUNDARY); i++)
	boundary[i] = mel->getBoundary(i);     
241

Thomas Witkowski's avatar
Thomas Witkowski committed
242
243
      for (int i = 0; i < element->getGeo(PROJECTION); i++)
	projection[i] = mel->getProjection(i);
244
    }
245

Thomas Witkowski's avatar
Thomas Witkowski committed
246
    if (fillFlag.isSet(Mesh::FILL_ORIENTATION)) {
247
248
249
      WorldVector<WorldVector<double> > a;
      double s;

250
251
      for (int i = 0; i < 3; i++) {
	a[i] = mel->coord[i + 1];
252
253
254
255
256
257
258
259
260
261
262
263
264
265
	a[i] -= mel->coord[0];
      }

      s = (a[0][1] * a[1][2] - a[0][2] * a[1][1]) * a[2][0]
	+ (a[0][2] * a[1][0] - a[0][0] * a[1][2]) * a[2][1]
	+ (a[0][0] * a[1][1] - a[0][1] * a[1][0]) * a[2][2];

      if (s >= 0)
	orientation = 1;
      else
	orientation = -1;
    }
  }

266

Thomas Witkowski's avatar
Thomas Witkowski committed
267
  double ElInfo3d::calcGrdLambda(DimVec<WorldVector<double> >& grd_lam)
268
  {
269
270
    FUNCNAME("ElInfo3d::calcGrdLambda()");

Thomas Witkowski's avatar
Thomas Witkowski committed
271
    TEST_EXIT_DBG(dimOfWorld == 3)
272
273
      ("dim != dim_of_world ! use parametric elements!\n");

274
275
276
    std::vector<double> &e1 = tmpWorldVecs[0];
    std::vector<double> &e2 = tmpWorldVecs[1];
    std::vector<double> &e3 = tmpWorldVecs[2];
277
278
279

    testFlag(Mesh::FILL_COORDS);

280
    for (int i = 0; i < 3; i++) {
281
282
283
      e1[i] = coord[1][i] - coord[0][i];
      e2[i] = coord[2][i] - coord[0][i];
      e3[i] = coord[3][i] - coord[0][i];
284
285
    }

286
287
288
289
    double det = 
      e1[0] * (e2[1] * e3[2] - e2[2] * e3[1]) -
      e1[1] * (e2[0] * e3[2] - e2[2] * e3[0]) +
      e1[2] * (e2[0] * e3[1] - e2[1] * e3[0]);
290

291
    double adet = abs(det);
292

293
294
295
296
297
298
299
    if (adet < 1.0E-25) {
      MSG("abs(det) = %f\n",adet);
      for (int i = 0; i < 4; i++)
	for (int j = 0; j < 3; j++)
	  grd_lam[i][j] = 0.0;
    } else {
      det = 1.0 / det;
300
301
302
303
304
305
306
307
308
309
310
      /* (a_ij) = A^{-T} */

      grd_lam[1][0] = (e2[1] * e3[2] - e2[2] * e3[1]) * det;
      grd_lam[1][1] = (e2[2] * e3[0] - e2[0] * e3[2]) * det;
      grd_lam[1][2] = (e2[0] * e3[1] - e2[1] * e3[0]) * det;
      grd_lam[2][0] = (e1[2] * e3[1] - e1[1] * e3[2]) * det;
      grd_lam[2][1] = (e1[0] * e3[2] - e1[2] * e3[0]) * det;
      grd_lam[2][2] = (e1[1] * e3[0] - e1[0] * e3[1]) * det;
      grd_lam[3][0] = (e1[1] * e2[2] - e1[2] * e2[1]) * det;
      grd_lam[3][1] = (e1[2] * e2[0] - e1[0] * e2[2]) * det;
      grd_lam[3][2] = (e1[0] * e2[1] - e1[1] * e2[0]) * det;
311

Thomas Witkowski's avatar
Thomas Witkowski committed
312
313
314
      grd_lam[0][0] = -grd_lam[1][0] - grd_lam[2][0] - grd_lam[3][0];
      grd_lam[0][1] = -grd_lam[1][1] - grd_lam[2][1] - grd_lam[3][1];
      grd_lam[0][2] = -grd_lam[1][2] - grd_lam[2][2] - grd_lam[3][2];
315
    }
316
317
318
319

    return adet;
  }

320

321
322
323
  const int ElInfo3d::worldToCoord(const WorldVector<double>& xy,
				   DimVec<double>* lambda) const
  {
324
325
    FUNCNAME("ElInfo::worldToCoord()");

Thomas Witkowski's avatar
Thomas Witkowski committed
326
    DimVec<WorldVector<double> > edge(mesh->getDim(), NO_INIT);
327
328
329
    WorldVector<double> x;
    double  x0, det, det0, det1, det2;
  
Thomas Witkowski's avatar
Thomas Witkowski committed
330
    static DimVec<double> vec(mesh->getDim(), NO_INIT);
331

332
    TEST_EXIT_DBG(lambda)("lambda must not be NULL\n");
333

Thomas Witkowski's avatar
Thomas Witkowski committed
334
    int dim = mesh->getDim();
335

336
    TEST_EXIT_DBG(dim == dimOfWorld)("dim!=dimOfWorld not yet implemented\n");
337
338
339
340
341
342
343
    
    /*  wir haben das gleichungssystem zu loesen: */
    /*       ( q1x q2x q3x)  (lambda1)     (qx)      */
    /*       ( q1y q2y q3y)  (lambda2)  =  (qy)      */
    /*       ( q1z q2z q3z)  (lambda3)     (qz)      */
    /*      mit qi=pi-p3, q=xy-p3                 */

344
    for (int j = 0; j < dimOfWorld; j++) {
Thomas Witkowski's avatar
Thomas Witkowski committed
345
      x0 = coord[dim][j];
346
      x[j] = xy[j] - x0;
347
348

      for (int i = 0; i < dim; i++)
Thomas Witkowski's avatar
Thomas Witkowski committed
349
	edge[i][j] = coord[i][j] - x0;
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
    }

    det =  edge[0][0] * edge[1][1] * edge[2][2]
      + edge[0][1] * edge[1][2] * edge[2][0]
      + edge[0][2] * edge[1][0] * edge[2][1]
      - edge[0][2] * edge[1][1] * edge[2][0]
      - edge[0][0] * edge[1][2] * edge[2][1]
      - edge[0][1] * edge[1][0] * edge[2][2];
    det0 =       x[0] * edge[1][1] * edge[2][2]
      +       x[1] * edge[1][2] * edge[2][0]
      +       x[2] * edge[1][0] * edge[2][1]
      -       x[2] * edge[1][1] * edge[2][0]
      -       x[0] * edge[1][2] * edge[2][1]
      -       x[1] * edge[1][0] * edge[2][2];
    det1 = edge[0][0] *       x[1] * edge[2][2]
      + edge[0][1] *       x[2] * edge[2][0]
      + edge[0][2] *       x[0] * edge[2][1]
      - edge[0][2] *       x[1] * edge[2][0]
      - edge[0][0] *       x[2] * edge[2][1]
      - edge[0][1] *       x[0] * edge[2][2];
    det2 = edge[0][0] * edge[1][1] *       x[2]
      + edge[0][1] * edge[1][2] *       x[0]
      + edge[0][2] * edge[1][0] *       x[1]
      - edge[0][2] * edge[1][1] *       x[0]
      - edge[0][0] * edge[1][2] *       x[1]
      - edge[0][1] * edge[1][0] *       x[2];
  
    if (abs(det) < DBL_TOL) {
      ERROR("det = %le; abort\n", det);
379

380
      for (int i = 0; i <= dim; i++)
381
382
	(*lambda)[i] = 1.0 / dim;

383
384
385
386
387
388
389
390
391
392
      return 0;
    }

    (*lambda)[0] = det0 / det;
    (*lambda)[1] = det1 / det;
    (*lambda)[2] = det2 / det;
    (*lambda)[3] = 1.0 - (*lambda)[0] - (*lambda)[1] - (*lambda)[2];
  
    int k = -1;
    double lmin = 0.0;
393
394

    for (int i = 0; i <= dim; i++) {
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
      if ((*lambda)[i] < -1.E-5) {
	if ((*lambda)[i] < lmin) {
	  k = i;
	  lmin = (*lambda)[i];
	}
      }
    }

    return k;
  }


  /****************************************************************************/
  /*   update EL_INFO structure after refinement (of some neighbours)	    */
  /****************************************************************************/

  void ElInfo3d::update()
  {
413
    FUNCNAME("ElInfo::update()");
414

Thomas Witkowski's avatar
Thomas Witkowski committed
415
416
    int neighbours = mesh->getGeo(NEIGH);
    int vertices = mesh->getGeo(VERTEX);
417
  
Thomas Witkowski's avatar
Thomas Witkowski committed
418
    if (fillFlag.isSet(Mesh::FILL_NEIGH) || fillFlag.isSet(Mesh::FILL_OPP_COORDS)) {
419
      Tetrahedron *nb;
Thomas Witkowski's avatar
Thomas Witkowski committed
420
      Flag fill_opp_coords = fillFlag & Mesh::FILL_OPP_COORDS;
421
422
      
      for (int ineigh = 0; ineigh < neighbours; ineigh++) {
Thomas Witkowski's avatar
Thomas Witkowski committed
423
	if ((nb = dynamic_cast<Tetrahedron*>(const_cast<Element*>(neighbour[ineigh])))) {
424
	  int ov = oppVertex[ineigh];
425
426
427
428
	  if (ov < 2 && nb->getFirstChild()) {
	    if (fill_opp_coords != Flag(0)) {
	      int k = -1;
	      for (int j = 0; j < vertices; j++)
429
		if (element->getDof(j) == nb->getDof(1 - ov)) 
430
431
432
		  k = j;
	      
	      if (k == -1) {
433
		for (int j = 0; j < vertices; j++)
434
		  if (mesh->associated(element->getDof(j, 0), nb->getDof(1 - ov, 0)))
435
		    k = j;
436
	      }
437
	      TEST_EXIT_DBG(k >= 0)("neighbour dof not found\n");
438
439
	      
	      if (nb->isNewCoordSet())
Thomas Witkowski's avatar
Thomas Witkowski committed
440
		oppCoord[ineigh] = *(nb->getNewCoord());
441
	      else
Thomas Witkowski's avatar
Thomas Witkowski committed
442
		for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
443
		  oppCoord[ineigh][j] = (oppCoord[ineigh][j] + coord[k][j]) / 2;
444
	    }
Thomas Witkowski's avatar
Thomas Witkowski committed
445
	    neighbour[ineigh] = dynamic_cast<Tetrahedron*>(const_cast<Element*>(nb->getChild(1-ov)));
446
	    oppVertex[ineigh] = 3;
447
448
449
	  }
	}
      }
450
    }
451
452
453
  }


Thomas Witkowski's avatar
Thomas Witkowski committed
454
  double ElInfo3d::getNormal(int face, WorldVector<double> &normal)
455
  {
Thomas Witkowski's avatar
Thomas Witkowski committed
456
457
    FUNCNAME("ElInfo3d::getNormal()");

458
    double det = 0.0;
Thomas Witkowski's avatar
Thomas Witkowski committed
459

460
    WorldVector<double> e0, e1, e2;
461

Thomas Witkowski's avatar
Thomas Witkowski committed
462
    if (dimOfWorld == 3) {
463
464
465
      int i0 = (face + 1) % 4;
      int i1 = (face + 2) % 4;
      int i2 = (face + 3) % 4;
466

Thomas Witkowski's avatar
Thomas Witkowski committed
467
      for (int i = 0; i < dimOfWorld; i++) {
468
469
470
	e0[i] = coord[i1][i] - coord[i0][i];
	e1[i] = coord[i2][i] - coord[i0][i];
	e2[i] = coord[face][i] - coord[i0][i];
471
472
      }

473
      vectorProduct(e0, e1, normal);
474

475
      if ((e2 * normal) < 0.0)
Thomas Witkowski's avatar
Thomas Witkowski committed
476
	for (int i = 0; i < dimOfWorld; i++)
477
478
479
	  normal[i] = -normal[i];

      det = norm(&normal);
480
      TEST_EXIT_DBG(det > 1.e-30)("det = 0 on face %d\n", face);
481
482
483
484
485

      normal[0] /= det;
      normal[1] /= det;
      normal[2] /= det;
    } else {
486
      MSG("Not implemented for DIM_OF_WORLD = %d in 3D!\n", dimOfWorld);
487
488
    }

489
    return det;
490
491
492
  }


493
  void ElInfo3d::fillElInfo(int ichild, const ElInfo *elInfoOld)
494
  {
495
496
    FUNCNAME("ElInfo3d::fillElInfo()");

497
498
    TEST_EXIT_DBG(elInfoOld)("Missing old elInfo!\n");

499
500
    int ochild = 0;             /* index of other child = 1-ichild */
    int *cv = NULL;             /* cv = child_vertex[el_type][ichild] */
501
    const int (*cvg)[4] = NULL;     /* cvg = child_vertex[el_type] */
502
    int *ce;                    /* ce = child_edge[el_type][ichild] */
503
    Element *nb, *nbk;
504
    Element *elOld = elInfoOld->element;
Thomas Witkowski's avatar
Thomas Witkowski committed
505
    Flag fillFlag_local = elInfoOld->fillFlag;
506
    DegreeOfFreedom *dof;
507
    int ov = -1;
508
    Mesh *mesh = elInfoOld->getMesh();
509

510
    TEST_EXIT_DBG(elOld->getChild(0))("missing child?\n"); 
511

512
    element = const_cast<Element*>(elOld->getChild(ichild));
Thomas Witkowski's avatar
Thomas Witkowski committed
513
514
    macroElement = elInfoOld->macroElement;
    fillFlag = fillFlag_local;
515
    parent = elOld;
516
    level = elInfoOld->level + 1;
517
    iChild = ichild;
518
519
520
521
522
523
524
    int el_type_local = 0;
    try {
      el_type_local = (dynamic_cast<const ElInfo3d*>(elInfoOld))->getType();
    } catch (const std::bad_cast& e) {
      ERROR_EXIT("ElInfo is not of type ElInfo3D but %s!\n", typeid(*elInfoOld).name());
    }

525
    elType = (el_type_local + 1) % 3;
526

Thomas Witkowski's avatar
Thomas Witkowski committed
527
    TEST_EXIT_DBG(element)("missing child %d?\n", ichild);
528

Thomas Witkowski's avatar
Thomas Witkowski committed
529
    if (fillFlag_local.isAnySet()) {
530
      cvg = Tetrahedron::childVertex[el_type_local];
531
      cv = const_cast<int*>(cvg[ichild]);
532
      ochild = 1 - ichild;
533
534
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
535
536
537
    if (fillFlag_local.isSet(Mesh::FILL_COORDS) || 
	fillFlag.isSet(Mesh::FILL_DET) ||
	fillFlag.isSet(Mesh::FILL_GRD_LAMBDA)) {
538
      for (int i = 0; i < 3; i++) {
539
	for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
540
	  coord[i][j] = elInfoOld->coord[cv[i]][j];
541
      }
542
543
      if (elOld->getNewCoord()) {
	coord[3] = *(elOld->getNewCoord());
544
      } else {
545
	for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
546
	  coord[3][j] = (elInfoOld->coord[0][j] + elInfoOld->coord[1][j]) / 2;
547
548
      }
    }
549

Thomas Witkowski's avatar
Thomas Witkowski committed
550
551
    if (fillFlag_local.isSet(Mesh::FILL_NEIGH) || 
	fillFlag.isSet(Mesh::FILL_OPP_COORDS)) {
552

Thomas Witkowski's avatar
Thomas Witkowski committed
553
554
      FixVec<Element*, NEIGH> *neigh_local = &neighbour;
      const FixVec<Element*, NEIGH> *neigh_old = &elInfoOld->neighbour;
555
556

      Flag fill_opp_coords;
Thomas Witkowski's avatar
Thomas Witkowski committed
557
      fill_opp_coords.setFlags(fillFlag_local & Mesh::FILL_OPP_COORDS);
558
      
559
      // === nb[0] is other child ===
560
      
561
562
      if (elOld->getChild(0) &&  
	  (nb = const_cast<Element*>(elOld->getChild(ochild)))) {
563
564
565
566
	
	if (nb->getChild(0)) {         /* go down one level for direct neighbour */
	  if (fill_opp_coords.isAnySet()) {
	    if (nb->getNewCoord()) {
Thomas Witkowski's avatar
Thomas Witkowski committed
567
	      oppCoord[0]= *(nb->getNewCoord());
568
569
	    } else {
	      int k = cvg[ochild][1];
570
	      for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
571
		oppCoord[0][j] = (elInfoOld->coord[ochild][j] + elInfoOld->coord[k][j]) / 2;
572
573
	    }
	  }
574
	  (*neigh_local)[0] = const_cast<Element*>(nb->getChild(1));
575
	  oppVertex[0] = 3;
576
	} else {
577
578
	  if (fill_opp_coords.isAnySet())
	    for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
579
	      oppCoord[0][j] = elInfoOld->coord[ochild][j];
580

581
	  (*neigh_local)[0] = nb;
582
	  oppVertex[0] = 0;
583
	}
584
585
586
587
      } else {
	ERROR_EXIT("no other child");
	(*neigh_local)[0] = NULL;
      }
588
589


590
      /*----- nb[1], nb[2] are childs of old neighbours nb_old[cv[i]] ----------*/
591
592
      
      for (int i = 1; i < 3; i++) {
593
	if ((nb = const_cast<Element*>((*neigh_old)[cv[i]]))) {
594
	  TEST_EXIT_DBG(nb->getChild(0))("nonconforming triangulation\n");
595

596
597
	  int k;
	  for (k = 0; k < 2; k++) { /* look at both childs of old neighbour */
598
	    nbk = const_cast<Element*>(nb->getChild(k));
599
600

	    if (nbk->getDof(0) == elOld->getDof(ichild)) {
601
	      /* opp. vertex */
602
	      dof = const_cast<int*>(nb->getDof(elInfoOld->oppVertex[cv[i]])); 
603
	      
604
	      if (dof == nbk->getDof(1)) {
605
606
607
608
		ov = 1;
		if (nbk->getChild(0)) {
		  if (fill_opp_coords.isAnySet()) {
		    if (nbk->getNewCoord()) {
Thomas Witkowski's avatar
Thomas Witkowski committed
609
		      oppCoord[i] = *(nbk->getNewCoord());
610
		    } else {
611
		      for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
612
613
			oppCoord[i][j] = (elInfoOld->oppCoord[cv[i]][j] + 
					   elInfoOld->coord[ichild][j]) / 2;		      
614
615
616
		    }
		  }
		  (*neigh_local)[i] = nbk->getChild(0);
617
		  oppVertex[i] = 3;
618

619
		  break;
620
		}
621
	      } else {
622
		if (dof != nbk->getDof(2)) { 
623
		  ov = -1; 
624

625
626
627
		  break; 
		}
		ov = 2;
628
629
	      }

630
631
	      if (fill_opp_coords.isAnySet())
		for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
632
		  oppCoord[i][j] = elInfoOld->oppCoord[cv[i]][j];
633

634
	      (*neigh_local)[i] = nbk;
635
	      oppVertex[i] = ov;
636

637
	      break;
638
	    }
639
640
641
	    
	  } /* end for k */

642
643
644

	  // === Test if periodic. ===

645
	  if (k == 2 || ov == -1) {
646
647
648

	    // Look at both childs of old neighbour.
	    for (k = 0; k < 2; k++) {
649
	      nbk = const_cast<Element*>(nb->getChild(k));
650
651
652
653
	      if (nbk->getDof(0) == elOld->getDof(ichild) ||
		  mesh->associated(nbk->getDof(0, 0), elOld->getDof(ichild, 0))) {

		// opp. vertex 
654
		dof = const_cast<int*>(nb->getDof(elInfoOld->oppVertex[cv[i]])); 
655
		
656
657
		if (dof == nbk->getDof(1) || 
		    mesh->associated(dof[0], nbk->getDof(1, 0))) {
658
659
660
661
		  ov = 1;
		  if (nbk->getChild(0)) {
		    if (fill_opp_coords.isAnySet()) {
		      if (nbk->getNewCoord()) {
Thomas Witkowski's avatar
Thomas Witkowski committed
662
			oppCoord[i] = *(nbk->getNewCoord());
663
		      } else {
664
			for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
665
666
			  oppCoord[i][j] = (elInfoOld->oppCoord[cv[i]][j] + 
					    elInfoOld->coord[ichild][j]) / 2;
667
668
669
		      }
		    }
		    (*neigh_local)[i] = nbk->getChild(0);
670
		    oppVertex[i] = 3;
671
672
673
		    break;
		  }
		} else {
674
675
		  TEST_EXIT_DBG(dof == nbk->getDof(2) || 
				mesh->associated(dof[0], nbk->getDof(2, 0)))
676
677
678
		    ("opp_vertex not found\n");
		  ov = 2;
		}
679

680
681
		if (fill_opp_coords.isAnySet())
		  for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
682
		    oppCoord[i][j] = elInfoOld->oppCoord[cv[i]][j];
683

684
		(*neigh_local)[i] = nbk;
685
		oppVertex[i] = ov;
686
687
688
689
		break;
	      }
	      
	    } /* end for k */
690

691
692
693
	    TEST_EXIT_DBG(k < 2)
	      ("Fill %d child of element %d (0-Level: %d): Child not found with vertex!\n",
	       ichild, elOld->getIndex(), elInfoOld->getMacroElement()->getIndex());
694
695
696
	  }
	} else {
	  (*neigh_local)[i] = NULL;
697
	}
698
699
700
701
702
703
      }  /* end for i */
      
      
      /*----- nb[3] is old neighbour neigh_old[ochild] ------------------------*/
      
      if (((*neigh_local)[3] = (*neigh_old)[ochild])) {
704
	oppVertex[3] = elInfoOld->oppVertex[ochild];
705

706
707
	if (fill_opp_coords.isAnySet())
	  for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
708
	    oppCoord[3][j] = elInfoOld->oppCoord[ochild][j];
709
710
      }
    }
711

Thomas Witkowski's avatar
Thomas Witkowski committed
712
    if (fillFlag_local.isSet(Mesh::FILL_BOUND)) {
713
      for (int i = 0; i < 3; i++)
Thomas Witkowski's avatar
Thomas Witkowski committed
714
	boundary[10 + i] = elInfoOld->getBoundary(10 + cv[i]);
715
      
Thomas Witkowski's avatar
Thomas Witkowski committed
716
      boundary[13] = elInfoOld->getBoundary(4);
717
      
Thomas Witkowski's avatar
Thomas Witkowski committed
718
719
720
721
      boundary[0] = INTERIOR;
      boundary[1] = elInfoOld->getBoundary(cv[1]);
      boundary[2] = elInfoOld->getBoundary(cv[2]);
      boundary[3] = elInfoOld->getBoundary(ochild);
722
      
Thomas Witkowski's avatar
Thomas Witkowski committed
723
      int geoFace = mesh->getGeo(FACE);
724

725
      ce = const_cast<int*>(Tetrahedron::childEdge[el_type_local][ichild]);
726
      for (int iedge = 0; iedge < 4; iedge++)
Thomas Witkowski's avatar
Thomas Witkowski committed
727
728
729
	boundary[geoFace + iedge] = elInfoOld->getBoundary(geoFace + ce[iedge]);      
      for (int iedge = 4; iedge < 6; iedge++)
	boundary[geoFace + iedge] = elInfoOld->getBoundary(5 - cv[iedge - 3]);
730

731
732
      if (elInfoOld->getProjection(0) &&
	  elInfoOld->getProjection(0)->getType() == VOLUME_PROJECTION) {
733
	
Thomas Witkowski's avatar
Thomas Witkowski committed
734
	projection[0] = elInfoOld->getProjection(0);      
735
      } else { // boundary projection
Thomas Witkowski's avatar
Thomas Witkowski committed
736
737
738
739
	projection[0] = NULL;
	projection[1] = elInfoOld->getProjection(cv[1]);
	projection[2] = elInfoOld->getProjection(cv[2]);
	projection[3] = elInfoOld->getProjection(ochild);
740
	
741
	for (int iedge = 0; iedge < 4; iedge++)
Thomas Witkowski's avatar
Thomas Witkowski committed
742
	  projection[geoFace + iedge] = elInfoOld->getProjection(geoFace + ce[iedge]);
743
	for (int iedge = 4; iedge < 6; iedge++)
Thomas Witkowski's avatar
Thomas Witkowski committed
744
	  projection[geoFace + iedge] = elInfoOld->getProjection(5 - cv[iedge - 3]);
745
      }
746
    }
747

748
    
Thomas Witkowski's avatar
Thomas Witkowski committed
749
    if (fillFlag.isSet(Mesh::FILL_ORIENTATION)) {
750
751
      orientation = 
	(dynamic_cast<ElInfo3d*>(const_cast<ElInfo*>(elInfoOld)))->orientation 
752
753
754
755
	* Tetrahedron::childOrientation[el_type_local][ichild];
    }
  }

756

757
  mtl::dense2D<double>& ElInfo3d::getSubElemCoordsMat(int degree) const
Thomas Witkowski's avatar
Thomas Witkowski committed
758
  {
759
760
    FUNCNAME("ElInfo3d::getSubElemCoordsMat()");

761
762
    using namespace mtl;

Thomas Witkowski's avatar
Thomas Witkowski committed
763
    if (subElemMatrices[degree].count(std::make_pair(refinementPathLength, refinementPath)) == 0) {
764
765
766
767
768
769
770
771
772
      switch (degree) {
      case 1:
	{
	  dense2D<double> mat(4, 4), tmpMat(4, 4);
	  mat = 1;
	  
	  for (int i = 0; i < refinementPathLength; i++) {
	    if (refinementPath & (1 << i)) {
	      if ((level + i) % 3 == 0)
Thomas Witkowski's avatar
Thomas Witkowski committed
773
		tmpMat = mat * mat_d1_l0_right;
774
	      else
Thomas Witkowski's avatar
Thomas Witkowski committed
775
		tmpMat = mat * mat_d1_l12_right;
776
777
778

	      mat = tmpMat;
	    } else  {
Thomas Witkowski's avatar
Thomas Witkowski committed
779
	      tmpMat = mat * mat_d1_left;
780
781
782
783
	      mat = tmpMat;
	    }
	  }

Thomas Witkowski's avatar
Thomas Witkowski committed
784
	  subElemMatrices[degree][std::make_pair(refinementPathLength, refinementPath)] = mat;  
785
	}
786
	break;
787
788
789
790
791
792
793
794
      case 4:
	{
	  dense2D<double> mat(35, 35), tmpMat(35, 35);
	  mat = 1;
	  
	  for (int i = 0; i < refinementPathLength; i++) {
	    if (refinementPath & (1 << i)) {
	      if ((level + i) % 3 == 0)
Thomas Witkowski's avatar
Thomas Witkowski committed
795
		tmpMat = mat * mat_d4_l0_right;
796
 	      else
Thomas Witkowski's avatar
Thomas Witkowski committed
797
 		tmpMat = mat * mat_d4_l12_right;
798
799
800

	      mat = tmpMat;
	    } else  {
Thomas Witkowski's avatar
Thomas Witkowski committed
801
	      tmpMat = mat * mat_d4_left;
802
803
804
805
	      mat = tmpMat;
	    }
	  }

Thomas Witkowski's avatar
Thomas Witkowski committed
806
	  subElemMatrices[degree][std::make_pair(refinementPathLength, refinementPath)] = mat;  
807
808
	}
	break;	
809
810
811
812
      default:
	ERROR_EXIT("Not supported for basis function degree: %d\n", degree);
      }
    }
813

Thomas Witkowski's avatar
Thomas Witkowski committed
814
    return subElemMatrices[degree][std::make_pair(refinementPathLength, refinementPath)];
Thomas Witkowski's avatar
Thomas Witkowski committed
815
816
  }

817

818
  mtl::dense2D<double>& ElInfo3d::getSubElemGradCoordsMat(int degree) const
Thomas Witkowski's avatar
Thomas Witkowski committed
819
  {
820
    FUNCNAME("ElInfo3d::getSubElemGradCoordsMat()");
821
822

    ERROR_EXIT("Not yet implemented!\n");
823

Thomas Witkowski's avatar
Thomas Witkowski committed
824
    return subElemGradMatrices[degree][std::make_pair(refinementPathLength, refinementPath)];
Thomas Witkowski's avatar
Thomas Witkowski committed
825
826
  }

827
}