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

openmc-dev / openmc / 21489819490

29 Jan 2026 06:21PM UTC coverage: 80.077% (-1.9%) from 81.953%
21489819490

Pull #3757

github

web-flow
Merge d08626053 into f7a734189
Pull Request #3757: Testing point detectors

16004 of 22621 branches covered (70.75%)

Branch coverage included in aggregate %.

94 of 518 new or added lines in 26 files covered. (18.15%)

1021 existing lines in 52 files now uncovered.

53779 of 64524 relevant lines covered (83.35%)

8016833.26 hits per line

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

0.0
/include/openmc/universe.h
1
#ifndef OPENMC_UNIVERSE_H
2
#define OPENMC_UNIVERSE_H
3

4
#include "openmc/bounding_box.h"
5
#include "openmc/cell.h"
6

7
namespace openmc {
8

9
#ifdef OPENMC_DAGMC_ENABLED
10
class DAGUniverse;
11
#endif
12

13
class GeometryState;
14
class Universe;
15
class UniversePartitioner;
16

17
namespace model {
18

19
extern std::unordered_map<int32_t, int32_t> universe_map;
20
extern vector<unique_ptr<Universe>> universes;
21

22
} // namespace model
23

24
//==============================================================================
25
//! A geometry primitive that fills all space and contains cells.
26
//==============================================================================
27

28
class Universe {
29
public:
30
  int32_t id_;            //!< Unique ID
31
  vector<int32_t> cells_; //!< Cells within this universe
32
  int32_t n_instances_;   //!< Number of instances of this universe
33

34
  //! \brief Write universe information to an HDF5 group.
35
  //! \param group_id An HDF5 group id.
36
  virtual void to_hdf5(hid_t group_id) const;
37

38
  virtual bool find_cell(GeometryState& p) const;
39

40
  BoundingBox bounding_box() const;
41

42
  /* By default, universes are CSG universes. The DAGMC
43
   * universe overrides standard behaviors, and in the future,
44
   * other things might too.
45
   */
UNCOV
46
  virtual GeometryType geom_type() const { return GeometryType::CSG; }
×
47

48
  unique_ptr<UniversePartitioner> partitioner_;
49
};
50

51
//==============================================================================
52
//! Speeds up geometry searches by grouping cells in a search tree.
53
//
54
//! Currently this object only works with universes that are divided up by a
55
//! bunch of z-planes.  It could be generalized to other planes, cylinders,
56
//! and spheres.
57
//==============================================================================
58

59
class UniversePartitioner {
60
public:
61
  explicit UniversePartitioner(const Universe& univ);
62

63
  //! Return the list of cells that could contain the given coordinates.
64
  const vector<int32_t>& get_cells(Position r, Direction u) const;
65

66
private:
67
  //! A sorted vector of indices to surfaces that partition the universe
68
  vector<int32_t> surfs_;
69

70
  //! Vectors listing the indices of the cells that lie within each partition
71
  //
72
  //! There are n+1 partitions with n surfaces.  `partitions_.front()` gives the
73
  //! cells that lie on the negative side of `surfs_.front()`.
74
  //! `partitions_.back()` gives the cells that lie on the positive side of
75
  //! `surfs_.back()`.  Otherwise, `partitions_[i]` gives cells sandwiched
76
  //! between `surfs_[i-1]` and `surfs_[i]`.
77
  vector<vector<int32_t>> partitions_;
78
};
79

80
} // namespace openmc
81
#endif // OPENMC_UNIVERSE_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