[Getfem-commits] [getfem-commits] branch cleanup-mesh-import created (now 69884dd4)

2023-08-02 Thread Konstantinos Poulios via Getfem-commits
logari81 pushed a change to branch cleanup-mesh-import.

  at 69884dd4 Change default treatment of overlapping nodes and cleanup of 
mesh import

This branch includes the following new commits:

 new 69884dd4 Change default treatment of overlapping nodes and cleanup of 
mesh import




[Getfem-commits] (no subject)

2023-08-02 Thread Konstantinos Poulios via Getfem-commits
branch: cleanup-mesh-import
commit 69884dd486e8e68d7bcdb502f2843c5131c5a91e
Author: Konstantinos Poulios 
AuthorDate: Wed Aug 2 23:14:40 2023 +0200

Change default treatment of overlapping nodes and cleanup of mesh import
---
 src/getfem/getfem_import.h |  62 ---
 src/getfem_import.cc   | 439 ++---
 2 files changed, 248 insertions(+), 253 deletions(-)

diff --git a/src/getfem/getfem_import.h b/src/getfem/getfem_import.h
index 10210207..cad32fd0 100644
--- a/src/getfem/getfem_import.h
+++ b/src/getfem/getfem_import.h
@@ -76,9 +76,9 @@ namespace getfem {
parametrization of the mesh in Gmsh .geo file must assign a
different number to each region, the problem exists because in
Gmsh can coexist, for example, "Physical Surface (200)" and
-   "Physical Line (200)", as they are different "types of regions"
-   in Gmsh, that which does not occur in GetFEM since there is
-   only one "type of region".
+   "Physical Line (200)", as they are different types of regions
+   in Gmsh, which cannot occur in GetFEM since there is only one
+   type of region.
 
 
   - "cdb" for meshes generated by ANSYS (in blocked format).
@@ -103,11 +103,19 @@ namespace getfem {
   - "am_fmt" for 2D meshes from emc2
 [http://pauillac.inria.fr/cdrom/prog/unix/emc2/eng.htm]
 
+
+  For all mesh formats, overlapping nodes are preserved by default.
+  In order to merge overlapping nodes during the import, add
+  ":merge_overlapping_nodes" to the format specifier.
+  For example:
+"gmsh:merge_overlapping_nodes"
+"cdb:merge_overlapping_nodes"
+"cdb:3:merge_overlapping_nodes"
   */
   void import_mesh(const std::string& filename, const std::string& format,
-  mesh& m);
+   mesh& m);
   void import_mesh(std::istream& f, const std::string& format,
-  mesh& m);
+   mesh& m);
   void import_mesh(const std::string& filename, mesh& m);
 
   /** Import a mesh file in format generated by Gmsh.
@@ -140,38 +148,42 @@ namespace getfem {
   be tested.
   */
   void import_mesh_gmsh(const std::string& filename, mesh& m,
-std::map _map,
+bool add_all_element_type = false,
+std::set *lower_dim_convex_rg = nullptr,
+std::map *region_map = nullptr,
 bool remove_last_dimension = true,
-std::map> *nodal_map = 
NULL,
-bool remove_duplicated_nodes = true);
-
-  void import_mesh_gmsh(std::istream& f, mesh& m,
+std::map> *nodal_map = 
nullptr,
+bool merge_overlapping_nodes = false);
+  void import_mesh_gmsh(const std::string& filename, mesh& m,
 std::map _map,
 bool remove_last_dimension = true,
-std::map> *nodal_map = 
NULL,
-bool remove_duplicated_nodes = true);
-
-  void import_mesh_gmsh(const std::string& filename, mesh& m,
+std::map> *nodal_map = 
nullptr,
+bool merge_overlapping_nodes = false) {
+import_mesh_gmsh(filename, m, false, nullptr, _map,
+ remove_last_dimension, nodal_map, 
merge_overlapping_nodes);
+  }
+  void import_mesh_gmsh(std::istream& f, mesh& m,
 bool add_all_element_type = false,
-std::set *lower_dim_convex_rg = NULL,
-std::map *region_map = NULL,
+std::set *lower_dim_convex_rg = nullptr,
+std::map *region_map = nullptr,
 bool remove_last_dimension = true,
-std::map> *nodal_map = 
NULL,
-bool remove_duplicated_nodes = true);
-
+std::map> *nodal_map = 
nullptr,
+bool merge_overlapping_nodes = false);
   void import_mesh_gmsh(std::istream& f, mesh& m,
-bool add_all_element_type = false,
-std::set *lower_dim_convex_rg = NULL,
-std::map *region_map = NULL,
+std::map _map,
 bool remove_last_dimension = true,
-std::map> *nodal_map = 
NULL,
-bool remove_duplicated_nodes = true);
+std::map> *nodal_map = 
nullptr,
+bool merge_overlapping_nodes = false) {
+import_gmsh_mesh(f, m, false, nullptr, _map,
+ remove_last_dimension, nodal_map, 
merge_overlapping_nodes);
+  }
 
   /** for gmsh and gid meshes, the mesh nodes are always 3D, so for a 2D mesh
   the z-component of nodes should be removed */
   void maybe_remove_last_dimension(mesh );
 
   /** for gmsh meshes, create table