Rheolef  7.1
an efficient C++ finite element environment
round.h
Go to the documentation of this file.
1 #ifndef _RHEOLEF_ROUND_H
2 #define _RHEOLEF_ROUND_H
23 #include "rheolef/rounder.h"
24 #include "rheolef/field_expr.h"
25 
26 namespace rheolef {
27 
28 template<class Expr, class T2>
29 typename
30 std::enable_if<
31  details::is_field_expr_affine_homogeneous<Expr>::value
32  ,field_basic<
33  typename Expr::scalar_type
34  ,typename Expr::memory_type
35  >
36 >::type
38  const Expr& expr,
39  const T2& prec)
40 {
41  typedef typename Expr::scalar_type T;
42  typedef typename Expr::memory_type M;
44  check_macro (expr.have_homogeneous_space (Xh),
45  "round(field_expr, prec): field_expr should have homogeneous space. HINT: use round(interpolate(Xh, field_expr), prec)");
46  field_basic<T,M> uh = expr; // create a tmp because expr has no expr.end_dof()
47  field_basic<T,M> vh (Xh);
48  std::transform (uh.begin_dof(), uh.end_dof(), vh.begin_dof(), rounder(prec));
49  return vh;
50 }
51 
52 }//namespace rheolef
53 #endif // _RHEOLEF_ROUND_H
iterator begin_dof()
Definition: field.h:501
iterator end_dof()
Definition: field.h:509
rheolef::std type
Expr1::float_type T
Definition: field_expr.h:261
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
This file is part of Rheolef.
rounder_type< T > rounder(const T &prec)
Definition: rounder.h:60
std::enable_if< details::is_field_expr_affine_homogeneous< Expr >::value,field_basic< typename Expr::scalar_type,typename Expr::memory_type >>::type round(const Expr &expr, const T2 &prec)
Definition: round.h:37
Expr1::memory_type M
Definition: vec_expr_v2.h:416