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: Thu, 31 Aug 2017 06:19:23 -0400 (EDT)

branch: mb-transInversion
commit 142c75927af437af103cadf244764eb8156d42c4
Author: mb <address@hidden>
Date:   Thu Aug 31 12:17:11 2017 +0200

    Add flag for projection into convex.
---
 src/bgeot_geotrans_inv.cc       |  6 ++++--
 src/getfem/bgeot_geotrans_inv.h | 35 +++++++++++++++++++++++++++--------
 2 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/src/bgeot_geotrans_inv.cc b/src/bgeot_geotrans_inv.cc
index 3a6e4de..1ac7d60 100644
--- a/src/bgeot_geotrans_inv.cc
+++ b/src/bgeot_geotrans_inv.cc
@@ -271,7 +271,9 @@ vector<size_type> get_linear_nodes_indices(
   return indices;
 }
 
-void project_into_convex(base_node &x, pgeometric_trans &pgeo_trans) {
+void project_into_convex(base_node &x, const geometric_trans *pgeo_trans, bool 
project) {
+  if (project == false) return;
+
   auto dim = pgeo_trans->dim();
 
   for (auto d = 0; d < dim; ++d) {
@@ -338,7 +340,7 @@ vector<size_type> get_linear_nodes_indices(pgeometric_trans 
pgt) {
       update_B();
       mult(transposed(B), nonlinear_storage.diff, nonlinear_storage.x_ref);
       add(scaled(nonlinear_storage.x_ref, -1.0), x);
-      project_into_convex(x, nonlinear_storage.plinear_inversion->pgt);
+      project_into_convex(x, pgt.get(), 
nonlinear_storage.project_into_element);
       nonlinear_storage.x_real = pgt->transform(x, G);
       add(nonlinear_storage.x_real, scaled(xreal, -1.0), 
nonlinear_storage.diff);
       res0 = res;
diff --git a/src/getfem/bgeot_geotrans_inv.h b/src/getfem/bgeot_geotrans_inv.h
index c7d674f..00fff23 100644
--- a/src/getfem/bgeot_geotrans_inv.h
+++ b/src/getfem/bgeot_geotrans_inv.h
@@ -63,6 +63,7 @@ namespace bgeot {
     base_node diff;
     base_node x_real;
     base_node x_ref;
+    bool project_into_element;
     std::shared_ptr<geotrans_inv_convex> plinear_inversion;
   };
   /** 
@@ -75,14 +76,32 @@ namespace bgeot {
     scalar_type EPS;
   public:
     const base_matrix &get_G() const { return G; }
-    geotrans_inv_convex(scalar_type e=10e-12) : N(0), P(0), pgt(0), EPS(e) {};
-    template<class TAB> geotrans_inv_convex(const convex<base_node, TAB> &cv,
-                                           pgeometric_trans pgt_, 
-                                            scalar_type e=10e-12)
-      : N(0), P(0), pgt(0), EPS(e) { init(cv.points(),pgt_); }
-    geotrans_inv_convex(const std::vector<base_node> &nodes,
-                       pgeometric_trans pgt_, scalar_type e=10e-12)
-      : N(0), P(0), pgt(0), EPS(e) { init(nodes,pgt_); }
+    geotrans_inv_convex(scalar_type e=10e-12, bool project_into_element = 
false) :
+      N(0), P(0), pgt(0), EPS(e)
+    {
+      nonlinear_storage.project_into_element = project_into_element;
+    };
+
+    template<class TAB> geotrans_inv_convex(
+      const convex<base_node, TAB> &cv,
+         pgeometric_trans pgt_, 
+      scalar_type e=10e-12,
+      bool project_into_element = false) : N(0), P(0), pgt(0), EPS(e)
+   {
+     nonlinear_storage.project_into_element = project_into_element;
+     init(cv.points(),pgt_);
+    }
+
+    geotrans_inv_convex(
+      const std::vector<base_node> &nodes,
+      pgeometric_trans pgt_,
+      scalar_type e=10e-12,
+      bool project_into_element = false) : N(0), P(0), pgt(0), EPS(e)
+    {
+      nonlinear_storage.project_into_element = project_into_element;
+      init(nodes,pgt_);
+    }
+
     template<class TAB> void init(const TAB &nodes, pgeometric_trans pgt_);
     
     /**



reply via email to

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