MOAB: Mesh Oriented datABase  (version 5.5.0)
read_cgm_facet_test.cpp File Reference
#include <iostream>
#include "moab/Interface.hpp"
#include "TestUtil.hpp"
#include "Internals.hpp"
#include "moab/Core.hpp"
#include "MBTagConventions.hpp"
#include "InitCGMA.hpp"
#include "GeometryQueryTool.hpp"
#include "ReadCGM.hpp"
#include "moab/FileOptions.hpp"
+ Include dependency graph for read_cgm_facet_test.cpp:

Go to the source code of this file.

Macros

#define IS_BUILDING_MB
 
#define OPTION_APPEND(X)
 

Functions

void read_file (Interface *moab, const char *input_file)
 
void test_cube_curve_facet ()
 
void test_cone_curve_facet ()
 
void read_file (Interface *moab, bool curve_fatal, const char *input_file, ErrorCode check_val, int &curve_fail, int &surface_fail)
 
int main (int, char **)
 

Variables

std::string input_cube = TestDir + "unittest/io/cube.sat"
 
std::string input_cone = TestDir + "unittest/io/cone.sat"
 

Macro Definition Documentation

◆ IS_BUILDING_MB

#define IS_BUILDING_MB

Definition at line 4 of file read_cgm_facet_test.cpp.

◆ OPTION_APPEND

#define OPTION_APPEND (   X)
Value:
{ \
if( options.length() ) options += ";"; \
options += ( X ); \
}

Function Documentation

◆ main()

int main ( int  ,
char **   
)

Definition at line 101 of file read_cgm_facet_test.cpp.

102 {
103  int result = 0;
104 
105  result += RUN_TEST( test_cube_curve_facet );
106 #ifndef HAVE_OCC_STEP
107  result += RUN_TEST( test_cone_curve_facet );
108 #endif
109  return result;
110 }

References RUN_TEST, test_cone_curve_facet(), and test_cube_curve_facet().

◆ read_file() [1/2]

void read_file ( Interface moab,
bool  curve_fatal,
const char *  input_file,
ErrorCode  check_val,
int &  curve_fail,
int &  surface_fail 
)

Definition at line 35 of file read_cgm_facet_test.cpp.

41 {
42  InitCGMA::initialize_cgma();
43  GeometryQueryTool::instance()->delete_geometry();
44  EntityHandle fs = 0;
45 
46  // set the options
47  std::string options;
48 #define OPTION_APPEND( X ) \
49  { \
50  if( options.length() ) options += ";"; \
51  options += ( X ); \
52  }
53 
54  OPTION_APPEND( "CGM_ATTRIBS=no" );
55  if( curve_fatal ) OPTION_APPEND( "FATAL_ON_CURVES" );
56  OPTION_APPEND( "VERBOSE_CGM_WARNINGS" );
57 
58  // set the file options
59  FileOptions opts( options.c_str() );
60 
61  // new ReadCGM instance
62  ReadCGM* RCGM = new ReadCGM( moab );
63  ErrorCode rval = RCGM->load_file( input_file, &fs, opts );
64  // CHKERR(rval);
65  curve_fail = RCGM->get_failed_curve_count();
66  surface_fail = RCGM->get_failed_surface_count();
67  // std::cout << curve_fail << " " << surface_fail << std::endl;
68 
69  CHECK_EQUAL( rval, check_val );
70  CHECK_EQUAL( curve_fail, 0 );
71  CHECK_EQUAL( surface_fail, 0 );
72 }

References CHECK_EQUAL, ErrorCode, moab::ReadCGM::get_failed_curve_count(), moab::ReadCGM::get_failed_surface_count(), input_file, moab::ReadCGM::load_file(), and OPTION_APPEND.

◆ read_file() [2/2]

◆ test_cone_curve_facet()

void test_cone_curve_facet ( )

Definition at line 89 of file read_cgm_facet_test.cpp.

90 {
91  // Open the test file
92  Core moab;
93  Interface* mb = &moab;
94  int curve_fail = 0;
95  int surface_fail = 0;
96  // should expect MB_FAILURE since we fail on curves
97  read_file( mb, true, input_cone.c_str(), MB_FAILURE, curve_fail, surface_fail );
98 }

References input_cone, mb, and read_file().

Referenced by main().

◆ test_cube_curve_facet()

void test_cube_curve_facet ( )

Definition at line 76 of file read_cgm_facet_test.cpp.

77 {
78  // Open the test file
79  Core moab;
80  Interface* mb = &moab;
81  int curve_fail = 0;
82  int surface_fail = 0;
83  // should succeed since we are not fatal error on curves
84  read_file( mb, false, input_cube.c_str(), MB_SUCCESS, curve_fail, surface_fail );
85 }

References input_cube, mb, MB_SUCCESS, and read_file().

Referenced by main().

Variable Documentation

◆ input_cone

std::string input_cone = TestDir + "unittest/io/cone.sat"

Definition at line 25 of file read_cgm_facet_test.cpp.

Referenced by test_cone_curve_facet().

◆ input_cube

std::string input_cube = TestDir + "unittest/io/cube.sat"

Definition at line 19 of file read_cgm_facet_test.cpp.

Referenced by test_cube_curve_facet().