-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b31280
commit e4c56f1
Showing
2 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright(C) 1999-2023 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, interFace | ||
#include "assembly.h" | ||
#include "exodusII.h" // for ex_block, etc | ||
#include "fmt/ostream.h" | ||
#include "smart_assert.h" // for SMART_ASSERT | ||
#include <cstdlib> // for exit, nullptr | ||
#include <string> // for string, char_traits | ||
|
||
template <typename INT> Assembly<INT>::Assembly() : Exo_Entity() {} | ||
|
||
template <typename INT> | ||
Assembly<INT>::Assembly(int file_id, size_t assembly_id) : Exo_Entity(file_id, assembly_id) | ||
{ | ||
SMART_ASSERT(file_id >= 0); | ||
SMART_ASSERT((int)assembly_id > EX_INVALID_ID); | ||
|
||
initialize(file_id, assembly_id); | ||
} | ||
|
||
template <typename INT> EXOTYPE Assembly<INT>::exodus_type() const { return EX_ASSEMBLY; } | ||
|
||
template <typename INT> void Assembly<INT>::entity_load_params() | ||
{ | ||
ex_assembly assembly{}; | ||
assembly.id = id_; | ||
int err = ex_get_assembly(fileId, &assembly); | ||
|
||
if (err < 0) { | ||
Error("Assembly<INT>::entity_load_params(): Failed to get assembly" | ||
" parameters! Aborting...\n"); | ||
} | ||
|
||
entity_count = assembly.entity_count; | ||
assembly_type = assembly.type; | ||
entities.resize(entity_count); | ||
|
||
// Now fill in the entities list. | ||
assembly.entity_list = entities.data(); | ||
err = ex_get_assembly(fileId, &assembly); | ||
|
||
if (err < 0) { | ||
Error("Assembly<INT>::entity_load_params(): Failed to get assembly" | ||
" parameters! Aborting...\n"); | ||
} | ||
} | ||
|
||
template <typename INT> int Assembly<INT>::Check_State() const | ||
{ | ||
SMART_ASSERT(id_ >= EX_INVALID_ID); | ||
return 1; | ||
} | ||
template class Assembly<int>; | ||
template class Assembly<int64_t>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright(C) 1999-2023 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 | ||
#pragma once | ||
|
||
#include "exo_entity.h" | ||
#include <iostream> | ||
|
||
#include <string> | ||
|
||
template <typename INT> class ExoII_Read; | ||
|
||
template <typename INT> class Assembly : public Exo_Entity | ||
{ | ||
public: | ||
Assembly(); | ||
Assembly(int file_id, size_t assembly_id); | ||
~Assembly() override = default; | ||
Assembly(const Assembly &) = delete; | ||
const Assembly &operator=(const Assembly &) = delete; | ||
|
||
ex_entity_type Type() const { return assembly_type; } | ||
const std::vector<ex_entity_id> &Entities() const { return entities; } | ||
|
||
private: | ||
int Check_State() const override; | ||
void entity_load_params() override; | ||
|
||
EXOTYPE exodus_type() const override; | ||
const char *label() const override { return "Assembly"; } | ||
const char *short_label() const override { return "assembly"; } | ||
|
||
int entity_count{0}; | ||
ex_entity_type assembly_type{EX_INVALID}; | ||
std::vector<ex_entity_id> entities{}; | ||
|
||
friend class ExoII_Read<INT>; | ||
}; |