31 composite_approx_int_method(
const bgeot::mesh_precomposite &mp,
33 bgeot::pconvex_ref cr) {
34 auto p = std::make_shared<approx_integration>(cr);
36 for (dal::bv_visitor cv(mi.convex_index()); !cv.finished(); ++cv) {
37 pintegration_method pim = mi.int_method_of_element(cv);
39 if (pim->type() != IM_APPROX || !(pgt->is_linear())) {
40 GMM_ASSERT1(
false,
"Approx integration and linear transformation "
43 papprox_integration pai = pim->approx_method();
45 for (
size_type j = 0; j < pai->nb_points_on_convex(); ++j) {
46 base_node pt = pgt->transform((*(pim->pintegration_points()))[j],
47 mi.linked_mesh().points_of_convex(cv));
48 p->add_point(pt, pai->coeff(j) * gmm::abs(mp.det[cv]));
50 for (
short_type f = 0; f < pgt->structure()->nb_faces(); ++f) {
52 base_node barycentre = gmm::mean_value(mi.linked_mesh().points_of_face_of_convex(cv, f).begin(),
53 mi.linked_mesh().points_of_face_of_convex(cv, f).end());
55 for (
short_type f3 = 0; f3 < cr->structure()->nb_faces(); ++f3) {
56 if (gmm::abs(cr->is_in_face(f3, barycentre)) < 1.0E-7)
60 w.resize(gmm::mat_nrows(mp.gtransinv[cv]));
61 gmm::mult(mp.gtransinv[cv], pgt->normals()[f], w);
62 scalar_type coeff_mul = gmm::abs(gmm::vect_norm2(w) * mp.det[cv]);
63 for (
size_type j = 0; j < pai->nb_points_on_face(f); ++j) {
64 base_node pt = pgt->transform
65 (pai->point_on_face(f, j),
66 mi.linked_mesh().points_of_convex(cv));
67 p->add_point(pt, pai->coeff_on_face(f, j) * coeff_mul, f2);
77 typedef dal::naming_system<integration_method>::param_list im_param_list;
79 pintegration_method structured_composite_int_method(im_param_list ¶ms,
80 std::vector<dal::pstatic_stored_object> &dependencies) {
81 GMM_ASSERT1(params.size() == 2,
"Bad number of parameters : "
82 << params.size() <<
" should be 2.");
83 GMM_ASSERT1(params[0].type() == 1 && params[1].type() == 0,
84 "Bad type of parameters");
85 pintegration_method pim = params[0].method();
86 int k = int(::floor(params[1].num() + 0.01));
87 GMM_ASSERT1(pim->type() == IM_APPROX && k > 0 && k <= 500 &&
88 double(k) == params[1].num(),
"Bad parameters");
90 bgeot::pbasic_mesh pm;
91 bgeot::pmesh_precomposite pmp;
97 mi.set_integration_method(pm->convex_index(), pim);
100 p = std::make_shared<integration_method>
101 (composite_approx_int_method(*pmp, mi,
102 pim->approx_method()->ref_convex()));
103 dependencies.push_back(p->approx_method()->ref_convex());
104 dependencies.push_back(p->approx_method()->pintegration_points());
110 struct just_for_singleton_HCT__ { mesh m; bgeot::mesh_precomposite mp; };
112 pintegration_method HCT_composite_int_method(im_param_list ¶ms,
113 std::vector<dal::pstatic_stored_object> &dependencies) {
115 just_for_singleton_HCT__ &jfs
118 GMM_ASSERT1(params.size() == 1,
"Bad number of parameters : "
119 << params.size() <<
" should be 1.");
120 GMM_ASSERT1(params[0].type() == 1,
"Bad type of parameters");
121 pintegration_method pim = params[0].method();
122 GMM_ASSERT1(pim->type() == IM_APPROX,
"Bad parameters");
126 size_type i0 = jfs.m.add_point(base_node(1.0/3.0, 1.0/3.0));
127 size_type i1 = jfs.m.add_point(base_node(0.0, 0.0));
128 size_type i2 = jfs.m.add_point(base_node(1.0, 0.0));
129 size_type i3 = jfs.m.add_point(base_node(0.0, 1.0));
130 jfs.m.add_triangle(i0, i2, i3);
131 jfs.m.add_triangle(i0, i3, i1);
132 jfs.m.add_triangle(i0, i1, i2);
133 jfs.mp.initialise(jfs.m);
136 mi.set_integration_method(jfs.m.convex_index(), pim);
139 p = std::make_shared<integration_method>
140 (composite_approx_int_method(jfs.mp, mi,
141 pim->approx_method()->ref_convex()));
142 dependencies.push_back(p->approx_method()->ref_convex());
143 dependencies.push_back(p->approx_method()->pintegration_points());
148 struct just_for_singleton_QUADC1__ { mesh m; bgeot::mesh_precomposite mp; };
150 pintegration_method QUADC1_composite_int_method(im_param_list ¶ms,
151 std::vector<dal::pstatic_stored_object> &dependencies) {
153 just_for_singleton_QUADC1__ &jfs
156 GMM_ASSERT1(params.size() == 1,
"Bad number of parameters : "
157 << params.size() <<
" should be 1.");
158 GMM_ASSERT1(params[0].type() == 1,
"Bad type of parameters");
159 pintegration_method pim = params[0].method();
160 GMM_ASSERT1(pim->type() == IM_APPROX,
"Bad parameters");
163 size_type i0 = jfs.m.add_point(base_node(0.0, 0.0));
164 size_type i1 = jfs.m.add_point(base_node(1.0, 0.0));
165 size_type i2 = jfs.m.add_point(base_node(0.0, 1.0));
166 size_type i3 = jfs.m.add_point(base_node(1.0, 1.0));
167 size_type i4 = jfs.m.add_point(base_node(0.5, 0.5));
168 jfs.m.add_triangle(i1, i3, i4);
169 jfs.m.add_triangle(i2, i0, i4);
170 jfs.m.add_triangle(i3, i2, i4);
171 jfs.m.add_triangle(i0, i1, i4);
172 jfs.mp.initialise(jfs.m);
175 mi.set_integration_method(jfs.m.convex_index(), pim);
178 p = std::make_shared<integration_method>
179 (composite_approx_int_method(jfs.mp, mi,
181 dependencies.push_back(p->approx_method()->ref_convex());
182 dependencies.push_back(p->approx_method()->pintegration_points());
186 struct just_for_singleton_pyramidc__ { mesh m; bgeot::mesh_precomposite mp; };
188 pintegration_method pyramid_composite_int_method(im_param_list ¶ms,
189 std::vector<dal::pstatic_stored_object> &dependencies) {
191 just_for_singleton_pyramidc__ &jfs
194 GMM_ASSERT1(params.size() == 1,
"Bad number of parameters : "
195 << params.size() <<
" should be 1.");
196 GMM_ASSERT1(params[0].type() == 1,
"Bad type of parameters");
197 pintegration_method pim = params[0].method();
198 GMM_ASSERT1(pim->type() == IM_APPROX,
"Bad parameters");
201 size_type i0 = jfs.m.add_point(base_node(-1.0, -1.0, 0.0));
202 size_type i1 = jfs.m.add_point(base_node( 1.0, -1.0, 0.0));
203 size_type i2 = jfs.m.add_point(base_node(-1.0, 1.0, 0.0));
204 size_type i3 = jfs.m.add_point(base_node( 1.0, 1.0, 0.0));
205 size_type i4 = jfs.m.add_point(base_node( 0.0, 0.0, 1.0));
206 jfs.m.add_tetrahedron(i0, i1, i2, i4);
207 jfs.m.add_tetrahedron(i1, i3, i2, i4);
208 jfs.mp.initialise(jfs.m);
211 mi.set_integration_method(jfs.m.convex_index(), pim);
214 p = std::make_shared<integration_method>
215 (composite_approx_int_method(jfs.mp, mi,
217 dependencies.push_back(p->approx_method()->ref_convex());
218 dependencies.push_back(p->approx_method()->pintegration_points());