| 1 |
// Copyright(C) 1999-2020, 2022, 2023, 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 |
|
| 7 |
#pragma once |
| 8 |
|
| 9 |
#include "Ioss_GroupingEntity.h" |
| 10 |
#include <cstddef> // for size_t |
| 11 |
#include <cstdint> // for int64_t |
| 12 |
#include <string> // for string |
| 13 |
#include <vector> |
| 14 |
|
| 15 |
#include "Ioss_EntityType.h" // for EntityType, etc |
| 16 |
#include "Ioss_Property.h" // for Property |
| 17 |
#include "ioss_export.h" |
| 18 |
|
| 19 |
namespace Ioss { |
| 20 |
class DatabaseIO; |
| 21 |
class Field; |
| 22 |
} // namespace Ioss |
| 23 |
|
| 24 |
namespace Ioss { |
| 25 |
|
| 26 |
using EntityContainer = std::vector<const Ioss::GroupingEntity *>; |
| 27 |
|
| 28 |
/** \brief A homogeneous collection of other GroupingEntities. |
| 29 |
*/ |
| 30 |
class IOSS_EXPORT Assembly : public GroupingEntity |
| 31 |
{ |
| 32 |
public: |
| 33 |
Assembly() = default; // Used for template typing only |
| 34 |
Assembly(const Assembly &) = default; |
| 35 |
|
| 36 |
Assembly(DatabaseIO *io_database, const std::string &my_name); |
| 37 |
|
| 38 |
IOSS_NODISCARD std::string type_string() const override { return "Assembly"; } |
| 39 |
IOSS_NODISCARD std::string short_type_string() const override { return "assembly"; } |
| 40 |
IOSS_NODISCARD std::string contains_string() const override |
| 41 |
{ |
| 42 |
return m_members.empty() ? "<EMPTY>" : m_members[0]->type_string(); |
| 43 |
} |
| 44 |
IOSS_NODISCARD EntityType type() const override { return ASSEMBLY; } |
| 45 |
|
| 46 |
IOSS_NODISCARD EntityType get_member_type() const { return m_type; } |
| 47 |
|
| 48 |
bool add(const GroupingEntity *member); |
| 49 |
bool remove(const GroupingEntity *removal); |
| 50 |
IOSS_NODISCARD const EntityContainer &get_members() const; |
| 51 |
IOSS_NODISCARD const GroupingEntity *get_member(const std::string &my_name) const; |
| 52 |
void remove_members(); |
| 53 |
IOSS_NODISCARD size_t member_count() const { return m_members.size(); } |
| 54 |
|
| 55 |
// Handle implicit properties -- These are calculated from data stored |
| 56 |
// in the grouping entity instead of having an explicit value assigned. |
| 57 |
// An example would be 'element_block_count' for a region. |
| 58 |
IOSS_NODISCARD Property get_implicit_property(const std::string &my_name) const override; |
| 59 |
|
| 60 |
protected: |
| 61 |
int64_t internal_get_field_data(const Field &field, void *data, |
| 62 |
size_t data_size) const override; |
| 63 |
|
| 64 |
int64_t internal_put_field_data(const Field &field, void *data, |
| 65 |
size_t data_size) const override; |
| 66 |
|
| 67 |
int64_t internal_get_zc_field_data(const Field &field, void **data, |
| 68 |
size_t *data_size) const override; |
| 69 |
|
| 70 |
private: |
| 71 |
EntityContainer m_members; |
| 72 |
EntityType m_type{INVALID_TYPE}; |
| 73 |
}; |
| 74 |
} // namespace Ioss |