MOAB: Mesh Oriented datABase  (version 5.4.0)
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,
00027                               int elems_size,
00028                               const double merge_tol,
00029                               const int do_merge    = true,
00030                               const int update_sets = false,
00031                               Tag merge_tag         = 0,
00032                               bool do_higher_dim    = true );
00033 
00034     ErrorCode merge_entities( Range& elems,
00035                               const double merge_tol,
00036                               const int do_merge    = true,
00037                               const int update_sets = false,
00038                               Tag merge_tag         = 0,
00039                               bool do_higher_dim    = true );
00040 
00041     // Identify higher dimension to be merged
00042     ErrorCode merge_higher_dimensions( Range& elems );
00043 
00044     // merge vertices according to an input tag
00045     ErrorCode merge_using_integer_tag( Range& verts, Tag user_tag, Tag merge_tag = 0 );
00046 
00047     //- perform the actual merge
00048     ErrorCode perform_merge( Tag merged_to );
00049 
00050     // new method, for overlapped meshes
00051     // meshset could be the whole mesh, represented by root set 0;
00052     ErrorCode merge_all( EntityHandle meshset, const double merge_tol );
00053 
00054   private:
00055     // iMesh_Instance imeshImpl;
00056 
00057     //- given a kdtree, set tag on vertices in leaf nodes with vertices
00058     //- to which they should be merged
00059     ErrorCode find_merged_to( EntityHandle& tree_root, AdaptiveKDTree& tree, Tag merged_to );
00060 
00061     Interface* mbImpl;
00062 
00063     //- the tag pointing to the entity to which an entity will be merged
00064     Tag mbMergeTag;
00065 
00066     double mergeTol, mergeTolSq;
00067 
00068     //- entities which will go away after the merge
00069     std::set< EntityHandle > deadEnts;
00070 
00071     // vertices that were merged with other vertices, and were left in the database
00072     std::set< EntityHandle > mergedToVertices;
00073 
00074     // Allow a warning to be suppressed when no merging is done
00075     bool printError;
00076 };
00077 
00078 }  // namespace moab
00079 
00080 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines