2
/// This file is part of Rheolef.
4
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
6
/// Rheolef is free software; you can redistribute it and/or modify
7
/// it under the terms of the GNU General Public License as published by
8
/// the Free Software Foundation; either version 2 of the License, or
9
/// (at your option) any later version.
11
/// Rheolef is distributed in the hope that it will be useful,
12
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
/// GNU General Public License for more details.
16
/// You should have received a copy of the GNU General Public License
17
/// along with Rheolef; if not, write to the Free Software
18
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
/// =========================================================================
21
#include "rheolef/lumped_mass.h"
25
using namespace ublas;
27
// TODO : force trapeze quadrature formulae when using non-constant weight
28
// because quadrature formulae degree is automatically computed
29
// for an exact approximation !!
30
// Actually, the lumped weighted matrix does not coincide with
31
// the local mass matrix with trapeze quadrature formulae
33
template<class T, class M>
35
lumped_mass<T,M>::operator() (const geo_element& K, ublas::matrix<T>& lumped_m) const
37
build_general_mass (K, lumped_m);
38
check_macro (lumped_m.size1() == lumped_m.size2(),
39
"lumped_mass: incompatible `" << base::get_first_basis().name()
40
<< "' and `" << base::get_second_basis().name() << "' basis");
41
size_type n = lumped_m.size1();
42
for (size_type i = 0; i < n; i++) {
44
for (size_type j = 0; j < n; j++) {
53
template<class T, class M>
55
lumped_mass<T,M>::initialize () const
57
check_macro (base::get_first_space().size() == base::get_second_space().size(),
58
"incompatible spaces for the `lumped_mass' form.");
59
check_macro (base::get_first_basis().name() == base::get_second_basis().name(),
60
"incompatible approximations for the `lumped_mass' form.");
61
std::string approx = base::get_first_basis().name();
62
check_macro ("P0" == approx || "P1" == approx || "P1d" == approx,
63
"unsupported `"<<approx<<"' approximation space for `lumped_mass' form");
64
if (base::is_weighted()) {
65
space_constant::valued_type weight_valued = base::_wh.valued_tag();
66
check_macro (weight_valued == space_constant::scalar,
67
"unsupported non-scalar weight for `lumped_mass' form");
69
base::set_n_derivative(0);
71
// ----------------------------------------------------------------------------
72
// instanciation in library
73
// ----------------------------------------------------------------------------
74
template class lumped_mass<Float,sequential>;
75
#ifdef _RHEOLEF_HAVE_MPI
76
template class lumped_mass<Float,distributed>;
77
#endif // _RHEOLEF_HAVE_MPI
79
} // namespace rheolef