| 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 |
|
| 7 |
#pragma once |
| 8 |
|
| 9 |
#include "Ioss_BoundingBox.h" |
| 10 |
#include "Ioss_EntityBlock.h" |
| 11 |
#include "Ioss_EntityType.h" // for EntityType, etc |
| 12 |
#include "Ioss_Property.h" // for Property |
| 13 |
#include <cstddef> // for size_t |
| 14 |
#include <cstdint> // for int64_t |
| 15 |
#include <string> // for string |
| 16 |
|
| 17 |
#include "Ioss_GroupingEntity.h" |
| 18 |
#include "Ioss_PropertyManager.h" |
| 19 |
#include "ioss_export.h" |
| 20 |
|
| 21 |
namespace Ioss { |
| 22 |
class DatabaseIO; |
| 23 |
} // namespace Ioss |
| 24 |
namespace Ioss { |
| 25 |
class Field; |
| 26 |
} // namespace Ioss |
| 27 |
|
| 28 |
namespace Ioss { |
| 29 |
|
| 30 |
/** \brief A collection of all nodes in the region. |
| 31 |
*/ |
| 32 |
class IOSS_EXPORT NodeBlock : public EntityBlock |
| 33 |
{ |
| 34 |
public: |
| 35 |
NodeBlock(DatabaseIO *io_database, const std::string &my_name, int64_t node_count, |
| 36 |
int64_t degrees_of_freedom); |
| 37 |
|
| 38 |
NodeBlock(const NodeBlock &other); |
| 39 |
|
| 40 |
IOSS_NODISCARD std::string type_string() const override { return "NodeBlock"; } |
| 41 |
IOSS_NODISCARD std::string short_type_string() const override { return "nodeblock"; } |
| 42 |
IOSS_NODISCARD std::string contains_string() const override { return "Node"; } |
| 43 |
IOSS_NODISCARD EntityType type() const override { return NODEBLOCK; } |
| 44 |
|
| 45 |
IOSS_NODISCARD bool is_nonglobal_nodeblock() const |
| 46 |
{ |
| 47 |
return properties.exists("IOSS_INTERNAL_CONTAINED_IN"); |
| 48 |
} |
| 49 |
|
| 50 |
IOSS_NODISCARD const GroupingEntity *contained_in() const override |
| 51 |
{ |
| 52 |
if (properties.exists("IOSS_INTERNAL_CONTAINED_IN")) { |
| 53 |
auto *ge = properties.get("IOSS_INTERNAL_CONTAINED_IN").get_pointer(); |
| 54 |
return static_cast<const GroupingEntity *>(ge); |
| 55 |
} |
| 56 |
return GroupingEntity::contained_in(); |
| 57 |
} |
| 58 |
|
| 59 |
// Handle implicit properties -- These are calculated from data stored |
| 60 |
// in the grouping entity instead of having an explicit value assigned. |
| 61 |
// An example would be 'element_block_count' for a region. |
| 62 |
IOSS_NODISCARD Property get_implicit_property(const std::string &my_name) const override; |
| 63 |
|
| 64 |
IOSS_NODISCARD AxisAlignedBoundingBox get_bounding_box() const; |
| 65 |
IOSS_NODISCARD bool operator!=(const Ioss::NodeBlock &rhs) const; |
| 66 |
IOSS_NODISCARD bool operator==(const Ioss::NodeBlock &rhs) const; |
| 67 |
IOSS_NODISCARD bool equal(const Ioss::NodeBlock &rhs) const; |
| 68 |
|
| 69 |
protected: |
| 70 |
int64_t internal_get_field_data(const Field &field, void *data, |
| 71 |
size_t data_size) const override; |
| 72 |
|
| 73 |
int64_t internal_put_field_data(const Field &field, void *data, |
| 74 |
size_t data_size) const override; |
| 75 |
|
| 76 |
int64_t internal_get_zc_field_data(const Field &field, void **data, |
| 77 |
size_t *data_size) const override; |
| 78 |
}; |
| 79 |
} // namespace Ioss |