| 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 |
#pragma once |
| 7 |
|
| 8 |
#include "exo_entity.h" |
| 9 |
#include "util.h" |
| 10 |
|
| 11 |
#include <iostream> |
| 12 |
|
| 13 |
#include <string> |
| 14 |
|
| 15 |
template <typename INT> class Exo_Read; |
| 16 |
|
| 17 |
template <typename INT> class Exo_Block : public Exo_Entity |
| 18 |
{ |
| 19 |
public: |
| 20 |
Exo_Block(); |
| 21 |
Exo_Block(int file_id, size_t exo_block_id); |
| 22 |
Exo_Block(int file_id, size_t id, const char *type, size_t num_e, size_t num_npe); |
| 23 |
Exo_Block(const Exo_Block &) = delete; |
| 24 |
const Exo_Block &operator=(const Exo_Block &) = delete; |
| 25 |
|
| 26 |
std::string Load_Connectivity(); |
| 27 |
std::string Free_Connectivity(); |
| 28 |
|
| 29 |
// Access functions: |
| 30 |
const std::string &Element_Type() const { return elmt_type; } |
| 31 |
size_t Num_Nodes_per_Element() const { return num_nodes_per_elmt; } |
| 32 |
|
| 33 |
// Block description access functions: |
| 34 |
const std::vector<INT> &Connectivity() const { return conn; } // 1-offset connectivity |
| 35 |
const INT *Connectivity(size_t elmt_index) const; // 1-offset connectivity |
| 36 |
|
| 37 |
// Misc: |
| 38 |
int64_t offset() const { return offset_; } |
| 39 |
void offset(int64_t off) { offset_ = off; } |
| 40 |
|
| 41 |
private: |
| 42 |
int Check_State() const override; |
| 43 |
void entity_load_params() override; |
| 44 |
|
| 45 |
EXOTYPE exodus_type() const override; |
| 46 |
const char *label() const override { return "Element Block"; } |
| 47 |
const char *short_label() const override { return "block"; } |
| 48 |
|
| 49 |
std::string elmt_type{}; |
| 50 |
int num_nodes_per_elmt{-1}; |
| 51 |
int64_t offset_{0}; |
| 52 |
std::vector<INT> conn{}; // Array; holds a matrix, num_elmts by num_nodes_per_elmt. |
| 53 |
|
| 54 |
friend class Exo_Read<INT>; |
| 55 |
}; |