Flow123d
master-1d42d53
|
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... | |
void | add_eval_point (unsigned int i_reg, unsigned int i_ele, unsigned int i_eval_point, unsigned int dh_loc_idx) |
unsigned int | get_simd_rounded_size () |
Returns number of eval. points with addition of max simd duplicates due to regions. 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... | |
Public Attributes | |
unsigned int | simd_size_double |
Static Public Attributes | |
static const unsigned int | undef_elem_idx = std::numeric_limits<unsigned int>::max() |
Index of invalid element in cache. More... | |
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... | |
std::unordered_set< unsigned int > | set_of_regions_ |
Keeps set of unique region indices of added eval. points. More... | |
template<template< IntDim... > class DimAssembly> | |
class | GenericAssembly |
template<template< IntDim... > class DimAssembly> | |
class | GenericAssemblyObserve |
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 152 of file field_value_cache.hh.
ElementCacheMap::ElementCacheMap | ( | ) |
Constructor.
Definition at line 37 of file field_value_cache.cc.
ElementCacheMap::~ElementCacheMap | ( | ) |
Destructor.
Definition at line 44 of file field_value_cache.cc.
|
inline |
Adds EvalPointData using emplace_back. Arguments correspond to constructor of EvalPointData.
Definition at line 197 of file field_value_cache.hh.
|
inline |
Reset all items of elements_eval_points_map.
Definition at line 170 of file field_value_cache.hh.
void ElementCacheMap::create_patch | ( | ) |
Create patch of cached elements before reading data to cache.
Definition at line 61 of file field_value_cache.cc.
|
inline |
Return begin position of element chunk in FieldValueCache.
Definition at line 251 of file field_value_cache.hh.
|
inline |
Return end position of element chunk in FieldValueCache.
Definition at line 257 of file field_value_cache.hh.
|
inline |
|
inline |
Return mesh_idx of element stored at given position of ElementCacheMap.
Definition at line 222 of file field_value_cache.hh.
|
inline |
Return item of eval_point_data_ specified by its position.
Definition at line 286 of file field_value_cache.hh.
|
inline |
Getter of eval_points object.
Definition at line 190 of file field_value_cache.hh.
void ElementCacheMap::finish_elements_update | ( | ) |
Finish update after reading data to cache.
Definition at line 123 of file field_value_cache.cc.
|
inline |
Returns number of eval. points with addition of max simd duplicates due to regions.
Definition at line 204 of file field_value_cache.hh.
|
inline |
Return value of evaluation point given by idx of element in patch and local point idx in EvalPoints from cache.
Definition at line 292 of file field_value_cache.hh.
void ElementCacheMap::init | ( | std::shared_ptr< EvalPoints > | eval_points | ) |
Init cache.
Definition at line 51 of file field_value_cache.cc.
|
inline |
Return number of stored elements.
Definition at line 246 of file field_value_cache.hh.
|
inline |
Return number of stored regions.
Definition at line 241 of file field_value_cache.hh.
|
inline |
Return position of element stored in ElementCacheMap.
Definition at line 227 of file field_value_cache.hh.
|
inline |
Return begin position of region chunk in FieldValueCache.
Definition at line 263 of file field_value_cache.hh.
|
inline |
Return begin position of region chunk specified by position in map.
Definition at line 275 of file field_value_cache.hh.
|
inline |
Return end position of region chunk in FieldValueCache.
Definition at line 269 of file field_value_cache.hh.
|
inline |
Return begin position of region chunk specified by position in map.
Definition at line 281 of file field_value_cache.hh.
|
inlineprotected |
Set item of element_eval_points_map_
.
Definition at line 316 of file field_value_cache.hh.
void ElementCacheMap::start_elements_update | ( | ) |
Start update of cache.
Definition at line 119 of file field_value_cache.cc.
|
friend |
Definition at line 371 of file field_value_cache.hh.
|
friend |
Definition at line 373 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 351 of file field_value_cache.hh.
|
protected |
Start positions of elements in eval_point_data_ (size = n_elements+1)
Definition at line 360 of file field_value_cache.hh.
|
protected |
Maps bulk element_idx to element index in patch - TODO remove.
Definition at line 361 of file field_value_cache.hh.
|
protected |
Maps boundary element_idx to element index in patch - TODO remove.
Definition at line 362 of file field_value_cache.hh.
|
staticprotected |
Base number of stored elements in patch.
Definition at line 313 of file field_value_cache.hh.
|
protected |
Vector of element indexes stored in cache.
Definition at line 323 of file field_value_cache.hh.
|
protected |
Definition at line 354 of file field_value_cache.hh.
|
protected |
Pointer to EvalPoints.
Definition at line 326 of file field_value_cache.hh.
|
protected |
Flag is set down during update of cache when this can't be read.
Definition at line 329 of file field_value_cache.hh.
|
staticprotected |
Base number of stored regions in patch.
Definition at line 310 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 359 of file field_value_cache.hh.
|
protected |
Keeps set of unique region indices of added eval. points.
Definition at line 367 of file field_value_cache.hh.
unsigned int ElementCacheMap::simd_size_double |
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 303 of file field_value_cache.hh.
|
static |
Index of invalid element in cache.
Definition at line 155 of file field_value_cache.hh.
|
staticprotected |
Special constant (.
Definition at line 307 of file field_value_cache.hh.