Flow123d
JS_before_hm-1804-gf2ad740aa
|
Go to the documentation of this file.
19 #ifndef FIELD_VALUE_CACHE_HH_
20 #define FIELD_VALUE_CACHE_HH_
23 #include <unordered_map>
24 #include <unordered_set>
56 EvalPointData(
unsigned int i_reg,
unsigned int i_ele,
unsigned int i_ep,
unsigned int dh_loc_idx)
93 static unsigned int get() {
98 static void set(
unsigned int n_elem) {
175 unsigned int last_element_idx = -1, i_elem_row = -1;
216 std::unordered_map<unsigned int, unsigned int>::const_iterator
it =
element_to_map_.find(mesh_elm_idx);
272 template<
class Value>
274 unsigned int elem_patch_idx,
unsigned int eval_points_idx)
const {
277 unsigned int value_cache_idx = this->
element_eval_point(elem_patch_idx, eval_points_idx);
279 return Value::get_from_array(field_cache, value_cache_idx);
342 template <
template<
IntDim...>
class DimAssembly>
unsigned int i_element_
mesh_idx of ElementAccessor appropriate to element
unsigned int element_chunk_begin(unsigned int elm_patch_idx) const
Return begin position of element chunk in FieldValueCache.
unsigned int elm_idx_on_position(unsigned pos) const
Return mesh_idx of element stored at given position of ElementCacheMap.
static unsigned int get()
Return number of stored elements.
CacheMapElementNumber()
Forbiden default constructor.
unsigned int i_eval_point_
index of point in EvalPoint object
void create_patch()
Create patch of cached elements before reading data to cache.
bool operator<(const EvalPointData &other)
unsigned int region_chunk_by_map_index(unsigned int r_idx) const
Return begin position of region chunk specified by position in map.
EvalPointData(const EvalPointData &other)
Copy constructor.
static const unsigned int simd_size_double
Auxiliary data class holds number of elements in cache and allow to set this value explicitly (e....
Directing class of FieldValueCache.
static const unsigned int undef_elem_idx
Index of invalid element in cache.
std::size_t permanent_size() const
Return permanent size of list.
unsigned int n_elements() const
Return number of stored elements.
void set_element_eval_point(unsigned int i_elem_in_cache, unsigned int i_eval_point, int val) const
Set item of element_eval_points_map_.
unsigned int element_chunk_end(unsigned int elm_patch_idx) const
Return end position of element chunk in FieldValueCache.
#define ASSERT_EQ_DBG(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
void operator=(CacheMapElementNumber const &)=delete
We don't need assignment operator.
void reset()
Clear the list.
int * element_eval_points_map_
Holds data of evaluating points in patch.
Declaration of class which handles the ordering of degrees of freedom (dof) and mappings between loca...
unsigned int position_in_cache(unsigned mesh_elm_idx) const
Return position of element stored in ElementCacheMap.
RevertableList< unsigned int > regions_starts_
Start positions of elements in regions (size = n_regions+1, last value is end of last region)
RevertableList< EvalPointData > eval_point_data_
unsigned int dh_loc_idx_
local index of cell in DOF handler
#define ASSERT_PTR_DBG(ptr)
Definition of assert macro checking non-null pointer (PTR) only for debug mode.
void init(std::shared_ptr< EvalPoints > eval_points)
Init cache.
const EvalPointData & eval_point_data(unsigned int point_idx) const
Return item of eval_point_data_ specified by its position.
unsigned int region_chunk_end(unsigned int region_patch_idx) const
Return end position of region chunk in FieldValueCache.
Side accessor allows to iterate over sides of DOF handler cell.
static const unsigned int elements_in_chunk
Base number of stored elements in patch.
unsigned int i_reg_
region_idx of element
static CacheMapElementNumber & get_instance()
void clear_element_eval_points_map()
Reset all items of elements_eval_points_map.
std::shared_ptr< EvalPoints > eval_points_
Pointer to EvalPoints.
EvalPointData(unsigned int i_reg, unsigned int i_ele, unsigned int i_ep, unsigned int dh_loc_idx)
Constructor sets all data members.
std::shared_ptr< EvalPoints > eval_points() const
Getter of eval_points object.
int element_eval_point(unsigned int i_elem_in_cache, unsigned int i_eval_point) const
static const int unused_point
Special constant (.
static const unsigned int regions_in_chunk
Base number of stored regions in patch.
std::unordered_map< unsigned int, unsigned int > element_to_map_
Maps element_idx to element index in patch - TODO remove.
std::vector< unsigned int > elm_idx_
Vector of element indexes stored in cache.
void finish_elements_update()
Finish update after reading data to cache.
unsigned int region_chunk_begin(unsigned int region_patch_idx) const
Return begin position of region chunk in FieldValueCache.
Cell accessor allow iterate over DOF handler cells.
unsigned int region_idx_from_chunk_position(unsigned int chunk_pos) const
Return begin position of region chunk specified by position in map.
~ElementCacheMap()
Destructor.
#define ASSERT_LT_DBG(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
ElementCacheMap()
Constructor.
unsigned int n_elem_
Maximal number of elements stored in cache.
void start_elements_update()
Start update of cache.
static void set(unsigned int n_elem)
Set number of stored elements.
Generic class of assemblation.
Value::return_type get_value(const FieldValueCache< typename Value::element_type > &field_cache, unsigned int elem_patch_idx, unsigned int eval_points_idx) const
Return value of evaluation point given by idx of element in patch and local point idx in EvalPoints f...
unsigned int n_regions() const
Return number of stored regions.
bool ready_to_reading_
Flag is set down during update of cache when this can't be read.
RevertableList< unsigned int > element_starts_
Start positions of elements in eval_point_data_ (size = n_elements+1)
Class holds local coordinations of evaluating points (bulk and sides) specified by element dimension.
unsigned int IntDim
A dimension index type.