Flow123d
JS_before_hm-1598-g3b021b4
|
Directing class of FieldValueCache. More...
#include <field_value_cache.hh>
Public Member Functions | |
ElementCacheMap () | |
Constructor. More... | |
~ElementCacheMap () | |
Destructor. More... | |
void | init (std::shared_ptr< EvalPoints > eval_points) |
Init cache. More... | |
void | create_patch () |
Create patch of cached elements before reading data to cache. More... | |
void | clear_element_eval_points_map () |
Reset all items of elements_eval_points_map. More... | |
void | start_elements_update () |
Start update of cache. More... | |
void | finish_elements_update () |
Finish update after reading data to cache. More... | |
std::shared_ptr< EvalPoints > | eval_points () const |
Getter of eval_points object. More... | |
int | element_eval_point (unsigned int i_elem_in_cache, unsigned int i_eval_point) const |
unsigned int | elm_idx_on_position (unsigned pos) const |
Return mesh_idx of element stored at given position of ElementCacheMap. More... | |
unsigned int | position_in_cache (unsigned mesh_elm_idx) const |
Return position of element stored in ElementCacheMap. More... | |
unsigned int | n_regions () const |
Return number of stored regions. More... | |
unsigned int | n_elements () const |
Return number of stored elements. More... | |
unsigned int | element_chunk_begin (unsigned int elm_patch_idx) const |
Return begin position of element chunk in FieldValueCache. More... | |
unsigned int | element_chunk_end (unsigned int elm_patch_idx) const |
Return end position of element chunk in FieldValueCache. More... | |
unsigned int | region_chunk_begin (unsigned int region_patch_idx) const |
Return begin position of region chunk in FieldValueCache. More... | |
unsigned int | region_chunk_end (unsigned int region_patch_idx) const |
Return end position of region chunk in FieldValueCache. More... | |
unsigned int | region_chunk_by_map_index (unsigned int r_idx) const |
Return begin position of region chunk specified by position in map. More... | |
unsigned int | region_idx_from_chunk_position (unsigned int chunk_pos) const |
Return begin position of region chunk specified by position in map. More... | |
const EvalPointData & | eval_point_data (unsigned int point_idx) const |
Return item of eval_point_data_ specified by its position. More... | |
template<class Value > | |
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 from cache. More... | |
Static Public Attributes | |
static const unsigned int | undef_elem_idx = std::numeric_limits<unsigned int>::max() |
Index of invalid element in cache. More... | |
static const unsigned int | simd_size_double = 4 |
Protected Member Functions | |
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_ . More... | |
Protected Attributes | |
std::vector< unsigned int > | elm_idx_ |
Vector of element indexes stored in cache. More... | |
std::shared_ptr< EvalPoints > | eval_points_ |
Pointer to EvalPoints. 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_ |
Holds data of evaluating points in patch. More... | |
RevertableList< EvalPointData > | eval_point_data_ |
Holds start positions and orders of region chunks and element chunks | |
RevertableList< unsigned int > | regions_starts_ |
Start positions of elements in regions (size = n_regions+1, last value is end of last region) More... | |
RevertableList< unsigned int > | element_starts_ |
Start positions of elements in eval_point_data_ (size = n_elements+1) More... | |
std::unordered_map< unsigned int, unsigned int > | element_to_map_ |
Maps element_idx to element index in patch - TODO remove. More... | |
Static Protected Attributes | |
static const int | unused_point = -1 |
Special constant (. More... | |
static const unsigned int | regions_in_chunk = 3 |
Base number of stored regions in patch. More... | |
static const unsigned int | elements_in_chunk = 10 |
Base number of stored elements in patch. More... | |
Friends | |
template<template< IntDim... > class DimAssembly> | |
class | GenericAssembly |
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).
IMPORTANT: Because there are combuned bulk and boundary elements, we must use mesh_idx value to correct identification of elements.
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 141 of file field_value_cache.hh.
ElementCacheMap::ElementCacheMap | ( | ) |
Constructor.
Definition at line 36 of file field_value_cache.cc.
ElementCacheMap::~ElementCacheMap | ( | ) |
Destructor.
Definition at line 43 of file field_value_cache.cc.
|
inline |
Reset all items of elements_eval_points_map.
Definition at line 163 of file field_value_cache.hh.
void ElementCacheMap::create_patch | ( | ) |
Create patch of cached elements before reading data to cache.
Definition at line 60 of file field_value_cache.cc.
|
inline |
Return begin position of element chunk in FieldValueCache.
Definition at line 222 of file field_value_cache.hh.
|
inline |
Return end position of element chunk in FieldValueCache.
Definition at line 228 of file field_value_cache.hh.
|
inline |
Definition at line 194 of file field_value_cache.hh.
|
inline |
Return mesh_idx of element stored at given position of ElementCacheMap.
Definition at line 200 of file field_value_cache.hh.
|
inline |
Return item of eval_point_data_ specified by its position.
Definition at line 257 of file field_value_cache.hh.
|
inline |
Getter of eval_points object.
Definition at line 183 of file field_value_cache.hh.
void ElementCacheMap::finish_elements_update | ( | ) |
Finish update after reading data to cache.
Definition at line 114 of file field_value_cache.cc.
|
inline |
Return value of evaluation point given by idx of element in patch and local point idx in EvalPoints from cache.
Definition at line 263 of file field_value_cache.hh.
void ElementCacheMap::init | ( | std::shared_ptr< EvalPoints > | eval_points | ) |
Init cache.
Definition at line 50 of file field_value_cache.cc.
|
inline |
Return number of stored elements.
Definition at line 217 of file field_value_cache.hh.
|
inline |
Return number of stored regions.
Definition at line 212 of file field_value_cache.hh.
|
inline |
Return position of element stored in ElementCacheMap.
Definition at line 205 of file field_value_cache.hh.
|
inline |
Return begin position of region chunk in FieldValueCache.
Definition at line 234 of file field_value_cache.hh.
|
inline |
Return begin position of region chunk specified by position in map.
Definition at line 246 of file field_value_cache.hh.
|
inline |
Return end position of region chunk in FieldValueCache.
Definition at line 240 of file field_value_cache.hh.
|
inline |
Return begin position of region chunk specified by position in map.
Definition at line 252 of file field_value_cache.hh.
|
inlineprotected |
Set item of element_eval_points_map_
.
Definition at line 283 of file field_value_cache.hh.
void ElementCacheMap::start_elements_update | ( | ) |
Start update of cache.
Definition at line 110 of file field_value_cache.cc.
|
friend |
Definition at line 332 of file field_value_cache.hh.
|
protected |
Holds data of evaluating points in patch.
This array provides indexes to FieldValueCache.
This one dimensional array behaves like two dimensional factually. Size is set to 'n_cached_elements * n_eval_points' and items are accessible through two indices:
1: Over elements holds in ElementCacheMap 2: Over EvalPoints for each element
Use always and only methods element_eval_point
for read and set_element_eval_point
(for write) to access to items!
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
TODO improve description
Definition at line 317 of file field_value_cache.hh.
|
protected |
Start positions of elements in eval_point_data_ (size = n_elements+1)
Definition at line 326 of file field_value_cache.hh.
|
protected |
Maps element_idx to element index in patch - TODO remove.
Definition at line 327 of file field_value_cache.hh.
|
staticprotected |
Base number of stored elements in patch.
Definition at line 280 of file field_value_cache.hh.
|
protected |
Vector of element indexes stored in cache.
Definition at line 289 of file field_value_cache.hh.
|
protected |
Definition at line 320 of file field_value_cache.hh.
|
protected |
Pointer to EvalPoints.
Definition at line 292 of file field_value_cache.hh.
|
protected |
Flag is set down during update of cache when this can't be read.
Definition at line 295 of file field_value_cache.hh.
|
staticprotected |
Base number of stored regions in patch.
Definition at line 277 of file field_value_cache.hh.
|
protected |
Start positions of elements in regions (size = n_regions+1, last value is end of last region)
Definition at line 325 of file field_value_cache.hh.
|
static |
Size of block (evaluation of FieldFormula) must be multiple of this value. TODO We should take this value from BParser and it should be dependent on processor configuration.
Definition at line 148 of file field_value_cache.hh.
|
static |
Index of invalid element in cache.
Definition at line 144 of file field_value_cache.hh.
|
staticprotected |
Special constant (.
Definition at line 274 of file field_value_cache.hh.