| 1 |
// Copyright 2002 - 2008, 2010, 2011 National Technology Engineering |
| 2 |
// Solutions of Sandia, LLC (NTESS). Under the terms of Contract |
| 3 |
// DE-NA0003525 with NTESS, the U.S. Government retains certain rights |
| 4 |
// in this software. |
| 5 |
// |
| 6 |
// Redistribution and use in source and binary forms, with or without |
| 7 |
// modification, are permitted provided that the following conditions are |
| 8 |
// met: |
| 9 |
// |
| 10 |
// * Redistributions of source code must retain the above copyright |
| 11 |
// notice, this list of conditions and the following disclaimer. |
| 12 |
// |
| 13 |
// * Redistributions in binary form must reproduce the above |
| 14 |
// copyright notice, this list of conditions and the following |
| 15 |
// disclaimer in the documentation and/or other materials provided |
| 16 |
// with the distribution. |
| 17 |
// |
| 18 |
// * Neither the name of NTESS nor the names of its contributors |
| 19 |
// may be used to endorse or promote products derived from this |
| 20 |
// software without specific prior written permission. |
| 21 |
// |
| 22 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 23 |
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 24 |
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 25 |
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 26 |
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 27 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 28 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 29 |
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 30 |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 31 |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 32 |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 33 |
// |
| 34 |
|
| 35 |
#include <gtest/gtest.h> // for TEST |
| 36 |
#include <sstream> // for ostringstream |
| 37 |
#include <unistd.h> |
| 38 |
#include "mpi.h" // for MPI_COMM_WORLD |
| 39 |
|
| 40 |
#include "stk_mesh/base/BulkData.hpp" // for BulkData |
| 41 |
#include "stk_mesh/base/MetaData.hpp" // for MetaData |
| 42 |
#include "stk_mesh/base/DumpMeshInfo.hpp" |
| 43 |
#include "stk_unit_test_utils/stk_mesh_fixtures/HexFixture.hpp" // for HexFixture |
| 44 |
|
| 45 |
namespace { |
| 46 |
|
| 47 |
TEST(UnitTestDebugDump, dump_all_meta_info) |
| 48 |
{ |
| 49 |
const unsigned NX = 3; |
| 50 |
const unsigned NY = 1; |
| 51 |
const unsigned NZ = 1; |
| 52 |
stk::mesh::fixtures::HexFixture fixture(MPI_COMM_WORLD, NX, NY, NZ); |
| 53 |
fixture.m_meta.commit(); |
| 54 |
|
| 55 |
// Doesn't check anything, but at least makes sure it builds and runs |
| 56 |
std::ostringstream oss; |
| 57 |
stk::mesh::impl::dump_all_meta_info(fixture.m_meta, oss); |
| 58 |
|
| 59 |
// std::cout << oss.str() << std::endl; |
| 60 |
} |
| 61 |
|
| 62 |
TEST(UnitTestDebugDump, dump_all_mesh_info) |
| 63 |
{ |
| 64 |
const unsigned NX = 3; |
| 65 |
const unsigned NY = 1; |
| 66 |
const unsigned NZ = 1; |
| 67 |
stk::mesh::fixtures::HexFixture hf(MPI_COMM_WORLD, NX, NY, NZ); |
| 68 |
hf.m_meta.commit(); |
| 69 |
hf.generate_mesh(); |
| 70 |
|
| 71 |
// Doesn't check anything, but at least makes sure it builds and runs |
| 72 |
std::ostringstream oss; |
| 73 |
stk::mesh::impl::dump_all_mesh_info(hf.m_bulk_data, oss); |
| 74 |
|
| 75 |
// std::cout << oss.str() << std::endl; |
| 76 |
} |
| 77 |
|
| 78 |
TEST(UnitTestDebugDump, dump_mesh_per_proc) |
| 79 |
{ |
| 80 |
const unsigned NX = 3; |
| 81 |
const unsigned NY = 1; |
| 82 |
const unsigned NZ = 1; |
| 83 |
stk::mesh::fixtures::HexFixture hf(MPI_COMM_WORLD, NX, NY, NZ); |
| 84 |
hf.m_meta.commit(); |
| 85 |
hf.generate_mesh(); |
| 86 |
|
| 87 |
// Doesn't check anything, but at least makes sure it builds and runs |
| 88 |
std::ostringstream oss; |
| 89 |
stk::mesh::impl::dump_mesh_per_proc(hf.m_bulk_data, "junk_mesh"); |
| 90 |
|
| 91 |
unlink(("junk_mesh." + std::to_string(stk::parallel_machine_rank(MPI_COMM_WORLD))).c_str()); |
| 92 |
} |
| 93 |
|
| 94 |
TEST(UnitTestDebugDump, dump_partition_summary) |
| 95 |
{ |
| 96 |
const unsigned NX = 3; |
| 97 |
const unsigned NY = 1; |
| 98 |
const unsigned NZ = 1; |
| 99 |
stk::mesh::fixtures::HexFixture hf(MPI_COMM_WORLD, NX, NY, NZ); |
| 100 |
hf.m_meta.commit(); |
| 101 |
hf.generate_mesh(); |
| 102 |
|
| 103 |
// Doesn't check anything, but at least makes sure it builds and runs |
| 104 |
std::ostringstream oss; |
| 105 |
stk::mesh::impl::dump_partition_summary(hf.m_bulk_data, oss); |
| 106 |
|
| 107 |
// std::cout << oss.str() << std::endl; |
| 108 |
} |
| 109 |
|
| 110 |
TEST(UnitTestDebugDump, dump_partition_summary_per_proc) |
| 111 |
{ |
| 112 |
const unsigned NX = 3; |
| 113 |
const unsigned NY = 1; |
| 114 |
const unsigned NZ = 1; |
| 115 |
stk::mesh::fixtures::HexFixture hf(MPI_COMM_WORLD, NX, NY, NZ); |
| 116 |
hf.m_meta.commit(); |
| 117 |
hf.generate_mesh(); |
| 118 |
|
| 119 |
// Doesn't check anything, but at least makes sure it builds and runs |
| 120 |
std::ostringstream oss; |
| 121 |
stk::mesh::impl::dump_partition_summary_per_proc(hf.m_bulk_data, "junk_partition_summary"); |
| 122 |
|
| 123 |
unlink(("junk_partition_summary." + std::to_string(stk::parallel_machine_rank(MPI_COMM_WORLD))).c_str()); |
| 124 |
} |
| 125 |
|
| 126 |
TEST(UnitTestDebugDump, dump_bucket_size_histogram) |
| 127 |
{ |
| 128 |
const unsigned NX = 3; |
| 129 |
const unsigned NY = 1; |
| 130 |
const unsigned NZ = 1; |
| 131 |
stk::mesh::fixtures::HexFixture hf(MPI_COMM_WORLD, NX, NY, NZ); |
| 132 |
hf.m_meta.commit(); |
| 133 |
hf.generate_mesh(); |
| 134 |
|
| 135 |
// Doesn't check anything, but at least makes sure it builds and runs |
| 136 |
std::ostringstream oss; |
| 137 |
stk::mesh::impl::dump_bucket_size_histogram(hf.m_bulk_data, oss); |
| 138 |
|
| 139 |
// std::cout << oss.str() << std::endl; |
| 140 |
} |
| 141 |
|
| 142 |
TEST(UnitTestDebugDump, dump_bucket_size_histogram_per_proc) |
| 143 |
{ |
| 144 |
const unsigned NX = 3; |
| 145 |
const unsigned NY = 1; |
| 146 |
const unsigned NZ = 1; |
| 147 |
stk::mesh::fixtures::HexFixture hf(MPI_COMM_WORLD, NX, NY, NZ); |
| 148 |
hf.m_meta.commit(); |
| 149 |
hf.generate_mesh(); |
| 150 |
|
| 151 |
// Doesn't check anything, but at least makes sure it builds and runs |
| 152 |
std::ostringstream oss; |
| 153 |
stk::mesh::impl::dump_bucket_size_histogram_per_proc(hf.m_bulk_data, "junk_histogram"); |
| 154 |
|
| 155 |
unlink(("junk_histogram." + std::to_string(stk::parallel_machine_rank(MPI_COMM_WORLD))).c_str()); |
| 156 |
} |
| 157 |
|
| 158 |
TEST(UnitTestDebugDump, dump_global_bucket_size_histogram) |
| 159 |
{ |
| 160 |
const unsigned NX = 3; |
| 161 |
const unsigned NY = 1; |
| 162 |
const unsigned NZ = 1; |
| 163 |
stk::mesh::fixtures::HexFixture hf(MPI_COMM_WORLD, NX, NY, NZ); |
| 164 |
hf.m_meta.commit(); |
| 165 |
hf.generate_mesh(); |
| 166 |
|
| 167 |
// Doesn't check anything, but at least makes sure it builds and runs |
| 168 |
std::ostringstream oss; |
| 169 |
stk::mesh::impl::dump_bucket_size_histogram_per_proc(hf.m_bulk_data, "junk_histogram"); |
| 170 |
|
| 171 |
unlink(("junk_histogram." + std::to_string(stk::parallel_machine_rank(MPI_COMM_WORLD))).c_str()); |
| 172 |
} |
| 173 |
|
| 174 |
} |