MOAB: Mesh Oriented datABase  (version 5.5.0)
mergemesh_test.cpp File Reference
#include "moab/Core.hpp"
#include "moab/Range.hpp"
#include "moab/MergeMesh.hpp"
#include <iostream>
#include "TestUtil.hpp"
+ Include dependency graph for mergemesh_test.cpp:

Go to the source code of this file.

Functions

void mergesimple_test ()
 
void merge_with_tag_test ()
 
void merge_all_test ()
 
int main ()
 

Variables

std::string meshfile = TestDir + "unittest/16_unmerged_hex.h5m"
 
std::string meshfile2 = TestDir + "unittest/merge_with_tag.h5m"
 
std::string meshfile3 = TestDir + "unittest/triangles.h5m"
 
std::string outfile = "mm_out.h5m"
 

Function Documentation

◆ main()

int main ( )

Definition at line 29 of file mergemesh_test.cpp.

31 {
32 #ifdef MOAB_HAVE_MPI
33  MPI_Init( &argc, &argv );
34 #endif
35  int result = 0;
36 
37  result += RUN_TEST( mergesimple_test );
38  result += RUN_TEST( merge_with_tag_test );
39  result += RUN_TEST( merge_all_test );
40 
41 #ifdef MOAB_HAVE_MPI
42  MPI_Finalize();
43 #endif
44  return result;
45 }

References merge_all_test(), merge_with_tag_test(), mergesimple_test(), and RUN_TEST.

◆ merge_all_test()

void merge_all_test ( )

Definition at line 96 of file mergemesh_test.cpp.

97 {
98  ErrorCode rval;
99  Core mb;
100  Interface* iface = &mb;
101 
102  rval = iface->load_mesh( meshfile3.c_str() );CHECK_ERR( rval );
103 
104  MergeMesh mm( iface );
105  double merge_tol = 1e-3;
106  rval = mm.merge_all( 0, merge_tol ); // root set
107  CHECK_ERR( rval );
108  rval = iface->write_file( outfile.c_str() );CHECK_ERR( rval );
109 
110  return;
111 }

References CHECK_ERR, ErrorCode, iface, moab::Interface::load_mesh(), mb, moab::MergeMesh::merge_all(), meshfile3, outfile, and moab::Interface::write_file().

Referenced by main().

◆ merge_with_tag_test()

void merge_with_tag_test ( )

Definition at line 71 of file mergemesh_test.cpp.

72 {
73  ErrorCode rval;
74  Core mb;
75  Interface* iface = &mb;
76  // can be generalized to load user defined input/output file
77 
78  rval = iface->load_mesh( meshfile2.c_str() );CHECK_ERR( rval );
79  int dim = 0;
80  moab::Range verts;
81  iface->get_entities_by_dimension( 0, dim, verts );
82  Tag tag_for_merge;
83  rval = iface->tag_get_handle( "IDFTAG", tag_for_merge );CHECK_ERR( rval );
84 
85  MergeMesh mm( iface );
86  rval = mm.merge_using_integer_tag( verts, tag_for_merge );CHECK_ERR( rval );
87  rval = iface->write_file( outfile.c_str() );CHECK_ERR( rval );
88 
89  verts.clear();
90  iface->get_entities_by_dimension( 0, dim, verts );
91  CHECK_EQUAL( 405, (int)verts.size() );
92 
93  return;
94 }

References CHECK_EQUAL, CHECK_ERR, moab::Range::clear(), dim, ErrorCode, moab::Interface::get_entities_by_dimension(), iface, moab::Interface::load_mesh(), mb, moab::MergeMesh::merge_using_integer_tag(), meshfile2, outfile, moab::Range::size(), moab::Interface::tag_get_handle(), and moab::Interface::write_file().

Referenced by main().

◆ mergesimple_test()

void mergesimple_test ( )

Definition at line 47 of file mergemesh_test.cpp.

48 {
49  ErrorCode rval;
50  Core mb;
51  Interface* iface = &mb;
52  // can be generalized to load user defined input/output file
53 
54  rval = iface->load_mesh( meshfile.c_str() );CHECK_ERR( rval );
55  int dim = 3;
56  moab::Range ents;
57  iface->get_entities_by_dimension( 0, dim, ents );
58 
59  MergeMesh mm( iface );
60  double merge_tol = 1e-3;
61 
62  rval = mm.merge_entities( ents, merge_tol );CHECK_ERR( rval );
63 
64  // Fixed for now
65 
66  rval = iface->write_file( outfile.c_str() );CHECK_ERR( rval );
67 
68  return;
69 }

References CHECK_ERR, dim, ErrorCode, moab::Interface::get_entities_by_dimension(), iface, moab::Interface::load_mesh(), mb, moab::MergeMesh::merge_entities(), meshfile, outfile, and moab::Interface::write_file().

Referenced by main().

Variable Documentation

◆ meshfile

std::string meshfile = TestDir + "unittest/16_unmerged_hex.h5m"

Definition at line 17 of file mergemesh_test.cpp.

Referenced by mergesimple_test().

◆ meshfile2

std::string meshfile2 = TestDir + "unittest/merge_with_tag.h5m"

Definition at line 18 of file mergemesh_test.cpp.

Referenced by merge_with_tag_test().

◆ meshfile3

std::string meshfile3 = TestDir + "unittest/triangles.h5m"

Definition at line 19 of file mergemesh_test.cpp.

Referenced by merge_all_test().

◆ outfile