8 #include <stk_io/util/Gmesh_STKmesh_Fixture.hpp> 9 #include <stk_util/unit_test_support/stk_utest_macros.hpp> 11 #include <stk_mesh/base/FieldData.hpp> 12 #include <stk_mesh/base/GetEntities.hpp> 14 # include <stk_mesh/fem/FEMHelpers.hpp> 16 #include <stk_mesh/fem/CoordinateSystems.hpp> 18 #include <Shards_BasicTopologies.hpp> 19 #include <Shards_CellTopologyData.h> 21 #include <Ioss_Utils.h> 25 enum { SpaceDim = 3 };
27 STKUNIT_UNIT_TEST(UnitTestGmeshFixture, testUnit)
29 const size_t num_x = 1;
30 const size_t num_y = 2;
31 const size_t num_z = 3;
32 const size_t num_surf = 6;
41 const std::vector<std::string> & sideset_names = fixture.getSidesetNames();
42 STKUNIT_ASSERT_EQUAL( num_surf, sideset_names.size() );
44 for(
size_t i = 0; i < num_surf; ++i ) {
46 STKUNIT_ASSERT(surf_name == sideset_names[i]);
49 std::vector<size_t> num_surf_elem(3);
50 num_surf_elem[0] = num_y * num_z;
51 num_surf_elem[1] = num_x * num_z;
52 num_surf_elem[2] = num_x * num_y;
54 for(
size_t i = 0; i < num_surf/2; ++i )
56 STKUNIT_ASSERT_EQUAL( num_surf_elem[i], fixture.getSurfElemCount(2*i) );
57 STKUNIT_ASSERT_EQUAL( num_surf_elem[i], fixture.getSurfElemCount(2*i+1) );
60 const size_t total_side_count = 2 * (num_surf_elem[0]+num_surf_elem[1]+num_surf_elem[2]);
61 STKUNIT_ASSERT_EQUAL( total_side_count, fixture.getSideCount() );
63 const size_t total_elem_count = num_x * num_y * num_z;
64 STKUNIT_ASSERT_EQUAL( total_elem_count, fixture.getElemCount() );
66 const size_t total_node_count = (num_x+1) * (num_y+1) * (num_z+1);
67 STKUNIT_ASSERT_EQUAL( total_node_count, fixture.getNodeCount() );
72 STKUNIT_ASSERT( coord_field );
75 const std::vector<stk_classic::mesh::Bucket*> & all_side_buckets = fixture.getBulkData().buckets( fem_meta.
side_rank() );
77 std::vector<stk_classic::mesh::Entity *> entities;
80 STKUNIT_ASSERT_EQUAL( sideset_names.size(), side_parts.size() );
82 for(
size_t ifset = 0; ifset < side_parts.size(); ++ifset )
84 std::pair<int, double> expected = fixture.getSurfCoordInfo(ifset);
89 STKUNIT_ASSERT_EQUAL( fixture.getSurfElemCount(ifset), entities.size() );
91 for (
size_t i = 0 ; i < entities.size() ; ++i ) {
94 const CellTopologyData * cell_topology = stk_classic::mesh::fem::get_cell_topology(side).getCellTopologyData();
96 STKUNIT_ASSERT( cell_topology );
100 STKUNIT_ASSERT_EQUAL( cell_topology->node_count, rel.size() );
102 for (
unsigned j = 0 ; j < cell_topology->node_count ; ++j )
106 STKUNIT_ASSERT( coords );
109 STKUNIT_ASSERT_DOUBLE_EQ(expected.second, coords[expected.first]);
FieldTraits< field_type >::data_type * field_data(const field_type &f, const Bucket::iterator i)
Pointer to the field data array.
This is a class for selecting buckets based on a set of meshparts and set logic.
Field with defined data type and multi-dimensions (if any)
void get_selected_entities(const Selector &selector, const std::vector< Bucket * > &input_buckets, std::vector< Entity * > &entities)
Get entities in selected buckets (selected by the given selector instance), and sorted by ID...
PairIterRelation relations() const
All Entity relations for which this entity is a member. The relations are ordered from lowest entity-...
A fundamental unit within the discretization of a problem domain, including but not limited to nodes...
std::vector< Part *> PartVector
Collections of parts are frequently maintained as a vector of Part pointers.
std::string to_string(const T &t)