Flow123d  release_2.2.0-914-gf1a3a4f
fe_value_handler.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file fe_value_handler.hh
15  * @brief
16  */
17 
18 #ifndef FE_VALUE_HANDLER_HH_
19 #define FE_VALUE_HANDLER_HH_
20 
21 #include "fields/vec_seq_double.hh"
22 #include "fields/field_values.hh"
23 #include "fem/mapping_p1.hh"
24 #include "fem/finite_element.hh"
25 #include "mesh/point.hh"
26 #include <armadillo>
27 
28 
29 /// Initialization structure of FEValueHandler class.
31 {
32  /// DOF handler object
33  std::shared_ptr<DOFHandlerMultiDim> dh;
34  /// Store data of Field
36  /// number of dofs
37  unsigned int ndofs;
38  /// number of components
39  unsigned int n_comp;
40 };
41 
42 /**
43  * Helper class that allows compute finite element values specified by element dimension.
44  */
45 template <int elemdim, int spacedim, class Value>
47 {
48 public:
49  typedef typename Space<spacedim>::Point Point;
50 
51  /// Constructor.
53 
54  /// Initialize data members
55  void initialize(FEValueInitData init_data, MappingP1<elemdim,3> *map = nullptr);
56  /// Return mapping object
58  return map_;
59  }
60  /// Returns one value in one given point.
61  typename Value::return_type const &value(const Point &p, const ElementAccessor<spacedim> &elm);
62  /// Returns std::vector of scalar values in several points at once.
63  void value_list (const std::vector< Point > &point_list, const ElementAccessor<spacedim> &elm,
65  /// Test if element contains given point.
66  bool contains_point(arma::vec point, Element &elm);
67 
68  /// Destructor.
69  ~FEValueHandler();
70 private:
71  /// DOF handler object
72  std::shared_ptr<DOFHandlerMultiDim> dh_;
73  /// Store data of Field
75  /// Array of indexes to data_vec_, used for get/set values
77  /// Last value, prevents passing large values (vectors) by value.
79  typename Value::return_type r_value_;
80  /// Mapping object.
82 };
83 
84 
85 
86 #endif /* FE_VALUE_HANDLER_HH_ */
Class MappingP1 implements the affine transformation of the unit cell onto the actual cell...
Space< spacedim >::Point Point
static constexpr bool value
Definition: json.hpp:87
MappingP1< elemdim, 3 > * map_
Mapping object.
arma::vec::fixed< spacedim > Point
Definition: point.hh:33
Value::return_type r_value_
VectorSeqDouble * data_vec
Store data of Field.
std::vector< IdxInt > dof_indices
Array of indexes to data_vec_, used for get/set values.
std::shared_ptr< DOFHandlerMultiDim > dh_
DOF handler object.
unsigned int ndofs
number of dofs
VectorSeqDouble * data_vec_
Store data of Field.
std::shared_ptr< DOFHandlerMultiDim > dh
DOF handler object.
MappingP1< elemdim, 3 > * get_mapping()
Return mapping object.
Value value_
Last value, prevents passing large values (vectors) by value.
Abstract class for description of finite elements.
unsigned int n_comp
number of components
Initialization structure of FEValueHandler class.