| 1 |
// Copyright(C) 1999-2024 National Technology & Engineering Solutions |
| 2 |
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
// NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
// |
| 5 |
// See packages/seacas/LICENSE for details |
| 6 |
#include <catch2/catch_session.hpp> |
| 7 |
#include <catch2/catch_test_macros.hpp> |
| 8 |
|
| 9 |
#include "Ioss_CodeTypes.h" |
| 10 |
#include "Ioss_SubSystem.h" |
| 11 |
#include "init/Ionit_Initializer.h" |
| 12 |
|
| 13 |
#include "adios/Ioad_Constants.h" |
| 14 |
#include "adios/Ioad_Helper.h" |
| 15 |
#include "adios/Ioad_TemplateToValue.h" |
| 16 |
|
| 17 |
#include <algorithm> |
| 18 |
#include <iostream> |
| 19 |
#include <ostream> |
| 20 |
#include <stddef.h> // for size_t |
| 21 |
#include <stdlib.h> // for rand, srand, RAND_MAX |
| 22 |
#include <string> |
| 23 |
#include <vector> |
| 24 |
|
| 25 |
//////// Global constants //////////// |
| 26 |
std::vector<std::string> ignored_properties = {"database_name", "base_filename", "database_type"}; |
| 27 |
std::vector<std::string> ignored_fields = {"implicit_ids"}; |
| 28 |
std::vector<std::string> ignore_errors = {"owning_processor"}; |
| 29 |
|
| 30 |
//////////////////////////// |
| 31 |
|
| 32 |
int main(int argc, char *argv[]) |
| 33 |
{ |
| 34 |
#ifdef SEACAS_HAVE_MPI |
| 35 |
MPI_Init(&argc, &argv); |
| 36 |
#endif |
| 37 |
const int result = Catch::Session().run(argc, argv); |
| 38 |
#ifdef SEACAS_HAVE_MPI |
| 39 |
MPI_Finalize(); |
| 40 |
#endif |
| 41 |
|
| 42 |
return result; |
| 43 |
} |
| 44 |
|
| 45 |
#define COMPARE_POINTERS_AND_THROW_WITH_INDEX(obj_type, obj1, obj2, meth, index) \ |
| 46 |
if (obj1->meth(index) != obj2->meth(index)) { \ |
| 47 |
std::ostringstream error; \ |
| 48 |
error << #obj_type " " #meth " do not match:\n" \ |
| 49 |
<< "1:" #index " - " << obj1->meth(index) << "\n" \ |
| 50 |
<< "2:" #index " - " << obj2->meth(index) << "\n"; \ |
| 51 |
throw(error.str()); \ |
| 52 |
} |
| 53 |
|
| 54 |
void CompareVariableType(const Ioss::VariableType *var1, const Ioss::VariableType *var2) |
| 55 |
{ |
| 56 |
COMPARE_POINTERS_AND_THROW_WITH_INDEX(VariableType, var1, var2, name, ); |
| 57 |
COMPARE_POINTERS_AND_THROW_WITH_INDEX(VariableType, var1, var2, component_count, ); |
| 58 |
COMPARE_POINTERS_AND_THROW_WITH_INDEX(VariableType, var1, var2, suffix_count, ); |
| 59 |
|
| 60 |
for (int i = 1; i <= var1->component_count(); i++) { |
| 61 |
COMPARE_POINTERS_AND_THROW_WITH_INDEX(VariableType, var1, var2, label, i); |
| 62 |
// COMPARE_POINTERS_AND_THROW_WITH_INDEX(VariableType, var1, var2, label_name, i); |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
#define COMPARE_VALUES_AND_THROW(obj_type, obj1, obj2, meth) \ |
| 67 |
if (obj1.meth() != obj2.meth()) { \ |
| 68 |
std::ostringstream error; \ |
| 69 |
error << #obj_type " " #meth " do not match:\n" \ |
| 70 |
<< "1: " << obj1.meth() << "\n" \ |
| 71 |
<< "2: " << obj2.meth() << "\n"; \ |
| 72 |
throw(error.str()); \ |
| 73 |
} |
| 74 |
|
| 75 |
template <typename T> bool CompareVectors(const std::vector<T> &v1, const std::vector<T> &v2) |
| 76 |
{ |
| 77 |
std::vector<T> v3; |
| 78 |
std::set_difference(v1.begin(), v1.end(), v2.begin(), v2.end(), std::back_inserter(v3)); |
| 79 |
if (v3.empty()) { |
| 80 |
return true; |
| 81 |
} |
| 82 |
else { |
| 83 |
return false; |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
#define COMPARE_VECTORS_AND_THROW(name, vec1, vec2) \ |
| 88 |
if (!CompareVectors(vec1, vec2)) { \ |
| 89 |
std::ostringstream error; \ |
| 90 |
error << "Vectors " << name << " do not match:\n"; \ |
| 91 |
throw(error.str()); \ |
| 92 |
} |
| 93 |
|
| 94 |
void CompareFields(const Ioss::Field &field1, const Ioss::Field &field2) |
| 95 |
{ |
| 96 |
// Check that type is the same for both fields |
| 97 |
COMPARE_VALUES_AND_THROW(Field, field1, field2, get_type); |
| 98 |
CompareVariableType(field1.raw_storage(), field2.raw_storage()); |
| 99 |
CompareVariableType(field1.transformed_storage(), field2.transformed_storage()); |
| 100 |
COMPARE_VALUES_AND_THROW(Field, field1, field2, raw_count); |
| 101 |
COMPARE_VALUES_AND_THROW(Field, field1, field2, transformed_count); |
| 102 |
COMPARE_VALUES_AND_THROW(Field, field1, field2, get_size); |
| 103 |
COMPARE_VALUES_AND_THROW(Field, field1, field2, get_role); |
| 104 |
COMPARE_VALUES_AND_THROW(Field, field1, field2, has_transform); |
| 105 |
COMPARE_VALUES_AND_THROW(Field, field1, field2, is_valid); |
| 106 |
COMPARE_VALUES_AND_THROW(Field, field1, field2, is_invalid); |
| 107 |
COMPARE_VALUES_AND_THROW(Field, field1, field2, get_name); |
| 108 |
COMPARE_VALUES_AND_THROW(Field, field1, field2, get_type); |
| 109 |
} |
| 110 |
|
| 111 |
// Compare fields |
| 112 |
// compare properties |
| 113 |
void CompareProperties(const Ioss::Property &prop1, const Ioss::Property &prop2) |
| 114 |
{ |
| 115 |
COMPARE_VALUES_AND_THROW(Property, prop1, prop2, get_name); |
| 116 |
COMPARE_VALUES_AND_THROW(Property, prop1, prop2, get_type); |
| 117 |
COMPARE_VALUES_AND_THROW(Property, prop1, prop2, is_valid); |
| 118 |
COMPARE_VALUES_AND_THROW(Property, prop1, prop2, is_invalid); |
| 119 |
COMPARE_VALUES_AND_THROW(Property, prop1, prop2, is_explicit); |
| 120 |
COMPARE_VALUES_AND_THROW(Property, prop1, prop2, is_implicit); |
| 121 |
switch (prop1.get_type()) { |
| 122 |
case Ioss::Property::BasicType::REAL: |
| 123 |
COMPARE_VALUES_AND_THROW(Property, prop1, prop2, get_real); |
| 124 |
break; |
| 125 |
case Ioss::Property::BasicType::INTEGER: |
| 126 |
COMPARE_VALUES_AND_THROW(Property, prop1, prop2, get_int); |
| 127 |
break; |
| 128 |
case Ioss::Property::BasicType::POINTER: |
| 129 |
// TODO: Verify that is makes sense. |
| 130 |
COMPARE_VALUES_AND_THROW(Property, prop1, prop2, get_pointer); |
| 131 |
break; |
| 132 |
case Ioss::Property::BasicType::STRING: |
| 133 |
COMPARE_VALUES_AND_THROW(Property, prop1, prop2, get_string); |
| 134 |
break; |
| 135 |
case Ioss::Property::BasicType::INVALID: |
| 136 |
default: throw("Unsupported property type " + prop1.get_name()); |
| 137 |
} |
| 138 |
} |
| 139 |
|
| 140 |
template <typename T, typename TF> |
| 141 |
void CompareFieldData(const T entity_block1, const T entity_block2, const std::string &field_name) |
| 142 |
{ |
| 143 |
std::vector<TF> data1; |
| 144 |
std::vector<TF> data2; |
| 145 |
entity_block1->get_field_data(field_name, data1); |
| 146 |
entity_block2->get_field_data(field_name, data2); |
| 147 |
COMPARE_VECTORS_AND_THROW(field_name, data1, data2); |
| 148 |
} |
| 149 |
|
| 150 |
template <typename T> |
| 151 |
void CompareFieldData(const T entity_block1, const T entity_block2, const std::string &field_name) |
| 152 |
{ |
| 153 |
auto field = entity_block1->get_field(field_name); |
| 154 |
switch (field.get_type()) { |
| 155 |
case Ioss::Field::BasicType::DOUBLE: |
| 156 |
CompareFieldData<T, double>(entity_block1, entity_block2, field_name); |
| 157 |
break; |
| 158 |
case Ioss::Field::BasicType::INT32: |
| 159 |
CompareFieldData<T, int32_t>(entity_block1, entity_block2, field_name); |
| 160 |
break; |
| 161 |
case Ioss::Field::BasicType::INT64: |
| 162 |
CompareFieldData<T, int64_t>(entity_block1, entity_block2, field_name); |
| 163 |
break; |
| 164 |
case Ioss::Field::BasicType::COMPLEX: |
| 165 |
// CompareFieldData<T, Complex>(entity_block1, entity_block2, field_name); |
| 166 |
break; |
| 167 |
case Ioss::Field::BasicType::CHARACTER: |
| 168 |
CompareFieldData<T, char>(entity_block1, entity_block2, field_name); |
| 169 |
break; |
| 170 |
default: |
| 171 |
throw("INTERNAL ERROR: Invalid field type. Something is wrong in the the input entity block."); |
| 172 |
} |
| 173 |
} |
| 174 |
|
| 175 |
template <typename T> void CompareAllProperties(const T &obj1, const T &obj2) |
| 176 |
{ |
| 177 |
auto block1_property_list = obj1->property_describe(); |
| 178 |
auto block2_property_list = obj2->property_describe(); |
| 179 |
for (auto property_name1 : block1_property_list) { |
| 180 |
if (std::find(ignored_properties.begin(), ignored_properties.end(), property_name1) != |
| 181 |
std::end(ignored_properties)) { |
| 182 |
continue; |
| 183 |
} |
| 184 |
auto property_name2 = |
| 185 |
std::find(std::begin(block2_property_list), std::end(block2_property_list), property_name1); |
| 186 |
if (property_name2 != block2_property_list.end()) { |
| 187 |
// Check that the content is the same. |
| 188 |
auto property1 = obj1->get_property(property_name1); |
| 189 |
auto property2 = obj2->get_property(property_name1); |
| 190 |
|
| 191 |
CompareProperties(property1, property2); |
| 192 |
} |
| 193 |
else { |
| 194 |
throw("Property name " + property_name1 + " not found in db2"); |
| 195 |
} |
| 196 |
} |
| 197 |
} |
| 198 |
|
| 199 |
template <typename T> |
| 200 |
void CompareContainers(const T &entity_blocks1, const T &entity_blocks2, Ioss::State state) |
| 201 |
{ |
| 202 |
for (auto entity_block1 : entity_blocks1) { |
| 203 |
// Find corresponding block in vector |
| 204 |
|
| 205 |
auto entity_block2 = |
| 206 |
std::find_if(entity_blocks2.begin(), entity_blocks2.end(), |
| 207 |
[=](typename T::value_type e) { return e->name() == entity_block1->name(); }); |
| 208 |
if (entity_block2 != entity_blocks2.end()) { |
| 209 |
auto block1_field_names = entity_block1->field_describe(); |
| 210 |
auto block2_field_names = (*entity_block2)->field_describe(); |
| 211 |
// Sorts vectors before comparing them |
| 212 |
std::sort(block1_field_names.begin(), block1_field_names.end()); |
| 213 |
std::sort(block2_field_names.begin(), block2_field_names.end()); |
| 214 |
COMPARE_VECTORS_AND_THROW(entity_block1->name(), block1_field_names, block2_field_names); |
| 215 |
|
| 216 |
for (auto name1 : block1_field_names) { |
| 217 |
if (std::find(ignored_fields.begin(), ignored_fields.end(), name1) != |
| 218 |
std::end(ignored_fields)) { |
| 219 |
continue; |
| 220 |
} |
| 221 |
// Check that the content is the same. |
| 222 |
auto field1 = entity_block1->get_fieldref(name1); |
| 223 |
auto field2 = (*entity_block2)->get_fieldref(name1); |
| 224 |
CompareFields(field1, field2); |
| 225 |
// Negated logical XOR |
| 226 |
if ((state == Ioss::STATE_TRANSIENT) == |
| 227 |
(field1.get_role() == Ioss::Field::RoleType::TRANSIENT)) { |
| 228 |
CompareFieldData(entity_block1, (*entity_block2), name1); |
| 229 |
} |
| 230 |
} |
| 231 |
|
| 232 |
CompareAllProperties(entity_block1, (*entity_block2)); |
| 233 |
} |
| 234 |
} |
| 235 |
} |
| 236 |
|
| 237 |
void CompareRegions(Ioss::Region *region1, Ioss::Region *region2) |
| 238 |
{ |
| 239 |
|
| 240 |
CompareAllProperties(region1, region2); |
| 241 |
Ioss::State state = region1->get_state(); |
| 242 |
// Compare all containers |
| 243 |
CompareContainers(region1->get_node_blocks(), region2->get_node_blocks(), state); |
| 244 |
CompareContainers(region1->get_edge_blocks(), region2->get_edge_blocks(), state); |
| 245 |
CompareContainers(region1->get_face_blocks(), region2->get_face_blocks(), state); |
| 246 |
CompareContainers(region1->get_element_blocks(), region2->get_element_blocks(), state); |
| 247 |
CompareContainers(region1->get_nodesets(), region2->get_nodesets(), state); |
| 248 |
CompareContainers(region1->get_edgesets(), region2->get_edgesets(), state); |
| 249 |
CompareContainers(region1->get_facesets(), region2->get_facesets(), state); |
| 250 |
CompareContainers(region1->get_elementsets(), region2->get_elementsets(), state); |
| 251 |
CompareContainers(region1->get_commsets(), region2->get_commsets(), state); |
| 252 |
CompareContainers(region1->get_sidesets(), region2->get_sidesets(), state); |
| 253 |
// CompareContainers(region1->get_sideblocks(), region2->get_sideblocks()); |
| 254 |
|
| 255 |
// Is there any global field or map? |
| 256 |
} |
| 257 |
|
| 258 |
void CompareDB(Ioss::DatabaseIO *db1, Ioss::DatabaseIO *db2) |
| 259 |
{ |
| 260 |
std::shared_ptr<Ioss::Region> region1(new Ioss::Region(db1)); |
| 261 |
std::shared_ptr<Ioss::Region> region2(new Ioss::Region(db2)); |
| 262 |
CompareRegions(region1.get(), region2.get()); |
| 263 |
// Region properties have been compared previously. |
| 264 |
int timestep_count = region1->get_property("state_count").get_int(); |
| 265 |
for (int step = 1; step <= timestep_count; step++) { |
| 266 |
region1->begin_state(step); |
| 267 |
region2->begin_state(step); |
| 268 |
|
| 269 |
CompareRegions(region1.get(), region2.get()); |
| 270 |
region1->end_state(step); |
| 271 |
region2->end_state(step); |
| 272 |
} |
| 273 |
} |
| 274 |
|
| 275 |
template <typename Entity, typename T> |
| 276 |
void put_field_data(std::string field_name, int local_size, size_t component_count, Entity *e) |
| 277 |
{ |
| 278 |
std::vector<T> data; |
| 279 |
size_t data_size = local_size * component_count; |
| 280 |
data.reserve(data_size); |
| 281 |
for (size_t i = 0; i < data_size; ++i) { |
| 282 |
if (field_name == "owning_processor") { |
| 283 |
int rank = e->get_database()->parallel_rank(); |
| 284 |
data.push_back(rank); |
| 285 |
} |
| 286 |
else { |
| 287 |
data.push_back(i + 1); // Ids must be >0 |
| 288 |
} |
| 289 |
} |
| 290 |
|
| 291 |
int num_ids_written = e->put_field_data(field_name, data); |
| 292 |
if (std::find(ignore_errors.begin(), ignore_errors.end(), field_name) != |
| 293 |
std::end(ignore_errors)) { |
| 294 |
return; |
| 295 |
} |
| 296 |
if (local_size != num_ids_written) { |
| 297 |
std::ostringstream msg; |
| 298 |
msg << " FAILED in put_field_data:"; |
| 299 |
msg << " field_name = " << field_name; |
| 300 |
msg << " , num_nodes = " << local_size; |
| 301 |
msg << " , num_ids_written = " << num_ids_written; |
| 302 |
throw std::runtime_error(msg.str()); |
| 303 |
} |
| 304 |
} |
| 305 |
|
| 306 |
template <typename Entity> void write_fields(Entity *e, Ioss::Field::RoleType role) |
| 307 |
{ |
| 308 |
auto field_names = e->field_describe(); |
| 309 |
for (auto field_name : field_names) { |
| 310 |
Ioss::Field field = e->get_field(field_name); |
| 311 |
if (field.get_role() != role) { |
| 312 |
continue; |
| 313 |
} |
| 314 |
std::string entity_type = e->type_string(); |
| 315 |
|
| 316 |
if (Ioad::find_field_in_mapset(entity_type, field_name, Ioad::Ignore_fields)) { |
| 317 |
continue; |
| 318 |
} |
| 319 |
size_t component_count; |
| 320 |
size_t local_size; |
| 321 |
|
| 322 |
if (Ioad::use_transformed_storage(field, entity_type, field_name)) { |
| 323 |
component_count = field.transformed_storage()->component_count(); |
| 324 |
local_size = field.transformed_count(); |
| 325 |
} |
| 326 |
else { |
| 327 |
component_count = field.raw_storage()->component_count(); |
| 328 |
local_size = field.raw_count(); |
| 329 |
} |
| 330 |
switch (field.get_type()) { |
| 331 |
case Ioss::Field::BasicType::DOUBLE: |
| 332 |
put_field_data<Ioss::NodeBlock, double>(field_name, local_size, component_count, e); |
| 333 |
break; |
| 334 |
case Ioss::Field::BasicType::INT32: |
| 335 |
put_field_data<Ioss::NodeBlock, int32_t>(field_name, local_size, component_count, e); |
| 336 |
break; |
| 337 |
case Ioss::Field::BasicType::INT64: |
| 338 |
put_field_data<Ioss::NodeBlock, int64_t>(field_name, local_size, component_count, e); |
| 339 |
break; |
| 340 |
case Ioss::Field::BasicType::COMPLEX: |
| 341 |
put_field_data<Ioss::NodeBlock, Complex>(field_name, local_size, component_count, e); |
| 342 |
break; |
| 343 |
case Ioss::Field::BasicType::CHARACTER: |
| 344 |
put_field_data<Ioss::NodeBlock, char>(field_name, local_size, component_count, e); |
| 345 |
break; |
| 346 |
default: |
| 347 |
std::ostringstream errmsg; |
| 348 |
errmsg << "INTERNAL ERROR: Invalid field type. " |
| 349 |
<< "Something is wrong in the Ioad::DatabaseIO::get_field_internal_t() function. " |
| 350 |
<< "Please report.\n"; |
| 351 |
IOSS_ERROR(errmsg); |
| 352 |
} |
| 353 |
} |
| 354 |
} |
| 355 |
|
| 356 |
void create_phantom(Ioss::DatabaseIO *db) |
| 357 |
{ |
| 358 |
// Create region. |
| 359 |
Ioss::Region *region = new Ioss::Region(db); |
| 360 |
region->begin_mode(Ioss::STATE_DEFINE_MODEL); |
| 361 |
db->set_region(region); |
| 362 |
// Create a NodeBlock with some fields |
| 363 |
int64_t node_count = 10; |
| 364 |
Ioss::NodeBlock *node_block = new Ioss::NodeBlock(db, "nodeblock_1", node_count, 3); |
| 365 |
region->add(node_block); |
| 366 |
// Define some transient fields |
| 367 |
std::vector<std::string> field_names{"field1", "field2"}; |
| 368 |
for (auto field_name : field_names) { |
| 369 |
// Exodus seems to always save TRANSIENT fields as `REAL`, so for the tests to pass |
| 370 |
// we only use this type. |
| 371 |
Ioss::Field field(field_name, Ioss::Field::BasicType::REAL, "scalar", |
| 372 |
Ioss::Field::RoleType::TRANSIENT); |
| 373 |
node_block->field_add(field); |
| 374 |
} |
| 375 |
// Add coordinate frames |
| 376 |
std::vector<double> coords(9, 0); |
| 377 |
Ioss::CoordinateFrame cf1(0, 'a', Data(coords)); |
| 378 |
region->add(cf1); |
| 379 |
Ioss::CoordinateFrame cf2(1, 'b', Data(coords)); |
| 380 |
region->add(cf2); |
| 381 |
// Fill up the fields with some values. |
| 382 |
region->end_mode(Ioss::STATE_DEFINE_MODEL); |
| 383 |
region->begin_mode(Ioss::STATE_MODEL); |
| 384 |
write_fields(node_block, Ioss::Field::RoleType::MESH); |
| 385 |
region->end_mode(Ioss::STATE_MODEL); |
| 386 |
region->begin_mode(Ioss::STATE_DEFINE_TRANSIENT); |
| 387 |
region->end_mode(Ioss::STATE_DEFINE_TRANSIENT); |
| 388 |
region->begin_mode(Ioss::STATE_TRANSIENT); |
| 389 |
region->add_state(0.1); |
| 390 |
region->begin_state(1); |
| 391 |
write_fields(node_block, Ioss::Field::RoleType::TRANSIENT); |
| 392 |
region->end_state(1); |
| 393 |
region->end_mode(Ioss::STATE_TRANSIENT); |
| 394 |
} |
| 395 |
|
| 396 |
void create_database(std::string type, std::string file_name) |
| 397 |
{ |
| 398 |
std::shared_ptr<Ioss::DatabaseIO> db(Ioss::IOFactory::create(type, file_name, Ioss::WRITE_RESULTS, |
| 399 |
Ioss::ParallelUtils::comm_world())); |
| 400 |
create_phantom(db.get()); |
| 401 |
db->closeDatabase(); |
| 402 |
} |
| 403 |
|
| 404 |
TEST_CASE("Ioad") |
| 405 |
{ |
| 406 |
|
| 407 |
Ioss::Init::Initializer init_db; |
| 408 |
std::string exodus_db_name = "phantom.e"; |
| 409 |
std::string adios_db_name = "phantom.bp"; |
| 410 |
create_database("exodus", exodus_db_name); |
| 411 |
create_database("adios", adios_db_name); |
| 412 |
// Database pointers are deleted by their respective region destructors. |
| 413 |
Ioss::DatabaseIO *read_exodus_db = Ioss::IOFactory::create( |
| 414 |
"exodus", exodus_db_name, Ioss::READ_MODEL, Ioss::ParallelUtils::comm_world()); |
| 415 |
read_exodus_db->set_int_byte_size_api(Ioss::USE_INT64_API); |
| 416 |
Ioss::DatabaseIO *read_adios_db = Ioss::IOFactory::create( |
| 417 |
"adios", adios_db_name, Ioss::READ_MODEL, Ioss::ParallelUtils::comm_world()); |
| 418 |
CompareDB(read_exodus_db, read_adios_db); |
| 419 |
} |
| 420 |
|
| 421 |
template <typename T> const std::string get_entity_type_test() |
| 422 |
{ |
| 423 |
// Use "node" as default entity type to enable factory to create object. |
| 424 |
std::unique_ptr<T> entity(Ioad::NewEntity<T>(nullptr, "", "node", 0)); |
| 425 |
return entity->type_string(); |
| 426 |
} |
| 427 |
|
| 428 |
// NodeBlock has a different constructor... |
| 429 |
template <> const std::string get_entity_type_test<Ioss::NodeBlock>() |
| 430 |
{ |
| 431 |
Ioss::NodeBlock nodeblock(nullptr, "", 0, 1); |
| 432 |
return nodeblock.type_string(); |
| 433 |
} |
| 434 |
|
| 435 |
// SideSet has a different constructor... |
| 436 |
template <> const std::string get_entity_type_test<Ioss::SideSet>() |
| 437 |
{ |
| 438 |
Ioss::SideSet sideset(nullptr, ""); |
| 439 |
return sideset.type_string(); |
| 440 |
} |
| 441 |
|
| 442 |
template <> const std::string get_entity_type_test<Ioss::SideBlock>() |
| 443 |
{ |
| 444 |
// default element arbitrarily set to "hex8": We need an element type |
| 445 |
// to be able to construct this sideblock. |
| 446 |
Ioss::SideBlock sideblock(nullptr, "", "node", "hex8", 0); |
| 447 |
return sideblock.type_string(); |
| 448 |
} |
| 449 |
|
| 450 |
TEST_CASE("Ioad_BlockNames") |
| 451 |
{ |
| 452 |
CHECK(get_entity_type_test<Ioss::SideBlock>() == Ioad::get_entity_type<Ioss::SideBlock>()); |
| 453 |
CHECK(get_entity_type_test<Ioss::SideSet>() == Ioad::get_entity_type<Ioss::SideSet>()); |
| 454 |
CHECK(get_entity_type_test<Ioss::NodeBlock>() == Ioad::get_entity_type<Ioss::NodeBlock>()); |
| 455 |
CHECK(get_entity_type_test<Ioss::EdgeBlock>() == Ioad::get_entity_type<Ioss::EdgeBlock>()); |
| 456 |
CHECK(get_entity_type_test<Ioss::FaceBlock>() == Ioad::get_entity_type<Ioss::FaceBlock>()); |
| 457 |
CHECK(get_entity_type_test<Ioss::ElementBlock>() == Ioad::get_entity_type<Ioss::ElementBlock>()); |
| 458 |
CHECK(get_entity_type_test<Ioss::NodeSet>() == Ioad::get_entity_type<Ioss::NodeSet>()); |
| 459 |
CHECK(get_entity_type_test<Ioss::EdgeSet>() == Ioad::get_entity_type<Ioss::EdgeSet>()); |
| 460 |
CHECK(get_entity_type_test<Ioss::FaceSet>() == Ioad::get_entity_type<Ioss::FaceSet>()); |
| 461 |
CHECK(get_entity_type_test<Ioss::ElementSet>() == Ioad::get_entity_type<Ioss::ElementSet>()); |
| 462 |
CHECK(get_entity_type_test<Ioss::CommSet>() == Ioad::get_entity_type<Ioss::CommSet>()); |
| 463 |
} |