icedb  version 0.5.1
Snow particle scattering database API
Public Member Functions | Public Attributes | List of all members
icedb::Shapes::NewShapeCommonOptionalProperties Struct Reference

Structure containing a list of all of the common optional data for creating a new shape in the database. More...

#include <shape.hpp>

Collaboration diagram for icedb::Shapes::NewShapeCommonOptionalProperties:
Collaboration graph
[legend]

Public Member Functions

bool isValid (gsl::not_null< const NewShapeRequiredProperties *> required, std::ostream *errout=nullptr) const
 

Public Attributes

gsl::span< const uint64_t > particle_scattering_element_number
 DIMENSION: The id number for each scattering element. Single dimension. More...
 
gsl::span< const uint8_t > particle_constituent_number
 DIMENSION: The id number of each particle's constituent. Single dimension. More...
 
gsl::span< const float > particle_scattering_element_radius
 
gsl::span< const std::string > particle_constituent_name
 
std::string particle_constituent_single_name
 
gsl::span< const float > particle_scattering_element_composition_fractional
 
gsl::span< const uint8_t > particle_scattering_element_composition_whole
 
float particle_scattering_element_spacing = -1
 OPTIONAL ATTRIBUTE: Physical spacing between adjacent grid points (in meters). Used in DDA. More...
 
float hint_max_scattering_element_dimension = -1
 EXPERIMENTAL HINT: Specify the maximum scattering element dimension. More...
 

Detailed Description

Structure containing a list of all of the common optional data for creating a new shape in the database.

Definition at line 60 of file shape.hpp.

Member Function Documentation

◆ isValid()

bool icedb::Shapes::NewShapeCommonOptionalProperties::isValid ( gsl::not_null< const NewShapeRequiredProperties *>  required,
std::ostream *  errout = nullptr 
) const

Validate that all required properties are set, and that they have the correct dimensions. Writes diagnostic messages to the output stream.

Definition at line 56 of file Shapes.cpp.

Referenced by icedb::Shapes::Shape::createShape(), and main().

58  {
59  bool good = true;
60 
61  if (!this->particle_scattering_element_number.empty()) {
62  if (required->number_of_particle_scattering_elements != this->particle_scattering_element_number.size()) {
63  good = false;
64  if (out) (*out) << "number_of_particle_scattering_elements is not equal to particle_scattering_element_number." << std::endl;
65  }
66  }
67  if (required->number_of_particle_constituents > 1) {
68  if (this->particle_constituent_number.empty() || this->particle_constituent_number.size() != required->number_of_particle_constituents) {
69  good = false;
70  if (out) (*out) << "particle_constituent_number is not set. "
71  "This is an essential dimension scale that the rest of the particle "
72  "data depends on." << std::endl;
73  }
74 
77  {
78  good = false;
79  if (out) (*out) << "particle_scattering_element_composition_whole and "
80  "particle_scattering_element_composition_fractional are not set, but one is required. "
81  << std::endl;
82  }
83 
86  {
87  good = false;
88  if (out) (*out) << "particle_scattering_element_composition_whole and "
89  "particle_scattering_element_composition_fractional are both set, but only one is allowed. "
90  << std::endl;
91  }
92 
95  != required->number_of_particle_scattering_elements)
96  {
97  good = false;
98  if (out) (*out) << "particle_scattering_element_composition_whole "
99  "has the wrong size. It should have a size of number_of_particle_scattering_elements."
100  << std::endl;
101  }
102  }
105  (required->number_of_particle_scattering_elements * required->number_of_particle_constituents)) {
106  good = false;
107  if (out) (*out) << "particle_scattering_element_composition_fractional has "
108  "the wrong dimensions. It should have dimensions of "
109  "[number_of_particle_scattering_elements][number_of_particle_constituents], yielding a total of "
110  << required->number_of_particle_scattering_elements * required->number_of_particle_constituents << " elements. "
111  "Instead, it currently has " << this->particle_scattering_element_composition_fractional.size()
112  << " elements." << std::endl;
113  }
114  }
115  }
116 
117 
118  if (this->particle_scattering_element_radius.size()) {
119  if (this->particle_scattering_element_radius.size() != required->number_of_particle_scattering_elements) {
120  good = false;
121  if (out) (*out) << "particle_scattering_element_radius has the wrong size. "
122  "It should have dimensions of [number_of_particle_scattering_elements]. "
123  "particle_scattering_element_radius has a current size of " << particle_scattering_element_radius.size()
124  << ", and this should be " << required->number_of_particle_scattering_elements
125  << "." << std::endl;
126  }
127  }
128 
129  if (particle_constituent_single_name.size() && required->number_of_particle_constituents != 1) {
130  good = false;
131  if (out) (*out) << "particle_constituent_single_name is a valid attribute only when a single non-ice constituent exists."
132  << std::endl;
133  }
134  if (particle_constituent_single_name.size() && this->particle_constituent_name.size()) {
135  good = false;
136  if (out) (*out) << "particle_constituent_single_name and particle_constituent_name are mutually exclusive."
137  << std::endl;
138  }
139  if (this->particle_constituent_name.size()) {
140  if (this->particle_constituent_name.size() != required->number_of_particle_constituents) {
141  good = false;
142  if (out) (*out) << "particle_constituent_name has the wrong size. "
143  "It should have dimensions of [number_of_particle_constituents]. "
144  << std::endl;
145  }
146  }
147  if (required->number_of_particle_constituents > 1 && this->particle_constituent_name.empty()) {
148  good = false;
149  if (out) (*out) << "number_of_particle_constituents > 1, so particle_constituent_name "
150  "is required." << std::endl;
151  }
152 
153  return good;
154  }
gsl::span< const uint8_t > particle_scattering_element_composition_whole
Definition: shape.hpp:93
gsl::span< const float > particle_scattering_element_radius
Definition: shape.hpp:69
gsl::span< const uint64_t > particle_scattering_element_number
DIMENSION: The id number for each scattering element. Single dimension.
Definition: shape.hpp:62
gsl::span< const float > particle_scattering_element_composition_fractional
Definition: shape.hpp:88
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
Here is the caller graph for this function:

Member Data Documentation

◆ hint_max_scattering_element_dimension

float icedb::Shapes::NewShapeCommonOptionalProperties::hint_max_scattering_element_dimension = -1

EXPERIMENTAL HINT: Specify the maximum scattering element dimension.

Definition at line 100 of file shape.hpp.

Referenced by icedb::Examples::Shapes::ShapeCommonOptionalData::apply(), and icedb::Shapes::Shape::createShape().

◆ particle_constituent_name

gsl::span<const std::string> icedb::Shapes::NewShapeCommonOptionalProperties::particle_constituent_name

VARIABLE: The name of each particle's constituent. Single dimension. Becomes REQUIRED if there is more than one constituent. If there is only one constituent, then this constituent can be written as an attribute, or it can be just assumed to be 'ice'. Dimensions of [particle_constituent_number]

Note
Currently ignored because I have to redo the HDF5 string writing functions.

Definition at line 77 of file shape.hpp.

Referenced by icedb::Examples::Shapes::ShapeCommonOptionalData::apply().

◆ particle_constituent_number

gsl::span<const uint8_t> icedb::Shapes::NewShapeCommonOptionalProperties::particle_constituent_number

DIMENSION: The id number of each particle's constituent. Single dimension.

Definition at line 64 of file shape.hpp.

Referenced by icedb::Examples::Shapes::ShapeCommonOptionalData::apply(), and icedb::Shapes::Shape::createShape().

◆ particle_constituent_single_name

std::string icedb::Shapes::NewShapeCommonOptionalProperties::particle_constituent_single_name

OPTIONAL ATTRIBUTE: The name of the single constituent of the particle Used only if there is a single constituent, and if this constituent is NOT ice.

Definition at line 81 of file shape.hpp.

Referenced by icedb::Examples::Shapes::ShapeCommonOptionalData::apply(), and icedb::Shapes::Shape::createShape().

◆ particle_scattering_element_composition_fractional

gsl::span<const float> icedb::Shapes::NewShapeCommonOptionalProperties::particle_scattering_element_composition_fractional

OPTIONAL VARIABLE: Mass fractions of each constituent for each scattering element. Either this or particle_scattering_element_composition_whole is is required only if there is more than one constituent CANNOT COEXIST with particle_scattering_element_composition_whole. Dimensions of [particle_scattering_element_number][particle_constituent_number]

Definition at line 88 of file shape.hpp.

Referenced by icedb::Examples::Shapes::ShapeCommonOptionalData::apply(), and icedb::Shapes::Shape::createShape().

◆ particle_scattering_element_composition_whole

gsl::span<const uint8_t> icedb::Shapes::NewShapeCommonOptionalProperties::particle_scattering_element_composition_whole

OPTIONAL VARIABLE: The constituent of each scattering element This table is used when scattering elements can only be a single substance (not fractional). This CANNOT COEXIST with particle_scattering_element_composition_fractional. It exists to save space when non-compressed data is stored.

Definition at line 93 of file shape.hpp.

Referenced by icedb::Examples::Shapes::ShapeCommonOptionalData::apply(), and icedb::Shapes::Shape::createShape().

◆ particle_scattering_element_number

gsl::span<const uint64_t> icedb::Shapes::NewShapeCommonOptionalProperties::particle_scattering_element_number

DIMENSION: The id number for each scattering element. Single dimension.

Definition at line 62 of file shape.hpp.

Referenced by icedb::Examples::Shapes::ShapeCommonOptionalData::apply(), and icedb::Shapes::Shape::createShape().

◆ particle_scattering_element_radius

gsl::span<const float> icedb::Shapes::NewShapeCommonOptionalProperties::particle_scattering_element_radius

OPTIONAL VARIABLE: Physical radius of the scattering sphere, in meters. Dimensions: [particle_scattering_element_number]

Definition at line 69 of file shape.hpp.

Referenced by icedb::Examples::Shapes::ShapeCommonOptionalData::apply(), and icedb::Shapes::Shape::createShape().

◆ particle_scattering_element_spacing

float icedb::Shapes::NewShapeCommonOptionalProperties::particle_scattering_element_spacing = -1

OPTIONAL ATTRIBUTE: Physical spacing between adjacent grid points (in meters). Used in DDA.

Definition at line 96 of file shape.hpp.

Referenced by icedb::Examples::Shapes::ShapeCommonOptionalData::apply(), icedb::Shapes::Shape::createShape(), and main().


The documentation for this struct was generated from the following files: