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

openmc-dev / openmc / 14386648657

10 Apr 2025 05:30PM UTC coverage: 85.118% (+0.07%) from 85.044%
14386648657

Pull #3370

github

web-flow
Merge 993e23d39 into 07f533461
Pull Request #3370: Fix negative distances from bins_crossed for CylindricalMesh

6 of 6 new or added lines in 1 file covered. (100.0%)

199 existing lines in 18 files now uncovered.

51665 of 60698 relevant lines covered (85.12%)

37166875.55 hits per line

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

0.0
/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:
UNCOV
20
  UnitSphereDistribution() {};
×
21
  explicit UnitSphereDistribution(Direction u) : u_ref_ {u} {};
22
  explicit UnitSphereDistribution(pugi::xml_node node);
23
  virtual ~UnitSphereDistribution() = default;
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
  UPtrDist mu_;  //!< Distribution of polar angle
55
  UPtrDist phi_; //!< Distribution of azimuthal angle
56
};
57

58
//==============================================================================
59
//! Uniform distribution on the unit sphere
60
//==============================================================================
61

62
Direction isotropic_direction(uint64_t* seed);
63

64
class Isotropic : public UnitSphereDistribution {
65
public:
UNCOV
66
  Isotropic() {};
×
67

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

74
//==============================================================================
75
//! Monodirectional distribution
76
//==============================================================================
77

78
class Monodirectional : public UnitSphereDistribution {
79
public:
80
  Monodirectional(Direction u) : UnitSphereDistribution {u} {};
81
  explicit Monodirectional(pugi::xml_node node)
82
    : UnitSphereDistribution {node} {};
83

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

90
using UPtrAngle = unique_ptr<UnitSphereDistribution>;
91

92
} // namespace openmc
93

94
#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