30 composite_approx_int_method(
const bgeot::mesh_precomposite &mp,
32 bgeot::pconvex_ref cr) {
33 auto p = std::make_shared<approx_integration>(cr);
35 for (dal::bv_visitor cv(mi.convex_index()); !cv.finished(); ++cv) {
36 pintegration_method pim = mi.int_method_of_element(cv);
38 if (pim->type() != IM_APPROX || !(pgt->is_linear())) {
39 GMM_ASSERT1(
false,
"Approx integration and linear transformation "
42 papprox_integration pai = pim->approx_method();
44 for (
size_type j = 0; j < pai->nb_points_on_convex(); ++j) {
45 base_node pt = pgt->transform((*(pim->pintegration_points()))[j],
46 mi.linked_mesh().points_of_convex(cv));
47 p->add_point(pt, pai->coeff(j) * gmm::abs(mp.det[cv]));
49 for (
short_type f = 0; f < pgt->structure()->nb_faces(); ++f) {
51 base_node barycentre = gmm::mean_value(mi.linked_mesh().points_of_face_of_convex(cv, f).begin(),
52 mi.linked_mesh().points_of_face_of_convex(cv, f).end());
54 for (
short_type f3 = 0; f3 < cr->structure()->nb_faces(); ++f3) {
55 if (gmm::abs(cr->is_in_face(f3, barycentre)) < 1.0E-7)
59 w.resize(gmm::mat_nrows(mp.gtransinv[cv]));
60 gmm::mult(mp.gtransinv[cv], pgt->normals()[f], w);
61 scalar_type coeff_mul = gmm::abs(gmm::vect_norm2(w) * mp.det[cv]);
62 for (
size_type j = 0; j < pai->nb_points_on_face(f); ++j) {
63 base_node pt = pgt->transform
64 (pai->point_on_face(f, j),
65 mi.linked_mesh().points_of_convex(cv));
66 p->add_point(pt, pai->coeff_on_face(f, j) * coeff_mul, f2);
76 typedef dal::naming_system<integration_method>::param_list im_param_list;
78 pintegration_method structured_composite_int_method(im_param_list ¶ms,
79 std::vector<dal::pstatic_stored_object> &dependencies) {
80 GMM_ASSERT1(params.size() == 2,
"Bad number of parameters : "
81 << params.size() <<
" should be 2.");
82 GMM_ASSERT1(params[0].type() == 1 && params[1].type() == 0,
83 "Bad type of parameters");
84 pintegration_method pim = params[0].method();
85 int k = int(::floor(params[1].num() + 0.01));
86 GMM_ASSERT1(pim->type() == IM_APPROX && k > 0 && k <= 500 &&
87 double(k) == params[1].num(),
"Bad parameters");
89 bgeot::pbasic_mesh pm;
90 bgeot::pmesh_precomposite pmp;
96 mi.set_integration_method(pm->convex_index(), pim);
99 p = std::make_shared<integration_method>
100 (composite_approx_int_method(*pmp, mi,
101 pim->approx_method()->ref_convex()));
102 dependencies.push_back(p->approx_method()->ref_convex());
103 dependencies.push_back(p->approx_method()->pintegration_points());
109 struct just_for_singleton_HCT__ { mesh m; bgeot::mesh_precomposite mp; };
111 pintegration_method HCT_composite_int_method(im_param_list ¶ms,
112 std::vector<dal::pstatic_stored_object> &dependencies) {
114 just_for_singleton_HCT__ &jfs
117 GMM_ASSERT1(params.size() == 1,
"Bad number of parameters : "
118 << params.size() <<
" should be 1.");
119 GMM_ASSERT1(params[0].type() == 1,
"Bad type of parameters");
120 pintegration_method pim = params[0].method();
121 GMM_ASSERT1(pim->type() == IM_APPROX,
"Bad parameters");
125 size_type i0 = jfs.m.add_point(base_node(1.0/3.0, 1.0/3.0));
126 size_type i1 = jfs.m.add_point(base_node(0.0, 0.0));
127 size_type i2 = jfs.m.add_point(base_node(1.0, 0.0));
128 size_type i3 = jfs.m.add_point(base_node(0.0, 1.0));
129 jfs.m.add_triangle(i0, i2, i3);
130 jfs.m.add_triangle(i0, i3, i1);
131 jfs.m.add_triangle(i0, i1, i2);
132 jfs.mp.initialise(jfs.m);
135 mi.set_integration_method(jfs.m.convex_index(), pim);
138 p = std::make_shared<integration_method>
139 (composite_approx_int_method(jfs.mp, mi,
140 pim->approx_method()->ref_convex()));
141 dependencies.push_back(p->approx_method()->ref_convex());
142 dependencies.push_back(p->approx_method()->pintegration_points());
147 struct just_for_singleton_QUADC1__ { mesh m; bgeot::mesh_precomposite mp; };
149 pintegration_method QUADC1_composite_int_method(im_param_list ¶ms,
150 std::vector<dal::pstatic_stored_object> &dependencies) {
152 just_for_singleton_QUADC1__ &jfs
155 GMM_ASSERT1(params.size() == 1,
"Bad number of parameters : "
156 << params.size() <<
" should be 1.");
157 GMM_ASSERT1(params[0].type() == 1,
"Bad type of parameters");
158 pintegration_method pim = params[0].method();
159 GMM_ASSERT1(pim->type() == IM_APPROX,
"Bad parameters");
162 size_type i0 = jfs.m.add_point(base_node(0.0, 0.0));
163 size_type i1 = jfs.m.add_point(base_node(1.0, 0.0));
164 size_type i2 = jfs.m.add_point(base_node(0.0, 1.0));
165 size_type i3 = jfs.m.add_point(base_node(1.0, 1.0));
166 size_type i4 = jfs.m.add_point(base_node(0.5, 0.5));
167 jfs.m.add_triangle(i1, i3, i4);
168 jfs.m.add_triangle(i2, i0, i4);
169 jfs.m.add_triangle(i3, i2, i4);
170 jfs.m.add_triangle(i0, i1, i4);
171 jfs.mp.initialise(jfs.m);
174 mi.set_integration_method(jfs.m.convex_index(), pim);
177 p = std::make_shared<integration_method>
178 (composite_approx_int_method(jfs.mp, mi,
180 dependencies.push_back(p->approx_method()->ref_convex());
181 dependencies.push_back(p->approx_method()->pintegration_points());
185 struct just_for_singleton_pyramidc__ { mesh m; bgeot::mesh_precomposite mp; };
187 pintegration_method pyramid_composite_int_method(im_param_list ¶ms,
188 std::vector<dal::pstatic_stored_object> &dependencies) {
190 just_for_singleton_pyramidc__ &jfs
193 GMM_ASSERT1(params.size() == 1,
"Bad number of parameters : "
194 << params.size() <<
" should be 1.");
195 GMM_ASSERT1(params[0].type() == 1,
"Bad type of parameters");
196 pintegration_method pim = params[0].method();
197 GMM_ASSERT1(pim->type() == IM_APPROX,
"Bad parameters");
200 size_type i0 = jfs.m.add_point(base_node(-1.0, -1.0, 0.0));
201 size_type i1 = jfs.m.add_point(base_node( 1.0, -1.0, 0.0));
202 size_type i2 = jfs.m.add_point(base_node(-1.0, 1.0, 0.0));
203 size_type i3 = jfs.m.add_point(base_node( 1.0, 1.0, 0.0));
204 size_type i4 = jfs.m.add_point(base_node( 0.0, 0.0, 1.0));
205 jfs.m.add_tetrahedron(i0, i1, i2, i4);
206 jfs.m.add_tetrahedron(i1, i3, i2, i4);
207 jfs.mp.initialise(jfs.m);
210 mi.set_integration_method(jfs.m.convex_index(), pim);
213 p = std::make_shared<integration_method>
214 (composite_approx_int_method(jfs.mp, mi,
216 dependencies.push_back(p->approx_method()->ref_convex());
217 dependencies.push_back(p->approx_method()->pintegration_points());
Handle composite polynomials.
static T & instance()
Instance from the current thread.
Integration methods (exact and approximated) on convexes.
Define the getfem::mesh_im class (integration of getfem::mesh_fem).
void mult(const L1 &l1, const L2 &l2, L3 &l3)
*/
gmm::uint16_type short_type
used as the common short type integer in the library
pconvex_ref pyramid_QK_of_reference(dim_type k)
pyramidal element of reference of degree k (k = 1 or 2 only)
void structured_mesh_for_convex(pconvex_ref cvr, short_type k, pbasic_mesh &pm, pmesh_precomposite &pmp, bool force_simplexification)
This function returns a mesh in pm which contains a refinement of the convex cvr if force_simplexific...
pconvex_ref parallelepiped_of_reference(dim_type nc, dim_type k)
parallelepiped of reference of dimension nc (and degree 1)
size_t size_type
used as the common size type in the library
std::shared_ptr< const bgeot::geometric_trans > pgeometric_trans
pointer type for a geometric transformation
GEneric Tool for Finite Element Methods.