| 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> |
| 36 |
#include <stk_util/stk_config.h> |
| 37 |
#include <stk_unit_test_utils/getOption.h> |
| 38 |
#include <stk_util/parallel/ParallelReduce.hpp> |
| 39 |
#include <stk_mesh/base/MetaData.hpp> |
| 40 |
#include <stk_mesh/base/MeshBuilder.hpp> |
| 41 |
#include <stk_mesh/base/BulkData.hpp> |
| 42 |
#include <stk_mesh/base/Bucket.hpp> |
| 43 |
#include <stk_mesh/base/Field.hpp> |
| 44 |
#include <stk_mesh/base/Entity.hpp> |
| 45 |
#include <stk_io/FillMesh.hpp> |
| 46 |
#include <stk_unit_test_utils/timer.hpp> |
| 47 |
|
| 48 |
namespace stk_perf_io_mesh_read |
| 49 |
{ |
| 50 |
|
| 51 |
TEST(StkIo, meshRead_hex_noAura) |
| 52 |
{ |
| 53 |
if (stk::parallel_machine_size(MPI_COMM_WORLD) > 16) { GTEST_SKIP(); } |
| 54 |
|
| 55 |
const unsigned NUM_RUNS = 5; |
| 56 |
const unsigned NUM_ITERS = 10; |
| 57 |
int ELEMS_PER_DIM = stk::unit_test_util::get_command_line_option("--ne", 80); |
| 58 |
std::string elems = std::to_string(ELEMS_PER_DIM); |
| 59 |
std::string meshSpec = "generated:"+elems+"x"+elems+"x"+elems; |
| 60 |
|
| 61 |
if (stk::parallel_machine_rank(MPI_COMM_WORLD) == 0) { |
| 62 |
std::cout << "Using mesh-spec: " << meshSpec << std::endl; |
| 63 |
} |
| 64 |
|
| 65 |
stk::unit_test_util::BatchTimer batchTimer(MPI_COMM_WORLD); |
| 66 |
|
| 67 |
batchTimer.initialize_batch_timer(); |
| 68 |
for (unsigned j = 0; j < NUM_RUNS; j++) { |
| 69 |
|
| 70 |
stk::parallel_machine_barrier(MPI_COMM_WORLD); |
| 71 |
|
| 72 |
batchTimer.start_batch_timer(); |
| 73 |
|
| 74 |
for(unsigned i=0; i<NUM_ITERS; ++i) { |
| 75 |
std::unique_ptr<stk::mesh::BulkData> bulkPtr = stk::mesh::MeshBuilder(MPI_COMM_WORLD) |
| 76 |
.set_aura_option(stk::mesh::BulkData::NO_AUTO_AURA) |
| 77 |
.create(); |
| 78 |
stk::io::fill_mesh(meshSpec, *bulkPtr); |
| 79 |
} |
| 80 |
|
| 81 |
batchTimer.stop_batch_timer(); |
| 82 |
} |
| 83 |
batchTimer.print_batch_timing(NUM_ITERS); |
| 84 |
} |
| 85 |
|
| 86 |
TEST(StkIo, meshRead_hex_shells_sidesets_aura) |
| 87 |
{ |
| 88 |
if (stk::parallel_machine_size(MPI_COMM_WORLD) > 16) { GTEST_SKIP(); } |
| 89 |
|
| 90 |
const unsigned NUM_RUNS = 5; |
| 91 |
const unsigned NUM_ITERS = 10; |
| 92 |
int ELEMS_PER_DIM = stk::unit_test_util::get_command_line_option("--ne", 80); |
| 93 |
std::string elems = std::to_string(ELEMS_PER_DIM); |
| 94 |
std::string meshSpec = "generated:"+elems+"x"+elems+"x"+elems+"|shell:xyzXYZ|sideset:xyzXYZ"; |
| 95 |
|
| 96 |
if (stk::parallel_machine_rank(MPI_COMM_WORLD) == 0) { |
| 97 |
std::cout << "Using mesh-spec: " << meshSpec << std::endl; |
| 98 |
} |
| 99 |
|
| 100 |
stk::unit_test_util::BatchTimer batchTimer(MPI_COMM_WORLD); |
| 101 |
|
| 102 |
batchTimer.initialize_batch_timer(); |
| 103 |
for (unsigned j = 0; j < NUM_RUNS; j++) { |
| 104 |
|
| 105 |
stk::parallel_machine_barrier(MPI_COMM_WORLD); |
| 106 |
|
| 107 |
batchTimer.start_batch_timer(); |
| 108 |
|
| 109 |
for(unsigned i=0; i<NUM_ITERS; ++i) { |
| 110 |
std::unique_ptr<stk::mesh::BulkData> bulkPtr = stk::mesh::MeshBuilder(MPI_COMM_WORLD) |
| 111 |
.create(); |
| 112 |
stk::io::fill_mesh(meshSpec, *bulkPtr); |
| 113 |
} |
| 114 |
|
| 115 |
batchTimer.stop_batch_timer(); |
| 116 |
} |
| 117 |
batchTimer.print_batch_timing(NUM_ITERS); |
| 118 |
} |
| 119 |
|
| 120 |
} |