Debian Codegraph @

packages/stk/stk_unit_tests/stk_tools/pmesh_lib/UnitTestPmesh.cpp

raw
1 // ####################### Start Clang Header Tool Managed Headers ########################
2 // clang-format off
3 #include <gtest/gtest.h>
4 #include <mpi.h> // for MPI_Comm_rank, MPI_Comm_size
5 #include <stddef.h> // for size_t
6 #include <stk_tools/pmesh_lib/makeparfiles.H> // for MakeParFile
7 #include <string> // for string
8 #include "stk_io/FillMesh.hpp" // for fill_mesh
9 #include "stk_mesh/base/BulkData.hpp" // for BulkData
10 #include "stk_mesh/base/MeshBuilder.hpp"
11 #include "stk_mesh/base/GetEntities.hpp" // for count_selected_entities
12 #include "stk_mesh/base/MetaData.hpp" // for MetaData
13 #include "stk_topology/topology.hpp" // for topology, topology::rank_t:...
14 // clang-format on
15 // ####################### End Clang Header Tool Managed Headers ########################
16
17 namespace
18 {
19
20 TEST(PMESH, a)
21 {
22 MPI_Comm comm = MPI_COMM_WORLD;
23
24 int num_procs = -1, my_proc_id = -1;
25 MPI_Comm_rank(comm, &my_proc_id);
26 MPI_Comm_size(comm, &num_procs);
27
28 // ncut_x * ncuts_y * ncuts_z is number of processor
29 int ncuts_x = 1, ncuts_y = 1, ncuts_z = 1;
30 size_t num_elem_per_edge = 10;
31 double lenx = 1.0, leny = 1.0, lenzi = 1.0;
32 const std::string rootdir="";
33 stk_tools::MakeParFile(my_proc_id, num_procs, ncuts_x, ncuts_y, ncuts_z, num_elem_per_edge, lenx, leny, lenzi, rootdir.c_str());
34
35 std::shared_ptr<stk::mesh::BulkData> bulk = stk::mesh::MeshBuilder(comm).create();
36 stk::mesh::MetaData& meta = bulk->mesh_meta_data();
37 stk::io::fill_mesh("cube.exo.1.0", *bulk);
38
39 size_t numElements = stk::mesh::count_selected_entities(meta.locally_owned_part(), bulk->buckets(stk::topology::ELEM_RANK));
40 EXPECT_EQ(num_elem_per_edge*num_elem_per_edge*num_elem_per_edge, numElements);
41 }
42
43 }