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

openmc-dev / openmc / 19058781736

04 Nov 2025 05:26AM UTC coverage: 82.008% (-3.1%) from 85.155%
19058781736

Pull #3252

github

web-flow
Merge b8a72730f into bd76fc056
Pull Request #3252: Adding vtkhdf option to write vtk data

16714 of 23236 branches covered (71.93%)

Branch coverage included in aggregate %.

61 of 66 new or added lines in 1 file covered. (92.42%)

3175 existing lines in 103 files now uncovered.

54243 of 63288 relevant lines covered (85.71%)

43393337.77 hits per line

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

83.33
/include/openmc/distribution_multi.h
1
#ifndef DISTRIBUTION_MULTI_H
2
#define DISTRIBUTION_MULTI_H
3

4
#include "openmc/memory.h"
5

6
#include "pugixml.hpp"
7

8
#include "openmc/distribution.h"
9
#include "openmc/position.h"
10

11
namespace openmc {
12

13
//==============================================================================
14
//! Probability density function for points on the unit sphere. Extensions of
15
//! this type are used to sample angular distributions for starting sources
16
//==============================================================================
17

18
class UnitSphereDistribution {
19
public:
20
  UnitSphereDistribution() {};
44,075✔
UNCOV
21
  explicit UnitSphereDistribution(Direction u) : u_ref_ {u} {};
×
22
  explicit UnitSphereDistribution(pugi::xml_node node);
23
  virtual ~UnitSphereDistribution() = default;
46,991✔
24

25
  static unique_ptr<UnitSphereDistribution> create(pugi::xml_node node);
26

27
  //! Sample a direction from the distribution
28
  //! \param seed Pseudorandom number seed pointer
29
  //! \return Direction sampled
30
  virtual Direction sample(uint64_t* seed) const = 0;
31

32
  Direction u_ref_ {0.0, 0.0, 1.0}; //!< reference direction
33
};
34

35
//==============================================================================
36
//! Explicit distribution of polar and azimuthal angles
37
//==============================================================================
38

39
class PolarAzimuthal : public UnitSphereDistribution {
40
public:
41
  PolarAzimuthal(Direction u, UPtrDist mu, UPtrDist phi);
42
  explicit PolarAzimuthal(pugi::xml_node node);
43

44
  //! Sample a direction from the distribution
45
  //! \param seed Pseudorandom number seed pointer
46
  //! \return Direction sampled
47
  Direction sample(uint64_t* seed) const override;
48

49
  // Observing pointers
50
  Distribution* mu() const { return mu_.get(); }
51
  Distribution* phi() const { return phi_.get(); }
52

53
private:
54
  Direction v_ref_ {1.0, 0.0, 0.0}; //!< reference direction
55
  Direction w_ref_;
56
  UPtrDist mu_;  //!< Distribution of polar angle
57
  UPtrDist phi_; //!< Distribution of azimuthal angle
58
};
59

60
//==============================================================================
61
//! Uniform distribution on the unit sphere
62
//==============================================================================
63

64
Direction isotropic_direction(uint64_t* seed);
65

66
class Isotropic : public UnitSphereDistribution {
67
public:
68
  Isotropic() {};
44,075✔
69

70
  //! Sample a direction from the distribution
71
  //! \param seed Pseudorandom number seed pointer
72
  //! \return Sampled direction
73
  Direction sample(uint64_t* seed) const override;
74
};
75

76
//==============================================================================
77
//! Monodirectional distribution
78
//==============================================================================
79

80
class Monodirectional : public UnitSphereDistribution {
81
public:
82
  Monodirectional(Direction u) : UnitSphereDistribution {u} {};
83
  explicit Monodirectional(pugi::xml_node node)
2,878✔
84
    : UnitSphereDistribution {node} {};
2,878✔
85

86
  //! Sample a direction from the distribution
87
  //! \param seed Pseudorandom number seed pointer
88
  //! \return Sampled direction
89
  Direction sample(uint64_t* seed) const override;
90
};
91

92
using UPtrAngle = unique_ptr<UnitSphereDistribution>;
93

94
} // namespace openmc
95

96
#endif // DISTRIBUTION_MULTI_H
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