• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NREL / SolTrace / 18544749821

15 Oct 2025 10:47PM UTC coverage: 89.946% (+45.8%) from 44.166%
18544749821

push

github

web-flow
Restructured backend for SolTrace (#63)

* Initial API for refactored SolTrace

* Updates to various APIs; first pass at element/ray source container implementation

* Use existing matrix-vector code as backend for matrix and vector classes; start implementing APIs

* Created new test on power tower example file with 50000 rays. Changed CMake to use cpp 17.

* Added ground results csv to new folder in google-tests directory

* Removed register prefix from variables in mtrand.h. More errors to come.

* Removed lines in CMakeLists causing linux failure, fixed bug in power tower test

* Created parabola.stinput test and a test using powertower optimization on the powertower sample

* Commented out parabola test for now, added nonexistent branch to CI to see how it runs

* Fixed syntax error

* Changed tests based on PR feedback

* Fixed error in CMakeLists that caused failure on windows

* Removed output messages from st_sim_run_test

* Fixed silly mistake in previous commit

* Added comments and removed unused libraries

* Changed naming conventions of tests

* Added high flux solar furnace test changes, changed parabola test file name

* Fixed typo

* Move refactored data to its own directory; add to refactored classes to build

* Add missed files

* Add unit tests for basic linear algebra and container template

* More tests; Start implementation of composite element

* Add more unit tests on element

* Add missed headers

* Remove target from cmake build command in CI

* Initial virtual element implementation; smoke test for virtual element

* Correct aperture spelling; add tests for virtual elements

* Add some unit tests for simulation data

* Move to static library for simulation data (temporary); update cmake files to get correct mac architecture

* Attempt to fix coverage failure

* Attempt to capture inline functions in code coverage; add a few more explicit tests

* Fix build

* Separate storage of CompositeElement and SingleElement; update te... (continued)

4357 of 4844 new or added lines in 62 files covered. (89.95%)

4357 of 4844 relevant lines covered (89.95%)

8565975.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

71.43
/coretrace/simulation_data/composite_element.hpp
1
/**
2
 * @file composite_element.hpp
3
 * @brief Composite element class for complex optical systems
4
 *
5
 * Defines the CompositeElement class which can contain multiple
6
 * sub-elements, allowing for hierarchical optical system definitions.
7
 * Enables grouping of related optical elements for easier management
8
 * and coordinate transformations.
9
 *
10
 * @defgroup elements Optical Elements
11
 * @{
12
 */
13

14
#ifndef SOLTRACE_COMPOSITE_ELEMENT_H
15
#define SOLTRACE_COMPOSITE_ELEMENT_H
16

17
#include <memory>
18

19
#include "container.hpp"
20
#include "element.hpp"
21

22
namespace SolTrace::Data {
23

24
class CompositeElement : public ElementBase
25
{
26
public:
27
    /**
28
     * @brief Default constructor for composite element
29
     */
30
    CompositeElement();
31
    virtual ~CompositeElement();
32

33
    /**
34
     * @brief Disable this composite element and all sub-elements
35
     */
36
    virtual void disable() const override;
37

38
    /**
39
     * @brief Enable this composite element and all sub-elements
40
     */
41
    virtual void enable() const override;
42

43
    /**
44
     * @brief Check if this element is composite
45
     * @return Always returns true for composite elements
46
     */
47
    virtual bool is_composite() const override
523✔
48
    {
49
        return true;
523✔
50
    }
51

52
    /**
53
     * @brief Set the stage number for this composite element
54
     * @param stage Stage number to assign
55
     */
56
    virtual void set_stage(int_fast64_t stage) override;
57

58
    /**
59
     * @brief Get the number of sub-elements in this composite
60
     * @return Number of elements contained in this composite
61
     */
62
    virtual uint_fast64_t get_number_of_elements() const override
795✔
63
    {
64
        // return this->my_elements.get_number_of_items();
65
        return this->number_of_elements;
795✔
66
    }
67

68
    // Element interface functions
69
    /**
70
     * @brief Get aperture pointer (always null for composite elements)
71
     * @return nullptr (composite elements don't have apertures)
72
     */
NEW
73
    virtual const aperture_ptr get_aperture() const override { return nullptr; }
×
74

75
    /**
76
     * @brief Get aperture pointer (always null for composite elements)
77
     * @return nullptr (composite elements don't have apertures)
78
     */
79
    virtual aperture_ptr get_aperture() override { return nullptr; }
2✔
80

81
    /**
82
     * @brief Set aperture (no-op for composite elements)
83
     * @param aperture_ptr Ignored for composite elements
84
     */
NEW
85
    virtual void set_aperture(aperture_ptr) override {}
×
86

87
    /**
88
     * @brief Get surface pointer (always null for composite elements)
89
     * @return nullptr (composite elements don't have surfaces)
90
     */
NEW
91
    virtual const surface_ptr get_surface() const override { return nullptr; }
×
92

93
    /**
94
     * @brief Get surface pointer (always null for composite elements)
95
     * @return nullptr (composite elements don't have surfaces)
96
     */
97
    virtual surface_ptr get_surface() override { return nullptr; }
2✔
98

99
    /**
100
     * @brief Set surface (no-op for composite elements)
101
     * @param surface_ptr Ignored for composite elements
102
     */
NEW
103
    virtual void set_surface(surface_ptr) override {}
×
104

105
    /**
106
     * @brief Get front optical properties (always null for composite elements)
107
     * @return nullptr (composite elements don't have optical properties)
108
     */
NEW
109
    virtual const OpticalProperties *get_front_optical_properties() const override
×
110
    {
NEW
111
        return nullptr;
×
112
    }
113

114
    /**
115
     * @brief Get front optical properties (always null for composite elements)
116
     * @return nullptr (composite elements don't have optical properties)
117
     */
118
    virtual OpticalProperties *get_front_optical_properties() override
2✔
119
    {
120
        return nullptr;
2✔
121
    }
122

123
    /**
124
     * @brief Set front optical properties (no-op for composite elements)
125
     * @param op Ignored for composite elements
126
     */
127
    virtual void set_front_optical_properties(const OpticalProperties &) override {}
1✔
128

129
    /**
130
     * @brief Get back optical properties (always null for composite elements)
131
     * @return nullptr (composite elements don't have optical properties)
132
     */
NEW
133
    virtual const OpticalProperties *get_back_optical_properties() const override
×
134
    {
NEW
135
        return nullptr;
×
136
    }
137

138
    /**
139
     * @brief Get back optical properties (always null for composite elements)
140
     * @return nullptr (composite elements don't have optical properties)
141
     */
142
    virtual OpticalProperties *get_back_optical_properties() override
2✔
143
    {
144
        return nullptr;
2✔
145
    }
146

147
    /**
148
     * @brief Set back optical properties (no-op for composite elements)
149
     * @param op Ignored for composite elements
150
     */
151
    virtual void set_back_optical_properties(const OpticalProperties &) override {};
1✔
152

153
    // CompositeElement accessors
154
    /**
155
     * @brief Add an element to this composite
156
     * @param el Shared pointer to element to add
157
     * @return Element ID of the added element
158
     */
159
    element_id add_element(element_ptr el);
160

161
    /**
162
     * @brief Remove an element from this composite
163
     * @param id Element ID to remove
164
     * @return Number of elements removed (0 or 1)
165
     */
166
    uint_fast64_t remove_element(element_id id);
167

168
    /**
169
     * @brief Get an element by ID
170
     * @param id Element ID to retrieve
171
     * @return Shared pointer to element, or null if not found
172
     */
173
    element_ptr get_element(element_id id);
174

175
    /**
176
     * @brief Replace an element with a new one
177
     * @param id Element ID to replace
178
     * @param el New element to insert
179
     * @return True if replacement was successful
180
     */
181
    bool replace_element(element_id id, element_ptr el);
182

183
    /**
184
     * @brief Remove all elements from this composite
185
     */
186
    void clear();
187

188
    // uint64_t get_total_number_of_elements() const
189
    // {
190
    //     return this->my_elements.get_total_number_of_items();
191
    // }
192

193
    /**
194
     * @brief Get iterator to beginning of element container
195
     * @return Iterator to first element
196
     */
197
    virtual ElementContainer::iterator get_iterator()
272✔
198
    {
199
        return this->my_elements.get_iterator();
272✔
200
    }
201
    virtual ElementContainer::const_iterator get_const_iterator() const
532✔
202
    {
203
        return this->my_elements.get_const_iterator();
532✔
204
    }
205
    virtual bool is_at_end(ElementContainer::iterator iter)
2,224✔
206
    {
207
        return this->my_elements.is_at_end(iter);
2,224✔
208
    }
209
    virtual bool is_at_end(ElementContainer::const_iterator citer) const
9,375✔
210
    {
211
        return this->my_elements.is_at_end(citer);
9,375✔
212
    }
213

214
    virtual void enforce_user_fields_set() const override;
215

216
private:
217
    uint_fast64_t number_of_elements;
218
    ElementContainer my_elements;
219
};
220

221
using composite_element_ptr = std::shared_ptr<CompositeElement>;
222

223
} // namespace SolTrace::Data
224

225
#endif
226

227
/**
228
 * @}
229
 */
230

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc