[MOAB-dev] r2901 - in MOAB/trunk: . test
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Wed May 20 13:48:43 CDT 2009
Author: kraftche
Date: 2009-05-20 13:48:43 -0500 (Wed, 20 May 2009)
New Revision: 2901
Modified:
MOAB/trunk/ExoIIInterface.hpp
MOAB/trunk/ExoIIUtil.cpp
MOAB/trunk/ReadNCDF.cpp
MOAB/trunk/ReadNCDF.hpp
MOAB/trunk/exodus_test.cc
MOAB/trunk/test/ho_test.cub
MOAB/trunk/test/ho_test.g
Log:
ExodusII reader fixes:
o s/PYRAMID8/PYRAMID10/
o swap mis-orderd SHELL4 and SHELL5 in ExoIIUtil::ElementTypeNames
o s/EXOII_SHEL/EXOII_SHELL/
o add unit test for consistent type info arrays in ExoIIUtil
o fix reading of sidesets adjacent to higher-order nodes
o add unit tests for reading higher-order sideset elements
Modified: MOAB/trunk/ExoIIInterface.hpp
===================================================================
--- MOAB/trunk/ExoIIInterface.hpp 2009-05-20 15:34:35 UTC (rev 2900)
+++ MOAB/trunk/ExoIIInterface.hpp 2009-05-20 18:48:43 UTC (rev 2901)
@@ -26,9 +26,9 @@
EXOII_TRUSS, EXOII_TRUSS2, EXOII_TRUSS3,
EXOII_TRI, EXOII_TRI3, EXOII_TRI6, EXOII_TRI7,
EXOII_QUAD, EXOII_QUAD4, EXOII_QUAD5, EXOII_QUAD8, EXOII_QUAD9,
- EXOII_SHEL, EXOII_SHELL4, EXOII_SHELL8, EXOII_SHELL9,
+ EXOII_SHELL, EXOII_SHELL4, EXOII_SHELL5, EXOII_SHELL8, EXOII_SHELL9,
EXOII_TETRA, EXOII_TETRA4, EXOII_TETRA8, EXOII_TETRA10, EXOII_TETRA14,
- EXOII_PYRAMID, EXOII_PYRAMID5, EXOII_PYRAMID8, EXOII_PYRAMID13, EXOII_PYRAMID18,
+ EXOII_PYRAMID, EXOII_PYRAMID5, EXOII_PYRAMID10, EXOII_PYRAMID13, EXOII_PYRAMID18,
EXOII_WEDGE,
EXOII_KNIFE,
EXOII_HEX, EXOII_HEX8, EXOII_HEX9, EXOII_HEX20, EXOII_HEX27,
Modified: MOAB/trunk/ExoIIUtil.cpp
===================================================================
--- MOAB/trunk/ExoIIUtil.cpp 2009-05-20 15:34:35 UTC (rev 2900)
+++ MOAB/trunk/ExoIIUtil.cpp 2009-05-20 18:48:43 UTC (rev 2901)
@@ -56,7 +56,7 @@
MBTET, // TETRA14,
MBPYRAMID, // PYRAMID,
MBPYRAMID, // PYRAMID5,
- MBPYRAMID, // PYRAMID8,
+ MBPYRAMID, // PYRAMID10,
MBPYRAMID, // PYRAMID13,
MBPYRAMID, // PYRAMID18,
MBPRISM, // WEDGE,
@@ -94,8 +94,8 @@
"QUAD8",
"QUAD9",
"SHELL",
+ "SHELL4",
"SHELL5",
- "SHELL4",
"SHELL8",
"SHELL9",
"TETRA",
@@ -105,7 +105,7 @@
"TETRA14",
"PYRAMID",
"PYRAMID5",
- "PYRAMID8",
+ "PYRAMID10",
"PYRAMID13",
"PYRAMID18",
"WEDGE",
@@ -153,7 +153,7 @@
14, // TETRA
5,
5,
- 8,
+ 10,
13,
18, // PYRAMID
6, // WEDGE
@@ -201,7 +201,7 @@
{0, 1, 1, 0}, // TETRA14 - mid nodes on edges and faces
{0, 0, 0, 0}, // PYRAMID - no mid nodes
{0, 0, 0, 0}, // PYRAMID5 - no mid nodes
- {0, 0, 1, 0}, // PYRAMID8 - *** TODO - not sure if this is right...
+ {0, 0, 1, 0}, // PYRAMID10 - *** TODO - not sure if this is right...
{0, 1, 0, 0}, // PYRAMID13 - *** TODO - not sure if this is right...
{0, 1, 1, 0}, // PYRAMID18 - *** TODO - not sure if this is right...
{0, 0, 0, 0}, // WEDGE - no mid nodes
Modified: MOAB/trunk/ReadNCDF.cpp
===================================================================
--- MOAB/trunk/ReadNCDF.cpp 2009-05-20 15:34:35 UTC (rev 2900)
+++ MOAB/trunk/ReadNCDF.cpp 2009-05-20 18:48:43 UTC (rev 2901)
@@ -1451,7 +1451,7 @@
int ss_seq_id)
{
//determine entity type from element id
- int i,k;
+ int i, k;
// if there are dist. factors, create a vector to hold the array
// and place this array as a tag onto the sideset meshset
@@ -1476,6 +1476,12 @@
}
}
+ MBEntityType subtype;
+ int num_side_nodes, num_elem_nodes;
+ const MBEntityHandle* nodes;
+ std::vector<MBEntityHandle> connectivity;
+ int side_node_idx[32];
+
int df_index = 0;
for(i=0; i < num_sides; i++)
{
@@ -1490,41 +1496,24 @@
MBEntityHandle ent_handle = element_ids[i] - block_data.startExoId + block_data.startMBId;
- std::vector<MBEntityHandle> nodes;
-
+ const int side_num = side_list[i] - 1;
if(type == MBHEX)
{
- //ent_handle = CREATE_HANDLE(MBHEX, base_id, error );
-
- //get the nodes of the Hex
- //if( mdbImpl->get_adjacencies( ent_handle, false, 0, nodes ) != MB_SUCCESS )
- if( mdbImpl->get_connectivity(&( ent_handle), 1, nodes) != MB_SUCCESS )
+ //get the nodes of the element
+ if( mdbImpl->get_connectivity( ent_handle, nodes, num_elem_nodes ) != MB_SUCCESS )
return MB_FAILURE;
- std::vector<MBEntityHandle> connectivity;
-
- //get the correct nodes to make the element
- int temp_index = MBCN::mConnectivityMap[MBHEX][1].conn[side_list[i]-1][0];
- assert(temp_index < MBCN::VerticesPerEntity(mdbImpl->type_from_handle(ent_handle)));
- connectivity.push_back(nodes[temp_index]);
- temp_index = MBCN::mConnectivityMap[MBHEX][1].conn[side_list[i]-1][1];
- assert(temp_index < MBCN::VerticesPerEntity(mdbImpl->type_from_handle(ent_handle)));
- connectivity.push_back( nodes[temp_index]);
- temp_index = MBCN::mConnectivityMap[MBHEX][1].conn[side_list[i]-1][2];
- assert(temp_index < MBCN::VerticesPerEntity(mdbImpl->type_from_handle(ent_handle)));
- connectivity.push_back( nodes[temp_index]);
- temp_index = MBCN::mConnectivityMap[MBHEX][1].conn[side_list[i]-1][3];
- assert(temp_index < MBCN::VerticesPerEntity(mdbImpl->type_from_handle(ent_handle)));
- connectivity.push_back( nodes[temp_index]);
-
- ent_handle = 0;
-
- if(create_sideset_element(connectivity, MBQUAD, ent_handle) == MB_SUCCESS)
- {
- entities_to_add.push_back(ent_handle);
- }
- else
+ MBCN::SubEntityNodeIndices( type, num_elem_nodes, 2, side_num, subtype, num_side_nodes, side_node_idx );
+ if (num_side_nodes <= 0)
return MB_FAILURE;
+
+ connectivity.resize( num_side_nodes );
+ for (k = 0; k < num_side_nodes; ++k)
+ connectivity[k] = nodes[ side_node_idx[k] ];
+
+ if (MB_SUCCESS != create_sideset_element( connectivity, subtype, ent_handle ))
+ return MB_FAILURE;
+ entities_to_add.push_back( ent_handle );
//read in distribution factor array
if( num_dist_factors )
@@ -1532,39 +1521,26 @@
for(k=0; k<4; k++)
dist_factor_vector.push_back( temp_dist_factor_vector[df_index++] );
}
-
}
// if it is a Tet
else if(type == MBTET)
{
- //ent_handle = CREATE_HANDLE(MBTET, base_id, error );
-
- //get the nodes of the Tet
- //if( mdbImpl->get_adjacencies( ent_handle, 0, false, nodes ) != MB_SUCCESS )
- if( mdbImpl->get_connectivity(&( ent_handle), 1, nodes) != MB_SUCCESS )
+ //get the nodes of the element
+ if( mdbImpl->get_connectivity( ent_handle, nodes, num_elem_nodes ) != MB_SUCCESS )
return MB_FAILURE;
- std::vector<MBEntityHandle> connectivity;
-
- //get the correct nodes to make the element
- int temp_index = MBCN::mConnectivityMap[MBTET][1].conn[ side_list[i]-1][0];
- connectivity.push_back( nodes[temp_index]);
- temp_index = MBCN::mConnectivityMap[MBTET][1].conn[ side_list[i]-1][1];
- assert(temp_index < MBCN::VerticesPerEntity(mdbImpl->type_from_handle(ent_handle)));
- connectivity.push_back( nodes[temp_index]);
- temp_index = MBCN::mConnectivityMap[MBTET][1].conn[ side_list[i]-1][2];
- assert(temp_index < MBCN::VerticesPerEntity(mdbImpl->type_from_handle(ent_handle)));
- connectivity.push_back( nodes[temp_index]);
-
- ent_handle = 0;
+ MBCN::SubEntityNodeIndices( type, num_elem_nodes, 2, side_num, subtype, num_side_nodes, side_node_idx );
+ if (num_side_nodes <= 0)
+ return MB_FAILURE;
- if(create_sideset_element(connectivity, MBTRI, ent_handle) == MB_SUCCESS)
- {
- entities_to_add.push_back(ent_handle);
- }
- else
+ connectivity.resize( num_side_nodes );
+ for (k = 0; k < num_side_nodes; ++k)
+ connectivity[k] = nodes[ side_node_idx[k] ];
+
+ if (MB_SUCCESS != create_sideset_element( connectivity, subtype, ent_handle ))
return MB_FAILURE;
+ entities_to_add.push_back( ent_handle );
//read in distribution factor array
if( num_dist_factors )
@@ -1575,7 +1551,7 @@
}
else if( type == MBQUAD &&
- exoii_type >= EXOII_SHEL && exoii_type <= EXOII_SHELL9 )
+ exoii_type >= EXOII_SHELL && exoii_type <= EXOII_SHELL9 )
{
//ent_handle = CREATE_HANDLE(MBQUAD, base_id, error );
@@ -1607,28 +1583,22 @@
}
else
{
- //ent_handle = CREATE_HANDLE(MBQUAD, base_id, error );
- //if( mdbImpl->get_adjacencies( ent_handle, 0, false, nodes ) != MB_SUCCESS )
- if( mdbImpl->get_connectivity(&( ent_handle), 1, nodes) != MB_SUCCESS )
+ //get the nodes of the element
+ if( mdbImpl->get_connectivity( ent_handle, nodes, num_elem_nodes ) != MB_SUCCESS )
return MB_FAILURE;
- std::vector<MBEntityHandle> connectivity;
- int index = MBCN::mConnectivityMap[MBQUAD][0].conn[ side_list[i]-1-2][0];
- assert(index < MBCN::VerticesPerEntity(mdbImpl->type_from_handle(ent_handle)));
- connectivity.push_back( nodes[index] );
- index = MBCN::mConnectivityMap[MBQUAD][0].conn[ side_list[i]-1-2][1];
- assert(index < MBCN::VerticesPerEntity(mdbImpl->type_from_handle(ent_handle)));
- connectivity.push_back( nodes[index] );
-
- ent_handle = 0;
-
- if(create_sideset_element(connectivity, MBEDGE, ent_handle) == MB_SUCCESS)
- {
- entities_to_add.push_back(ent_handle);
- }
- else
+ MBCN::SubEntityNodeIndices( type, num_elem_nodes, 1, side_num-2, subtype, num_side_nodes, side_node_idx );
+ if (num_side_nodes <= 0)
return MB_FAILURE;
+ connectivity.resize( num_side_nodes );
+ for (k = 0; k < num_side_nodes; ++k)
+ connectivity[k] = nodes[ side_node_idx[k] ];
+
+ if (MB_SUCCESS != create_sideset_element( connectivity, subtype, ent_handle ))
+ return MB_FAILURE;
+ entities_to_add.push_back( ent_handle );
+
if( num_dist_factors )
{
for(k=0; k<2; k++)
@@ -1639,31 +1609,21 @@
// if it is a Quad
else if(type == MBQUAD)
{
- //ent_handle = CREATE_HANDLE(MBQUAD, base_id, error );
-
- //get the nodes of the Quad
- //if( mdbImpl->get_adjacencies( ent_handle, 0, false, nodes ) != MB_SUCCESS )
- if( mdbImpl->get_connectivity(&( ent_handle), 1, nodes) != MB_SUCCESS )
+ //get the nodes of the element
+ if( mdbImpl->get_connectivity( ent_handle, nodes, num_elem_nodes ) != MB_SUCCESS )
return MB_FAILURE;
- std::vector<MBEntityHandle> connectivity;
-
- //get the correct nodes to make the element
- int index = MBCN::mConnectivityMap[MBQUAD][0].conn[ side_list[i]-1][0];
- assert(index < MBCN::VerticesPerEntity(mdbImpl->type_from_handle(ent_handle)));
- connectivity.push_back( nodes[index] );
- index = MBCN::mConnectivityMap[MBQUAD][0].conn[ side_list[i]-1][1];
- assert(index < MBCN::VerticesPerEntity(mdbImpl->type_from_handle(ent_handle)));
- connectivity.push_back( nodes[index] );
-
- ent_handle = 0;
+ MBCN::SubEntityNodeIndices( type, num_elem_nodes, 1, side_num, subtype, num_side_nodes, side_node_idx );
+ if (num_side_nodes <= 0)
+ return MB_FAILURE;
- if(create_sideset_element(connectivity, MBEDGE, ent_handle) == MB_SUCCESS)
- {
- entities_to_add.push_back(ent_handle);
- }
- else
+ connectivity.resize( num_side_nodes );
+ for (k = 0; k < num_side_nodes; ++k)
+ connectivity[k] = nodes[ side_node_idx[k] ];
+
+ if (MB_SUCCESS != create_sideset_element( connectivity, subtype, ent_handle ))
return MB_FAILURE;
+ entities_to_add.push_back( ent_handle );
//read in distribution factor array
if( num_dist_factors )
@@ -1671,7 +1631,6 @@
for(k=0; k<2; k++)
dist_factor_vector.push_back( temp_dist_factor_vector[df_index++] );
}
-
}
else if(type == MBTRI)
{
@@ -1693,28 +1652,22 @@
side_offset = 2;
}
- //ent_handle = CREATE_HANDLE(MBTRI, base_id, error );
- //if( mdbImpl->get_adjacencies( ent_handle, 0, false, nodes ) != MB_SUCCESS )
- if( mdbImpl->get_connectivity(&( ent_handle), 1, nodes) != MB_SUCCESS )
- return MB_FAILURE;
+ //get the nodes of the element
+ if( mdbImpl->get_connectivity( ent_handle, nodes, num_elem_nodes ) != MB_SUCCESS )
+ return MB_FAILURE;
- std::vector<MBEntityHandle> connectivity;
+ MBCN::SubEntityNodeIndices( type, num_elem_nodes, 1, side_num-side_offset, subtype, num_side_nodes, side_node_idx );
+ if (num_side_nodes <= 0)
+ return MB_FAILURE;
- int index = MBCN::mConnectivityMap[MBTRI][0].conn[ side_list[i]-1-side_offset][0];
- assert(index < MBCN::VerticesPerEntity(mdbImpl->type_from_handle(ent_handle)));
- connectivity.push_back( nodes[index] );
- index = MBCN::mConnectivityMap[MBTRI][0].conn[ side_list[i]-1-side_offset][1];
- assert(index < MBCN::VerticesPerEntity(mdbImpl->type_from_handle(ent_handle)));
- connectivity.push_back( nodes[index] );
-
- ent_handle = 0;
-
- if(create_sideset_element(connectivity, MBEDGE, ent_handle) == MB_SUCCESS)
- {
- entities_to_add.push_back(ent_handle);
- }
- else
+ connectivity.resize( num_side_nodes );
+ for (k = 0; k < num_side_nodes; ++k)
+ connectivity[k] = nodes[ side_node_idx[k] ];
+
+ if (MB_SUCCESS != create_sideset_element( connectivity, subtype, ent_handle ))
return MB_FAILURE;
+ entities_to_add.push_back( ent_handle );
+
if( num_dist_factors )
{
for(k=0; k<2; k++)
@@ -1729,7 +1682,7 @@
return MB_SUCCESS;
}
-MBErrorCode ReadNCDF::create_sideset_element( std::vector<MBEntityHandle> connectivity,
+MBErrorCode ReadNCDF::create_sideset_element( const std::vector<MBEntityHandle>& connectivity,
MBEntityType type, MBEntityHandle& handle)
{
// get adjacent entities
@@ -1831,7 +1784,7 @@
df_index += 3;
else if( elem_type >= EXOII_QUAD && elem_type <= EXOII_QUAD9 )
df_index += 2;
- else if( elem_type >= EXOII_SHEL && elem_type <= EXOII_SHELL9)
+ else if( elem_type >= EXOII_SHELL && elem_type <= EXOII_SHELL9)
{
if(side_id == 1 || side_id == 2)
df_index += 4;
Modified: MOAB/trunk/ReadNCDF.hpp
===================================================================
--- MOAB/trunk/ReadNCDF.hpp 2009-05-20 15:34:35 UTC (rev 2900)
+++ MOAB/trunk/ReadNCDF.hpp 2009-05-20 18:48:43 UTC (rev 2901)
@@ -160,7 +160,7 @@
*/
//! creates an element with the given connectivity
- MBErrorCode create_sideset_element( std::vector<MBEntityHandle>, MBEntityType, MBEntityHandle&);
+ MBErrorCode create_sideset_element( const std::vector<MBEntityHandle>&, MBEntityType, MBEntityHandle&);
//! I think this ought to be moved to MBCore. KGM
MBErrorCode check_file_status(std::string& filename,
Modified: MOAB/trunk/exodus_test.cc
===================================================================
--- MOAB/trunk/exodus_test.cc 2009-05-20 15:34:35 UTC (rev 2900)
+++ MOAB/trunk/exodus_test.cc 2009-05-20 18:48:43 UTC (rev 2901)
@@ -5,6 +5,7 @@
#include "ReadNCDF.hpp"
#include "WriteNCDF.hpp"
#include "FileOptions.hpp"
+#include "ExoIIUtil.hpp"
#include <math.h>
#include <algorithm>
@@ -31,12 +32,19 @@
MBEntityHandle entity,
int mid_nodes[4] );
+void test_read_side( int sideset_id,
+ MBEntityType sideset_type,
+ int sideset_nodes_per_elem,
+ bool shell_side = false );
+
// Validate elements of specified type.
// Looks for a block containing the specified entity type
// and with the specified mid-node flags set in its
// HAS_MID_NODES_TAG.
void test_ho_elements( MBEntityType type, int num_nodes );
+void test_types();
+
void test_tri6 () { test_ho_elements(MBTRI, 6); }
void test_tri7 () { test_ho_elements(MBTRI, 7); }
@@ -52,10 +60,17 @@
void test_hex20() { test_ho_elements(MBHEX, 20); }
void test_hex27() { test_ho_elements(MBHEX, 27); }
+void test_read_tri6_side() { test_read_side( 1, MBEDGE, 3 ); } // sideset 1
+void test_read_shell_side() { test_read_side( 3, MBQUAD, 9, true ); } // sideset 3
+void test_read_shell_edge() { test_read_side( 4, MBEDGE, 3 ); } // sideset 4
+void test_read_hex20_side() { test_read_side( 2, MBQUAD, 8 ); } // sideset 2
+
int main()
{
int result = 0;
+ result += RUN_TEST(test_types);
+
result += RUN_TEST(test_tri6 );
result += RUN_TEST(test_tri7 );
result += RUN_TEST(test_quad5);
@@ -68,9 +83,92 @@
result += RUN_TEST(test_hex20);
result += RUN_TEST(test_hex27);
+ result += RUN_TEST(test_read_tri6_side );
+ result += RUN_TEST(test_read_shell_side);
+ result += RUN_TEST(test_read_shell_edge);
+ result += RUN_TEST(test_read_hex20_side);
+
return result;
}
+struct TestType {
+ MBEntityType moab_type;
+ ExoIIElementType exo_type;
+ int num_nodes;
+ std::string name;
+};
+
+void check_type( const TestType& type )
+{
+ int has_mid_nodes[4];
+ MBCN::HasMidNodes( type.moab_type, type.num_nodes, has_mid_nodes );
+
+ CHECK_EQUAL( type.moab_type, ExoIIUtil::ExoIIElementMBEntity[type.exo_type] );
+ CHECK_EQUAL( type.name, std::string( ExoIIUtil::ElementTypeNames[type.exo_type] ) );
+ CHECK_EQUAL( type.num_nodes, ExoIIUtil::VerticesPerElement[type.exo_type] );
+ switch (MBCN::Dimension(type.moab_type)) {
+ case 3: CHECK_EQUAL( has_mid_nodes[3], ExoIIUtil::HasMidNodes[type.exo_type][3] );
+ case 2: CHECK_EQUAL( has_mid_nodes[2], ExoIIUtil::HasMidNodes[type.exo_type][2] );
+ case 1: CHECK_EQUAL( has_mid_nodes[1], ExoIIUtil::HasMidNodes[type.exo_type][1] );
+ }
+
+ MBCore moab;
+ ExoIIUtil tool(&moab);
+ CHECK_EQUAL( type.exo_type, tool.element_name_to_type( type.name.c_str() ) );
+ CHECK_EQUAL( type.name, std::string(tool.element_type_name( type.exo_type ) ) );
+}
+
+void test_types()
+{
+ const TestType types[] = {
+ { MBVERTEX, EXOII_SPHERE, 1, "SPHERE" },
+ { MBEDGE, EXOII_SPRING, 1, "SPRING" },
+ { MBEDGE, EXOII_BAR, 2, "BAR" },
+ { MBEDGE, EXOII_BAR2, 2, "BAR2" },
+ { MBEDGE, EXOII_BAR3, 3, "BAR3" },
+ { MBEDGE, EXOII_BEAM, 2, "BEAM" },
+ { MBEDGE, EXOII_BEAM2, 2, "BEAM2" },
+ { MBEDGE, EXOII_BEAM3, 3, "BEAM3" },
+ { MBEDGE, EXOII_TRUSS, 2, "TRUSS" },
+ { MBEDGE, EXOII_TRUSS2, 2, "TRUSS2" },
+ { MBEDGE, EXOII_TRUSS3, 3, "TRUSS3" },
+ { MBTRI, EXOII_TRI, 3, "TRI" },
+ { MBTRI, EXOII_TRI3, 3, "TRI3" },
+ { MBTRI, EXOII_TRI6, 6, "TRI6" },
+ { MBTRI, EXOII_TRI7, 7, "TRI7" },
+ { MBQUAD, EXOII_QUAD, 4, "QUAD" },
+ { MBQUAD, EXOII_QUAD4, 4, "QUAD4" },
+ { MBQUAD, EXOII_QUAD5, 5, "QUAD5" },
+ { MBQUAD, EXOII_QUAD8, 8, "QUAD8" },
+ { MBQUAD, EXOII_QUAD9, 9, "QUAD9" },
+ { MBQUAD, EXOII_SHELL, 4, "SHELL" },
+ { MBQUAD, EXOII_SHELL4, 4, "SHELL4" },
+ { MBQUAD, EXOII_SHELL5, 5, "SHELL5" },
+ { MBQUAD, EXOII_SHELL8, 8, "SHELL8" },
+ { MBQUAD, EXOII_SHELL9, 9, "SHELL9" },
+ { MBTET, EXOII_TETRA, 4, "TETRA" },
+ { MBTET, EXOII_TETRA4, 4, "TETRA4" },
+ { MBTET, EXOII_TETRA8, 8, "TETRA8" },
+ { MBTET, EXOII_TETRA10, 10, "TETRA10" },
+ { MBTET, EXOII_TETRA14, 14, "TETRA14" },
+ { MBPYRAMID, EXOII_PYRAMID, 5, "PYRAMID" },
+ { MBPYRAMID, EXOII_PYRAMID5, 5, "PYRAMID5" },
+ { MBPYRAMID, EXOII_PYRAMID10, 10, "PYRAMID10" },
+ { MBPYRAMID, EXOII_PYRAMID13, 13, "PYRAMID13" },
+ { MBPYRAMID, EXOII_PYRAMID18, 18, "PYRAMID18" },
+ { MBPRISM, EXOII_WEDGE, 6, "WEDGE" },
+ { MBKNIFE, EXOII_KNIFE, 7, "KNIFE" },
+ { MBHEX, EXOII_HEX, 8, "HEX" },
+ { MBHEX, EXOII_HEX8, 8, "HEX8" },
+ { MBHEX, EXOII_HEX9, 9, "HEX9" },
+ { MBHEX, EXOII_HEX20, 20, "HEX20" },
+ { MBHEX, EXOII_HEX27, 27, "HEX27" },
+ { MBHEX, EXOII_HEXSHELL, 12, "HEXSHELL" } };
+ const int num_types = sizeof(types)/sizeof(types[0]);
+ for (int i = 0; i < num_types; ++i)
+ check_type( types[i] );
+}
+
void read_file( MBInterface& moab,
const char* input_file )
{
@@ -213,6 +311,23 @@
return 0;
}
+MBEntityHandle find_sideset( MBInterface& mb,
+ int sideset_id,
+ MBEntityType side_type )
+{
+ MBErrorCode rval;
+ MBTag ss_tag;
+ rval = mb.tag_get_handle( NEUMANN_SET_TAG_NAME, ss_tag );
+ CHECK_ERR(rval);
+
+ const void* tag_vals[] = { &sideset_id };
+ MBRange side_sets;
+ rval = mb.get_entities_by_type_and_tag( 0, MBENTITYSET, &ss_tag, tag_vals, 1, side_sets );
+ CHECK_ERR(rval);
+ CHECK_EQUAL( 1, (int)side_sets.size() );
+ return side_sets.front();
+}
+
// Validate elements of specified type.
// Looks for a block containing the specified entity type
// and with the specified mid-node flags set in its
@@ -238,3 +353,41 @@
CHECK(block != 0);
check_ho_elements( mb2, block, type, ho_flags );
}
+
+void test_read_side( int id,
+ MBEntityType sideset_type,
+ int sideset_nodes_per_elem,
+ bool shell_side )
+{
+ // read test file
+ MBCore mb_impl;
+ MBInterface& moab = mb_impl;
+ read_file( moab, ho_file );
+
+ // get side set
+ MBEntityHandle set = find_sideset( moab, id, sideset_type );
+ CHECK(set != 0);
+
+ // check expected element connectivity
+ int ho_flags[4];
+ MBCN::HasMidNodes( sideset_type, sideset_nodes_per_elem, ho_flags );
+ check_ho_elements( moab, set, sideset_type, ho_flags );
+
+ if (shell_side)
+ return;
+
+ // check that each element is on the boundary of the mesh
+ MBRange elems;
+ MBErrorCode rval = mb_impl.get_entities_by_handle( set, elems );
+ CHECK_ERR(rval);
+
+ int dim = MBCN::Dimension( sideset_type );
+ for (MBRange::iterator i= elems.begin(); i != elems.end(); ++i) {
+ MBRange adj;
+ rval = mb_impl.get_adjacencies( &*i, 1, dim+1, false, adj, MBInterface::UNION );
+ CHECK_ERR(rval);
+ CHECK_EQUAL( 1, (int)adj.size() );
+ }
+
+}
+
Modified: MOAB/trunk/test/ho_test.cub
===================================================================
(Binary files differ)
Modified: MOAB/trunk/test/ho_test.g
===================================================================
(Binary files differ)
More information about the moab-dev
mailing list