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

NREL / SolTrace / 18887449607

28 Oct 2025 07:53PM UTC coverage: 89.87% (-0.08%) from 89.946%
18887449607

Pull #76

github

web-flow
Merge e0df5f970 into f6f121007
Pull Request #76: Fix NativeRunner ray tracing failure for parabola surface

944 of 994 new or added lines in 28 files covered. (94.97%)

2 existing lines in 1 file now uncovered.

4418 of 4916 relevant lines covered (89.87%)

10138914.15 hits per line

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

61.9
/coretrace/simulation_data/surface.hpp
1
/**
2
 * @file surface.hpp
3
 * @brief Optical surface geometry definitions
4
 *
5
 * Defines various optical surface types (flat, parabolic, spherical, etc.)
6
 * and their mathematical representations for ray-surface intersection
7
 * calculations. Provides the foundation for ray tracing on different
8
 * geometric surface types used in concentrated solar power systems.
9
 *
10
 * @defgroup surfaces Optical Surfaces
11
 * @{
12
 */
13

14
#ifndef SOLTRACE_SURFACE_H
15
#define SOLTRACE_SURFACE_H
16

17
#include <memory>
18
#include <vector>
19

20
namespace SolTrace::Data {
21

22
enum SurfaceType
23
{
24
    CONE,
25
    CYLINDER,
26
    FLAT,
27
    PARABOLA,
28
    SPHERE,
29

30
    HYPER,
31
    GENERAL_SPENCER_MURTY,
32
    TORUS,
33

34
    SURFACE_UNKNOWN
35
};
36

37
struct Surface
38
{
39
public:
40
    SurfaceType my_type;
41

42
    Surface(SurfaceType st) : my_type(st) {}
×
43
    virtual ~Surface() {}
×
44

45
    SurfaceType get_type() { return my_type; }
8,359✔
46
};
47

48
struct Cone : public Surface
49
{
50
    // z(x,y) = sqrt(x^2 + y^2) / tan(theta)
51
    // where theta = half_angle
52
    double half_angle;
NEW
53
    Cone(double ha) : Surface(SurfaceType::CONE), half_angle(ha) {}
×
54
    virtual ~Cone() {}
×
55
};
56

57
struct Cylinder : public Surface
58
{
59
    // x^2 + (z - r)^2 = r^2
60
    // where r = radius
61
    double radius;
62
    Cylinder(double r) : Surface(SurfaceType::CYLINDER), radius(r)
43✔
63
    {
64
    }
43✔
65
    virtual ~Cylinder() {}
43✔
66
};
67

68
struct Flat : public Surface
69
{
70
    Flat() : Surface(SurfaceType::FLAT) {}
1,922✔
71
    virtual ~Flat() {}
1,922✔
72
};
73

74
struct Parabola : public Surface
75
{
76
    // z(x,y) = (cx * x^2 + cy * y^2) / 2
77
    // TODO: Assuming that vertex_x_curv gives cx and
78
    // that vertex_y_curv gives cy
79
    double focal_length_x;
80
    double focal_length_y;
81

82
    Parabola(double focal_x, double focal_y) : Surface(SurfaceType::PARABOLA),
6,478✔
83
                                               focal_length_x(focal_x),
6,478✔
84
                                               focal_length_y(focal_y)
6,478✔
85
    {
86
    }
6,478✔
87
    virtual ~Parabola() {}
6,478✔
88
};
89

90
struct Sphere : public Surface
91
{
92
    // z(x,y) = c(x^2 + y^2) / [1 + sqrt(1 - c^2{x^2 + y^2})]
93
    // where c = 1/R.
94
    // TODO: This form seems to be unnecessarily complicated.
95
    // Could easily just use one of the equations
96
    // z(x,y) = (1 - sqrt(1 - c^2 (x^2 + y^2))) / c
97
    //        = R - sqrt(R^2 - (x^2 + y^2))
98
    // Need to check on this.
99
    double vertex_curv;
100

NEW
101
    Sphere(double curv) : Surface(SurfaceType::SPHERE),
×
102
                          vertex_curv(curv)
×
103
    {
104
    }
×
105
    virtual ~Sphere() {}
×
106
};
107

108
// TODO: Add other surface types. Documentation has the following:
109
// 1. Hyperboloid/Ellipsoid
110
// 2. Zernike Series
111
// 3. VSHOT data
112
// 4. Finite Element data
113
// 5. General Spencer & Murty Equation
114
// 6. Polynomial Series (rotationally symmetric)
115
// 7. Cubic Spline Interpolation (rotationally symmetric)
116

117
using surface_ptr = std::shared_ptr<Surface>;
118

119
template <typename S, typename... Args>
120
inline auto make_surface(Args &&...args)
8,473✔
121
{
122
    return std::make_shared<S>(std::forward<Args>(args)...);
8,473✔
123
}
124

125
surface_ptr make_surface_from_type(SurfaceType type,
126
                                   const std::vector<double> &args);
127

128
} // namespace SolTrace::Data
129

130
/**
131
 * @}
132
 */
133

134
#endif
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