ElInfo3d.cc 39 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#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 {

17
18
19
20
21
22
23
24
25
26
27
  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}};
28
29
  mtl::dense2D<double> ElInfo3d::mat_d1_l0_right(mat_d1_l0_right_val);

30
31
32
33
34
35
36
  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);


37
38
39
40
41
42
43
44
45
46
47
48
49
50
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

  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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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, 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, 0.0, 0.0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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, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.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, 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);



160
161
  void ElInfo3d::fillMacroInfo(const MacroElement * mel)
  {
162
163
    FUNCNAME("ElInfo3d::fillMacroInfo()");
    Element *nb;
164
    MacroElement *mnb;
165
    Flag fill_opp_coords;
166

167
168
    macroElement = const_cast<MacroElement*>( mel);
    element = const_cast<Element*>(mel->getElement());
Thomas Witkowski's avatar
Thomas Witkowski committed
169
    parent = NULL;
170
    level = 0;
171
    elType = const_cast<MacroElement*>(mel)->getElType();
172

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

Thomas Witkowski's avatar
Thomas Witkowski committed
175
176
177
    if (fillFlag.isSet(Mesh::FILL_COORDS) || 
	fillFlag.isSet(Mesh::FILL_DET) ||
	fillFlag.isSet(Mesh::FILL_GRD_LAMBDA)) {
178
      for (int i = 0; i < vertices; i++)
Thomas Witkowski's avatar
Thomas Witkowski committed
179
	coord[i] = mel->coord[i];
180
181
    }

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

Thomas Witkowski's avatar
Thomas Witkowski committed
184
185
    if (fillFlag.isSet(Mesh::FILL_OPP_COORDS) || 
        fillFlag.isSet(Mesh::FILL_NEIGH)) {
186

Thomas Witkowski's avatar
Thomas Witkowski committed
187
      fill_opp_coords.setFlags(fillFlag & Mesh::FILL_OPP_COORDS);
188
      for (int i = 0; i < neighbours; i++) {
189
	if ((mnb = const_cast<MacroElement*>( mel->getNeighbour(i)))) {
Thomas Witkowski's avatar
Thomas Witkowski committed
190
191
	  neighbour[i] = const_cast<Element*>( mel->getNeighbour(i)->getElement());
	  nb = const_cast<Element*>( neighbour[i]);
192
	  int k;
193
	  k = oppVertex[i] = mel->getOppVertex(i);
194
195

	  if (nb->getChild(0) && (k < 2)) {   /*make nb nearest element.*/
196
	    if (k == 1) {
Thomas Witkowski's avatar
Thomas Witkowski committed
197
198
	      neighbour[i]      = const_cast<Element*>( nb->getChild(0));
	      nb = const_cast<Element*>( neighbour[i]);
199
	    } else {
Thomas Witkowski's avatar
Thomas Witkowski committed
200
201
	      neighbour[i]      = const_cast<Element*>( nb->getChild(1));
	      nb = const_cast<Element*>( neighbour[i]);
202
	    }
203
	    k = oppVertex[i] = 3;
204
205
206
	    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
207
		oppCoord[i] = *(mnb->getElement()->getNewCoord());
208
	      else
Thomas Witkowski's avatar
Thomas Witkowski committed
209
		oppCoord[i] = (mnb->coord[0] + mnb->coord[1]) * 0.5;
210
211
	    }
	  } else {
212
	    if  (fill_opp_coords.isAnySet()) {
Thomas Witkowski's avatar
Thomas Witkowski committed
213
	      oppCoord[i] = mnb->coord[k];
214
215
	    }
	  }
216
	} else {
Thomas Witkowski's avatar
Thomas Witkowski committed
217
	  neighbour[i] = NULL;
218
219
220
221
	}
      }
    }

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

Thomas Witkowski's avatar
Thomas Witkowski committed
226
227
      for (int i = 0; i < element->getGeo(PROJECTION); i++)
	projection[i] = mel->getProjection(i);
228
    }
229

Thomas Witkowski's avatar
Thomas Witkowski committed
230
    if (fillFlag.isSet(Mesh::FILL_ORIENTATION)) {
231
232
233
      WorldVector<WorldVector<double> > a;
      double s;

234
235
      for (int i = 0; i < 3; i++) {
	a[i] = mel->coord[i + 1];
236
237
238
239
240
241
242
243
244
245
246
247
248
249
	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;
    }
  }

