getfem-commits
[Top][All Lists]
Advanced

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

[Getfem-commits] r5077 - in /trunk/getfem/src: ./ getfem/


From: Yves . Renard
Subject: [Getfem-commits] r5077 - in /trunk/getfem/src: ./ getfem/
Date: Wed, 02 Sep 2015 19:15:00 -0000

Author: renard
Date: Wed Sep  2 21:14:59 2015
New Revision: 5077

URL: http://svn.gna.org/viewcvs/getfem?rev=5077&view=rev
Log:
a tool for computing the jump of fem_level_set

Modified:
    trunk/getfem/src/getfem/dal_bit_vector.h
    trunk/getfem/src/getfem/getfem_fem.h
    trunk/getfem/src/getfem/getfem_fem_level_set.h
    trunk/getfem/src/getfem/getfem_level_set.h
    trunk/getfem/src/getfem_fem.cc
    trunk/getfem/src/getfem_fem_level_set.cc

Modified: trunk/getfem/src/getfem/dal_bit_vector.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/dal_bit_vector.h?rev=5077&r1=5076&r2=5077&view=diff
==============================================================================
--- trunk/getfem/src/getfem/dal_bit_vector.h    (original)
+++ trunk/getfem/src/getfem/dal_bit_vector.h    Wed Sep  2 21:14:59 2015
@@ -261,7 +261,7 @@
     size_type first_true(void) const;
     /// index of first zero entry (size_type(0) for an empty bit_vector)
     size_type first_false(void) const;
-      /// index of last non-zero entry (size_type(-1) for an empty bit_vector)
+    /// index of last non-zero entry (size_type(-1) for an empty bit_vector)
     size_type last_true(void) const;
     /// index of last zero entry (size_type(0) for an empty bit_vector)
     size_type last_false(void) const;

Modified: trunk/getfem/src/getfem/getfem_fem.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_fem.h?rev=5077&r1=5076&r2=5077&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_fem.h        (original)
+++ trunk/getfem/src/getfem/getfem_fem.h        Wed Sep  2 21:14:59 2015
@@ -685,6 +685,7 @@
     pfem_precomp pfp_;      // optional fem_precomp_ (speed up the 
computations)
     size_type convex_num_;  // The element (convex) number
     short_type face_num_;   // Face number for boundary integration
+    int xfem_side_; // For the computation of a jump with fem_level_set only
   public:
     /// true if a fem_precomp_ has been supplied.
     bool have_pfp() const { return pfp_ != 0; }
@@ -717,6 +718,8 @@
     pfem_precomp pfp() const { return pfp_; }
     void set_pfp(pfem_precomp newpfp);
     void set_pf(pfem newpf);
