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

Go to the source code of this file.

Functions

void test_dimension_pair ()
 
void test_type_names ()
 
void test_dimension ()
 
void test_vertices_per_entity ()
 
void test_num_sub_entities ()
 
void test_sub_entity_type_vtx ()
 
void test_sub_entity_type_edge ()
 
void test_sub_entity_type_tri ()
 
void test_sub_entity_type_quad ()
 
void test_sub_entity_type_tet ()
 
void test_sub_entity_type_pyr ()
 
void test_sub_entity_type_pri ()
 
void test_sub_entity_type_knife ()
 
void test_sub_entity_type_hex ()
 
void test_sub_entity_indices_vtx ()
 
void test_sub_entity_indices_edge ()
 
void test_sub_entity_indices_tri ()
 
void test_sub_entity_indices_quad ()
 
void test_sub_entity_indices_tet ()
 
void test_sub_entity_indices_pyr ()
 
void test_sub_entity_indices_pri ()
 
void test_sub_entity_indices_hex ()
 
void test_side_number_tri ()
 
void test_side_number_quad ()
 
void test_side_number_tet ()
 
void test_side_number_pyr ()
 
void test_side_number_pri ()
 
void test_side_number_hex ()
 
void test_opposite_side_tri ()
 
void test_opposite_side_quad ()
 
void test_opposite_side_tet ()
 
void test_opposite_side_hex ()
 
void test_has_mid_nodes (EntityType type)
 
void test_has_mid_nodes_edge ()
 
void test_has_mid_nodes_tri ()
 
void test_has_mid_nodes_quad ()
 
void test_has_mid_nodes_tet ()
 
void test_has_mid_nodes_pyr ()
 
void test_has_mid_nodes_pri ()
 
void test_has_mid_nodes_knife ()
 
void test_has_mid_nodes_hex ()
 
void test_ho_node_parent ()
 
void test_ho_node_index ()
 
void test_sub_entity_nodes (EntityType parent, int sub_dimension)
 
void test_sub_entity_nodes (EntityType parent, int num_nodes, int sub_dimension)
 
void test_sub_entity_nodes_tri_edges ()
 
void test_sub_entity_nodes_quad_edges ()
 
void test_sub_entity_nodes_tet_edges ()
 
void test_sub_entity_nodes_tet_faces ()
 
void test_sub_entity_nodes_pyr_edges ()
 
void test_sub_entity_nodes_pyr_faces ()
 
void test_sub_entity_nodes_pri_edges ()
 
void test_sub_entity_nodes_pri_faces ()
 
void test_sub_entity_nodes_kni_edges ()
 
void test_sub_entity_nodes_kni_faces ()
 
void test_sub_entity_nodes_hex_edges ()
 
void test_sub_entity_nodes_hex_faces ()
 
void prism_issue ()
 
void test_wedges ()
 
int main ()
 
void do_test_sub_entity_type_2d (EntityType type)
 
void do_test_sub_entity_type_3d (EntityType type, int num_faces, const EntityType *face_types)
 
void test_0d_sub_entity_indices (EntityType type, int num_vtx)
 
void test_1d_sub_entity_indices (EntityType type, int num_edges, const int(*edge_indices)[2])
 
void test_2d_sub_entity_indices (EntityType type, int num_faces, const int(*face_indices)[5])
 
void test_elem_as_sub_entity (EntityType type, int dim, int num_vertices)
 
static void do_test_side_number_1d (EntityType type, int idx)
 
static void do_test_side_number_2d (EntityType type, int idx)
 

Variables

const EntityType elem_types [] = { MBTRI, MBQUAD, MBTET, MBPYRAMID, MBPRISM, MBHEX, MBMAXTYPE }
 

Function Documentation

◆ do_test_side_number_1d()

static void do_test_side_number_1d ( EntityType  type,
int  idx 
)
static

Definition at line 544 of file mbcn_test.cpp.

545 {
546  // define a random handle list
547  const int elem_verts[] = { 7400, 6233, 3027, 0454, 6839, 5391, 7735, 3603 };
548  // get side indices
549  int side_idx[4] = { 0, 0 };
550  CN::SubEntityVertexIndices( type, 1, idx, side_idx );
551 
552  // "reversed" and "offset" are the same thing for edges.
553  int side_conn[2] = { elem_verts[side_idx[0]], elem_verts[side_idx[1]] };
554  int rev_conn[2] = { elem_verts[side_idx[1]], elem_verts[side_idx[0]] };
555  int result_side = -100, result_sense = -100, result_offset = -100;
556  int err = CN::SideNumber( type, elem_verts, side_conn, 2, 1, result_side, result_sense, result_offset );
557  CHECK_EQUAL( 0, err );
558  CHECK_EQUAL( idx, result_side );
559  CHECK_EQUAL( 1, result_sense );
560  CHECK_EQUAL( 0, result_offset );
561  err = CN::SideNumber( type, elem_verts, rev_conn, 2, 1, result_side, result_sense, result_offset );
562  CHECK_EQUAL( 0, err );
563  CHECK_EQUAL( idx, result_side );
564  CHECK( result_offset == 1 || result_sense == -1 );
565 }

References CHECK, CHECK_EQUAL, moab::CN::SideNumber(), and moab::CN::SubEntityVertexIndices().

Referenced by test_side_number_hex(), test_side_number_pri(), test_side_number_pyr(), test_side_number_quad(), test_side_number_tet(), and test_side_number_tri().

◆ do_test_side_number_2d()

static void do_test_side_number_2d ( EntityType  type,
int  idx 
)
static

Definition at line 567 of file mbcn_test.cpp.

568 {
569  // define a random handle list
570  const int elem_verts[] = { 7400, 6233, 3027, 0454, 6839, 5391, 7735, 3603 };
571  // get side indices
572  const int side_size = CN::VerticesPerEntity( CN::SubEntityType( type, 2, idx ) );
573  int side_idx[4] = { 0, 0, 0, 0 };
574  CN::SubEntityVertexIndices( type, 2, idx, side_idx );
575 
576  // for each possible forward or reverse offset
577  for( int rev = -1; rev < 2; rev += 2 )
578  {
579  for( int off = 0; off < side_size; ++off )
580  {
581  int side_conn[4];
582  side_conn[3] = 0;
583  for( int i = 0; i < side_size; ++i )
584  side_conn[( side_size + rev * i ) % side_size] = elem_verts[side_idx[( i + off ) % side_size]];
585 
586  int result_side = -100, result_sense = -100, result_offset = -100;
587  int err =
588  CN::SideNumber( type, elem_verts, side_conn, side_size, 2, result_side, result_sense, result_offset );
589  CHECK_EQUAL( 0, err );
590  CHECK_EQUAL( idx, result_side );
591  CHECK_EQUAL( rev, result_sense );
592  CHECK_EQUAL( off, result_offset );
593  }
594  }
595 }

References CHECK_EQUAL, moab::CN::SideNumber(), moab::CN::SubEntityType(), moab::CN::SubEntityVertexIndices(), and moab::CN::VerticesPerEntity().

Referenced by test_side_number_hex(), test_side_number_pri(), test_side_number_pyr(), and test_side_number_tet().

◆ do_test_sub_entity_type_2d()

void do_test_sub_entity_type_2d ( EntityType  type)

Definition at line 299 of file mbcn_test.cpp.

300 {
301  for( int j = 0; j < CN::VerticesPerEntity( type ); ++j )
302  {
303  CHECK_EQUAL( MBVERTEX, CN::SubEntityType( type, 0, j ) );
304  CHECK_EQUAL( MBEDGE, CN::SubEntityType( type, 1, j ) );
305  }
306  CHECK_EQUAL( type, CN::SubEntityType( type, 2, 0 ) );
307 }

References CHECK_EQUAL, MBEDGE, MBVERTEX, moab::CN::SubEntityType(), and moab::CN::VerticesPerEntity().

Referenced by test_sub_entity_type_quad(), and test_sub_entity_type_tri().

◆ do_test_sub_entity_type_3d()

void do_test_sub_entity_type_3d ( EntityType  type,
int  num_faces,
const EntityType *  face_types 
)

Definition at line 309 of file mbcn_test.cpp.

310 {
311  for( int j = 0; j < CN::VerticesPerEntity( type ); ++j )
312  {
313  CHECK_EQUAL( MBVERTEX, CN::SubEntityType( type, 0, j ) );
314  }
315 
316  for( int j = 0; j < CN::NumSubEntities( type, 1 ); ++j )
317  {
318  CHECK_EQUAL( MBEDGE, CN::SubEntityType( type, 1, j ) );
319  }
320 
321  for( int j = 0; j < num_faces; ++j )
322  {
323  EntityType sub_type = CN::SubEntityType( type, 2, j );
324  CHECK_EQUAL( face_types[j], sub_type );
325  }
326 
327  CHECK_EQUAL( type, CN::SubEntityType( type, 3, 0 ) );
328 }

References CHECK_EQUAL, MBEDGE, MBVERTEX, moab::CN::NumSubEntities(), moab::CN::SubEntityType(), and moab::CN::VerticesPerEntity().

Referenced by test_sub_entity_type_hex(), test_sub_entity_type_knife(), test_sub_entity_type_pri(), test_sub_entity_type_pyr(), and test_sub_entity_type_tet().

◆ main()

int main ( )

Definition at line 133 of file mbcn_test.cpp.

134 {
135  int result = 0;
136  result += RUN_TEST( test_dimension_pair );
137  result += RUN_TEST( test_type_names );
138  result += RUN_TEST( test_dimension );
139  result += RUN_TEST( test_vertices_per_entity );
140  result += RUN_TEST( test_num_sub_entities );
141 
142  result += RUN_TEST( test_sub_entity_type_vtx );
143  result += RUN_TEST( test_sub_entity_type_edge );
144  result += RUN_TEST( test_sub_entity_type_tri );
145  result += RUN_TEST( test_sub_entity_type_quad );
146  result += RUN_TEST( test_sub_entity_type_tet );
147  result += RUN_TEST( test_sub_entity_type_pyr );
148  result += RUN_TEST( test_sub_entity_type_pri );
150  result += RUN_TEST( test_sub_entity_type_hex );
151 
160 
161  result += RUN_TEST( test_side_number_tri );
162  result += RUN_TEST( test_side_number_quad );
163  result += RUN_TEST( test_side_number_tet );
164  result += RUN_TEST( test_side_number_pyr );
165  result += RUN_TEST( test_side_number_pri );
166  result += RUN_TEST( test_side_number_hex );
167 
168  result += RUN_TEST( test_opposite_side_tri );
169  result += RUN_TEST( test_opposite_side_quad );
170  result += RUN_TEST( test_opposite_side_tet );
171  result += RUN_TEST( test_opposite_side_hex );
172 
173  result += RUN_TEST( test_has_mid_nodes_edge );
174  result += RUN_TEST( test_has_mid_nodes_tri );
175  result += RUN_TEST( test_has_mid_nodes_quad );
176  result += RUN_TEST( test_has_mid_nodes_tet );
177  result += RUN_TEST( test_has_mid_nodes_pyr );
178  result += RUN_TEST( test_has_mid_nodes_pri );
179  result += RUN_TEST( test_has_mid_nodes_knife );
180  result += RUN_TEST( test_has_mid_nodes_hex );
181 
194 
195  result += RUN_TEST( test_ho_node_parent );
196  result += RUN_TEST( test_ho_node_index );
197  result += RUN_TEST( prism_issue );
198  result += RUN_TEST( test_wedges );
199  return result;
200 }

References prism_issue(), RUN_TEST, test_dimension(), test_dimension_pair(), test_has_mid_nodes_edge(), test_has_mid_nodes_hex(), test_has_mid_nodes_knife(), test_has_mid_nodes_pri(), test_has_mid_nodes_pyr(), test_has_mid_nodes_quad(), test_has_mid_nodes_tet(), test_has_mid_nodes_tri(), test_ho_node_index(), test_ho_node_parent(), test_num_sub_entities(), test_opposite_side_hex(), test_opposite_side_quad(), test_opposite_side_tet(), test_opposite_side_tri(), test_side_number_hex(), test_side_number_pri(), test_side_number_pyr(), test_side_number_quad(), test_side_number_tet(), test_side_number_tri(), test_sub_entity_indices_edge(), test_sub_entity_indices_hex(), test_sub_entity_indices_pri(), test_sub_entity_indices_pyr(), test_sub_entity_indices_quad(), test_sub_entity_indices_tet(), test_sub_entity_indices_tri(), test_sub_entity_indices_vtx(), test_sub_entity_nodes_hex_edges(), test_sub_entity_nodes_hex_faces(), test_sub_entity_nodes_kni_edges(), test_sub_entity_nodes_kni_faces(), test_sub_entity_nodes_pri_edges(), test_sub_entity_nodes_pri_faces(), test_sub_entity_nodes_pyr_edges(), test_sub_entity_nodes_pyr_faces(), test_sub_entity_nodes_quad_edges(), test_sub_entity_nodes_tet_edges(), test_sub_entity_nodes_tet_faces(), test_sub_entity_nodes_tri_edges(), test_sub_entity_type_edge(), test_sub_entity_type_hex(), test_sub_entity_type_knife(), test_sub_entity_type_pri(), test_sub_entity_type_pyr(), test_sub_entity_type_quad(), test_sub_entity_type_tet(), test_sub_entity_type_tri(), test_sub_entity_type_vtx(), test_type_names(), test_vertices_per_entity(), and test_wedges().

◆ prism_issue()

void prism_issue ( )

Definition at line 1166 of file mbcn_test.cpp.

1167 {
1168  moab::Core mb;
1169 
1170  std::vector< moab::EntityHandle > conn;
1171  double coords[3];
1172  for( int i = 0; i < 15; ++i )
1173  {
1175  mb.create_vertex( coords, h );
1176  conn.push_back( h );
1177  }
1178 
1180  mb.create_element( moab::MBPRISM, conn.data(), 15, w );
1181 
1182  // this leads to the failure
1183  {
1184  std::vector< moab::EntityHandle > adj;
1185  mb.get_adjacencies( &w, 1, 2, true, adj );
1186  }
1187  std::vector< moab::EntityHandle > edges;
1188  std::vector< moab::EntityHandle > faces;
1189  mb.get_entities_by_dimension( 0, 1, edges );
1190  for( const auto& e : edges )
1191  {
1192  std::vector< moab::EntityHandle > conn;
1193  std::cout << "edge " << e << " connectivity: ";
1194 
1195  mb.get_connectivity( &e, 1, conn );
1196  for( const auto& n : conn )
1197  std::cout << n << " ";
1198  std::cout << "\n";
1199  }
1200  mb.get_entities_by_dimension( 0, 2, faces );
1201  for( const auto& f : faces )
1202  {
1203  std::vector< moab::EntityHandle > conn;
1204  std::cout << "face " << f << " connectivity: ";
1205 
1206  mb.get_connectivity( &f, 1, conn );
1207  for( const auto& n : conn )
1208  std::cout << n << " ";
1209  std::cout << "\n";
1210  }
1211  std::vector< moab::EntityHandle > nodes;
1212  mb.get_entities_by_dimension( 0, 0, nodes );
1213  for( const auto& n : nodes )
1214  {
1215  std::vector< moab::EntityHandle > adj;
1216  std::cout << "node " << n << " connection: ";
1217  adj.clear();
1218  mb.get_adjacencies( &n, 1, 1, true, adj );
1219  std::cout << adj.size() << " edges,";
1220  // there are either 1 or 3 adjacent edges to each vertex (1 for mid edge vertex)
1221  CHECK( 1 == adj.size() || 3 == adj.size() );
1222  adj.clear();
1223  mb.get_adjacencies( &n, 1, 2, true, adj );
1224  std::cout << adj.size() << " faces,";
1225  // there are either 2 or 3 adjacent faces to each vertex ( 2 for mid edge evertex)
1226  CHECK( 2 == adj.size() || 3 == adj.size() );
1227  adj.clear();
1228  mb.get_adjacencies( &n, 1, 3, true, adj );
1229  std::cout << adj.size() << " volumes\n";
1230  }
1231 }

References CHECK, moab::Core::create_element(), moab::Core::create_vertex(), moab::Core::get_adjacencies(), moab::Core::get_connectivity(), moab::Core::get_entities_by_dimension(), mb, and MBPRISM.

Referenced by main().

◆ test_0d_sub_entity_indices()

void test_0d_sub_entity_indices ( EntityType  type,
int  num_vtx 
)

Definition at line 382 of file mbcn_test.cpp.

383 {
384  for( int i = 0; i < num_vtx; ++i )
385  {
386  // zero input array
387  int indices[2] = { 0, -100 };
388  // check correct results
389  CN::SubEntityVertexIndices( type, 0, i, indices );
390  CHECK_EQUAL( i, indices[0] );
391  // check didn't write past end of array
392  CHECK_EQUAL( -100, indices[1] );
393  }
394 }

References CHECK_EQUAL, and moab::CN::SubEntityVertexIndices().

Referenced by test_sub_entity_indices_edge(), test_sub_entity_indices_hex(), test_sub_entity_indices_pri(), test_sub_entity_indices_pyr(), test_sub_entity_indices_quad(), test_sub_entity_indices_tet(), and test_sub_entity_indices_tri().

◆ test_1d_sub_entity_indices()

void test_1d_sub_entity_indices ( EntityType  type,
int  num_edges,
const int(*)  edge_indices[2] 
)

Definition at line 396 of file mbcn_test.cpp.

397 {
398  for( int i = 0; i < num_edges; ++i )
399  {
400  // zero input array
401  int indices[3] = { 0, 0, -99 };
402  // check correct results
403  CN::SubEntityVertexIndices( type, 1, i, indices );
404  if( edge_indices[i][0] == indices[0] )
405  {
406  CHECK_EQUAL( edge_indices[i][1], indices[1] );
407  }
408  else
409  {
410  CHECK_EQUAL( edge_indices[i][0], indices[1] );
411  CHECK_EQUAL( edge_indices[i][1], indices[0] );
412  }
413  // check didn't write past end of array
414  CHECK_EQUAL( -99, indices[2] );
415  }
416 }

References CHECK_EQUAL, and moab::CN::SubEntityVertexIndices().

Referenced by test_sub_entity_indices_hex(), test_sub_entity_indices_pri(), test_sub_entity_indices_pyr(), test_sub_entity_indices_quad(), test_sub_entity_indices_tet(), and test_sub_entity_indices_tri().

◆ test_2d_sub_entity_indices()

void test_2d_sub_entity_indices ( EntityType  type,
int  num_faces,
const int(*)  face_indices[5] 
)

Definition at line 418 of file mbcn_test.cpp.

