Flow123d  JS_before_hm-984-g3a19f2f
field_value_cache.impl.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 field_value_cache.impl.hh
15  * @brief
16  * @author David Flanderka
17  */
18 
19 #ifndef FIELD_VALUE_CACHE_IMPL_HH_
20 #define FIELD_VALUE_CACHE_IMPL_HH_
21 
23 #include "fem/dh_cell_accessor.hh"
24 #include "mesh/accessors.hh"
25 
26 template<class elm_type>
27 template<class Value>
28 typename Value::return_type FieldValueCache<elm_type>::get_value(const ElementCacheMap &map,
29  const DHCellAccessor &dh_cell, unsigned int eval_points_idx) {
30  static_assert( std::is_same<elm_type, typename Value::element_type>::value, "Wrong element type.");
31 
33  ASSERT_EQ_DBG(Value::NRows_, data_.n_rows());
34  ASSERT_EQ_DBG(Value::NCols_, data_.n_cols());
35  int value_cache_idx = map.get_field_value_cache_index(dh_cell.element_cache_index(), eval_points_idx);
36  ASSERT_GE(value_cache_idx, 0);
37  return Value::get_from_array(data_, value_cache_idx);
38 }
39 
40 
41 
42 #endif /* FIELD_VALUE_CACHE_IMPL_HH_ */
#define ASSERT_EQ_DBG(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Definition: asserts.hh:332
unsigned int elm_idx() const
Return serial idx to element of loc_ele_idx_.
Value::return_type get_value(const ElementCacheMap &map, const DHCellAccessor &dh_cell, unsigned int eval_points_idx)
Return value of evaluation point given by DHCell and local point idx in EvalPoints.
#define ASSERT_GE(a, b)
Definition of comparative assert macro (Greater or Equal)
Definition: asserts.hh:320
Directing class of FieldValueCache.
unsigned int element_cache_index() const
Getter of elm_cache_index_.
Cell accessor allow iterate over DOF handler cells.
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
Definition: asserts.hh:347
static constexpr bool value
Definition: json.hpp:87
static const unsigned int undef_elem_idx
Index of invalid element in cache.
int get_field_value_cache_index(unsigned int elm_idx, unsigned int loc_point_idx) const
Return index of point in FieldValueCache.