40 #ifndef GETFEM_MAT_ELEM_H__
41 #define GETFEM_MAT_ELEM_H__
52 struct mat_elem_integration_callback {
57 std::vector<const bgeot::base_tensor*> eltm;
69 virtual void exec(bgeot::base_tensor &t,
bool first, scalar_type c) = 0;
70 virtual ~mat_elem_integration_callback() {}
83 mutable base_matrix pa;
87 virtual void compute(base_tensor &t,
const base_matrix &a,
89 mat_elem_integration_callback *icb = 0)
const = 0;
90 virtual void compute_on_face(base_tensor &t,
const base_matrix &a,
92 mat_elem_integration_callback *icb = 0)
102 template <
class CONT>
void
103 gen_compute(base_tensor &t,
const CONT &a,
size_type elt,
104 mat_elem_integration_callback *icb = 0)
const {
105 bgeot::vectors_to_base_matrix(pa, a);
106 compute(t, pa, elt, icb);
111 template <
class CONT>
void
112 gen_compute_on_face(base_tensor &t,
114 mat_elem_integration_callback *icb = 0)
const {
115 bgeot::vectors_to_base_matrix(pa, a);
116 compute_on_face(t, pa, f, elt, icb);
119 mat_elem_computation()
120 { DAL_STORED_OBJECT_DEBUG_CREATED(
this,
"Mat elem computation"); }
121 virtual ~mat_elem_computation()
122 { DAL_STORED_OBJECT_DEBUG_DESTROYED(
this,
"Mat elem computation"); }
126 typedef std::shared_ptr<const mat_elem_computation>
127 pmat_elem_computation;
135 pmat_elem_computation
mat_elem(pmat_elem_type pm,
136 pintegration_method pi,
138 bool prefer_comp_on_real_element=
false);
140 class mat_elem_pool {
141 std::set<pmat_elem_computation> mat_elems;
144 pmat_elem_computation operator()(pmat_elem_type pm,
145 pintegration_method pi,
147 bool prefer_comp_on_real_element=
false) {
148 pmat_elem_computation p=
mat_elem(pm, pi, pg, prefer_comp_on_real_element);
153 for (
auto it = mat_elems.begin(); it != mat_elems.end(); ++it)
157 ~mat_elem_pool() {
clear(); }