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

Open-Sn / opensn / 25359736025

04 May 2026 04:34PM UTC coverage: 75.416% (-0.001%) from 75.417%
25359736025

push

github

web-flow
Merge pull request #1038 from quocdang1998/sycl-mod

Extend SYCL implementation for caribou and OpenSn

21817 of 28929 relevant lines covered (75.42%)

65645385.67 hits per line

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

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

4
#include "framework/object_factory.h"
5
#include "framework/logging/log.h"
6

7
namespace opensn
8
{
9

10
ObjectFactory&
11
ObjectFactory::GetInstance() noexcept
23,577✔
12
{
13
  static ObjectFactory singleton;
23,577✔
14
  return singleton;
23,577✔
15
}
16

17
const std::map<std::string, ObjectFactory::ObjectRegistryEntry>&
18
ObjectFactory::GetRegistry() const
×
19
{
20
  return object_registry_;
×
21
}
22

23
bool
24
ObjectFactory::RegistryHasKey(const std::string& key) const
19,575✔
25
{
26
  return object_registry_.count(key) > 0;
19,575✔
27
}
28

29
InputParameters
30
ObjectFactory::GetRegisteredObjectParameters(const std::string& type) const
×
31
{
32
  auto iter = object_registry_.find(type);
×
33
  OpenSnInvalidArgumentIf(iter == object_registry_.end(),
×
34
                          "Object type \"" + type + "\" is not registered in ObjectFactory.");
35

36
  const auto& reg_entry = iter->second;
×
37

38
  return reg_entry.get_in_params_func();
×
39
}
40

41
void
42
ObjectFactory::DumpRegister() const
×
43
{
44
  log.Log() << "\n\n";
×
45
  for (const auto& [key, entry] : object_registry_)
×
46
  {
47
    if (log.GetVerbosity() == 0)
×
48
    {
49
      log.Log() << key;
×
50
      continue;
×
51
    }
52

53
    log.Log() << "OBJECT_BEGIN " << key;
×
54

55
    if (entry.get_in_params_func == nullptr)
×
56
      log.Log() << "NOT_CONSTRUCTIBLE";
×
57
    else
58
    {
59
      const auto in_params = entry.get_in_params_func();
×
60
      in_params.DumpParameters();
×
61
    }
×
62

63
    log.Log() << "OBJECT_END\n\n";
×
64
  }
65
  log.Log() << "\n\n";
×
66
}
×
67

68
void
69
ObjectFactory::AssertRegistryKeyAvailable(const std::string& key,
19,575✔
70
                                          const std::string& calling_function) const
71
{
72
  if (RegistryHasKey(key))
19,575✔
73
    OpenSnLogicalError(calling_function + ": Attempted to register Object \"" + key +
×
74
                       "\" but an object with the same name is already registered.");
75
}
19,575✔
76

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