an efficient C++ finite element environment
|
|
Go to the documentation of this file. 1 # ifndef _RHEOLEF_FIELD_H
2 # define _RHEOLEF_FIELD_H
194 #include "rheolef/linalg.h"
195 #include "rheolef/space.h"
196 #include "rheolef/undeterminated.h"
197 #include "rheolef/misc_algo.h"
198 #include "rheolef/quadrature.h"
199 #include "rheolef/integrate_option.h"
216 template <
class Value>
219 is_rheolef_arithmetic<Value>
234 template <
class T,
class M = rheo_default_memory_model>
259 const T& init_value = std::numeric_limits<T>::max());
263 const T& init_value = std::numeric_limits<T>::max());
266 template <
class Expr,
class Sfinae =
267 typename std::enable_if<
279 template <
class Value>
280 typename std::enable_if<
287 template <
class Expr>
288 typename std::enable_if<
302 std::string
name()
const {
return _V.name(); }
305 const std::string&
valued()
const {
return _V.valued(); }
356 idiststream&
get (idiststream& ips);
379 template <
class Expr>
383 const band_basic<T,M>&
gh,
387 template <
class Expr>
392 template <
class Expr>
394 const band_basic<T,M>&
gh,
411 template <
class T,
class M>
414 template <
class T,
class M>
426 template <
class T,
class M>
445 : _blk_dis_iub_iter(),
446 _blk_dis_iub_incr(1),
453 : _blk_dis_iub_iter(blk_dis_iub_iter),
454 _blk_dis_iub_incr(1),
461 : _blk_dis_iub_iter(blk_dis_iub_iter),
462 _blk_dis_iub_incr(blk_dis_iub_incr),
474 bool blk = (*_blk_dis_iub_iter).is_blocked();
475 size_type dis_iub = (*_blk_dis_iub_iter).dis_iub();
476 size_type iub = (!blk) ? dis_iub - _first_iu : dis_iub - _first_ib;
477 return (!blk) ?
_u[iub] :
_b[iub];
479 iterator& operator++ () { _blk_dis_iub_iter += _blk_dis_iub_incr;
return *
this; }
498 template <
class T,
class M>
503 dis_dof_indexes_requires_update();
504 return iterator (_V.data()._idof2blk_dis_iub.begin(), _u.begin(), _b.begin(), _u.ownership().first_index(), _b.ownership().first_index());
506 template <
class T,
class M>
511 dis_dof_indexes_requires_update();
512 return iterator (_V.data()._idof2blk_dis_iub.end(), _u.begin(), _b.begin(), _u.ownership().first_index(), _b.ownership().first_index());
517 template <
class T,
class M>
536 : _blk_dis_iub_iter(),
537 _blk_dis_iub_incr(1),
544 : _blk_dis_iub_iter(blk_dis_iub_iter),
545 _blk_dis_iub_incr(1),
551 : _blk_dis_iub_iter(i._blk_dis_iub_iter),
552 _blk_dis_iub_incr(i._blk_dis_iub_incr),
555 _first_iu(i._first_iu),
556 _first_ib(i._first_ib)
564 bool blk = (*_blk_dis_iub_iter).is_blocked();
565 size_type dis_iub = (*_blk_dis_iub_iter).dis_iub();
566 size_type iub = (!blk) ? dis_iub - _first_iu : dis_iub - _first_ib;
567 return (!blk) ?
_u[iub] :
_b[iub];
569 const_iterator& operator++ () { _blk_dis_iub_iter += _blk_dis_iub_incr;
return *
this; }
587 template <
class T,
class M>
592 dis_dof_indexes_requires_update();
593 return const_iterator (_V.data()._idof2blk_dis_iub.begin(), _u.begin(), _b.begin(), _u.ownership().first_index(), _b.ownership().first_index());
595 template <
class T,
class M>
600 dis_dof_indexes_requires_update();
601 return const_iterator (_V.data()._idof2blk_dis_iub.end(), _u.begin(), _b.begin(), _u.ownership().first_index(), _b.ownership().first_index());
606 template <
class T,
class M>
612 _dis_dof_indexes_requires_update(true),
613 _dis_dof_assembly_requires_update(false)
616 template <
class T,
class M>
628 template <
class T,
class M>
632 _dis_dof_indexes_requires_update =
true;
634 template <
class T,
class M>
638 _dis_dof_assembly_requires_update =
true;
641 template<
class T,
class M>
642 template <
class Value>
644 typename std::enable_if<
650 check_macro (
name() !=
"",
"field=constant : uninitialized field in affectation");
652 dis_dof_indexes_requires_update();
655 template <
class T,
class M>
660 dis_dof_indexes_requires_update();
661 bool blk = _V.is_blocked (idof);
664 size_type iub = dis_iub - _u.ownership().first_index();
667 size_type iub = dis_iub - _b.ownership().first_index();
671 template <
class T,
class M>
676 bool blk = _V.is_blocked (idof);
678 return (!blk) ? _u.dis_at(dis_iub) : _b.dis_at(dis_iub);
680 template <
class T,
class M>
685 T val = std::numeric_limits<T>::max();
687 val = std::min(val, *iter);
689 #ifdef _RHEOLEF_HAVE_MPI
691 val = mpi::all_reduce (comm(), val, mpi::minimum<T>());
693 #endif // _RHEOLEF_HAVE_MPI
696 template <
class T,
class M>
701 T val = std::numeric_limits<T>::min();
703 val = std::max(val, *iter);
705 #ifdef _RHEOLEF_HAVE_MPI
707 val = mpi::all_reduce (comm(), val, mpi::maximum<T>());
709 #endif // _RHEOLEF_HAVE_MPI
712 template <
class T,
class M>
717 T val = std::numeric_limits<T>::max();
719 val = std::min(val, abs(*iter));
721 #ifdef _RHEOLEF_HAVE_MPI
723 val = mpi::all_reduce (comm(), val, mpi::minimum<T>());
725 #endif // _RHEOLEF_HAVE_MPI
728 template <
class T,
class M>
735 val = std::max(val, abs(*iter));
737 #ifdef _RHEOLEF_HAVE_MPI
739 val = mpi::all_reduce (comm(), val, mpi::maximum<T>());
741 #endif // _RHEOLEF_HAVE_MPI
744 template <
class T,
class M>
751 template <
class T,
class M>
std::ptrdiff_t difference_type
const space_type & get_space() const
bool operator!=(const heap_allocator< T1 > &lhs, const heap_allocator< T1 > &rhs)
std::string get_approx() const
vec< T, M >::size_type size_type
std::enable_if< details::is_rheolef_arithmetic< U >::value,ad3_basic< T > & >::type operator+=(ad3_basic< T > &a, const U &b)
const distributor & ownership() const
void assembly(const geo_basic< T, M > &dom, const Expr &expr, const integrate_option &iopt)
const_iterator begin_dof() const
disarray< space_pair_type, M >::const_iterator iter_t
field gh(Float epsilon, Float t, const field &uh, const test &v)
const_iterator(iter_t blk_dis_iub_iter, data_t u, data_t b, size_type first_iu, size_type first_ib)
point_basic< T > dis_vector_evaluate(const point_basic< T > &x) const
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
const communicator & comm() const
const communicator_type & comm() const
base::const_iterator const_iterator
vec< T, M >::size_type size_type
field_basic< Float > field
see the field page for the full documentation
csr< T, sequential > operator*(const T &lambda, const csr< T, sequential > &a)
T evaluate(const geo_element &K, const point_basic< T > &hat_xq, size_type i_comp=0) const
bool _dis_dof_indexes_requires_update
typename float_traits< T >::type float_type
iterator(iter_t blk_dis_iub_iter, size_type blk_dis_iub_incr, data_t u, data_t b, size_type first_iu, size_type first_ib)
see the distributor page for the full documentation
see the band page for the full documentation
see the geo_element page for the full documentation
std::ptrdiff_t difference_type
void dis_idof(const basis_basic< T > &b, const geo_size &gs, const geo_element &K, typename std::vector< size_type >::iterator dis_idof_tab)
void set_increment(size_type incr)
see the vec page for the full documentation
const T & dis_dof(size_type dis_idof) const
void set_increment(size_type incr)
const vec< T, M > & u() const
bool operator==(const heap_allocator< T1 > &lhs, const heap_allocator< T1 > &rhs)
dis_reference dis_dof_entry(size_type dis_idof)
const geo_type & get_geo() const
void resize(const space_type &V, const T &init_value=std::numeric_limits< T >::max())
see the integrate_option page for the full documentation
const_iterator operator++(int)
std::forward_iterator_tag iterator_category
iterator(iter_t blk_dis_iub_iter, data_t u, data_t b, size_type first_iu, size_type first_ib)
void dis_dof_update() const
valued_type valued_tag() const
void dis_dof_assembly_requires_update() const
const_iterator(iterator i)
int constraint_process_rank() const
std::istream & operator>>(std::istream &is, const catchmark &m)
std::forward_iterator_tag iterator_category
This file is part of Rheolef.
size_type dis_size() const
global and local sizes
const typedef T & reference
vec< T, M >::const_iterator data_t
vec< T, M >::iterator data_t
odiststream & put_field(odiststream &ops) const
odiststream: see the diststream page for the full documentation
const typedef T * pointer
see the disarray page for the full documentation
size_type dis_ndof() const
const std::string & valued() const
disarray< space_pair_type, M >::const_iterator iter_t
bool have_homogeneous_space(space_basic< T, M > &Xh) const
std::enable_if< details::is_rheolef_arithmetic< U >::value,ad3_basic< T >>::type operator+(const U &a, const ad3_basic< T > &b)
void assembly_internal(const geo_basic< T, M > &dom, const geo_basic< T, M > &band, const band_basic< T, M > &gh, const Expr &expr, const integrate_option &qopt, bool is_on_band)
size_type _blk_dis_iub_incr
field_basic< Float, sequential > field_sequential
const vec< T, M > & b() const
field::size_type size_type
size_type _blk_dis_iub_incr
field_component< T, M > operator()(size_type i_comp, size_type j_comp)
field_indirect< T, M > operator[](const geo_basic< T, M > &dom)
T dis_evaluate(const point_basic< T > &x, size_type i_comp=0) const
void dis_dof_indexes_requires_update() const
field_basic< T, M > & operator=(const field_basic< T, M > &)
std::ostream & operator<<(std::ostream &os, const catchmark &m)
odiststream & put(odiststream &ops) const
bool _dis_dof_assembly_requires_update
idiststream & get(idiststream &ips)
base::size_type size_type
size_type size(size_type iproc) const
typename vec< T, M >::dis_reference dis_reference