Rheolef  7.1
an efficient C++ finite element environment
field_expr_recursive.h
Go to the documentation of this file.
1 #ifndef _RHEOLEF_FIELD_EXPR_RECURSIVE_H
2 #define _RHEOLEF_FIELD_EXPR_RECURSIVE_H
3 //
24 // field-valued nonlinear expressions, as:
25 //
26 // field wh = interpolate (Xh, 1/uh - uh*(1-vh)):
27 // Float Ih = integrate (omega, 1/uh - uh*(1-vh), qopt):
28 //
29 // author: Pierre.Saramito@imag.fr
30 //
31 // date: 15 september 2015
32 //
33 // Notes; use template expressions and SFINAE techiques
34 // The interpolation operator is required, as in
35 // 1/uh and uh*vh that do not belong to Xh when uh, vh in Xh
36 //
37 // SUMMARY:
38 // 1. unary operations
39 // 1.1. unary node
40 // 1.2. unary calls
41 // 1.3. unary compose
42 // 2. binary operations
43 // 2.1. binary node
44 // 2.2. binary calls
45 // 2.3. binary compose
46 //
47 #include "rheolef/field_expr_terminal.h"
48 
49 namespace rheolef {
50 
51 // -------------------------------------------
52 // 1. unary operations
53 // -------------------------------------------
54 // 1.1. unary node
55 // -------------------------------------------
56 namespace details {
57 
58 template<class UnaryFunction, class Expr>
60 public:
61 // typedefs:
62 
64  using memory_type = typename Expr::memory_type;
65  using result_type = typename details::generic_unary_traits<UnaryFunction>::template result_hint<typename Expr::result_type>::type;
70 
71 // alocators:
72 
73  field_expr_v2_nonlinear_node_unary (const UnaryFunction& f, const Expr& expr);
74 
75 // --------------------------------------------
76 // accessors for the affine & homogeneous case:
77 // --------------------------------------------
78 
80  = and_type<
81  or_type<
82  std::is_same<UnaryFunction,details::unary_plus>
83  ,std::is_same<UnaryFunction,details::negate>
84  ,std::is_same<UnaryFunction,details::binder_first <details::plus, scalar_type>>
85  ,std::is_same<UnaryFunction,details::binder_second<details::plus, scalar_type>>
86  ,std::is_same<UnaryFunction,details::binder_first <details::minus, scalar_type>>
87  ,std::is_same<UnaryFunction,details::binder_second<details::minus, scalar_type>>
88  ,std::is_same<UnaryFunction,details::binder_first <details::multiplies,scalar_type>>
89  ,std::is_same<UnaryFunction,details::binder_second<details::multiplies,scalar_type>>
90  ,std::is_same<UnaryFunction,details::binder_second<details::divides, scalar_type>>
91  >
93  >;
94 
96  return is_affine_homogeneous::value
97  && _expr.have_homogeneous_space (Vh);
98  }
99  // minimal forward iterator interface:
100  struct const_iterator {
101  using iterator_category = std::forward_iterator_tag;
102  using value_type = typename Expr::scalar_type;
104  using pointer = value_type*;
105  using difference_type = std::ptrdiff_t;
106  const_iterator (UnaryFunction f, typename Expr::const_iterator expr_iter)
107  : _f(f), _expr_iter (expr_iter) {}
108  const_iterator& operator++ () { ++_expr_iter; return *this; }
109  value_type operator* () const { return _f (*_expr_iter); }
110  protected:
111  const UnaryFunction _f;
112  typename Expr::const_iterator _expr_iter;
113  };
114  const_iterator begin_dof() const { return const_iterator (_f, _expr.begin_dof()); }
115 
116 // --------------------------------------------
117 // interface for the general nonlinear case:
118 // --------------------------------------------
119 // accessors:
120 
122  const Expr& expr() const { return _expr; }
123 
126  }
127 
128 // initializators:
129 
130  void initialize (
131  const piola_on_pointset<float_type>& pops,
132  const integrate_option& iopt) const
133  { _expr.initialize (pops, iopt); }
134 
135  void initialize (
137  const piola_on_pointset<float_type>& pops,
138  const integrate_option& iopt) const
139  { _expr.initialize (Xh, pops, iopt); }
140 
141 // -------------------------
142 // run time check args types
143 // -------------------------
144  template<class Result, class Arg, class Status>
146  template<class M>
148  const self_type& obj,
149  const geo_basic<float_type,M>& omega_K,
150  const geo_element& K,
151  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
152  {
153  fatal_macro ("invalid type resolution: Result="<<typename_macro(Result)
154  << ", Arg="<<typename_macro(Arg)
155  << ", UnaryFunction="<<typename_macro(UnaryFunction));
156  }
157  template<class M>
159  const self_type& obj,
160  const geo_basic<float_type,M>& omega_K,
161  const geo_element& K,
162  const side_information_type& sid,
163  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
164  {
165  fatal_macro ("invalid type resolution: Result="<<typename_macro(Result)
166  << ", Arg="<<typename_macro(Arg)
167  << ", UnaryFunction="<<typename_macro(UnaryFunction));
168  }
169  };
170  template<class Result, class Arg>
171  struct evaluate_call_check<Result,Arg,std::true_type> {
172  // in an element:
173  template<class M>
175  const self_type& obj,
176  const geo_basic<float_type,M>& omega_K,
177  const geo_element& K,
178  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
179  {
180  Eigen::Matrix<Arg,Eigen::Dynamic,1> value1;
181  obj._expr.evaluate (omega_K, K, value1);
182  value.resize(value1.size());
183  for (size_type i = 0, ni = value.rows(); i < ni; ++i) {
184  value[i] = obj._f (value1[i]);
185  }
186  }
187  // on a side:
188  template<class M>
190  const self_type& obj,
191  const geo_basic<float_type,M>& omega_K,
192  const geo_element& K,
193  const side_information_type& sid,
194  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
195  {
196  Eigen::Matrix<Arg,Eigen::Dynamic,1> value1;
197  obj._expr.evaluate_on_side (omega_K, K, sid, value1);
198  value.resize (value1.size());
199  for (size_type i = 0, ni = value.rows(); i < ni; ++i) {
200  value[i] = obj._f (value1[i]);
201  }
202  }
203  };
204 // -------------------------------------------
205 // evaluate in an element, with known arg type
206 // -------------------------------------------
207  template<class Result, class Arg, class M>
209  const geo_basic<float_type,M>& omega_K,
210  const geo_element& K,
211  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
212  {
213  typedef typename details::generic_unary_traits<UnaryFunction>::template hint<Arg,Result>::result_type result_type;
214  typedef typename details::and_type<
217  >::type
218  status_t;
220  eval (*this, omega_K, K, value);
221  }
222 // -------------------------------------------
223 // evaluate on a side, with known arg type
224 // -------------------------------------------
225  template<class Result, class Arg, class M>
227  const geo_basic<float_type,M>& omega_K,
228  const geo_element& K,
229  const side_information_type& sid,
230  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
231  {
232  typedef typename details::generic_unary_traits<UnaryFunction>::template hint<Arg,Result>::result_type result_type;
233  typedef typename details::and_type<
236  >::type
237  status_t;
239  eval (*this, omega_K, K, sid, value);
240  }
241 // -------------------------------------------
242 // determine args at compile-time or run-time:
243 // -------------------------------------------
244  template<class This, class Result, class Arg, space_constant::valued_type ArgTag = space_constant::valued_tag_traits<Arg>::value>
245  struct evaluate_switch {};
246 
247  // when arg is unknown at run-time:
248  template<class This, class Result, class Arg>
249  struct evaluate_switch<This, Result, Arg, space_constant::last_valued> {
250  template<class M>
251  void evaluate (
252  const This& obj,
253  const geo_basic<float_type,M>& omega_K,
254  const geo_element& K,
255  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
256  {
257  typedef typename scalar_traits<Arg>::type T;
258  space_constant::valued_type arg_valued_tag = obj._expr.valued_tag();
259  switch (arg_valued_tag) {
261  obj.template evaluate_call<Result,T,M> (omega_K, K, value); break;
263  obj.template evaluate_call<Result, point_basic<T> > (omega_K, K, value); break;
266  obj.template evaluate_call<Result, tensor_basic<T> > (omega_K, K, value); break;
267  default: { error_macro ("unexpected valued tag="<<arg_valued_tag); }
268  }
269  }
270  template<class M>
272  const This& obj,
273  const geo_basic<float_type,M>& omega_K,
274  const geo_element& K,
275  const side_information_type& sid,
276  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
277  {
278  typedef typename scalar_traits<Arg>::type T;
279  space_constant::valued_type arg_valued_tag = obj._expr.valued_tag();
280  switch (arg_valued_tag) {
282  obj.template evaluate_call<Result,T> (omega_K, K, sid, value); break;
284  obj.template evaluate_call<Result, point_basic<T> > (omega_K, K, value); break;
287  obj.template evaluate_call<Result, tensor_basic<T> > (omega_K, K, value); break;
288  default: { error_macro ("unexpected valued tag="<<arg_valued_tag); }
289  }
290  }
291  };
292  // specializations when arg is known at compile-time:
293 #define _RHEOLEF_evaluate_switch_specialization(VALUED,VALUE) \
294  template<class This, class Result, class Arg> \
295  struct evaluate_switch <This, Result, Arg, VALUED> { \
296  typedef typename scalar_traits<Arg>::type T; \
297  typedef typename float_traits<Arg>::type float_type; \
298  \
299  void evaluate ( \
300  const This& obj, \
301  const geo_basic<float_type,memory_type>& omega_K, \
302  const geo_element& K, \
303  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const \
304  { obj.template evaluate_call<Result, VALUE> (omega_K, K, value); } \
305  \
306  template<class M> \
307  void evaluate_on_side ( \
308  const This& obj, \
309  const geo_basic<float_type,M>& omega_K, \
310  const geo_element& K, \
311  const side_information_type& sid, \
312  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const \
313  { obj.template evaluate_call<Result, VALUE> (omega_K, K, sid, value); } \
314  }; \
315 
321 #undef _RHEOLEF_evaluate_switch_specialization
322 
323 // ----------------------
324 // evaluate in an element
325 // ----------------------
326  template<class Result>
327  void
328  evaluate (
329  const geo_basic<float_type,memory_type>& omega_K,
330  const geo_element& K,
331  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
332  {
333  typedef field_expr_v2_nonlinear_node_unary<UnaryFunction, Expr> This;
334  typedef typename details::generic_unary_traits<UnaryFunction>::template hint<typename Expr::value_type,Result>::argument_type
335  A1;
336  evaluate_switch <This, Result, A1> helper;
337  helper.evaluate (*this, omega_K, K, value);
338  }
339 // -------------------
340 // evaluate on a side:
341 // -------------------
342  template<class Result>
343  void
345  const geo_basic<float_type,memory_type>& omega_K,
346  const geo_element& K,
347  const side_information_type& sid,
348  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
349  {
350  typedef field_expr_v2_nonlinear_node_unary<UnaryFunction, Expr> This;
351  typedef typename details::generic_unary_traits<UnaryFunction>::template hint<typename Expr::value_type,Result>::argument_type
352  A1;
353  evaluate_switch <This, Result, A1> helper;
354  helper.evaluate_on_side (*this, omega_K, K, sid, value);
355  }
356 
357  template<class Result>
358  bool valued_check() const {
359  typedef typename details::generic_unary_traits<UnaryFunction>::template hint<typename Expr::value_type,Result>::argument_type
360  A1;
361  if (! is_undeterminated<A1>::value) return _expr.template valued_check<A1>();
362  return true;
363  }
364 protected:
365 // data:
366  UnaryFunction _f;
367  Expr _expr;
368 // working area:
369 public:
370  mutable std::array<
371  Eigen::Matrix<scalar_type,Eigen::Dynamic,1>
373  mutable std::array<
374  Eigen::Matrix<point_basic<scalar_type>,Eigen::Dynamic,1>
376  mutable std::array<
377  Eigen::Matrix<tensor_basic<scalar_type>,Eigen::Dynamic,1>
379  mutable std::array<
380  Eigen::Matrix<tensor3_basic<scalar_type>,Eigen::Dynamic,1>
382  mutable std::array<
383  Eigen::Matrix<tensor4_basic<scalar_type>,Eigen::Dynamic,1>
385 };
386 
387 template<class UnaryFunction, class Expr>
389  const UnaryFunction& f,
390  const Expr& expr)
391  : _f(f),
392  _expr(expr),
393  _scalar_val(),
394  _vector_val(),
395  _tensor_val(),
396  _tensor3_val(),
397  _tensor4_val()
398 {
399 }
400 
401 template<class F, class Expr> struct is_field_expr_v2_nonlinear_arg <field_expr_v2_nonlinear_node_unary<F,Expr>> : std::true_type {};
402 template<class F, class Expr> struct is_field_expr_affine_homogeneous<field_expr_v2_nonlinear_node_unary<F,Expr>, typename std::enable_if<
403  field_expr_v2_nonlinear_node_unary<F,Expr>::is_affine_homogeneous::value>::type>: std::true_type {};
404 
405 } // namespace details
406 // -------------------------------------------
407 // 1.2. unary calls
408 // -------------------------------------------
409 // unary operators +- and std::math
410 
411 #define _RHEOLEF_make_field_expr_v2_nonlinear_unary_operator(FUNCTION,FUNCTOR) \
412 template<class Expr> \
413 inline \
414 typename \
415 std::enable_if< \
416  details::is_field_expr_v2_nonlinear_arg<Expr>::value \
417  && ! details::is_field_expr_v2_constant <Expr>::value \
418  ,details::field_expr_v2_nonlinear_node_unary< \
419  FUNCTOR \
420  ,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type \
421  > \
422 >::type \
423 FUNCTION (const Expr& expr) \
424 { \
425  typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type wrap_t; \
426  return details::field_expr_v2_nonlinear_node_unary <FUNCTOR,wrap_t> (FUNCTOR(), wrap_t(expr)); \
427 }
428 
429 #define _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(FUNCTION) \
430  _RHEOLEF_make_field_expr_v2_nonlinear_unary_operator(FUNCTION, details::FUNCTION##_)
431 
432 // standard unary operators
435 // std::cmath
453 // rheolef extensions
457 
458 // tr(sigma_h) & trans(sigma_h) : trace & transpose of a tensor-valued field
461 
462 #undef _RHEOLEF_make_field_expr_v2_nonlinear_unary_function
463 #undef _RHEOLEF_make_field_expr_v2_nonlinear_unary_operator
464 
465 // -------------------------------------------
466 // 1.3. unary compose
467 // -------------------------------------------
468 
469 template<class Function, class Expr>
470 inline
471 typename
472 std::enable_if<
477  >
478 >::type
479 compose (const Function& f, const Expr& expr)
480 {
484 }
485 // ---------------------------------------------------------------------------
486 // 2. binary operations
487 // ---------------------------------------------------------------------------
488 // 2.1. binary node
489 // -------------------------------------------
490 namespace details {
491 
492 template<class BinaryFunction, class Expr1, class Expr2>
494 public:
495 // typedefs:
496 
498  using result_type = typename details::generic_binary_traits<BinaryFunction>::template result_hint<typename Expr1::result_type,typename Expr2::result_type>::type;
502  using memory_type = typename Expr1::memory_type;
503 
504 // alocators:
505 
507  const BinaryFunction& f,
508  const Expr1& expr1,
509  const Expr2& expr2);
510 
511 // --------------------------------------------
512 // accessors for the affine & homogeneous case:
513 // --------------------------------------------
514 
515  // the result expr is affine-homogeneous if and only if:
516  // binop expr1 expr2
517  // +- A|C A|C
518  // */ A C
519  // * C A
521  = or_type<
522  and_type<
523  or_type<
524  std::is_same<BinaryFunction,details::plus>
525  ,std::is_same<BinaryFunction,details::minus>
526  >
527  ,is_field_expr_affine_homogeneous<Expr1>
528  ,is_field_expr_affine_homogeneous<Expr2>
529  >
530  ,and_type<
531  or_type<
532  std::is_same<BinaryFunction,details::multiplies>
533  ,std::is_same<BinaryFunction,details::divides>
534  >
535  ,is_field_expr_affine_homogeneous<Expr1>
536  ,is_field_expr_v2_constant <Expr2>
537  >
538  ,and_type<
539  std::is_same<BinaryFunction,details::multiplies>
540  ,is_field_expr_v2_constant <Expr1>
541  ,is_field_expr_affine_homogeneous<Expr2>
542  >
543  >;
546  return is_affine_homogeneous::value
547  && _expr1.have_homogeneous_space (Vh)
548  && _expr2.have_homogeneous_space (Vh2)
549  && Vh.name() == Vh2.name();
550  }
551  // minimal forward iterator interface:
552  struct const_iterator {
553  using iterator_category = std::forward_iterator_tag;
554  using value_type = typename promote<
555  typename Expr1::scalar_type,
556  typename Expr2::scalar_type>::type;
558  using pointer = value_type*;
559  using difference_type = std::ptrdiff_t;
560  const_iterator (const BinaryFunction& f, typename Expr1::const_iterator iter1, typename Expr2::const_iterator iter2)
561  : _f(f), _iter1 (iter1), _iter2 (iter2) {}
562  const_iterator& operator++ () { ++_iter1; ++_iter2; return *this; }
563  value_type operator* () const { return _f (*_iter1, *_iter2); }
564  protected:
566  typename Expr1::const_iterator _iter1;
567  typename Expr2::const_iterator _iter2;
568  };
569  const_iterator begin_dof() const { return const_iterator (_f, _expr1.begin_dof(), _expr2.begin_dof()); }
570 
571 // --------------------------------------------
572 // interface for the general nonlinear case:
573 // --------------------------------------------
574 
575 // accessors:
576 
578 
581  }
582 
583 // initializers:
584 
585  void initialize (
586  const piola_on_pointset<float_type>& pops,
587  const integrate_option& iopt) const
588  {
589  _expr1.initialize (pops, iopt);
590  _expr2.initialize (pops, iopt);
591  }
592  void initialize (
594  const piola_on_pointset<float_type>& pops,
595  const integrate_option& iopt) const
596  {
597  _expr1.initialize (Xh, pops, iopt);
598  _expr2.initialize (Xh, pops, iopt);
599  }
600 
601 // evaluators:
602 
603  template<class Result, class Arg1, class Arg2, class M>
605  const geo_basic<float_type,M>& omega_K,
606  const geo_element& K,
607  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
608  {
609  Eigen::Matrix<Arg1,Eigen::Dynamic,1> value1; _expr1.evaluate (omega_K, K, value1);
610  Eigen::Matrix<Arg2,Eigen::Dynamic,1> value2; _expr2.evaluate (omega_K, K, value2);
611  value.resize (value1.size());
612  // TODO: DVT_EIGEN_BLAS1
613  for (size_t i = 0, ni = value.rows(); i < ni; ++i) {
614  value[i] = _f (value1[i], value2[i]);
615  }
616  }
617  template<class Result, class Arg1, class Arg2, class M>
619  const geo_basic<float_type,M>& omega_K,
620  const geo_element& K,
621  const side_information_type& sid,
622  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
623  {
624  Eigen::Matrix<Arg1,Eigen::Dynamic,1> value1; _expr1.evaluate_on_side (omega_K, K, sid, value1);
625  Eigen::Matrix<Arg2,Eigen::Dynamic,1> value2; _expr2.evaluate_on_side (omega_K, K, sid, value2);
626  value.resize (value1.size());
627  for (size_t i = 0, ni = value.rows(); i < ni; ++i) {
628  value[i] = _f (value1[i], value2[i]);
629  }
630  }
631  template<class This, class Result, class ReturnType, class Arg1, class Arg2>
632  struct evaluate_internal {
633  template<class M>
634  void operator() (
635  const This& obj,
636  const geo_basic<float_type,M>& omega_K,
637  const geo_element& K,
638  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
639  {
640  fatal_macro ("unexpected return type "
641  << pretty_typename_macro(ReturnType) << ": "
642  << pretty_typename_macro(Result) << " was expected for function "
643  << pretty_typename_macro(BinaryFunction) << "("
644  << pretty_typename_macro(Arg1) << ","
645  << pretty_typename_macro(Arg2) << ")");
646  }
647  template<class M>
648  void operator() (
649  const This& obj,
650  const geo_basic<float_type,M>& omega_K,
651  const geo_element& K,
652  const side_information_type& sid,
653  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
654  {
655  fatal_macro ("unexpected return type "
656  << pretty_typename_macro(ReturnType) << ": "
657  << pretty_typename_macro(Result) << " was expected for function "
658  << pretty_typename_macro(BinaryFunction) << "("
659  << pretty_typename_macro(Arg1) << ","
660  << pretty_typename_macro(Arg2) << ")");
661  }
662  };
663  template<class This, class Result, class Arg1, class Arg2>
664  struct evaluate_internal<This,Result,Result,Arg1,Arg2> {
665  template<class M>
666  void operator() (
667  const This& obj,
668  const geo_basic<float_type,M>& omega_K,
669  const geo_element& K,
670  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
671  { obj.template evaluate_internal2<Result,Arg1,Arg2,M> (omega_K, K, value); }
672 
673  template<class M>
674  void operator() (
675  const This& obj,
676  const geo_basic<float_type,M>& omega_K,
677  const geo_element& K,
678  const side_information_type& sid,
679  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
680  { obj.template evaluate_internal2 <Result,Arg1,Arg2,M> (omega_K, K, sid, value);
681  }
682  };
683  template<class Result, class Arg1, class Arg2, class M>
685  const geo_basic<float_type,M>& omega_K,
686  const geo_element& K,
687  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
688  {
689  typedef typename details::generic_binary_traits<BinaryFunction>::template result_hint<Arg1,Arg2>::type ReturnType;
690  typedef field_expr_v2_nonlinear_node_binary<BinaryFunction, Expr1, Expr2> This;
691  evaluate_internal<This,Result,ReturnType,Arg1,Arg2> eval_int;
692  eval_int (*this, omega_K, K, value);
693  }
694  template<class Result, class Arg1, class Arg2, class M>
696  const geo_basic<float_type,M>& omega_K,
697  const geo_element& K,
698  const side_information_type& sid,
699  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
700  {
701  typedef typename details::generic_binary_traits<BinaryFunction>::template result_hint<Arg1,Arg2>::type ReturnType;
702  typedef field_expr_v2_nonlinear_node_binary<BinaryFunction, Expr1, Expr2> This;
703  evaluate_internal<This,Result,ReturnType,Arg1,Arg2> eval_int;
704  eval_int (*this, omega_K, K, sid, value);
705  }
706  // when both args are defined at compile time:
707  template<class This, class Result,
708  class Arg1, space_constant::valued_type Arg1Tag,
709  class Arg2, space_constant::valued_type Arg2Tag>
711  template<class M>
712  void operator() (
713  const This& obj,
714  const geo_basic<float_type,M>& omega_K,
715  const geo_element& K,
716  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
717  { obj.template evaluate_call<Result, Arg1, Arg2> (omega_K, K, value); }
718 
719  template<class M>
720  void operator() (
721  const This& obj,
722  const geo_basic<float_type,M>& omega_K,
723  const geo_element& K,
724  const side_information_type& sid,
725  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
726  { obj.template evaluate_call<Result, Arg1, Arg2> (omega_K, K, sid, value); }
727  };
728  // specialization when both args are undefined at compile time:
729  template<class This, class Result,
730  class Arg1,
731  class Arg2>
732  struct evaluate_switch<This, Result,
733  Arg1, space_constant::last_valued,
735  template<class M>
736  void operator() (
737  const This& obj,
738  const geo_basic<float_type,M>& omega_K,
739  const geo_element& K,
740  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
741  {
742  typedef typename scalar_traits<Arg1>::type T1;
743  typedef typename scalar_traits<Arg2>::type T2;
744  space_constant::valued_type arg1_valued_tag = obj._expr1.valued_tag();
745  space_constant::valued_type arg2_valued_tag = obj._expr2.valued_tag();
746  switch (arg1_valued_tag) {
747  case space_constant::scalar: {
748  switch (arg2_valued_tag) {
750  return obj.template evaluate_call<Result, T1, T2> (omega_K, K, value); break;
752  return obj.template evaluate_call<Result, T1, point_basic<T2> > (omega_K, K, value); break;
755  return obj.template evaluate_call<Result, T1, tensor_basic<T2> > (omega_K, K, value); break;
757  return obj.template evaluate_call<Result, T1, tensor3_basic<T2> >(omega_K, K, value); break;
758  default: error_macro ("unexpected second argument valued tag="<<arg2_valued_tag);
759  }
760  break;
761  }
762  case space_constant::vector: {
763  switch (arg2_valued_tag) {
765  return obj.template evaluate_call<Result, point_basic<T1>, T2> (omega_K, K, value); break;
767  return obj.template evaluate_call<Result, point_basic<T1>, point_basic<T2> > (omega_K, K, value); break;
770  return obj.template evaluate_call<Result, point_basic<T1>, tensor_basic<T2> > (omega_K, K, value); break;
772  return obj.template evaluate_call<Result, point_basic<T1>, tensor3_basic<T2> >(omega_K, K, value); break;
773  default: error_macro ("unexpected second argument valued tag="<<arg2_valued_tag);
774  }
775  break;
776  }
779  switch (arg2_valued_tag) {
781  return obj.template evaluate_call<Result, tensor_basic<T1>, T2> (omega_K, K, value); break;
783  return obj.template evaluate_call<Result, tensor_basic<T1>, point_basic<T2> > (omega_K, K, value); break;
786  return obj.template evaluate_call<Result, tensor_basic<T1>, tensor_basic<T2> > (omega_K, K, value); break;
788  return obj.template evaluate_call<Result, tensor_basic<T1>, tensor3_basic<T2> >(omega_K, K, value); break;
789  default: error_macro ("unexpected second argument valued tag="<<arg2_valued_tag);
790  }
791  break;
792  }
794  switch (arg2_valued_tag) {
796  return obj.template evaluate_call<Result, tensor3_basic<T1>, T2> (omega_K, K, value); break;
798  return obj.template evaluate_call<Result, tensor3_basic<T1>, point_basic<T2> > (omega_K, K, value); break;
801  return obj.template evaluate_call<Result, tensor3_basic<T1>, tensor_basic<T2> > (omega_K, K, value); break;
803  return obj.template evaluate_call<Result, tensor3_basic<T1>, tensor3_basic<T2> >(omega_K, K, value); break;
804  default: error_macro ("unexpected second argument valued tag="<<arg2_valued_tag);
805  }
806  break;
807  }
808  default: error_macro ("unexpected first argument valued tag="<<arg1_valued_tag);
809  }
810  }
811  };
812  // specialization when only first arg is defined at compile time:
813  template<class This, class Result,
814  class Arg1, space_constant::valued_type Arg1Tag,
815  class Arg2>
816  struct evaluate_switch<This, Result,
817  Arg1, Arg1Tag,
818  Arg2, space_constant::last_valued> {
819  template<class M>
820  void operator() (
821  const This& obj,
822  const geo_basic<float_type,M>& omega_K,
823  const geo_element& K,
824  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
825  {
826  typedef typename scalar_traits<Arg2>::type T2;
827  space_constant::valued_type arg2_valued_tag = obj._expr2.valued_tag();
828  switch (arg2_valued_tag) {
830  return obj.template evaluate_call<Result, Arg1, T2> (omega_K, K, value); break;
832  return obj.template evaluate_call<Result, Arg1, point_basic<T2> > (omega_K, K, value); break;
835  return obj.template evaluate_call<Result, Arg1, tensor_basic<T2> > (omega_K, K, value); break;
837  return obj.template evaluate_call<Result, Arg1, tensor3_basic<T2> > (omega_K, K, value); break;
838  default: error_macro ("unexpected second argument valued tag="<<arg2_valued_tag);
839  }
840  }
841  };
842  // specialization when only second arg is defined at compile time:
843  template<class This, class Result,
844  class Arg1,
845  class Arg2, space_constant::valued_type Arg2Tag>
846  struct evaluate_switch<This, Result,
847  Arg1, space_constant::last_valued,
848  Arg2, Arg2Tag> {
849  template<class M>
850  void operator() (
851  const This& obj,
852  const geo_basic<float_type,M>& omega_K,
853  const geo_element& K,
854  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
855  {
856  typedef typename scalar_traits<Arg1>::type T1;
857  space_constant::valued_type arg1_valued_tag = obj._expr1.valued_tag();
858  switch (arg1_valued_tag) {
860  return obj.template evaluate_call<Result, T1, Arg2> (omega_K, K, value); break;
862  return obj.template evaluate_call<Result, point_basic<T1>, Arg2> (omega_K, K, value); break;
865  return obj.template evaluate_call<Result, tensor_basic<T1>, Arg2> (omega_K, K, value); break;
867  return obj.template evaluate_call<Result, tensor3_basic<T1>, Arg2>(omega_K, K, value); break;
868  default: error_macro ("unexpected first argument valued tag="<<arg1_valued_tag);
869  }
870  }
871  };
872  template<class Result, class M>
873  void evaluate (
874  const geo_basic<float_type,M>& omega_K,
875  const geo_element& K,
876  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
877  {
878  typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
879  typename Expr1::value_type
880  ,typename Expr2::value_type
881  ,Result>::first_argument_type A1;
882  typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
883  typename Expr1::value_type
884  ,typename Expr2::value_type
885  ,Result>::second_argument_type A2;
888  typedef field_expr_v2_nonlinear_node_binary<BinaryFunction, Expr1, Expr2> This;
890  eval (*this, omega_K, K, value);
891  }
892  template<class Result, class M>
893  void
895  const geo_basic<float_type,M>& omega_K,
896  const geo_element& K,
897  const side_information_type& sid,
898  Eigen::Matrix<Result,Eigen::Dynamic,1>& value) const
899  {
900  typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
901  typename Expr1::value_type
902  ,typename Expr2::value_type
903  ,Result>::first_argument_type A1;
904  typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
905  typename Expr1::value_type
906  ,typename Expr2::value_type
907  ,Result>::second_argument_type A2;
910  typedef field_expr_v2_nonlinear_node_binary<BinaryFunction, Expr1, Expr2> This;
912  eval (*this, omega_K, K, sid, value);
913  }
914  template<class Result>
915  bool valued_check() const {
916  typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
917  typename Expr1::value_type
918  ,typename Expr2::value_type
919  ,Result>::first_argument_type A1;
920  typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
921  typename Expr1::value_type
922  ,typename Expr2::value_type
923  ,Result>::second_argument_type A2;
924  bool status = true;
925  if (! is_undeterminated<A1>::value) status &= _expr1.template valued_check<A1>();
926  if (! is_undeterminated<A2>::value) status &= _expr2.template valued_check<A2>();
927  return status;
928  }
929 
930 protected:
931 // data:
934  Expr2 _expr2;
935 };
936 template<class BinaryFunction, class Expr1, class Expr2>
938  const BinaryFunction& f,
939  const Expr1& expr1,
940  const Expr2& expr2)
941  : _f(f),
942  _expr1(expr1),
943  _expr2(expr2)
944 {
945 }
946 
947 template<class F, class Expr1, class Expr2> struct is_field_expr_v2_nonlinear_arg <field_expr_v2_nonlinear_node_binary<F,Expr1,Expr2>> : std::true_type {};
948 template<class F, class Expr1, class Expr2> struct is_field_expr_affine_homogeneous<field_expr_v2_nonlinear_node_binary<F,Expr1,Expr2>, typename std::enable_if<
949  field_expr_v2_nonlinear_node_binary<F,Expr1,Expr2>::is_affine_homogeneous::value>::type>: std::true_type {};
950 
951 } // namespace details
952 // -------------------------------------------
953 // 2.2. binary calls
954 // -------------------------------------------
955 /*
956  combination table:
957 
958  +- | c a n
959  ---|-------
960  c | C A N
961  a | A A N
962  n | N N N
963 
964  * | c a n
965  ---|-------
966  c | C A N
967  a | A N N
968  n | N N N
969 
970  / | c a n
971  ---|-------
972  c | C N N
973  a | A N N
974  n | N N N
975 
976  argument:
977  c : constant, as scalar, point, tensor, ect
978  l : affine homogeneous expr argument: as field, field_indirect or field_expr_node::is_affine_homogeneous
979  n : function, functor or ! field_expr_node::is_affine_homogeneous
980  result:
981  C : constant : this combination is not implemented here
982  A,N : are implemented here
983  rules:
984  at least one of the two args is not of type "c"
985  when c: c value is embeded in bind_first or bind_second
986  and the operation reduces to an unary one
987  when a: if it is a field_convertible, it should be wrapped
988  in field_expr_v2_nonlinear_terminal_field
989  when c: no wrapper is need
990  implementation:
991  The a and n cases are grouped, thanks to the wrapper_traits
992  and it remains to cases :
993  1) both args are field_expr_v2_nonlinear or a function
994  2) one arg is a field_expr_v2_nonlinear or a function and the second argument is a constant
995 */
996 
997 #define _RHEOLEF_make_field_expr_v2_nonlinear_binary(FUNCTION,FUNCTOR) \
998 template<class Expr1, class Expr2> \
999 inline \
1000 typename \
1001 std::enable_if< \
1002  details::is_field_expr_v2_nonlinear_arg<Expr1>::value \
1003  && details::is_field_expr_v2_nonlinear_arg<Expr2>::value \
1004  && ! details::is_field_expr_v2_constant <Expr1>::value \
1005  && ! details::is_field_expr_v2_constant <Expr2>::value \
1006  ,details::field_expr_v2_nonlinear_node_binary< \
1007  FUNCTOR \
1008  ,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type \
1009  ,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type \
1010  > \
1011 >::type \
1012 FUNCTION (const Expr1& expr1, const Expr2& expr2) \
1013 { \
1014  typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type wrap1_t; \
1015  typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type wrap2_t; \
1016  return details::field_expr_v2_nonlinear_node_binary <FUNCTOR,wrap1_t,wrap2_t> \
1017  (FUNCTOR(), wrap1_t(expr1), wrap2_t(expr2)); \
1018 } \
1019 template<class Expr1, class Expr2> \
1020 inline \
1021 typename \
1022 std::enable_if< \
1023  details::is_field_expr_v2_constant <Expr1>::value \
1024  && details::is_field_expr_v2_nonlinear_arg<Expr2>::value \
1025  && ! details::is_field_expr_v2_constant <Expr2>::value \
1026  ,details::field_expr_v2_nonlinear_node_unary< \
1027  details::binder_first< \
1028  FUNCTOR \
1029  ,typename details::field_promote_first_argument< \
1030  Expr1 \
1031  ,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type::value_type \
1032  >::type \
1033  > \
1034  ,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type \
1035  > \
1036 >::type \
1037 FUNCTION (const Expr1& expr1, const Expr2& expr2) \
1038 { \
1039  typedef typename details::field_promote_first_argument< \
1040  Expr1 \
1041  ,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type::value_type \
1042  >::type \
1043  value_type; \
1044  typedef details::binder_first<FUNCTOR,value_type> fun_t; \
1045  typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type wrap2_t; \
1046  return details::field_expr_v2_nonlinear_node_unary<fun_t,wrap2_t>(fun_t(FUNCTOR(), expr1), wrap2_t(expr2)); \
1047 } \
1048 template<class Expr1, class Expr2> \
1049 inline \
1050 typename \
1051 std::enable_if< \
1052  details::is_field_expr_v2_constant <Expr2>::value \
1053  && details::is_field_expr_v2_nonlinear_arg<Expr1>::value \
1054  && ! details::is_field_expr_v2_constant <Expr1>::value \
1055  ,details::field_expr_v2_nonlinear_node_unary< \
1056  details::binder_second< \
1057  FUNCTOR \
1058  ,typename details::field_promote_second_argument< \
1059  typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type::value_type \
1060  ,Expr2 \
1061  >::type \
1062  > \
1063  ,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type \
1064  > \
1065 >::type \
1066 FUNCTION (const Expr1& expr1, const Expr2& expr2) \
1067 { \
1068  typedef typename details::field_promote_second_argument< \
1069  typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type::value_type \
1070  ,Expr2 \
1071  >::type \
1072  value_type; \
1073  typedef details::binder_second<FUNCTOR,value_type> fun_t; \
1074  typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type wrap1_t; \
1075  return details::field_expr_v2_nonlinear_node_unary<fun_t,wrap1_t>(fun_t(FUNCTOR(), expr2), wrap1_t(expr1)); \
1076 }
1077 
1080 _RHEOLEF_make_field_expr_v2_nonlinear_binary (operator*, details::multiplies)
1081 _RHEOLEF_make_field_expr_v2_nonlinear_binary (operator/, details::divides)
1082 
1083 // -------------------------------------------
1084 // std::maths
1085 // -------------------------------------------
1086 
1087 #define _RHEOLEF_make_field_expr_v2_nonlinear_binary_function(FUNCTION) \
1088  _RHEOLEF_make_field_expr_v2_nonlinear_binary (FUNCTION, details::FUNCTION##_) \
1089 
1097 
1098 #undef _RHEOLEF_make_field_expr_v2_nonlinear_binary_function
1099 #undef _RHEOLEF_make_field_expr_v2_nonlinear_binary
1100 
1101 // -------------------------------------------
1102 // 2.3. binary compose
1103 // -------------------------------------------
1104 // note: compose 1 & 2 are not reductible to n-ary
1105 // as it uses deductible return types
1106 // TODO: do not use deductible types => reduces to n-ary !!
1107 
1108 // two args are field-expressions
1109 template<class Function, class Expr1, class Expr2>
1110 inline
1111 typename
1112 std::enable_if<
1121  >
1122 >::type
1123 compose (const Function& f, const Expr1& expr1, const Expr2& expr2)
1124 {
1125  typedef typename details::function_traits<Function>::functor_type fun_wrap_t;
1126  typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type expr1_wrap_t;
1127  typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type expr2_wrap_t;
1130  (fun_wrap_t(f), expr1_wrap_t(expr1), expr2_wrap_t(expr2));
1131 }
1132 // left arg is a constant
1133 template <class Function, class Expr1, class Expr2>
1134 inline
1135 typename
1136 std::enable_if<
1141  details::binder_first<
1143  ,typename promote<
1144  Expr1
1145  ,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type::value_type
1146  >::type
1147  >
1149  >
1150 >::type
1151 compose (const Function& f, const Expr1& expr1, const Expr2& expr2)
1152 {
1153  typedef typename promote<
1154  Expr1
1155  ,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type::value_type
1156  >::type value_type;
1157  typedef typename details::function_traits<Function>::functor_type wrap_fun_t;
1158  typedef details::binder_first<wrap_fun_t,value_type> binded_fun_t;
1161  <binded_fun_t, wrap2_t>
1162  (binded_fun_t(wrap_fun_t(f), expr1), wrap2_t(expr2));
1163 }
1164 // right arg is a constant
1165 template <class Function, class Expr1, class Expr2>
1166 inline
1167 typename
1168 std::enable_if<
1169  details::is_field_expr_v2_nonlinear_arg<Expr1>::value
1170  && ! details::is_field_expr_v2_constant <Expr1>::value
1171  && details::is_field_expr_v2_constant <Expr2>::value
1172  ,details::field_expr_v2_nonlinear_node_unary<
1173  details::binder_second<
1174  typename details::function_traits<Function>::functor_type
1175  ,typename promote<
1176  typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type::value_type
1177  ,Expr2
1178  >::type
1179  >
1180  ,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type
1181  >
1182 >::type
1183 compose (const Function& f, const Expr1& expr1, const Expr2& expr2)
1184 {
1185  typedef typename promote<
1186  typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type::value_type
1187  ,Expr2
1188  >::type value_type;
1189  typedef typename details::function_traits<Function>::functor_type wrap_fun_t;
1190  typedef details::binder_second<wrap_fun_t,value_type> binded_fun_t;
1191  typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type wrap1_t;
1192  return details::field_expr_v2_nonlinear_node_unary
1193  <binded_fun_t, wrap1_t>
1194  (binded_fun_t(wrap_fun_t(f), expr2), wrap1_t(expr1));
1195 }
1196 
1197 } // namespace rheolef
1198 #endif // _RHEOLEF_FIELD_EXPR_RECURSIVE_H
rheolef::_RHEOLEF_make_field_expr_v2_nonlinear_unary_function
details::negate _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(cos) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(sin) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(tan) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(acos) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(asin) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(atan) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(cosh) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(sinh) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(tanh) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(exp) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(log) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(log10) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(sqrt) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(abs) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(fabs) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(floor) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(ceil) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(sqr) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(norm) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(norm2) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(tr) _RHEOLEF_make_field_expr_v2_nonlinear_unary_function(trans) template< class Function
_RHEOLEF_evaluate_switch_specialization
#define _RHEOLEF_evaluate_switch_specialization(VALUED, VALUE)
Definition: field_expr_recursive.h:293
rheolef::geo_basic< float_type, M >
rheolef::details::field_expr_v2_nonlinear_node_unary::evaluate_call
void evaluate_call(const geo_basic< float_type, M > &omega_K, const geo_element &K, const side_information_type &sid, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value) const
Definition: field_expr_recursive.h:226
rheolef::details::field_expr_v2_nonlinear_node_unary::valued_hint
static const space_constant::valued_type valued_hint
Definition: field_expr_recursive.h:121
rheolef::space_constant::last_valued
@ last_valued
Definition: space_constant.h:143
rheolef::details::field_expr_v2_nonlinear_node_unary::const_iterator::value_type
typename Expr::scalar_type value_type
Definition: field_expr_recursive.h:102
rheolef::begin_dof
const_iterator begin_dof() const
Definition: field_expr_recursive.h:569
rheolef::details::field_expr_v2_nonlinear_node_unary::begin_dof
const_iterator begin_dof() const
Definition: field_expr_recursive.h:114
mkgeo_ball.expr
expr
Definition: mkgeo_ball.sh:361
rheolef::point_basic
Definition: point.h:87
rheolef::details::or_type
Definition: field_expr_utilities.h:58
rheolef::space_constant::valued_tag_traits::value
static const valued_type value
Definition: space_constant.h:161
rheolef::_RHEOLEF_make_field_expr_v2_nonlinear_unary_operator
_RHEOLEF_make_field_expr_v2_nonlinear_unary_operator(operator+, details::unary_plus) _RHEOLEF_make_field_expr_v2_nonlinear_unary_operator(operator-
rheolef::const_iterator::iterator_category
std::forward_iterator_tag iterator_category
Definition: field_expr_recursive.h:553
expr1_wrap_t
details::field_expr_v2_nonlinear_terminal_wrapper_traits< Expr1 >::type expr1_wrap_t
Definition: field_expr_recursive.h:1126
rheolef::Function
rheolef::std Function
rheolef::details::field_expr_v2_nonlinear_node_unary::field_expr_v2_nonlinear_node_unary
field_expr_v2_nonlinear_node_unary(const UnaryFunction &f, const Expr &expr)
Definition: field_expr_recursive.h:388
rheolef::details::is_field_expr_affine_homogeneous
Definition: field.h:229
rheolef::valued_tag
space_constant::valued_type valued_tag() const
Definition: field_expr_recursive.h:579
rheolef::details::field_expr_v2_nonlinear_node_unary::_tensor4_val
std::array< Eigen::Matrix< tensor4_basic< scalar_type >, Eigen::Dynamic, 1 >,reference_element::max_variant > _tensor4_val
Definition: field_expr_recursive.h:384
rheolef::const_iterator::const_iterator
const_iterator(const BinaryFunction &f, typename Expr1::const_iterator iter1, typename Expr2::const_iterator iter2)
Definition: field_expr_recursive.h:560
rheolef::details::field_expr_v2_nonlinear_terminal_wrapper_traits::type
Expr type
Definition: field_expr_terminal.h:98
rheolef::value
rheolef::std value
rheolef::details::field_expr_v2_nonlinear_node_unary::evaluate_call_check
Definition: field_expr_recursive.h:145
rheolef::details::field_expr_v2_nonlinear_node_unary::const_iterator::iterator_category
std::forward_iterator_tag iterator_category
Definition: field_expr_recursive.h:101
rheolef::_expr1
Expr1 _expr1
Definition: field_expr_recursive.h:933
rheolef::space_basic
the finite element space
Definition: space.h:352
rheolef::tensor_basic
Definition: tensor.h:90
rheolef::valued_check
bool valued_check() const
Definition: field_expr_recursive.h:915
rheolef::space_constant::tensor3
@ tensor3
Definition: space_constant.h:140
rheolef::details::minus
Definition: expression.h:543
rheolef::geo_element
see the geo_element page for the full documentation
Definition: geo_element.h:102
rheolef::pow
space_mult_list< T, M > pow(const space_basic< T, M > &X, size_t n)
Definition: space_mult.h:120
rheolef::float_type
typename float_traits< value_type >::type float_type
Definition: field_expr_recursive.h:501
rheolef::space_constant::valued_type
valued_type
Definition: space_constant.h:135
rheolef::details::field_expr_v2_nonlinear_node_unary::expr
const Expr & expr() const
Definition: field_expr_recursive.h:122
rheolef::is_affine_homogeneous
or_type< and_type< or_type< std::is_same< BinaryFunction, details::plus >,std::is_same< BinaryFunction, details::minus > >,is_field_expr_affine_homogeneous< Expr1 >,is_field_expr_affine_homogeneous< Expr2 > >,and_type< or_type< std::is_same< BinaryFunction, details::multiplies >,std::is_same< BinaryFunction, details::divides > >,is_field_expr_affine_homogeneous< Expr1 >,is_field_expr_v2_constant< Expr2 > >,and_type< std::is_same< BinaryFunction, details::multiplies >,is_field_expr_v2_constant< Expr1 >,is_field_expr_affine_homogeneous< Expr2 > > > is_affine_homogeneous
Definition: field_expr_recursive.h:543
rheolef::details::field_expr_v2_nonlinear_node_unary::_scalar_val
std::array< Eigen::Matrix< scalar_type, Eigen::Dynamic, 1 >,reference_element::max_variant > _scalar_val
Definition: field_expr_recursive.h:372
rheolef::details::field_expr_v2_nonlinear_node_unary::evaluate_switch< This, Result, Arg, space_constant::last_valued >::evaluate_on_side
void evaluate_on_side(const This &obj, const geo_basic< float_type, M > &omega_K, const geo_element &K, const side_information_type &sid, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value) const
Definition: field_expr_recursive.h:271
rheolef::norm
T norm(const vec< T, M > &x)
norm(x): see the expression page for the full documentation
Definition: vec.h:387
rheolef::const_iterator::difference_type
std::ptrdiff_t difference_type
Definition: field_expr_recursive.h:559
rheolef::evaluate_on_side
void evaluate_on_side(const geo_basic< float_type, M > &omega_K, const geo_element &K, const side_information_type &sid, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value) const
Definition: field_expr_recursive.h:894
rheolef::side_information_type
Definition: reference_element_face_transformation.h:37
rheolef::norm2
T norm2(const vec< T, M > &x)
norm2(x): see the expression page for the full documentation
Definition: vec.h:379
_RHEOLEF_make_field_expr_v2_nonlinear_binary
#define _RHEOLEF_make_field_expr_v2_nonlinear_binary(FUNCTION, FUNCTOR)
Definition: field_expr_recursive.h:997
rheolef::const_iterator::_iter2
Expr2::const_iterator _iter2
Definition: field_expr_recursive.h:567
rheolef::const_iterator::value_type
typename promote< typename Expr1::scalar_type, typename Expr2::scalar_type >::type value_type
Definition: field_expr_recursive.h:556
rheolef::details::field_expr_v2_nonlinear_node_unary::have_homogeneous_space
bool have_homogeneous_space(space_basic< scalar_type, memory_type > &Vh) const
Definition: field_expr_recursive.h:95
rheolef::integrate_option
see the integrate_option page for the full documentation
Definition: integrate_option.h:125
rheolef::space_constant::tensor
@ tensor
Definition: space_constant.h:138
rheolef::const_iterator::reference
value_type & reference
Definition: field_expr_recursive.h:557
rheolef::details::and_type
Definition: field_expr_utilities.h:81
rheolef::result_type
typename details::generic_binary_traits< BinaryFunction >::template result_hint< typename Expr1::result_type, typename Expr2::result_type >::type result_type
Definition: field_expr_recursive.h:498
rheolef::space_constant::scalar
@ scalar
Definition: space_constant.h:136
rheolef::details::plus
Definition: expression.h:456
rheolef::details::field_expr_v2_nonlinear_node_unary::valued_tag
space_constant::valued_type valued_tag() const
Definition: field_expr_recursive.h:124
rheolef::details::field_expr_v2_nonlinear_node_unary::const_iterator::difference_type
std::ptrdiff_t difference_type
Definition: field_expr_recursive.h:105
rheolef::details::field_expr_v2_nonlinear_node_unary::_expr
_RHEOLEF_evaluate_switch_specialization(space_constant::scalar, T) _RHEOLEF_evaluate_switch_specialization(space_constant Expr _expr
Definition: field_expr_recursive.h:316
rheolef::BinaryFunction
rheolef::std BinaryFunction
rheolef::details::function_traits
Definition: field_expr_utilities.h:188
rheolef::geo_element::size_type
reference_element::size_type size_type
Definition: geo_element.h:125
rheolef::details::unary_plus
Definition: expression.h:208
rheolef::ddot
T ddot(const tensor_basic< T > &a, const tensor_basic< T > &b)
ddot(x,y): see the expression page for the full documentation
Definition: tensor.cc:278
rheolef::details::generic_unary_traits::valued_tag
static space_constant::valued_type valued_tag(space_constant::valued_type)
Definition: expression.h:199
rheolef::type
rheolef::std type
fun_wrap_t
details::function_traits< Function >::functor_type fun_wrap_t
Definition: field_expr_recursive.h:1125
rheolef::tensor3_basic< T >
tensor_basic< T > tensor3_basic< T >
Definition: piola_fem.h:137
rheolef::exp
tensor_basic< T > exp(const tensor_basic< T > &a, size_t d)
Definition: tensor-exp.cc:92
rheolef::_f
BinaryFunction _f
Definition: field_expr_recursive.h:932
rheolef::details::field_expr_v2_nonlinear_node_unary
Definition: field_expr_recursive.h:59
rheolef::compose
rheolef::std enable_if ::type compose const Function f, const Expr1 expr1, const Expr2 expr2 compose(const Function &f, const Expr1 &expr1, const Expr2 &expr2)
Definition: field_expr_recursive.h:1151
rheolef::details::field_expr_v2_nonlinear_node_unary::evaluate_switch
Definition: field_expr_recursive.h:245
rheolef::details::field_expr_v2_nonlinear_node_unary::float_type
typename float_traits< scalar_type >::type float_type
Definition: field_expr_recursive.h:68
rheolef::value_type
result_type value_type
Definition: field_expr_recursive.h:499
rheolef::tensor3_basic
Definition: tensor3.h:73
rheolef::space_constant::unsymmetric_tensor
@ unsymmetric_tensor
Definition: space_constant.h:139
rheolef::details::field_expr_v2_nonlinear_node_unary::evaluate_switch< This, Result, Arg, space_constant::last_valued >::evaluate
void evaluate(const This &obj, const geo_basic< float_type, M > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value) const
Definition: field_expr_recursive.h:251
fatal_macro
#define fatal_macro(message)
Definition: dis_macros.h:33
rheolef::details::is_field_expr_v2_constant
Definition: field.h:225
rheolef::memory_type
typename Expr1::memory_type memory_type
Definition: field_expr_recursive.h:502
rheolef::const_iterator::_f
const BinaryFunction _f
Definition: field_expr_recursive.h:565
rheolef::details::field_expr_v2_nonlinear_node_unary::const_iterator::operator++
const_iterator & operator++()
Definition: field_expr_recursive.h:108
rheolef::details::field_expr_v2_nonlinear_node_unary::initialize
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt) const
Definition: field_expr_recursive.h:130
rheolef::piola_on_pointset< float_type >
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::float_traits::type
T type
Definition: Float.h:94
rheolef::details::field_expr_v2_nonlinear_node_unary::initialize
void initialize(const space_basic< float_type, memory_type > &Xh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt) const
Definition: field_expr_recursive.h:135
rheolef::details::field_expr_v2_nonlinear_node_unary::const_iterator::const_iterator
const_iterator(UnaryFunction f, typename Expr::const_iterator expr_iter)
Definition: field_expr_recursive.h:106
error_macro
#define error_macro(message)
Definition: dis_macros.h:49
rheolef::space_constant::tensor4
@ tensor4
Definition: space_constant.h:141
rheolef::details::field_expr_v2_nonlinear_node_unary::evaluate_call
void evaluate_call(const geo_basic< float_type, M > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value) const
Definition: field_expr_recursive.h:208
rheolef::scalar_type
typename scalar_traits< value_type >::type scalar_type
Definition: field_expr_recursive.h:500
rheolef::details::field_expr_v2_nonlinear_node_unary::scalar_type
typename scalar_traits< value_type >::type scalar_type
Definition: field_expr_recursive.h:67
rheolef::details::field_expr_v2_nonlinear_node_unary::const_iterator
Definition: field_expr_recursive.h:100
rheolef::details::generic_unary_traits
Definition: expression.h:187
rheolef::reference_element::max_variant
static const variant_type max_variant
Definition: reference_element.h:82
rheolef::const_iterator::pointer
value_type * pointer
Definition: field_expr_recursive.h:558
rheolef::initialize
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt) const
Definition: field_expr_recursive.h:585
rheolef::point_basic< T >
point_basic< T >
Definition: piola_fem.h:135
rheolef::details::field_expr_v2_nonlinear_node_unary::const_iterator::operator*
value_type operator*() const
Definition: field_expr_recursive.h:109
rheolef::compose
details::field_expr_v2_nonlinear_node_nary< typename details::function_traits< Function >::functor_type,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits< Exprs >::type... > ::type compose(const Function &f, const Exprs &... exprs)
see the compose page for the full documentation
Definition: compose.h:246
rheolef::details::field_expr_v2_nonlinear_node_unary::const_iterator::_f
const UnaryFunction _f
Definition: field_expr_recursive.h:111
rheolef::scalar_traits::type
T type
Definition: point.h:324
rheolef::field_expr_v2_nonlinear_node_binary
field_expr_v2_nonlinear_node_binary(const BinaryFunction &f, const Expr1 &expr1, const Expr2 &expr2)
rheolef::const_iterator::_iter1
Expr1::const_iterator _iter1
Definition: field_expr_recursive.h:566
rheolef::evaluate_internal2
void evaluate_internal2(const geo_basic< float_type, M > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value) const
Definition: field_expr_recursive.h:604
rheolef::const_iterator
Definition: field_expr_recursive.h:552
expr2_wrap_t
details::field_expr_v2_nonlinear_terminal_wrapper_traits< Expr2 >::type expr2_wrap_t
Definition: field_expr_recursive.h:1127
rheolef::space_constant::vector
@ vector
Definition: space_constant.h:137
rheolef::_expr2
Expr2 _expr2
Definition: field_expr_recursive.h:934
rheolef::details::is_equal
Definition: space_constant.h:38
rheolef::details::negate
Definition: expression.h:230
rheolef::details::field_expr_v2_nonlinear_node_unary::_vector_val
std::array< Eigen::Matrix< point_basic< scalar_type >, Eigen::Dynamic, 1 >,reference_element::max_variant > _vector_val
Definition: field_expr_recursive.h:375
rheolef::details::field_expr_v2_nonlinear_node_unary::const_iterator::_expr_iter
Expr::const_iterator _expr_iter
Definition: field_expr_recursive.h:112
rheolef::details::field_expr_v2_nonlinear_node_unary::_tensor3_val
std::array< Eigen::Matrix< tensor3_basic< scalar_type >, Eigen::Dynamic, 1 >,reference_element::max_variant > _tensor3_val
Definition: field_expr_recursive.h:381
rheolef::details::not_type
Definition: field_expr_utilities.h:106
size_type
field::size_type size_type
Definition: branch.cc:425
rheolef::details::field_expr_v2_nonlinear_node_unary::memory_type
typename Expr::memory_type memory_type
Definition: field_expr_recursive.h:64
rheolef::promote
Definition: promote.h:29
rheolef::details::field_expr_v2_nonlinear_node_unary::const_iterator::reference
value_type & reference
Definition: field_expr_recursive.h:103
rheolef::details::field_expr_v2_nonlinear_node_unary::evaluate_call_check::operator()
void operator()(const self_type &obj, const geo_basic< float_type, M > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value) const
Definition: field_expr_recursive.h:147
rheolef::evaluate_call
void evaluate_call(const geo_basic< float_type, M > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value) const
Definition: field_expr_recursive.h:684
rheolef::evaluate
void evaluate(const geo_basic< float_type, M > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value) const
Definition: field_expr_recursive.h:873
rheolef::Expr1
rheolef::std Expr1
dot(x,y): see the expression page for the full documentation
rheolef::details::field_expr_v2_nonlinear_node_unary::result_type
typename details::generic_unary_traits< UnaryFunction >::template result_hint< typename Expr::result_type >::type result_type
Definition: field_expr_recursive.h:65
rheolef::evaluate_switch
Definition: field_expr_recursive.h:710
f
Definition: cavity_dg.h:29
rheolef::trans
csr< T, sequential > trans(const csr< T, sequential > &a)
trans(a): see the form page for the full documentation
Definition: csr.h:455
rheolef::details::field_expr_v2_nonlinear_node_unary::const_iterator::pointer
value_type * pointer
Definition: field_expr_recursive.h:104
rheolef::valued_hint
static const space_constant::valued_type valued_hint
Definition: field_expr_recursive.h:577
rheolef::space_constant::valued_tag_traits
Definition: space_constant.h:161
rheolef::details::generic_binary_traits::valued_tag
static space_constant::valued_type valued_tag(space_constant::valued_type, space_constant::valued_type)
Definition: expression.h:421
rheolef::details::is_field_expr_v2_nonlinear_arg
Definition: field_expr_terminal.h:74
rheolef::std
Definition: vec_expr_v2.h:402
mkgeo_contraction.status
status
Definition: mkgeo_contraction.sh:290
rheolef::details::field_expr_v2_nonlinear_node_unary::value_type
result_type value_type
Definition: field_expr_recursive.h:66
rheolef::details::dot
rheolef::details::is_vec dot
rheolef::details::field_expr_v2_nonlinear_node_unary::_tensor_val
std::array< Eigen::Matrix< tensor_basic< scalar_type >, Eigen::Dynamic, 1 >,reference_element::max_variant > _tensor_val
Definition: field_expr_recursive.h:378
rheolef::is_undeterminated
Definition: undeterminated.h:39
rheolef::details::operator*
pair_with_linear_algebra< T1, T2 > operator*(const T0 &k, const pair_with_linear_algebra< T1, T2 > &x)
Definition: pair_with_linear_algebra.h:64
T
Expr1::float_type T
Definition: field_expr.h:261
rheolef::details::field_expr_v2_nonlinear_node_unary::size_type
geo_element::size_type size_type
Definition: field_expr_recursive.h:63
rheolef::tr
U tr(const tensor_basic< U > &a, size_t d=3)
_RHEOLEF_make_field_expr_v2_nonlinear_binary_function
#define _RHEOLEF_make_field_expr_v2_nonlinear_binary_function(FUNCTION)
Definition: field_expr_recursive.h:1087
rheolef::have_homogeneous_space
bool have_homogeneous_space(space_basic< scalar_type, memory_type > &Vh) const
Definition: field_expr_recursive.h:544