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

openmc-dev / openmc / 14515233533

17 Apr 2025 12:06PM UTC coverage: 83.16% (-2.3%) from 85.414%
14515233533

Pull #3087

github

web-flow
Merge 6ed397e9d into 47ca2916a
Pull Request #3087: wheel building with scikit build core

140769 of 169274 relevant lines covered (83.16%)

11830168.1 hits per line

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

83.82
/src/tallies/filter_meshsurface.cpp
1
#include "openmc/tallies/filter_meshsurface.h"
2

3
#include "openmc/capi.h"
4
#include "openmc/constants.h"
5
#include "openmc/error.h"
6
#include "openmc/mesh.h"
7

8
namespace openmc {
9

10
void MeshSurfaceFilter::get_all_bins(
2,644,224✔
11
  const Particle& p, TallyEstimator estimator, FilterMatch& match) const
12
{
13
  Position r0 = p.r_last_current();
2,644,224✔
14
  Position r1 = p.r();
2,644,224✔
15
  if (translated_) {
2,644,224✔
16
    r0 -= translation();
×
17
    r1 -= translation();
×
18
  }
19

20
  Direction u = p.u();
2,644,224✔
21
  model::meshes[mesh_]->surface_bins_crossed(r0, r1, u, match.bins_);
2,644,224✔
22
  for (auto b : match.bins_)
11,793,034✔
23
    match.weights_.push_back(1.0);
9,148,810✔
24
}
2,644,224✔
25

26
std::string MeshSurfaceFilter::text_label(int bin) const
1,377,992✔
27
{
28
  auto& mesh = *model::meshes[mesh_];
1,377,992✔
29
  int n_dim = mesh.n_dimension_;
1,377,992✔
30

31
  // Get flattend mesh index and surface index.
32
  int i_mesh = bin / (4 * n_dim);
1,377,992✔
33
  MeshDir surf_dir = static_cast<MeshDir>(bin % (4 * n_dim));
1,377,992✔
34

35
  // Get mesh index part of label.
36
  std::string out = MeshFilter::text_label(i_mesh);
1,377,992✔
37

38
  // Get surface part of label.
39
  switch (surf_dir) {
1,377,992✔
40
  case MeshDir::OUT_LEFT:
115,005✔
41
    out += " Outgoing, x-min";
115,005✔
42
    break;
115,005✔
43
  case MeshDir::IN_LEFT:
115,005✔
44
    out += " Incoming, x-min";
115,005✔
45
    break;
115,005✔
46
  case MeshDir::OUT_RIGHT:
115,005✔
47
    out += " Outgoing, x-max";
115,005✔
48
    break;
115,005✔
49
  case MeshDir::IN_RIGHT:
115,005✔
50
    out += " Incoming, x-max";
115,005✔
51
    break;
115,005✔
52
  case MeshDir::OUT_BACK:
114,950✔
53
    out += " Outgoing, y-min";
114,950✔
54
    break;
114,950✔
55
  case MeshDir::IN_BACK:
114,950✔
56
    out += " Incoming, y-min";
114,950✔
57
    break;
114,950✔
58
  case MeshDir::OUT_FRONT:
114,950✔
59
    out += " Outgoing, y-max";
114,950✔
60
    break;
114,950✔
61
  case MeshDir::IN_FRONT:
114,950✔
62
    out += " Incoming, y-max";
114,950✔
63
    break;
114,950✔
64
  case MeshDir::OUT_BOTTOM:
114,543✔
65
    out += " Outgoing, z-min";
114,543✔
66
    break;
114,543✔
67
  case MeshDir::IN_BOTTOM:
114,543✔
68
    out += " Incoming, z-min";
114,543✔
69
    break;
114,543✔
70
  case MeshDir::OUT_TOP:
114,543✔
71
    out += " Outgoing, z-max";
114,543✔
72
    break;
114,543✔
73
  case MeshDir::IN_TOP:
114,543✔
74
    out += " Incoming, z-max";
114,543✔
75
    break;
114,543✔
76
  }
77

78
  return out;
1,377,992✔
79
}
×
80

81
void MeshSurfaceFilter::set_mesh(int32_t mesh)
160✔
82
{
83
  mesh_ = mesh;
160✔
84
  n_bins_ = model::meshes[mesh_]->n_surface_bins();
160✔
85
}
160✔
86

87
//==============================================================================
88
// C-API functions
89
//==============================================================================
90

91
extern "C" int openmc_meshsurface_filter_get_mesh(
×
92
  int32_t index, int32_t* index_mesh)
93
{
94
  return openmc_mesh_filter_get_mesh(index, index_mesh);
×
95
}
96

97
extern "C" int openmc_meshsurface_filter_set_mesh(
×
98
  int32_t index, int32_t index_mesh)
99
{
100
  return openmc_mesh_filter_set_mesh(index, index_mesh);
×
101
}
102

103
extern "C" int openmc_meshsurface_filter_get_translation(
×
104
  int32_t index, double translation[3])
105
{
106
  return openmc_mesh_filter_get_translation(index, translation);
×
107
}
108

109
extern "C" int openmc_meshsurface_filter_set_translation(
×
110
  int32_t index, double translation[3])
111
{
112
  return openmc_mesh_filter_set_translation(index, translation);
×
113
}
114

115
} // namespace openmc
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