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;
45 {
46 public:
47 ParseResult process(Model& model) final override;
48 ParseResult process(Model& model, Geometry& geo) final override;
49 ParseResult process(Model& model, Material& mat) final override;
50 void addParameter(const String& parameter);
51 void _parseAll() final override;
54 };
55
57 {
58 public:
60 {
61 e_get_max_min
62 , e_get_average
63 , e_get_variance
64 , e_get_std_dev
65 , e_get_strings
66 , e_get_total
67 , e_get_indices
68 , e_get_floats
69 };
70 public:
71 explicit DesignParameterAccumulator(const DesignParameter& design_parameter, BitFlag mode = BitFlag(0));
72 void accumulate(fltp08 value, const uint01& dim = X, bool to_unit = true);
73 ParseResult process(Model& model) final override;
74 ParseResult process(Model& model, Geometry& geo) final override;
75 ParseResult process(Model& model, Material& mat) final override;
76 void _parseAll() final override;
77 void accumulate(const DesignObject& object, fltp08 known_avg = Constant<fltp08>::NaN);
78 void setToDefaults(const DesignObject& object);
79 DesignObject::DesignObjectType type() { return m_design_type; }
80 void clear();
81 virtual ParseResult postProcess(Model& m) final override;
82 void addToTotal(fltp08 value);
83 void setCollectVerticesByPrimitive(PrimitiveProperty vertex_collection_primitive);
84 protected:
85
86 bool _setupValues(const DesignObject& object);
87 void _accumulate(const DesignObject& object);
88 Matrix<fltp08> _matrix(const DesignObject& object);
89 void _accumulateVertices(const Geometry& geo, const TableColumn& column);
90 void _accumulate(const DesignObject& object, uint04 row, const TableColumn& column);
91 void _accumulate(const String& data);
92 public:
100 fltp08 total_value = 0.0;
101 fltp08 upper_variance = 0.0;//variance for greater than average values
102 fltp08 lower_variance = 0.0;//variance for less than average values
103 fltp08 upper_std_dev = 0.0;//standard deviation for greater than average values
104 fltp08 lower_std_dev = 0.0;//standard deviation for less than average values
105 uint04 total_upper = 0;//Total less than average values
106 uint04 total_lower = 0;//Total greater than average values
107 uint04 total_count = 0;
108 uint04 min_num_of_decimals = 0;
109 uint04 max_num_of_decimals = Constant<uint04>::Max;
110 uint04 min_digits = 0;
111 uint04 max_num_of_values = Constant<uint04>::Max;
113 bool is_normal_prop = false;
114 bool add_commas = false;
115 bool recursive_matrix = false;
116 bool use_defaults = false;
117 bool include_unit_symbols = true;
122 protected:
123 fltp08 total_value_c = 0.0;//Used to keep precision when accumulating
124 bool is_matrix_prop = false;
125 bool is_design_index = false;
126 bool is_vertex_index = false;
127 bool is_special_field = false;
128 PrimitiveProperty m_vertex_collection_primitive = PrimitiveProperty::Vertices;
129 DesignObject::DesignObjectType m_design_type = DesignObject::DesignObjectType::e_model;
131 };
132
134 {
135 public:
137 {
138 e_set_from_strings
139 };
140 public:
141 explicit DesignParameterSetter(const DesignParameter& design_parameter, SetMode mode);
142 ParseResult process(Model& model) final override;
143 ParseResult process(Model& model, Geometry& geo) final override;
144 ParseResult process(Model& model, Material& mat) final override;
145 void _parseAll() final override;
146 void setToDefaults(const DesignObject& object);
147 void clear();
148 protected:
149 const String& currentValue() const;
150 bool _setupValues(const DesignObject& object);
151 void _set(DesignObject& object);
152 Matrix<fltp08> _matrix(const DesignObject& object) const;
153 void _setVertices(Geometry& geo, TableColumn& column);
154 void _set(DesignObject& object, uint04 row, TableColumn& column);
155 public:
156 Matrix<fltp08> transform = Matrix<fltp08>(1.0);
158 SetMode set_mode;
159 uint04 total_count = 0;
160 uint04 set_offset = 0;
161 uint04 max_num_of_values = Constant<uint04>::Max;
162 String default_value;
163 bool is_normal_prop = false;
164 bool recursive = true;
165 bool recursive_matrix = false;
166 bool use_defaults = false;
167 Buffer<String> string_values;
168 Buffer<uint04> indices;
169 Buffer<fltp08> float_values;
170 protected:
171 fltp08 total_value_c = 0.0;//Used to keep precision when accumulating
172 bool is_matrix_prop = false;
173 bool is_design_index = false;
174 bool is_vertex_index = false;
175 bool is_special_field = false;
176 DesignObject::DesignObjectType m_design_type = DesignObject::DesignObjectType::e_model;
177 uint04 property_index = Constant<uint04>::NaN;
178 };
179
180
181}
182
183
184
185
#define NDEVR_DESIGN_API
Definition DLLInfo.h:77
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
Definition BitFlag.hpp:68
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition GraphicsPipeline.h:42
Definition DesignObject.h:66
DesignObjectType
Definition DesignObject.h:75
Definition DesignParameterAccumulator.h:57
Buffer< fltp08 > float_values
Definition DesignParameterAccumulator.h:120
String string_cache
Definition DesignParameterAccumulator.h:121
Buffer< String > string_values
Definition DesignParameterAccumulator.h:118
AccumulateMode
Definition DesignParameterAccumulator.h:60
BitFlag accumulate_mode
Definition DesignParameterAccumulator.h:97
DesignParameter parameter
Definition DesignParameterAccumulator.h:94
String default_value
Definition DesignParameterAccumulator.h:112
ConstPointer< Unit > override_unit
Definition DesignParameterAccumulator.h:95
Buffer< uint04 > indices
Definition DesignParameterAccumulator.h:119
Definition DesignParameterAccumulator.h:45
Buffer< DesignParameter > parameters
Definition DesignParameterAccumulator.h:52
Dictionary< String, uint04 > parameter_count
Definition DesignParameterAccumulator.h:53
Definition DesignParameter.h:42
Definition DesignParameterAccumulator.h:134
SetMode
Definition DesignParameterAccumulator.h:137
Definition Dictionary.h:48
Definition Geometry.h:64
Definition Material.h:45
Definition Matrix.hpp:173
Definition Model.h:54
Definition ModelIterator.h:39
ParseResult
Definition ModelIterator.h:42
Definition String.h:40
Definition TableColumn.h:68
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:98
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181
Definition BaseValues.hpp:272