419 {
420  for( int i = 0; i < num_faces; ++i )
421  {
422  // zero input array
423  int indices[5] = { 0, 0, 0, -99, -99 };
424  // check correct results
425  CN::SubEntityVertexIndices( type, 2, i, indices );
426  const int num_vtx = face_indices[i][0];
427  if( num_vtx != 3 ) CHECK_EQUAL( 4, num_vtx );
428  const int* exp_index = face_indices[i] + 1;
429  int off = std::find( indices, indices + num_vtx, exp_index[0] ) - indices;
430  CHECK( off < num_vtx );
431  /* Expect faces to be ordered such that CCW normal is outwards
432  *
433  bool reverse = indices[(off+num_vtx-1)%num_vtx] == exp_index[1];
434  if (reverse) {
435  CHECK_EQUAL( exp_index[1], indices[(off+num_vtx-1)%num_vtx] );
436  CHECK_EQUAL( exp_index[2], indices[(off+num_vtx-2)%num_vtx] );
437  if (num_vtx == 4)
438  CHECK_EQUAL( exp_index[3], indices[(off+num_vtx-3)%num_vtx] );
439  }
440  else {
441  */
442  CHECK_EQUAL( exp_index[1], indices[( off + 1 ) % num_vtx] );
443  CHECK_EQUAL( exp_index[2], indices[( off + 2 ) % num_vtx] );
444  if( num_vtx == 4 ) CHECK_EQUAL( exp_index[3], indices[( off + 3 ) % num_vtx] );
445  /*
446  }
447  */
448 
449  // check didn't write past end of array
450  if( num_vtx == 3 ) CHECK_EQUAL( -99, indices[3] );
451  CHECK_EQUAL( -99, indices[4] );
452  }
453 }

References CHECK, CHECK_EQUAL, and moab::CN::SubEntityVertexIndices().

Referenced by test_sub_entity_indices_hex(), test_sub_entity_indices_pri(), test_sub_entity_indices_pyr(), and test_sub_entity_indices_tet().

◆ test_dimension()

void test_dimension ( )

Definition at line 235 of file mbcn_test.cpp.

236 {
237  CHECK_EQUAL( 0, CN::Dimension( MBVERTEX ) );
238  CHECK_EQUAL( 1, CN::Dimension( MBEDGE ) );
239  CHECK_EQUAL( 2, CN::Dimension( MBTRI ) );
240  CHECK_EQUAL( 2, CN::Dimension( MBQUAD ) );
241  CHECK_EQUAL( 2, CN::Dimension( MBPOLYGON ) );
242  CHECK_EQUAL( 3, CN::Dimension( MBTET ) );
243  CHECK_EQUAL( 3, CN::Dimension( MBPYRAMID ) );
244  CHECK_EQUAL( 3, CN::Dimension( MBPRISM ) );
245  CHECK_EQUAL( 3, CN::Dimension( MBKNIFE ) );
246  CHECK_EQUAL( 3, CN::Dimension( MBHEX ) );
247  CHECK_EQUAL( 3, CN::Dimension( MBPOLYHEDRON ) );
248 }

References CHECK_EQUAL, moab::CN::Dimension(), MBEDGE, MBHEX, MBKNIFE, MBPOLYGON, MBPOLYHEDRON, MBPRISM, MBPYRAMID, MBQUAD, MBTET, MBTRI, and MBVERTEX.

Referenced by main().

◆ test_dimension_pair()

void test_dimension_pair ( )

Definition at line 205 of file mbcn_test.cpp.

206 {
207  DimensionPair dp;
208 
209  dp = CN::TypeDimensionMap[0];
210  CHECK_EQUAL( MBVERTEX, dp.first );
211  CHECK_EQUAL( MBVERTEX, dp.second );
212 
213  dp = CN::TypeDimensionMap[1];
214  CHECK_EQUAL( MBEDGE, dp.first );
215  CHECK_EQUAL( MBEDGE, dp.second );
216 
217  dp = CN::TypeDimensionMap[2];
218  CHECK_EQUAL( MBTRI, dp.first );
219  CHECK_EQUAL( MBPOLYGON, dp.second );
220 
221  dp = CN::TypeDimensionMap[3];
222  CHECK_EQUAL( MBTET, dp.first );
223  CHECK_EQUAL( MBPOLYHEDRON, dp.second );
224 }

References CHECK_EQUAL, MBEDGE, MBPOLYGON, MBPOLYHEDRON, MBTET, MBTRI, MBVERTEX, and moab::CN::TypeDimensionMap.

Referenced by main().

◆ test_elem_as_sub_entity()

void test_elem_as_sub_entity ( EntityType  type,
int  dim,
int  num_vertices 
)

Definition at line 455 of file mbcn_test.cpp.

456 {
457  int indices[9] = { -2, -2, -2, -2, -2, -2, -2, -2, -2 };
458  CN::SubEntityVertexIndices( type, dim, 0, indices );
459  for( int i = 0; i < num_vertices; ++i )
460  CHECK_EQUAL( i, indices[i] );
461  // make sure didn't write past end
462  CHECK_EQUAL( -2, indices[num_vertices] );
463 }

References CHECK_EQUAL, dim, and moab::CN::SubEntityVertexIndices().

Referenced by test_sub_entity_indices_edge(), test_sub_entity_indices_hex(), test_sub_entity_indices_pri(), test_sub_entity_indices_pyr(), test_sub_entity_indices_quad(), test_sub_entity_indices_tet(), test_sub_entity_indices_tri(), and test_sub_entity_indices_vtx().

◆ test_has_mid_nodes()

void test_has_mid_nodes ( EntityType  type)

Definition at line 884 of file mbcn_test.cpp.

885 {
886  const int combinations[][4] = { { 0, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 1, 1, 0 },
887  { 0, 0, 0, 1 }, { 0, 1, 0, 1 }, { 0, 0, 1, 1 }, { 0, 1, 1, 1 } };
888 
889  const int dim = CN::Dimension( type );
890  // calculate number of valid combinations of ho node flags
891  int num_comb = 1;
892  for( int i = 0; i < dim; ++i )
893  num_comb *= 2;
894  // for each valid combination
895  for( int c = 0; c < num_comb; ++c )
896  {
897  // calculate corresponding number of vertices in element
898  const int* ho_nodes = combinations[c];
899  int num_vtx = CN::VerticesPerEntity( type );
900  switch( dim )
901  {
902  case 3:
903  case 2:
904  // extra clauses to avoid fall-through error
905  if( 3 == dim && ho_nodes[2] ) num_vtx += CN::NumSubEntities( type, 2 );
906  if( 2 <= dim && ho_nodes[1] ) num_vtx += CN::NumSubEntities( type, 1 );
907  }
908  if( ho_nodes[dim] ) ++num_vtx;
909 
910  CHECK_EQUAL( ho_nodes[1], (int)CN::HasMidEdgeNodes( type, num_vtx ) );
911  CHECK_EQUAL( ho_nodes[2], (int)CN::HasMidFaceNodes( type, num_vtx ) );
912  CHECK_EQUAL( ho_nodes[3], (int)CN::HasMidRegionNodes( type, num_vtx ) );
913 
914  int results[4] = { 0, -1, -1, -1 };
915  CN::HasMidNodes( type, num_vtx, results );
916  CHECK_EQUAL( 0, !!results[0] );
917  CHECK_EQUAL( ho_nodes[1], !!results[1] );
918  CHECK_EQUAL( ho_nodes[2], !!results[2] );
919  CHECK_EQUAL( ho_nodes[3], !!results[3] );
920  }
921 }

References CHECK_EQUAL, dim, moab::CN::Dimension(), moab::CN::HasMidEdgeNodes(), moab::CN::HasMidFaceNodes(), moab::CN::HasMidNodes(), moab::CN::HasMidRegionNodes(), moab::CN::NumSubEntities(), and moab::CN::VerticesPerEntity().

Referenced by test_has_mid_nodes_edge(), test_has_mid_nodes_hex(), test_has_mid_nodes_knife(), test_has_mid_nodes_pri(), test_has_mid_nodes_pyr(), test_has_mid_nodes_quad(), test_has_mid_nodes_tet(), and test_has_mid_nodes_tri().

◆ test_has_mid_nodes_edge()

void test_has_mid_nodes_edge ( )

Definition at line 44 of file mbcn_test.cpp.

45 {
47 }

References MBEDGE, and test_has_mid_nodes().

Referenced by main().

◆ test_has_mid_nodes_hex()

void test_has_mid_nodes_hex ( )

Definition at line 72 of file mbcn_test.cpp.

73 {
75 }

References MBHEX, and test_has_mid_nodes().

Referenced by main().

◆ test_has_mid_nodes_knife()

void test_has_mid_nodes_knife ( )

Definition at line 68 of file mbcn_test.cpp.

69 {
71 }

References MBKNIFE, and test_has_mid_nodes().

Referenced by main().

◆ test_has_mid_nodes_pri()

void test_has_mid_nodes_pri ( )

Definition at line 64 of file mbcn_test.cpp.

65 {
67 }

References MBPRISM, and test_has_mid_nodes().

Referenced by main().

◆ test_has_mid_nodes_pyr()

void test_has_mid_nodes_pyr ( )

Definition at line 60 of file mbcn_test.cpp.

61 {
63 }

References MBPYRAMID, and test_has_mid_nodes().

Referenced by main().

◆ test_has_mid_nodes_quad()

void test_has_mid_nodes_quad ( )

Definition at line 52 of file mbcn_test.cpp.

53 {
55 }

References MBQUAD, and test_has_mid_nodes().

Referenced by main().

◆ test_has_mid_nodes_tet()

void test_has_mid_nodes_tet ( )

Definition at line 56 of file mbcn_test.cpp.

57 {
59 }

References MBTET, and test_has_mid_nodes().

Referenced by main().

◆ test_has_mid_nodes_tri()

void test_has_mid_nodes_tri ( )

Definition at line 48 of file mbcn_test.cpp.

49 {
51 }

References MBTRI, and test_has_mid_nodes().

Referenced by main().

◆ test_ho_node_index()

void test_ho_node_index ( )

Definition at line 991 of file mbcn_test.cpp.

