1 // (c) bernhard schupp 1997 - 1998
2 #ifndef MAPP_CUBE_3D_H_INCLUDED
3 #define MAPP_CUBE_3D_H_INCLUDED
4 
5 #include <cmath>
6 
7 #include "gitter_sti.h"
8 
9 namespace ALUGrid
10 {
11 
12   class LinearMapping;	// in mapp_tetra_3d.h
13 
14   class TrilinearMapping
15   {
16     static const alucoord_t _epsilon;
17 
18     const alucoord_t (&p0)[ 3 ], (&p1)[ 3 ], (&p2)[ 3 ], (&p3)[ 3 ];
19     const alucoord_t (&p4)[ 3 ], (&p5)[ 3 ], (&p6)[ 3 ], (&p7)[ 3 ];
20     alucoord_t a [ 8 ][ 3 ];
21     alucoord_t Df [ 3 ][ 3 ];
22     alucoord_t Dfi [ 3 ][ 3 ];
23     alucoord_t DetDf;
24     void linear (const alucoord_t (&)[3]);
25     void inverse (const alucoord_t (&)[3]);
26     public :
27       inline TrilinearMapping (const alucoord_t (&)[3], const alucoord_t (&)[3], const alucoord_t (&)[3], const alucoord_t (&)[3],
28                                const alucoord_t (&)[3], const alucoord_t (&)[3], const alucoord_t (&)[3], const alucoord_t (&)[3]);
29       inline TrilinearMapping (const TrilinearMapping &);
~TrilinearMapping()30      ~TrilinearMapping () {}
31       alucoord_t det (const alucoord_t (&)[3]);
32       inline void map2world (const alucoord_t (&)[3], alucoord_t (&)[3]) const;
33       inline void map2world (const alucoord_t , const alucoord_t , const alucoord_t , alucoord_t (&)[3]) const;
34       void world2map (const alucoord_t (&)[3], alucoord_t (&)[3]);
35 
barycenter(const alucoord_t (& p0)[3],const alucoord_t (& p1)[3],const alucoord_t (& p2)[3],const alucoord_t (& p3)[3],const alucoord_t (& p4)[3],const alucoord_t (& p5)[3],const alucoord_t (& p6)[3],const alucoord_t (& p7)[3],alucoord_t (& barycenter)[3])36       static inline void barycenter(const alucoord_t (&p0)[3], const alucoord_t (&p1)[3], const alucoord_t (&p2)[3], const alucoord_t (&p3)[3],
37                                     const alucoord_t (&p4)[3], const alucoord_t (&p5)[3], const alucoord_t (&p6)[3], const alucoord_t (&p7)[3],
38                                     alucoord_t (&barycenter)[3])
39       {
40         barycenter[0] = 0.125 * (p0[0] + p1[0] + p2[0] + p3[0] + p4[0] + p5[0] + p6[0] + p7[0]);
41         barycenter[1] = 0.125 * (p0[1] + p1[1] + p2[1] + p3[1] + p4[1] + p5[1] + p6[1] + p7[1]);
42         barycenter[2] = 0.125 * (p0[2] + p1[2] + p2[2] + p3[2] + p4[2] + p5[2] + p6[2] + p7[2]);
43 
44   #ifdef ALUGRIDDEBUG
45         {
46           TrilinearMapping map(p0,p1,p2,p3,p4,p5,p6,p7);
47           alucoord_t p[3];
48           map.map2world(.0, .0, .0, p);
49           for(int j=0; j<3; ++j)
50           {
51             alugrid_assert ( fabs(barycenter[j] - p[j]) < 1e-8 );
52           }
53         }
54   #endif
55       }
56 
57       // returns true if mapping is affine
58       inline bool affine() const;
59   };
60 
61   class QuadraturCube3Dbasis
62   {
63   protected:
64     static const alucoord_t _p2 [4][3];
65     static const alucoord_t _p3 [8][3];
66   };
67 
68   struct VolumeCalc
69   {
70     typedef alucoord_t val_t;
71     typedef int arg_t;
72 
73     val_t operator() ( const alucoord_t (&)[ 3 ], const arg_t & );
74     val_t operator() ( const alucoord_t (&)[ 4 ], const LinearMapping &, const arg_t & );
75   };
76 
77   struct SurfaceCalc
78   {
79   public:
80     typedef alucoord_t val_t;
81     typedef int arg_t;
82     val_t operator() ( const alucoord_t (&)[ 2 ], const alucoord_t (&)[ 3 ], const arg_t & );
83     val_t operator() ( const alucoord_t (&)[ 3 ], const alucoord_t (&)[ 3 ], const arg_t & );
84   };
85 
86   template< class A > class QuadraturCube3D : private QuadraturCube3Dbasis {
87     private :
88       TrilinearMapping _map;
89     public :
QuadraturCube3D(const TrilinearMapping & m)90       QuadraturCube3D (const TrilinearMapping & m) : _map (m) {}
~QuadraturCube3D()91      ~QuadraturCube3D () {}
92       typedef typename A::val_t val_t;
93       typedef typename A::arg_t arg_t;
94       inline val_t integrate2 (val_t, const arg_t & = arg_t ());
95       inline val_t integrate3 (val_t, const arg_t & = arg_t ());
96   };
97 
98   template< class A > class QuadraturCube3D_1 : private QuadraturCube3Dbasis {
99     private :
100       TrilinearMapping _map;
101     public :
QuadraturCube3D_1(const TrilinearMapping & m)102       QuadraturCube3D_1 (const TrilinearMapping & m) : _map (m) {}
~QuadraturCube3D_1()103      ~QuadraturCube3D_1 () {}
104       typedef typename A::val_t val_t;
105       typedef typename A::arg_t arg_t;
106       inline val_t integrate2 (val_t, const arg_t & = arg_t ());
107       inline val_t integrate3 (val_t, const arg_t & = arg_t ());
108   };
109 
110   class BilinearSurfaceMapping {
111     const alucoord_t (&_p0)[3], (&_p1)[3], (&_p2)[3], (&_p3)[3];
112     alucoord_t _b [4][3];
113     alucoord_t _n [3][3];
114     public :
115       inline BilinearSurfaceMapping (const alucoord_t (&)[3], const alucoord_t (&)[3], const alucoord_t (&)[3], const alucoord_t (&)[3]);
116       inline BilinearSurfaceMapping (const BilinearSurfaceMapping &);
~BilinearSurfaceMapping()117      ~BilinearSurfaceMapping () {}
118       inline void map2world(const alucoord_t (&)[2], alucoord_t (&)[3]) const;
119       inline void map2world(alucoord_t x, alucoord_t y, alucoord_t (&w)[3]) const;
120       inline void normal(const alucoord_t (&)[2], alucoord_t (&)[3]) const;
121 
barycenter(const alucoord_t (& p0)[3],const alucoord_t (& p1)[3],const alucoord_t (& p2)[3],const alucoord_t (& p3)[3],alucoord_t (& barycenter)[3])122       static inline void barycenter(const alucoord_t (&p0)[3], const alucoord_t (&p1)[3], const alucoord_t (&p2)[3], const alucoord_t (&p3)[3],
123                                     alucoord_t (&barycenter)[3])
124       {
125         barycenter[0] = 0.25 * (p0[0] + p1[0] + p2[0] + p3[0]);
126         barycenter[1] = 0.25 * (p0[1] + p1[1] + p2[1] + p3[1]);
127         barycenter[2] = 0.25 * (p0[2] + p1[2] + p2[2] + p3[2]);
128 
129   #ifdef ALUGRIDDEBUG
130         {
131           BilinearSurfaceMapping map(p0,p1,p2,p3);
132           alucoord_t p[3];
133           map.map2world(.0, .0, p);
134           for(int j=0; j<3; ++j)
135           {
136             alugrid_assert ( fabs(barycenter[j] - p[j]) < 1e-8 );
137           }
138         }
139   #endif
140       }
141   };
142 
143   class QuadraturCube2Dbasis {
144     protected :
145       static const alucoord_t _p1 [2];
146       static const alucoord_t _p3 [4][2];
147   };
148 
149   template< class A > class QuadraturCube2D : private QuadraturCube2Dbasis {
150     BilinearSurfaceMapping _map;
151     public:
QuadraturCube2D(const BilinearSurfaceMapping & m)152       QuadraturCube2D(const BilinearSurfaceMapping & m) : _map (m) {}
~QuadraturCube2D()153      ~QuadraturCube2D() {}
154       typedef typename A::val_t val_t;
155       typedef typename A::arg_t arg_t;
156       inline val_t integrate1 (val_t, const arg_t & = arg_t());
157       inline val_t integrate3 (val_t, const arg_t & = arg_t());
158       inline val_t integrate  (val_t, const arg_t & = arg_t(), int = 1);
159   };
160 
161   template< class A > class QuadraturCube2D_1 : private QuadraturCube2Dbasis {
162     BilinearSurfaceMapping _map;
163     public:
QuadraturCube2D_1(const BilinearSurfaceMapping & m)164       QuadraturCube2D_1(const BilinearSurfaceMapping & m) : _map (m) {}
~QuadraturCube2D_1()165      ~QuadraturCube2D_1() {}
166       typedef typename A::val_t val_t;
167       typedef typename A::arg_t arg_t;
168       inline val_t integrate1 (val_t, const arg_t & = arg_t());
169       inline val_t integrate3 (val_t, const arg_t & = arg_t());
170       inline val_t integrate  (val_t, const arg_t & = arg_t(), int = 1);
171   };
172 
173           //
174           //    #    #    #  #          #    #    #  ######
175           //    #    ##   #  #          #    ##   #  #
176           //    #    # #  #  #          #    # #  #  #####
177           //    #    #  # #  #          #    #  # #  #
178           //    #    #   ##  #          #    #   ##  #
179           //    #    #    #  ######     #    #    #  ######
180           //
181 
182 
TrilinearMapping(const alucoord_t (& x0)[3],const alucoord_t (& x1)[3],const alucoord_t (& x2)[3],const alucoord_t (& x3)[3],const alucoord_t (& x4)[3],const alucoord_t (& x5)[3],const alucoord_t (& x6)[3],const alucoord_t (& x7)[3])183   inline TrilinearMapping::TrilinearMapping (const alucoord_t (&x0)[3], const alucoord_t (&x1)[3],
184                         const alucoord_t (&x2)[3], const alucoord_t (&x3)[3], const alucoord_t (&x4)[3],
185                         const alucoord_t (&x5)[3], const alucoord_t (&x6)[3], const alucoord_t (&x7)[3])
186     : p0(x0), p1(x1), p2(x2), p3(x3), p4(x4), p5(x5), p6(x6), p7(x7) {
187     a [0][0] = p3 [0];
188     a [0][1] = p3 [1];
189     a [0][2] = p3 [2];
190     a [1][0] = p0 [0] - p3 [0];
191     a [1][1] = p0 [1] - p3 [1];
192     a [1][2] = p0 [2] - p3 [2];
193     a [2][0] = p2 [0] - p3 [0];
194     a [2][1] = p2 [1] - p3 [1];
195     a [2][2] = p2 [2] - p3 [2];
196     a [3][0] = p7 [0] - p3 [0];
197     a [3][1] = p7 [1] - p3 [1];
198     a [3][2] = p7 [2] - p3 [2];
199     a [4][0] = p1 [0] - p2 [0] - a [1][0];
200     a [4][1] = p1 [1] - p2 [1] - a [1][1];
201     a [4][2] = p1 [2] - p2 [2] - a [1][2];
202     a [5][0] = p6 [0] - p7 [0] - a [2][0];
203     a [5][1] = p6 [1] - p7 [1] - a [2][1];
204     a [5][2] = p6 [2] - p7 [2] - a [2][2];
205     a [6][0] = p4 [0] - p0 [0] - a [3][0];
206     a [6][1] = p4 [1] - p0 [1] - a [3][1];
207     a [6][2] = p4 [2] - p0 [2] - a [3][2];
208     a [7][0] = p5 [0] - p4 [0] + p7 [0] - p6 [0] - p1 [0] + p0 [0] + a [2][0];
209     a [7][1] = p5 [1] - p4 [1] + p7 [1] - p6 [1] - p1 [1] + p0 [1] + a [2][1];
210     a [7][2] = p5 [2] - p4 [2] + p7 [2] - p6 [2] - p1 [2] + p0 [2] + a [2][2];
211     return;
212   }
213 
TrilinearMapping(const TrilinearMapping & map)214   inline TrilinearMapping::TrilinearMapping (const TrilinearMapping & map)
215     : p0(map.p0), p1(map.p1), p2(map.p2), p3(map.p3), p4(map.p4), p5(map.p5), p6(map.p6), p7(map.p7) {
216     for (int i = 0; i < 8; i ++)
217       for (int j = 0; j < 3; j ++)
218         a [i][j] = map.a [i][j];
219     return;
220   }
221 
map2world(const alucoord_t (& p)[3],alucoord_t (& world)[3])222   inline void TrilinearMapping::map2world(const alucoord_t (&p)[3], alucoord_t (&world)[3]) const {
223     alucoord_t x = .5 * (p [0] + 1.);
224     alucoord_t y = .5 * (p [1] + 1.);
225     alucoord_t z = .5 * (p [2] + 1.);
226     alucoord_t t3 = y * z;
227     alucoord_t t8 = x * z;
228     alucoord_t t13 = x * y;
229     alucoord_t t123 = x * t3;
230     world [0] = a [0][0] + a [1][0] * x + a [2][0] * y + a [3][0] * z + a [4][0] * t13 + a [5][0] * t3 + a [6][0] * t8 + a [7][0] * t123;
231     world [1] = a [0][1] + a [1][1] * x + a [2][1] * y + a [3][1] * z + a [4][1] * t13 + a [5][1] * t3 + a [6][1] * t8 + a [7][1] * t123;
232     world [2] = a [0][2] + a [1][2] * x + a [2][2] * y + a [3][2] * z + a [4][2] * t13 + a [5][2] * t3 + a [6][2] * t8 + a [7][2] * t123;
233     return;
234   }
235 
map2world(const alucoord_t x1,const alucoord_t x2,const alucoord_t x3,alucoord_t (& world)[3])236   inline void TrilinearMapping::map2world(const alucoord_t x1, const alucoord_t x2, const alucoord_t x3, alucoord_t (&world)[3]) const {
237     alucoord_t map [3];
238     map [0] = x1;
239     map [1] = x2;
240     map [2] = x3;
241     map2world (map, world);
242     return;
243   }
244 
affine()245   inline bool TrilinearMapping::affine () const
246   {
247     alucoord_t sum = 0.0;
248     // summ all factor from non-linaer terms
249     for(int i=4; i<8; ++i)
250     {
251       for(int j=0; j<3; ++j)
252       {
253         sum += fabs(a[i][j]);
254       }
255     }
256 
257     // mapping is affine when all higher terms are zero
258     return (sum < _epsilon);
259   }
260 
integrate2(val_t base,const arg_t & x)261   template< class A > inline typename QuadraturCube3D < A >::val_t QuadraturCube3D < A >::integrate2 (val_t base, const arg_t & x) {
262 
263           // Exakt f"ur Polynome vom Grad <= 2
264           // auf dem W"urfel [-1,1]x[-1,1]x[-1,1], V([-1,1]^3) = 8.0
265 
266     for(int i = 0; i < 4; i ++) {
267       val_t t = A()( _p2 [i], x);
268       base += (t *= ( _map.det ( _p2 [i]) * 2.0));
269     }
270     return base;
271   }
272 
integrate3(val_t base,const arg_t & x)273   template< class A > inline typename QuadraturCube3D < A >::val_t QuadraturCube3D < A >::integrate3 (val_t base, const arg_t & x) {
274 
275           // exakt f"ur Polynome vom Grad <= 3
276 
277     for(int i = 0; i < 8; i ++ ) {
278       val_t t = A()( _p3 [i], x);
279       base += (t *= _map.det ( _p3 [i]));
280     }
281     return base;
282   }
283 
integrate2(val_t base,const arg_t & x)284   template< class A > inline typename QuadraturCube3D_1 < A >::val_t QuadraturCube3D_1 < A >::integrate2 (val_t base, const arg_t & x) {
285 
286           // Exakt f"ur Polynome vom Grad <= 2
287           // auf dem W"urfel [-1,1]x[-1,1]x[-1,1], V([-1,1]^3) = 8.0
288 
289     for(int i = 0; i < 4; i ++) {
290       val_t t = A()( _p2 [i], _map, x);
291       base += (t *= ( _map.det ( _p2 [i]) * 2.0));
292     }
293     return base;
294   }
295 
integrate3(val_t base,const arg_t & x)296   template< class A > inline typename QuadraturCube3D_1 < A >::val_t QuadraturCube3D_1 < A >::integrate3 (val_t base, const arg_t & x) {
297 
298           // exakt f"ur Polynome vom Grad <= 3
299 
300     for(int i = 0; i < 8; i ++ ) {
301       val_t t = A()( _p3 [i], _map, x);
302       base += (t *= _map.det ( _p3 [i]));
303     }
304     return base;
305   }
306 
operator()307   inline VolumeCalc::val_t VolumeCalc::operator () (const alucoord_t (&)[3], const arg_t &) {
308     return 1.0;
309   }
310 
operator()311   inline VolumeCalc::val_t VolumeCalc::operator () (const alucoord_t (&)[4], const LinearMapping &, const arg_t &) {
312     return 1.0;
313   }
314 
BilinearSurfaceMapping(const alucoord_t (& x0)[3],const alucoord_t (& x1)[3],const alucoord_t (& x2)[3],const alucoord_t (& x3)[3])315   inline BilinearSurfaceMapping::BilinearSurfaceMapping (const alucoord_t (&x0)[3], const alucoord_t (&x1)[3], const alucoord_t (&x2)[3], const alucoord_t (&x3)[3])
316     : _p0 (x0), _p1 (x1), _p2 (x2), _p3 (x3) {
317     _b [0][0] = _p0 [0];
318     _b [0][1] = _p0 [1];
319     _b [0][2] = _p0 [2];
320     _b [1][0] = _p3 [0] - _p0 [0];
321     _b [1][1] = _p3 [1] - _p0 [1];
322     _b [1][2] = _p3 [2] - _p0 [2];
323     _b [2][0] = _p1 [0] - _p0 [0];
324     _b [2][1] = _p1 [1] - _p0 [1];
325     _b [2][2] = _p1 [2] - _p0 [2];
326     _b [3][0] = _p2 [0] - _p1 [0] - _b [1][0];
327     _b [3][1] = _p2 [1] - _p1 [1] - _b [1][1];
328     _b [3][2] = _p2 [2] - _p1 [2] - _b [1][2];
329     _n [0][0] = _b [1][1] * _b [2][2] - _b [1][2] * _b [2][1];
330     _n [0][1] = _b [1][2] * _b [2][0] - _b [1][0] * _b [2][2];
331     _n [0][2] = _b [1][0] * _b [2][1] - _b [1][1] * _b [2][0];
332     _n [1][0] = _b [1][1] * _b [3][2] - _b [1][2] * _b [3][1];
333     _n [1][1] = _b [1][2] * _b [3][0] - _b [1][0] * _b [3][2];
334     _n [1][2] = _b [1][0] * _b [3][1] - _b [1][1] * _b [3][0];
335     _n [2][0] = _b [3][1] * _b [2][2] - _b [3][2] * _b [2][1];
336     _n [2][1] = _b [3][2] * _b [2][0] - _b [3][0] * _b [2][2];
337     _n [2][2] = _b [3][0] * _b [2][1] - _b [3][1] * _b [2][0];
338     return;
339   }
340 
BilinearSurfaceMapping(const BilinearSurfaceMapping & m)341   inline BilinearSurfaceMapping::BilinearSurfaceMapping (const BilinearSurfaceMapping & m)
342           : _p0(m._p0), _p1(m._p1), _p2(m._p2), _p3(m._p3) {
343     {for (int i = 0; i < 4; i ++)
344       for (int j = 0; j < 3; j ++ )
345         _b [i][j] = m._b [i][j];
346     }
347     {for (int i = 0; i < 3; i ++)
348       for (int j = 0; j < 3; j ++ )
349         _n [i][j] = m._n [i][j];
350     }
351     return;
352   }
353 
map2world(const alucoord_t (& map)[2],alucoord_t (& wld)[3])354   inline void BilinearSurfaceMapping::map2world (const alucoord_t (&map)[2], alucoord_t (&wld)[3]) const {
355     alucoord_t x = .5 * (map [0] + 1.0);
356     alucoord_t y = .5 * (map [1] + 1.0);
357     alucoord_t xy = x * y;
358     wld[0] = _b [0][0] + x * _b [1][0] + y * _b [2][0] + xy * _b [3][0];
359     wld[1] = _b [0][1] + x * _b [1][1] + y * _b [2][1] + xy * _b [3][1];
360     wld[2] = _b [0][2] + x * _b [1][2] + y * _b [2][2] + xy * _b [3][2];
361     return;
362   }
363 
map2world(alucoord_t x,alucoord_t y,alucoord_t (& w)[3])364   inline void BilinearSurfaceMapping::map2world (alucoord_t x, alucoord_t y, alucoord_t (&w)[3]) const {
365     alucoord_t p [2];
366     p [0] = x;
367     p [1] = y;
368     map2world (p,w);
369     return;
370   }
371 
normal(const alucoord_t (& map)[2],alucoord_t (& normal)[3])372   inline void BilinearSurfaceMapping::normal (const alucoord_t (&map)[2], alucoord_t (&normal)[3]) const {
373     alucoord_t x = .5 * (map [0] + 1.0);
374     alucoord_t y = .5 * (map [1] + 1.0);
375     normal [0] = -( _n [0][0] + _n [1][0] * x + _n [2][0] * y);
376     normal [1] = -( _n [0][1] + _n [1][1] * x + _n [2][1] * y);
377     normal [2] = -( _n [0][2] + _n [1][2] * x + _n [2][2] * y);
378     return;
379   }
380 
integrate1(val_t base,const arg_t & x)381   template< class A > typename QuadraturCube2D < A >::val_t QuadraturCube2D < A >::integrate1 (val_t base, const arg_t & x) {
382     alucoord_t n [3];
383     _map.normal (_p1,n);
384     return base + A () (_p1,n,x);
385   }
386 
integrate3(val_t base,const arg_t & x)387   template< class A > typename QuadraturCube2D < A >::val_t QuadraturCube2D < A >::integrate3 (val_t base, const arg_t & x) {
388     const alucoord_t quarter = 1.0/4.0;
389     val_t res;
390     for(int i = 0; i < 4; i ++) {
391       alucoord_t n [3];
392       _map.normal (_p3 [i],n);
393       val_t tmp = A () ( _p3 [i],n,x);
394       base += (tmp *= quarter);
395     }
396     return base;
397   }
398 
integrate(val_t base,const arg_t & x,int resolution)399   template< class A > typename QuadraturCube2D < A >::val_t QuadraturCube2D < A >::integrate(val_t base, const arg_t & x, int resolution) {
400     alucoord_t w = 1.0/alucoord_t (resolution * resolution);
401     alucoord_t delta = 2.0/alucoord_t (resolution);
402     for(int i = 0; i < resolution; i ++) {
403       alucoord_t p [2];
404       p [0] = delta * (alucoord_t (i) + .5) - 1.0;
405       for(int j = 0; j < resolution; j ++) {
406         alucoord_t n [3];
407         p [1] = delta * (alucoord_t (j) + .5) - 1.0;
408         _map.normal (p,n);
409         val_t tmp = A () (p,n,x);
410         tmp *= w;
411         base += tmp;
412       }
413     }
414     return base;
415   }
416 
integrate1(val_t base,const arg_t & x)417   template< class A > typename QuadraturCube2D_1 < A >::val_t QuadraturCube2D_1< A >::integrate1 ( val_t base, const arg_t &x )
418   {
419     return base + A()( _p1,_map, x );
420   }
421 
422   template< class A >
integrate3(val_t base,const arg_t & x)423   typename QuadraturCube2D_1 < A >::val_t QuadraturCube2D_1< A >::integrate3 ( val_t base, const arg_t & x )
424   {
425     const alucoord_t quarter = 1.0/4.0;
426     val_t res;
427     for(int i = 0; i < 4; i ++) {
428       val_t tmp = A () ( _p3 [i],_map,x);
429       base += (tmp *= quarter);
430     }
431     return base;
432   }
433 
434   template< class A >
integrate(val_t base,const arg_t & x,int resolution)435   typename QuadraturCube2D_1 < A >::val_t QuadraturCube2D_1 < A >::integrate(val_t base, const arg_t & x, int resolution)
436   {
437     alucoord_t w = 1.0/alucoord_t (resolution * resolution);
438     alucoord_t delta = 2.0/alucoord_t (resolution);
439     for(int i = 0; i < resolution; i ++) {
440       alucoord_t p [2];
441       p [0] = delta * (alucoord_t (i) + .5) - 1.0;
442       for(int j = 0; j < resolution; j ++) {
443         p [1] = delta * (alucoord_t (j) + .5) - 1.0;
444         val_t tmp = A () (p,_map,x);
445         tmp *= w;
446         base += tmp;
447       }
448     }
449     return base;
450   }
451 
operator()452   inline SurfaceCalc::val_t SurfaceCalc::operator()(const alucoord_t (&)[2], const alucoord_t (&n)[3], const arg_t &)
453   {
454     return sqrt (n [0] * n [0] + n [1] * n [1] + n [2] * n [2]);
455   }
456 
operator()457   inline SurfaceCalc::val_t SurfaceCalc::operator()(const alucoord_t (&)[3], const alucoord_t (&n)[3], const arg_t &)
458   {
459     return sqrt (n [0] * n [0] + n [1] * n [1] + n [2] * n [2]);
460   }
461 
462 } // namespace ALUGrid
463 
464 #endif // #ifndef MAPP_CUBE_3D_H_INCLUDED
465