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/element.h"
22
#include "rheolef/basis_on_lattice.h"
27
element_rep<T>::element_rep (std::string name, std::string numb)
28
: _name((numb != "") ? numb : name),
30
_numb( ((numb != "") ? numb : name) + "_numbering"),
34
_tr_p1_value.set (_b, _tr_p1);
36
// ----------------------------------------------------------------------------
37
// node associated to a dof: local (K,loc_idof) argument
38
// ----------------------------------------------------------------------------
42
element_rep<T>::x_dof (const geo_element& K, size_type loc_idof, const geo_basic<T,M>& omega) const
44
// TODO: only P1 transformation supported : isoparametric not yet !
45
warning_macro ("x_dof("<<name()<<") on K"<< K.dis_ie());
46
basis_on_nodal_basis::const_iterator first = _tr_p1_value.begin(K,loc_idof);
47
basis_on_nodal_basis::const_iterator last = _tr_p1_value.end (K,loc_idof);
49
size_type dim = omega.dimension();
50
for (size_type k = 0; first != last; first++, k++) {
51
const point& ak = omega.vertex (K[k]);
53
warning_macro ("coef["<<k<<"]="<<ck);
54
for (size_type i = 0; i < dim; i++) {
60
// ----------------------------------------------------------------------------
61
// node associated to a dof: "idof" argument
62
// ----------------------------------------------------------------------------
66
element_rep<T>::x_dof (size_type idof, const geo_basic<T,M>& omega) const
69
return omega.vertex (idof);
70
} else if (name() == "P0") {
71
const geo_element& K = omega[idof];
73
for (size_type iloc = 0, nloc = K.size(); iloc < nloc; iloc++) {
74
x += omega.dis_vertex (K[iloc]);
77
warning_macro ("x_dof = " << x);
79
} else if (name() == "P1d") {
80
size_type nvert_per_elt;
81
switch (omega.map_dimension()) {
91
if (omega.dis_size_by_variant()[reference_element::t] != 0) {
100
if (omega.dis_size_by_variant()[reference_element::T] != 0) {
102
} else if (omega.dis_size_by_variant()[reference_element::P] != 0) {
109
// TODO: extend P1d mixed (t,q) or (T,P,H) meshes: nvert_per_elt is no more constant
110
size_type ie = idof/nvert_per_elt;
111
size_type iloc = idof - ie*nvert_per_elt;
112
const geo_element& K = omega[ie];
113
size_type dis_iv = K[iloc];
114
const basic_point<T>& x = omega.dis_vertex(dis_iv);
118
error_macro ("unsupported x_dof for \""<<name()<<"\" element");
119
return basic_point<T>();
122
// ----------------------------------------------------------------------------
123
// instanciation in library
124
// ----------------------------------------------------------------------------
125
template class element<Float>;
126
template class element_rep<Float>;
127
template class lagrange<Float>;
130
basic_point<Float> element_rep<Float>::x_dof (const geo_element& K, size_type loc_idof, const geo_basic<Float,sequential>& omeqa) const;
132
basic_point<Float> element_rep<Float>::x_dof (size_type idof, const geo_basic<Float,sequential>& omeqa) const;
134
#ifdef _RHEOLEF_HAVE_MPI
136
basic_point<Float> element_rep<Float>::x_dof (const geo_element& K, size_type loc_idof, const geo_basic<Float,distributed>& omeqa) const;
138
basic_point<Float> element_rep<Float>::x_dof (size_type idof, const geo_basic<Float,distributed>& omeqa) const;
139
#endif // _RHEOLEF_HAVE_MPI
141
} // namespace rheolef