992 {
993  const int combinations[][4] = { { 0, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 1, 1, 0 },
994  { 0, 0, 0, 1 }, { 0, 1, 0, 1 }, { 0, 0, 1, 1 }, { 0, 1, 1, 1 } };
995 
996  for( const EntityType* t = elem_types; *t != MBMAXTYPE; ++t )
997  {
998  const EntityType type = *t;
999  const int dim = CN::Dimension( type );
1000  // calculate number of valid combinations of ho node flags
1001  int num_comb = 1;
1002  for( int i = 0; i < dim; ++i )
1003  num_comb *= 2;
1004  // for each valid combination
1005  for( int c = 0; c < num_comb; ++c )
1006  {
1007  // calculate corresponding number of vertices in element
1008  const int* ho_nodes = combinations[c];
1009  int num_vtx = CN::VerticesPerEntity( type );
1010  switch( dim )
1011  {
1012  case 3:
1013  case 2:
1014  // extra clauses to avoid fall-through error
1015  if( 3 == dim && ho_nodes[2] ) num_vtx += CN::NumSubEntities( type, 2 );
1016  if( 2 <= dim && ho_nodes[1] ) num_vtx += CN::NumSubEntities( type, 1 );
1017  }
1018  if( ho_nodes[dim] ) ++num_vtx;
1019 
1020  // start at first higher-order node
1021  int pos = CN::VerticesPerEntity( type );
1022 
1023  // check mid-edge
1024  if( dim > 1 && ho_nodes[1] )
1025  {
1026  for( int i = 0; i < CN::NumSubEntities( type, 1 ); ++i )
1027  {
1028  int idx = CN::HONodeIndex( type, num_vtx, 1, i );
1029  CHECK_EQUAL( pos++, idx );
1030  }
1031  }
1032 
1033  // check mid-face
1034  if( dim > 2 && ho_nodes[2] )
1035  {
1036  for( int i = 0; i < CN::NumSubEntities( type, 2 ); ++i )
1037  {
1038  int idx = CN::HONodeIndex( type, num_vtx, 2, i );
1039  CHECK_EQUAL( pos++, idx );
1040  }
1041  }
1042 
1043  // check mid-volume
1044  if( ho_nodes[dim] )
1045  {
1046  int idx = CN::HONodeIndex( type, num_vtx, dim, 0 );
1047  CHECK_EQUAL( pos++, idx );
1048  }
1049  } // for ho_node combinatinos
1050  } // for each type
1051 }

References CHECK_EQUAL, dim, moab::CN::Dimension(), elem_types, moab::CN::HONodeIndex(), MBMAXTYPE, moab::CN::NumSubEntities(), t, and moab::CN::VerticesPerEntity().

Referenced by main().

◆ test_ho_node_parent()

void test_ho_node_parent ( )

Definition at line 923 of file mbcn_test.cpp.

924 {
925  const int combinations[][4] = { { 0, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 1, 1, 0 },
926  { 0, 0, 0, 1 }, { 0, 1, 0, 1 }, { 0, 0, 1, 1 }, { 0, 1, 1, 1 } };
927 
928  for( const EntityType* t = elem_types; *t != MBMAXTYPE; ++t )
929  {
930  const EntityType type = *t;
931  const int dim = CN::Dimension( type );
932  // calculate number of valid combinations of ho node flags
933  int num_comb = 1;
934  for( int i = 0; i < dim; ++i )
935  num_comb *= 2;
936  // for each valid combination
937  for( int c = 0; c < num_comb; ++c )
938  {
939  // calculate corresponding number of vertices in element
940  const int* ho_nodes = combinations[c];
941  int num_vtx = CN::VerticesPerEntity( type );
942  switch( dim )
943  {
944  case 3:
945  case 2:
946  // extra clauses to avoid fall-through error
947  if( 3 == dim && ho_nodes[2] ) num_vtx += CN::NumSubEntities( type, 2 );
948  if( 2 <= dim && ho_nodes[1] ) num_vtx += CN::NumSubEntities( type, 1 );
949  }
950  if( ho_nodes[dim] ) ++num_vtx;
951 
952  // start at first higher-order node
953  int pos = CN::VerticesPerEntity( type );
954 
955  // check mid-edge
956  if( dim > 1 && ho_nodes[1] )
957  {
958  for( int i = 0; i < CN::NumSubEntities( type, 1 ); ++i )
959  {
960  int pdim = -1, pidx = -1;
961  CN::HONodeParent( type, num_vtx, pos++, pdim, pidx );
962  CHECK_EQUAL( 1, pdim );
963  CHECK_EQUAL( i, pidx );
964  }
965  }
966 
967  // check mid-face
968  if( dim > 2 && ho_nodes[2] )
969  {
970  for( int i = 0; i < CN::NumSubEntities( type, 2 ); ++i )
971  {
972  int pdim = -1, pidx = -1;
973  CN::HONodeParent( type, num_vtx, pos++, pdim, pidx );
974  CHECK_EQUAL( 2, pdim );
975  CHECK_EQUAL( i, pidx );
976  }
977  }
978 
979  // check mid-volume
980  if( ho_nodes[dim] )
981  {
982  int pdim = -1, pidx = -1;
983  CN::HONodeParent( type, num_vtx, pos++, pdim, pidx );
984  CHECK_EQUAL( dim, pdim );
985  CHECK_EQUAL( 0, pidx );
986  }
987  } // for ho_node combinatinos
988  } // for each type
989 }

References CHECK_EQUAL, dim, moab::CN::Dimension(), elem_types, moab::CN::HONodeParent(), MBMAXTYPE, moab::CN::NumSubEntities(), t, and moab::CN::VerticesPerEntity().

Referenced by main().

◆ test_num_sub_entities()

void test_num_sub_entities ( )

Definition at line 263 of file mbcn_test.cpp.

264 {
265  CHECK_EQUAL( 1, CN::NumSubEntities( MBVERTEX, 0 ) );
266 
267  CHECK_EQUAL( 2, CN::NumSubEntities( MBEDGE, 0 ) );
268  CHECK_EQUAL( 1, CN::NumSubEntities( MBEDGE, 1 ) );
269 
270  CHECK_EQUAL( 3, CN::NumSubEntities( MBTRI, 0 ) );
271  CHECK_EQUAL( 3, CN::NumSubEntities( MBTRI, 1 ) );
272  CHECK_EQUAL( 1, CN::NumSubEntities( MBTRI, 2 ) );
273 
274  CHECK_EQUAL( 4, CN::NumSubEntities( MBQUAD, 0 ) );
275  CHECK_EQUAL( 4, CN::NumSubEntities( MBQUAD, 1 ) );
276  CHECK_EQUAL( 1, CN::NumSubEntities( MBQUAD, 2 ) );
277 
278  CHECK_EQUAL( 4, CN::NumSubEntities( MBTET, 0 ) );
279  CHECK_EQUAL( 6, CN::NumSubEntities( MBTET, 1 ) );
280  CHECK_EQUAL( 4, CN::NumSubEntities( MBTET, 2 ) );
281 
282  CHECK_EQUAL( 5, CN::NumSubEntities( MBPYRAMID, 0 ) );
283  CHECK_EQUAL( 8, CN::NumSubEntities( MBPYRAMID, 1 ) );
284  CHECK_EQUAL( 5, CN::NumSubEntities( MBPYRAMID, 2 ) );
285 
286  CHECK_EQUAL( 6, CN::NumSubEntities( MBPRISM, 0 ) );
287  CHECK_EQUAL( 9, CN::NumSubEntities( MBPRISM, 1 ) );
288  CHECK_EQUAL( 5, CN::NumSubEntities( MBPRISM, 2 ) );
289 
290  CHECK_EQUAL( 7, CN::NumSubEntities( MBKNIFE, 0 ) );
291  CHECK_EQUAL( 10, CN::NumSubEntities( MBKNIFE, 1 ) );
292  CHECK_EQUAL( 5, CN::NumSubEntities( MBKNIFE, 2 ) );
293 
294  CHECK_EQUAL( 8, CN::NumSubEntities( MBHEX, 0 ) );
295  CHECK_EQUAL( 12, CN::NumSubEntities( MBHEX, 1 ) );
296  CHECK_EQUAL( 6, CN::NumSubEntities( MBHEX, 2 ) );
297 }

References CHECK_EQUAL, MBEDGE, MBHEX, MBKNIFE, MBPRISM, MBPYRAMID, MBQUAD, MBTET, MBTRI, MBVERTEX, and moab::CN::NumSubEntities().

Referenced by main().

◆ test_opposite_side_hex()

void test_opposite_side_hex ( )

Definition at line 772 of file mbcn_test.cpp.

