Debian Codegraph @

packages/seacas/libraries/ioss/src/main/io_info_main.C

raw
1 /*
2 * Copyright(C) 1999-2020, 2023, 2024 National Technology & Engineering Solutions
3 * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
4 * NTESS, the U.S. Government retains certain rights in this software.
5 *
6 * See packages/seacas/LICENSE for details
7 */
8
9 #include <fmt/core.h>
10 #include <ostream>
11 #include <stdlib.h>
12 #include <string>
13
14 #include "Ionit_Initializer.h"
15 #include "Ioss_IOFactory.h"
16 #include "Ioss_ScopeGuard.h"
17 #include "Ioss_Utils.h"
18 #include "info_interface.h"
19 #include "io_info.h"
20
21 // ========================================================================
22
23 namespace {
24 std::string codename;
25 std::string version = "1.07 (2024/11/08)";
26
27 #ifdef SEACAS_HAVE_MPI
28 void mpi_finalize()
29 {
30 MPI_Comm parentcomm;
31 MPI_Comm_get_parent(&parentcomm);
32 if (parentcomm != MPI_COMM_NULL) {
33 int istatus = EXIT_SUCCESS;
34 MPI_Send(&istatus, 1, MPI_INT, 0, 0, parentcomm);
35 }
36 MPI_Finalize();
37 }
38 #endif
39 } // namespace
40
41 int main(int argc, char *argv[])
42 {
43 #ifdef SEACAS_HAVE_MPI
44 MPI_Init(&argc, &argv);
45 ON_BLOCK_EXIT(mpi_finalize);
46 #endif
47
48 Info::Interface interFace(version);
49 interFace.parse_options(argc, argv);
50
51 Ioss::Init::Initializer io;
52
53 if (interFace.show_config()) {
54 Ioss::OUTPUT() << "\n" << Ioss::IOFactory::show_configuration();
55 exit(EXIT_SUCCESS);
56 }
57
58 codename = argv[0];
59 size_t ind = codename.find_last_of('/', codename.size());
60 if (ind != std::string::npos) {
61 codename = codename.substr(ind + 1, codename.size());
62 }
63
64 if (interFace.list_change_sets()) {
65 Ioss::io_info_change_set_info(interFace);
66 }
67 else {
68 Ioss::io_info_file_info(interFace);
69 }
70
71 fmt::print("\n{} execution successful.\n", codename);
72 return EXIT_SUCCESS;
73 }