GEOSX
RestartFlags.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 TotalEnergies
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
15 #ifndef GEOS_DATAREPOSITORY_RESTARTFLAGS_HPP_
16 #define GEOS_DATAREPOSITORY_RESTARTFLAGS_HPP_
17 
22 namespace geos
23 {
24 namespace dataRepository
25 {
26 
32 enum class RestartFlags : integer
33 {
34  NO_WRITE,
35  WRITE,
37 };
38 
44 enum class PlotLevel : integer
45 {
46  LEVEL_0,
47  LEVEL_1,
48  LEVEL_2,
49  LEVEL_3,
50  NOPLOT
51 };
52 
58 inline PlotLevel toPlotLevel( int const val )
59 {
60  switch( val )
61  {
62  case static_cast< int >( PlotLevel::LEVEL_0 ):
63  {
64  return PlotLevel::LEVEL_0;
65  }
66  case static_cast< int >( PlotLevel::LEVEL_1 ):
67  {
68  return PlotLevel::LEVEL_1;
69  }
70  case static_cast< int >( PlotLevel::LEVEL_2 ):
71  {
72  return PlotLevel::LEVEL_2;
73  }
74  case static_cast< int >( PlotLevel::LEVEL_3 ):
75  {
76  return PlotLevel::LEVEL_3;
77  }
78  case static_cast< int >( PlotLevel::NOPLOT ):
79  {
80  return PlotLevel::NOPLOT;
81  }
82  default:
83  {
84  GEOS_ERROR( "Could not parse " << val << " into a PlotLevel." );
85  return PlotLevel::NOPLOT;
86  }
87  }
88 }
89 
96 inline
97 std::istream & operator>>( std::istream & is, PlotLevel & plotLevel )
98 {
99  int value;
100  is >> value;
101  plotLevel = toPlotLevel( value );
102  return is;
103 }
104 
111 inline
112 std::ostream & operator<<( std::ostream & os, PlotLevel const & plotLevel )
113 { return os << static_cast< int >( plotLevel ); }
114 
115 }
116 }
117 
118 #endif /* GEOS_DATAREPOSITORY_RESTARTFLAGS_HPP_ */
#define GEOS_ERROR(msg)
Raise a hard error and terminate the program.
Definition: Logger.hpp:122
@ NOPLOT
Do not ever write to plot file.
@ LEVEL_3
Write to plot when plotLevel>=3 is specified in input.
@ LEVEL_0
Write to plot always.
@ LEVEL_2
Write to plot when plotLevel>=2 is specified in input.
@ LEVEL_1
Write to plot when plotLevel>=1 is specified in input.
std::istream & operator>>(std::istream &is, PlotLevel &plotLevel)
Reads a PlotLevel enum from a stream.
std::ostream & operator<<(std::ostream &os, PlotLevel const &plotLevel)
Writes a plot level to a stream.
PlotLevel toPlotLevel(int const val)
Function to get a PlotLevel enum from an int.
@ WRITE_AND_READ
Write and read from restart.
@ NO_WRITE
Do not write into restart.
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122