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

Open-Sn / opensn / 18300593117

06 Oct 2025 10:47PM UTC coverage: 74.862% (-0.2%) from 75.031%
18300593117

push

github

web-flow
Merge pull request #759 from wdhawkins/performance

Sweep performance optimizations

294 of 302 new or added lines in 15 files covered. (97.35%)

334 existing lines in 80 files now uncovered.

17788 of 23761 relevant lines covered (74.86%)

61852783.95 hits per line

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

89.47
/python/lib/source.cc
1
// SPDX-FileCopyrightText: 2025 The OpenSn Authors <https://open-sn.github.io/opensn/>
2
// SPDX-License-Identifier: MIT
3

4
#include "python/lib/py_wrappers.h"
5
#include "modules/linear_boltzmann_solvers/lbs_problem/volumetric_source/volumetric_source.h"
6
#include "modules/linear_boltzmann_solvers/lbs_problem/point_source/point_source.h"
7
#include <memory>
8

9
namespace opensn
10
{
11

12
// Wrap point source
13
void
14
WrapPointSource(py::module& src)
416✔
15
{
16
  // clang-format off
17
  // point source
18
  auto point_source = py::class_<PointSource, std::shared_ptr<PointSource>>(
19
    src,
20
    "PointSource",
21
    R"(
22
    Point sources, defined by its location and a group-wise strength vector.
23

24
    Wrapper of :cpp:class:`opensn::PointSource`.
25
    )"
26
  );
416✔
27
  point_source.def(
416✔
28
    py::init(
416✔
UNCOV
29
      [](py::kwargs& params)
×
30
      {
31
        return PointSource::Create(kwargs_to_param_block(params));
9✔
32
      }
33
    ),
34
    R"(
35
    Construct a point source from its location and strength.
36

37
    Parameters
38
    ----------
39
    location: Tuple[float, float, float]
40
        Coordinates of the point source.
41
    strength: List[float]
42
        Group-wise point source strength.
43
    )"
44
  );
45
  // clang-format on
46
}
416✔
47

48
// Wrap volumetric source
49
void
50
WrapVolumetricSource(py::module& src)
416✔
51
{
52
  // clang-format off
53
  // volumetric source
54
  auto volumetric_source = py::class_<VolumetricSource, std::shared_ptr<VolumetricSource>>(
55
    src,
56
    "VolumetricSource",
57
    R"(
58
      Multi-group isotropic volumetric sources.
59

60
      Wrapper of :cpp:class:`opensn::VolumetricSource`.
61
    )"
62
  );
416✔
63
  volumetric_source.def(
416✔
64
    py::init(
416✔
UNCOV
65
      [](py::kwargs& params)
×
66
      {
67
        return VolumetricSource::Create(kwargs_to_param_block(params));
325✔
68
      }
69
    ),
70
    R"(
71
    Construct a multi-group isotropic volumetric sources.
72

73
    Parameters
74
    ----------
75
    block_ids: List[int]
76
        An array of block IDs the volumetric source is present within.
77
    logical_volume: pyopensn.logvol.LogicalVolume
78
        Logical volume that the volumetric source is defined within.
79
    group_strength: List[float]
80
        An array of multi-group source strength values. Note that this is only used when a function
81
        is not provided.
82
    func: pyopensn.math.VectorSpatialFunction
83
        Function to be used to define the source.
84
    )"
85
  );
86
  // clang-format on
87
}
416✔
88

89
// Wrap the source components of OpenSn
90
void
91
py_source(py::module& pyopensn)
62✔
92
{
93
  py::module src = pyopensn.def_submodule("source", "Source module.");
62✔
94
  WrapPointSource(src);
62✔
95
  WrapVolumetricSource(src);
62✔
96
}
62✔
97

98
} // namespace opensn
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