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

Strucure containing a list of all of the required data needed to create a new shape in the database. More...

#include <shape.hpp>

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

Public Member Functions

bool isValid (std::ostream *errout=nullptr) const
 
bool requiresOptionalPropertiesStruct () const
 

Public Attributes

bool NC4_compat = true
 
uint64_t number_of_particle_scattering_elements = 0
 
uint8_t number_of_particle_constituents = 0
 
gsl::span< const float > particle_scattering_element_coordinates
 
uint64_t particle_scattering_element_coordinates_are_integral = 0
 
std::string particle_id
 ATTRIBUTE: Unique Particle Identifier. More...
 

Detailed Description

Strucure containing a list of all of the required data needed to create a new shape in the database.

Definition at line 12 of file shape.hpp.

Member Function Documentation

◆ isValid()

bool icedb::Shapes::NewShapeRequiredProperties::isValid ( 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 10 of file Shapes.cpp.

References number_of_particle_constituents, number_of_particle_scattering_elements, particle_id, and particle_scattering_element_coordinates.

Referenced by main().

10  {
11  bool good = true;
12 
14  good = false;
15  if (out) (*out) << "The number of scattering elements is not set." << std::endl;
16  }
18  good = false;
19  if (out) (*out) << "The number of particle constituents is not set." << std::endl;
20  }
21  if (!particle_id.size()) {
22  good = false;
23  if (out) (*out) << "Particle ID is not set." << std::endl;
24  }
25 
26  if (this->particle_scattering_element_coordinates.empty()) {
27  good = false;
28  if (out) (*out) << "particle_scattering_element_coordinates is not set. "
29  "Particles need to have scattering elements." << std::endl;
30  }
32  good = false;
33  if (out) (*out) << "particle_scattering_element_coordinates has "
34  "the wrong dimensions. It should have dimensions of "
35  "[number_of_particle_scattering_elements][3], yielding a total of "
36  << 3 * number_of_particle_scattering_elements << " elements. "
37  "Instead, it currently has " << particle_scattering_element_coordinates.size()
38  << " elements." << std::endl;
39  }
40  if (this->number_of_particle_constituents == 0) {
41  good = false;
42  if (out) (*out) << "number_of_particle_constituents is not set. "
43  "Particles need to have a composition." << std::endl;
44  }
45 
46 
47  return good;
48  }
std::string particle_id
ATTRIBUTE: Unique Particle Identifier.
Definition: shape.hpp:48
gsl::span< const float > particle_scattering_element_coordinates
Definition: shape.hpp:37
Here is the caller graph for this function:

◆ requiresOptionalPropertiesStruct()

bool icedb::Shapes::NewShapeRequiredProperties::requiresOptionalPropertiesStruct ( ) const

Based on the required properties, must the optional properties structure be required? i.e. Extra information is needed to properly construct the shape.

Definition at line 50 of file Shapes.cpp.

References number_of_particle_constituents.

50  {
51  bool req = false;
52  if (this->number_of_particle_constituents > 1) req = true;
53  return req;
54  }

Member Data Documentation

◆ NC4_compat

bool icedb::Shapes::NewShapeRequiredProperties::NC4_compat = true

Do we want NetCDF-4 compatability? Should always be yes.

Deprecated:
This will be removed

Definition at line 15 of file shape.hpp.

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

◆ number_of_particle_constituents

uint8_t icedb::Shapes::NewShapeRequiredProperties::number_of_particle_constituents = 0

DIMENSION: The number of distinct constituents in the particle. If these have non-trivial ids (i.e. not 1, 2, 3, 4, ...), then define the optional attribute particle_constituent_number.

Definition at line 27 of file shape.hpp.

Referenced by icedb::Examples::Shapes::ShapeRequiredData::apply(), isValid(), main(), and requiresOptionalPropertiesStruct().

◆ number_of_particle_scattering_elements

uint64_t icedb::Shapes::NewShapeRequiredProperties::number_of_particle_scattering_elements = 0

DIMENSION: The number of scattering elements. If these have non-trivial ids (i.e. not 1, 2, 3, 4, ...), then define the optional attribute particle_scattering_element_number.

Definition at line 22 of file shape.hpp.

Referenced by icedb::Examples::Shapes::ShapeRequiredData::apply(), isValid(), and main().

◆ particle_id

std::string icedb::Shapes::NewShapeRequiredProperties::particle_id

ATTRIBUTE: Unique Particle Identifier.

Definition at line 48 of file shape.hpp.

Referenced by icedb::Examples::Shapes::ShapeRequiredData::apply(), isValid(), and main().

◆ particle_scattering_element_coordinates

gsl::span<const float> icedb::Shapes::NewShapeRequiredProperties::particle_scattering_element_coordinates

VARIABLE: Cartesian coordinates of the center of each scattering element Written in form of x_1, y_1, z_1, x_2, y_2, z_2, ... Dimensions of [number_of_particle_scattering_elements][axis]

Definition at line 37 of file shape.hpp.

Referenced by icedb::Examples::Shapes::ShapeRequiredData::apply(), isValid(), and main().

◆ particle_scattering_element_coordinates_are_integral

uint64_t icedb::Shapes::NewShapeRequiredProperties::particle_scattering_element_coordinates_are_integral = 0

Are the particle_scattering_element_coordinates integers? This allows for optimization when writing. If they are integers, then particle_scattering_element_coordinates_ints is written instead.

Definition at line 42 of file shape.hpp.

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


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