93 #ifndef GETFEM_INTEGRATION_H__
94 #define GETFEM_INTEGRATION_H__
117 mutable std::vector<long_scalar_type> int_monomials;
118 mutable std::vector< std::vector<long_scalar_type> > int_face_monomials;
123 dim_type
dim(
void)
const {
return cvs->dim(); }
133 long_scalar_type
int_poly(
const base_poly &P)
const;
144 typedef std::shared_ptr<const poly_integration> ppoly_integration;
152 class integration_method;
153 typedef std::shared_ptr<const integration_method> pintegration_method;
156 class approx_integration {
160 bgeot::pconvex_ref cvr;
161 bgeot::pstored_point_tab pint_points;
162 std::vector<scalar_type> int_coeffs;
163 std::vector<size_type> repartition;
166 std::vector<PT_TAB> pt_to_store;
168 bool built_on_the_fly;
173 dim_type dim(
void)
const {
return cvr->structure()->dim(); }
174 size_type nb_points(
void)
const {
return int_coeffs.size(); }
176 size_type nb_points_on_convex(
void)
const {
return repartition[0]; }
179 {
return repartition[f+1] - repartition[f]; }
181 {
return repartition[f]; }
184 {
return cvr->structure()->nb_faces(); }
185 bool is_built_on_the_fly(
void)
const {
return built_on_the_fly; }
186 void set_built_on_the_fly(
void) { built_on_the_fly =
true; }
190 bgeot::pconvex_ref ref_convex(
void)
const {
return cvr; }
192 const std::vector<size_type> &repart(
void)
const {
return repartition; }
197 bgeot::pstored_point_tab pintegration_points(
void)
const
198 {
return pint_points; }
200 const base_node &point(
size_type i)
const
201 {
return (*pint_points)[i]; }
205 {
return (*pint_points)[repartition[f] + i]; }
207 const std::vector<scalar_type> &integration_coefficients(
void)
const
208 {
return int_coeffs; }
210 scalar_type coeff(
size_type i)
const {
return int_coeffs[i]; }
213 {
return int_coeffs[repartition[f] + i]; }
215 void add_point(
const base_node &pt, scalar_type w,
217 bool include_empty =
false);
218 void add_point_norepeat(
const base_node &pt, scalar_type w,
220 void add_point_full_symmetric(base_node pt, scalar_type w);
221 void add_method_on_face(pintegration_method ppi,
short_type f);
222 void valid_method(
void);
224 approx_integration(
void) : valid(false), built_on_the_fly(false) { }
225 approx_integration(bgeot::pconvex_ref cr)
226 : cvr(cr), repartition(cr->structure()->nb_faces()+1),
227 pt_to_store(cr->structure()->nb_faces()+1), valid(false),
228 built_on_the_fly(false)
229 { std::fill(repartition.begin(), repartition.end(), 0); }
230 virtual ~approx_integration() {}
233 typedef std::shared_ptr<const approx_integration> papprox_integration;
245 ppoly_integration ppi;
246 papprox_integration pai;
248 void remove() { pai = papprox_integration(); ppi = ppoly_integration(); }
252 const papprox_integration &approx_method(
void)
const {
return pai; }
253 const ppoly_integration &exact_method(
void)
const {
return ppi; }
255 void set_approx_method(papprox_integration paii)
256 { remove(); pai = paii; im_type = IM_APPROX; }
257 void set_exact_method(ppoly_integration ppii)
258 { remove(); ppi = ppii; im_type = IM_EXACT; }
260 bgeot::pstored_point_tab pintegration_points(
void)
const {
261 if (type() == IM_EXACT) {
263 std::vector<base_node> spt(1); spt[0] = base_node(n);
264 return store_point_tab(spt);
266 else if (type() == IM_APPROX)
267 return pai->pintegration_points();
268 else GMM_ASSERT1(
false,
"IM_NONE has no points");
276 case IM_EXACT:
return ppi->structure();
277 case IM_APPROX:
return pai->structure();
278 case IM_NONE: GMM_ASSERT1(
false,
"IM_NONE has no structure");
279 default: GMM_ASSERT3(
false,
"");
285 DAL_STORED_OBJECT_DEBUG_CREATED(
this,
"Exact integration method");
286 ppi = p; im_type = IM_EXACT;
290 DAL_STORED_OBJECT_DEBUG_CREATED(
this,
"Approximate integration method");
291 pai = p; im_type = IM_APPROX;
295 DAL_STORED_OBJECT_DEBUG_CREATED(
this,
"Integration method");
300 { DAL_STORED_OBJECT_DEBUG_DESTROYED(
this,
"Integration method"); }
312 bool throw_if_not_found =
true);
340 pintegration_method
im_none(
void);
344 papprox_integration composite_approx_int_method(
const bgeot::mesh_precomposite &mp,
346 bgeot::pconvex_ref cr);
350 scalar_type test_integration_error(papprox_integration pim, dim_type order);
352 papprox_integration get_approx_im_or_fail(pintegration_method pim);
357 typedef dal::naming_system<integration_method>::param_list im_param_list;
359 void add_integration_name(std::string name,