/usr/include/rheolef/characteristic.h is in librheolef-dev 6.6-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 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 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | #ifndef _RHEO_CHARACTERISTIC_H
#define _RHEO_CHARACTERISTIC_H
///
/// This file is part of Rheolef.
///
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
///
/// Rheolef is free software; you can redistribute it and/or modify
/// it under the terms of the GNU General Public License as published by
/// the Free Software Foundation; either version 2 of the License, or
/// (at your option) any later version.
///
/// Rheolef is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU General Public License for more details.
///
/// You should have received a copy of the GNU General Public License
/// along with Rheolef; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
///
/// =========================================================================
#include "rheolef/field.h"
#include "rheolef/quadrature.h"
#include "rheolef/basis_on_pointset.h"
namespace rheolef {
// -------------------------------------------------------------------
// characteristic_on_quadrature: store the localization in mesh of the
// quadrature point tacking: y = x + d(x) : that belongs in K as hat_y
// -------------------------------------------------------------------
template <class T, class M>
struct characteristic_on_quadrature_rep {
// allocators:
characteristic_on_quadrature_rep (quadrature_option_type qopt1 = quadrature_option_type(quadrature_option_type::max_family,0))
: _qopt (qopt1),
_quad (),
_piola_on_quad(),
_ie2dis_ix (),
_hat_y (),
_yq ()
{}
characteristic_on_quadrature_rep (const characteristic_on_quadrature_rep<T,M>& x)
: _qopt (x._qopt),
#ifdef TO_CLEAN
_quad (x._quad),
_piola_on_quad(x._piola_on_quad),
_ie2dis_ix (x._ie2dis_ix),
_hat_y (x._hat_y),
_yq (x._yq)
#endif // TO_CLEAN
_quad (),
_piola_on_quad(),
_ie2dis_ix (),
_hat_y (),
_yq ()
{
error_macro ("physical copy of characteristic_on_quadrature_rep may not happend");
}
public:
// data:
quadrature_option_type _qopt;
quadrature<T> _quad;
basis_on_pointset<T> _piola_on_quad;
array<index_set,M> _ie2dis_ix;
array<point_basic<T>,M> _hat_y;
array<point_basic<T>,M> _yq;
};
template <class T, class M>
class characteristic_on_quadrature : public smart_pointer<characteristic_on_quadrature_rep<T,M> > {
public:
// typedefs:
typedef characteristic_on_quadrature_rep<T,M> rep;
typedef smart_pointer<rep> base;
// allocator:
characteristic_on_quadrature
(quadrature_option_type qopt = quadrature_option_type(quadrature_option_type::max_family,0))
: base (new_macro(rep(qopt)))
{}
// data:
};
// -------------------------------------------------------------------
// characteristic_rep: store a list of characteristic_on_quadrature(s)
// together with the displacement field dh
// -------------------------------------------------------------------
template<class T, class M>
class characteristic_rep {
public:
typedef std::map<std::string,characteristic_on_quadrature<T,M> > map_type;
// allocator:
characteristic_rep(const field_basic<T,M>& dh)
: _dh(dh),
_coq_map()
{}
// accesor:
const field_basic<T,M>& get_displacement() const { return _dh; }
const characteristic_on_quadrature<T,M>&
get_pre_computed (
const space_basic<T,M>& Xh,
const field_basic<T,M>& dh,
const quadrature_option_type& qopt) const;
// data:
protected:
field_basic<T,M> _dh;
mutable map_type _coq_map;
};
/*Class:characteristic
NAME: @code{characteristic} - the Lagrange-Galerkin method implemented
@cindex Lagrange-Galerkin method
@cindex method of characteristic
@cindex quadrature formulae
@findex riesz
@clindex space
@clindex geo
SYNOPSYS:
The class characteristic implements the Lagrange-Galerkin method:
It is the extension of the method of characteristic from the finite
difference to the finite element context.
EXAMPLE:
@noindent
Consider the bilinear form @code{lh} defined by
@example
/
|
lh(x) = | uh(x+dh(x)) v(x) dx
|
/ Omega
@end example
where @code{dh} is a deformation vector field.
The characteristic is defined by @code{X(x)=x+dh(x)}
and the previous integral writes equivalently:
@example
/
|
lh(x) = | uh(X(x)) v(x) dx
|
/ Omega
@end example
For instance, in Lagrange-Galerkin methods,
the deformation field @code{dh(x)=-dt*uh(x)}
where @code{uh} is the advection field and @code{dt} a time step.
The following code implements the computation of lh:
@example
field dh = ...;
field uh = ...;
characteristic X (dh);
test v (Xh);
field lh = integrate (compose(uh, X)*v, qopt);
@end example
The Gauss-Lobatto quadrature formule is recommended for
Lagrange-Galerkin methods.
The order equal to the polynomial order of Xh
(order 1: trapeze, order 2: simpson, etc).
Recall that this choice of quadrature formulae guaranties inconditional
stability at any polynomial order.
Alternative quadrature formulae or order can be used by using the
additional quadrature option argument to the @code{integrate} function @pxref{integrate algorithm}.
End: */
//<characteristic:
template<class T, class M = rheo_default_memory_model>
class characteristic_basic : public smart_pointer<characteristic_rep<T,M> > {
public:
typedef characteristic_rep<T,M> rep;
typedef smart_pointer<rep> base;
// allocator:
characteristic_basic(const field_basic<T,M>& dh);
// accesors:
const field_basic<T,M>& get_displacement() const;
const characteristic_on_quadrature<T,M>&
get_pre_computed (
const space_basic<T,M>& Xh,
const field_basic<T,M>& dh,
const quadrature_option_type& qopt) const;
};
typedef characteristic_basic<Float> characteristic;
//>characteristic:
template<class T, class M>
inline
characteristic_basic<T,M>::characteristic_basic (const field_basic<T,M>& dh)
: base (new_macro(rep(dh)))
{
}
template<class T, class M>
inline
const field_basic<T,M>&
characteristic_basic<T,M>::get_displacement() const
{
return base::data().get_displacement();
}
template<class T, class M>
inline
const characteristic_on_quadrature<T,M>&
characteristic_basic<T,M>::get_pre_computed (
const space_basic<T,M>& Xh,
const field_basic<T,M>& dh,
const quadrature_option_type& qopt) const
{
return base::data().get_pre_computed (Xh,dh,qopt);
}
// ===========================================================================
// the temporary class returned by compose (phi_h,X)
// ===========================================================================
template<class T, class M>
class field_o_characteristic {
public:
// allocator:
field_o_characteristic(const field_basic<T,M>& uh, const characteristic_basic<T,M>& X)
: _uh(uh), _X(X) {}
// accesor:
const field_basic<T,M>& get_field() const { return _uh; }
const characteristic_basic<T,M>& get_characteristic() const { return _X; }
// data:
protected:
field_basic<T,M> _uh;
characteristic_basic<T,M> _X;
};
#ifdef TO_CLEAN
// ===========================================================================
// compose (uh,X) returns a temporary:
// ===========================================================================
template<class T, class M>
inline
field_o_characteristic<T,M>
compose (const field_basic<T,M>& uh, characteristic_basic<T,M>& X)
{
return field_o_characteristic<T,M>(uh, X);
}
// ===========================================================================
// riesz(Vh,compose (phi_h,X)) returns a field:
// => specialisation of the riesz function:
// ===========================================================================
template <class T, class M>
field_basic<T,M>
riesz (
const space_basic<T,M>& Xh,
const field_o_characteristic<T,M>& f,
quadrature_option_type qopt
= quadrature_option_type(quadrature_option_type::max_family,0));
#endif // TO_CLEAN
}// namespace rheolef
#endif // _RHEO_CHARACTERISTIC_H
|