API Documentation
Loading...
Searching...
No Matches
DesignParameterAccumulator.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Design
28File: DesignParameterAccumulator
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/DesignParameter.h>
35#include <NDEVR/DesignObject.h>
36#include <NDEVR/ModelIterator.h>
37
38namespace NDEVR
39{
40 class Geometry;
41 class Model;
42 class TableColumn;
43 class DesignObject;
44
45 /**--------------------------------------------------------------------------------------------------
46 \brief Searches a model heirarchy and pulls a list of available parameters along with the count for
47 how many instances of that parameter are present.
48 **/
50 {
51 public:
52 ParseResult process(Model& model) final override;
53 ParseResult process(Model& model, Geometry& geo) final override;
54 ParseResult process(Model& model, Material& mat) final override;
55 void addParameter(const String& parameter);
56 private:
57 void parseAllModels() final override;
58 public:
60 Dictionary<String, uint04> parameter_count;
61 };
62
63 /**--------------------------------------------------------------------------------------------------
64 \brief Searches a model heirarchy and pulls all parameter data based on the AccumationMode settings
65 **/
67 {
68 public:
70 {
71 e_get_max_min
72 , e_get_average
73 , e_get_variance
74 , e_get_std_dev
75 , e_get_strings
76 , e_get_total
77 , e_get_indices
78 , e_get_floats
79 };
80 public:
81 explicit DesignParameterAccumulator(const DesignParameter& design_parameter, BitFlag mode = BitFlag(0));
82 void setToDefaults(const DesignObject& object);
83 void accumulate(fltp08 value, const uint01& dim = X, bool to_unit = true);
84 void accumulate(const DesignObject& object, fltp08 known_avg = Constant<fltp08>::Invalid);
85 void addToTotal(fltp08 value);
86 DesignObject::DesignObjectType type() { return m_design_type; }
87 void clear();
88 void setCollectVerticesByPrimitive(PrimitiveProperty vertex_collection_primitive);
89 private:
90 ParseResult process(Model& model) final override;
91 ParseResult process(Model& model, Geometry& geo) final override;
92 ParseResult process(Model& model, Material& mat) final override;
93 ParseResult postProcess(Model& m) final override;
94 private:
95 void parseAllModels() final override;
96 bool _setupValues(const DesignObject& object);
97 void _accumulate(const DesignObject& object);
98 Matrix<fltp08> _matrix(const DesignObject& object);
99 void _accumulateVertices(const Geometry& geo, const TableColumn& column);
100 void _accumulate(const DesignObject& object, uint04 row, const TableColumn& column);
101 void _accumulate(const String& data);
102 public:
103 Matrix<fltp08> transform = Matrix<fltp08>(1.0);
105 ConstPointer<Unit> override_unit;
106 fltp08 average = Constant<fltp08>::Invalid;
107 BitFlag accumulate_mode;
108 fltp08 max = Constant<fltp08>::Min;
109 fltp08 min = Constant<fltp08>::Max;
110 fltp08 total_value = 0.0;
111 fltp08 upper_variance = 0.0;//variance for greater than average values
112 fltp08 lower_variance = 0.0;//variance for less than average values
113 fltp08 upper_std_dev = 0.0;//standard deviation for greater than average values
114 fltp08 lower_std_dev = 0.0;//standard deviation for less than average values
115 uint04 total_upper = 0;//Total less than average values
116 uint04 total_lower = 0;//Total greater than average values
117 uint04 total_count = 0;
118 uint04 min_num_of_decimals = 0;
119 uint04 max_num_of_decimals = Constant<uint04>::Max;
120 uint04 min_digits = 0;
121 uint04 max_num_of_values = Constant<uint04>::Max;
122 String default_value;
123 bool is_normal_prop = false;
124 bool add_commas = false;
125 bool recursive_matrix = false;
126 bool use_defaults = false;
127 bool include_unit_symbols = true;
128 Buffer<String> string_values;
129 Buffer<uint04> indices;
130 Buffer<fltp08> float_values;
131 String string_cache;
132 protected:
133 fltp08 total_value_c = 0.0;//Used to keep precision when accumulating
134 bool is_matrix_prop = false;
135 bool is_design_index = false;
136 bool is_vertex_index = false;
137 bool is_special_field = false;
138 PrimitiveProperty m_vertex_collection_primitive = PrimitiveProperty::Vertices;
139 DesignObject::DesignObjectType m_design_type = DesignObject::DesignObjectType::e_model;
140 uint04 property_index = Constant<uint04>::Invalid;
141 };
142 /**--------------------------------------------------------------------------------------------------
143 \brief Classes for conveniently setting parameters for a series of DesignObjects in the model hierarchy.
144 **/
146 {
147 public:
149 {
150 e_set_from_strings
151 };
152 public:
153 explicit DesignParameterSetter(const DesignParameter& design_parameter, SetMode mode);
154 void setToDefaults(const DesignObject& object);
155 private:
156 ParseResult process(Model& model) final override;
157 ParseResult process(Model& model, Geometry& geo) final override;
158 ParseResult process(Model& model, Material& mat) final override;
159 void clear();
160 private:
161 const String& currentValue() const;
162 bool _setupValues(const DesignObject& object);
163 void _set(DesignObject& object);
164 Matrix<fltp08> _matrix(const DesignObject& object) const;
165 void _setVertices(Geometry& geo, TableColumn& column);
166 void _set(DesignObject& object, uint04 row, TableColumn& column);
167 public:
171 uint04 total_count = 0;
172 uint04 set_offset = 0;
173 uint04 max_num_of_values = Constant<uint04>::Max;
175 bool is_normal_prop = false;
176 bool recursive = true;
177 bool recursive_matrix = false;
178 bool use_defaults = false;
182 protected:
183 fltp08 total_value_c = 0.0;//Used to keep precision when accumulating
184 bool is_matrix_prop = false;
185 bool is_design_index = false;
186 bool is_vertex_index = false;
187 bool is_special_field = false;
188 DesignObject::DesignObjectType m_design_type = DesignObject::DesignObjectType::e_model;
190 };
191
192
193}
194
195
196
197
#define NDEVR_DESIGN_API
Definition DLLInfo.h:55
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
Definition BitFlag.hpp:55
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition GraphicsPipeline.h:42
A low-level database object that can be used to access general stored properties within the NDEVR Mod...
Definition DesignObject.h:67
DesignObjectType
Definition DesignObject.h:74
Searches a model heirarchy and pulls all parameter data based on the AccumationMode settings.
Definition DesignParameterAccumulator.h:67
void setToDefaults(const DesignObject &object)
void accumulate(fltp08 value, const uint01 &dim=X, bool to_unit=true)
AccumulateMode
Definition DesignParameterAccumulator.h:70
DesignObject::DesignObjectType type()
Definition DesignParameterAccumulator.h:86
DesignParameterAccumulator(const DesignParameter &design_parameter, BitFlag mode=BitFlag(0))
void setCollectVerticesByPrimitive(PrimitiveProperty vertex_collection_primitive)
void accumulate(const DesignObject &object, fltp08 known_avg=Constant< fltp08 >::Invalid)
Searches a model heirarchy and pulls a list of available parameters along with the count for how many...
Definition DesignParameterAccumulator.h:50
ParseResult process(Model &model, Geometry &geo) final override
ParseResult process(Model &model, Material &mat) final override
void addParameter(const String &parameter)
ParseResult process(Model &model) final override
A definition of data that is logically stored in the Model heirarchy. Data could be a property of a M...
Definition DesignParameter.h:46
Classes for conveniently setting parameters for a series of DesignObjects in the model hierarchy.
Definition DesignParameterAccumulator.h:146
Buffer< fltp08 > float_values
Definition DesignParameterAccumulator.h:181
void setToDefaults(const DesignObject &object)
Buffer< String > string_values
Definition DesignParameterAccumulator.h:179
DesignParameterSetter(const DesignParameter &design_parameter, SetMode mode)
DesignParameter parameter
Definition DesignParameterAccumulator.h:169
String default_value
Definition DesignParameterAccumulator.h:174
SetMode
Definition DesignParameterAccumulator.h:149
SetMode set_mode
Definition DesignParameterAccumulator.h:170
Buffer< uint04 > indices
Definition DesignParameterAccumulator.h:180
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
A core class within the model heirarchy containing vertex-based data (Usually 3D data) within a set c...
Definition Geometry.h:64
Container responsible for storing and setting the appearance of a Model or Geometry within the NDEVR ...
Definition Material.h:51
Definition Matrix.hpp:176
A core class that represents a node on model heirarchy. This node may contain a Geometry or one or mo...
Definition Model.h:58
A base class for easily transversing a model heirarchy, applying an overritten function at each level...
Definition ModelIterator.h:43
ParseResult
Definition ModelIterator.h:46
The core String class for the NDEVR API.
Definition String.h:69
A virtual storage type that is used with Table class to store data where the actual mechanism for sto...
Definition TableColumn.h:76
Definition ACIColor.h:37
PrimitiveProperty
Definition DesignObjectBase.h:44
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233
A definition of how to describe and display data. Units can be of any type.
Definition Unit.h:36