WRApplication
External kratos "application" for multiscale time integration.
IntervalUtility.hpp
Go to the documentation of this file.
1 
3 #pragma once
4 
5 // --- Core Includes ---
6 #include "includes/define.h"
7 #include "includes/kratos_parameters.h"
8 
9 
10 namespace Kratos::WRApp {
11 
12 namespace Impl {
13 
14 
19 
24 template <class TValue>
25 class KRATOS_API(WR_APPLICATION) IntervalUtility
26 {
27 public:
28 
30 
33 
57  IntervalUtility(Parameters Settings);
58 
59  IntervalUtility(IntervalUtility&& rOther) = default;
60 
61  IntervalUtility(const IntervalUtility& rOther) = default;
62 
63  TValue GetIntervalBegin() const noexcept;
64 
65  TValue GetIntervalEnd() const noexcept;
66 
68  bool IsInInterval(TValue Value) const noexcept;
69 
70  static Parameters GetDefaultParameters();
71 
73  std::string Info() const;
74 
76  void PrintInfo(std::ostream& rOStream) const;
77 
79  void PrintData(std::ostream& rOStream) const;
80 
81 private:
90  void SetBoundaries(TValue begin, TValue end) noexcept;
91 
92  TValue mBegin;
93 
94  TValue mEnd;
95 };
96 
97 
99 template <class TValue>
100 std::ostream& operator << (std::ostream& rOStream, const IntervalUtility<TValue>& rThis)
101 {
102  rThis.PrintInfo(rOStream);
103  rOStream << " : ";
104  rThis.PrintData(rOStream);
105  return rOStream;
106 }
107 
108 
111 
112 
113 } // namespace Impl
114 
115 
120 
123 
126 
127 
130 
131 } // namespace Kratos
Utility class for membership tests on a 1D interval.
Definition: IntervalUtility.hpp:26
IntervalUtility(IntervalUtility &&rOther)=default
TValue GetIntervalBegin() const noexcept
KRATOS_CLASS_POINTER_DEFINITION(IntervalUtility)
IntervalUtility(const IntervalUtility &rOther)=default
IntervalUtility(Parameters Settings)
Construct from parameters containing "interval".
IntervalUtility()
Default constructor initializing boundaries to "Begin" and "End".
Definition: MPIUtils.hpp:9
Definition: CheckpointID.hpp:68