51 #ifndef BGEOT_GEOTRANS_INV_H__
52 #define BGEOT_GEOTRANS_INV_H__
65 base_matrix G, pc, K, B, CS;
69 bool has_linearized_approx =
false;
70 base_matrix K_ref_B_transp_lin;
74 const base_matrix &get_G()
const {
return G; }
77 : N(0), P(0), pgt(0), EPS(e) {}
82 : N(0), P(0), pgt(0), EPS(e)
84 init(cv.points(), pgt_);
90 : N(0), P(0), pgt(0), EPS(e)
113 scalar_type IN_EPS=1e-12,
bool project_into_element=
false);
134 scalar_type IN_EPS=1e-12,
bool project_into_element=
false);
138 scalar_type IN_EPS,
bool &converged,
bool throw_except,
139 bool project_into_element);
141 void update_linearization();
143 friend class geotrans_inv_convex_bfgs;
148 bool geotrans_changed = (pgt != pgt_);
if (geotrans_changed) pgt = pgt_;
149 GMM_ASSERT3(!nodes.empty(),
"empty points!");
150 if (N != nodes[0].size())
151 { N = nodes[0].size(); geotrans_changed =
true; }
152 if (geotrans_changed) {
153 P = pgt->structure()->dim();
154 pc.resize(pgt->nb_points() , P);
158 G.resize(N, pgt->nb_points());
160 vectors_to_base_matrix(G, nodes);
161 if (pgt->is_linear()) {
162 if (geotrans_changed) {
164 pgt->poly_vector_grad(Dummy, pc);
168 }
else if (pgt->complexity() > 1)
169 update_linearization();
184 void clear() { tree.
clear(); }
187 tree.reserve(std::distance(c.begin(),c.end()));
188 typename CONT::const_iterator it = c.begin(), ite = c.end();
189 for (; it != ite; ++it) tree.
add_point(*it);
203 tree.points_in_box(ipts, min, max);
229 template<
class TAB,
class CONT1,
class CONT2>
232 CONT1 &pftab, CONT2 &itab,
233 bool bruteforce=
false);
240 template<
class TAB,
class CONT1,
class CONT2>
243 CONT1 &pftab, CONT2 &itab,
248 bounding_box(min, max, cv.points(), pgt);
249 for (
size_type k=0; k < min.size(); ++k) { min[k] -= EPS; max[k] += EPS; }
250 gic.init(cv.points(),pgt);
253 else boxpts = tree.points();
256 for (
size_type l = 0; l < boxpts.size(); ++l) {
258 if (gic.
invert(boxpts[l].n, pftab[nbpt], EPS)) {
259 itab[nbpt++] = boxpts[l].i;
Geometric transformations on convexes.
Simple implementation of a KD-tree.
generic definition of a convex ( bgeot::convex_structure + vertices coordinates )
does the inversion of the geometric transformation for a given convex
bool invert(const base_node &n, base_node &n_ref, scalar_type IN_EPS=1e-12, bool project_into_element=false)
given the node on the real element, returns the node on the reference element (even if it is outside ...
handles the geometric inversion for a given (supposedly quite large) set of points
void add_points(const CONT &c)
Add the points contained in c to the list of points.
size_type points_in_box(kdtree_tab_type &ipts, const base_node &min, const base_node &max) const
Find all the points present in the box between min and max.
size_type nb_points() const
Number of points.
size_type add_point(base_node p)
Add point p to the list of points.
size_type points_in_convex(const convex< base_node, TAB > &cv, pgeometric_trans pgt, CONT1 &pftab, CONT2 &itab, bool bruteforce=false)
Search all the points in the convex cv, which is the transformation of the convex cref via the geomet...
Balanced tree over a set of points.
void add_point_with_id(const base_node &n, size_type i)
insert a new point, with an associated number.
size_type add_point(const base_node &n)
insert a new point
void clear()
reset the tree, remove all points
std::vector< index_node_pair > kdtree_tab_type
store a set of points with associated indexes.
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