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
/// =========================================================================
23
#include "rheolef/basis_rep.h"
24
#include "rheolef/smart_pointer.h"
27
NAME: @code{basis} - polynomial basis
28
@cindex polynomial basis
30
@cindex reference element
31
@clindex reference_element
34
The @code{basis} class defines functions that evaluates a polynomial
35
basis and its derivatives on a point. The polynomial basis
36
is designated by a string, e.g. "P0", "P1", "P2", "bubble",...
37
indicating the basis. The basis depends also of the reference element:
38
triangle, square, tetrahedron (@pxref{reference_element internal}).
39
For instance, on a square, the "P1"
40
string designates the common Q1 four-nodes basis on the reference square.
43
The nodes associated to the Lagrange polynomial basis
44
are also available by its associated accessor.
48
The @code{basis} class
49
is a @pxref{smart_pointer internal}) class on a @code{basis_rep} class that is a pure virtual base class
50
for effective bases, e.g. basis_P1, basis_P1, etc.
52
LMC-IMAG, 38041 Grenoble cedex 9, France
53
| Pierre.Saramito@imag.fr
59
class basis : public smart_pointer<basis_rep> {
64
typedef size_t size_type;
68
basis (std::string name = "");
72
std::string name() const;
73
size_type degree() const;
74
size_type size (reference_element hat_K) const;
77
reference_element hat_K,
78
size_type i_dof_local,
79
const point& hat_x) const;
82
reference_element hat_K,
83
size_type i_dof_local,
84
const point& hat_x) const;
87
reference_element hat_K,
89
std::vector<Float>& values) const;
92
reference_element hat_K,
94
std::vector<point>& values) const;
97
reference_element hat_K,
98
std::vector<point>& hat_node) const;
100
void dump(std::ostream& out = std::cerr) const;
103
// -----------------------------------------------------------
105
// -----------------------------------------------------------
107
basis::basis(std::string name)
108
: smart_pointer<basis_rep> (basis_rep::make_ptr(name))
115
return data().name();
119
basis::degree() const
121
return data().degree();
125
basis::size (reference_element hat_K) const
127
return data().size (hat_K);
132
reference_element hat_K,
133
size_type i_dof_local,
134
const point& hat_x) const
136
return data().eval (hat_K, i_dof_local, hat_x);
141
reference_element hat_K,
142
size_type i_dof_local,
143
const point& hat_x) const
145
return data().grad_eval (hat_K, i_dof_local, hat_x);
150
reference_element hat_K,
152
std::vector<Float>& values) const
154
return data().eval (hat_K, hat_x, values);
159
reference_element hat_K,
161
std::vector<point>& values) const
163
return data().grad_eval (hat_K, hat_x, values);
168
reference_element hat_K,
169
std::vector<point>& hat_node) const
171
return data().hat_node (hat_K, hat_node);
175
basis::dump(std::ostream& out) const
177
out << "basis " << name() << std::endl;
179
#endif // _RHEO_BASIS_H