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

openmc-dev / openmc / 16646681306

31 Jul 2025 10:36AM UTC coverage: 84.927% (-0.2%) from 85.103%
16646681306

Pull #3508

github

web-flow
Merge ac07884d9 into a64cc96ed
Pull Request #3508: Automate workflow for mesh- or cell-based R2S calculations

42 of 215 new or added lines in 5 files covered. (19.53%)

400 existing lines in 32 files now uncovered.

52933 of 62328 relevant lines covered (84.93%)

36043131.63 hits per line

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

84.21
/include/openmc/xml_interface.h
1
#ifndef OPENMC_XML_INTERFACE_H
2
#define OPENMC_XML_INTERFACE_H
3

4
#include <cstddef> // for size_t
5
#include <sstream> // for stringstream
6
#include <string>
7

8
#include "pugixml.hpp"
9
#include "xtensor/xadapt.hpp"
10
#include "xtensor/xarray.hpp"
11

12
#include "openmc/position.h"
13
#include "openmc/vector.h"
14

15
namespace openmc {
16

17
inline bool check_for_node(pugi::xml_node node, const char* name)
18
{
19
  return node.attribute(name) || node.child(name);
×
20
}
21

22
std::string get_node_value(pugi::xml_node node, const char* name,
23
  bool lowercase = false, bool strip = false);
24

25
bool get_node_value_bool(pugi::xml_node node, const char* name);
26

27
template<typename T>
28
vector<T> get_node_array(
29,027✔
29
  pugi::xml_node node, const char* name, bool lowercase = false)
30
{
31
  // Get value of node attribute/child
32
  std::string s {get_node_value(node, name, lowercase)};
29,027✔
33

34
  // Read values one by one into vector
35
  std::stringstream iss {s};
29,027✔
UNCOV
36
  T value;
×
37
  vector<T> values;
29,027✔
38
  while (iss >> value)
89,143✔
39
    values.push_back(value);
60,116✔
40

41
  return values;
58,054✔
42
}
29,027✔
43

29,027✔
44
template<typename T>
45
xt::xarray<T> get_node_xarray(
46
  pugi::xml_node node, const char* name, bool lowercase = false)
47
{
29,027✔
48
  vector<T> v = get_node_array<T>(node, name, lowercase);
49
  vector<std::size_t> shape = {v.size()};
50
  return xt::adapt(v, shape);
29,027✔
51
}
52

29,027✔
53
std::vector<Position> get_node_position_array(
89,143✔
54
  pugi::xml_node node, const char* name, bool lowercase = false);
60,116✔
55

56
Position get_node_position(
58,054✔
57
  pugi::xml_node node, const char* name, bool lowercase = false);
29,027✔
UNCOV
58

×
59
} // namespace openmc
60
#endif // OPENMC_XML_INTERFACE_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

© 2025 Coveralls, Inc