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