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

openmc-dev / openmc / 13114782272

03 Feb 2025 01:38PM UTC coverage: 82.603% (-2.3%) from 84.867%
13114782272

Pull #3087

github

web-flow
Merge 258841139 into 59c398be8
Pull Request #3087: wheel building with scikit build core

107121 of 129682 relevant lines covered (82.6%)

12608592.69 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,884,608✔
11
  const Particle& p, TallyEstimator estimator, FilterMatch& match) const
12
{
13
  Position r0 = p.r_last_current();
2,884,608✔
14
  Position r1 = p.r();
2,884,608✔
15
  if (translated_) {
2,884,608✔
16
    r0 -= translation();
×
17
    r1 -= translation();
×
18
  }
19

20
  Direction u = p.u();
2,884,608✔
21
  model::meshes[mesh_]->surface_bins_crossed(r0, r1, u, match.bins_);
2,884,608✔
22
  for (auto b : match.bins_)
12,865,128✔
23
    match.weights_.push_back(1.0);
9,980,520✔
24
}
2,884,608✔
25

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

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

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

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

78
  return out;
1,503,264✔
79
}
×
80

81
void MeshSurfaceFilter::set_mesh(int32_t mesh)
170✔
82
{
83
  mesh_ = mesh;
170✔
84
  n_bins_ = model::meshes[mesh_]->n_surface_bins();
170✔
85
}
170✔
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