IOSS 2.0

Ioss_CodeTypes.h
Go to the documentation of this file.
1 // Copyright(C) 1999-2017 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 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following
14 // disclaimer in the documentation and/or other materials provided
15 // with the distribution.
16 //
17 // * Neither the name of NTESS nor the names of its
18 // contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 #ifndef IOSS_code_types_h
34 #define IOSS_code_types_h
35
36 #include <array>
37 #include <cstddef>
38 #include <cstdint>
39 #include <string>
40 #include <vector>
41
42 #if defined(_MSC_VER)
43 #ifdef _WIN64
44 #define ssize_t __int64
45 #else
46 #define ssize_t long
47 #endif
48 #endif
49
50 namespace Ioss {
51 using IntVector = std::vector<int>;
52 using Int64Vector = std::vector<int64_t>;
53 using NameList = std::vector<std::string>;
54 using IJK_t = std::array<int, 3>;
55 } // namespace Ioss
56
57 inline const std::string IOSS_SCALAR() { return std::string("scalar"); }
58 inline const std::string IOSS_VECTOR_2D() { return std::string("vector_2d"); }
59 inline const std::string IOSS_VECTOR_3D() { return std::string("vector_3d"); }
60 inline const std::string IOSS_SYM_TENSOR() { return std::string("sym_tensor_33"); }
61
62 #if defined(BUILT_IN_SIERRA)
63 #define SEACAS_HAVE_MPI
64 /* #undef IOSS_THREADSAFE */
65 /* #undef SEACAS_HAVE_KOKKOS */
66 /* #undef SEACAS_HAVE_DATAWAREHOUSE */
67 #define SEACAS_HAVE_EXODUS
68 #define SEACAS_HAVE_CGNS
69 #define SEACAS_HAVE_PAMGEN
70 #define PARALLEL_AWARE_EXODUS
71 #else
72 #include <SEACASIoss_config.h>
73 #endif
74
75 #if defined(PARALLEL_AWARE_EXODUS)
76 #ifndef SEACAS_HAVE_MPI
77 #define SEACAS_HAVE_MPI
78 #endif
79 #endif
80
81 #if defined(IOSS_THREADSAFE)
82 #include <mutex>
83 #endif
84
85 #if defined(SEACAS_HAVE_MPI)
86 #include <mpi.h>
87 #define PAR_UNUSED(x)
88 #else
89 #define PAR_UNUSED(x) \
90 do { \
91 (void)(x); \
92 } while (0)
93
94 #ifndef MPI_COMM_WORLD
95 #define MPI_COMM_WORLD 0
96 using MPI_Comm = int;
97 #endif
98 #endif
99
100 #ifdef SEACAS_HAVE_KOKKOS
101 #include <Kokkos_Core.hpp> // for Kokkos::complex
102 #endif
103
104 #include <complex>
105 #if defined(FOUR_BYTE_REAL)
106 //'FOUR_BYTE_REAL' is a sierra macro which may or may not be defined
107 // when this header is compiled...
108 // If FOUR_BYTE_REAL is defined then we know we need float, otherwise
109 // stick with double.
110 using Complex = std::complex<float>;
111 #ifdef SEACAS_HAVE_KOKKOS
112 using Kokkos_Complex = Kokkos::complex<float>;
113 #endif
114 #else
115 using Complex = std::complex<double>;
116 #ifdef SEACAS_HAVE_KOKKOS
117 using Kokkos_Complex = Kokkos::complex<double>;
118 #endif
119 #endif
120 #endif
121
122 #if defined(IOSS_THREADSAFE)
123 #define IOSS_FUNC_ENTER(m) std::lock_guard<std::mutex> guard(m)
124 #else
125
126 #if defined IOSS_TRACE
127 #include <Ioss_Tracer.h>
128 #define IOSS_FUNC_ENTER(m) Ioss::Tracer m(__func__)
129 #else
130 #define IOSS_FUNC_ENTER(m)
131 #endif
132 #endif
133
134 #ifndef IOSS_DEBUG_OUTPUT
135 #define IOSS_DEBUG_OUTPUT 0
136 #endif
Ioss::NameList
std::vector< std::string > NameList
Definition: Ioss_CodeTypes.h:53
Complex
std::complex< double > Complex
Definition: Ioss_CodeTypes.h:115
Ioss::IntVector
std::vector< int > IntVector
Definition: Ioss_CodeTypes.h:51
IOSS_VECTOR_3D
const std::string IOSS_VECTOR_3D()
Definition: Ioss_CodeTypes.h:59
IOSS_SYM_TENSOR
const std::string IOSS_SYM_TENSOR()
Definition: Ioss_CodeTypes.h:60
Ioss
The main namespace for the Ioss library.
Definition: Ioad_DatabaseIO.C:66
Ioss::Int64Vector
std::vector< int64_t > Int64Vector
Definition: Ioss_CodeTypes.h:52
IOSS_SCALAR
const std::string IOSS_SCALAR()
Definition: Ioss_CodeTypes.h:57
Ioss::IJK_t
std::array< int, 3 > IJK_t
Definition: Ioss_CodeTypes.h:54
Ioss_Tracer.h
MPI_Comm
int MPI_Comm
Definition: Ioss_CodeTypes.h:96
IOSS_VECTOR_2D
const std::string IOSS_VECTOR_2D()
Definition: Ioss_CodeTypes.h:58