IOSS 2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Ioss_CodeTypes.h
Go to the documentation of this file.
1// Copyright(C) 1999-2025 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#pragma once
8
9#include <array>
10#include <cstddef>
11#include <cstdint>
12#include <string>
13#include <vector>
14
15#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || \
16 defined(__MINGW32__) || defined(_WIN64) || defined(__MINGW64__)
17#define __IOSS_WINDOWS__ 1
18#endif
19
20namespace Ioss {
21 using IntVector = std::vector<int>;
22 using Int64Vector = std::vector<int64_t>;
23 using NameList = std::vector<std::string>;
24 using IJK_t = std::array<int, 3>;
25} // namespace Ioss
26
27inline std::string IOSS_SCALAR() { return {"scalar"}; }
28inline std::string IOSS_VECTOR_2D() { return {"vector_2d"}; }
29inline std::string IOSS_VECTOR_3D() { return {"vector_3d"}; }
30inline std::string IOSS_SYM_TENSOR() { return {"sym_tensor_33"}; }
31
32#if __has_include("SEACASIoss_config.h")
33// This is a CMake build
34#include "SEACASIoss_config.h"
35#else
36// This is not a CMake build
37#define SEACAS_HAVE_MPI
38/* #undef IOSS_THREADSAFE */
39/* #undef SEACAS_HAVE_KOKKOS */
40#define SEACAS_HAVE_EXODUS
41#define SEACAS_HAVE_EXONULL
42#define SEACAS_HAVE_CGNS
43/* #undef SEACAS_HAVE_FAODEL */
44#define SEACAS_HAVE_PAMGEN
45#endif
46
47#if defined(IOSS_THREADSAFE)
48#include <mutex>
49#endif
50
51#if (__cplusplus >= 201703L)
52#define IOSS_MAYBE_UNUSED [[maybe_unused]]
53#define IOSS_NODISCARD [[nodiscard]]
54#else
55#define IOSS_MAYBE_UNUSED
56#define IOSS_NODISCARD
57#endif
58
59#if defined(SEACAS_HAVE_MPI)
60#include <mpi.h>
61using Ioss_MPI_Comm = MPI_Comm;
62#define IOSS_PAR_UNUSED(x)
63#define ADIOS2_USE_MPI 1
64#else
65using Ioss_MPI_Comm = int;
66#if (__cplusplus >= 201703L)
67// For C++17, we rely on IOSS_MAYBE_UNUSED instead. Can eventually remove all IOSS_PAR_UNUSED...
68#define IOSS_PAR_UNUSED(x)
69#else
70#define IOSS_PAR_UNUSED(x) \
71 do { \
72 (void)(x); \
73 } while (0)
74#endif
75#endif
76
77#ifdef SEACAS_HAVE_KOKKOS
78#include <Kokkos_Core.hpp> // for Kokkos::complex
79#endif
80
81#include <complex>
82#if defined(FOUR_BYTE_REAL)
83//'FOUR_BYTE_REAL' is a sierra macro which may or may not be defined
84// when this header is compiled...
85// If FOUR_BYTE_REAL is defined then we know we need float, otherwise
86// stick with double.
87using Complex = std::complex<float>;
88#ifdef SEACAS_HAVE_KOKKOS
89using Kokkos_Complex = Kokkos::complex<float>;
90#endif
91#else
92using Complex = std::complex<double>;
93#ifdef SEACAS_HAVE_KOKKOS
94using Kokkos_Complex = Kokkos::complex<double>;
95#endif
96#endif
97
98#if defined(IOSS_THREADSAFE)
99#define IOSS_FUNC_ENTER(m) std::lock_guard<std::mutex> guard(m)
100#else
101
102#if defined IOSS_TRACE
103#include "Ioss_Tracer.h"
104#define IOSS_FUNC_ENTER(m) Ioss::Tracer m(__func__)
105#else
106#define IOSS_FUNC_ENTER(m)
107#endif
108#endif
109
110#ifndef IOSS_DEBUG_OUTPUT
111#define IOSS_DEBUG_OUTPUT 0
112#endif
113
114// For use to create a no-op get or put_field_internal function...
115#define IOSS_NOOP_GFI(type) \
116 int64_t get_field_internal(const type *, const Ioss::Field &, void *, size_t) const override \
117 { \
118 return -1; \
119 }
120#define IOSS_NOOP_PFI(type) \
121 int64_t put_field_internal(const type *, const Ioss::Field &, void *, size_t) const override \
122 { \
123 return -1; \
124 }
std::string IOSS_VECTOR_2D()
Definition Ioss_CodeTypes.h:28
std::complex< double > Complex
Definition Ioss_CodeTypes.h:92
MPI_Comm Ioss_MPI_Comm
Definition Ioss_CodeTypes.h:61
std::string IOSS_SCALAR()
Definition Ioss_CodeTypes.h:27
std::string IOSS_SYM_TENSOR()
Definition Ioss_CodeTypes.h:30
std::string IOSS_VECTOR_3D()
Definition Ioss_CodeTypes.h:29
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40
std::vector< int64_t > Int64Vector
Definition Ioss_CodeTypes.h:22
std::vector< int > IntVector
Definition Ioss_CodeTypes.h:21
Ioss::NameList NameList
Definition Ioss_ChangeSetFactory.h:25
std::array< int, 3 > IJK_t
Definition Ioss_CodeTypes.h:24