| 1 |
// Copyright(C) 1999-2023 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 |
|
| 7 |
#include "ED_SystemInterface.h" // for SystemInterface, interFace |
| 8 |
#include "assembly.h" |
| 9 |
#include "exodusII.h" // for ex_block, etc |
| 10 |
#include "fmt/ostream.h" |
| 11 |
#include "smart_assert.h" // for SMART_ASSERT |
| 12 |
#include <cstdlib> // for exit, nullptr |
| 13 |
#include <string> // for string, char_traits |
| 14 |
|
| 15 |
template <typename INT> Assembly<INT>::Assembly() : Exo_Entity() {} |
| 16 |
|
| 17 |
template <typename INT> |
| 18 |
Assembly<INT>::Assembly(int file_id, size_t assembly_id) : Exo_Entity(file_id, assembly_id) |
| 19 |
{ |
| 20 |
SMART_ASSERT(file_id >= 0); |
| 21 |
SMART_ASSERT((int)assembly_id > EX_INVALID_ID); |
| 22 |
|
| 23 |
initialize(file_id, assembly_id); |
| 24 |
} |
| 25 |
|
| 26 |
template <typename INT> EXOTYPE Assembly<INT>::exodus_type() const { return EX_ASSEMBLY; } |
| 27 |
|
| 28 |
template <typename INT> void Assembly<INT>::entity_load_params() |
| 29 |
{ |
| 30 |
ex_assembly assembly{}; |
| 31 |
assembly.id = id_; |
| 32 |
int err = ex_get_assembly(fileId, &assembly); |
| 33 |
|
| 34 |
if (err < 0) { |
| 35 |
Error("Assembly<INT>::entity_load_params(): Failed to get assembly" |
| 36 |
" parameters! Aborting...\n"); |
| 37 |
} |
| 38 |
|
| 39 |
entity_count = assembly.entity_count; |
| 40 |
assembly_type = assembly.type; |
| 41 |
entities.resize(entity_count); |
| 42 |
|
| 43 |
// Now fill in the entities list. |
| 44 |
assembly.entity_list = Data(entities); |
| 45 |
err = ex_get_assembly(fileId, &assembly); |
| 46 |
|
| 47 |
if (err < 0) { |
| 48 |
Error("Assembly<INT>::entity_load_params(): Failed to get assembly" |
| 49 |
" parameters! Aborting...\n"); |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
template <typename INT> int Assembly<INT>::Check_State() const |
| 54 |
{ |
| 55 |
SMART_ASSERT(id_ >= EX_INVALID_ID); |
| 56 |
return 1; |
| 57 |
} |
| 58 |
template class Assembly<int>; |
| 59 |
template class Assembly<int64_t>; |