Flow123d
3.9.0-d39db4f
|
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, bool bdr=false) 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_ |
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... | |
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 bulk element_idx to element index in patch - TODO remove. More... | |
std::unordered_map< unsigned int, unsigned int > | element_to_map_bdr_ |
Maps boundary element_idx to element index in patch - TODO remove. More... | |
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 combined bulk and boundary elements, we must use mesh_idx value to correct identification of elements.
TODO:
Resulting simplifications:
Definition at line 151 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 173 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 239 of file field_value_cache.hh.
|
inline |
Return end position of element chunk in FieldValueCache.
Definition at line 245 of file field_value_cache.hh.
|
inline |
|
inline |
Return mesh_idx of element stored at given position of ElementCacheMap.
Definition at line 210 of file field_value_cache.hh.
|
inline |
Return item of eval_point_data_ specified by its position.
Definition at line 274 of file field_value_cache.hh.
|
inline |
Getter of eval_points object.
Definition at line 193 of file field_value_cache.hh.
void ElementCacheMap::finish_elements_update | ( | ) |
Finish update after reading data to cache.
Definition at line 121 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 280 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 234 of file field_value_cache.hh.
|
inline |
Return number of stored regions.
Definition at line 229 of file field_value_cache.hh.
|
inline |
Return position of element stored in ElementCacheMap.
Definition at line 215 of file field_value_cache.hh.
|
inline |
Return begin position of region chunk in FieldValueCache.
Definition at line 251 of file field_value_cache.hh.
|
inline |
Return begin position of region chunk specified by position in map.
Definition at line 263 of file field_value_cache.hh.
|
inline |
Return end position of region chunk in FieldValueCache.
Definition at line 257 of file field_value_cache.hh.
|
inline |
Return begin position of region chunk specified by position in map.
Definition at line 269 of file field_value_cache.hh.
|
inlineprotected |
Set item of element_eval_points_map_
.
Definition at line 300 of file field_value_cache.hh.
void ElementCacheMap::start_elements_update | ( | ) |
Start update of cache.
Definition at line 117 of file field_value_cache.cc.
|
friend |
Definition at line 351 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 334 of file field_value_cache.hh.
|
protected |
Start positions of elements in eval_point_data_ (size = n_elements+1)
Definition at line 343 of file field_value_cache.hh.
|
protected |
Maps bulk element_idx to element index in patch - TODO remove.
Definition at line 344 of file field_value_cache.hh.
|
protected |
Maps boundary element_idx to element index in patch - TODO remove.
Definition at line 345 of file field_value_cache.hh.
|
staticprotected |
Base number of stored elements in patch.
Definition at line 297 of file field_value_cache.hh.
|
protected |
Vector of element indexes stored in cache.
Definition at line 306 of file field_value_cache.hh.
|
protected |
Definition at line 337 of file field_value_cache.hh.
|
protected |
Pointer to EvalPoints.
Definition at line 309 of file field_value_cache.hh.
|
protected |
Flag is set down during update of cache when this can't be read.
Definition at line 312 of file field_value_cache.hh.
|
staticprotected |
Base number of stored regions in patch.
Definition at line 294 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 342 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 158 of file field_value_cache.hh.
|
static |
Index of invalid element in cache.
Definition at line 154 of file field_value_cache.hh.
|
staticprotected |
Special constant (.
Definition at line 291 of file field_value_cache.hh.