COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
ElementData.hpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2011 von Karman Institute for Fluid Dynamics, Belgium
2 //
3 // This software is distributed under the terms of the
4 // GNU Lesser General Public License version 3 (LGPLv3).
5 // See doc/lgpl.txt and doc/gpl.txt for the license text.
6 
7 #ifndef cf3_solver_actions_Proto_ElementData_hpp
8 #define cf3_solver_actions_Proto_ElementData_hpp
9 
10 #include <boost/array.hpp>
11 
12 #include <boost/fusion/algorithm/iteration/for_each.hpp>
13 #include <boost/fusion/adapted/mpl.hpp>
14 #include <boost/fusion/mpl.hpp>
15 #include <boost/fusion/container/vector/convert.hpp>
16 #include <boost/fusion/container/vector.hpp>
17 #include <boost/fusion/view/filter_view.hpp>
18 
19 #include <boost/mpl/assert.hpp>
20 #include <boost/mpl/for_each.hpp>
21 #include <boost/mpl/range_c.hpp>
22 #include <boost/mpl/transform.hpp>
23 #include <boost/mpl/vector_c.hpp>
24 
25 #include "common/Component.hpp"
27 
30 
31 #include "mesh/Elements.hpp"
32 #include "mesh/Field.hpp"
33 #include "mesh/Mesh.hpp"
34 #include "mesh/Region.hpp"
35 #include "mesh/Space.hpp"
36 #include "mesh/Dictionary.hpp"
37 #include "mesh/ElementData.hpp"
38 #include "mesh/Connectivity.hpp"
39 
40 #include "ElementMatrix.hpp"
41 #include "ElementOperations.hpp"
42 #include "ElementTransforms.hpp"
43 #include "FieldSync.hpp"
44 #include "Terminals.hpp"
45 
46 namespace cf3 {
47 namespace solver {
48 namespace actions {
49 namespace Proto {
50 
51 namespace detail
52 {
54  template<typename EquationDataT>
55  struct GetNbNodes
56  {
57  template<typename BoolT, typename EqDataT>
58  struct apply
59  {
60  };
61 
62  template<typename EqDataT>
63  struct apply<boost::mpl::false_, EqDataT>
64  {
65  static const Uint value = boost::remove_pointer
66  <
67  typename boost::remove_reference
68  <
69  typename boost::fusion::result_of::front<EquationDataT>::type
70  >::type
71  >::type::EtypeT::nb_nodes;
72  };
73 
74  template<typename EqDataT>
75  struct apply<boost::mpl::true_, EqDataT>
76  {
77  static const Uint value = 0;
78  };
79 
81  };
82 
84  template<typename MatchingGrammarT>
85  struct HasSubGrammar :
86  boost::proto::or_
87  <
88  boost::proto::when
89  <
90  MatchingGrammarT,
91  boost::mpl::true_()
92  >,
93  boost::proto::when
94  <
95  boost::proto::terminal< boost::proto::_ >,
96  boost::mpl::false_()
97  >,
98  boost::proto::when
99  <
100  boost::proto::nary_expr<boost::proto::_, boost::proto::vararg<boost::proto::_> >,
101  boost::proto::fold< boost::proto::_, boost::mpl::false_(), boost::mpl::max< boost::proto::_state, boost::proto::call< HasSubGrammar<MatchingGrammarT> > >() >
102  >
103  >
104  {
105  };
106 
108  template<Uint I>
109  struct UsesVar : HasSubGrammar< boost::proto::terminal< Var<boost::mpl::int_<I>, boost::proto::_> > >
110  {
111  };
112 
113  template<typename ExprT, typename MatchingGrammarT>
114  struct HasSubExpr
115  {
116  static const bool value = boost::result_of<HasSubGrammar<MatchingGrammarT>(ExprT)>::type::value;
117  };
118 
120  template<Uint I>
122  boost::proto::or_
123  <
124  boost::proto::when
125  <
126  boost::proto::or_
127  <
128  boost::proto::function< boost::proto::terminal< SFOp<boost::proto::_> >, boost::proto::vararg<boost::proto::_> >,
129  boost::proto::terminal< SFOp<boost::proto::_> >,
130  boost::proto::function<boost::proto::terminal<NodalValuesTag>, FieldTypes>,
131  ElementMatrixGrammar,
132  ElementMatrixGrammarIndexed< boost::mpl::int_<0>, boost::mpl::int_<0> >
133  >,
134  boost::mpl::false_()
135  >,
136  boost::proto::when
137  <
138  boost::proto::terminal< Var<boost::mpl::int_<I>, boost::proto::_> >,
139  boost::mpl::true_()
140  >
141  >
142  {
143  };
144 
145  template<Uint I>
146  struct HasEvalVar :
147  boost::proto::or_
148  <
149  boost::proto::call< MatchImplicitEval<I> >,
150  boost::proto::when
151  <
152  boost::proto::terminal< boost::proto::_ >,
153  boost::mpl::false_()
154  >,
155  boost::proto::when
156  <
157  boost::proto::nary_expr<boost::proto::_, boost::proto::vararg<boost::proto::_> >,
158  boost::proto::fold< boost::proto::_, boost::mpl::false_(), boost::mpl::max< boost::proto::_state, boost::proto::call< HasEvalVar<I> > >() >
159  >
160  >
161  {
162  };
163 
164 
165 }
166 
168 template<typename ETYPE>
170 {
171 public:
173  typedef ETYPE EtypeT ;
174 
176  typedef typename EtypeT::NodesT ValueT;
177 
179  typedef const ValueT& ValueResultT;
180 
182  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
183 
184  GeometricSupport(const mesh::Elements& elements) :
185  m_coordinates(elements.geometry_fields().coordinates()),
186  m_connectivity_array(elements.geometry_space().connectivity().array())
187  {
188  }
189 
191  void set_element(const Uint element_idx)
192  {
193  m_element_idx = element_idx;
194  const mesh::Connectivity::ConstRow row = m_connectivity_array[element_idx];
195  std::copy(row.begin(), row.end(), m_connectivity.begin());
197  }
198 
200  ValueResultT nodes() const
201  {
202  return m_nodes;
203  }
204 
205  Real volume() const
206  {
207  return EtypeT::volume(m_nodes);
208  }
209 
210  const typename EtypeT::CoordsT& coordinates(const typename EtypeT::MappedCoordsT& mapped_coords) const
211  {
212  EtypeT::SF::compute_value(mapped_coords, m_sf);
213  m_eval_result.noalias() = m_sf * m_nodes;
214  return m_eval_result;
215  }
216 
218  const typename EtypeT::CoordsT& coordinates() const
219  {
220  return m_eval_result;
221  }
222 
224  const typename EtypeT::JacobianT& jacobian(const typename EtypeT::MappedCoordsT& mapped_coords) const
225  {
227  return m_jacobian_matrix;
228  }
229 
231  const typename EtypeT::JacobianT& jacobian() const
232  {
233  return m_jacobian_matrix;
234  }
235 
237  const typename EtypeT::JacobianT& jacobian_inverse() const
238  {
239  return m_jacobian_inverse;
240  }
241 
242  Real jacobian_determinant(const typename EtypeT::MappedCoordsT& mapped_coords) const
243  {
245  return m_jacobian_determinant;
246  }
247 
249  Real jacobian_determinant() const
250  {
251  return m_jacobian_determinant;
252  }
253 
254  const typename EtypeT::CoordsT& normal(const typename EtypeT::MappedCoordsT& mapped_coords) const
255  {
256  EtypeT::normal(mapped_coords, m_nodes, m_normal_vector);
257  return m_normal_vector;
258  }
259 
260  const typename EtypeT::CoordsT& normal() const
261  {
262  return m_normal_vector;
263  }
264 
266  void compute_shape_functions(const typename EtypeT::MappedCoordsT& mapped_coords) const
267  {
268  EtypeT::SF::compute_value(mapped_coords, m_sf);
269  }
270 
272  void compute_jacobian(const typename EtypeT::MappedCoordsT& mapped_coords) const
273  {
274  compute_jacobian_dispatch(boost::mpl::bool_<EtypeT::dimension == EtypeT::dimensionality>(), mapped_coords);
275  }
276 
278  void compute_coordinates() const
279  {
280  m_eval_result.noalias() = m_sf * m_nodes;
281  }
282 
284  void compute_normal(const typename EtypeT::MappedCoordsT& mapped_coords) const
285  {
286  compute_normal_dispatch(boost::mpl::bool_<EtypeT::dimension - EtypeT::dimensionality == 1>(), mapped_coords);
287  }
288 
289  const boost::array<Uint, EtypeT::nb_nodes>& element_connectivity() const
290  {
291  return m_connectivity;
292  }
293 
294 private:
295  void compute_normal_dispatch(boost::mpl::false_, const typename EtypeT::MappedCoordsT&) const
296  {
297  }
298 
299  void compute_normal_dispatch(boost::mpl::true_, const typename EtypeT::MappedCoordsT& mapped_coords) const
300  {
301  EtypeT::normal(mapped_coords, m_nodes, m_normal_vector);
302  }
303 
304  void compute_jacobian_dispatch(boost::mpl::false_, const typename EtypeT::MappedCoordsT&) const
305  {
306  }
307 
308  void compute_jacobian_dispatch(boost::mpl::true_, const typename EtypeT::MappedCoordsT& mapped_coords) const
309  {
311  bool is_invertible;
312  m_jacobian_matrix.computeInverseAndDetWithCheck(m_jacobian_inverse, m_jacobian_determinant, is_invertible);
313  cf3_assert(is_invertible);
314  }
315 
317  ValueT m_nodes;
318 
321 
324 
326  boost::array<Uint, EtypeT::nb_nodes> m_connectivity;
327 
330 
332 private:
333  mutable typename EtypeT::SF::ValueT m_sf;
334  mutable typename EtypeT::CoordsT m_eval_result;
339 };
340 
342 inline mesh::Field& find_field(mesh::Elements& elements, const std::string& tag)
343 {
344  mesh::Mesh& mesh = common::find_parent_component<mesh::Mesh>(elements);
345  return common::find_component_recursively_with_tag<mesh::Field>(mesh, tag);
346 }
347 
349 template<typename ETYPE, typename SupportEtypeT, Uint Dim, bool IsEquationVar>
351 {
352 public:
354  typedef ETYPE EtypeT;
355 
356 private:
358  template<Uint VarDim, int Dummy=0>
360  {
361  typedef Eigen::Matrix<Real, 1, VarDim> MatrixT;
362  typedef const MatrixT& result_type;
363 
364  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
365 
366  template<typename NodeValuesT>
367  result_type operator()(const typename EtypeT::SF::ValueT& sf, const NodeValuesT& values) const
368  {
369  stored_result.noalias() = sf * values;
370  return stored_result;
371  }
372 
373  mutable MatrixT stored_result;
374  };
375 
377  template<int Dummy>
378  struct InterpolationImpl<1, Dummy>
379  {
380  typedef Real result_type;
381 
382  template<typename NodeValuesT>
383  result_type operator()(const typename EtypeT::SF::ValueT& sf, const NodeValuesT& values) const
384  {
385  stored_result = sf * values;
386  return stored_result;
387  }
388 
389  mutable Real stored_result;
390  };
391 
392 public:
393 
395 
397  typedef Eigen::Matrix<Real, EtypeT::nb_nodes, Dim> ValueT;
398 
400  typedef Eigen::Matrix<Real, EtypeT::nb_nodes*Dim, 1> ElementVectorT;
401 
403  typedef const ValueT& ValueResultT;
404 
407 
410 
411  // Specialization of InterpolationImpl should ensure that 1x1 matrices are replaced by Reals
412  BOOST_MPL_ASSERT_NOT(( boost::is_same<EvalT, const Eigen::Matrix<Real, 1, 1>&> ));
413 
415  typedef typename EtypeT::SF::GradientT GradientT;
416 
418  typedef Eigen::Matrix<Real, 1, Dim * EtypeT::nb_nodes> DivergenceLinT;
419 
421  static const Uint dimension = Dim;
422 
424  static const bool is_equation_variable = IsEquationVar;
425 
427  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
428 
430  const mesh::Connectivity& get_connectivity(const std::string& tag, mesh::Elements& elements)
431  {
432  const mesh::Mesh& mesh = common::find_parent_component<mesh::Mesh>(elements);
433  Handle<mesh::Dictionary const> dict = common::find_component_ptr_with_tag<mesh::Dictionary>(mesh, tag);
434  if(is_null(dict))
435  dict = mesh.geometry_fields().handle<mesh::Dictionary>(); // fall back to the geometry if the dict is not found by tag
436  return elements.space(*dict).connectivity();
437  }
438 
439  template<typename VariableT>
440  EtypeTVariableData(const VariableT& placeholder, mesh::Elements& elements, const SupportT& support) :
441  m_field(find_field(elements, placeholder.field_tag())),
442  m_connectivity_array(get_connectivity(placeholder.field_tag(), elements).array()),
443  m_support(support),
444  offset(m_field.descriptor().offset(placeholder.name())),
445  m_need_sync(false)
446  {
447  }
448 
450  {
451  if(common::PE::Comm::instance().is_active())
452  {
453  const Uint my_sync = m_need_sync ? 1 : 0;
454  Uint global_sync = 0;
455  common::PE::Comm::instance().all_reduce(common::PE::plus(), &my_sync, 1, &global_sync);
456  if(global_sync != 0)
458  }
459  }
460 
462  void set_element(const Uint element_idx)
463  {
464  m_element_idx = element_idx;
466  }
467 
469  {
471  }
472 
474  const SupportT& support() const
475  {
476  return m_support;
477  }
478 
480  ValueResultT value() const
481  {
482  return m_element_values;
483  }
484 
485  const ElementVectorT& element_vector() const
486  {
487  for(int i = 0; i != Dim; ++i)
488  {
489  m_element_vector.template segment<EtypeT::nb_nodes>(EtypeT::nb_nodes*i) = m_element_values.col(i);
490  }
491  return m_element_vector;
492  }
493 
494  template<typename NodeValsT>
495  void add_nodal_values(const NodeValsT& vals)
496  {
498  for(Uint i = 0; i != dimension; ++i)
499  {
500  m_element_values.col(i) += vals.template block<EtypeT::nb_nodes, 1>(i*EtypeT::nb_nodes, 0);
501  for(Uint j = 0; j != EtypeT::nb_nodes; ++j)
502  m_field[row[j]][offset+i] = m_element_values(j,i);
503  }
504 
505  m_need_sync = true;
506  }
507 
508  template<typename NodeValsT>
509  void add_nodal_values_component(const NodeValsT& vals, const Uint component_idx)
510  {
512  for(Uint i = 0; i != EtypeT::nb_nodes; ++i)
513  {
514  m_element_values(i, component_idx) += vals[i];
515  m_field[row[i]][offset+component_idx] = m_element_values(i, component_idx);
516  }
517 
518  m_need_sync = true;
519  }
520 
522  void compute_values(const MappedCoordsT& mapped_coords) const
523  {
524  compute_values_dispatch(boost::mpl::bool_<EtypeT::dimension == EtypeT::dimensionality>(), mapped_coords);
525  }
526 
528  EvalT eval(const MappedCoordsT& mapped_coords) const
529  {
530  EtypeT::SF::compute_value(mapped_coords, m_sf);
531  return m_eval(m_sf, m_element_values);
532  }
533 
535  EvalT eval() const
536  {
537  return m_eval.stored_result;
538  }
539 
541  const typename EtypeT::SF::ValueT& shape_function(const MappedCoordsT& mapped_coords) const
542  {
543  EtypeT::SF::compute_value(mapped_coords, m_sf);
544  return m_sf;
545  }
546 
548  const typename EtypeT::SF::ValueT& shape_function() const
549  {
550  return m_sf;
551  }
552 
554  const GradientT& nabla(const MappedCoordsT& mapped_coords) const
555  {
556  EtypeT::SF::compute_gradient(mapped_coords, m_mapped_gradient_matrix);
557  m_gradient.noalias() = m_support.jacobian(mapped_coords).inverse() * m_mapped_gradient_matrix;
558  return m_gradient;
559  }
560 
562  const GradientT& nabla() const
563  {
564  return m_gradient;
565  }
566 
567 private:
569  void compute_values_dispatch(boost::mpl::false_, const MappedCoordsT& mapped_coords) const
570  {
571  EtypeT::SF::compute_value(mapped_coords, m_sf);
573  }
574 
576  void compute_values_dispatch(boost::mpl::true_, const MappedCoordsT& mapped_coords) const
577  {
578  compute_values_dispatch(boost::mpl::false_(), mapped_coords);
579  EtypeT::SF::compute_gradient(mapped_coords, m_mapped_gradient_matrix);
581  }
582 
585 
586  mutable ElementVectorT m_element_vector;
587 
590 
593 
595  const SupportT& m_support;
596 
598 
600  mutable typename EtypeT::SF::ValueT m_sf;
601  mutable typename EtypeT::SF::GradientT m_mapped_gradient_matrix;
602  mutable GradientT m_gradient;
603 
605 
607 
608 public:
610  const Uint offset;
611 };
612 
614 template<typename SupportEtypeT, Uint Dim, bool IsEquationVar>
615 class EtypeTVariableData<ElementBased<Dim>, SupportEtypeT, Dim, IsEquationVar>
616 {
617 public:
619 
621  typedef Eigen::Map< Eigen::Matrix<Real, 1, Dim> > ValueResultT;
622 
625 
627  static const Uint dimension = Dim;
628 
630  static const bool is_equation_variable = IsEquationVar;
631 
632  template<typename VariableT>
633  EtypeTVariableData(const VariableT& placeholder, mesh::Elements& elements, const SupportT& support) :
634  m_field(find_field(elements, placeholder.field_tag())),
635  m_support(support),
636  m_elements_begin(m_field.dict().space(elements).size() ? m_field.dict().space(elements).connectivity()[0][0] : 0),
637  offset(m_field.descriptor().offset(placeholder.name()))
638  {
639  }
640 
642  void set_element(const Uint element_idx)
643  {
644  m_field_idx = element_idx + m_elements_begin;
645  }
646 
647  ValueResultT value() const
648  {
649  return ValueResultT(&m_field[m_field_idx][offset]);
650  }
651 
652  typedef typename SupportEtypeT::MappedCoordsT MappedCoordsT;
653  typedef ValueResultT EvalT;
654 
656  EvalT eval(const MappedCoordsT& mapped_coords=MappedCoordsT()) const
657  {
658  return value();
659  }
660 
661  // Dummy types for compatibility with higher order elements
662  RealMatrix& nabla(RealMatrix mapped_coords = RealMatrix()) const
663  {
664  cf3_assert(false); // should not be used
665  return m_dummy_result;
666  }
667 
668  const RealMatrix& shape_function(RealMatrix mapped_coords = RealMatrix()) const
669  {
670  cf3_assert(false); // should not be used
671  return m_dummy_result;
672  }
673 
674  void compute_values(const MappedCoordsT& mapped_coords) const
675  {
676  }
677 
678 private:
680  const SupportT& m_support;
683  RealMatrix m_dummy_result; // only there for compilation purposes during the checking of the variable types. Never really used.
684 
685 public:
687  const Uint offset;
688 };
689 
691 template<typename SupportEtypeT, bool IsEquationVar>
692 class EtypeTVariableData<ElementBased<1>, SupportEtypeT, 1, IsEquationVar>
693 {
694 public:
696 
698  typedef Real& ValueResultT;
699 
702 
704  static const Uint dimension = 1;
705 
707  static const bool is_equation_variable = IsEquationVar;
708 
709  template<typename VariableT>
710  EtypeTVariableData(const VariableT& placeholder, mesh::Elements& elements, const SupportT& support) :
711  m_field(find_field(elements, placeholder.field_tag())),
712  m_support(support),
713  m_elements_begin(m_field.dict().space(elements).size() ? m_field.dict().space(elements).connectivity()[0][0] : 0),
714  offset(m_field.descriptor().offset(placeholder.name()))
715  {
716  }
717 
719  void set_element(const Uint element_idx)
720  {
721  m_field_idx = element_idx + m_elements_begin;
722  }
723 
724  Real& value() const
725  {
726  cf3_assert(m_field_idx < m_field.size());
727  return m_field[m_field_idx][offset];
728  }
729 
730  typedef Real EvalT;
731 
732  typedef typename SupportEtypeT::MappedCoordsT MappedCoordsT;
733 
735  EvalT eval(const MappedCoordsT& mapped_coords=MappedCoordsT()) const
736  {
737  return value();
738  }
739  const RealMatrix& nabla(RealMatrix mapped_coords = RealMatrix()) const
740  {
741  cf3_assert(false); // should not be used
742  return m_dummy_result;
743  }
744 
745  const RealMatrix& shape_function(RealMatrix mapped_coords = RealMatrix()) const
746  {
747  cf3_assert(false); // should not be used
748  return m_dummy_result;
749  }
750 
751  void compute_values(const MappedCoordsT& mapped_coords) const
752  {
753  }
754 
755 private:
757  const SupportT& m_support;
760  RealMatrix m_dummy_result; // only there for compilation purposes during the checking of the variable types. Never really used.
761 
762 public:
764  const Uint offset;
765 };
766 
769 {
770  template<typename DataT, int Dummy = 0>
771  struct apply
772  {
773  typedef boost::mpl::bool_<boost::remove_pointer<DataT>::type::is_equation_variable> type;
774  };
775 
776  template<int Dummy>
777  struct apply<boost::mpl::void_, Dummy>
778  {
779  typedef boost::mpl::false_ type;
780  };
781 };
782 
784 template<typename VariablesT, typename SupportEtypeT, typename ShapeFunctionsT, typename EquationVariablesT, typename MatrixSizesT, typename EMatrixSizeT>
786 {
787  template<typename I>
788  struct apply
789  {
790  typedef typename boost::mpl::at<VariablesT, I>::type VarT;
791  typedef typename boost::mpl::at<ShapeFunctionsT, I>::type EtypeT;
792  typedef typename boost::mpl::at<EquationVariablesT, I>::type IsEquationVar;
793  typedef typename boost::mpl::if_<IsEquationVar, EMatrixSizeT, typename boost::mpl::at<MatrixSizesT, I>::type>::type MatSize;
794 
795  template<typename AVarT, typename AnETypeT>
796  struct GetEETypeT
797  {
798  typedef typename boost::mpl::if_c<AnETypeT::order == 0, ElementBased<FieldWidth<VarT, SupportEtypeT>::value>, AnETypeT>::type type;
799  };
800 
801  template<typename AnETypeT>
802  struct GetEETypeT<boost::mpl::void_, AnETypeT>
803  {
804  typedef boost::mpl::void_ type;
805  };
806 
808 
809  typedef typename boost::mpl::if_
810  <
811  boost::mpl::is_void_<VarT>,
812  boost::mpl::void_,
815  };
816 };
817 
818 template<typename VariablesT, typename EtypeT, typename EquationVariablesT, typename MatrixSizesT, typename EMatrixSizeT>
819 struct MakeVarData<VariablesT, EtypeT, EtypeT, EquationVariablesT, MatrixSizesT, EMatrixSizeT>
820 {
821  template<typename I>
822  struct apply
823  {
824  typedef typename boost::mpl::at<VariablesT, I>::type VarT;
825  typedef typename boost::mpl::at<EquationVariablesT, I>::type IsEquationVar;
826  typedef typename boost::mpl::if_<IsEquationVar, EMatrixSizeT, typename boost::mpl::at<MatrixSizesT, I>::type>::type MatSize;
827 
828  typedef typename boost::mpl::if_
829  <
830  boost::mpl::is_void_<VarT>,
831  boost::mpl::void_,
834  };
835 };
836 
837 template<typename IsEqVarT, typename VariableSFT>
839 {
840  typedef typename boost::mpl::if_c<VariableSFT::order == 0, boost::mpl::false_, IsEqVarT>::type type;
841 };
842 
843 
844 template<typename IsEqVarT>
845 struct FilterElementField<IsEqVarT, boost::mpl::void_>
846 {
847  typedef boost::mpl::false_ type;
848 };
849 
851 template<typename EquationVariablesT, typename VariablesEtypeTT, typename SupportEtypeT>
853 {
854  typedef typename boost::mpl::eval_if
855  <
856  boost::mpl::is_sequence<VariablesEtypeTT>,
857  boost::mpl::transform
858  <
859  typename boost::mpl::copy<EquationVariablesT, boost::mpl::back_inserter< boost::mpl::vector0<> > >::type,
860  VariablesEtypeTT,
862  >,
863  boost::mpl::transform
864  <
865  typename boost::mpl::copy<EquationVariablesT, boost::mpl::back_inserter< boost::mpl::vector0<> > >::type,
867  >
868  >::type type;
869 };
870 
876 template<typename VariablesT, typename VariablesEtypeTT, typename SupportEtypeT, typename EquationVariablesInT>
878 {
879 public:
880  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
882  typedef typename boost::fusion::result_of::size<VariablesT>::type NbVarsT;
883 
885  typedef SupportEtypeT SupportShapeFunction;
886 
888  static const Uint dimension = SupportShapeFunction::dimension;
889 
892 
895 
898 
900  typedef Eigen::Matrix<Real, EMatrixSizeT::value, EMatrixSizeT::value> ElementMatrixT;
901 
903  typedef Eigen::Matrix<Real, EMatrixSizeT::value, 1> ElementVectorT;
904 
905  typedef typename boost::fusion::result_of::as_vector
906  <
907  typename boost::mpl::transform
908  <
909  typename boost::mpl::copy<boost::mpl::range_c<int,0,NbVarsT::value>, boost::mpl::back_inserter< boost::mpl::vector_c<Uint> > >::type, //range from 0 to NbVarsT
911  >::type
912  >::type VariablesDataT;
913 
915  typedef boost::fusion::filter_view< VariablesDataT, IsEquationData > EquationDataT;
916 
918 
920  m_variables(variables),
921  m_elements(elements),
922  m_support(elements),
924  {
925  boost::mpl::for_each< boost::mpl::range_c<int, 0, NbVarsT::value> >(InitVariablesData(m_variables, m_elements, m_variables_data, m_support));
926  for(Uint i = 0; i != CF3_PROTO_MAX_ELEMENT_MATRICES; ++i)
927  {
928  m_element_matrices[i].setZero();
929  m_element_vectors[i].setZero();
930  }
931 
932  init_block_accumulator(typename boost::fusion::result_of::empty<EquationDataT>::type());
933  }
934 
935  // Init LSS block accumulator
936  void init_block_accumulator(boost::mpl::false_)
937  {
938  typedef typename boost::mpl::transform
939  <
940  typename boost::mpl::copy<VariablesT, boost::mpl::back_inserter< boost::mpl::vector0<> > >::type,
942  >::type NbEqsPerVarT;
943 
945  }
946 
947  // No LSS, so nothing to be done
948  void init_block_accumulator(boost::mpl::true_)
949  {
950  }
951 
953  {
954  boost::mpl::for_each< boost::mpl::range_c<int, 0, NbVarsT::value> >(DeleteVariablesData(m_variables_data));
955  }
956 
958  void set_element(const Uint element_idx)
959  {
960  m_element_idx = element_idx;
961  m_support.set_element(element_idx);
962  boost::mpl::for_each< boost::mpl::range_c<int, 0, NbVarsT::value> >(SetElement(m_variables_data, element_idx));
963  boost::fusion::for_each(m_equation_data, FillRhs(m_element_rhs));
964  update_blocks(typename boost::fusion::result_of::empty<EquationDataT>::type());
965  }
966 
968  void update_blocks(boost::mpl::false_)
969  {
970  boost::fusion::front(m_equation_data)->update_block_connectivity(block_accumulator);
971  indices_converted = false;
972  }
973 
974  void update_blocks(boost::mpl::true_)
975  {
976  }
977 
979  template<typename ExprT>
980  void precompute_element_matrices(const typename SupportEtypeT::MappedCoordsT& mapped_coords, const ExprT& e)
981  {
982  // TODO: Add some granularity in here
983  m_support.compute_shape_functions(mapped_coords);
985  m_support.compute_jacobian(mapped_coords);
986  m_support.compute_normal(mapped_coords);
987  boost::mpl::for_each< boost::mpl::range_c<int, 0, NbVarsT::value> >(PrecomputeData<ExprT>(m_variables_data, mapped_coords));
988  }
989 
991  template<typename I>
992  struct DataType
993  {
994  typedef typename boost::remove_pointer
995  <
996  typename boost::remove_reference
997  <
998  typename boost::fusion::result_of::at
999  <
1000  VariablesDataT, I
1001  >::type
1002  >::type
1003  >::type type;
1004  };
1005 
1007  template<typename I>
1009  {
1010  typedef typename boost::remove_pointer
1011  <
1012  typename boost::remove_reference
1013  <
1014  typename boost::fusion::result_of::at
1015  <
1016  VariablesT, I
1017  >::type
1018  >::type
1019  >::type type;
1020  };
1021 
1023 
1025  template<typename I>
1026  typename DataType<I>::type& var_data(const I&)
1027  {
1028  return *boost::fusion::at<typename IndexType<I>::type>(m_variables_data);
1029  }
1030 
1032  template<typename I>
1033  const typename VariableType<I>::type& variable(const I&)
1034  {
1035  return boost::fusion::at<I>(m_variables);
1036  }
1037 
1039  SupportT& support()
1040  {
1041  return m_support;
1042  }
1043 
1044  const SupportT& support() const
1045  {
1046  return m_support;
1047  }
1048 
1050  ElementMatrixT& element_matrix(const int i)
1051  {
1052  return m_element_matrices[i];
1053  }
1054 
1056  ElementVectorT& element_vector(const int i)
1057  {
1058  return m_element_vectors[i];
1059  }
1060 
1062  ElementVectorT& element_rhs()
1063  {
1064  return m_element_rhs;
1065  };
1066 
1069  mutable bool indices_converted; // Indicate if the indices in the block accumulator have been converted to LSS indices
1070 
1071 private:
1074 
1077 
1079  SupportT m_support;
1080 
1082  VariablesDataT m_variables_data;
1083 
1085 
1088  ElementVectorT m_element_rhs;
1089 
1091  const EquationDataT m_equation_data;
1092 
1094 
1097  {
1098  InitVariablesData(VariablesT& vars, mesh::Elements& elems, VariablesDataT& vars_data, const SupportT& sup) :
1099  m_variables(vars),
1100  m_elements(elems),
1101  m_variables_data(vars_data),
1102  m_support(sup)
1103  {
1104  }
1105 
1106  template<typename I>
1107  void operator()(const I&)
1108  {
1109  apply(boost::fusion::at<I>(m_variables), boost::fusion::at<I>(m_variables_data));
1110  }
1111 
1112  void apply(const boost::mpl::void_&, const boost::mpl::void_&)
1113  {
1114  }
1115 
1116  template<typename VarT, typename VarDataT>
1117  void apply(const VarT& v, VarDataT*& d)
1118  {
1119  d = new VarDataT(v, m_elements, m_support);
1120  }
1121 
1124  VariablesDataT& m_variables_data;
1125  const SupportT& m_support;
1126  };
1127 
1130  {
1131  DeleteVariablesData(VariablesDataT& vars_data) : variables_data(vars_data)
1132  {
1133  }
1134 
1135  template<typename I>
1136  void operator()(const I&)
1137  {
1138  apply(boost::fusion::at<I>(variables_data));
1139  }
1140 
1141  void apply(const boost::mpl::void_&)
1142  {
1143  }
1144 
1145  template<typename T>
1146  void apply(T*& d)
1147  {
1148  delete d;
1149  }
1150 
1151  VariablesDataT& variables_data;
1152  };
1153 
1155  struct SetElement
1156  {
1157  SetElement(VariablesDataT& vars_data, const Uint elem_idx) :
1158  variables_data(vars_data),
1159  element_idx(elem_idx)
1160  {
1161  }
1162 
1163  template<typename I>
1164  void operator()(const I&)
1165  {
1166  apply(boost::fusion::at<I>(variables_data));
1167  }
1168 
1169  void apply(const boost::mpl::void_&)
1170  {
1171  }
1172 
1173  template<typename T>
1174  void apply(T*& d)
1175  {
1176  d->set_element(element_idx);
1177  }
1178 
1179  VariablesDataT& variables_data;
1181  };
1182 
1184  template<typename ExprT>
1186  {
1187  PrecomputeData(VariablesDataT& vars_data, const typename SupportEtypeT::MappedCoordsT& mapped_coords) :
1188  m_variables_data(vars_data),
1189  m_mapped_coords(mapped_coords)
1190  {
1191  }
1192 
1193  template<typename I>
1194  void operator()(const I&)
1195  {
1196  apply(typename boost::result_of<detail::UsesVar<I::value>(ExprT)>::type(), I(), boost::fusion::at<I>(m_variables_data));
1197  }
1198 
1199  template<typename I, typename T>
1200  void apply(boost::mpl::false_, I, T)
1201  {
1202  }
1203 
1204  template<typename I, typename T>
1205  void apply(boost::mpl::true_, I, T*& d)
1206  {
1207 // static const bool needs_eval = boost::result_of<detail::HasEvalVar<I::value>(ExprT)>::type::value;
1208  d->compute_values(m_mapped_coords);
1209  }
1210 
1211  template<Uint Dim, bool IsEquationVar>
1212  void apply(boost::mpl::true_, EtypeTVariableData<ElementBased<Dim>, SupportEtypeT, Dim, IsEquationVar>*&)
1213  {
1214  }
1215 
1216  // Variable is not used - do nothing
1217  template<typename T>
1218  void apply(boost::mpl::false_, T*& d)
1219  {
1220  }
1221 
1222  private:
1223  VariablesDataT& m_variables_data;
1224  const typename SupportEtypeT::MappedCoordsT& m_mapped_coords;
1225  };
1226 
1228  struct FillRhs
1229  {
1230  FillRhs(ElementVectorT& elm_v) :
1231  element_vector(elm_v)
1232  {
1233  }
1234 
1235  template<typename DataT>
1236  void operator()(const DataT* data) const
1237  {
1238  typename DataT::ValueResultT v = data->value();
1239  static const Uint rows = DataT::ValueT::RowsAtCompileTime;
1240  static const Uint cols = DataT::ValueT::ColsAtCompileTime;
1241  for(Uint i = 0; i != cols; ++i)
1242  {
1243  element_vector.template segment<rows>( (data->offset + i)*rows ) = v.col(i);
1244  }
1245  }
1246 
1247  ElementVectorT& element_vector;
1248  };
1249 };
1250 
1251 } // namespace Proto
1252 } // namespace actions
1253 } // namespace solver
1254 } // namespace cf3
1255 
1256 #endif // cf3_solver_actions_Proto_ElementData_hpp
boost::fusion::filter_view< VariablesDataT, IsEquationData > EquationDataT
A view of only the data used in the element matrix.
SupportEtypeT SupportShapeFunction
Shape function for the support.
boost::mpl::if_c< VariableSFT::order==0, boost::mpl::false_, IsEqVarT >::type type
EvalT eval() const
Return previously computed evaluation.
void set_element(const Uint element_idx)
Update nodes for the current element.
T * all_reduce(const Op &op, const T *in_values, const int in_n, T *out_values, const int stride=1)
Definition: Comm.hpp:282
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef boost::fusion::result_of::size< VariablesT >::type NbVarsT
Number of variales that we have stored.
std::string name(ComponentWrapper &self)
const EtypeT::JacobianT & jacobian_inverse() const
Precomputed jacobian inverse.
void resize(Uint numnodes, Uint numeqs)
setting up sizes
boost::proto::terminal< SFOp< NormalOp > >::type const normal
boost::mpl::if_< IsEquationVar, EMatrixSizeT, typename boost::mpl::at< MatrixSizesT, I >::type >::type MatSize
void precompute_element_matrices(const typename SupportEtypeT::MappedCoordsT &mapped_coords, const ExprT &e)
Precompute element matrices, for the variables found in expr.
DataType< I >::type & var_data(const I &)
Return the data stored at index I.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW const mesh::Connectivity & get_connectivity(const std::string &tag, mesh::Elements &elements)
We store data as a fixed-size Eigen matrix, so we need to make sure alignment is respected.
VariablesDataT m_variables_data
Data associated with each numbered variable.
EtypeT::SF::GradientT GradientT
Type of the gradient.
const EtypeT::CoordsT & coordinates(const typename EtypeT::MappedCoordsT &mapped_coords) const
void compute_normal(const typename EtypeT::MappedCoordsT &mapped_coords) const
Precompute normal (if we have a "face" type)
bool is_null(T ptr)
predicate for comparison to nullptr
Definition: CF.hpp:151
const GradientT & nabla() const
Previously calculated gradient matrix.
Grammar matching expressions if they have a terminal with the index given in the template parameter...
Definition: ElementData.hpp:85
TableArray< Uint >::type ArrayT
the type of the internal structure of the table
Definition: Table.hpp:53
Safe pointer to an object. This is the supported method for referring to components.
Definition: Handle.hpp:39
void update_blocks(boost::mpl::false_)
Update block accumulator only if a system of equations is accessed in the expressions.
external boost library namespace
BOOST_MPL_ASSERT_NOT((boost::is_same< EvalT, const Eigen::Matrix< Real, 1, 1 > & >))
SetElement(VariablesDataT &vars_data, const Uint elem_idx)
static FieldSynchronizer & instance()
Singleton implementation.
Definition: FieldSync.cpp:21
EvalT eval(const MappedCoordsT &mapped_coords=MappedCoordsT()) const
Calculate and return the interpolation at given mapped coords.
void copy(const std::vector< Real > &vector, RealMatrix &realmatrix)
Copy std::vector to dynamic RealMatrix types.
void insert(mesh::Field &f, bool do_periodic_element_update)
Definition: FieldSync.cpp:28
void update_block_connectivity(math::LSS::BlockAccumulator &block_accumulator)
Initializes the pointers in a VariablesDataT fusion sequence.
SupportT & support()
Get the data associated with the geometric support.
static void compute_jacobian(const MappedCoordsT &mapped_coord, const NodesT &nodes, MatrixType &jacobian)
static Real jacobian_determinant(const MappedCoordsT &mapped_coord, const NodesT &nodes)
Definition: Hexa3D.cpp:169
EtypeTVariableData(const VariableT &placeholder, mesh::Elements &elements, const SupportT &support)
Eigen::Matrix< Real, EMatrixSizeT::value, 1 > ElementVectorT
Type for the element vector (combined for all equations)
Metafunction class for creating an appropriate data type.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW result_type operator()(const typename EtypeT::SF::ValueT &sf, const NodeValuesT &values) const
boost::array< Uint, EtypeT::nb_nodes > m_connectivity
Connectivity table for the current element.
MatrixSizePerVar< VariablesT, VariablesEtypeTT, SupportEtypeT >::type MatrixSizesT
Element matrix size per var.
Returns true if an interpolation op is used.
Eigen::Matrix< Real, EtypeT::nb_nodes, Dim > ValueT
The value type for all element values.
ValueResultT value() const
Reference to the stored data, i.e. the matrix of nodal values.
EtypeT::MappedCoordsT MappedCoordsT
Type for passing mapped coordinates.
InitVariablesData(VariablesT &vars, mesh::Elements &elems, VariablesDataT &vars_data, const SupportT &sup)
#define cf3_assert(a)
Definition: Assertions.hpp:93
const EtypeT::JacobianT & jacobian(const typename EtypeT::MappedCoordsT &mapped_coords) const
Jacobian matrix computed by the shape function.
EtypeT::NodesT ValueT
The value type for all element nodes.
void compute_values_dispatch(boost::mpl::true_, const MappedCoordsT &mapped_coords) const
Precompute for volume EtypeT.
EtypeT::SF::ValueT m_sf
Temp storage for non-scalar results.
boost::fusion::result_of::as_vector< typename boost::mpl::transform< typename boost::mpl::copy< boost::mpl::range_c< int, 0, NbVarsT::value >, boost::mpl::back_inserter< boost::mpl::vector_c< Uint > > >::type, MakeVarData< VariablesT, SupportEtypeT, VariablesEtypeTT, EquationVariablesT, MatrixSizesT, EMatrixSizeT > >::type >::type VariablesDataT
mesh::Elements & m_elements
Referred Elements.
void compute_jacobian_dispatch(boost::mpl::false_, const typename EtypeT::MappedCoordsT &) const
const common::Table< Real > & m_coordinates
Coordinates table.
boost::mpl::at< VariablesT, I >::type VarT
Functions and operators associated with a geometric support.
ElementMatrixT m_element_matrices[CF3_PROTO_MAX_ELEMENT_MATRICES]
Data associated with field variables.
Set the element on each stored data item.
boost::mpl::at< EquationVariablesT, I >::type IsEquationVar
Calculate the size of the element matrix.
Eigen::Matrix< Real, EMatrixSizeT::value, EMatrixSizeT::value > ElementMatrixT
Type for the element matrix (combined for all equations)
FilterEquationVars< EquationVariablesInT, VariablesEtypeTT, SupportEtypeT >::type EquationVariablesT
Filter out element-based fields from the equation variables.
static const bool is_equation_variable
True if this variable is an unknow in the system of equations.
boost::mpl::if_< boost::mpl::is_void_< VarT >, boost::mpl::void_, EtypeTVariableData< EtypeT, EtypeT, FieldWidth< VarT, EtypeT >::value, IsEquationVar::value > * >::type type
Get the width of a field varaible, based on the variable type.
Dim
Enumeration of the dimensions.
Definition: Defs.hpp:15
Filter out element-based fields from the possible equation variables.
boost::mpl::eval_if< boost::mpl::is_sequence< VariablesSFT >, boost::mpl::transform< typename boost::mpl::copy< VariablesT, boost::mpl::back_inserter< boost::mpl::vector0<> > >::type, VariablesSFT, NodesTimesDim< boost::mpl::_1, boost::mpl::_2, SupportSF > >, boost::mpl::transform< typename boost::mpl::copy< VariablesT, boost::mpl::back_inserter< boost::mpl::vector0<> > >::type, NodesTimesDim< boost::mpl::_1, VariablesSFT, SupportSF > > >::type type
boost::remove_pointer< typename boost::remove_reference< typename boost::fusion::result_of::at< VariablesDataT, I >::type >::type >::type type
Real e()
Definition of the Unit charge [C].
Definition: Consts.hpp:30
Return the type of the stored variable I (I being an Integral Constant in the boost::mpl sense) ...
void compute_values_dispatch(boost::mpl::false_, const MappedCoordsT &mapped_coords) const
Precompute for non-volume EtypeT.
void neighbour_indices(const T &idx_vector)
entering the indices where the local matrix is lying
VariablesT & m_variables
Variables used in the expression.
Eigen::Matrix< Real, EtypeT::nb_nodes *Dim, 1 > ElementVectorT
The value type for a linearised representation of the element values.
const ValueT & ValueResultT
Return type of the value() method.
ElementMatrixT & element_matrix(const int i)
Retrieve the element matrix at index i.
const SupportEtypeT::MappedCoordsT & m_mapped_coords
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic > RealMatrix
Dynamic sized matrix of Real scalars.
Definition: MatrixTypes.hpp:22
Helper struct to get the number of element nodes.
Definition: ElementData.hpp:55
Uint size() const
Definition: Table.hpp:127
const EtypeT::CoordsT & normal() const
void compute_normal_dispatch(boost::mpl::true_, const typename EtypeT::MappedCoordsT &mapped_coords) const
SupportT m_support
Data for the geometric support.
Holds the Component class, as well as the ComponentIterator class plus some functions related to comp...
boost::mpl::bool_< boost::remove_pointer< DataT >::type::is_equation_variable > type
GeometricSupport< SupportEtypeT > SupportT
Eigen::Matrix< Real, nb_nodes, Hexa3D_traits::dimension > NodesT
Eigen::Matrix< Real, 1, Dim *EtypeT::nb_nodes > DivergenceLinT
Type of the linearized form of the divergence.
const SupportT & support() const
Reference to the geometric support.
void set_element(const Uint element_idx)
Update element index.
EtypeT::SF::ValueT m_sf
Cached data.
const EquationDataT m_equation_data
Filtered view of the data associated with equation variables.
const EtypeT::CoordsT & normal(const typename EtypeT::MappedCoordsT &mapped_coords) const
ElementMatrixSize< MatrixSizesT, EquationVariablesT >::type EMatrixSizeT
Size for the element matrix.
const mesh::Connectivity::ArrayT & m_connectivity_array
Connectivity for all elements.
ElementVectorT & element_vector(const int i)
Retrieve the element vector at index i.
void set_element(const Uint element_idx)
Update nodes for the current element and set the connectivity for the passed block accumulator...
PrecomputeData(VariablesDataT &vars_data, const typename SupportEtypeT::MappedCoordsT &mapped_coords)
mesh::Field & find_field(mesh::Elements &elements, const std::string &tag)
Helper function to find a field starting from a region.
const mesh::Connectivity::ArrayT & m_connectivity_array
Connectivity table.
const EtypeT::JacobianT & jacobian() const
Precomputed jacobian.
TableConstRow< Uint >::type ConstRow
the const type of a row in the internal structure of the table
Definition: Table.hpp:59
Top-level namespace for coolfluid.
Definition: Action.cpp:18
ETYPE EtypeT
The shape function type.
void compute_values(const MappedCoordsT &mapped_coords) const
Precompute all the cached values for the given geometric support and mapped coordinates.
result_type operator()(const typename EtypeT::SF::ValueT &sf, const NodeValuesT &values) const
const EtypeT::SF::ValueT & shape_function(const MappedCoordsT &mapped_coords) const
Shape function matrix at mapped coordinates (calculates and returns)
const boost::array< Uint, EtypeT::nb_nodes > & element_connectivity() const
const ElementVectorT & element_vector() const
void fill(NodeValuesT &to_fill, const common::Table< Real > &data_array, const RowT &element_row, const Uint start=0)
Fill STL-vector like per-node data storage.
Definition: ElementData.hpp:28
void apply(const boost::mpl::void_ &, const boost::mpl::void_ &)
void init_block_accumulator(boost::mpl::false_)
math::LSS::BlockAccumulator block_accumulator
Stores a mutable block accululator, always up-to-date with index mapping and correct size...
const EtypeT::CoordsT & coordinates() const
Precomputed coordinates.
GeometricSupport< SupportEtypeT > SupportT
Eigen::Matrix< Real, Hexa3D_traits::dimension, 1 > CoordsT
const EtypeT::SF::ValueT & shape_function() const
Previously calculated shape function matrix.
boost::mpl::eval_if< boost::mpl::is_sequence< VariablesEtypeTT >, boost::mpl::transform< typename boost::mpl::copy< EquationVariablesT, boost::mpl::back_inserter< boost::mpl::vector0<> > >::type, VariablesEtypeTT, FilterElementField< boost::mpl::_1, boost::mpl::_2 > >, boost::mpl::transform< typename boost::mpl::copy< EquationVariablesT, boost::mpl::back_inserter< boost::mpl::vector0<> > >::type, FilterElementField< boost::mpl::_1, VariablesEtypeTT > > >::type type
Set the element on each stored data item.
void compute_jacobian_dispatch(boost::mpl::true_, const typename EtypeT::MappedCoordsT &mapped_coords) const
void compute_jacobian(const typename EtypeT::MappedCoordsT &mapped_coords) const
Precompute jacobian for the given mapped coordinates.
EtypeTVariableData(const VariableT &placeholder, mesh::Elements &elements, const SupportT &support)
ValueT m_element_values
Value of the field in each element node.
boost::mpl::fold< typename FilterMatrixSizes< MatrixSizesT, EquationVariablesT >::type, boost::mpl::int_< 0 >, boost::mpl::plus< boost::mpl::_1, boost::mpl::_2 > >::type type
Grammar matching expressions if they have a terminal with the index given in the template parameter...
const Uint offset
Index of where the variable we need is in the field data row.
void compute_normal_dispatch(boost::mpl::false_, const typename EtypeT::MappedCoordsT &) const
ElementVectorT m_element_vectors[CF3_PROTO_MAX_ELEMENT_MATRICES]
Uint m_element_idx
Index for the current element.
unsigned int Uint
typedef for unsigned int
Definition: CF.hpp:90
const VariableType< I >::type & variable(const I &)
Return the variable stored at index I.
Space & space(const Dictionary &dict)
Definition: Entities.cpp:148
boost::mpl::if_c< AnETypeT::order==0, ElementBased< FieldWidth< VarT, SupportEtypeT >::value >, AnETypeT >::type type
ElementData(VariablesT &variables, mesh::Elements &elements)
void init_block_accumulator(boost::mpl::true_)
void add_nodal_values(const NodeValsT &vals)
static Real volume(const NodesT &nodes)
Definition: Hexa3D.cpp:324
void compute_coordinates() const
Precompute the interpolated value (requires a computed EtypeT)
boost::remove_pointer< typename boost::remove_reference< typename boost::fusion::result_of::at< VariablesT, I >::type >::type >::type type
EvalT eval(const MappedCoordsT &mapped_coords=MappedCoordsT()) const
Calculate and return the interpolation at given mapped coords.
Dummy shape function type used for element-based fields.
Definition: Terminals.hpp:42
InterpolationImpl< Dim >::result_type EvalT
The result type of an interpolation at given mapped coordinates.
static const Uint dimension
The dimension of the variable.
Return the type of the data stored for variable I (I being an Integral Constant in the boost::mpl sen...
GeometricSupport< SupportEtypeT > SupportT
Data type for the geometric support.
EvalT eval(const MappedCoordsT &mapped_coords) const
Calculate and return the interpolation at given mapped coords.
EtypeTVariableData(const VariableT &placeholder, mesh::Elements &elements, const SupportT &support)
Eigen::Map< Eigen::Matrix< Real, 1, Dim > > ValueResultT
Type of returned value.
boost::mpl::at< ShapeFunctionsT, I >::type EtypeT
const GradientT & nabla(const MappedCoordsT &mapped_coords) const
Return the gradient matrix.
Eigen::Matrix< Real, Hexa3D_traits::SF::dimensionality, Hexa3D_traits::dimension > JacobianT
Real jacobian_determinant(const typename EtypeT::MappedCoordsT &mapped_coords) const
const ValueT & ValueResultT
Return type of the value() method.
boost::mpl::if_< boost::mpl::is_void_< VarT >, boost::mpl::void_, EtypeTVariableData< EEtypeT, SupportEtypeT, FieldWidth< VarT, SupportEtypeT >::value, IsEquationVar::value > * >::type type
GeometricSupport< SupportEtypeT > SupportT
Data type for the geometric support.
static Comm & instance()
Return a reference to the current PE.
Definition: Comm.cpp:44
Real jacobian_determinant() const
Precomputed jacobian determinant.
void apply(boost::mpl::true_, EtypeTVariableData< ElementBased< Dim >, SupportEtypeT, Dim, IsEquationVar > *&)
const RealMatrix & shape_function(RealMatrix mapped_coords=RealMatrix()) const
void set_element(const Uint element_idx)
Update nodes for the current element.
GetEETypeT< VarT, EtypeT >::type EEtypeT
ValueResultT nodes() const
Reference to the current nodes.
void add_nodal_values_component(const NodeValsT &vals, const Uint component_idx)
#define CF3_PROTO_MAX_ELEMENT_MATRICES
const SupportT & m_support
Gemetric support.
Connectivity & connectivity()
connectivity table to dictionary entries
Definition: Space.hpp:110
2D Lagrange P1 Triangular Element type This class provides the lagrangian shape function describing t...
Definition: Hexa3D.hpp:36
void compute_shape_functions(const typename EtypeT::MappedCoordsT &mapped_coords) const
Precompute the shape function matrix.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW GeometricSupport(const mesh::Elements &elements)
We store nodes as a fixed-size Eigen matrix, so we need to make sure alignment is respected...
ElementVectorT & element_rhs()
Retrieve the element RHS.
Predicate to check if data belongs to an equation variable.
boost::mpl::if_< IsEquationVar, EMatrixSizeT, typename boost::mpl::at< MatrixSizesT, I >::type >::type MatSize
Send comments to:
COOLFluiD Web Admin