getfem-commits
[Top][All Lists]
Advanced

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

[Getfem-commits] (no subject)


From: Konstantinos Poulios
Subject: [Getfem-commits] (no subject)
Date: Sat, 14 Jul 2018 02:00:09 -0400 (EDT)

branch: code-cleanup
commit 73ae4aa65f164bb898c1b8e01e16e1d45021bbb6
Author: Konstantinos Poulios <address@hidden>
Date:   Sat Jul 14 07:59:14 2018 +0200

    Revert "Remove unused mesh_region option"
    
    This reverts commit 7328044c3602778db98e108c4ad881d4bbb4ac02.
---
 src/getfem/getfem_mesh_region.h | 11 ++++++++---
 src/getfem_mesh_region.cc       | 22 +++++++++++++---------
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/getfem/getfem_mesh_region.h b/src/getfem/getfem_mesh_region.h
index abbee46..d930a7d 100644
--- a/src/getfem/getfem_mesh_region.h
+++ b/src/getfem/getfem_mesh_region.h
@@ -92,9 +92,10 @@ namespace getfem {
     std::shared_ptr<impl> p;  /* the real region data */
     // #endif
 
-    size_type id_;     /* used temporarily when the 
-                          mesh_region(size_type) constructor is used */
+    size_type id_;            /* used temporarily when the 
+                                mesh_region(size_type) constructor is used */
 
+    size_type type_; //optional type of the region
     omp_distribute<bool> partitioning_allowed; /** specifies that in
                           multithreaded code only a partition of the
                           region is visible in index() and size() methods,
@@ -144,7 +145,7 @@ namespace getfem {
     mesh_region(size_type id__);
 
     /** internal constructor. You should used m.region(id) instead. */
-    mesh_region(mesh& m, size_type id__);
+    mesh_region(mesh& m, size_type id__, size_type type = size_type(-1));
     /** build a mesh_region from a convex list stored in a bit_vector. */
     mesh_region(const dal::bit_vector &bv);
 
@@ -171,6 +172,10 @@ namespace getfem {
 
     size_type id() const { return id_; }
 
+    size_type get_type() const { return type_; }
+
+    void  set_type(size_type type)  { type_ = type; }
+
     /** In multithreaded part of the program makes only a partition of the 
     region visible in the index() and size() operations, as well as during 
     iterations with mr_visitor. This is a default behaviour*/
diff --git a/src/getfem_mesh_region.cc b/src/getfem_mesh_region.cc
index 15c3590..11ebfdc 100644
--- a/src/getfem_mesh_region.cc
+++ b/src/getfem_mesh_region.cc
@@ -34,26 +34,26 @@ namespace getfem {
   }
 
 
-  mesh_region::mesh_region()
-    : p(std::make_shared<impl>()), id_(size_type(-2)),
-      partitioning_allowed(true), parent_mesh(0), index_updated(false)
+  mesh_region::mesh_region() : p(std::make_shared<impl>()), id_(size_type(-2)),
+                              type_(size_type(-1)),
+    partitioning_allowed(true), parent_mesh(0), index_updated(false)
   { 
     if (me_is_multithreaded_now()) prohibit_partitioning();
   }
 
-  mesh_region::mesh_region(size_type id__)
-    : id_(id__), partitioning_allowed(true), parent_mesh(0), 
index_updated(false)
+  mesh_region::mesh_region(size_type id__) : id_(id__), type_(size_type(-1)),
+    partitioning_allowed(true), parent_mesh(0), index_updated(false)
   { }
 
-  mesh_region::mesh_region(mesh& m, size_type id__)
-    : p(std::make_shared<impl>()), id_(id__), partitioning_allowed(true),
-      parent_mesh(&m), index_updated(false)
+  mesh_region::mesh_region(mesh& m, size_type id__, size_type type) : 
+    p(std::make_shared<impl>()), id_(id__), type_(type), 
partitioning_allowed(true), parent_mesh(&m),
+    index_updated(false)
   { 
     if (me_is_multithreaded_now()) prohibit_partitioning();  
   }
 
   mesh_region::mesh_region(const dal::bit_vector &bv) : 
-    p(std::make_shared<impl>()), id_(size_type(-2)),
+    p(std::make_shared<impl>()), id_(size_type(-2)), type_(size_type(-1)),
     partitioning_allowed(true), parent_mesh(0), index_updated(false)
   { 
     if (me_is_multithreaded_now()) prohibit_partitioning();  
@@ -89,6 +89,7 @@ namespace getfem {
     if (!this->parent_mesh && !from.parent_mesh)
     {
       this->id_ = from.id_;
+      this->type_ = from.type_;
       this->partitioning_allowed = from.partitioning_allowed;
       if (from.p.get()) {
         if (!this->p.get()) this->p = std::make_shared<impl>();
@@ -100,6 +101,7 @@ namespace getfem {
     else if (!this->parent_mesh) {
       this->p = from.p;
       this->id_ = from.id_;
+      this->type_ = from.type_;
       this->parent_mesh = from.parent_mesh;
       this->partitioning_allowed = from.partitioning_allowed;
     }
@@ -107,11 +109,13 @@ namespace getfem {
       if (from.p.get())
       {
         this->wp() = from.rp();
+        this->type_= from.get_type();
         this->partitioning_allowed = from.partitioning_allowed;
       }
       else if (from.id_ == size_type(-1)) {
         this->clear();
         this->add(this->parent_mesh->convex_index());
+        this->type_ = size_type(-1);
         this->partitioning_allowed = true;
       }
       touch_parent_mesh();



reply via email to

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