icedb  version 0.5.1
Snow particle scattering database API
shape.hpp
Go to the documentation of this file.
1 #pragma once
2 #include "fs.hpp"
3 #include "Table.hpp"
4 #include "Attribute.hpp"
5 #include "Group.hpp"
6 
7 namespace icedb {
9  namespace Shapes {
10 
15  bool NC4_compat = true;
16 
17  // The DIMENSIONS
18 
23 
28 
29  // Each particle has three axes (X, Y and Z). As these are trivial, only the
30  // scale lables are written; the scale does not have an explicit dataset filled with values.
31 
32  // The VARIABLES
33 
38 
43 
44 
45  // The ATTRIBUTES
46 
48  std::string particle_id;
49 
50 
53  bool isValid(std::ostream *errout = nullptr) const;
54 
58  };
62  gsl::span<const uint64_t> particle_scattering_element_number;
64  gsl::span<const uint8_t> particle_constituent_number;
65 
66 
69  gsl::span<const float> particle_scattering_element_radius;
70 
77  gsl::span<const std::string> particle_constituent_name;
78 
82 
94 
96  float particle_scattering_element_spacing = -1;
97 
98 
100  float hint_max_scattering_element_dimension = -1;
101 
104  bool isValid(gsl::not_null<const NewShapeRequiredProperties*> required, std::ostream *errout = nullptr) const;
105  };
106 
112  class Shape : virtual public Groups::Group
113  {
114  protected:
115  Shape(const std::string &uid);
116  public:
118  static const std::string _icedb_obj_type_shape_identifier;
119  virtual ~Shape();
125  static bool isShape(Groups::Group &owner, const std::string &name);
130  static bool isShape(gsl::not_null<H5::Group*> group);
132  bool isShape() const;
138  static bool isValid(gsl::not_null<H5::Group*> group, std::ostream *out = nullptr);
142  bool isValid(std::ostream *out = nullptr) const;
143 
145  typedef std::unique_ptr<Shape> Shape_Type;
146 
150  static Shape_Type openShape(Groups::Group &grpshp);
152  static Shape_Type openShape(Groups::Group &owner, const std::string &name);
154  static Shape_Type openShape(Groups::Group::Group_HDF_shared_ptr shape);
155 
164  static Shape_Type createShape(Groups::Group &grpshp, const std::string &uid,
165  gsl::not_null<const NewShapeRequiredProperties*> required,
166  const NewShapeCommonOptionalProperties* optional = nullptr);
176  static Shape_Type createShape(Groups::Group &owner, const std::string &name,
177  const std::string &uid,
178  gsl::not_null<const NewShapeRequiredProperties*> required,
179  const NewShapeCommonOptionalProperties* optional = nullptr);
188  static Shape_Type createShape(Groups::Group::Group_HDF_shared_ptr newShapeLocation,
189  const std::string &uid,
190  gsl::not_null<const NewShapeRequiredProperties*> required,
191  const NewShapeCommonOptionalProperties* optional = nullptr);
192 
194  const std::string particle_unique_id;
195 
196  /*
197  Tables::Table::Table_Type getTable_ParticleScatteringElementNumber() const;
198  Tables::Table::Table_Type getTable_ParticleScatteringElementCoordinates() const;
199  Tables::Table::Table_Type getTable_ParticleConstituentName() const;
200  Tables::Table::Table_Type getTable_ParticleScatteringElementComposition() const;
201 
202  Tables::Table::Table_Type getTable_ParticleScatteringElementRadius() const;
203 
204  Attributes::Attribute<float> getParticleScatteringElementSpacing_m() const;
205 
206  size_t getNumScatteringElements() const;
207  */
208  };
209  }
210 }
gsl::span< const uint8_t > particle_scattering_element_composition_whole
Definition: shape.hpp:93
std::shared_ptr< H5::Group > Group_HDF_shared_ptr
Definition: Group.hpp:32
Strucure containing a list of all of the required data needed to create a new shape in the database...
Definition: shape.hpp:12
A group is similar to a folder / directory. It can have Attributes and Tables.
Definition: Group.hpp:22
static const std::string _icedb_obj_type_shape_identifier
Each shape &#39;group&#39; has an attribute with this identifier. Used for shape collection and searching...
Definition: shape.hpp:118
std::string particle_id
ATTRIBUTE: Unique Particle Identifier.
Definition: shape.hpp:48
A high-level class to manipulate particle shapes.
Definition: shape.hpp:112
gsl::span< const float > particle_scattering_element_radius
Definition: shape.hpp:69
Structure containing a list of all of the common optional data for creating a new shape in the databa...
Definition: shape.hpp:60
gsl::span< const float > particle_scattering_element_coordinates
Definition: shape.hpp:37
const std::string particle_unique_id
This is the unique identifier for this shape.
Definition: shape.hpp:194
gsl::span< const uint64_t > particle_scattering_element_number
DIMENSION: The id number for each scattering element. Single dimension.
Definition: shape.hpp:62
uint64_t particle_scattering_element_coordinates_are_integral
Definition: shape.hpp:42
gsl::span< const float > particle_scattering_element_composition_fractional
Definition: shape.hpp:88
std::unique_ptr< Shape > Shape_Type
The preferred C++ type for referencing a shape.
Definition: shape.hpp:145
gsl::span< const std::string > particle_constituent_name
Definition: shape.hpp:77
gsl::span< const uint8_t > particle_constituent_number
DIMENSION: The id number of each particle&#39;s constituent. Single dimension.
Definition: shape.hpp:64
bool isValid(std::ostream *errout=nullptr) const
Definition: Shapes.cpp:10