773 {
774  int idx, dim, err;
775 
776  err = CN::OppositeSide( MBHEX, 0, 0, idx, dim );
777  CHECK_EQUAL( 0, err );
778  CHECK_EQUAL( 0, dim );
779  CHECK_EQUAL( 6, idx );
780  err = CN::OppositeSide( MBHEX, 1, 0, idx, dim );
781  CHECK_EQUAL( 0, err );
782  CHECK_EQUAL( 0, dim );
783  CHECK_EQUAL( 7, idx );
784  err = CN::OppositeSide( MBHEX, 2, 0, idx, dim );
785  CHECK_EQUAL( 0, err );
786  CHECK_EQUAL( 0, dim );
787  CHECK_EQUAL( 4, idx );
788  err = CN::OppositeSide( MBHEX, 3, 0, idx, dim );
789  CHECK_EQUAL( 0, err );
790  CHECK_EQUAL( 0, dim );
791  CHECK_EQUAL( 5, idx );
792  err = CN::OppositeSide( MBHEX, 4, 0, idx, dim );
793  CHECK_EQUAL( 0, err );
794  CHECK_EQUAL( 0, dim );
795  CHECK_EQUAL( 2, idx );
796  err = CN::OppositeSide( MBHEX, 5, 0, idx, dim );
797  CHECK_EQUAL( 0, err );
798  CHECK_EQUAL( 0, dim );
799  CHECK_EQUAL( 3, idx );
800  err = CN::OppositeSide( MBHEX, 6, 0, idx, dim );
801  CHECK_EQUAL( 0, err );
802  CHECK_EQUAL( 0, dim );
803  CHECK_EQUAL( 0, idx );
804  err = CN::OppositeSide( MBHEX, 7, 0, idx, dim );
805  CHECK_EQUAL( 0, err );
806  CHECK_EQUAL( 0, dim );
807  CHECK_EQUAL( 1, idx );
808 
809  err = CN::OppositeSide( MBHEX, 0, 1, idx, dim );
810  CHECK_EQUAL( 0, err );
811  CHECK_EQUAL( 1, dim );
812  CHECK_EQUAL( 10, idx );
813  err = CN::OppositeSide( MBHEX, 1, 1, idx, dim );
814  CHECK_EQUAL( 0, err );
815  CHECK_EQUAL( 1, dim );
816  CHECK_EQUAL( 11, idx );
817  err = CN::OppositeSide( MBHEX, 2, 1, idx, dim );
818  CHECK_EQUAL( 0, err );
819  CHECK_EQUAL( 1, dim );
820  CHECK_EQUAL( 8, idx );
821  err = CN::OppositeSide( MBHEX, 3, 1, idx, dim );
822  CHECK_EQUAL( 0, err );
823  CHECK_EQUAL( 1, dim );
824  CHECK_EQUAL( 9, idx );
825  err = CN::OppositeSide( MBHEX, 4, 1, idx, dim );
826  CHECK_EQUAL( 0, err );
827  CHECK_EQUAL( 1, dim );
828  CHECK_EQUAL( 6, idx );
829  err = CN::OppositeSide( MBHEX, 5, 1, idx, dim );
830  CHECK_EQUAL( 0, err );
831  CHECK_EQUAL( 1, dim );
832  CHECK_EQUAL( 7, idx );
833  err = CN::OppositeSide( MBHEX, 6, 1, idx, dim );
834  CHECK_EQUAL( 0, err );
835  CHECK_EQUAL( 1, dim );
836  CHECK_EQUAL( 4, idx );
837  err = CN::OppositeSide( MBHEX, 7, 1, idx, dim );
838  CHECK_EQUAL( 0, err );
839  CHECK_EQUAL( 1, dim );
840  CHECK_EQUAL( 5, idx );
841  err = CN::OppositeSide( MBHEX, 8, 1, idx, dim );
842  CHECK_EQUAL( 0, err );
843  CHECK_EQUAL( 1, dim );
844  CHECK_EQUAL( 2, idx );
845  err = CN::OppositeSide( MBHEX, 9, 1, idx, dim );
846  CHECK_EQUAL( 0, err );
847  CHECK_EQUAL( 1, dim );
848  CHECK_EQUAL( 3, idx );
849  err = CN::OppositeSide( MBHEX, 10, 1, idx, dim );
850  CHECK_EQUAL( 0, err );
851  CHECK_EQUAL( 1, dim );
852  CHECK_EQUAL( 0, idx );
853  err = CN::OppositeSide( MBHEX, 11, 1, idx, dim );
854  CHECK_EQUAL( 0, err );
855  CHECK_EQUAL( 1, dim );
856  CHECK_EQUAL( 1, idx );
857 
858  err = CN::OppositeSide( MBHEX, 0, 2, idx, dim );
859  CHECK_EQUAL( 0, err );
860  CHECK_EQUAL( 2, dim );
861  CHECK_EQUAL( 2, idx );
862  err = CN::OppositeSide( MBHEX, 1, 2, idx, dim );
863  CHECK_EQUAL( 0, err );
864  CHECK_EQUAL( 2, dim );
865  CHECK_EQUAL( 3, idx );
866  err = CN::OppositeSide( MBHEX, 2, 2, idx, dim );
867  CHECK_EQUAL( 0, err );
868  CHECK_EQUAL( 2, dim );
869  CHECK_EQUAL( 0, idx );
870  err = CN::OppositeSide( MBHEX, 3, 2, idx, dim );
871  CHECK_EQUAL( 0, err );
872  CHECK_EQUAL( 2, dim );
873  CHECK_EQUAL( 1, idx );
874  err = CN::OppositeSide( MBHEX, 4, 2, idx, dim );
875  CHECK_EQUAL( 0, err );
876  CHECK_EQUAL( 2, dim );
877  CHECK_EQUAL( 5, idx );
878  err = CN::OppositeSide( MBHEX, 5, 2, idx, dim );
879  CHECK_EQUAL( 0, err );
880  CHECK_EQUAL( 2, dim );
881  CHECK_EQUAL( 4, idx );
882 }

References CHECK_EQUAL, dim, MBHEX, and moab::CN::OppositeSide().

Referenced by main().

◆ test_opposite_side_quad()

void test_opposite_side_quad ( )

Definition at line 670 of file mbcn_test.cpp.

671 {
672  int idx, dim, err;
673  err = CN::OppositeSide( MBQUAD, 0, 0, idx, dim );
674  CHECK_EQUAL( 0, err );
675  CHECK_EQUAL( 0, dim );
676  CHECK_EQUAL( 2, idx );
677  err = CN::OppositeSide( MBQUAD, 1, 0, idx, dim );
678  CHECK_EQUAL( 0, err );
679  CHECK_EQUAL( 0, dim );
680  CHECK_EQUAL( 3, idx );
681  err = CN::OppositeSide( MBQUAD, 2, 0, idx, dim );
682  CHECK_EQUAL( 0, err );
683  CHECK_EQUAL( 0, dim );
684  CHECK_EQUAL( 0, idx );
685  err = CN::OppositeSide( MBQUAD, 3, 0, idx, dim );
686  CHECK_EQUAL( 0, err );
687  CHECK_EQUAL( 0, dim );
688  CHECK_EQUAL( 1, idx );
689 
690  err = CN::OppositeSide( MBQUAD, 0, 1, idx, dim );
691  CHECK_EQUAL( 0, err );
692  CHECK_EQUAL( 1, dim );
693  CHECK_EQUAL( 2, idx );
694  err = CN::OppositeSide( MBQUAD, 1, 1, idx, dim );
695  CHECK_EQUAL( 0, err );
696  CHECK_EQUAL( 1, dim );
697  CHECK_EQUAL( 3, idx );
698  err = CN::OppositeSide( MBQUAD, 2, 1, idx, dim );
699  CHECK_EQUAL( 0, err );
700  CHECK_EQUAL( 1, dim );
701  CHECK_EQUAL( 0, idx );
702  err = CN::OppositeSide( MBQUAD, 3, 1, idx, dim );
703  CHECK_EQUAL( 0, err );
704  CHECK_EQUAL( 1, dim );
705  CHECK_EQUAL( 1, idx );
706 }

References CHECK_EQUAL, dim, MBQUAD, and moab::CN::OppositeSide().

Referenced by main().

◆ test_opposite_side_tet()

void test_opposite_side_tet ( )

Definition at line 708 of file mbcn_test.cpp.

709 {
710  int idx, dim, err;
711 
712  err = CN::OppositeSide( MBTET, 0, 0, idx, dim );
713  CHECK_EQUAL( 0, err );
714  CHECK_EQUAL( 2, dim );
715  CHECK_EQUAL( 1, idx );
716  err = CN::OppositeSide( MBTET, 1, 0, idx, dim );
717  CHECK_EQUAL( 0, err );
718  CHECK_EQUAL( 2, dim );
719  CHECK_EQUAL( 2, idx );
720  err = CN::OppositeSide( MBTET, 2, 0, idx, dim );
721  CHECK_EQUAL( 0, err );
722  CHECK_EQUAL( 2, dim );
723  CHECK_EQUAL( 0, idx );
724  err = CN::OppositeSide( MBTET, 3, 0, idx, dim );
725  CHECK_EQUAL( 0, err );
726  CHECK_EQUAL( 2, dim );
727  CHECK_EQUAL( 3, idx );
728 
729  err = CN::OppositeSide( MBTET, 0, 2, idx, dim );
730  CHECK_EQUAL( 0, err );
731  CHECK_EQUAL( 0, dim );
732  CHECK_EQUAL( 2, idx );
733  err = CN::OppositeSide( MBTET, 1, 2, idx, dim );
734  CHECK_EQUAL( 0, err );
735  CHECK_EQUAL( 0, dim );
736  CHECK_EQUAL( 0, idx );
737  err = CN::OppositeSide( MBTET, 2, 2, idx, dim );
738  CHECK_EQUAL( 0, err );
739  CHECK_EQUAL( 0, dim );
740  CHECK_EQUAL( 1, idx );
741  err = CN::OppositeSide( MBTET, 3, 2, idx, dim );
742  CHECK_EQUAL( 0, err );
743  CHECK_EQUAL( 0, dim );
744  CHECK_EQUAL( 3, idx );
745 
746  err = CN::OppositeSide( MBTET, 0, 1, idx, dim );
747  CHECK_EQUAL( 0, err );
748  CHECK_EQUAL( 1, dim );
749  CHECK_EQUAL( 5, idx );
750  err = CN::OppositeSide( MBTET, 1, 1, idx, dim );
751  CHECK_EQUAL( 0, err );
752  CHECK_EQUAL( 1, dim );
753  CHECK_EQUAL( 3, idx );
754  err = CN::OppositeSide( MBTET, 2, 1, idx, dim );
755  CHECK_EQUAL( 0, err );
756  CHECK_EQUAL( 1, dim );
757  CHECK_EQUAL( 4, idx );
758  err = CN::OppositeSide( MBTET, 3, 1, idx, dim );
759  CHECK_EQUAL( 0, err );
760  CHECK_EQUAL( 1, dim );
761  CHECK_EQUAL( 1, idx );
762  err = CN::OppositeSide( MBTET, 4, 1, idx, dim );
763  CHECK_EQUAL( 0, err );
764  CHECK_EQUAL( 1, dim );
765  CHECK_EQUAL( 2, idx );
766  err = CN::OppositeSide( MBTET, 5, 1, idx, dim );
767  CHECK_EQUAL( 0, err );
768  CHECK_EQUAL( 1, dim );
769  CHECK_EQUAL( 0, idx );
770 }

