| 1 |
// Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions |
| 2 |
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
// NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
// |
| 5 |
// See packages/seacas/LICENSE for details |
| 6 |
|
| 7 |
#include "Ioss_DBUsage.h" // for DatabaseUsage |
| 8 |
#include "Ioss_IOFactory.h" // for IOFactory |
| 9 |
#include <catalyst/Iocatalyst_DatabaseIO.h> |
| 10 |
#include <catalyst/Iocatalyst_IOFactory.h> |
| 11 |
#include <cstddef> // for nullptr |
| 12 |
#include <string> // for string |
| 13 |
|
| 14 |
#include <catalyst.hpp> |
| 15 |
#include <fmt/ostream.h> |
| 16 |
|
| 17 |
namespace Ioss { |
| 18 |
class PropertyManager; |
| 19 |
} |
| 20 |
|
| 21 |
namespace Iocatalyst { |
| 22 |
|
| 23 |
const IOFactory *IOFactory::factory() |
| 24 |
{ |
| 25 |
static IOFactory registerThis; |
| 26 |
return ®isterThis; |
| 27 |
} |
| 28 |
|
| 29 |
IOFactory::IOFactory() : Ioss::IOFactory("catalyst") |
| 30 |
{ |
| 31 |
Ioss::IOFactory::alias("catalyst", "catalyst2"); |
| 32 |
Ioss::IOFactory::alias("catalyst", "catalyst_conduit"); |
| 33 |
} |
| 34 |
|
| 35 |
Ioss::DatabaseIO *IOFactory::make_IO(const std::string &filename, Ioss::DatabaseUsage db_usage, |
| 36 |
Ioss_MPI_Comm communicator, |
| 37 |
const Ioss::PropertyManager &properties) const |
| 38 |
{ |
| 39 |
return new DatabaseIO(nullptr, filename, db_usage, communicator, properties); |
| 40 |
} |
| 41 |
|
| 42 |
std::string IOFactory::show_config() const |
| 43 |
{ |
| 44 |
std::stringstream config; |
| 45 |
fmt::print(config, "\tCatalyst Library Version: {}\n", CATALYST_VERSION); |
| 46 |
fmt::print(config, "\t\tCatalyst ABI Version: {}\n", CATALYST_ABI_VERSION); |
| 47 |
|
| 48 |
conduit_cpp::Node node; |
| 49 |
catalyst_about(conduit_cpp::c_node(&node)); |
| 50 |
auto implementation = node.has_path("catalyst/implementation") |
| 51 |
? node["catalyst/implementation"].as_string() |
| 52 |
: std::string("stub"); |
| 53 |
fmt::print(config, "\t\tImplementation: {}\n\n", implementation.c_str()); |
| 54 |
return config.str(); |
| 55 |
} |
| 56 |
} // namespace Iocatalyst |