52 #ifndef BGEOT_GEOTRANS_INV_H__
53 #define BGEOT_GEOTRANS_INV_H__
66 base_matrix G, pc, K, B, CS;
70 bool has_linearized_approx =
false;
71 base_matrix K_ref_B_transp_lin;
75 const base_matrix &get_G()
const {
return G; }
78 : N(0), P(0), pgt(0), EPS(e) {}
83 : N(0), P(0), pgt(0), EPS(e)
85 init(cv.points(), pgt_);
91 : N(0), P(0), pgt(0), EPS(e)
114 scalar_type IN_EPS=1e-12,
bool project_into_element=
false);
135 scalar_type IN_EPS=1e-12,
bool project_into_element=
false);
139 scalar_type IN_EPS,
bool &converged,
bool throw_except,
140 bool project_into_element);
142 void update_linearization();
144 friend class geotrans_inv_convex_bfgs;
149 bool geotrans_changed = (pgt != pgt_);
if (geotrans_changed) pgt = pgt_;
150 GMM_ASSERT3(!nodes.empty(),
"empty points!");
151 if (N != nodes[0].size())
152 { N = nodes[0].size(); geotrans_changed =
true; }
153 if (geotrans_changed) {
154 P = pgt->structure()->dim();
155 pc.resize(pgt->nb_points() , P);
156 K.resize(N,P); B.resize(N,P); CS.resize(P,P);
157 G.resize(N, pgt->nb_points());
159 vectors_to_base_matrix(G, nodes);
160 if (pgt->is_linear()) {
161 if (geotrans_changed) {
163 pgt->poly_vector_grad(Dummy, pc);
168 if (pgt->complexity() > 1)
169 update_linearization();
185 void clear(
void) { tree.
clear(); }
188 tree.reserve(std::distance(c.begin(),c.end()));
189 typename CONT::const_iterator it = c.begin(), ite = c.end();
190 for (; it != ite; ++it) tree.
add_point(*it);
204 tree.points_in_box(ipts, min, max);
230 template<
class TAB,
class CONT1,
class CONT2>
233 CONT1 &pftab, CONT2 &itab,
234 bool bruteforce=
false);
241 template<
class TAB,
class CONT1,
class CONT2>
244 CONT1 &pftab, CONT2 &itab,
249 bounding_box(min, max, cv.points(), pgt);
250 for (
size_type k=0; k < min.size(); ++k) { min[k] -= EPS; max[k] += EPS; }
251 gic.init(cv.points(),pgt);
254 else boxpts = tree.points();
257 for (
size_type l = 0; l < boxpts.size(); ++l) {
259 if (gic.
invert(boxpts[l].n, pftab[nbpt], EPS)) {
260 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 nb_points(void) const
Number 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 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