References CHECK_EQUAL, dim, MBTET, and moab::CN::OppositeSide().

Referenced by main().

◆ test_opposite_side_tri()

void test_opposite_side_tri ( )

Definition at line 641 of file mbcn_test.cpp.

642 {
643  int idx, dim, err;
644  err = CN::OppositeSide( MBTRI, 0, 0, idx, dim );
645  CHECK_EQUAL( 0, err );
646  CHECK_EQUAL( 1, dim );
647  CHECK_EQUAL( 1, idx );
648  err = CN::OppositeSide( MBTRI, 1, 0, idx, dim );
649  CHECK_EQUAL( 0, err );
650  CHECK_EQUAL( 1, dim );
651  CHECK_EQUAL( 2, idx );
652  err = CN::OppositeSide( MBTRI, 2, 0, idx, dim );
653  CHECK_EQUAL( 0, err );
654  CHECK_EQUAL( 1, dim );
655  CHECK_EQUAL( 0, idx );
656  err = CN::OppositeSide( MBTRI, 0, 1, idx, dim );
657  CHECK_EQUAL( 0, err );
658  CHECK_EQUAL( 0, dim );
659  CHECK_EQUAL( 2, idx );
660  err = CN::OppositeSide( MBTRI, 1, 1, idx, dim );
661  CHECK_EQUAL( 0, err );
662  CHECK_EQUAL( 0, dim );
663  CHECK_EQUAL( 0, idx );
664  err = CN::OppositeSide( MBTRI, 2, 1, idx, dim );
665  CHECK_EQUAL( 0, err );
666  CHECK_EQUAL( 0, dim );
667  CHECK_EQUAL( 1, idx );
668 }

References CHECK_EQUAL, dim, MBTRI, and moab::CN::OppositeSide().

Referenced by main().

◆ test_side_number_hex()

void test_side_number_hex ( )

Definition at line 633 of file mbcn_test.cpp.

634 {
635  for( int edge = 0; edge < 12; ++edge )
637  for( int face = 0; face < 6; ++face )
639 }

References do_test_side_number_1d(), do_test_side_number_2d(), and MBHEX.

Referenced by main().

◆ test_side_number_pri()

void test_side_number_pri ( )

Definition at line 625 of file mbcn_test.cpp.

626 {
627  for( int edge = 0; edge < 9; ++edge )
629  for( int face = 0; face < 5; ++face )
631 }

References do_test_side_number_1d(), do_test_side_number_2d(), and MBPRISM.

Referenced by main().

◆ test_side_number_pyr()

void test_side_number_pyr ( )

Definition at line 617 of file mbcn_test.cpp.

618 {
619  for( int edge = 0; edge < 8; ++edge )
621  for( int face = 0; face < 5; ++face )
623 }

References do_test_side_number_1d(), do_test_side_number_2d(), and MBPYRAMID.

Referenced by main().

◆ test_side_number_quad()

void test_side_number_quad ( )

Definition at line 603 of file mbcn_test.cpp.

604 {
605  for( int side = 0; side < 4; ++side )
607 }

References do_test_side_number_1d(), and MBQUAD.

Referenced by main().

◆ test_side_number_tet()

void test_side_number_tet ( )

Definition at line 609 of file mbcn_test.cpp.

610 {
611  for( int edge = 0; edge < 6; ++edge )
613  for( int face = 0; face < 4; ++face )
615 }

References do_test_side_number_1d(), do_test_side_number_2d(), and MBTET.

Referenced by main().

◆ test_side_number_tri()

void test_side_number_tri ( )

Definition at line 597 of file mbcn_test.cpp.

598 {
599  for( int side = 0; side < 3; ++side )
600  do_test_side_number_1d( MBTRI, side );
601 }

References do_test_side_number_1d(), and MBTRI.

Referenced by main().

◆ test_sub_entity_indices_edge()

void test_sub_entity_indices_edge ( )

Definition at line 470 of file mbcn_test.cpp.

471 {
474 }

References MBEDGE, test_0d_sub_entity_indices(), and test_elem_as_sub_entity().

Referenced by main().

◆ test_sub_entity_indices_hex()

void test_sub_entity_indices_hex ( )

Definition at line 530 of file mbcn_test.cpp.

531 {
532  const EntityType type = MBHEX;
533  const int num_vtx = 8;
534  const int edges[][2] = { { 0, 1 }, { 1, 2 }, { 2, 3 }, { 3, 0 }, { 0, 4 }, { 1, 5 },
535  { 2, 6 }, { 3, 7 }, { 4, 5 }, { 5, 6 }, { 6, 7 }, { 7, 4 } };
536  const int faces[][5] = { { 4, 0, 1, 5, 4 }, { 4, 1, 2, 6, 5 }, { 4, 2, 3, 7, 6 },
537  { 4, 3, 0, 4, 7 }, { 4, 3, 2, 1, 0 }, { 4, 4, 5, 6, 7 } };
538  test_0d_sub_entity_indices( type, num_vtx );
539  test_1d_sub_entity_indices( type, sizeof( edges ) / sizeof( edges[0] ), edges );
540  test_2d_sub_entity_indices( type, sizeof( faces ) / sizeof( faces[0] ), faces );
541  test_elem_as_sub_entity( type, 3, num_vtx );
542 }

References MBHEX, test_0d_sub_entity_indices(), test_1d_sub_entity_indices(), test_2d_sub_entity_indices(), and test_elem_as_sub_entity().

Referenced by main().

◆ test_sub_entity_indices_pri()

void test_sub_entity_indices_pri ( )

Definition at line 517 of file mbcn_test.cpp.

518 {
519  const EntityType type = MBPRISM;
520  const int num_vtx = 6;
521  const int edges[][2] = { { 0, 1 }, { 1, 2 }, { 2, 0 }, { 0, 3 }, { 1, 4 }, { 2, 5 }, { 3, 4 }, { 4, 5 }, { 5, 3 } };
522  const int faces[][5] = {
523  { 4, 0, 1, 4, 3 }, { 4, 1, 2, 5, 4 }, { 4, 2, 0, 3, 5 }, { 3, 2, 1, 0, 0 }, { 3, 3, 4, 5, 0 } };
524  test_0d_sub_entity_indices( type, num_vtx );
525  test_1d_sub_entity_indices( type, sizeof( edges ) / sizeof( edges[0] ), edges );
526  test_2d_sub_entity_indices( type, sizeof( faces ) / sizeof( faces[0] ), faces );
527  test_elem_as_sub_entity( type, 3, num_vtx );
528 }

References MBPRISM, test_0d_sub_entity_indices(), test_1d_sub_entity_indices(), test_2d_sub_entity_indices(), and test_elem_as_sub_entity().

Referenced by main().

◆ test_sub_entity_indices_pyr()

void test_sub_entity_indices_pyr ( )

Definition at line 504 of file mbcn_test.cpp.

505 {
506  const EntityType type = MBPYRAMID;
507  const int num_vtx = 5;
508  const int edges[][2] = { { 0, 1 }, { 1, 2 }, { 2, 3 }, { 3, 0 }, { 0, 4 }, { 1, 4 }, { 2, 4 }, { 3, 4 } };
509  const int faces[][5] = {
510  { 3, 0, 1, 4, 0 }, { 3, 1, 2, 4, 0 }, { 3, 2, 3, 4, 0 }, { 3, 3, 0, 4, 0 }, { 4, 3, 2, 1, 0 } };
511  test_0d_sub_entity_indices( type, num_vtx );
512  test_1d_sub_entity_indices( type, sizeof( edges ) / sizeof( edges[0] ), edges );
513  test_2d_sub_entity_indices( type, sizeof( faces ) / sizeof( faces[0] ), faces );
514  test_elem_as_sub_entity( type, 3, num_vtx );
515 }

References MBPYRAMID, test_0d_sub_entity_indices(), test_1d_sub_entity_indices(), test_2d_sub_entity_indices(), and test_elem_as_sub_entity().

Referenced by main().

◆ test_sub_entity_indices_quad()

void test_sub_entity_indices_quad ( )

Definition at line 484 of file mbcn_test.cpp.

485 {
486  const int edges[4][2] = { { 0, 1 }, { 1, 2 }, { 2, 3 }, { 3, 0 } };
488  test_1d_sub_entity_indices( MBQUAD, 4, edges );
490 }

References MBQUAD, test_0d_sub_entity_indices(), test_1d_sub_entity_indices(), and test_elem_as_sub_entity().

Referenced by main().

◆ test_sub_entity_indices_tet()

void test_sub_entity_indices_tet ( )

Definition at line 492 of file mbcn_test.cpp.

493 {
494  const EntityType type = MBTET;
495  const int num_vtx = 4;
496  const int edges[][2] = { { 0, 1 }, { 1, 2 }, { 2, 0 }, { 0, 3 }, { 1, 3 }, { 2, 3 } };
497  const int faces[][5] = { { 3, 0, 1, 3, 0 }, { 3, 1, 2, 3, 0 }, { 3, 2, 0, 3, 0 }, { 3, 2, 1, 0, 0 } };
498  test_0d_sub_entity_indices( type, num_vtx );
499  test_1d_sub_entity_indices( type, sizeof( edges ) / sizeof( edges[0] ), edges );
500  test_2d_sub_entity_indices( type, sizeof( faces ) / sizeof( faces[0] ), faces );
501  test_elem_as_sub_entity( type, 3, num_vtx );
502 }

References MBTET, test_0d_sub_entity_indices(), test_1d_sub_entity_indices(), test_2d_sub_entity_indices(), and test_elem_as_sub_entity().

Referenced by main().

◆ test_sub_entity_indices_tri()

