MOAB: Mesh Oriented datABase  (version 5.2.1)
MergeMesh.hpp
Go to the documentation of this file.
00001 #ifndef MERGEMESH_HPP
00002 #define MERGEMESH_HPP
00003 
00004 #include "moab/Interface.hpp"
00005 #include "moab/Range.hpp"
00006 #include <set>
00007 
00008 namespace moab
00009 {
00010 
00011 class AdaptiveKDTree;
00012 
00013 class MergeMesh
00014 {
00015   public:
00016     /* \brief Constructor
00017      */
00018     MergeMesh( Interface* mbImpl, bool printErrorIn = true );
00019 
00020     /* \brief Destructor
00021      */
00022     virtual ~MergeMesh();
00023 
00024     /* \brief Merge vertices in elements passed in
00025      */
00026     ErrorCode merge_entities( EntityHandle* elems, int elems_size, const double merge_tol, const int do_merge = true,
00027                               const int update_sets = false, Tag merge_tag = 0, bool do_higher_dim = true );
00028 
00029     ErrorCode merge_entities( Range& elems, const double merge_tol, const int do_merge = true,
00030                               const int update_sets = false, Tag merge_tag = 0, bool do_higher_dim = true );
00031 
00032     // Identify higher dimension to be merged
00033     ErrorCode merge_higher_dimensions( Range& elems );
00034 
00035     // merge vertices according to an input tag
00036     ErrorCode merge_using_integer_tag( Range& verts, Tag user_tag, Tag merge_tag = 0 );
00037 
00038     //- perform the actual merge
00039     ErrorCode perform_merge( Tag merged_to );
00040 
00041     // new method, for overlapped meshes
00042     // meshset could be the whole mesh, represented by root set 0;
00043     ErrorCode merge_all( EntityHandle meshset, const double merge_tol );
00044 
00045   private:
00046     // iMesh_Instance imeshImpl;
00047 
00048     //- given a kdtree, set tag on vertices in leaf nodes with vertices
00049     //- to which they should be merged
00050     ErrorCode find_merged_to( EntityHandle& tree_root, AdaptiveKDTree& tree, Tag merged_to );
00051 
00052     Interface* mbImpl;
00053 
00054     //- the tag pointing to the entity to which an entity will be merged
00055     Tag mbMergeTag;
00056 
00057     double mergeTol, mergeTolSq;
00058 
00059     //- entities which will go away after the merge
00060     std::set<EntityHandle> deadEnts;
00061 
00062     // vertices that were merged with other vertices, and were left in the database
00063     std::set<EntityHandle>  mergedToVertices;
00064 
00065     // Allow a warning to be suppressed when no merging is done
00066     bool printError;
00067 };
00068 
00069 }  // namespace moab
00070 
00071 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines