1
#ifndef _RHEO_PIOLA_ALGO_H
2
#define _RHEO_PIOLA_ALGO_H
4
/// This file is part of Rheolef.
6
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
8
/// Rheolef is free software; you can redistribute it and/or modify
9
/// it under the terms of the GNU General Public License as published by
10
/// the Free Software Foundation; either version 2 of the License, or
11
/// (at your option) any later version.
13
/// Rheolef is distributed in the hope that it will be useful,
14
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
/// GNU General Public License for more details.
18
/// You should have received a copy of the GNU General Public License
19
/// along with Rheolef; if not, write to the Free Software
20
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
#include "rheolef/tensor.h"
23
#include "rheolef/geo.h"
24
// ---------------------------------------------------------------------------
25
// piola transform and its inverse on simplex
26
// ---------------------------------------------------------------------------
27
// piola transformation
29
// hat_x --> x = F_K(hat_x)
30
// ------------------------------------------
31
// TODO: should be merged with
32
// piola.h = general piola on all elements (non-simplex)
33
// this file is actually used only by ZZ posteriori error estimators
41
bool is_a_vector = false)
43
return point((!is_a_vector?a[0]:0)
44
+ (b[0]-a[0])*hat_x[0]);
53
bool is_a_vector = false)
55
return ((!is_a_vector)?a:point(0,0))
67
bool is_a_vector = false)
69
return ((!is_a_vector)?a:point(0,0))
74
// ------------------------------------------
75
// piola transformation matrix: M_K where
76
// F_K(hat_x) = M_K*hat_x + t_K
77
// ------------------------------------------
95
m.set_column (b-a, 0, 2);
96
m.set_column (c-a, 1, 2);
107
m.set_column (b-a, 0, 3);
108
m.set_column (c-a, 1, 3);
109
m.set_column (d-a, 2, 3);
116
const geo_element& K)
119
case reference_element::e:
120
set_piola_matrix_e (M_K,
124
case reference_element::t:
125
set_piola_matrix_t (M_K,
130
case reference_element::T:
131
set_piola_matrix_T (M_K,
138
error_macro ("not yet supported element");
141
// ------------------------------------------
142
// inverse piola transformation
143
// F_K^{-1} : K --> hat(K)
145
// ------------------------------------------
153
return point((x[0]-a[0])/(b[0]-a[0]));
163
Float t9 = 1/(-b[0]*c[1]+b[0]*a[1]+a[0]*c[1]+c[0]*b[1]-c[0]*a[1]-a[0]*b[1]);
164
Float t11 = -a[0]+x[0];
165
Float t15 = -a[1]+x[1];
166
return point((-c[1]+a[1])*t9*t11-(-c[0]+a[0])*t9*t15,
167
(b[1]-a[1])*t9*t11-(b[0]-a[0])*t9*t15);
180
for (size_t i = 0; i < 3; i++) {
187
bool is_singular = ! invert_3x3 (A, inv_A);
188
check_macro(!is_singular, "inv_piola: singular transformation in tetrahedron");
189
point hat_x = inv_A*ax;
192
#endif // _RHEO_PIOLA_ALGO_H