void test_sub_entity_indices_tri ( )

Definition at line 476 of file mbcn_test.cpp.

477 {
478  const int edges[3][2] = { { 0, 1 }, { 1, 2 }, { 2, 0 } };
480  test_1d_sub_entity_indices( MBTRI, 3, edges );
482 }

References MBTRI, test_0d_sub_entity_indices(), test_1d_sub_entity_indices(), and test_elem_as_sub_entity().

Referenced by main().

◆ test_sub_entity_indices_vtx()

void test_sub_entity_indices_vtx ( )

Definition at line 465 of file mbcn_test.cpp.

466 {
468 }

References MBVERTEX, and test_elem_as_sub_entity().

Referenced by main().

◆ test_sub_entity_nodes() [1/2]

void test_sub_entity_nodes ( EntityType  parent,
int  num_nodes,
int  sub_dimension 
)

Definition at line 1085 of file mbcn_test.cpp.

1086 {
1087  const int num_sub = CN::NumSubEntities( parent, sub_dimension );
1088  const int parent_ho = CN::HasMidNodes( parent, num_nodes );
1089  int child_ho = 0;
1090  for( int d = 1; d <= sub_dimension; ++d )
1091  child_ho |= ( parent_ho & ( 1 << d ) );
1092 
1093  // first test the types
1094  for( int i = 0; i < num_sub; ++i )
1095  {
1096  int num, conn[moab::MAX_SUB_ENTITY_VERTICES];
1097  EntityType type;
1098  CN::SubEntityNodeIndices( parent, num_nodes, sub_dimension, i, type, num, conn );
1099  CHECK_EQUAL( CN::SubEntityType( parent, sub_dimension, i ), type );
1100  }
1101 
1102  // now test that they have the correct number of higher-order node
1103  for( int i = 0; i < num_sub; ++i )
1104  {
1105  int num, conn[moab::MAX_SUB_ENTITY_VERTICES];
1106  EntityType type;
1107  CN::SubEntityNodeIndices( parent, num_nodes, sub_dimension, i, type, num, conn );
1108  const int ho = CN::HasMidNodes( type, num );
1109  CHECK_EQUAL( child_ho, ho );
1110  }
1111 
1112  // now test the actual indices
1113  for( int i = 0; i < num_sub; ++i )
1114  {
1116  EntityType type;
1117  CN::SubEntityNodeIndices( parent, num_nodes, sub_dimension, i, type, num, conn );
1118 
1119  // check corner indices against SubEntityVertexIndices
1120  const int num_corner = CN::VerticesPerEntity( type );
1121  CHECK( num >= num_corner );
1122  CN::SubEntityVertexIndices( parent, sub_dimension, i, corners );
1123  for( int j = 0; j < num_corner; ++j )
1124  CHECK_EQUAL( corners[j], conn[j] );
1125 
1126  // check mid-edge indices, if present
1127  int idx = num_corner;
1128  if( child_ho & CN::MID_EDGE_BIT )
1129  {
1130  // for each edge in the sub-entity type
1131  const int num_edge = CN::NumSubEntities( type, 1 );
1132  for( int j = 0; j < num_edge; ++j )
1133  {
1134  // get edge indices for sub-entity connectivity
1135  int edge_ends[2];
1136  CN::SubEntityVertexIndices( type, 1, j, edge_ends );
1137  // convert to indices into parent type's connectivity
1138  CHECK( edge_ends[0] < num_corner );
1139  edge_ends[0] = corners[edge_ends[0]];
1140  CHECK( edge_ends[1] < num_corner );
1141  edge_ends[1] = corners[edge_ends[1]];
1142  // find edge index in parent element
1143  int side, sense, off;
1144  int result = CN::SideNumber( parent, edge_ends, 2, 1, side, sense, off );
1145  CHECK_EQUAL( 0, result );
1146  // get location in parent entity connectivity for mid-edge node
1147  int loc = CN::HONodeIndex( parent, num_nodes, 1, side );
1148  CHECK_EQUAL( loc, conn[idx++] );
1149  }
1150  }
1151 
1152  // check mid-face indices, if present
1153  if( child_ho & CN::MID_FACE_BIT )
1154  {
1155  CHECK_EQUAL( 2, CN::Dimension( type ) );
1156  int loc = CN::HONodeIndex( parent, num_nodes, 2, i );
1157  CHECK_EQUAL( loc, conn[idx++] );
1158  }
1159 
1160  // make sure there were no extra node indices returned
1161  CHECK_EQUAL( idx, num );
1162  }
1163 }

References CHECK, CHECK_EQUAL, moab::CN::Dimension(), moab::CN::HasMidNodes(), moab::CN::HONodeIndex(), moab::MAX_SUB_ENTITY_VERTICES, moab::CN::MID_EDGE_BIT, moab::CN::MID_FACE_BIT, moab::CN::NumSubEntities(), moab::CN::SideNumber(), moab::CN::SubEntityNodeIndices(), moab::CN::SubEntityType(), moab::CN::SubEntityVertexIndices(), and moab::CN::VerticesPerEntity().

◆ test_sub_entity_nodes() [2/2]

void test_sub_entity_nodes ( EntityType  parent,
int  sub_dimension 
)

Definition at line 1053 of file mbcn_test.cpp.

1054 {
1055  const int num_corner = CN::VerticesPerEntity( parent );
1056  const int num_edge = CN::NumSubEntities( parent, 1 );
1057  const int num_face = CN::NumSubEntities( parent, 2 );
1058 
1059  auto dim = CN::Dimension( parent );
1060  switch( dim )
1061  {
1062  case 3:
1063  case 2:
1064  case 1:
1065  test_sub_entity_nodes( parent, num_corner + num_face, sub_dimension );
1066  test_sub_entity_nodes( parent, num_corner + num_edge + num_face, sub_dimension );
1067  test_sub_entity_nodes( parent, num_corner + num_face + 1, sub_dimension );
1068  test_sub_entity_nodes( parent, num_corner + num_edge + num_face + 1, sub_dimension );
1069  if( 2 <= dim )
1070  {
1071  test_sub_entity_nodes( parent, num_corner + num_edge, sub_dimension );
1072  test_sub_entity_nodes( parent, num_corner + num_edge + 1, sub_dimension );
1073  }
1074  if( 1 <= dim )
1075  {
1076  test_sub_entity_nodes( parent, num_corner, sub_dimension );
1077  test_sub_entity_nodes( parent, num_corner + 1, sub_dimension );
1078  }
1079  break;
1080  default:
1081  CHECK( false );
1082  }
1083 }

References CHECK, dim, moab::CN::Dimension(), moab::CN::NumSubEntities(), and moab::CN::VerticesPerEntity().

Referenced by test_sub_entity_nodes_hex_edges(), test_sub_entity_nodes_hex_faces(), test_sub_entity_nodes_kni_edges(), test_sub_entity_nodes_kni_faces(), test_sub_entity_nodes_pri_edges(), test_sub_entity_nodes_pri_faces(), test_sub_entity_nodes_pyr_edges(), test_sub_entity_nodes_pyr_faces(), test_sub_entity_nodes_quad_edges(), test_sub_entity_nodes_tet_edges(), test_sub_entity_nodes_tet_faces(), and test_sub_entity_nodes_tri_edges().

◆ test_sub_entity_nodes_hex_edges()

void test_sub_entity_nodes_hex_edges ( )

Definition at line 122 of file mbcn_test.cpp.

123 {
125 }

References MBHEX, and test_sub_entity_nodes().

Referenced by main().

◆ test_sub_entity_nodes_hex_faces()

void test_sub_entity_nodes_hex_faces ( )

Definition at line 126 of file mbcn_test.cpp.

127 {
129 }

References MBHEX, and test_sub_entity_nodes().

Referenced by main().

◆ test_sub_entity_nodes_kni_edges()

void test_sub_entity_nodes_kni_edges ( )

Definition at line 114 of file mbcn_test.cpp.

115 {
117 }

References MBKNIFE, and test_sub_entity_nodes().

Referenced by main().

◆ test_sub_entity_nodes_kni_faces()

void test_sub_entity_nodes_kni_faces ( )

Definition at line 118 of file mbcn_test.cpp.

119 {
121 }

References MBKNIFE, and test_sub_entity_nodes().

Referenced by main().

◆ test_sub_entity_nodes_pri_edges()

void test_sub_entity_nodes_pri_edges ( )

Definition at line 106 of file mbcn_test.cpp.

107 {
109 }

References MBPRISM, and test_sub_entity_nodes().

Referenced by main().

◆ test_sub_entity_nodes_pri_faces()

void test_sub_entity_nodes_pri_faces ( )

Definition at line 110 of file mbcn_test.cpp.

111 {
113 }

References MBPRISM, and test_sub_entity_nodes().

Referenced by main().

◆ test_sub_entity_nodes_pyr_edges()

void test_sub_entity_nodes_pyr_edges ( )

Definition at line 98 of file mbcn_test.cpp.

99 {
101 }

References MBPYRAMID, and test_sub_entity_nodes().

Referenced by main().

◆ test_sub_entity_nodes_pyr_faces()

void test_sub_entity_nodes_pyr_faces ( )

Definition at line 102 of file mbcn_test.cpp.

103 {
105 }

References MBPYRAMID, and test_sub_entity_nodes().

Referenced by main().

◆ test_sub_entity_nodes_quad_edges()

void test_sub_entity_nodes_quad_edges ( )

Definition at line 86 of file mbcn_test.cpp.

87 {
89 }

References MBQUAD, and test_sub_entity_nodes().

Referenced by main().

◆ test_sub_entity_nodes_tet_edges()

void test_sub_entity_nodes_tet_edges ( )

Definition at line 90 of file mbcn_test.cpp.

91 {
93 }

References MBTET, and test_sub_entity_nodes().

Referenced by main().

