19 #ifndef FIELD_VALUE_CACHE_HH_
20 #define FIELD_VALUE_CACHE_HH_
23 #include <unordered_map>
24 #include <unordered_set>
57 EvalPointData(
unsigned int i_reg,
unsigned int i_ele,
unsigned int i_ep,
unsigned int dh_loc_idx)
94 static unsigned int get() {
99 static void set(
unsigned int n_elem) {
172 unsigned int last_element_idx = -1, i_elem_row = -1;
197 inline void add_eval_point(
unsigned int i_reg,
unsigned int i_ele,
unsigned int i_eval_point,
unsigned int dh_loc_idx)
235 std::unordered_map<unsigned int, unsigned int>::const_iterator
it;
308 template<
class Value>
310 unsigned int elem_patch_idx,
unsigned int eval_points_idx)
const {
313 unsigned int value_cache_idx = this->
element_eval_point(elem_patch_idx, eval_points_idx);
315 return Value::get_from_array(field_cache, value_cache_idx);
390 template <
template<
IntDim...>
class DimAssembly>
392 template <
template<
IntDim...>
class DimAssembly>
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR) only for debug mode.
Auxiliary data class holds number of elements in cache and allow to set this value explicitly (e....
unsigned int n_elem_
Maximal number of elements stored in cache.
static unsigned int get()
Return number of stored elements.
static CacheMapElementNumber & get_instance()
CacheMapElementNumber()
Forbiden default constructor.
CacheMapElementNumber(CacheMapElementNumber const &)=delete
We don't need copy constructor.
void operator=(CacheMapElementNumber const &)=delete
We don't need assignment operator.
static void set(unsigned int n_elem)
Set number of stored elements.
Cell accessor allow iterate over DOF handler cells.
Side accessor allows to iterate over sides of DOF handler cell.
Directing class of FieldValueCache.
unsigned int region_chunk_end(unsigned int region_patch_idx) const
Return end position of region chunk in FieldValueCache.
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 elm_idx_on_position(unsigned pos) const
Return mesh_idx of element stored at given position of ElementCacheMap.
unsigned int element_chunk_begin(unsigned int elm_patch_idx) const
Return begin position of element chunk in FieldValueCache.
ElementCacheMap()
Constructor.
RevertableList< unsigned int > element_starts_
Start positions of elements in eval_point_data_ (size = n_elements+1)
RevertableList< unsigned int > regions_starts_
Start positions of elements in regions (size = n_regions+1, last value is end of last region)
unsigned int get_simd_rounded_size()
Returns number of eval. points with addition of max simd duplicates due to regions.
std::unordered_map< unsigned int, unsigned int > element_to_map_bdr_
Maps boundary element_idx to element index in patch - TODO remove.
void start_elements_update()
Start update of cache.
void finish_elements_update()
Finish update after reading data to cache.
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...
void clear_element_eval_points_map()
Reset all items of elements_eval_points_map.
unsigned int region_chunk_by_map_index(unsigned int r_idx) const
Return begin position of region chunk specified by position in map.
void create_patch()
Create patch of cached elements before reading data to cache.
std::unordered_set< unsigned int > set_of_regions_
Keeps set of unique region indices of added eval. points.
RevertableList< EvalPointData > eval_point_data_
static const int unused_point
Special constant (.
void add_eval_point(unsigned int i_reg, unsigned int i_ele, unsigned int i_eval_point, unsigned int dh_loc_idx)
unsigned int n_elements() const
Return number of stored elements.
void init(std::shared_ptr< EvalPoints > eval_points)
Init cache.
static const unsigned int undef_elem_idx
Index of invalid element in cache.
static const unsigned int elements_in_chunk
Base number of stored elements in patch.
bool ready_to_reading_
Flag is set down during update of cache when this can't be read.
unsigned int n_regions() const
Return number of stored regions.
void make_paermanent_eval_points()
Mark eval_point_data_ as permanent.
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 bulk element_idx to element index in patch - TODO remove.
int element_eval_point(unsigned int i_elem_in_cache, unsigned int i_eval_point) const
std::shared_ptr< EvalPoints > eval_points() const
Getter of eval_points object.
std::shared_ptr< EvalPoints > eval_points_
Pointer to EvalPoints.
unsigned int region_chunk_begin(unsigned int region_patch_idx) const
Return begin position of region chunk in FieldValueCache.
~ElementCacheMap()
Destructor.
unsigned int region_idx_from_chunk_position(unsigned int chunk_pos) const
Return begin position of region chunk specified by position in map.
std::size_t n_eval_points() const
Return number of stored items in eval_point_data_.
const std::vector< unsigned int > & elm_idx_vec(bool bdr=false) const
Return vector of bulk/boundary element idx.
unsigned int position_in_cache(unsigned mesh_elm_idx, bool bdr=false) const
Return position of element stored in ElementCacheMap.
int * element_eval_points_map_
Holds data of evaluating points in patch.
unsigned int simd_size_double
unsigned int element_chunk_end(unsigned int elm_patch_idx) const
Return end position of element chunk in FieldValueCache.
const EvalPointData & eval_point_data(unsigned int point_idx) const
Return item of eval_point_data_ specified by its position.
std::vector< unsigned int > bdr_elm_idx_
Vector of boundary element indexes stored in cache.
std::vector< unsigned int > elm_idx_
Vector of bulk element indexes stored in cache.
Class holds local coordinations of evaluating points (bulk and sides) specified by element dimension.
Generic class of observe output assemblation.
Generic class of assemblation.
Declaration of class which handles the ordering of degrees of freedom (dof) and mappings between loca...
unsigned int IntDim
A dimension index type.
unsigned int i_eval_point_
index of point in EvalPoint object
unsigned int dh_loc_idx_
local index of cell in DOF handler
unsigned int i_element_
mesh_idx of ElementAccessor appropriate to element
unsigned int i_reg_
region_idx of element
EvalPointData(unsigned int i_reg, unsigned int i_ele, unsigned int i_ep, unsigned int dh_loc_idx)
Constructor sets all data members.
bool operator<(const EvalPointData &other)
EvalPointData(const EvalPointData &other)
Copy constructor.
std::size_t make_permanent()
Finalize temporary part of data.
void reset()
Clear the list.
std::size_t emplace_back(Args &&... args)
std::size_t temporary_size() const
Return temporary size of list (full size of stored data).
std::size_t permanent_size() const
Return permanent size of list.