30 map_iterator it=ids.find(ipt);
38 void mesh_trans_inv::points_on_convex(
size_type cv,
39 std::vector<size_type> &itab)
const {
40 itab.resize(pts_cvx[cv].size());
size_type j = 0;
41 for (set_iterator it = pts_cvx[cv].begin(); it != pts_cvx[cv].end(); ++it)
46 set_iterator it = pts_cvx[cv].begin();
47 for (
size_type j = 0; it != pts_cvx[cv].end() && j < i; ++it, ++j) {}
48 GMM_ASSERT1(it != pts_cvx[cv].end(),
"internal error");
52 void mesh_trans_inv::distribute(
int extrapolation, mesh_region rg_source) {
54 rg_source.from_mesh(msh);
55 rg_source.error_if_not_convexes();
59 size_type nbcvx = msh.nb_allocated_convex();
60 ref_coords.resize(nbpts);
61 std::vector<double> dist(nbpts);
62 std::vector<size_type> cvx_pts(nbpts);
63 pts_cvx.clear(); pts_cvx.resize(nbcvx);
64 base_node min, max, pt_ref;
66 dal::bit_vector npt, cv_on_bound;
68 scalar_type
mult = scalar_type(1);
70 bool projection_into_element(extrapolation == 0);
73 for (dal::bv_visitor j(rg_source.index()); !j.finished(); ++j) {
74 if (mult > scalar_type(1) && !(cv_on_bound.is_in(j)))
continue;
76 bounding_box(min, max, msh.points_of_convex(j), pgt);
77 for (
size_type k=0; k < min.size(); ++k) { min[k]-=EPS; max[k]+=EPS; }
78 if (extrapolation == 2) {
79 if (mult == scalar_type(1))
80 for (
short_type f = 0; f < msh.nb_faces_of_convex(j); ++f) {
81 size_type neighbor_cv = msh.neighbor_of_convex(j, f);
82 if (!all_convexes && neighbor_cv !=
size_type(-1)) {
84 if (!rg_source.is_in(neighbor_cv))
90 if (cv_on_bound.is_in(j)) {
91 scalar_type h = scalar_type(0);
93 h = std::max(h, max[k] - min[k]);
98 points_in_box(boxpts, min, max);
100 if (boxpts.size() > 0) gic.init(msh.points_of_convex(j), pgt);
102 for (
size_type l = 0; l < boxpts.size(); ++l) {
104 if (npt[ind] || dist[ind] > 0) {
106 bool gicisin = gic.invert(boxpts[l].n, pt_ref, converged, EPS,
107 projection_into_element);
108 bool toadd = extrapolation || gicisin;
109 double isin = pgt->convex_ref()->is_in(pt_ref);
111 if (toadd && !(npt[ind])) {
112 if (isin < dist[ind]) pts_cvx[cvx_pts[ind]].erase(ind);
120 ref_coords[ind] = pt_ref;
121 dist[ind] = isin; cvx_pts[ind] = j;
122 pts_cvx[j].insert(ind);
128 mult *= scalar_type(2);
129 }
while (npt.card() > 0 && extrapolation == 2);
static mesh_region all_convexes()
provide a default value for the mesh_region parameters of assembly procedures etc.
Interpolation of fields from a mesh_fem onto another.
void mult(const L1 &l1, const L2 &l2, L3 &l3)
*/
std::vector< index_node_pair > kdtree_tab_type
store a set of points with associated indexes.
gmm::uint16_type short_type
used as the common short type integer in the library
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.