Flow123d
JS_before_hm-989-g79825ac
|
Directing class of FieldValueCache. More...
#include <field_value_cache.hh>
Classes | |
struct | RegionData |
class | UpdateCacheHelper |
Public Member Functions | |
ElementCacheMap () | |
Constructor. More... | |
~ElementCacheMap () | |
Destructor. More... | |
void | init (std::shared_ptr< EvalPoints > eval_points) |
Init cache. More... | |
void | add (const DHCellAccessor &dh_cell) |
Adds element to region_cache_indices_map_ set. More... | |
void | add (const DHCellSide &cell_side) |
Same as previous but passes DHCellSide as parameter. More... | |
void | prepare_elements_to_update () |
Prepare data member before reading data to cache. More... | |
void | create_elements_points_map () |
Create map of used eval points on cached elements. More... | |
void | start_elements_update () |
Start update of cache. More... | |
void | finish_elements_update () |
Finish update after reading data to cache. More... | |
const UpdateCacheHelper & | update_cache_data () const |
Return update cache data helper. More... | |
UpdateCacheHelper & | update_cache_data () |
Return update cache data helper. More... | |
std::shared_ptr< EvalPoints > | eval_points () const |
Getter of eval_points object. More... | |
void | mark_used_eval_points (const DHCellAccessor &dh_cell, unsigned int subset_idx, unsigned int data_size, unsigned int start_point=0) |
int | get_field_value_cache_index (unsigned int elm_idx, unsigned int loc_point_idx) const |
Return index of point in FieldValueCache. More... | |
unsigned int | elm_idx_on_position (unsigned pos) const |
Return idx of element stored at given position of ElementCacheMap. More... | |
DHCellAccessor & | operator() (DHCellAccessor &dh_cell) const |
Set index of cell in ElementCacheMap (or undef value if cell is not stored in cache). More... | |
Static Public Attributes | |
static constexpr unsigned int | n_cached_elements = 20 |
Number of cached elements which values are stored in cache. More... | |
static const unsigned int | undef_elem_idx = std::numeric_limits<unsigned int>::max() |
Index of invalid element in cache. More... | |
Protected Member Functions | |
void | clear_element_eval_points_map () |
Reset all items of elements_eval_points_map. More... | |
void | add_to_region (ElementAccessor< 3 > elm) |
Add element to appropriate region data of update_data_ object. More... | |
Protected Attributes | |
std::vector< unsigned int > | elm_idx_ |
std::unordered_map< unsigned int, unsigned int > | cache_idx_ |
std::shared_ptr< EvalPoints > | eval_points_ |
Pointer to EvalPoints. More... | |
UpdateCacheHelper | update_data_ |
Holds data used for cache update. More... | |
bool | ready_to_reading_ |
Flag is set down during update of cache when this can't be read. More... | |
int ** | element_eval_points_map_ |
unsigned int | points_in_cache_ |
Number of points stored in cache. More... | |
Static Protected Attributes | |
static const int | unused_point = -2 |
Special constant (. More... | |
static const int | point_in_proggress = -1 |
Special constant (. More... | |
Directing class of FieldValueCache.
Manage storing and updating element data (elements of same dimension) to cache. We need only one shared instance of this class for all fields in equation (but typically for dim = 1,2,3).
TODO: The logic of creating and updating this class is quite complex, describe in which order the methods are supposed to be called and which internal structures are updated when.
Definition at line 113 of file field_value_cache.hh.
ElementCacheMap::ElementCacheMap | ( | ) |
Constructor.
Definition at line 56 of file field_value_cache.cc.
ElementCacheMap::~ElementCacheMap | ( | ) |
Destructor.
Definition at line 64 of file field_value_cache.cc.
void ElementCacheMap::add | ( | const DHCellAccessor & | dh_cell | ) |
Adds element to region_cache_indices_map_ set.
Definition at line 83 of file field_value_cache.cc.
void ElementCacheMap::add | ( | const DHCellSide & | cell_side | ) |
Same as previous but passes DHCellSide as parameter.
Definition at line 90 of file field_value_cache.cc.
|
protected |
Add element to appropriate region data of update_data_ object.
Definition at line 170 of file field_value_cache.cc.
|
protected |
Reset all items of elements_eval_points_map.
Definition at line 161 of file field_value_cache.cc.
void ElementCacheMap::create_elements_points_map | ( | ) |
Create map of used eval points on cached elements.
Definition at line 120 of file field_value_cache.cc.
|
inline |
Return idx of element stored at given position of ElementCacheMap.
Definition at line 243 of file field_value_cache.hh.
|
inline |
Getter of eval_points object.
Definition at line 222 of file field_value_cache.hh.
void ElementCacheMap::finish_elements_update | ( | ) |
Finish update after reading data to cache.
Definition at line 147 of file field_value_cache.cc.
|
inline |
Return index of point in FieldValueCache.
Definition at line 237 of file field_value_cache.hh.
void ElementCacheMap::init | ( | std::shared_ptr< EvalPoints > | eval_points | ) |
Init cache.
Definition at line 73 of file field_value_cache.cc.
void ElementCacheMap::mark_used_eval_points | ( | const DHCellAccessor & | dh_cell, |
unsigned int | subset_idx, | ||
unsigned int | data_size, | ||
unsigned int | start_point = 0 |
||
) |
Set used element eval points to value ElementCacheMap::point_in_proggress
dh_cell | Specified element |
subset_idx | Index of subset |
data_size | Number of points |
start_point | Index of first used point in subset (e.g. subset holds eval points of all sides but EdgeIntegral represents only one of them) |
Definition at line 153 of file field_value_cache.cc.
DHCellAccessor & ElementCacheMap::operator() | ( | DHCellAccessor & | dh_cell | ) | const |
Set index of cell in ElementCacheMap (or undef value if cell is not stored in cache).
Definition at line 186 of file field_value_cache.cc.
void ElementCacheMap::prepare_elements_to_update | ( | ) |
Prepare data member before reading data to cache.
Definition at line 97 of file field_value_cache.cc.
void ElementCacheMap::start_elements_update | ( | ) |
Start update of cache.
Definition at line 142 of file field_value_cache.cc.
|
inline |
Return update cache data helper.
Definition at line 212 of file field_value_cache.hh.
|
inline |
Return update cache data helper.
Definition at line 217 of file field_value_cache.hh.
|
protected |
Map of element indices stored in cache, allows reverse search to previous vector. TODO: could be moved to UpdateCacheHelper structure
Definition at line 269 of file field_value_cache.hh.
|
protected |
Two dimensional array provides indexes to FieldValueCache.
1: Over elements holds in ElementCacheMap 2: Over EvalPoints for each element
Array is filled in those three steps: a. Reset - all items are set to ElementCacheMap::unused_point b. Used eval points are set to ElementCacheMap::point_in_proggress c. Eval points marked in previous step are sequentially numbered
Definition at line 296 of file field_value_cache.hh.
|
protected |
Vector of element indexes stored in cache. TODO: could be moved to UpdateCacheHelper structure
Definition at line 265 of file field_value_cache.hh.
|
protected |
Pointer to EvalPoints.
Definition at line 272 of file field_value_cache.hh.
|
static |
Number of cached elements which values are stored in cache.
Definition at line 116 of file field_value_cache.hh.
|
staticprotected |
Special constant (.
Definition at line 255 of file field_value_cache.hh.
|
protected |
Number of points stored in cache.
Definition at line 300 of file field_value_cache.hh.
|
protected |
Flag is set down during update of cache when this can't be read.
Definition at line 278 of file field_value_cache.hh.
|
static |
Index of invalid element in cache.
Definition at line 119 of file field_value_cache.hh.
|
staticprotected |
Special constant (.
Definition at line 252 of file field_value_cache.hh.
|
protected |
Holds data used for cache update.
Definition at line 275 of file field_value_cache.hh.