-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQPField.h
33 lines (25 loc) · 854 Bytes
/
QPField.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//
// Created by alhei on 2022/08/11.
//
#ifndef ALE_QPFIELD_H
#define ALE_QPFIELD_H
#include <array>
#include "StateFieldManager.h"
template <unsigned int dim, class type>
class QPField{
public:
QPField() {};
type get_field_value(unsigned int level, unsigned int el_id, unsigned int qp) const {return field.at({level, el_id, qp});};
void add_field_value(unsigned int level, unsigned int el_id, unsigned int qp, type value);
private:
unordered_map<array<unsigned int, 3>, type, array_hash> field;
};
template<unsigned int dim, class type>
void QPField<dim, type>::add_field_value(unsigned int level, unsigned int el_id, unsigned int qp, type value) {
array<unsigned int, 3> input{level, el_id, qp};
pair<array<unsigned int, 3>, type> p;
p.first=input;
p.second=value;
field.insert(p);
}
#endif //ALE_QPFIELD_H