250

Thomas Witkowski's avatar
Thomas Witkowski committed
251
  double ElInfo3d::calcGrdLambda(DimVec<WorldVector<double> >& grd_lam)
252
  {
253
254
    FUNCNAME("ElInfo3d::calcGrdLambda()");

Thomas Witkowski's avatar
Thomas Witkowski committed
255
    TEST_EXIT_DBG(dimOfWorld == 3)
256
257
      ("dim != dim_of_world ! use parametric elements!\n");

258
259
260
    std::vector<double> &e1 = tmpWorldVecs[0];
    std::vector<double> &e2 = tmpWorldVecs[1];
    std::vector<double> &e3 = tmpWorldVecs[2];
261
262
263

    testFlag(Mesh::FILL_COORDS);

264
    for (int i = 0; i < 3; i++) {
265
266
267
      e1[i] = coord[1][i] - coord[0][i];
      e2[i] = coord[2][i] - coord[0][i];
      e3[i] = coord[3][i] - coord[0][i];
268
269
    }

270
271
272
273
    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]);
274

275
    double adet = abs(det);
276

277
278
279
280
281
282
283
    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;
284
285
286
287
288
289
290
291
292
293
294
      /* (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;
295

Thomas Witkowski's avatar
Thomas Witkowski committed
296
297
298
      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];
299
    }
300
301
302
303

    return adet;
  }

304

305
306
307
  const int ElInfo3d::worldToCoord(const WorldVector<double>& xy,
				   DimVec<double>* lambda) const
  {
308
309
    FUNCNAME("ElInfo::worldToCoord()");

Thomas Witkowski's avatar
Thomas Witkowski committed
310
    DimVec<WorldVector<double> > edge(mesh->getDim(), NO_INIT);
311
312
313
    WorldVector<double> x;
    double  x0, det, det0, det1, det2;
  
Thomas Witkowski's avatar
Thomas Witkowski committed
314
    static DimVec<double> vec(mesh->getDim(), NO_INIT);
315

316
    TEST_EXIT_DBG(lambda)("lambda must not be NULL\n");
317

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

320
    TEST_EXIT_DBG(dim == dimOfWorld)("dim!=dimOfWorld not yet implemented\n");
321
322
323
324
325
326
327
    
    /*  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                 */

328
    for (int j = 0; j < dimOfWorld; j++) {
Thomas Witkowski's avatar
Thomas Witkowski committed
329
      x0 = coord[dim][j];
330
      x[j] = xy[j] - x0;
331
332

      for (int i = 0; i < dim; i++)
Thomas Witkowski's avatar
Thomas Witkowski committed
333
	edge[i][j] = coord[i][j] - x0;
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
    }

    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);
363

364
      for (int i = 0; i <= dim; i++)
365
366
	(*lambda)[i] = 1.0 / dim;

367
368
369
370
371
372
373
374
375
376
      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;