+    int xfem_side(void) const { return xfem_side_; }
+    void set_xfem_side(int side) { xfem_side_ = side; }
     fem_interpolation_context();
     fem_interpolation_context(bgeot::pgeotrans_precomp pgp__,
                               pfem_precomp pfp__, size_type ii__,

Modified: trunk/getfem/src/getfem/getfem_fem_level_set.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_fem_level_set.h?rev=5077&r1=5076&r2=5077&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_fem_level_set.h      (original)
+++ trunk/getfem/src/getfem/getfem_fem_level_set.h      Wed Sep  2 21:14:59 2015
@@ -79,7 +79,7 @@
     dal::bit_vector ls_index; /* lists only the significant level sets */
     std::string common_ls_zones;
     void find_zone_id(const fem_interpolation_context &c, 
-                     std::vector<bool> &ids) const;
+                     std::vector<bool> &ids, int side = 0) const;
   public:
     template <typename IT_LS_ENRICH>
     fem_level_set(IT_LS_ENRICH it, pfem pf, const mesh_level_set &mls_,

Modified: trunk/getfem/src/getfem/getfem_level_set.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_level_set.h?rev=5077&r1=5076&r2=5077&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_level_set.h  (original)
+++ trunk/getfem/src/getfem/getfem_level_set.h  Wed Sep  2 21:14:59 2015
@@ -60,14 +60,16 @@
     bool with_secondary;
     scalar_type shift_ls;     // for the computation of a gap on a level_set.
     // shift the level set on the ref element for mesher_level_set call
+    // Deprecated.
 
     void copy_from(const level_set &ls); // WARNING :  to be updated if
                                          //    some components are added 
 
   public :
 
-    void set_shift(scalar_type shift_ls_) { shift_ls = shift_ls_; }
-    scalar_type get_shift(void) const { return shift_ls; } 
+    void set_shift(scalar_type shift_ls_) // Deprecated
+    { shift_ls = shift_ls_; }
+    scalar_type get_shift(void) const { return shift_ls; }  // Deprecated
     void simplify(scalar_type eps = 0.01);
     void update_from_context(void) const { }
     void reinit(void);

Modified: trunk/getfem/src/getfem_fem.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_fem.cc?rev=5077&r1=5076&r2=5077&view=diff
==============================================================================
--- trunk/getfem/src/getfem_fem.cc      (original)
+++ trunk/getfem/src/getfem_fem.cc      Wed Sep  2 21:14:59 2015
@@ -186,25 +186,27 @@
 
   fem_interpolation_context::fem_interpolation_context() :
     bgeot::geotrans_interpolation_context(), pf_(0), pfp_(0), 
-    convex_num_(size_type(-1)), face_num_(short_type(-1)) {}
+    convex_num_(size_type(-1)), face_num_(short_type(-1)), xfem_side_(0) {}
   fem_interpolation_context::fem_interpolation_context
   (bgeot::pgeotrans_precomp pgp__, pfem_precomp pfp__, size_type ii__, 
    const base_matrix& G__, size_type convex_num__, short_type face_num__) : 
     bgeot::geotrans_interpolation_context(pgp__,ii__,G__), 
-    convex_num_(convex_num__), face_num_(face_num__) { set_pfp(pfp__); }
+    convex_num_(convex_num__), face_num_(face_num__), xfem_side_(0)
+    { set_pfp(pfp__); }
   fem_interpolation_context::fem_interpolation_context
   (bgeot::pgeometric_trans pgt__, pfem_precomp pfp__, size_type ii__, 
    const base_matrix& G__, size_type convex_num__, short_type face_num__) :
     bgeot::geotrans_interpolation_context(pgt__,&pfp__->get_point_tab(),
                                          ii__, G__),
-    convex_num_(convex_num__), face_num_(face_num__)
+    convex_num_(convex_num__), face_num_(face_num__), xfem_side_(0)
   { set_pfp(pfp__); }
   fem_interpolation_context::fem_interpolation_context(
    bgeot::pgeometric_trans pgt__, pfem pf__,
    const base_node& xref__,const base_matrix& G__, size_type convex_num__,
    short_type face_num__) :
     bgeot::geotrans_interpolation_context(pgt__,xref__,G__),
-    pf_(pf__), pfp_(0), convex_num_(convex_num__), face_num_(face_num__) {}
+    pf_(pf__), pfp_(0), convex_num_(convex_num__), face_num_(face_num__),
+    xfem_side_(0) {}
  
   void virtual_fem::real_base_value(const fem_interpolation_context &c, 
                                    base_tensor &t, bool withM) const

Modified: trunk/getfem/src/getfem_fem_level_set.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_fem_level_set.cc?rev=5077&r1=5076&r2=5077&view=diff
==============================================================================
--- trunk/getfem/src/getfem_fem_level_set.cc    (original)
+++ trunk/getfem/src/getfem_fem_level_set.cc    Wed Sep  2 21:14:59 2015
@@ -94,7 +94,7 @@
   }
 
   void fem_level_set::find_zone_id(const fem_interpolation_context &c, 
-                                  std::vector<bool> &ids) const {
+                                  std::vector<bool> &ids, int side) const {
     size_type s = 0, cv = c.convex_num();
     for (size_type i = 0; i < dofzones.size(); ++i)
       if (dofzones[i]) s += dofzones[i]->size();
@@ -104,17 +104,29 @@
     base_vector coeff(32);
     
     mesher_level_set eval;
+    size_type iclosest = size_type(-1); scalar_type vclosest = 1E100;
     for (dal::bv_visitor i(ls_index); !i.finished(); ++i) {
       const level_set *ls = mls.get_level_set(i);
       const mesh_fem &mf = ls->get_mesh_fem();
       slice_vector_on_basic_dof_of_element(mf, ls->values(), cv, coeff);
       eval.init_base(mf.fem_of_element(cv), coeff);
-      eval.set_shift(ls->get_shift());
+      eval.set_shift(ls->get_shift()); // Deprecated
 
       // mesher_level_set eval = mls.get_level_set(i)->mls_of_convex(cv);
+      
+
       scalar_type v = eval(c.xref());
-      z[(size_t)i] = (v > 0.) ? '+' : '-';
-    }
+      if (side != 0) {
+        if (gmm::abs(v) <  vclosest) { vclosest = gmm::abs(v); iclosest = i; }
+      }
+      z[size_type(i)] = (v > 0.) ? '+' : '-';
+    }
+
+    if (side != 0 && iclosest != size_type(-1)) // Forces the side of the
+                           // closest level-set (in order to compute jumps).
+      z[iclosest] = (side > 0) ? '+' : '-';
+
+
     unsigned cnt = 0;
     for (unsigned d = 0; d < dofzones.size(); ++d) {
       if (!dofzones[d]) continue;
@@ -143,7 +155,7 @@
     base_tensor::const_iterator itf = tt.begin();
 
     std::vector<bool> zid;
-    find_zone_id(c, zid);
+    find_zone_id(c, zid, c.xfem_side());
     for (dim_type q = 0; q < target_dim(); ++q) {
       unsigned cnt = 0;
       for (size_type d = 0; d < bfem->nb_dof(0); ++d, ++itf) {
@@ -172,7 +184,7 @@
     base_tensor::const_iterator itf = tt.begin();
 
     std::vector<bool> zid;
-    find_zone_id(c, zid);
+    find_zone_id(c, zid, c.xfem_side());
 
     for (dim_type i = 0; i < c.N() ; ++i) {
       for (dim_type q = 0; q < target_dim(); ++q) {
@@ -204,7 +216,7 @@
     base_tensor::const_iterator itf = tt.begin();
 
     std::vector<bool> zid;
-    find_zone_id(c, zid);
+    find_zone_id(c, zid, c.xfem_side());
 
     for (dim_type i = 0; i < c.N() ; ++i) {
       for (dim_type j = 0; j < c.N() ; ++j) {




reply via email to

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