GEOS
RestartFlags.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 Total, S.A
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_DATAREPOSITORY_RESTARTFLAGS_HPP_
21 #define GEOS_DATAREPOSITORY_RESTARTFLAGS_HPP_
22 
23 #include "common/logger/Logger.hpp"
24 
25 namespace geos
26 {
27 namespace dataRepository
28 {
29 
35 enum class RestartFlags : integer
36 {
37  NO_WRITE,
38  WRITE,
40 };
41 
47 enum class PlotLevel : integer
48 {
49  LEVEL_0,
50  LEVEL_1,
51  LEVEL_2,
52  LEVEL_3,
53  NOPLOT
54 };
55 
61 inline PlotLevel toPlotLevel( int const val )
62 {
63  switch( val )
64  {
65  case static_cast< int >( PlotLevel::LEVEL_0 ):
66  {
67  return PlotLevel::LEVEL_0;
68  }
69  case static_cast< int >( PlotLevel::LEVEL_1 ):
70  {
71  return PlotLevel::LEVEL_1;
72  }
73  case static_cast< int >( PlotLevel::LEVEL_2 ):
74  {
75  return PlotLevel::LEVEL_2;
76  }
77  case static_cast< int >( PlotLevel::LEVEL_3 ):
78  {
79  return PlotLevel::LEVEL_3;
80  }
81  case static_cast< int >( PlotLevel::NOPLOT ):
82  {
83  return PlotLevel::NOPLOT;
84  }
85  default:
86  {
87  GEOS_ERROR( "Could not parse " << val << " into a PlotLevel." );
88  return PlotLevel::NOPLOT;
89  }
90  }
91 }
92 
99 inline
100 std::istream & operator>>( std::istream & is, PlotLevel & plotLevel )
101 {
102  int value;
103  is >> value;
104  plotLevel = toPlotLevel( value );
105  return is;
106 }
107 
114 inline
115 std::ostream & operator<<( std::ostream & os, PlotLevel const & plotLevel )
116 { return os << static_cast< int >( plotLevel ); }
117 
118 }
119 }
120 
121 #endif /* GEOS_DATAREPOSITORY_RESTARTFLAGS_HPP_ */
#define GEOS_ERROR(msg)
Raise a hard error and terminate the program.
Definition: Logger.hpp:157
@ 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:82