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

openmc-dev / openmc / 22917034411

10 Mar 2026 06:03PM UTC coverage: 81.502%. First build
22917034411

Pull #3857

github

web-flow
Merge 830839b48 into 1dc4aa988
Pull Request #3857: Minimal implementation of hexagonal mesh

17740 of 25558 branches covered (69.41%)

Branch coverage included in aggregate %.

419 of 501 new or added lines in 5 files covered. (83.63%)

58275 of 67710 relevant lines covered (86.07%)

44657209.84 hits per line

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

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

20
  Direction u = p.u();
113,616,107✔
21
  model::meshes[mesh_]->surface_bins_crossed(r0, r1, u, match.bins_);
113,616,107✔
22
  for (auto b : match.bins_)
172,999,728✔
23
    match.weights_.push_back(1.0);
59,383,621✔
24
}
113,616,107✔
25

26
std::string MeshSurfaceFilter::text_label(int bin) const
1,403,556✔
27
{
28
  auto mesh = dynamic_cast<StructuredMesh*>(model::meshes[mesh_].get());
1,403,556!
29
  int n_dim = mesh->n_dimension_;
1,403,556✔
30

31
  // Get flattend mesh index and surface index.
32
  int i_mesh = bin / (4 * n_dim);
1,403,556✔
33
  int i_surf = bin % (4 * n_dim);
1,403,556✔
34

35
  std::string out = MeshFilter::text_label(i_mesh);
1,403,556✔
36
  out += " ";
1,403,556✔
37
  out += mesh->surface_label(i_surf);
2,807,112✔
38
  return out;
1,403,556✔
39
}
×
40

41
void MeshSurfaceFilter::set_mesh(int32_t mesh)
392✔
42
{
43
  mesh_ = mesh;
392✔
44
  if (!dynamic_cast<StructuredMesh*>(model::meshes[mesh_].get()))
392!
NEW
45
    fatal_error("Only structured mesh is supported in MeshSurfaceFilter.");
×
46
  n_bins_ = model::meshes[mesh_]->n_surface_bins();
392✔
47
}
392✔
48

49
//==============================================================================
50
// C-API functions
51
//==============================================================================
52

53
extern "C" int openmc_meshsurface_filter_get_mesh(
44✔
54
  int32_t index, int32_t* index_mesh)
55
{
56
  return openmc_mesh_filter_get_mesh(index, index_mesh);
44✔
57
}
58

59
extern "C" int openmc_meshsurface_filter_set_mesh(
209✔
60
  int32_t index, int32_t index_mesh)
61
{
62
  return openmc_mesh_filter_set_mesh(index, index_mesh);
209✔
63
}
64

65
extern "C" int openmc_meshsurface_filter_get_translation(
11✔
66
  int32_t index, double translation[3])
67
{
68
  return openmc_mesh_filter_get_translation(index, translation);
11✔
69
}
70

71
extern "C" int openmc_meshsurface_filter_set_translation(
11✔
72
  int32_t index, double translation[3])
73
{
74
  return openmc_mesh_filter_set_translation(index, translation);
11✔
75
}
76

77
} // 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