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