377
378

    for (int i = 0; i <= dim; i++) {
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
      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()
  {
397
    FUNCNAME("ElInfo::update()");
398

Thomas Witkowski's avatar
Thomas Witkowski committed
399
400
    int neighbours = mesh->getGeo(NEIGH);
    int vertices = mesh->getGeo(VERTEX);
401
  
Thomas Witkowski's avatar
Thomas Witkowski committed
402
    if (fillFlag.isSet(Mesh::FILL_NEIGH) || fillFlag.isSet(Mesh::FILL_OPP_COORDS)) {
403
      Tetrahedron *nb;
Thomas Witkowski's avatar
Thomas Witkowski committed
404
      Flag fill_opp_coords = fillFlag & Mesh::FILL_OPP_COORDS;
405
406
      
      for (int ineigh = 0; ineigh < neighbours; ineigh++) {
Thomas Witkowski's avatar
Thomas Witkowski committed
407
	if ((nb = dynamic_cast<Tetrahedron*>(const_cast<Element*>(neighbour[ineigh])))) {
408
	  int ov = oppVertex[ineigh];
409
410
411
412
	  if (ov < 2 && nb->getFirstChild()) {
	    if (fill_opp_coords != Flag(0)) {
	      int k = -1;
	      for (int j = 0; j < vertices; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
413
		if (element->getDOF(j) == nb->getDOF(1 - ov)) 
414
415
416
		  k = j;
	      
	      if (k == -1) {
417
		for (int j = 0; j < vertices; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
418
		  if (mesh->associated(element->getDOF(j, 0), nb->getDOF(1 - ov, 0)))
419
		    k = j;
420
	      }
421
	      TEST_EXIT_DBG(k >= 0)("neighbour dof not found\n");
422
423
	      
	      if (nb->isNewCoordSet())
Thomas Witkowski's avatar
Thomas Witkowski committed
424
		oppCoord[ineigh] = *(nb->getNewCoord());
425
	      else
Thomas Witkowski's avatar
Thomas Witkowski committed
426
		for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
427
		  oppCoord[ineigh][j] = (oppCoord[ineigh][j] + coord[k][j]) / 2;
428
	    }
Thomas Witkowski's avatar
Thomas Witkowski committed
429
	    neighbour[ineigh] = dynamic_cast<Tetrahedron*>(const_cast<Element*>(nb->getChild(1-ov)));
430
	    oppVertex[ineigh] = 3;
431
432
433
	  }
	}
      }
434
    }
435
436
437
  }


Thomas Witkowski's avatar
Thomas Witkowski committed
438
  double ElInfo3d::getNormal(int face, WorldVector<double> &normal)
439
  {
Thomas Witkowski's avatar
Thomas Witkowski committed
440
441
    FUNCNAME("ElInfo3d::getNormal()");

442
    double det = 0.0;
Thomas Witkowski's avatar
Thomas Witkowski committed
443

444
    WorldVector<double> e0, e1, e2;
445

Thomas Witkowski's avatar
Thomas Witkowski committed
446
    if (dimOfWorld == 3) {
447
448
449
      int i0 = (face + 1) % 4;
      int i1 = (face + 2) % 4;
      int i2 = (face + 3) % 4;
450

Thomas Witkowski's avatar
Thomas Witkowski committed
451
      for (int i = 0; i < dimOfWorld; i++) {
452
453
454
	e0[i] = coord[i1][i] - coord[i0][i];
	e1[i] = coord[i2][i] - coord[i0][i];
	e2[i] = coord[face][i] - coord[i0][i];
455
456
      }

457
      vectorProduct(e0, e1, normal);
458

459
      if ((e2 * normal) < 0.0)
Thomas Witkowski's avatar
Thomas Witkowski committed
460
	for (int i = 0; i < dimOfWorld; i++)
461
462
463
	  normal[i] = -normal[i];

      det = norm(&normal);
464
      TEST_EXIT_DBG(det > 1.e-30)("det = 0 on face %d\n", face);
465
466
467
468
469

      normal[0] /= det;
      normal[1] /= det;
      normal[2] /= det;
    } else {
Thomas Witkowski's avatar
Thomas Witkowski committed
470
      MSG("not implemented for DIM_OF_WORLD = %d in 3d\n", dimOfWorld);
471
472
    }

473
    return det;
474
475
476
  }


477
  void ElInfo3d::fillElInfo(int ichild, const ElInfo *elInfoOld)
478
  {
479
480
481
482
    FUNCNAME("ElInfo3d::fillElInfo()");

    int ochild = 0;             /* index of other child = 1-ichild */
    int *cv = NULL;             /* cv = child_vertex[el_type][ichild] */
483
    const int (*cvg)[4] = NULL;     /* cvg = child_vertex[el_type] */
484
    int *ce;                    /* ce = child_edge[el_type][ichild] */
485
    Element *nb, *nbk;
Thomas Witkowski's avatar
Thomas Witkowski committed
486
487
    Element *el_old = elInfoOld->element;
    Flag fillFlag_local = elInfoOld->fillFlag;
488
    DegreeOfFreedom *dof;
489
    int ov = -1;
490
    Mesh *mesh = elInfoOld->getMesh();
491

Thomas Witkowski's avatar
Thomas Witkowski committed
492
    TEST_EXIT_DBG(el_old->getChild(0))("missing child?\n"); 
493

Thomas Witkowski's avatar
Thomas Witkowski committed
494
495
496
497
    element = const_cast<Element*>( el_old->getChild(ichild));
    macroElement = elInfoOld->macroElement;
    fillFlag = fillFlag_local;
    parent  = el_old;
498
    level = elInfoOld->level + 1;
499
500
    iChild = ichild;
    int el_type_local = (dynamic_cast<const ElInfo3d*>(elInfoOld))->getType();
501
    elType = (el_type_local + 1) % 3;
502

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

Thomas Witkowski's avatar
Thomas Witkowski committed
505
    if (fillFlag_local.isAnySet()) {
506
      cvg = Tetrahedron::childVertex[el_type_local];
507
      cv = const_cast<int*>(cvg[ichild]);
508
      ochild = 1 - ichild;
509
510
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
511
512
513
    if (fillFlag_local.isSet(Mesh::FILL_COORDS) || 
	fillFlag.isSet(Mesh::FILL_DET) ||
	fillFlag.isSet(Mesh::FILL_GRD_LAMBDA)) {
514
      for (int i = 0; i < 3; i++) {
515
	for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
516
	  coord[i][j] = elInfoOld->coord[cv[i]][j];
517
      }
518
      if (el_old->getNewCoord()) {
Thomas Witkowski's avatar
Thomas Witkowski committed
519
	coord[3] = *(el_old->getNewCoord());
520
      } else {
521
	for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
522
	  coord[3][j] = (elInfoOld->coord[0][j] + elInfoOld->coord[1][j]) / 2;
523
524
      }
    }
525

Thomas Witkowski's avatar
Thomas Witkowski committed
526
527
    if (fillFlag_local.isSet(Mesh::FILL_NEIGH) || 
	fillFlag.isSet(Mesh::FILL_OPP_COORDS)) {
528

Thomas Witkowski's avatar
Thomas Witkowski committed
529
530
      FixVec<Element*, NEIGH> *neigh_local = &neighbour;
      const FixVec<Element*, NEIGH> *neigh_old = &elInfoOld->neighbour;
531
532

      Flag fill_opp_coords;
Thomas Witkowski's avatar
Thomas Witkowski committed
533
      fill_opp_coords.setFlags(fillFlag_local & Mesh::FILL_OPP_COORDS);
534
535
536
537
538
539
540
541
542
543
      
      /*----- nb[0] is other child --------------------------------------------*/
      
      /*    if (nb = el_old->child[ochild])   old version  */
      if (el_old->getChild(0)  &&  
	  (nb = const_cast<Element*>( el_old->getChild(ochild)))) {
	
	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
544
	      oppCoord[0]= *(nb->getNewCoord());
545
546
	    } else {
	      int k = cvg[ochild][1];
547
	      for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
548
		oppCoord[0][j] = (elInfoOld->coord[ochild][j] + elInfoOld->coord[k][j]) / 2;
549
550
	    }
	  }
551
	  (*neigh_local)[0] = const_cast<Element*>( nb->getChild(1));
552
	  oppVertex[0] = 3;
553
	} else {
554
555
	  if (fill_opp_coords.isAnySet())
	    for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
556
	      oppCoord[0][j] = elInfoOld->coord[ochild][j];
557

558
	  (*neigh_local)[0] = nb;
559
	  oppVertex[0] = 0;
560
	}
561
562
563
564
      } else {
	ERROR_EXIT("no other child");
	(*neigh_local)[0] = NULL;
      }
565
566


567
568
569
570
      /*----- nb[1],nb[2] are childs of old neighbours nb_old[cv[i]] ----------*/
      
      for (int i = 1; i < 3; i++) {
	if ((nb = const_cast<Element*>( (*neigh_old)[cv[i]]))) {
571
	  TEST_EXIT_DBG(nb->getChild(0))("nonconforming triangulation\n");
572
	  
573
574
575
576
577
	  int k;
	  for (k = 0; k < 2; k++) { /* look at both childs of old neighbour */
	    nbk = const_cast<Element*>( nb->getChild(k));
	    if (nbk->getDOF(0) == el_old->getDOF(ichild)) {
	      /* opp. vertex */
578
	      dof = const_cast<int*>(nb->getDOF(elInfoOld->oppVertex[cv[i]])); 
579
580
581
582
583
584
	      
	      if (dof == nbk->getDOF(1)) {
		ov = 1;
		if (nbk->getChild(0)) {
		  if (fill_opp_coords.isAnySet()) {
		    if (nbk->getNewCoord()) {
Thomas Witkowski's avatar
Thomas Witkowski committed
585
		      oppCoord[i] = *(nbk->getNewCoord());
586
		    } else {
587
		      for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
588
589
			oppCoord[i][j] = (elInfoOld->oppCoord[cv[i]][j] + 
					   elInfoOld->coord[ichild][j]) / 2;		      
590
591
592
		    }
		  }
		  (*neigh_local)[i] = nbk->getChild(0);
593
		  oppVertex[i] = 3;
594
		  break;
595
		}
596
597
598
599
600
601
	      } else {
		if (dof != nbk->getDOF(2)) { 
		  ov = -1; 
		  break; 
		}
		ov = 2;
602
603
	      }

604
605
	      if (fill_opp_coords.isAnySet())
		for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
606
		  oppCoord[i][j] = elInfoOld->oppCoord[cv[i]][j];
607

608
	      (*neigh_local)[i] = nbk;
609
	      oppVertex[i] = ov;
610
	      break;
611
	    }
612
613
614
615
616
617
618
619
620
621
	    
	  } /* end for k */

	  // periodic ?
	  if (k == 2 || ov == -1) {
	    for (k = 0; k < 2; k++) {  /* look at both childs of old neighbour */
	      nbk = const_cast<Element*>( nb->getChild(k));
	      if (nbk->getDOF(0) == el_old->getDOF(ichild) ||
		  mesh->associated(nbk->getDOF(0, 0), el_old->getDOF(ichild, 0))) {
		/* opp. vertex */
622
		dof = const_cast<int*>(nb->getDOF(elInfoOld->oppVertex[cv[i]])); 
623
624
625
626
627
628
629
		
		if (dof == nbk->getDOF(1) || 
		    mesh->associated(dof[0], nbk->getDOF(1, 0))) {
		  ov = 1;
		  if (nbk->getChild(0)) {
		    if (fill_opp_coords.isAnySet()) {
		      if (nbk->getNewCoord()) {
Thomas Witkowski's avatar
Thomas Witkowski committed
630
			oppCoord[i] = *(nbk->getNewCoord());
631
		      } else {
632
			for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
633
634
			  oppCoord[i][j] = (elInfoOld->oppCoord[cv[i]][j] + 
					    elInfoOld->coord[ichild][j]) / 2;
635
636
637
		      }
		    }
		    (*neigh_local)[i] = nbk->getChild(0);
638
		    oppVertex[i] = 3;
639
640
641
		    break;
		  }
		} else {
642
643
		  TEST_EXIT_DBG(dof == nbk->getDOF(2) || 
				mesh->associated(dof[0], nbk->getDOF(2, 0)))
644
645
646
		    ("opp_vertex not found\n");
		  ov = 2;
		}
647

648
649
		if (fill_opp_coords.isAnySet())
		  for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
650
		    oppCoord[i][j] = elInfoOld->oppCoord[cv[i]][j];
651

652
		(*neigh_local)[i] = nbk;
653
		oppVertex[i] = ov;
654
655
656
657
		break;
	      }
	      
	    } /* end for k */
658

659
	    TEST_EXIT_DBG(k < 2)("child not found with vertex\n");
660
661
662
	  }
	} else {
	  (*neigh_local)[i] = NULL;
663
	}
664
665
666
667
668
669
      }  /* end for i */
      
      
      /*----- nb[3] is old neighbour neigh_old[ochild] ------------------------*/
      
      if (((*neigh_local)[3] = (*neigh_old)[ochild])) {
670
	oppVertex[3] = elInfoOld->oppVertex[ochild];
671

672
673
	if (fill_opp_coords.isAnySet())
	  for (int j = 0; j < dimOfWorld; j++)
Thomas Witkowski's avatar
Thomas Witkowski committed
674
	    oppCoord[3][j] = elInfoOld->oppCoord[ochild][j];
675
676
      }
    }
677

Thomas Witkowski's avatar
Thomas Witkowski committed
678
    if (fillFlag_local.isSet(Mesh::FILL_BOUND)) {
679
      for (int i = 0; i < 3; i++)
Thomas Witkowski's avatar
Thomas Witkowski committed
680
	boundary[10 + i] = elInfoOld->getBoundary(10 + cv[i]);
681
      
Thomas Witkowski's avatar
Thomas Witkowski committed
682
      boundary[13] = elInfoOld->getBoundary(4);
683
      
Thomas Witkowski's avatar
Thomas Witkowski committed
684
685
686
687
      boundary[0] = INTERIOR;
      boundary[1] = elInfoOld->getBoundary(cv[1]);
      boundary[2] = elInfoOld->getBoundary(cv[2]);
      boundary[3] = elInfoOld->getBoundary(ochild);
688
      
Thomas Witkowski's avatar
Thomas Witkowski committed
689
      int geoFace = mesh->getGeo(FACE);
690

691
      ce = const_cast<int*>(Tetrahedron::childEdge[el_type_local][ichild]);
692
      for (int iedge = 0; iedge < 4; iedge++)
Thomas Witkowski's avatar
Thomas Witkowski committed
693
694
695
	boundary[geoFace + iedge] = elInfoOld->getBoundary(geoFace + ce[iedge]);      
      for (int iedge = 4; iedge < 6; iedge++)
	boundary[geoFace + iedge] = elInfoOld->getBoundary(5 - cv[iedge - 3]);
696

697
698
      if (elInfoOld->getProjection(0) &&
	  elInfoOld->getProjection(0)->getType() == VOLUME_PROJECTION) {
699
	
Thomas Witkowski's avatar
Thomas Witkowski committed
700
	projection[0] = elInfoOld->getProjection(0);      
701
      } else { // boundary projection
Thomas Witkowski's avatar
Thomas Witkowski committed
702
703
704
705
	projection[0] = NULL;
	projection[1] = elInfoOld->getProjection(cv[1]);
	projection[2] = elInfoOld->getProjection(cv[2]);
	projection[3] = elInfoOld->getProjection(ochild);
706
	
707
	for (int iedge = 0; iedge < 4; iedge++)
Thomas Witkowski's avatar
Thomas Witkowski committed
708
	  projection[geoFace + iedge] = elInfoOld->getProjection(geoFace + ce[iedge]);
709
	for (int iedge = 4; iedge < 6; iedge++)
Thomas Witkowski's avatar
Thomas Witkowski committed
710
	  projection[geoFace + iedge] = elInfoOld->getProjection(5 - cv[iedge - 3]);
711
      }
712
    }
713

714
    
Thomas Witkowski's avatar
Thomas Witkowski committed
715
    if (fillFlag.isSet(Mesh::FILL_ORIENTATION)) {
716
717
      orientation = 
	(dynamic_cast<ElInfo3d*>(const_cast<ElInfo*>(elInfoOld)))->orientation 
718
719
720
721
	* Tetrahedron::childOrientation[el_type_local][ichild];
    }
  }

722

723
  mtl::dense2D<double>& ElInfo3d::getSubElemCoordsMat(int degree) const
Thomas Witkowski's avatar
Thomas Witkowski committed
724
  {
725
726
    FUNCNAME("ElInfo3d::getSubElemCoordsMat()");

727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
    using namespace mtl;

    if (subElemMatrices[degree].count(refinementPath) == 0) {
      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)
		tmpMat = mat_d1_l0_right * mat;
	      else
		tmpMat = mat_d1_l12_right * mat;

	      mat = tmpMat;
	    } else  {
	      tmpMat = mat_d1_left * mat;
	      mat = tmpMat;
	    }
	  }

750
	  subElemMatrices[degree][refinementPath] = mat;  
751
	}
752
	break;
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
      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)
		tmpMat = mat_d4_l0_right * mat;
// 	      else
// 		tmpMat = mat_d4_l12_right * mat;

	      mat = tmpMat;
	    } else  {
	      tmpMat = mat_d4_left * mat;
	      mat = tmpMat;
	    }
	  }

	  subElemMatrices[degree][refinementPath] = mat;  
	}
	break;	
775
776
777
778
      default:
	ERROR_EXIT("Not supported for basis function degree: %d\n", degree);
      }
    }
779
780

    return subElemMatrices[degree][refinementPath];
Thomas Witkowski's avatar
Thomas Witkowski committed
781
782
  }

783

784
  mtl::dense2D<double>& ElInfo3d::getSubElemGradCoordsMat(int degree) const
Thomas Witkowski's avatar
Thomas Witkowski committed
785
  {
786
    FUNCNAME("ElInfo3d::getSubElemGradCoordsMat()");
787
788

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

790
    return subElemGradMatrices[degree][refinementPath];
Thomas Witkowski's avatar
Thomas Witkowski committed
791
792
  }

793
}