MOAB: Mesh Oriented datABase  (version 5.4.1)
smf_test.cpp File Reference
#include "TestUtil.hpp"
#include "moab/Core.hpp"
#include "moab/Range.hpp"
+ Include dependency graph for smf_test.cpp:

Go to the source code of this file.

Defines

#define IS_BUILDING_MB

Functions

void read_file (Interface &moab, const char *input_file)
void test_read_nodes ()
void test_read_triangles ()
int main ()

Variables

static const char example [] = "three.smf"

Define Documentation

#define IS_BUILDING_MB

Definition at line 3 of file smf_test.cpp.


Function Documentation

int main ( )

Definition at line 18 of file smf_test.cpp.

References RUN_TEST, test_read_nodes(), and test_read_triangles().

{
    int result = 0;

    result += RUN_TEST( test_read_nodes );
    result += RUN_TEST( test_read_triangles );

    return result;
}
void read_file ( Interface moab,
const char *  input_file 
)
void test_read_nodes ( )

Definition at line 74 of file smf_test.cpp.

References CHECK_ARRAYS_EQUAL, CHECK_EQUAL, CHECK_ERR, ErrorCode, example, moab::Interface::get_connectivity(), moab::Interface::get_entities_by_type(), moab::Interface::id_from_handle(), MBTRI, and read_file().

Referenced by main().

{
    ErrorCode rval;
    Core moab;
    Interface& mb = moab;
    read_file( moab, example );

    std::vector< EntityHandle > triangles;
    rval = mb.get_entities_by_type( 0, MBTRI, triangles );CHECK_ERR( rval );
    CHECK_EQUAL( (size_t)36, triangles.size() );

    int vtx_ids[3];
    const EntityHandle* conn;
    int len;

    const int conn1[] = { 1, 4, 2 };
    int pos           = 0;
    rval              = mb.get_connectivity( triangles[pos], conn, len );CHECK_ERR( rval );
    CHECK_EQUAL( 3, len );
    int i = 0;
    for( i = 0; i < 3; i++ )
        vtx_ids[i] = mb.id_from_handle( conn[i] );
    CHECK_ARRAYS_EQUAL( conn1, 3, vtx_ids, len );

    // last triangle
    const int conn2[] = { 19, 21, 23 };
    rval              = mb.get_connectivity( triangles[35], conn, len );CHECK_ERR( rval );
    CHECK_EQUAL( 3, len );
    for( i = 0; i < 3; i++ )
        vtx_ids[i] = mb.id_from_handle( conn[i] );
    CHECK_ARRAYS_EQUAL( conn2, 3, vtx_ids, len );
}

Variable Documentation

const char example[] = "three.smf" [static]

Definition at line 11 of file smf_test.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines