/usr/include/rheolef/basis_on_lattice.h is in librheolef-dev 5.93-2.
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 | #ifndef _RHEO_BASIS_ON_LATTICE_H
#define _RHEO_BASIS_ON_LATTICE_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
///
/// =========================================================================
//! Pre-compute a piola transformation polynomial basis
//! on a lattice definied on the reference element.
//! The computation is performed one time for all
//! the first time the reference element appears.
//! Thus, when looping on the mesh for the Lagrange interpolation
//! on a Lagrange nodal basis : the lattice is the set of nodes
//! the evaluation of the fem polynomial basis.
//! The evaluation is performed only one time.
#include "rheolef/basis.h"
#include "rheolef/quadrature.h"
namespace rheolef {
// -----------------------------------------------------------------------
// basis evaluated on nodal lattice of Lagrange basis
// -----------------------------------------------------------------------
class basis_on_nodal_basis {
public:
typedef std::vector<Float>::size_type size_type;
typedef std::vector<Float>::const_iterator const_iterator;
// allocators:
basis_on_nodal_basis ();
basis_on_nodal_basis (const basis& nb, const basis& b);
// modifiers:
void set (const basis& nb, const basis& b);
// accessors:
const_iterator begin (reference_element hat_K, size_type q) const;
const_iterator end (reference_element hat_K, size_type q) const;
// data:
protected:
basis _nb;
basis _b;
mutable std::vector<std::vector<Float> > _val [reference_element::max_size];
mutable std::vector<bool > _initialized;
void _initialize (reference_element hat_K) const;
};
// -----------------------------------------------------------------------
// basis evaluated on lattice of quadrature formulae
// -----------------------------------------------------------------------
class basis_on_quadrature {
public:
typedef std::vector<Float>::size_type size_type;
typedef std::vector<Float>::const_iterator const_iterator;
typedef std::vector<point>::const_iterator const_iterator_grad;
typedef std::vector<basic_point<point> >::const_iterator const_iterator_hessian;
// allocators:
basis_on_quadrature ();
basis_on_quadrature (const quadrature& quad, const basis& b);
// modifiers:
void set (const quadrature& quad, const basis& b);
// accessors:
const basis get_basis() const;
const_iterator begin (reference_element hat_K, size_type q) const;
const_iterator end (reference_element hat_K, size_type q) const;
const_iterator_grad
begin_grad (reference_element hat_K, size_type q) const;
const_iterator_grad
end_grad (reference_element hat_K, size_type q) const;
const_iterator_hessian
begin_hessian (reference_element hat_K, size_type q) const;
const_iterator_hessian
end_hessian (reference_element hat_K, size_type q) const;
// data:
protected:
const quadrature* _p_quad;
basis _b;
mutable std::vector<std::vector<Float> > _val [reference_element::max_size];
mutable std::vector<std::vector<point> > _grad_val [reference_element::max_size];
mutable std::vector<std::vector<basic_point<point> > > _hessian_val [reference_element::max_size];
mutable std::vector<bool > _initialized;
mutable std::vector<bool > _grad_initialized;
mutable std::vector<bool > _hessian_initialized;
void _initialize (reference_element hat_K) const;
void _grad_initialize (reference_element hat_K) const;
void _hessian_initialize (reference_element hat_K) const;
};
// ----------------------------------------------------------
// inlined
// ----------------------------------------------------------
inline
basis_on_nodal_basis::basis_on_nodal_basis ()
: _nb(), _b(), _val(),
_initialized(reference_element::max_size, false)
{
}
inline
basis_on_nodal_basis::basis_on_nodal_basis (const basis& nb, const basis& b)
: _nb(nb), _b(b), _val(),
_initialized(reference_element::max_size, false)
{
}
inline
void
basis_on_nodal_basis::set (const basis& nb, const basis& b)
{
_nb = nb;
_b = b;
std::fill (_initialized.begin(), _initialized.end(), false);
}
inline
basis_on_quadrature::basis_on_quadrature ()
: _p_quad(0), _b(), _val(), _grad_val(), _hessian_val(),
_initialized(reference_element::max_size, false),
_grad_initialized(reference_element::max_size, false),
_hessian_initialized(reference_element::max_size, false)
{
}
inline
basis_on_quadrature::basis_on_quadrature (const quadrature& quad, const basis& b)
: _p_quad(&quad), _b(b), _val(), _grad_val(), _hessian_val(),
_initialized(reference_element::max_size, false),
_grad_initialized(reference_element::max_size, false),
_hessian_initialized(reference_element::max_size, false)
{
}
inline
void
basis_on_quadrature::set (const quadrature& quad, const basis& b)
{
// data was not defined on this quadrature formulae : reset
std::fill (_initialized.begin(), _initialized.end(), false);
std::fill (_grad_initialized.begin(), _grad_initialized.end(), false);
std::fill (_hessian_initialized.begin(), _hessian_initialized.end(), false);
_p_quad = &quad;
_b = b;
}
inline
const basis
basis_on_quadrature::get_basis() const
{
return _b;
}
}// namespace rheolef
#endif // _RHEO_BASIS_ON_LATTICE_H
|