Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
00001 #include "iGeom.h" 00002 #include "iMesh.h" 00003 #include "iRel.h" 00004 00005 #include "TestUtil.hpp" 00006 00007 #include <cstdlib> 00008 00009 iGeom_Instance geom; 00010 iMesh_Instance mesh; 00011 iRel_Instance rel; 00012 using namespace moab; 00013 00014 void test_initial_inactive() 00015 { 00016 int err; 00017 iRel_PairHandle pair; 00018 00019 iRel_createPair( rel, geom, iRel_SET, iRel_IGEOM_IFACE, iRel_INACTIVE, mesh, iRel_SET, iRel_IMESH_IFACE, 00020 iRel_ACTIVE, &pair, &err );CHECK_ERR( err ); 00021 00022 iBase_EntitySetHandle geom_set; 00023 iGeom_createEntSet( geom, false, &geom_set, &err );CHECK_ERR( err ); 00024 00025 iBase_EntitySetHandle mesh_set; 00026 iMesh_createEntSet( mesh, false, &mesh_set, &err );CHECK_ERR( err ); 00027 00028 iRel_setSetSetRelation( rel, pair, geom_set, mesh_set, &err );CHECK_ERR( err ); 00029 00030 iBase_EntitySetHandle related_set; 00031 iRel_getSetSetRelation( rel, pair, mesh_set, 1, &related_set, &err );CHECK_ERR( err ); 00032 CHECK_EQUAL( related_set, geom_set ); 00033 00034 iRel_getSetSetRelation( rel, pair, geom_set, 0, &related_set, &err ); 00035 CHECK( err != iBase_SUCCESS ); 00036 00037 iRel_changePairStatus( rel, pair, iRel_ACTIVE, iRel_ACTIVE, &err );CHECK_ERR( err ); 00038 00039 iRel_getSetSetRelation( rel, pair, geom_set, 0, &related_set, &err );CHECK_ERR( err ); 00040 CHECK_EQUAL( related_set, mesh_set ); 00041 } 00042 00043 void test_initial_notexist() 00044 { 00045 int err; 00046 iRel_PairHandle pair; 00047 00048 iRel_createPair( rel, geom, iRel_SET, iRel_IGEOM_IFACE, iRel_NOTEXIST, mesh, iRel_SET, iRel_IMESH_IFACE, 00049 iRel_ACTIVE, &pair, &err );CHECK_ERR( err ); 00050 00051 iBase_EntitySetHandle geom_set; 00052 iGeom_createEntSet( geom, false, &geom_set, &err );CHECK_ERR( err ); 00053 00054 iBase_EntitySetHandle mesh_set; 00055 iMesh_createEntSet( mesh, false, &mesh_set, &err );CHECK_ERR( err ); 00056 00057 iRel_setSetSetRelation( rel, pair, geom_set, mesh_set, &err );CHECK_ERR( err ); 00058 00059 iBase_EntitySetHandle related_set; 00060 iRel_getSetSetRelation( rel, pair, mesh_set, 1, &related_set, &err );CHECK_ERR( err ); 00061 CHECK_EQUAL( related_set, geom_set ); 00062 00063 iRel_getSetSetRelation( rel, pair, geom_set, 0, &related_set, &err ); 00064 CHECK( err != iBase_SUCCESS ); 00065 00066 iRel_changePairStatus( rel, pair, iRel_ACTIVE, iRel_ACTIVE, &err );CHECK_ERR( err ); 00067 00068 iRel_getSetSetRelation( rel, pair, geom_set, 0, &related_set, &err );CHECK_ERR( err ); 00069 CHECK_EQUAL( related_set, mesh_set ); 00070 } 00071 00072 int main() 00073 { 00074 int err; 00075 int num_fail = 0; 00076 00077 iGeom_newGeom( 0, &geom, &err, 0 ); 00078 iMesh_newMesh( 0, &mesh, &err, 0 ); 00079 iRel_create( 0, &rel, &err, 0 ); 00080 00081 num_fail += RUN_TEST( test_initial_inactive ); 00082 num_fail += RUN_TEST( test_initial_notexist ); 00083 00084 iRel_destroy( rel, &err ); 00085 iMesh_dtor( mesh, &err ); 00086 iGeom_dtor( geom, &err ); 00087 00088 return num_fail; 00089 }