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

Open-Sn / opensn / 18928565313

22 Oct 2025 07:55PM UTC coverage: 74.771%. Remained the same
18928565313

push

github

web-flow
Merge pull request #807 from wdhawkins/clang-tidy-init-variables

Fixing clang-tidy init-variables warnings

132 of 179 new or added lines in 52 files covered. (73.74%)

184 existing lines in 3 files now uncovered.

18203 of 24345 relevant lines covered (74.77%)

53868061.69 hits per line

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

0.0
/framework/field_functions/interpolation/ffinter_point.cc
1
// SPDX-FileCopyrightText: 2024 The OpenSn Authors <https://open-sn.github.io/opensn/>
2
// SPDX-License-Identifier: MIT
3

4
#include "framework/field_functions/interpolation/ffinter_point.h"
5

6
#include "framework/field_functions/field_function_grid_based.h"
7
#include "framework/math/spatial_discretization/spatial_discretization.h"
8
#include "framework/mesh/mesh_continuum/mesh_continuum.h"
9
#include "framework/logging/log.h"
10
#include "framework/runtime.h"
11

12
namespace opensn
13
{
14

15
std::shared_ptr<FieldFunctionInterpolationPoint>
UNCOV
16
FieldFunctionInterpolationPoint::Create()
×
17
{
UNCOV
18
  auto ffi = std::make_shared<FieldFunctionInterpolationPoint>();
×
19
  field_func_interpolation_stack.emplace_back(ffi);
×
20
  return ffi;
×
21
}
×
22

23
void
UNCOV
24
FieldFunctionInterpolationPoint::Initialize()
×
25
{
UNCOV
26
  log.Log0Verbose1() << "Initializing point interpolator.";
×
27

28
  // Check for empty FF-list
UNCOV
29
  if (field_functions_.empty())
×
30
    throw std::logic_error("Unassigned field function in point field function interpolator.");
×
31

UNCOV
32
  const auto& grid = field_functions_.front()->GetSpatialDiscretization().GetGrid();
×
33
  std::vector<uint64_t> cells_potentially_owning_point;
×
34
  for (const auto& cell : grid->local_cells)
×
35
  {
UNCOV
36
    const auto& vcc = cell.centroid;
×
37
    const auto& poi = point_of_interest_;
×
38
    const auto nudged_point = poi + 1.0e-6 * (vcc - poi);
×
39
    if (grid->CheckPointInsideCell(cell, nudged_point))
×
40
      cells_potentially_owning_point.push_back(cell.global_id);
×
41
  }
42

UNCOV
43
  std::vector<uint64_t> recvbuf;
×
44
  mpi_comm.all_gather(cells_potentially_owning_point, recvbuf);
×
45

UNCOV
46
  if (recvbuf.empty())
×
47
  {
UNCOV
48
    throw std::logic_error("FieldFunctionInterpolationPoint::Initialize: No cell identified "
×
49
                           "containing the specified point.");
×
50
  }
51

UNCOV
52
  uint64_t owning_cell_gid = recvbuf.front();
×
53
  for (const uint64_t gid : recvbuf)
×
54
    owning_cell_gid = std::min(owning_cell_gid, gid);
×
55
  locally_owned_ = false;
×
56
  for (const uint64_t gid : cells_potentially_owning_point)
×
57
  {
UNCOV
58
    if (gid == owning_cell_gid)
×
59
    {
UNCOV
60
      locally_owned_ = true;
×
61
      owning_cell_gid_ = owning_cell_gid;
×
62
      break;
×
63
    }
64
  }
UNCOV
65
}
×
66

67
void
UNCOV
68
FieldFunctionInterpolationPoint::Execute()
×
69
{
UNCOV
70
  if (not locally_owned_)
×
71
    return;
×
72

UNCOV
73
  const auto& ref_ff = *field_functions_.front();
×
74
  const auto& sdm = ref_ff.GetSpatialDiscretization();
×
75
  const auto& grid = sdm.GetGrid();
×
76

UNCOV
77
  const auto& uk_man = ref_ff.GetUnknownManager();
×
78
  const auto uid = 0;
×
79
  const auto cid = ref_component_;
×
80

UNCOV
81
  const auto field_data = ref_ff.GetGhostedFieldVector();
×
82

UNCOV
83
  const auto& cell = grid->cells[owning_cell_gid_];
×
84
  const auto& cell_mapping = sdm.GetCellMapping(cell);
×
85
  const size_t num_nodes = cell_mapping.GetNumNodes();
×
86

UNCOV
87
  std::vector<double> node_dof_values(num_nodes, 0.0);
×
88
  for (size_t i = 0; i < num_nodes; ++i)
×
89
  {
UNCOV
90
    const auto imap = sdm.MapDOFLocal(cell, i, uk_man, uid, cid);
×
91
    node_dof_values[i] = field_data[imap];
×
92
  }
93

UNCOV
94
  Vector<double> shape_values(num_nodes, 0.0);
×
95
  cell_mapping.ShapeValues(point_of_interest_, shape_values);
×
96
  point_value_ = 0.0;
×
97
  for (size_t i = 0; i < num_nodes; ++i)
×
98
    point_value_ += node_dof_values[i] * shape_values(i);
×
99
}
×
100

101
double
UNCOV
102
FieldFunctionInterpolationPoint::GetPointValue() const
×
103
{
NEW
104
  double global_point_value = 0.0;
×
105
  mpi_comm.all_reduce(point_value_, global_point_value, mpi::op::sum<double>());
×
106
  return global_point_value;
×
107
}
108

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