◆ test_sub_entity_nodes_tet_faces()

void test_sub_entity_nodes_tet_faces ( )

Definition at line 94 of file mbcn_test.cpp.

95 {
97 }

References MBTET, and test_sub_entity_nodes().

Referenced by main().

◆ test_sub_entity_nodes_tri_edges()

void test_sub_entity_nodes_tri_edges ( )

Definition at line 82 of file mbcn_test.cpp.

83 {
85 }

References MBTRI, and test_sub_entity_nodes().

Referenced by main().

◆ test_sub_entity_type_edge()

void test_sub_entity_type_edge ( )

Definition at line 335 of file mbcn_test.cpp.

336 {
337  CHECK_EQUAL( MBVERTEX, CN::SubEntityType( MBEDGE, 0, 0 ) );
338  CHECK_EQUAL( MBVERTEX, CN::SubEntityType( MBEDGE, 0, 1 ) );
339  CHECK_EQUAL( MBEDGE, CN::SubEntityType( MBEDGE, 1, 0 ) );
340 }

References CHECK_EQUAL, MBEDGE, MBVERTEX, and moab::CN::SubEntityType().

Referenced by main().

◆ test_sub_entity_type_hex()

void test_sub_entity_type_hex ( )

Definition at line 376 of file mbcn_test.cpp.

377 {
378  const EntityType types[] = { MBQUAD, MBQUAD, MBQUAD, MBQUAD, MBQUAD, MBQUAD };
379  do_test_sub_entity_type_3d( MBHEX, sizeof( types ) / sizeof( types[0] ), types );
380 }

References do_test_sub_entity_type_3d(), MBHEX, and MBQUAD.

Referenced by main().

◆ test_sub_entity_type_knife()

void test_sub_entity_type_knife ( )

Definition at line 370 of file mbcn_test.cpp.

371 {
372  const EntityType types[] = { MBQUAD, MBQUAD, MBQUAD, MBQUAD, MBQUAD };
373  do_test_sub_entity_type_3d( MBKNIFE, sizeof( types ) / sizeof( types[0] ), types );
374 }

References do_test_sub_entity_type_3d(), MBKNIFE, and MBQUAD.

Referenced by main().

◆ test_sub_entity_type_pri()

void test_sub_entity_type_pri ( )

Definition at line 364 of file mbcn_test.cpp.

365 {
366  const EntityType types[] = { MBQUAD, MBQUAD, MBQUAD, MBTRI, MBTRI };
367  do_test_sub_entity_type_3d( MBPRISM, sizeof( types ) / sizeof( types[0] ), types );
368 }

References do_test_sub_entity_type_3d(), MBPRISM, MBQUAD, and MBTRI.

Referenced by main().

◆ test_sub_entity_type_pyr()

void test_sub_entity_type_pyr ( )

Definition at line 358 of file mbcn_test.cpp.

359 {
360  const EntityType types[] = { MBTRI, MBTRI, MBTRI, MBTRI, MBQUAD };
361  do_test_sub_entity_type_3d( MBPYRAMID, sizeof( types ) / sizeof( types[0] ), types );
362 }

References do_test_sub_entity_type_3d(), MBPYRAMID, MBQUAD, and MBTRI.

Referenced by main().

◆ test_sub_entity_type_quad()

void test_sub_entity_type_quad ( )

Definition at line 347 of file mbcn_test.cpp.

348 {
350 }

References do_test_sub_entity_type_2d(), and MBQUAD.

Referenced by main().

◆ test_sub_entity_type_tet()

void test_sub_entity_type_tet ( )

Definition at line 352 of file mbcn_test.cpp.

353 {
354  const EntityType types[] = { MBTRI, MBTRI, MBTRI, MBTRI };
355  do_test_sub_entity_type_3d( MBTET, sizeof( types ) / sizeof( types[0] ), types );
356 }

References do_test_sub_entity_type_3d(), MBTET, and MBTRI.

Referenced by main().

◆ test_sub_entity_type_tri()

void test_sub_entity_type_tri ( )

Definition at line 342 of file mbcn_test.cpp.

343 {
345 }

References do_test_sub_entity_type_2d(), and MBTRI.

Referenced by main().

◆ test_sub_entity_type_vtx()

void test_sub_entity_type_vtx ( )

Definition at line 330 of file mbcn_test.cpp.

331 {
332  CHECK_EQUAL( MBVERTEX, CN::SubEntityType( MBVERTEX, 0, 0 ) );
333 }

References CHECK_EQUAL, MBVERTEX, and moab::CN::SubEntityType().

Referenced by main().

◆ test_type_names()

void test_type_names ( )

Definition at line 226 of file mbcn_test.cpp.

227 {
228  for( EntityType t = MBVERTEX; t != MBMAXTYPE; ++t )
229  {
230  const char* name = CN::EntityTypeName( t );
231  CHECK_EQUAL( t, CN::EntityTypeFromName( name ) );
232  }
233 }

References CHECK_EQUAL, moab::CN::EntityTypeFromName(), moab::CN::EntityTypeName(), MBMAXTYPE, MBVERTEX, and t.

Referenced by main().

◆ test_vertices_per_entity()

void test_vertices_per_entity ( )

Definition at line 250 of file mbcn_test.cpp.

251 {
252  CHECK_EQUAL( 1, CN::VerticesPerEntity( MBVERTEX ) );
253  CHECK_EQUAL( 2, CN::VerticesPerEntity( MBEDGE ) );
254  CHECK_EQUAL( 3, CN::VerticesPerEntity( MBTRI ) );
255  CHECK_EQUAL( 4, CN::VerticesPerEntity( MBQUAD ) );
256  CHECK_EQUAL( 4, CN::VerticesPerEntity( MBTET ) );
257  CHECK_EQUAL( 5, CN::VerticesPerEntity( MBPYRAMID ) );
258  CHECK_EQUAL( 6, CN::VerticesPerEntity( MBPRISM ) );
259  CHECK_EQUAL( 7, CN::VerticesPerEntity( MBKNIFE ) );
260  CHECK_EQUAL( 8, CN::VerticesPerEntity( MBHEX ) );
261 }

References CHECK_EQUAL, MBEDGE, MBHEX, MBKNIFE, MBPRISM, MBPYRAMID, MBQUAD, MBTET, MBTRI, MBVERTEX, and moab::CN::VerticesPerEntity().

Referenced by main().

◆ test_wedges()

void test_wedges ( )

Definition at line 1233 of file mbcn_test.cpp.

1234 {
1235  moab::Core mb;
1236 
1237  //mb.load_file("./wed15_2.h5m");
1238  std::vector< moab::EntityHandle > conn;
1239  double coords[3];
1240  for( int i = 0; i < 22; ++i )
1241  {
1243  mb.create_vertex( coords, h );
1244  }
1245  moab::EntityHandle conn1[15] = { 10, 20, 14, 1, 8, 5, 21, 19, 15, 16, 22, 18, 9, 7, 6 };
1246  moab::EntityHandle conn2[15] = { 10, 14, 12, 1, 5, 3, 15, 13, 11, 16, 18, 17, 6, 4, 2 };
1247 
1249  mb.create_element( moab::MBPRISM, conn1, 15, w );
1250  mb.create_element( moab::MBPRISM, conn2, 15, w );
1251 
1252  std::vector< moab::EntityHandle > wedges;
1253  mb.get_entities_by_dimension( 0, 3, wedges );
1254 
1255  // > If I comment this block there is no problem
1256  for( const auto& w : wedges )
1257  {
1258  std::vector< moab::EntityHandle > adj;
1259  mb.get_adjacencies( &w, 1, 2, true, adj );
1260  CHECK( 5 == adj.size() );
1261  }
1262  // <
1263 
1264  for( const auto& w : wedges )
1265  {
1266  std::vector< moab::EntityHandle > conn;
1267  mb.get_connectivity( &w, 1, conn );
1268  CHECK( 15 == conn.size() );
1269  for( const auto& n : conn )
1270  {
1271  std::vector< moab::EntityHandle > edges;
1272  mb.get_adjacencies( &n, 1, 1, true, edges );
1273  if( edges.size() == 0 )
1274  {
1275  std::cout << " node " << n << " not connected to edges \n";
1276  std::vector< moab::EntityHandle > faces;
1277  mb.get_adjacencies( &n, 1, 2, false, faces );
1278  for( const auto& f : faces )
1279  {
1280  std::vector< moab::EntityHandle > connf;
1281  mb.get_connectivity( &f, 1, connf );
1282  std::cout << "face:" << mb.id_from_handle( f );
1283  for( const auto& n1 : connf )
1284  std::cout << " " << n1;
1285  std::cout << "\n";
1286  }
1287  std::vector< moab::EntityHandle > prisms;
1288  mb.get_adjacencies( &n, 1, 3, false, prisms );
1289  for( const auto& p : prisms )
1290  {
1291  std::vector< moab::EntityHandle > connf;
1292  mb.get_connectivity( &p, 1, connf );
1293  std::cout << "prism:" << mb.id_from_handle( p );
1294  for( const auto& n1 : connf )
1295  std::cout << " " << n1;
1296  std::cout << "\n";
1297  }
1298  CHECK( edges.size() != 0 );
1299  }
1300  }
1301  }
1302 }

References CHECK, moab::Core::create_element(), moab::Core::create_vertex(), moab::Core::get_adjacencies(), moab::Core::get_connectivity(), moab::Core::get_entities_by_dimension(), moab::Core::id_from_handle(), mb, and MBPRISM.

Referenced by main().

Variable Documentation

◆ elem_types

const EntityType elem_types[] = { MBTRI, MBQUAD, MBTET, MBPYRAMID, MBPRISM, MBHEX, MBMAXTYPE }

Definition at line 202 of file mbcn_test.cpp.

Referenced by test_ho_node_index(), and test_ho_node_parent().