getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] (no subject)


From: Markus Bürg
Subject: [Getfem-commits] (no subject)
Date: Mon, 3 Jun 2019 11:40:12 -0400 (EDT)

branch: mb-Use_rtree_in_poly_composite
commit e3e5d9d213b68b9ea50bf861bbe5bdd27346959d
Author: mb <address@hidden>
Date:   Mon May 27 13:55:19 2019 +0200

    Have to loop over all possible candidates.
---
 src/getfem_fem_global_function.cc | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/getfem_fem_global_function.cc 
b/src/getfem_fem_global_function.cc
index e97e96e..22ee47d 100644
--- a/src/getfem_fem_global_function.cc
+++ b/src/getfem_fem_global_function.cc
@@ -82,14 +82,14 @@ namespace getfem {
 
     size_type nb_total_dof(functions.size());
     base_node bmin(dim()), bmax(dim());
-    bgeot::rtree boxtree;
+    bgeot::rtree boxtree{1E-13};
+    std::map<size_type, std::vector<size_type>> box_to_convexes_map;
     for (size_type i=0; i < nb_total_dof; ++i) {
       functions[i]->bounding_box(bmin, bmax);
-      boxtree.add_box(bmin, bmax, i);
+      box_to_convexes_map[boxtree.add_box(bmin, bmax, i)].push_back(i);
     }
     boxtree.build_tree();
 
-    scalar_type EPS=1E-13;
     size_type max_dof(0);
     index_of_global_dof_.clear();
     index_of_global_dof_.resize(m.nb_allocated_convex());
@@ -99,8 +99,6 @@ namespace getfem {
       bgeot::pgeometric_trans pgt = m.trans_of_convex(cv);
 
       bounding_box(bmin, bmax, m.points_of_convex(cv), pgt);
-      for (auto&& xx : bmin) xx -= EPS;
-      for (auto&& xx : bmax) xx += EPS;
 
       bgeot::rtree::pbox_set boxlst;
       boxtree.find_intersecting_boxes(bmin, bmax, boxlst);
@@ -113,18 +111,22 @@ namespace getfem {
         papprox_integration pai = pim->approx_method();
 
         for (const auto &box : boxlst) {
-          for (size_type k = 0; k < pai->nb_points(); ++k) {
-            base_node gpt = pgt->transform(pai->point(k),
-                                           m.points_of_convex(cv));
-            if (functions[box->id]->is_in_support(gpt)) {
-              index_of_global_dof_[cv].push_back(box->id);
-              break;
+          for (auto candidate : box_to_convexes_map.at(box->id)) {
+            for (size_type k = 0; k < pai->nb_points(); ++k) {
+              base_node gpt = pgt->transform(pai->point(k),
+                                             m.points_of_convex(cv));
+              if (functions[candidate]->is_in_support(gpt)) {
+                index_of_global_dof_[cv].push_back(candidate);
+                break;
+              }
             }
           }
         }
       } else { // !has_mesh_im
-        for (const auto &box : boxlst)
-          index_of_global_dof_[cv].push_back(box->id);
+        for (const auto &box : boxlst) {
+          for (auto candidate : box_to_convexes_map.at(box->id))
+            index_of_global_dof_[cv].push_back(candidate);
+        }
       }
       max_dof = std::max(max_dof, index_of_global_dof_[cv].size());
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]