// Copyright(C) 1999-2022 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // // See packages/seacas/LICENSE for details #include "ED_SystemInterface.h" // for SystemInterface, etc #include "edge_block.h" #include "exodusII.h" // for ex_set, etc #include "iqsort.h" // for index_qsort #include "smart_assert.h" // for SMART_ASSERT #include // for exit #include // for vector template Edge_Block::Edge_Block() : Exo_Entity() {} template Edge_Block::Edge_Block(int file_id, size_t id) : Exo_Entity(file_id, id) { SMART_ASSERT((int)id != EX_INVALID_ID); } template Edge_Block::Edge_Block(int file_id, size_t id, size_t ne) : Exo_Entity(file_id, id, ne) { SMART_ASSERT(id > 0); } template Edge_Block::~Edge_Block() { SMART_ASSERT(Check_State()); } template EXOTYPE Edge_Block::exodus_type() const { return EX_EDGE_BLOCK; } template void Edge_Block::entity_load_params() { int num_attr; ex_block block{}; block.id = id_; block.type = EX_EDGE_BLOCK; int err = ex_get_block_param(fileId, &block); if (err < 0) { Error("Edge_Block::entity_load_params(): Failed to get edge" " block parameters! Aborting...\n"); } numEntity = block.num_entry; num_edges_per_elmt = block.num_edges_per_entry; num_attr = block.num_attribute; elmt_type = block.topology; if (num_edges_per_elmt < 0 || num_attr < 0) { Error(fmt::format( "Edge_Block::entity_load_params(): Data appears corrupt for edge block {}!\n" "\tnum elmts = {}\n" "\tnum edges per elmt = {}\n" "\tnum attributes = {}\n" " ... Aborting...\n", fmt::group_digits(numEntity), num_edges_per_elmt, num_attr)); } } template size_t Edge_Block::Edge_Index(size_t position) const { SMART_ASSERT(position < numEntity); return position; } template int Edge_Block::Check_State() const { SMART_ASSERT(id_ >= EX_INVALID_ID); SMART_ASSERT(!(id_ == EX_INVALID_ID && numEntity > 0)); return 1; } template class Edge_Block; template class Edge_Block;