MOAB: Mesh Oriented datABase  (version 5.4.1)
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 = "unittest/16_unmerged_hex.h5m"
std::string meshfile2 = "unittest/merge_with_tag.h5m"
std::string meshfile3 = "unittest/triangles.h5m"
std::string outfile = "mm_out.h5m"

Function Documentation

int main ( )

Definition at line 29 of file mergemesh_test.cpp.

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

{
#ifdef MOAB_HAVE_MPI
    MPI_Init( &argc, &argv );
#endif
    int result = 0;

    result += RUN_TEST( mergesimple_test );
    result += RUN_TEST( merge_with_tag_test );
    result += RUN_TEST( merge_all_test );

#ifdef MOAB_HAVE_MPI
    MPI_Finalize();
#endif
    return result;
}
void merge_all_test ( )

Definition at line 96 of file mergemesh_test.cpp.

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

Referenced by main().

{
    ErrorCode rval;
    Core mb;
    Interface* iface = &mb;

    rval = iface->load_mesh( meshfile3.c_str() );CHECK_ERR( rval );

    MergeMesh mm( iface );
    double merge_tol = 1e-3;
    rval             = mm.merge_all( 0, merge_tol );  // root set
    CHECK_ERR( rval );
    rval = iface->write_file( outfile.c_str() );CHECK_ERR( rval );

    return;
}

Definition at line 71 of file mergemesh_test.cpp.

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().

{
    ErrorCode rval;
    Core mb;
    Interface* iface = &mb;
    // can be generalized to load user defined input/output file

    rval = iface->load_mesh( meshfile2.c_str() );CHECK_ERR( rval );
    int dim = 0;
    moab::Range verts;
    iface->get_entities_by_dimension( 0, dim, verts );
    Tag tag_for_merge;
    rval = iface->tag_get_handle( "IDFTAG", tag_for_merge );CHECK_ERR( rval );

    MergeMesh mm( iface );
    rval = mm.merge_using_integer_tag( verts, tag_for_merge );CHECK_ERR( rval );
    rval = iface->write_file( outfile.c_str() );CHECK_ERR( rval );

    verts.clear();
    iface->get_entities_by_dimension( 0, dim, verts );
    CHECK_EQUAL( 405, (int)verts.size() );

    return;
}
void mergesimple_test ( )

Definition at line 47 of file mergemesh_test.cpp.

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().

{
    ErrorCode rval;
    Core mb;
    Interface* iface = &mb;
    // can be generalized to load user defined input/output file

    rval = iface->load_mesh( meshfile.c_str() );CHECK_ERR( rval );
    int dim = 3;
    moab::Range ents;
    iface->get_entities_by_dimension( 0, dim, ents );

    MergeMesh mm( iface );
    double merge_tol = 1e-3;

    rval = mm.merge_entities( ents, merge_tol );CHECK_ERR( rval );

    // Fixed for now

    rval = iface->write_file( outfile.c_str() );CHECK_ERR( rval );

    return;
}

Variable Documentation

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

Definition at line 17 of file mergemesh_test.cpp.

Referenced by mergesimple_test().

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

Definition at line 18 of file mergemesh_test.cpp.

Referenced by merge_with_tag_test().

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

Definition at line 19 of file mergemesh_test.cpp.

Referenced by merge_all_test().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines