MOAB: Mesh Oriented datABase  (version 5.5.0)
testSmooth.cpp File Reference
#include "FBiGeom.h"
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <iterator>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <cmath>
+ Include dependency graph for testSmooth.cpp:

Go to the source code of this file.

Classes

class  SimpleArray< T >
 

Macros

#define CHECK(STR)    if( err != iBase_SUCCESS ) return print_error( STR, err, geom, __FILE__, __LINE__ )
 
#define STRINGIFY(S)   XSTRINGIFY( S )
 
#define XSTRINGIFY(S)   #S
 
#define ARRAY_INOUT(A)   A.ptr(), &( A ).capacity(), &( A ).size()
 
#define ARRAY_IN(A)   &( A )[0], ( A ).size()
 

Typedefs

typedef iBase_TagHandle TagHandle
 
typedef iBase_EntityHandle GentityHandle
 
typedef iBase_EntitySetHandle GentitysetHandle
 

Functions

static bool print_error (const char *desc, int err, FBiGeom_Instance geom, const char *file, int line)
 
bool smooth_test (const std::string &filename, FBiGeom_Instance)
 
bool tags_test (FBiGeom_Instance geom)
 
bool tag_get_set_test (FBiGeom_Instance geom)
 
bool tag_info_test (FBiGeom_Instance geom)
 
bool gentityset_test (FBiGeom_Instance geom, bool, bool)
 
bool topology_adjacencies_test (FBiGeom_Instance geom)
 
bool geometry_evaluation_test (FBiGeom_Instance geom)
 
bool construct_test (FBiGeom_Instance geom)
 
bool primitives_test (FBiGeom_Instance geom)
 
bool transforms_test (FBiGeom_Instance geom)
 
bool booleans_test (FBiGeom_Instance geom)
 
bool shutdown_test (FBiGeom_Instance geom, std::string &engine_opt)
 
bool save_entset_test (FBiGeom_Instance geom)
 
bool mesh_size_test (FBiGeom_Instance geom)
 
bool normals_test (FBiGeom_Instance geom)
 
bool ray_test (FBiGeom_Instance geom)
 
void handle_error_code (const bool result, int &number_failed, int &, int &number_successful)
 
int main (int argc, char *argv[])
 
static bool compare_box (const double *expected_min, const double *expected_max, const double *actual_min, const double *actual_max)
 
static int get_entities (FBiGeom_Instance geom, int entity_type, std::vector< iBase_EntityHandle > &entities_out, iBase_TagHandle id_tag=0, std::vector< int > *ids_out=0)
 
static int check_firmness (FBiGeom_Instance geom, const std::vector< iBase_EntityHandle > &entities, const std::vector< int > &ids, iBase_TagHandle firmness_tag, const char *expected_value, const char *ent_type_str)
 
static int count_num_with_tag (FBiGeom_Instance geom, const std::vector< iBase_EntityHandle > &ents, iBase_TagHandle tag)
 

Macro Definition Documentation

◆ ARRAY_IN

#define ARRAY_IN (   A)    &( A )[0], ( A ).size()

Definition at line 125 of file testSmooth.cpp.

◆ ARRAY_INOUT

#define ARRAY_INOUT (   A)    A.ptr(), &( A ).capacity(), &( A ).size()

Definition at line 124 of file testSmooth.cpp.

◆ CHECK

#define CHECK (   STR)     if( err != iBase_SUCCESS ) return print_error( STR, err, geom, __FILE__, __LINE__ )

Definition at line 25 of file testSmooth.cpp.

◆ STRINGIFY

#define STRINGIFY (   S)    XSTRINGIFY( S )

Definition at line 28 of file testSmooth.cpp.

◆ XSTRINGIFY

#define XSTRINGIFY (   S)    #S

Definition at line 29 of file testSmooth.cpp.

Typedef Documentation

◆ GentityHandle

Definition at line 46 of file testSmooth.cpp.

◆ GentitysetHandle

Definition at line 47 of file testSmooth.cpp.

◆ TagHandle

Definition at line 45 of file testSmooth.cpp.

Function Documentation

◆ booleans_test()

bool booleans_test ( FBiGeom_Instance  geom)

Definition at line 1357 of file testSmooth.cpp.

1358 {
1359  int err;
1360 
1361  // construct a brick size 1, and a cylinder rad 0.25 height 2
1362  iBase_EntityHandle brick = 0, cyl = 0;
1363  FBiGeom_createBrick( geom, 1.0, 0.0, 0.0, &brick, &err );
1364  CHECK( "Problems creating brick for booleans test." );
1365  FBiGeom_createCylinder( geom, 1.0, 0.25, 0.0, &cyl, &err );
1366  CHECK( "Problems creating cylinder for booleans test." );
1367 
1368  // subtract the cylinder from the brick
1369  iBase_EntityHandle subtract_result = 0;
1370  FBiGeom_subtractEnts( geom, brick, cyl, &subtract_result, &err );
1371  CHECK( "Problems subtracting for booleans subtract test." );
1372 
1373  // section the brick
1374  iBase_EntityHandle section_result = 0;
1375  FBiGeom_sectionEnt( geom, subtract_result, 1.0, 0.0, 0.0, 0.25, true, &section_result, &err );
1376  CHECK( "Problems sectioning for booleans section test." );
1377 
1378  // unite the section result with a new cylinder
1379  FBiGeom_createCylinder( geom, 1.0, 0.25, 0.0, &cyl, &err );
1380  CHECK( "Problems creating cylinder for unite test." );
1381  iBase_EntityHandle unite_results;
1382  iBase_EntityHandle unite_input[] = { section_result, cyl };
1383  FBiGeom_uniteEnts( geom, unite_input, 2, &unite_results, &err );
1384  CHECK( "Problems uniting for booleans unite test." );
1385 
1386  FBiGeom_deleteEnt( geom, unite_results, &err );
1387  CHECK( "Problems deleting for booleans unite test." );
1388  return true;
1389 }

References CHECK, FBiGeom_createBrick, FBiGeom_createCylinder, FBiGeom_deleteEnt, FBiGeom_sectionEnt, FBiGeom_subtractEnts, FBiGeom_uniteEnts, and geom.

◆ check_firmness()

static int check_firmness ( FBiGeom_Instance  geom,
const std::vector< iBase_EntityHandle > &  entities,
const std::vector< int > &  ids,
iBase_TagHandle  firmness_tag,
const char *  expected_value,
const char *  ent_type_str 
)
static

Definition at line 1423 of file testSmooth.cpp.

1429 {
1430  const int firmness_size = 4;
1431  std::vector< char > firmness( firmness_size * entities.size() );
1432 
1433  char* byte_ptr = &firmness[0];
1434  int err, junk1 = firmness.size(), junk2 = entities.size() * firmness_size;
1435  FBiGeom_getArrData( geom, &entities[0], entities.size(), firmness_tag, (void**)&byte_ptr, &junk1, &junk2, &err );
1436  if( iBase_SUCCESS != err ) return err;
1437 
1438  bool all_correct = true;
1439  for( unsigned i = 0; i < entities.size(); ++i )
1440  if( std::string( &firmness[firmness_size * i], firmness_size ) != expected_value ) all_correct = false;
1441  if( !all_correct )
1442  {
1443  std::cout << "ERROR: Expected \"" << expected_value << "\" firmness "
1444  << "for all " << ent_type_str << "." << std::endl;
1445  std::cout << "ID Actual " << std::endl;
1446  for( unsigned i = 0; i < entities.size(); ++i )
1447  std::cout << std::setw( 2 ) << ids[i] << " " << std::string( &firmness[firmness_size * i], firmness_size )
1448  << std::endl;
1449  return iBase_FAILURE;
1450  }
1451 
1452  return iBase_SUCCESS;
1453 }

References entities, FBiGeom_getArrData, geom, iBase_FAILURE, and iBase_SUCCESS.

Referenced by mesh_size_test().

◆ compare_box()

static bool compare_box ( const double *  expected_min,
const double *  expected_max,
const double *  actual_min,
const double *  actual_max 
)
static

Definition at line 1212 of file testSmooth.cpp.

1216 {
1217  bool same = true;
1218  double dtol = 1.0e-6;
1219 
1220  for( int i = 0; i < 3; ++i )
1221  {
1222  if( expected_min[i] < actual_min[i] - dtol || expected_min[i] * 10 > actual_min[i] ||
1223  expected_max[i] > actual_max[i] + dtol || expected_max[i] * 10 < actual_max[i] )
1224  same = false;
1225  }
1226  return same;
1227 }

Referenced by primitives_test().

◆ construct_test()

bool construct_test ( FBiGeom_Instance  geom)
Test:
TSTTG construct Test
  • Check construction of geometry

Definition at line 1155 of file testSmooth.cpp.

1156 {
1157  int err;
1158  iBase_EntityHandle new_body = 0;
1159 
1160  // construct a cylinder, sweep it about an axis, and delete the result
1161  iBase_EntityHandle cyl = 0;
1162  FBiGeom_createCylinder( geom, 1.0, 1.0, 0.0, &cyl, &err );
1163  // Is the minor radius really supposed to be zero??? - JK
1164  CHECK( "Creating cylinder failed." );
1165 
1166  // move it onto the y axis
1167  FBiGeom_moveEnt( geom, cyl, 0.0, 1.0, -0.5, &err );
1168  CHECK( "Problems moving surface." );
1169 
1170  // get the surface with max z
1171  iBase_EntityHandle max_surf = 0;
1173  FBiGeom_getEntAdj( geom, cyl, iBase_FACE, ARRAY_INOUT( surfs ), &err );
1174  CHECK( "Problems getting max surf for rotation." );
1175 
1176  SimpleArray< double > max_corn, min_corn;
1178  ARRAY_INOUT( max_corn ), &err );
1179  CHECK( "Problems getting max surf for rotation." );
1180  double dtol = 1.0e-6;
1181  for( int i = 0; i < surfs.size(); ++i )
1182  {
1183  if( ( max_corn[3 * i + 2] ) <= dtol && ( max_corn[3 * i + 2] ) >= -dtol && ( min_corn[3 * i + 2] ) <= dtol &&
1184  ( min_corn[3 * i + 2] ) >= -dtol )
1185  {
1186  max_surf = surfs[i];
1187  break;
1188  }
1189  }
1190 
1191  if( 0 == max_surf )
1192  {
1193  std::cerr << "Couldn't find max surf for rotation." << std::endl;
1194  return false;
1195  }
1196 
1197  // sweep it around the x axis
1198  FBiGeom_moveEnt( geom, cyl, 0.0, 1.0, 0.0, &err );
1199  CHECK( "Problems moving surface." );
1200 
1201  FBiGeom_sweepEntAboutAxis( geom, max_surf, 360.0, 1.0, 0.0, 0.0, &new_body, &err );
1202  CHECK( "Problems sweeping surface about axis." );
1203 
1204  // now delete
1205  FBiGeom_deleteEnt( geom, new_body, &err );
1206  CHECK( "Problems deleting cylinder or swept surface body." );
1207 
1208  // if we got here, we were successful
1209  return true;
1210 }

References ARRAY_IN, ARRAY_INOUT, CHECK, FBiGeom_createCylinder, FBiGeom_deleteEnt, FBiGeom_getArrBoundBox, FBiGeom_getEntAdj, FBiGeom_moveEnt, FBiGeom_sweepEntAboutAxis, geom, iBase_FACE, iBase_INTERLEAVED, and SimpleArray< T >::size().

◆ count_num_with_tag()

static int count_num_with_tag ( FBiGeom_Instance  geom,
const std::vector< iBase_EntityHandle > &  ents,
iBase_TagHandle  tag 
)
static

Definition at line 1455 of file testSmooth.cpp.

1458 {
1459  int err, bytes;
1460  FBiGeom_getTagSizeBytes( geom, tag, &bytes, &err );
1461  if( iBase_SUCCESS != err ) return -1;
1462  std::vector< char > data( bytes );
1463 
1464  int success_count = 0;
1465  for( size_t i = 0; i < ents.size(); ++i )
1466  {
1467  char* ptr = &data[0];
1468  int junk1 = bytes, junk2;
1469  FBiGeom_getData( geom, ents[i], tag, (void**)&ptr, &junk1, &junk2, &err );
1470  if( iBase_TAG_NOT_FOUND == err ) continue;
1471  if( iBase_SUCCESS != err ) return -1;
1472  ++success_count;
1473  }
1474 
1475  return success_count;
1476 }

References FBiGeom_getData, FBiGeom_getTagSizeBytes, geom, iBase_SUCCESS, and iBase_TAG_NOT_FOUND.

Referenced by mesh_size_test().

◆ gentityset_test()

bool gentityset_test ( FBiGeom_Instance  geom,
bool  ,
bool   
)
Test:
TSTT gentity sets test (just implemented parts for now)
  • Check gentity sets

Definition at line 531 of file testSmooth.cpp.

532 {
533  int num_type = 4;
534  iBase_EntitySetHandle ges_array[4];
535  int number_array[4];
536  // int num_all_gentities_super = 0;
537  int ent_type = iBase_VERTEX;
538 
539  int err;
541  FBiGeom_getRootSet( geom, &root_set, &err );
542  CHECK( "ERROR : getRootSet failed!" );
543 
544  // get the number of sets in the whole model
545  int all_sets = 0;
546  FBiGeom_getNumEntSets( geom, root_set, 0, &all_sets, &err );
547  CHECK( "Problem getting the number of all gentity sets in whole model." );
548 
549  // add gentities to entitysets by type
550  for( ; ent_type < num_type; ent_type++ )
551  {
552  // initialize the entityset
553  FBiGeom_createEntSet( geom, true, &ges_array[ent_type], &err );
554  CHECK( "Problem creating entityset." );
555 
556  // get entities by type in total "mesh"
558  FBiGeom_getEntities( geom, root_set, ent_type, ARRAY_INOUT( gentities ), &err );
559  CHECK( "Failed to get gentities by type in gentityset_test." );
560 
561  // add gentities into gentity set
562  FBiGeom_addEntArrToSet( geom, ARRAY_IN( gentities ), ges_array[ent_type], &err );
563  CHECK( "Failed to add gentities in entityset_test." );
564 
565  // Check to make sure entity set really has correct number of entities in it
566  FBiGeom_getNumOfType( geom, ges_array[ent_type], ent_type, &number_array[ent_type], &err );
567  CHECK( "Failed to get number of gentities by type in entityset_test." );
568 
569  // compare the number of entities by type
570  int num_type_gentity = gentities.size();
571 
572  if( number_array[ent_type] != num_type_gentity )
573  {
574  std::cerr << "Number of gentities by type is not correct" << std::endl;
575  return false;
576  }
577 
578  // add to number of all entities in super set
579  // num_all_gentities_super += num_type_gentity;
580  }
581 
582  // make a super set having all entitysets
583  iBase_EntitySetHandle super_set;
584  FBiGeom_createEntSet( geom, true, &super_set, &err );
585  CHECK( "Failed to create a super set in gentityset_test." );
586 
587  for( int i = 0; i < num_type; i++ )
588  {
589  FBiGeom_addEntSet( geom, ges_array[i], super_set, &err );
590  CHECK( "Failed to create a super set in gentityset_test." );
591  }
592 
593  //----------TEST BOOLEAN OPERATIONS----------------//
594 
595  iBase_EntitySetHandle temp_ges1;
596  FBiGeom_createEntSet( geom, true, &temp_ges1, &err );
597  CHECK( "Failed to create a super set in gentityset_test." );
598 
599  // Subtract
600  // add all EDGEs and FACEs to temp_es1
601  // get all EDGE entities
602  SimpleArray< iBase_EntityHandle > gedges, gfaces, temp_gentities1;
603  FBiGeom_getEntities( geom, ges_array[iBase_EDGE], iBase_EDGE, ARRAY_INOUT( gedges ), &err );
604  CHECK( "Failed to get gedge gentities in gentityset_test." );
605 
606  // add EDGEs to ges1
607  FBiGeom_addEntArrToSet( geom, ARRAY_IN( gedges ), temp_ges1, &err );
608  CHECK( "Failed to add gedge gentities in gentityset_test." );
609 
610  // get all FACE gentities
611  FBiGeom_getEntities( geom, ges_array[iBase_FACE], iBase_FACE, ARRAY_INOUT( gfaces ), &err );
612  CHECK( "Failed to get gface gentities in gentityset_test." );
613 
614  // add FACEs to es1
615  FBiGeom_addEntArrToSet( geom, ARRAY_IN( gfaces ), temp_ges1, &err );
616  CHECK( "Failed to add gface gentities in gentityset_test." );
617 
618  // subtract EDGEs
619  FBiGeom_subtract( geom, temp_ges1, ges_array[iBase_EDGE], &temp_ges1, &err );
620  CHECK( "Failed to subtract gentitysets in gentityset_test." );
621 
622  FBiGeom_getEntities( geom, temp_ges1, iBase_FACE, ARRAY_INOUT( temp_gentities1 ), &err );
623  CHECK( "Failed to get gface gentities in gentityset_test." );
624 
625  if( gfaces.size() != temp_gentities1.size() )
626  {
627  std::cerr << "Number of entitysets after subtraction not correct \
628  in gentityset_test."
629  << std::endl;
630  return false;
631  }
632 
633  // check there's nothing but gfaces in temp_ges1
634  int num_gents;
635  FBiGeom_getNumOfType( geom, temp_ges1, iBase_EDGE, &num_gents, &err );
636  CHECK( "Failed to get dimensions of gentities in gentityset_test." );
637  if( 0 != num_gents )
638  {
639  std::cerr << "Subtraction failed to remove all edges" << std::endl;
640  return false;
641  }
642 
643  //------------Intersect------------
644  //
645 
646  // clean out the temp_ges1
647  FBiGeom_rmvEntArrFromSet( geom, ARRAY_IN( gfaces ), temp_ges1, &err );
648  CHECK( "Failed to remove gface gentities in gentityset_test." );
649 
650  // check if it is really cleaned out
651  FBiGeom_getNumOfType( geom, temp_ges1, iBase_FACE, &num_gents, &err );
652  CHECK( "Failed to get number of gentities by type in gentityset_test." );
653 
654  if( num_gents != 0 )
655  {
656  std::cerr << "failed to remove correctly." << std::endl;
657  return false;
658  }
659 
660  // add EDGEs to temp ges1
661  FBiGeom_addEntArrToSet( geom, ARRAY_IN( gedges ), temp_ges1, &err );
662  CHECK( "Failed to add gedge gentities in gentityset_test." );
663 
664  // add FACEs to temp ges1
665  FBiGeom_addEntArrToSet( geom, ARRAY_IN( gfaces ), temp_ges1, &err );
666  CHECK( "Failed to add gface gentities in gentityset_test." );
667 
668  // intersect temp_ges1 with gedges set
669  // temp_ges1 entityset is altered
670  FBiGeom_intersect( geom, temp_ges1, ges_array[iBase_EDGE], &temp_ges1, &err );
671  CHECK( "Failed to intersect in gentityset_test." );
672 
673  // try to get FACEs, but there should be nothing but EDGE
674  FBiGeom_getNumOfType( geom, temp_ges1, iBase_FACE, &num_gents, &err );
675  CHECK( "Failed to get gface gentities in gentityset_test." );
676 
677  if( num_gents != 0 )
678  {
679  std::cerr << "wrong number of gfaces." << std::endl;
680  return false;
681  }
682 
683  //-------------Unite--------------
684 
685  // get all regions
686  iBase_EntitySetHandle temp_ges2;
688 
689  FBiGeom_createEntSet( geom, true, &temp_ges2, &err );
690  CHECK( "Failed to create a temp gentityset in gentityset_test." );
691 
692  FBiGeom_getEntities( geom, ges_array[iBase_REGION], iBase_REGION, ARRAY_INOUT( gregions ), &err );
693  CHECK( "Failed to get gregion gentities in gentityset_test." );
694 
695  // add REGIONs to temp es2
696  FBiGeom_addEntArrToSet( geom, ARRAY_IN( gregions ), temp_ges2, &err );
697  CHECK( "Failed to add gregion gentities in gentityset_test." );
698 
699  // unite temp_ges1 and temp_ges2
700  // temp_ges1 gentityset is altered
701  FBiGeom_unite( geom, temp_ges1, temp_ges2, &temp_ges1, &err );
702  CHECK( "Failed to unite in gentityset_test." );
703 
704  // perform the check
705  FBiGeom_getNumOfType( geom, temp_ges1, iBase_REGION, &num_gents, &err );
706  CHECK( "Failed to get number of gregion gentities by type in gentityset_test." );
707 
708  if( num_gents != number_array[iBase_REGION] )
709  {
710  std::cerr << "different number of gregions in gentityset_test." << std::endl;
711  return false;
712  }
713 
714  //--------Test parent/child stuff in entiysets-----------
715 
716  // Add 2 sets as children to another
717  iBase_EntitySetHandle parent_child;
718  FBiGeom_createEntSet( geom, true, &parent_child, &err );
719  CHECK( "Problem creating gentityset in gentityset_test." );
720 
721  FBiGeom_addPrntChld( geom, ges_array[iBase_VERTEX], parent_child, &err );
722  CHECK( "Problem add parent in gentityset_test." );
723 
724  // check if parent is really added
726  FBiGeom_getPrnts( geom, parent_child, 1, ARRAY_INOUT( parents ), &err );
727  CHECK( "Problem getting parents in gentityset_test." );
728 
729  if( parents.size() != 1 )
730  {
731  std::cerr << "number of parents is not correct in gentityset_test." << std::endl;
732  return false;
733  }
734 
735  // add parent and child
736  // sidl::array<void*> parent_child_array = sidl::array<void*>::create1d(1);
737  // int num_parent_child_array;
738  // sidl::array<void*> temp_gedge_array = sidl::array<void*>::create1d(1);
739  // int num_temp_gedge_array;
740  // parent_child_array.set(0, parent_child);
741  // temp_gedge_array.set(0, ges_array[TSTTG::EntityType_EDGE]);
742  FBiGeom_addPrntChld( geom, ges_array[iBase_EDGE], parent_child, &err );
743  CHECK( "Problem adding parent and child in gentityset_test." );
744 
745  // sidl::array<void*> temp_gface_array = sidl::array<void*>::create1d(1);
746  // int num_temp_gface_array;
747  // temp_gface_array.set(0, ges_array[TSTTG::EntityType_FACE]);
748  FBiGeom_addPrntChld( geom, parent_child, ges_array[iBase_FACE], &err );
749  CHECK( "Problem adding parent and child in gentityset_test." );
750 
751  // add child
752  FBiGeom_addPrntChld( geom, parent_child, ges_array[iBase_REGION], &err );
753  CHECK( "Problem adding child in gentityset_test." );
754 
755  // get the number of parent gentitysets
756  num_gents = -1;
757  FBiGeom_getNumPrnt( geom, parent_child, 1, &num_gents, &err );
758  CHECK( "Problem getting number of parents in gentityset_test." );
759 
760  if( num_gents != 2 )
761  {
762  std::cerr << "number of parents is not correct in gentityset_test." << std::endl;
763  return false;
764  }
765 
766  // get the number of child gentitysets
767  num_gents = -1;
768  FBiGeom_getNumChld( geom, parent_child, 1, &num_gents, &err );
769  CHECK( "Problem getting number of children in gentityset_test." );
770 
771  if( num_gents != 2 )
772  {
773  std::cerr << "number of children is not correct in gentityset_test." << std::endl;
774  return false;
775  }
776 
778  FBiGeom_getChldn( geom, parent_child, 1, ARRAY_INOUT( children ), &err );
779  CHECK( "Problem getting children in gentityset_test." );
780 
781  if( children.size() != 2 )
782  {
783  std::cerr << "number of children is not correct in gentityset_test." << std::endl;
784  return false;
785  }
786 
787  // remove children
788  FBiGeom_rmvPrntChld( geom, parent_child, ges_array[iBase_FACE], &err );
789  CHECK( "Problem removing parent child in gentityset_test." );
790 
791  // get the number of child gentitysets
792  FBiGeom_getNumChld( geom, parent_child, 1, &num_gents, &err );
793  CHECK( "Problem getting number of children in gentityset_test." );
794 
795  if( num_gents != 1 )
796  {
797  std::cerr << "number of children is not correct in gentityset_test." << std::endl;
798  return false;
799  }
800 
801  // parent_child and ges_array[TSTTG::EntityType_EDGE] should be related
802  int result = 0;
803  FBiGeom_isChildOf( geom, ges_array[iBase_EDGE], parent_child, &result, &err );
804  CHECK( "Problem checking relation in gentityset_test." );
805  if( !result )
806  {
807  std::cerr << "parent_child and ges_array[TSTTG::EntityType_EDGE] should be related" << std::endl;
808  return false;
809  }
810 
811  // ges_array[TSTTG::EntityType_FACE] and ges_array[TSTTG::REGION] are not related
812  result = 2;
813  FBiGeom_isChildOf( geom, ges_array[iBase_FACE], ges_array[iBase_REGION], &result, &err );
814  if( result )
815  {
816  std::cerr << "ges_array[TSTTG::REGION] and ges_array[TSTTG::EntityType_FACE] should not be "
817  "related"
818  << std::endl;
819  return false;
820  }
821 
822  //--------test modify and query functions-----------------------------
823 
824  // check the number of gentity sets in whole mesh
826  FBiGeom_getEntSets( geom, root_set, 1, ARRAY_INOUT( gentity_sets ), &err );
827  CHECK( "Problem to get all gentity sets in mesh." );
828 
829  if( gentity_sets.size() != all_sets + 8 )
830  {
831  std::cerr << "the number of gentity sets in whole mesh should be 8 times of num_iter." << std::endl;
832  return false;
833  }
834 
835  // get all gentity sets in super set
837  FBiGeom_getEntSets( geom, super_set, 1, ARRAY_INOUT( ges_array1 ), &err );
838  CHECK( "Problem to get gentity sets in super set." );
839 
840  // get the number of gentity sets in super set
841  int num_super;
842  FBiGeom_getNumEntSets( geom, super_set, 1, &num_super, &err );
843  CHECK( "Problem to get the number of all gentity sets in super set." );
844 
845  // the number of gentity sets in super set should be same
846  if( num_super != ges_array1.size() )
847  {
848  std::cerr << "the number of gentity sets in super set should be same." << std::endl;
849  return false;
850  }
851 
852  // get all entities in super set
854  FBiGeom_getEntSets( geom, super_set, 1, ARRAY_INOUT( all_gentities ), &err );
855  CHECK( "Problem to get all gentities in super set." );
856 
857  // compare the number of all gentities in super set
858  // HJK : num_hops is not implemented
859  // if (num_all_gentities_super != ARRAY_SIZE(all_gentities)) {
860  // std::cerr << "number of all gentities in super set should be same." << std::endl;
861  // success = false;
862  //}
863 
864  // test add, remove and get all entitiy sets using super set
865  // check GetAllGentitysets works recursively and dosen't return
866  // multi sets
867  for( int k = 0; k < num_super; k++ )
868  {
869  // add gentity sets of super set to each gentity set of super set
870  // make multiple child super sets
871  iBase_EntitySetHandle ges_k = ges_array1[k];
872 
873  for( int a = 0; a < ges_array1.size(); a++ )
874  {
875  FBiGeom_addEntSet( geom, ges_array1[a], ges_k, &err );
876  CHECK( "Problem to add entity set." );
877  }
878 
879  // add super set to each entity set
880  // sidl::array<GentitysetHandle> superset_array
881  //= sidl::array<GentitysetHandle>::create1d(1);
882  // superset_array.set(0, super_set);
883  // int num_superset_array;
884 
885  FBiGeom_addEntSet( geom, super_set, ges_k, &err );
886  CHECK( "Problem to add super set to gentitysets." );
887 
888  // add one gentity sets multiple times
889  // HJK: ??? how to deal this case?
890  // sidl::array<GentitysetHandle> temp_array1
891  //= sidl::array<GentitysetHandle>::create1d(1);
892  // int num_temp_array1;
893  // temp_array1.set(0, temp_ges1);
894 
895  // for (int l = 0; l < 3; l++) {
896  FBiGeom_addEntSet( geom, temp_ges1, ges_k, &err );
897  CHECK( "Problem to add temp set to gentitysets." );
898  //}
899  }
900 
901  return true;
902 }

References ARRAY_IN, ARRAY_INOUT, CHECK, children, FBiGeom_addEntArrToSet, FBiGeom_addEntSet, FBiGeom_addPrntChld, FBiGeom_createEntSet, FBiGeom_getChldn, FBiGeom_getEntities, FBiGeom_getEntSets, FBiGeom_getNumChld, FBiGeom_getNumEntSets, FBiGeom_getNumOfType, FBiGeom_getNumPrnt, FBiGeom_getPrnts, FBiGeom_getRootSet, FBiGeom_intersect, FBiGeom_isChildOf, FBiGeom_rmvEntArrFromSet, FBiGeom_rmvPrntChld, FBiGeom_subtract, FBiGeom_unite, geom, iBase_EDGE, iBase_FACE, iBase_REGION, iBase_VERTEX, root_set, and SimpleArray< T >::size().

◆ geometry_evaluation_test()

bool geometry_evaluation_test ( FBiGeom_Instance  geom)
Test:
FBiGeom_MOAB topology adjacencies Test
  • Check topology information
  • Check adjacency

Definition at line 997 of file testSmooth.cpp.

998 {
999  int i, err;
1001  FBiGeom_getRootSet( geom, &root_set, &err );
1002  CHECK( "ERROR : getRootSet failed!" );
1003 
1004  int top = iBase_VERTEX;
1005  int num_test_top = iBase_ALL_TYPES;
1006  std::vector< std::vector< iBase_EntityHandle > > gentity_vectors( num_test_top );
1007 
1008  // fill the vectors of each topology entities
1009  // like lines vector, polygon vector, triangle vector,
1010  // quadrilateral, polyhedrron, tet, hex, prism, pyramid,
1011  // septahedron vectors
1012  for( i = top; i < num_test_top; i++ )
1013  {
1015  FBiGeom_getEntities( geom, root_set, i, ARRAY_INOUT( gentities ), &err );
1016  CHECK( "Failed to get gentities in adjacencies_test." );
1017 
1018  gentity_vectors[i].resize( gentities.size() );
1019  std::copy( gentities.begin(), gentities.end(), gentity_vectors[i].begin() );
1020  }
1021 
1022  // check adjacencies in both directions
1023  double min[3], max[3], on[3];
1024  double near[3] = { .0, .0, .0 };
1025  std::vector< iBase_EntityHandle >::iterator vit;
1026  for( i = iBase_REGION; i >= iBase_VERTEX; i-- )
1027  {
1028  if( i != iBase_EDGE )
1029  {
1030  for( vit = gentity_vectors[i].begin(); vit != gentity_vectors[i].end(); ++vit )
1031  {
1032  iBase_EntityHandle this_gent = *vit;
1033  FBiGeom_getEntBoundBox( geom, this_gent, &min[0], &min[1], &min[2], &max[0], &max[1], &max[2], &err );
1034  CHECK( "Failed to get bounding box of entity." );
1035 
1036  for( int j = 0; j < 3; j++ )
1037  near[j] = ( min[j] + max[j] ) / 2;
1038  FBiGeom_getEntClosestPt( geom, this_gent, near[0], near[1], near[2], &on[0], &on[1], &on[2], &err );
1039  CHECK( "Failed to get closest point on entity." );
1040  std::cout << " entity of type " << i << " closest point to \n " << near[0] << " " << near[1] << " "
1041  << near[2] << "\n is " << on[0] << " " << on[1] << " " << on[2] << "\n";
1042  }
1043  }
1044  }
1045 
1046  return true;
1047 }

References ARRAY_INOUT, SimpleArray< T >::begin(), CHECK, SimpleArray< T >::end(), FBiGeom_getEntBoundBox, FBiGeom_getEntClosestPt, FBiGeom_getEntities, FBiGeom_getRootSet, geom, iBase_ALL_TYPES, iBase_EDGE, iBase_REGION, iBase_VERTEX, root_set, and SimpleArray< T >::size().

Referenced by main().

◆ get_entities()

static int get_entities ( FBiGeom_Instance  geom,
int  entity_type,
std::vector< iBase_EntityHandle > &  entities_out,
iBase_TagHandle  id_tag = 0,
std::vector< int > *  ids_out = 0 
)
static

Definition at line 1391 of file testSmooth.cpp.

1396 {
1397  int err, num;
1398  iBase_EntitySetHandle root;
1399  FBiGeom_getRootSet( geom, &root, &err );
1400  if( iBase_SUCCESS != err ) return err;
1401  FBiGeom_getNumOfType( geom, root, entity_type, &num, &err );
1402  if( iBase_SUCCESS != err ) return err;
1403 
1404  entities_out.resize( num );
1405  int junk1 = entities_out.size(), junk2;
1406  iBase_EntityHandle* junk_ptr = &entities_out[0];
1407  ;
1408  FBiGeom_getEntities( geom, root, entity_type, &junk_ptr, &junk1, &junk2, &err );
1409  if( iBase_SUCCESS != err ) return err;
1410  assert( num == junk1 && num == junk2 );
1411 
1412  if( !ids_out ) return iBase_SUCCESS;
1413 
1414  ids_out->resize( num );
1415  int* int_ptr = &( *ids_out )[0];
1416  FBiGeom_getIntArrData( geom, &entities_out[0], num, id_tag, &int_ptr, &junk1, &junk2, &err );
1417  if( iBase_SUCCESS != err ) return err;
1418  assert( num == junk1 && num == junk2 );
1419 
1420  return iBase_SUCCESS;
1421 }

References FBiGeom_getEntities, FBiGeom_getIntArrData, FBiGeom_getNumOfType, FBiGeom_getRootSet, geom, iBase_SUCCESS, and id_tag.

Referenced by mesh_size_test().

◆ handle_error_code()

void handle_error_code ( const bool  result,
int &  number_failed,
int &  ,
int &  number_successful 
)

Definition at line 146 of file testSmooth.cpp.

147 {
148  if( result )
149  {
150  std::cout << "Success";
151  number_successful++;
152  }
153  else
154  {
155  std::cout << "Failure";
156  number_failed++;
157  }
158 }

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 160 of file testSmooth.cpp.

161 {
162  std::string filename = STRINGIFY( MESHDIR ) "/shell.h5m";
163  std::string engine_opt;
164 
165  if( argc == 1 )
166  {
167  std::cout << "Using default input file: " << filename << std::endl;
168  }
169  else if( argc == 2 )
170  {
171  filename = argv[1];
172  }
173  else
174  {
175  std::cerr << "Usage: " << argv[0] << " [geom_filename]" << std::endl;
176  return 1;
177  }
178 
179  bool result;
180  int number_tests = 0;
181  int number_tests_successful = 0;
182  int number_tests_not_implemented = 0;
183  int number_tests_failed = 0;
184 
185  // initialize the Mesh
186  int err;
188  FBiGeom_newGeom( engine_opt.c_str(), &geom, &err, engine_opt.length() );
189  CHECK( "Interface initialization didn't work properly." );
190 
191  // Print out Header information
192  std::cout << "\n\nITAPS GEOMETRY INTERFACE TEST PROGRAM:\n\n";
193  // gLoad test
194 
195  std::cout << " Smooth faceting load and initialization: \n";
196  result = smooth_test( filename, geom );
197  handle_error_code( result, number_tests_failed, number_tests_not_implemented, number_tests_successful );
198 
199  number_tests++;
200  std::cout << "\n";
201 
202  // tags test
203  std::cout << " tags: ";
204  result = tags_test( geom );
205  handle_error_code( result, number_tests_failed, number_tests_not_implemented, number_tests_successful );
206  number_tests++;
207  std::cout << "\n";
208  /*
209  // gentitysets test
210  std::cout << " gentity sets: ";
211  result = gentityset_test(geom, false, false);
212  handle_error_code(result, number_tests_failed,
213  number_tests_not_implemented,
214  number_tests_successful);
215  number_tests++;
216  std::cout << "\n";
217  */
218  // topology adjacencies test
219  std::cout << " topology adjacencies: ";
220  result = topology_adjacencies_test( geom );
221  handle_error_code( result, number_tests_failed, number_tests_not_implemented, number_tests_successful );
222  number_tests++;
223  std::cout << "\n";
224 
225  // geometry evaluation test
226  std::cout << " geometry evaluation: \n";
227  result = geometry_evaluation_test( geom );
228  handle_error_code( result, number_tests_failed, number_tests_not_implemented, number_tests_successful );
229  number_tests++;
230  std::cout << "\n";
231 
232  // normals evaluation test
233  std::cout << " normals geometry evaluation: \n";
234  result = normals_test( geom );
235  handle_error_code( result, number_tests_failed, number_tests_not_implemented, number_tests_successful );
236  number_tests++;
237  std::cout << "\n";
238 
239  // ray tracing test
240  std::cout << " ray intersection test: \n";
241  result = ray_test( geom );
242  handle_error_code( result, number_tests_failed, number_tests_not_implemented, number_tests_successful );
243  number_tests++;
244  std::cout << "\n";
245  /*
246  // construct test
247  std::cout << " construct: ";
248  result = construct_test(geom);
249  handle_error_code(result, number_tests_failed,
250  number_tests_not_implemented,
251  number_tests_successful);
252  number_tests++;
253  std::cout << "\n";
254 
255  // primitives test
256  std::cout << " primitives: ";
257  result = primitives_test(geom);
258  handle_error_code(result, number_tests_failed,
259  number_tests_not_implemented,
260  number_tests_successful);
261  number_tests++;
262  std::cout << "\n";
263 
264  // transforms test
265  std::cout << " transforms: ";
266  result = transforms_test(geom);
267  handle_error_code(result, number_tests_failed,
268  number_tests_not_implemented,
269  number_tests_successful);
270  number_tests++;
271  std::cout << "\n";
272 
273  // booleans test
274  std::cout << " booleans: ";
275  result = booleans_test(geom);
276  handle_error_code(result, number_tests_failed,
277  number_tests_not_implemented,
278  number_tests_successful);
279  number_tests++;
280  std::cout << "\n";
281 
282  #if defined(HAVE_ACIS) && !defined(FORCE_OCC)
283  std::cout << " mesh size: ";
284  result = mesh_size_test(geom);
285  handle_error_code(result, number_tests_failed,
286  number_tests_not_implemented,
287  number_tests_successful);
288  number_tests++;
289  std::cout << "\n";
290 
291  // save entset test
292  std::cout << " save entset: ";
293  result = save_entset_test(geom);
294  handle_error_code(result, number_tests_failed,
295  number_tests_not_implemented,
296  number_tests_successful);
297  number_tests++;
298  std::cout << "\n";
299  #endif
300  */
301  // shutdown test
302  std::cout << " shutdown: ";
303  result = shutdown_test( geom, engine_opt );
304  handle_error_code( result, number_tests_failed, number_tests_not_implemented, number_tests_successful );
305  number_tests++;
306  std::cout << "\n";
307 
308  // summary
309 
310  std::cout << "\nTSTT TEST SUMMARY: \n"
311  << " Number Tests: " << number_tests << "\n"
312  << " Number Successful: " << number_tests_successful << "\n"
313  << " Number Not Implemented: " << number_tests_not_implemented << "\n"
314  << " Number Failed: " << number_tests_failed << "\n\n"
315  << std::endl;
316 
317  return number_tests_failed;
318 }

References CHECK, FBiGeom_newGeom, filename, geom, geometry_evaluation_test(), handle_error_code(), normals_test(), number_tests, number_tests_failed, number_tests_successful, ray_test(), shutdown_test(), smooth_test(), STRINGIFY, tags_test(), and topology_adjacencies_test().

◆ mesh_size_test()

bool mesh_size_test ( FBiGeom_Instance  geom)

Definition at line 1478 of file testSmooth.cpp.

1479 {
1480  const char* filename = STRINGIFY( SRCDIR ) "/size.sat";
1481  int err, junk1, junk2;
1482  bool result = true;
1483 
1484  FBiGeom_deleteAll( geom, &err );
1485  CHECK( "" );
1486  FBiGeom_load( geom, filename, 0, &err, strlen( filename ), 0 );
1487  CHECK( "Failed to load input file: 'size.sat'" );
1488 
1489  // get tag handles
1490  iBase_TagHandle interval, size, firmness, id;
1491  FBiGeom_getTagHandle( geom, "MESH_INTERVAL", &interval, &err, strlen( "MESH_INTERVAL" ) );
1492  CHECK( "FBiGeom_getTagHandle(\"MESH_INTERVAL\")" );
1493  FBiGeom_getTagHandle( geom, "MESH_SIZE", &size, &err, strlen( "MESH_SIZE" ) );
1494  CHECK( "FBiGeom_getTagHandle(\"MESH_SIZE\")" );
1495  FBiGeom_getTagHandle( geom, "SIZE_FIRMNESS", &firmness, &err, strlen( "SIZE_FIRMNESS" ) );
1496  CHECK( "FBiGeom_getTagHandle(\"SIZE_FIRMNESS\")" );
1497  FBiGeom_getTagHandle( geom, "GLOBAL_ID", &id, &err, strlen( "GLOBAL_ID" ) );
1498  CHECK( "FBiGeom_getTagHandle(\"GLOBAL_ID\")" );
1499 
1500  // get entity lists
1501  std::vector< iBase_EntityHandle > verts, curves, surfs, vols;
1502  std::vector< int > vert_ids, curve_ids, surf_ids, vol_ids;
1503  err = get_entities( geom, iBase_VERTEX, verts, id, &vert_ids );
1504  CHECK( "" );
1505  err = get_entities( geom, iBase_EDGE, curves, id, &curve_ids );
1506  CHECK( "" );
1507  err = get_entities( geom, iBase_FACE, surfs, id, &surf_ids );
1508  CHECK( "" );
1509  err = get_entities( geom, iBase_REGION, vols, id, &vol_ids );
1510  CHECK( "" );
1511 
1512  // expect interval count to be the same as ID for every curve
1513  std::vector< int > intervals( curves.size() );
1514  int* int_ptr = &intervals[0];
1515  junk1 = junk2 = curves.size();
1516  FBiGeom_getIntArrData( geom, &curves[0], curves.size(), interval, &int_ptr, &junk1, &junk2, &err );
1517  CHECK( "Failed to get intervals for curves" );
1518  if( intervals != curve_ids )
1519  {
1520  std::cout << "ERROR: Incorrect curve intervals for one or more curves." << std::endl;
1521  std::cout << "ID Expected Actual" << std::endl;
1522  for( unsigned i = 0; i < curves.size(); ++i )
1523  std::cout << std::setw( 2 ) << curve_ids[i] << " " << std::setw( 8 ) << curve_ids[i] << " "
1524  << std::setw( 6 ) << intervals[i] << std::endl;
1525  result = false;
1526  }
1527 
1528  // expect size to be the same as ID for every surface
1529  std::vector< double > sizes( surfs.size() );
1530  double* dbl_ptr = &sizes[0];
1531  junk1 = junk2 = surfs.size();
1532  FBiGeom_getDblArrData( geom, &surfs[0], surfs.size(), size, &dbl_ptr, &junk1, &junk2, &err );
1533  CHECK( "Failed to get sizes for surfaces" );
1534  bool all_correct = true;
1535  for( unsigned i = 0; i < surfs.size(); ++i )
1536  if( fabs( sizes[i] - (double)surf_ids[i] ) > 1e-8 ) all_correct = false;
1537  if( !all_correct )
1538  {
1539  std::cout << "ERROR: Incorrect mesh size for one or more surfaces." << std::endl;
1540  std::cout << "ID Expected Actual " << std::endl;
1541  for( unsigned i = 0; i < surfs.size(); ++i )
1542  std::cout << std::setw( 2 ) << surf_ids[i] << " " << std::setw( 8 ) << (double)surf_ids[i] << " "
1543  << std::setw( 8 ) << sizes[i] << std::endl;
1544  result = false;
1545  }
1546 
1547  err = result ? iBase_SUCCESS : iBase_FAILURE;
1548  CHECK( "Invalid size or interval data" );
1549 
1550  // expect "HARD" firmness on all curves
1551  err = check_firmness( geom, curves, curve_ids, firmness, "HARD", "curves" );
1552  CHECK( "Invalid curve firmness" );
1553  // expect "SOFT" firmness on all surfaces
1554  err = check_firmness( geom, surfs, surf_ids, firmness, "SOFT", "surfaces" );
1555  CHECK( "Invalid surface firmness" );
1556 
1557  // expect no firmnes on other entities
1558  err = count_num_with_tag( geom, verts, firmness ) ? iBase_FAILURE : iBase_SUCCESS;
1559  CHECK( "Got firmness for vertex." );
1560  err = count_num_with_tag( geom, vols, firmness ) ? iBase_FAILURE : iBase_SUCCESS;
1561  CHECK( "Got firmness for volume." );
1562 
1563  // expect no interval tag on any entities except curves
1564  err = count_num_with_tag( geom, verts, interval ) ? iBase_FAILURE : iBase_SUCCESS;
1565  CHECK( "Got interval count for vertex." );
1566  err = count_num_with_tag( geom, vols, interval ) ? iBase_FAILURE : iBase_SUCCESS;
1567  CHECK( "Got interval count for volume." );
1568 
1569  // expect no size tag on any entities except surfaces
1570  // curves should have size of one of their parent surfaces
1572  CHECK( "Got mesh size for vertex." );
1574  CHECK( "Got mesh size for volume." );
1575 
1576  return true;
1577 }

References CHECK, check_firmness(), count_num_with_tag(), FBiGeom_deleteAll, FBiGeom_getDblArrData, FBiGeom_getIntArrData, FBiGeom_getTagHandle, FBiGeom_load, filename, geom, get_entities(), iBase_EDGE, iBase_FACE, iBase_FAILURE, iBase_REGION, iBase_SUCCESS, iBase_VERTEX, size, sizes, and STRINGIFY.

◆ normals_test()

bool normals_test ( FBiGeom_Instance  geom)

Definition at line 1050 of file testSmooth.cpp.

1051 {
1052  int i, err;
1054  FBiGeom_getRootSet( geom, &root_set, &err );
1055  CHECK( "ERROR : getRootSet failed!" );
1056 
1057  int top = iBase_VERTEX;
1058  int num_test_top = iBase_ALL_TYPES;
1059  std::vector< std::vector< iBase_EntityHandle > > gentity_vectors( num_test_top );
1060 
1061  // fill the vectors of each topology entities
1062  // like lines vector, polygon vector, triangle vector,
1063  // quadrilateral, polyhedrron, tet, hex, prism, pyramid,
1064  // septahedron vectors
1065  for( i = top; i < num_test_top; i++ )
1066  {
1068  FBiGeom_getEntities( geom, root_set, i, ARRAY_INOUT( gentities ), &err );
1069  CHECK( "Failed to get gentities in adjacencies_test." );
1070 
1071  gentity_vectors[i].resize( gentities.size() );
1072  std::copy( gentities.begin(), gentities.end(), gentity_vectors[i].begin() );
1073  }
1074 
1075  // check adjacencies in both directions
1076  double min[3], max[3];
1077  double normal[3] = { .0, .0, .0 };
1078  std::vector< iBase_EntityHandle >::iterator vit;
1079  for( i = iBase_REGION; i > iBase_EDGE; i-- )
1080  {
1081  for( vit = gentity_vectors[i].begin(); vit != gentity_vectors[i].end(); ++vit )
1082  {
1083  iBase_EntityHandle this_gent = *vit;
1084  FBiGeom_getEntBoundBox( geom, this_gent, &min[0], &min[1], &min[2], &max[0], &max[1], &max[2], &err );
1085  CHECK( "Failed to get bounding box of entity." );
1086 
1087  FBiGeom_getEntNrmlXYZ( geom, this_gent, ( max[0] + min[0] ) / 2, ( max[1] + min[1] ) / 2,
1088  ( max[2] + min[2] ) / 2, &normal[0], &normal[1], &normal[2], &err );
1089 
1090  CHECK( "Failed to get normal to the closest point." );
1091  std::cout << " entity of type " << i << " closest normal to center:\n " << normal[0] << " " << normal[1]
1092  << " " << normal[2] << "\n";
1093  }
1094  }
1095 
1096  return true;
1097 }

References ARRAY_INOUT, SimpleArray< T >::begin(), CHECK, SimpleArray< T >::end(), FBiGeom_getEntBoundBox, FBiGeom_getEntities, FBiGeom_getEntNrmlXYZ, FBiGeom_getRootSet, geom, iBase_ALL_TYPES, iBase_EDGE, iBase_REGION, iBase_VERTEX, root_set, and SimpleArray< T >::size().

Referenced by main().

◆ primitives_test()

bool primitives_test ( FBiGeom_Instance  geom)

Definition at line 1229 of file testSmooth.cpp.

1230 {
1231  int err;
1233  iBase_EntityHandle prim;
1234 
1235  FBiGeom_createBrick( geom, 1.0, 2.0, 3.0, &prim, &err );
1236  CHECK( "createBrick failed." );
1237  prims[0] = prim;
1238 
1239  FBiGeom_createCylinder( geom, 1.0, 4.0, 2.0, &prim, &err );
1240  CHECK( "createCylinder failed." );
1241  prims[1] = prim;
1242 
1243  FBiGeom_createTorus( geom, 2.0, 1.0, &prim, &err );
1244  CHECK( "createTorus failed." );
1245  prims[2] = prim;
1246 
1247  // verify the bounding boxes for Acis based entities
1248  SimpleArray< double > max_corn, min_corn;
1250  ARRAY_INOUT( max_corn ), &err );
1251 
1252  double preset_min_corn[] =
1253  // min brick corner xyz
1254  { -0.5, -1.0, -1.5,
1255  // min cyl corner xyz
1256  -4.0, -2.0, -0.5,
1257  // min torus corner xyz
1258  -3.0, -3.0, -1.0 };
1259 
1260  double preset_max_corn[] =
1261  // max brick corner xyz
1262  { 0.5, 1.0, 1.5,
1263  // max cyl corner xyz
1264  4.0, 2.0, 0.5,
1265  // max torus corner xyz
1266  3.0, 3.0, 1.0 };
1267 
1268  if( !compare_box( preset_min_corn, preset_max_corn, &min_corn[0], &max_corn[0] ) )
1269  {
1270  std::cerr << "Box check failed for brick" << std::endl;
1271  return false;
1272  }
1273 
1274  if( !compare_box( preset_min_corn + 3, preset_max_corn + 3, &min_corn[3], &max_corn[3] ) )
1275  {
1276  std::cerr << "Box check failed for cylinder" << std::endl;
1277  return false;
1278  }
1279 
1280  if( !compare_box( preset_min_corn + 6, preset_max_corn + 6, &min_corn[6], &max_corn[6] ) )
1281  {
1282  std::cerr << "Box check failed for torus" << std::endl;
1283  return false;
1284  }
1285  // must have worked; delete the entities then return
1286  for( int i = 0; i < 3; ++i )
1287  {
1288  FBiGeom_deleteEnt( geom, prims[i], &err );
1289  CHECK( "Problems deleting primitive after boolean check." );
1290  }
1291 
1292  return true;
1293 }

References ARRAY_IN, ARRAY_INOUT, CHECK, compare_box(), FBiGeom_createBrick, FBiGeom_createCylinder, FBiGeom_createTorus, FBiGeom_deleteEnt, FBiGeom_getArrBoundBox, geom, and iBase_INTERLEAVED.

◆ print_error()

static bool print_error ( const char *  desc,
int  err,
FBiGeom_Instance  geom,
const char *  file,
int  line 
)
static

Definition at line 31 of file testSmooth.cpp.

32 {
33  char buffer[1024];
35  buffer[sizeof( buffer ) - 1] = '\0';
36 
37  std::cerr << "ERROR: " << desc << std::endl
38  << " Error code: " << err << std::endl
39  << " Error desc: " << buffer << std::endl
40  << " At : " << file << ':' << line << std::endl;
41 
42  return false; // must always return false or CHECK macro will break
43 }

References buffer, FBiGeom_getDescription, and geom.

Referenced by save_entset_test().

◆ ray_test()

bool ray_test ( FBiGeom_Instance  geom)

Definition at line 1100 of file testSmooth.cpp.

1101 {
1102  int err;
1104  FBiGeom_getRootSet( geom, &root_set, &err );
1105  CHECK( "ERROR : getRootSet failed!" );
1106 
1107  int top = iBase_FACE;
1108 
1110  FBiGeom_getEntities( geom, root_set, top, ARRAY_INOUT( faces ), &err );
1111  CHECK( "Failed to get gentities in adjacencies_test." );
1112 
1113  // check only the first face
1114 
1115  // check adjacencies in both directions
1116  double min[3], max[3];
1117 
1118  iBase_EntityHandle first_face = faces[0];
1119 
1120  FBiGeom_getEntBoundBox( geom, first_face, &min[0], &min[1], &min[2], &max[0], &max[1], &max[2], &err );
1121  CHECK( "Failed to get bounding box of entity." );
1122 
1123  // assume that the ray shot from the bottom of the box (middle) is a pretty good candidate
1124  // in z direction
1125  double x = ( min[0] + max[0] ) / 2, y = ( min[1] + max[1] ) / 2, z = min[2];
1126  SimpleArray< iBase_EntityHandle > intersect_entity_handles;
1127  SimpleArray< double > intersect_coords;
1128  SimpleArray< double > param_coords;
1129  FBiGeom_getPntRayIntsct( geom, x, y, z, // shot from
1130  0., 0., 1., // direction
1131  ARRAY_INOUT( intersect_entity_handles ), iBase_INTERLEAVED,
1132  ARRAY_INOUT( intersect_coords ), ARRAY_INOUT( param_coords ), &err );
1133 
1134  CHECK( "Failed to find ray intersections points " );
1135  for( int i = 0; i < intersect_entity_handles.size(); i++ )
1136  {
1137  int j;
1138  FBiGeom_getEntType( geom, intersect_entity_handles[i], &j, &err );
1139  CHECK( "Failed to get type of entity." );
1140 
1141  std::cout << " entity of type " << j << " n: " << intersect_entity_handles[i] << "\n"
1142  << intersect_coords[3 * i] << " " << intersect_coords[3 * i + 1] << " " << intersect_coords[3 * i + 2]
1143  << "\n"
1144  << " distance: " << param_coords[i] << "\n";
1145  }
1146 
1147  return true;
1148 }

References ARRAY_INOUT, CHECK, FBiGeom_getEntBoundBox, FBiGeom_getEntities, FBiGeom_getEntType, FBiGeom_getPntRayIntsct, FBiGeom_getRootSet, geom, iBase_FACE, iBase_INTERLEAVED, root_set, and SimpleArray< T >::size().

Referenced by main().

◆ save_entset_test()

bool save_entset_test ( FBiGeom_Instance  geom)

Definition at line 1596 of file testSmooth.cpp.

1597 {
1598  int err;
1599 
1600 #ifdef FORCE_OCC
1601  std::string filename = "testout.brep";
1602 #elif defined( HAVE_ACIS )
1603  std::string filename = "testout.sat";
1604 #elif defined( HAVE_OCC )
1605  std::string filename = "testout.brep";
1606 #else
1607  std::string filename = "testout.sat";
1608 #endif
1609 
1610  // initialize number of ents and sets to compare with later
1611  int num_ents_bef, num_sets_bef;
1612  iBase_EntitySetHandle root;
1613  FBiGeom_getRootSet( geom, &root, &err );
1614  CHECK( "Failed to get root set." );
1615  FBiGeom_getNumEntSets( geom, root, 1, &num_sets_bef, &err );
1616  CHECK( "Failed to get number of ent sets." );
1617  FBiGeom_getNumOfType( geom, root, iBase_REGION, &num_ents_bef, &err );
1618  CHECK( "Failed to get number of entities." );
1619 
1620  // create set, and entity to add to set
1621  iBase_EntityHandle cyl;
1622  FBiGeom_createCylinder( geom, 1.0, 0.25, 0.0, &cyl, &err );
1623  CHECK( "Problems creating cylinder for save entset test." );
1624  iBase_EntitySetHandle seth;
1625  FBiGeom_createEntSet( geom, true, &seth, &err );
1626  CHECK( "Problems creating entity set for save entset test." );
1627 
1628  // add the entity
1629  FBiGeom_addEntToSet( geom, cyl, seth, &err );
1630  CHECK( "Problems adding entity to set for save entset test." );
1631 
1632  // save/restore the model, and see if the entity is there
1633  FBiGeom_save( geom, filename.c_str(), NULL, &err, filename.length(), 0 );
1634  CHECK( "Problems saving file for save entset test." );
1635 
1636  FBiGeom_destroyEntSet( geom, seth, &err );
1637  CHECK( "Failed to destroy entity set." );
1638  FBiGeom_deleteEnt( geom, cyl, &err );
1639  CHECK( "Failed to destroy entity." );
1640 
1641  // read the file back in
1642  FBiGeom_load( geom, filename.c_str(), NULL, &err, filename.length(), 0 );
1643  CHECK( "Problems reading file for save entset test." );
1644 
1645  // check number of sets and entities
1646  int num_ents_aft, num_sets_aft;
1647  FBiGeom_getNumEntSets( geom, root, 1, &num_sets_aft, &err );
1648  CHECK( "Failed to get number of ent sets." );
1649  FBiGeom_getNumOfType( geom, root, iBase_REGION, &num_ents_aft, &err );
1650  CHECK( "Failed to get number of entities." );
1651  bool success = true;
1652  if( num_ents_aft != 2 * num_ents_bef + 1 )
1653  {
1654  print_error( "Failed to get the right number of entities.", iBase_FAILURE, geom, __FILE__, __LINE__ );
1655  success = false;
1656  }
1657  else if( num_sets_aft != 2 * num_sets_bef + 1 )
1658  {
1659  print_error( "Failed to get the right number of entity sets.", iBase_FAILURE, geom, __FILE__, __LINE__ );
1660  success = false;
1661  }
1662 
1663  // otherwise, we succeeded
1664  return success;
1665 }

References CHECK, FBiGeom_addEntToSet, FBiGeom_createCylinder, FBiGeom_createEntSet, FBiGeom_deleteEnt, FBiGeom_destroyEntSet, FBiGeom_getNumEntSets, FBiGeom_getNumOfType, FBiGeom_getRootSet, FBiGeom_load, FBiGeom_save, filename, geom, iBase_FAILURE, iBase_REGION, and print_error().

◆ shutdown_test()

bool shutdown_test ( FBiGeom_Instance  geom,
std::string &  engine_opt 
)

Definition at line 1579 of file testSmooth.cpp.

1580 {
1581  int err;
1582 
1583  // test shutdown & startup of interface
1584  FBiGeom_dtor( geom, &err );
1585  CHECK( "Interface destruction didn't work properly." );
1586 
1587  FBiGeom_newGeom( engine_opt.c_str(), &geom, &err, engine_opt.length() );
1588  CHECK( "Interface re-construction didn't work properly." );
1589 
1590  FBiGeom_dtor( geom, &err );
1591  CHECK( "2nd Interface destruction didn't work properly." );
1592 
1593  return true;
1594 }

References CHECK, FBiGeom_dtor, FBiGeom_newGeom, and geom.

Referenced by main().

◆ smooth_test()

bool smooth_test ( const std::string &  filename,
FBiGeom_Instance  geom 
)
Test:
Load Mesh
  • Load a mesh file
Test:
Load Mesh
  • Load a mesh file

Definition at line 326 of file testSmooth.cpp.

327 {
328  int err;
329  char opts[] = "SMOOTH;";
330  FBiGeom_load( geom, &filename[0], opts, &err, filename.length(), 8 );
331  // FBiGeom_load( geom, &filename[0], 0, &err, filename.length(), 0 );
332  CHECK( "ERROR : can not load a geometry" );
333 
335  FBiGeom_getRootSet( geom, &root_set, &err );
336  CHECK( "ERROR : getRootSet failed!" );
337 
338  // print out the number of entities
339  std::cout << "Model contents: " << std::endl;
340  const char* gtype[] = { "vertices: ", "edges: ", "faces: ", "regions: " };
341  for( int i = 0; i <= 3; ++i )
342  {
343  int count;
344  FBiGeom_getNumOfType( geom, root_set, i, &count, &err );
345  CHECK( "Error: problem getting entities after gLoad." );
346  std::cout << gtype[i] << count << std::endl;
347  }
348 
349  return true;
350 }

References CHECK, FBiGeom_getNumOfType, FBiGeom_getRootSet, FBiGeom_load, filename, geom, and root_set.

Referenced by main().

◆ tag_get_set_test()

bool tag_get_set_test ( FBiGeom_Instance  geom)

Definition at line 462 of file testSmooth.cpp.

463 {
464  int err;
465 
466  // create an arbitrary tag, size 4
467  iBase_TagHandle this_tag;
468  std::string tag_name( "tag_get_set tag" );
469  FBiGeom_createTag( geom, &tag_name[0], sizeof( int ), iBase_BYTES, &this_tag, &err, tag_name.length() );
470  CHECK( "ERROR : can not create a tag for get_set test." );
471 
473  FBiGeom_getRootSet( geom, &root_set, &err );
474  CHECK( "ERROR : getRootSet failed!" );
475 
476  // set this tag to an integer on each entity; keep track of total sum
477  int sum = 0, num = 0, dim;
478  for( dim = 0; dim <= 3; dim++ )
479  {
480  SimpleArray< iBase_EntityHandle > gentity_handles;
481  FBiGeom_getEntities( geom, root_set, dim, ARRAY_INOUT( gentity_handles ), &err );
482  int num_ents = gentity_handles.size();
483  std::vector< int > tag_vals( num_ents );
484  for( int i = 0; i < num_ents; ++i )
485  {
486  tag_vals[i] = num;
487  sum += num;
488  ++num;
489  }
490 
491  FBiGeom_setArrData( geom, ARRAY_IN( gentity_handles ), this_tag, (char*)&tag_vals[0],
492  tag_vals.size() * sizeof( int ), &err );
493  CHECK( "ERROR : can't set tag on entities" );
494  }
495 
496  // check tag values for entities now
497  int get_sum = 0;
498  for( dim = 0; dim <= 3; dim++ )
499  {
500  SimpleArray< iBase_EntityHandle > gentity_handles;
501  FBiGeom_getEntities( geom, root_set, dim, ARRAY_INOUT( gentity_handles ), &err );
502  int num_ents = gentity_handles.size();
503 
504  SimpleArray< char > tag_vals;
505  FBiGeom_getArrData( geom, ARRAY_IN( gentity_handles ), this_tag, (void**)tag_vals.ptr(), &tag_vals.capacity(),
506  &tag_vals.size(), &err );
507  CHECK( "ERROR : can't get tag on entities" );
508 
509  int* tag_ptr = (int*)( &tag_vals[0] );
510  for( int i = 0; i < num_ents; ++i )
511  get_sum += tag_ptr[i];
512  }
513 
514  if( get_sum != sum )
515  {
516  std::cerr << "ERROR: getData didn't return consistent results." << std::endl;
517  return false;
518  }
519 
520  FBiGeom_destroyTag( geom, this_tag, true, &err );
521  CHECK( "ERROR : couldn't delete tag." );
522 
523  return true;
524 }

References ARRAY_IN, ARRAY_INOUT, SimpleArray< T >::capacity(), CHECK, dim, FBiGeom_createTag, FBiGeom_destroyTag, FBiGeom_getArrData, FBiGeom_getEntities, FBiGeom_getRootSet, FBiGeom_setArrData, geom, iBase_BYTES, SimpleArray< T >::ptr(), root_set, SimpleArray< T >::size(), and moab::sum().

Referenced by tags_test().

◆ tag_info_test()

bool tag_info_test ( FBiGeom_Instance  geom)

Definition at line 367 of file testSmooth.cpp.

368 {
369  int err;
370 
372  FBiGeom_getRootSet( geom, &root_set, &err );
373  CHECK( "ERROR : getRootSet failed!" );
374 
375  // create an arbitrary tag, size 4
376  iBase_TagHandle this_tag, tmp_handle;
377  std::string tag_name( "tag_info tag" ), tmp_name;
378  FBiGeom_createTag( geom, &tag_name[0], 4, iBase_BYTES, &this_tag, &err, tag_name.length() );
379  CHECK( "ERROR : can not create a tag." );
380 
381  // get information on the tag
382 
383  char name_buffer[256];
384  FBiGeom_getTagName( geom, this_tag, name_buffer, &err, sizeof( name_buffer ) );
385  CHECK( "ERROR : Couldn't get tag name." );
386  if( tag_name != name_buffer )
387  {
388  std::cerr << "ERROR: getTagName returned '" << name_buffer << "' for tag created as '" << tag_name << "'"
389  << std::endl;
390  return false;
391  }
392 
393  FBiGeom_getTagHandle( geom, &tag_name[0], &tmp_handle, &err, tag_name.length() );
394  CHECK( "ERROR : Couldn't get tag handle." );
395  if( tmp_handle != this_tag )
396  {
397  std::cerr << "ERROR: getTagHandle didn't return consistent result." << std::endl;
398  return false;
399  }
400 
401  int tag_size;
402  FBiGeom_getTagSizeBytes( geom, this_tag, &tag_size, &err );
403  CHECK( "ERROR : Couldn't get tag size." );
404  if( tag_size != 4 )
405  {
406  std::cerr << "ERROR: getTagSizeBytes: expected 4, got " << tag_size << std::endl;
407  return false;
408  }
409 
410  FBiGeom_getTagSizeValues( geom, this_tag, &tag_size, &err );
411  CHECK( "ERROR : Couldn't get tag size." );
412  if( tag_size != 4 )
413  {
414  std::cerr << "ERROR: getTagSizeValues: expected 4, got " << tag_size << std::endl;
415  return false;
416  }
417 
418  int tag_type;
419  FBiGeom_getTagType( geom, this_tag, &tag_type, &err );
420  CHECK( "ERROR : Couldn't get tag type." );
421  if( tag_type != iBase_BYTES )
422  {
423  std::cerr << "ERROR: getTagType: expected " << iBase_BYTES << ", got " << tag_type << std::endl;
424  return false;
425  }
426 
427  FBiGeom_destroyTag( geom, this_tag, true, &err );
428  CHECK( "ERROR : Couldn't delete a tag." );
429 
430  // print information about all the tags in the model
431 
432  std::set< iBase_TagHandle > tags;
435  CHECK( "getEntities( ..., iBase_ALL_TYPES, ... ) failed." );
436  for( int i = 0; i < entities.size(); ++i )
437  {
439  FBiGeom_getAllTags( geom, entities[i], ARRAY_INOUT( tag_arr ), &err );
440  CHECK( "getAllTags failed." );
441  std::copy( tag_arr.begin(), tag_arr.end(), std::inserter( tags, tags.begin() ) );
442  }
443 
444  std::cout << "Tags defined on model: ";
445  bool first = true;
446  for( std::set< iBase_TagHandle >::iterator sit = tags.begin(); sit != tags.end(); ++sit )
447  {
448  FBiGeom_getTagName( geom, *sit, name_buffer, &err, sizeof( name_buffer ) );
449  name_buffer[sizeof( name_buffer ) - 1] = '\0'; // mnake sure of NUL termination
450  CHECK( "getTagName failed." );
451 
452  if( !first ) std::cout << ", ";
453  std::cout << name_buffer;
454  first = false;
455  }
456  if( first ) std::cout << "<none>";
457  std::cout << std::endl;
458 
459  return true;
460 }

References ARRAY_INOUT, SimpleArray< T >::begin(), CHECK, SimpleArray< T >::end(), entities, FBiGeom_createTag, FBiGeom_destroyTag, FBiGeom_getAllTags, FBiGeom_getEntities, FBiGeom_getRootSet, FBiGeom_getTagHandle, FBiGeom_getTagName, FBiGeom_getTagSizeBytes, FBiGeom_getTagSizeValues, FBiGeom_getTagType, moab::GeomUtil::first(), geom, iBase_ALL_TYPES, iBase_BYTES, and root_set.

Referenced by tags_test().

◆ tags_test()

bool tags_test ( FBiGeom_Instance  geom)
Test:
Test tag creating, reading, writing, deleting
  • Load a mesh file

Definition at line 356 of file testSmooth.cpp.

357 {
358  bool success = tag_info_test( geom );
359  if( !success ) return success;
360 
361  success = tag_get_set_test( geom );
362  if( !success ) return success;
363 
364  return true;
365 }

References geom, tag_get_set_test(), and tag_info_test().

Referenced by main().

◆ topology_adjacencies_test()

bool topology_adjacencies_test ( FBiGeom_Instance  geom)
Test:
TSTTG topology adjacencies Test
  • Check topology information
  • Check adjacency

Definition at line 912 of file testSmooth.cpp.

913 {
914  int i, err;
916  FBiGeom_getRootSet( geom, &root_set, &err );
917  CHECK( "ERROR : getRootSet failed!" );
918 
919  int top = iBase_VERTEX;
920  int num_test_top = iBase_ALL_TYPES;
921  std::vector< std::vector< iBase_EntityHandle > > gentity_vectors( num_test_top );
922 
923  // fill the vectors of each topology entities
924  // like lines vector, polygon vector, triangle vector,
925  // quadrilateral, polyhedrron, tet, hex, prism, pyramid,
926  // septahedron vectors
927  for( i = top; i < num_test_top; i++ )
928  {
930  FBiGeom_getEntities( geom, root_set, i, ARRAY_INOUT( gentities ), &err );
931  CHECK( "Failed to get gentities in adjacencies_test." );
932 
933  gentity_vectors[i].resize( gentities.size() );
934  std::copy( gentities.begin(), gentities.end(), gentity_vectors[i].begin() );
935  }
936 
937  // check number of entities for each topology
938  for( i = top; i < num_test_top; i++ )
939  {
940  int num_tops = 0;
941  FBiGeom_getNumOfType( geom, root_set, i, &num_tops, &err );
942  CHECK( "Failed to get number of gentities in adjacencies_test." );
943 
944  if( static_cast< int >( gentity_vectors[i].size() ) != num_tops )
945  {
946  std::cerr << "Number of gentities doesn't agree with number returned for dimension " << i << std::endl;
947  return false;
948  }
949  }
950 
951  // check adjacencies in both directions
952  std::vector< iBase_EntityHandle >::iterator vit;
953  for( i = iBase_REGION; i >= iBase_VERTEX; i-- )
954  {
955  for( vit = gentity_vectors[i].begin(); vit != gentity_vectors[i].end(); ++vit )
956  {
957  iBase_EntityHandle this_gent = *vit;
958 
959  // check downward adjacencies
960  for( int j = iBase_VERTEX; j < i; j++ )
961  {
962 
964  FBiGeom_getEntAdj( geom, this_gent, j, ARRAY_INOUT( lower_ents ), &err );
965  CHECK( "Bi-directional adjacencies test failed." );
966 
967  // for each of them, make sure they are adjacent to the upward ones
968  int num_lower = lower_ents.size();
969  for( int k = 0; k < num_lower; k++ )
970  {
972  FBiGeom_getEntAdj( geom, lower_ents[k], i, ARRAY_INOUT( upper_ents ), &err );
973  CHECK( "Bi-directional adjacencies test failed." );
974  if( std::find( upper_ents.begin(), upper_ents.end(), this_gent ) == upper_ents.end() )
975  {
976  std::cerr << "Didn't find lower-upper adjacency which was supposed to be "
977  "there, dims = "
978  << i << ", " << j << std::endl;
979  return false;
980  }
981  }
982  }
983  }
984  }
985 
986  return true;
987 }

References ARRAY_INOUT, SimpleArray< T >::begin(), CHECK, SimpleArray< T >::end(), FBiGeom_getEntAdj, FBiGeom_getEntities, FBiGeom_getNumOfType, FBiGeom_getRootSet, geom, iBase_ALL_TYPES, iBase_REGION, iBase_VERTEX, root_set, SimpleArray< T >::size(), and size.

Referenced by main().

◆ transforms_test()

bool transforms_test ( FBiGeom_Instance  geom)

Definition at line 1295 of file testSmooth.cpp.

1296 {
1297  int err;
1298 
1299  // construct a brick
1300  iBase_EntityHandle brick = 0;
1301  FBiGeom_createBrick( geom, 1.0, 2.0, 3.0, &brick, &err );
1302  CHECK( "Problems creating brick for transforms test." );
1303 
1304  // move it, then test bounding box
1305  FBiGeom_moveEnt( geom, brick, 0.5, 1.0, 1.5, &err );
1306  CHECK( "Problems moving brick for transforms test." );
1307 
1308  double bb_min[3], bb_max[3];
1309  FBiGeom_getEntBoundBox( geom, brick, bb_min, bb_min + 1, bb_min + 2, bb_max, bb_max + 1, bb_max + 2, &err );
1310  CHECK( "Problems getting bounding box after move." );
1311 
1312  double dtol = 1.0e-6;
1313  if( ( bb_min[0] ) >= dtol || ( bb_min[0] ) <= -dtol || ( bb_min[1] ) >= dtol || ( bb_min[1] ) <= -dtol ||
1314  ( bb_min[2] ) >= dtol || ( bb_min[2] ) <= -dtol || ( bb_max[0] - 1 ) >= dtol || 1 - bb_max[0] >= dtol ||
1315  ( bb_max[1] - 2 ) >= dtol || 2 - bb_max[1] >= dtol || ( bb_max[2] - 3 ) >= dtol || 3 - bb_max[2] >= dtol )
1316  {
1317  std::cerr << "Wrong bounding box after move." << std::endl;
1318  return false;
1319  }
1320 
1321  // now rotate it about +x, then test bounding box
1322  FBiGeom_rotateEnt( geom, brick, 90, 1.0, 0.0, 0.0, &err );
1323  CHECK( "Problems rotating brick for transforms test." );
1324 
1325  FBiGeom_getEntBoundBox( geom, brick, bb_min, bb_min + 1, bb_min + 2, bb_max, bb_max + 1, bb_max + 2, &err );
1326  CHECK( "Problems getting bounding box after rotate." );
1327 
1328  if( ( bb_min[0] ) >= dtol || -bb_min[0] >= dtol || ( bb_min[1] + 3 ) >= dtol || -( bb_min[1] + 3 ) >= dtol ||
1329  ( bb_min[2] ) >= dtol || -( bb_min[2] ) >= dtol || ( bb_max[0] - 1 ) >= dtol || 1 - bb_max[0] >= dtol ||
1330  ( bb_max[1] ) >= dtol || -( bb_max[1] ) >= dtol || ( bb_max[2] - 2 ) >= dtol || 2 - bb_max[2] >= dtol )
1331  {
1332  std::cerr << "Wrong bounding box after rotate." << std::endl;
1333  return false;
1334  }
1335 
1336  // now reflect through y plane; should recover original bb
1337  FBiGeom_reflectEnt( geom, brick, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, &err );
1338  CHECK( "Problems reflecting brick for transforms test." );
1339 
1340  FBiGeom_getEntBoundBox( geom, brick, bb_min, bb_min + 1, bb_min + 2, bb_max, bb_max + 1, bb_max + 2, &err );
1341  CHECK( "Problems getting bounding box after reflect." );
1342 
1343  if( ( bb_min[0] ) >= dtol || -( bb_min[0] ) >= dtol || ( bb_min[1] ) >= dtol || ( bb_min[2] ) >= dtol ||
1344  -( bb_min[1] ) >= dtol || -( bb_min[2] ) >= dtol || ( bb_max[0] - 1 ) >= dtol || 1 - bb_max[0] >= dtol ||
1345  ( bb_max[1] - 3 ) >= dtol || 3 - bb_max[1] >= dtol || ( bb_max[2] - 2 ) >= dtol || 2 - bb_max[2] >= dtol )
1346  {
1347  std::cerr << "Wrong bounding box after reflect." << std::endl;
1348  return false;
1349  }
1350 
1351  // must have worked; delete the entities then return
1352  FBiGeom_deleteEnt( geom, brick, &err );
1353  CHECK( "Problems deleting brick after transforms check." );
1354  return true;
1355 }

References CHECK, FBiGeom_createBrick, FBiGeom_deleteEnt, FBiGeom_getEntBoundBox, FBiGeom_moveEnt, FBiGeom_reflectEnt, FBiGeom_rotateEnt, and geom.