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 namespace Ioss {
43 using IntVector = std::vector<int>;
44 using Int64Vector = std::vector<int64_t>;
45 using NameList = std::vector<std::string>;
46 using IJK_t = std::array<int, 3>;
47 } // namespace Ioss
48
49 inline const std::string IOSS_SCALAR() { return std::string("scalar"); }
50 inline const std::string IOSS_VECTOR_2D() { return std::string("vector_2d"); }
51 inline const std::string IOSS_VECTOR_3D() { return std::string("vector_3d"); }
52 inline const std::string IOSS_SYM_TENSOR() { return std::string("sym_tensor_33"); }
53
54 #if defined(BUILT_IN_SIERRA)
55 #define SEACAS_HAVE_MPI
56 /* #undef IOSS_THREADSAFE */
57 /* #undef SEACAS_HAVE_KOKKOS */
58 /* #undef SEACAS_HAVE_DATAWAREHOUSE */
59 #define SEACAS_HAVE_EXODUS
60 #define SEACAS_HAVE_CGNS
61 #define SEACAS_HAVE_PAMGEN
62 #define PARALLEL_AWARE_EXODUS
63 #else
64 #include <SEACASIoss_config.h>
65 #endif
66
67 #if defined(PARALLEL_AWARE_EXODUS)
68 #ifndef SEACAS_HAVE_MPI
69 #define SEACAS_HAVE_MPI
70 #endif
71 #endif
72
73 #if defined(IOSS_THREADSAFE)
74 #include <mutex>
75 #endif
76
77 #if defined(SEACAS_HAVE_MPI)
78 #include <mpi.h>
79 #define PAR_UNUSED(x)
80 #else
81 #define PAR_UNUSED(x) \
82 do { \
83 (void)(x); \
84 } while (0)
85
86 #ifndef MPI_COMM_WORLD
87 #define MPI_COMM_WORLD 0
88 using MPI_Comm = int;
89 #endif
90 #endif
91
92 #ifdef SEACAS_HAVE_KOKKOS
93 #include <Kokkos_Core.hpp> // for Kokkos::complex
94 #endif
95
96 #include <complex>
97 #if defined(FOUR_BYTE_REAL)
98 //'FOUR_BYTE_REAL' is a sierra macro which may or may not be defined
99 // when this header is compiled...
100 // If FOUR_BYTE_REAL is defined then we know we need float, otherwise
101 // stick with double.
102 using Complex = std::complex<float>;
103 #ifdef SEACAS_HAVE_KOKKOS
104 using Kokkos_Complex = Kokkos::complex<float>;
105 #endif
106 #else
107 using Complex = std::complex<double>;
108 #ifdef SEACAS_HAVE_KOKKOS
109 using Kokkos_Complex = Kokkos::complex<double>;
110 #endif
111 #endif
112 #endif
113
114 #if defined(IOSS_THREADSAFE)
115 #define IOSS_FUNC_ENTER(m) std::lock_guard<std::mutex> guard(m)
116 #else
117
118 #if defined IOSS_TRACE
119 #include <Ioss_Tracer.h>
120 #define IOSS_FUNC_ENTER(m) Ioss::Tracer m(__func__)
121 #else
122 #define IOSS_FUNC_ENTER(m)
123 #endif
124 #endif
125
126 #ifndef IOSS_DEBUG_OUTPUT
127 #define IOSS_DEBUG_OUTPUT 0
128 #endif
Ioss::NameList
std::vector< std::string > NameList
Definition: Ioss_CodeTypes.h:45
Ioss
The main namespace for the Ioss library.
Definition: Ioad_DatabaseIO.C:66
IOSS_VECTOR_2D
const std::string IOSS_VECTOR_2D()
Definition: Ioss_CodeTypes.h:50
Ioss::IntVector
std::vector< int > IntVector
Definition: Ioss_CodeTypes.h:43
IOSS_SCALAR
const std::string IOSS_SCALAR()
Definition: Ioss_CodeTypes.h:49
IOSS_SYM_TENSOR
const std::string IOSS_SYM_TENSOR()
Definition: Ioss_CodeTypes.h:52
Ioss_Tracer.h
Complex
std::complex< double > Complex
Definition: Ioss_CodeTypes.h:107
Ioss::IJK_t
std::array< int, 3 > IJK_t
Definition: Ioss_CodeTypes.h:46
IOSS_VECTOR_3D
const std::string IOSS_VECTOR_3D()
Definition: Ioss_CodeTypes.h:51
Ioss::Int64Vector
std::vector< int64_t > Int64Vector
Definition: Ioss_CodeTypes.h:44
MPI_Comm
int MPI_Comm
Definition: Ioss_CodeTypes.h:88