Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
MergeMesh.hpp
Go to the documentation of this file.
1 #ifndef MERGEMESH_HPP
2 #define MERGEMESH_HPP
3 
4 #include "moab/Interface.hpp"
5 #include "moab/Range.hpp"
6 #include <set>
7 
8 namespace moab
9 {
10 
11 class AdaptiveKDTree;
12 
13 class MergeMesh
14 {
15  public:
16  /* \brief Constructor
17  */
18  MergeMesh( Interface* mbImpl, bool printErrorIn = true );
19 
20  /* \brief Destructor
21  */
22  virtual ~MergeMesh();
23 
24  /* \brief Merge vertices in elements passed in
25  */
27  int elems_size,
28  const double merge_tol,
29  const int do_merge = true,
30  const int update_sets = false,
31  Tag merge_tag = 0,
32  bool do_higher_dim = true );
33 
35  const double merge_tol,
36  const int do_merge = true,
37  const int update_sets = false,
38  Tag merge_tag = 0,
39  bool do_higher_dim = true );
40 
41  // Identify higher dimension to be merged
43 
44  // merge vertices according to an input tag
45  ErrorCode merge_using_integer_tag( Range& verts, Tag user_tag, Tag merge_tag = 0 );
46 
47  //- perform the actual merge
48  ErrorCode perform_merge( Tag merged_to );
49 
50  // new method, for overlapped meshes
51  // meshset could be the whole mesh, represented by root set 0;
52  ErrorCode merge_all( EntityHandle meshset, const double merge_tol );
53 
54  private:
55  // iMesh_Instance imeshImpl;
56 
57  //- given a kdtree, set tag on vertices in leaf nodes with vertices
58  //- to which they should be merged
59  ErrorCode find_merged_to( EntityHandle& tree_root, AdaptiveKDTree& tree, Tag merged_to );
60 
62 
63  //- the tag pointing to the entity to which an entity will be merged
65 
67 
68  //- entities which will go away after the merge
69  std::set< EntityHandle > deadEnts;
70 
71  // vertices that were merged with other vertices, and were left in the database
72  std::set< EntityHandle > mergedToVertices;
73 
74  // Allow a warning to be suppressed when no merging is done
75  bool printError;
76 };
77 
78 } // namespace moab
79 
80 #endif