ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_EBIF.H
Go to the documentation of this file.
1 #ifndef ERF_EB_IF_H_
2 #define ERF_EB_IF_H_
3 
4 using namespace amrex;
5 
6 /********************************************************************************
7  * *
8  * Union of a list (std::vector) of the same kind of implicit function. *
9  * *
10  ********************************************************************************/
11 template <class F>
12 class UnionListIF {
13 
14 public:
15 
16  UnionListIF (const Vector<F> & a_ifs)
17  : m_ifs(a_ifs)
18  {
19  m_empty = ! a_ifs.empty();
20  }
21 
23 
24  UnionListIF (const UnionListIF & rhs) = default;
25  UnionListIF (UnionListIF && rhs) = default;
26  UnionListIF & operator= (const UnionListIF & rhs) = default;
27  UnionListIF & operator= (UnionListIF && rhs) = default;
28 
29  bool is_empty () const {return m_empty;}
30 
31  Real operator() (const RealArray & p) const {
32 
33  // NOTE: this assumes that m_ifs is not empty
34  Real vmax=m_ifs[0](p);
35  for (int i=1; i< m_ifs.size(); i++) {
36  Real vcur = m_ifs[i](p);
37  if ( vmax < vcur ) vmax = vcur;
38  }
39 
40  return vmax;
41  }
42 
43 private:
44 
45  Vector<F> m_ifs;
46  bool m_empty;
47 };
48 
49 #endif
Definition: ERF_EBIF.H:12
bool is_empty() const
Definition: ERF_EBIF.H:29
UnionListIF(UnionListIF &&rhs)=default
Vector< F > m_ifs
Definition: ERF_EBIF.H:45
UnionListIF(const UnionListIF &rhs)=default
bool m_empty
Definition: ERF_EBIF.H:46
UnionListIF(const Vector< F > &a_ifs)
Definition: ERF_EBIF.H:16
~UnionListIF()
Definition: ERF_EBIF.H:22
Definition: ERF_ConsoleIO.cpp:12