~ubuntu-branches/ubuntu/raring/rheolef/raring-proposed

« back to all changes in this revision

Viewing changes to nfem/plib/form_element.h

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito, Pierre Saramito, Sylvestre Ledru
  • Date: 2012-05-14 14:02:09 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120514140209-dzbdlidkotyflf9e
Tags: 6.1-1
[ Pierre Saramito ]
* New upstream release 6.1 (minor changes):
  - support arbitrarily polynomial order Pk
  - source code supports g++-4.7 (closes: #671996)

[ Sylvestre Ledru ]
* update of the watch file

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "rheolef/scalar_traits.h"
25
25
#include "rheolef/numbering.h"
26
26
#include "rheolef/quadrature.h"
27
 
#include "rheolef/basis_on_lattice.h"
 
27
#include "rheolef/basis_on_pointset.h"
28
28
#include "rheolef/tensor.h"
29
29
#include "rheolef/field.h"
 
30
#include "rheolef/band.h"
30
31
 
31
32
#include <boost/numeric/ublas/matrix.hpp>
32
33
 
37
38
class form_element_rep {
38
39
public:
39
40
// typedefs:
40
 
    typedef geo_element::size_type          size_type;
41
 
    typedef typename scalar_traits<T>::type float_type;
42
 
    typedef point_basic<float_type>         vertex_type;
43
 
    typedef space_basic<float_type,M>       space_type;
44
 
    typedef geo_basic<float_type,M>         geo_type;
45
 
    typedef space_constant::coordinate_type coordinate_type;
 
41
    typedef geo_element::size_type                          size_type;
 
42
    typedef typename scalar_traits<T>::type                 float_type;
 
43
    typedef point_basic<float_type>                         vertex_type;
 
44
    typedef space_basic<float_type,M>                       space_type;
 
45
    typedef geo_basic<float_type,M>                         geo_type;
 
46
    typedef space_constant::coordinate_type                 coordinate_type;
 
47
    typedef typename basis_on_pointset<T>::const_iterator   quad_const_iterator;
 
48
    typedef typename basis_on_pointset<T>::const_iterator_grad quad_const_iterator_grad;
46
49
 
47
50
// allocators:
48
51
 
92
95
    static void cumul_otimes (
93
96
        ublas::matrix<T>& m, 
94
97
        const T& w,
95
 
        basis_on_quadrature::const_iterator phi,
96
 
        basis_on_quadrature::const_iterator last_phi,
97
 
        basis_on_quadrature::const_iterator first_psi,
98
 
        basis_on_quadrature::const_iterator last_psi);
 
98
        quad_const_iterator phi,
 
99
        quad_const_iterator last_phi,
 
100
        quad_const_iterator first_psi,
 
101
        quad_const_iterator last_psi);
99
102
 
100
103
    static void cumul_otimes (
101
104
        ublas::matrix<T>& m,
102
 
        const tensor& Dw,
103
 
        basis_on_quadrature::const_iterator_grad grad_phi,
104
 
        basis_on_quadrature::const_iterator_grad last_grad_phi,
105
 
        basis_on_quadrature::const_iterator_grad first_grad_psi,
106
 
        basis_on_quadrature::const_iterator_grad last_grad_psi,
 
105
        const tensor_basic<T>& Dw,
 
106
        quad_const_iterator_grad grad_phi,
 
107
        quad_const_iterator_grad last_grad_phi,
 
108
        quad_const_iterator_grad first_grad_psi,
 
109
        quad_const_iterator_grad last_grad_psi,
107
110
        size_type map_d);
108
111
 
109
112
// for scalar-weighted forms:
129
132
    bool use_coordinate_system_dual_weight () const
130
133
                { return _use_coordinate_system_dual_weight; }
131
134
 
132
 
#ifdef TODO
133
 
    const basis& get_weight_basis () const;
134
 
    void  weight (const geo_element& K, size_type q, tensor& W) const;
135
 
 
136
 
    const numbering& get_first_numbering() const;
137
 
    const numbering& get_second_numbering() const;
138
 
 
139
 
    const geo&       get_global_geo() const;
140
 
 
141
 
// toolbox for building elementary forms:
142
 
 
143
 
    static void cumul_otimes (
144
 
        ublas::matrix<T>& m, 
145
 
        const T& w,
146
 
        basis_on_quadrature::const_iterator phi,
147
 
        basis_on_quadrature::const_iterator last_phi,
148
 
        basis_on_quadrature::const_iterator_grad first_grad_psi,
149
 
        basis_on_quadrature::const_iterator_grad last_grad_psi);
150
 
    static void cumul_otimes (
151
 
        ublas::matrix<T>& m, 
152
 
        const T& w,
153
 
        basis_on_quadrature::const_iterator phi,
154
 
        basis_on_quadrature::const_iterator last_phi,
155
 
        basis_on_quadrature::const_iterator_hessian first_hessian_psi,
156
 
        basis_on_quadrature::const_iterator_hessian last_hessian_psi);
157
 
    static void cumul_otimes (
158
 
        ublas::matrix<T>& m, 
159
 
        const T& w,
160
 
        basis_on_quadrature::const_iterator_grad grad_phi,
161
 
        basis_on_quadrature::const_iterator_grad last_grad_phi,
162
 
        basis_on_quadrature::const_iterator_grad first_grad_psi,
163
 
        basis_on_quadrature::const_iterator_grad last_grad_psi);
164
 
 
165
 
    void build_general_mass(const geo_element& K, ublas::matrix<T>& m) const;
166
 
    void build_d_ds        (const geo_element& K, ublas::matrix<T>& m) const;
167
 
    void build_d2_ds2      (const geo_element& K, ublas::matrix<T>& m) const;
168
 
    void build_d_ds_d_ds   (const geo_element& K, ublas::matrix<T>& m) const;
169
 
    void build_grad_grad   (const geo_element& K, ublas::matrix<T>& m) const;
170
 
    void build_gradt_grad  (const geo_element& K, ublas::matrix<T>& m) const;
171
 
    void build_div_div     (const geo_element& K, ublas::matrix<T>& m) const;
172
 
    void d_dx              (const geo_element& K, ublas::matrix<T>& m, size_type idx) const;
173
 
 
174
 
#endif // TODO
 
135
// for banded level set method:
 
136
 
 
137
    bool is_on_band() const { return _is_on_band; }
 
138
    void set_band (const band_basic<T,M>& bh) const { _band = bh; _is_on_band = true; }
 
139
    const band_basic<T,M>& get_band() const { return _band; }
175
140
 
176
141
// data:
177
142
protected:
178
 
    space_type             _X;  // also origin      dof numbering
179
 
    space_type             _Y;  // also destination dof numbering
180
 
    geo_type               _omega; // for the access to distributed vertices
 
143
    space_type                     _X;  // also origin      dof numbering
 
144
    space_type                     _Y;  // also destination dof numbering
 
145
    geo_type                       _omega; // for the access to distributed vertices
181
146
 
182
147
    mutable bool                   _initialized;
183
148
    mutable size_type              _n_derivative; // e.g. =2 for grad_grad and =0 for mass
184
 
    mutable quadrature             _quad;
 
149
    mutable quadrature<T>          _quad;
185
150
    mutable quadrature_option_type _qopt;
186
 
    mutable basis_on_quadrature    _bx_table;
187
 
    mutable basis_on_quadrature    _by_table;
188
 
    mutable basis_on_quadrature    _piola_table;
 
151
    mutable basis_on_pointset<T>   _bx_table;
 
152
    mutable basis_on_pointset<T>   _by_table;
 
153
    mutable basis_on_pointset<T>   _piola_table;
189
154
 
190
155
    mutable bool                   _is_weighted;
191
156
    mutable field_basic<T,M>       _wh;
192
 
    mutable basis_on_quadrature    _bw_table;
 
157
    mutable basis_on_pointset<T>   _bw_table;
193
158
    mutable bool                   _use_coordinate_system_weight;
194
159
    mutable bool                   _use_coordinate_system_dual_weight;
195
160
 
 
161
    mutable bool                   _is_on_band;
 
162
    mutable band_basic<T,M>        _band;
 
163
 
196
164
// internal:
197
165
public:
198
166
    // automatically generated implementation in form_element_make.cc :
224
192
   _wh(),
225
193
   _bw_table(),
226
194
   _use_coordinate_system_weight(true),
227
 
   _use_coordinate_system_dual_weight(false)
 
195
   _use_coordinate_system_dual_weight(false),
 
196
   _is_on_band(false),
 
197
   _band()
228
198
{
229
199
}
230
200
template<class T, class M>
248
218
   _wh(),
249
219
   _bw_table(),
250
220
   _use_coordinate_system_weight(true),
251
 
   _use_coordinate_system_dual_weight(false)
 
221
   _use_coordinate_system_dual_weight(false),
 
222
   _is_on_band(false),
 
223
   _band()
252
224
{
253
225
}
254
226
template<class T, class M>
340
312
{
341
313
  return _wh;
342
314
}
343
 
#ifdef TODO
344
 
inline
345
 
const basis&
346
 
form_element_rep::get_weight_basis () const
347
 
{
348
 
  return get_weight().get_space().get_basis();
349
 
}
350
 
inline
351
 
const numbering& 
352
 
form_element_rep::get_first_numbering() const
353
 
{
354
 
  return get_first_space().get_numbering();
355
 
}
356
 
inline
357
 
const numbering& 
358
 
form_element_rep::get_second_numbering() const
359
 
{
360
 
  return get_second_space().get_numbering();
361
 
}
362
 
inline
363
 
void
364
 
form_element_rep::set_use_coordinate_system_weight (bool use) const
365
 
{
366
 
    _use_coordinate_system_weight = use;
367
 
}
368
 
inline
369
 
bool
370
 
form_element_rep::use_coordinate_system_weight () const
371
 
{
372
 
    return _use_coordinate_system_weight;
373
 
}
374
 
inline
375
 
void
376
 
form_element_rep::set_use_coordinate_system_dual_weight (bool use) const
377
 
{
378
 
    _use_coordinate_system_dual_weight = use;
379
 
}
380
 
inline
381
 
bool
382
 
form_element_rep::use_coordinate_system_dual_weight () const
383
 
{
384
 
    return _use_coordinate_system_dual_weight;
385
 
}
386
 
#endif // TODO
387
 
 
388
315
// ----------------------------------------------------------
389
316
// wrapper class
390
317
// ----------------------------------------------------------
455
382
    bool is_weighted() const;
456
383
    const field_basic<T,M>& get_weight () const;
457
384
 
458
 
#ifdef TODO
459
 
    void set_use_coordinate_system_weight(bool use) const;
460
 
#endif // TODO
 
385
// for banded level set method:
 
386
 
 
387
    bool is_on_band() const;
 
388
    const band_basic<T,M>& get_band() const;
 
389
    void set_band (const band_basic<T,M>& bh) const;
 
390
 
461
391
};
462
392
//>form_element:
463
393
// -----------------------------------------------------------
515
445
{
516
446
    return base::data().get_weight();
517
447
}
 
448
template <class T, class M>
 
449
inline
 
450
bool
 
451
form_element<T,M>::is_on_band() const
 
452
{
 
453
    return base::data().is_on_band();
 
454
}
 
455
template <class T, class M>
 
456
inline
 
457
void
 
458
form_element<T,M>::set_band(const band_basic<T,M>& bh) const
 
459
{
 
460
    return base::data().set_band(bh);
 
461
}
 
462
template <class T, class M>
 
463
inline
 
464
const band_basic<T,M>&
 
465
form_element<T,M>::get_band() const
 
466
{
 
467
    return base::data().get_band();
 
468
}
518
469
 
519
470
}// namespace rheolef
520
471
#endif // _RHEOLEF_FORM_ELEMENT_H