ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
TimeInterpolatedData Struct Reference

#include <ERF_TimeInterpolatedData.H>

Collaboration diagram for TimeInterpolatedData:

Public Member Functions

 TimeInterpolatedData ()=default
 
 TimeInterpolatedData (double time)
 
 ~TimeInterpolatedData ()
 
 TimeInterpolatedData (TimeInterpolatedData &&other) noexcept
 
TimeInterpolatedData & operator= (TimeInterpolatedData &&other) noexcept
 
 TimeInterpolatedData (const TimeInterpolatedData &other)=delete
 
TimeInterpolatedData & operator= (const TimeInterpolatedData &other)=delete
 
void set_time (double time)
 
double get_time () const
 
void add_var (amrex::MultiFab *var_data, int own_data)
 
amrex::MultiFab & get_var (int var_idx)
 
int num_vars ()
 
void clear ()
 

Private Attributes

amrex::Vector< amrex::MultiFab * > m_data
 
amrex::Vector< int > m_owns_data
 
double m_time = 0.0
 

Constructor & Destructor Documentation

◆ TimeInterpolatedData() [1/4]

TimeInterpolatedData::TimeInterpolatedData ( )
default

Construct empty time-interpolated data storage.

◆ TimeInterpolatedData() [2/4]

TimeInterpolatedData::TimeInterpolatedData ( double  time)
inline

Construct storage associated with a time.

Parameters
[in]timetime associated with the data
21 : m_time(time) {}
double m_time
Definition: ERF_TimeInterpolatedData.H:136

◆ ~TimeInterpolatedData()

TimeInterpolatedData::~TimeInterpolatedData ( )
inline

Destroy owned data and clear internal storage.

26  {
27  clear();
28  }
void clear()
Definition: ERF_TimeInterpolatedData.H:118
Here is the call graph for this function:

◆ TimeInterpolatedData() [3/4]

TimeInterpolatedData::TimeInterpolatedData ( TimeInterpolatedData &&  other)
inlinenoexcept

Move constructor: takes over the source's data and ownership, leaving it empty.

Parameters
[in]othersource object
36  : m_data(std::move(other.m_data)),
37  m_owns_data(std::move(other.m_owns_data)),
38  m_time(other.m_time)
39  {
40  other.m_data.clear();
41  other.m_owns_data.clear();
42  }
amrex::Vector< int > m_owns_data
Definition: ERF_TimeInterpolatedData.H:135
amrex::Vector< amrex::MultiFab * > m_data
Definition: ERF_TimeInterpolatedData.H:134

◆ TimeInterpolatedData() [4/4]

TimeInterpolatedData::TimeInterpolatedData ( const TimeInterpolatedData &  other)
delete

Deleted copy constructor.

Parameters
[in]othersource object

Member Function Documentation

◆ add_var()

void TimeInterpolatedData::add_var ( amrex::MultiFab *  var_data,
int  own_data 
)
inline

Add a MultiFab pointer to the managed list.

Parameters
[in]var_dataMultiFab pointer to store
[in]own_datawhether this object owns and deletes var_data
96  {
97  m_data.push_back(var_data);
98  m_owns_data.push_back(own_data);
99  }

◆ clear()

void TimeInterpolatedData::clear ( )
inline

Clear stored data, deleting entries owned by this object.

118  {
119  // clear all data owned by this object
120  for (int i = 0; i < num_vars(); ++i) {
121  if (m_owns_data[i] == 1) {
122  m_data[i]->clear();
123  delete m_data[i];
124  }
125  }
126 
127  // clear internal memory
128  m_data.clear();
129  m_owns_data.clear();
130  m_time = 0.0;
131  }
int num_vars()
Definition: ERF_TimeInterpolatedData.H:113

Referenced by operator=(), and ~TimeInterpolatedData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_time()

double TimeInterpolatedData::get_time ( ) const
inline

Return the time associated with the data.

88 { return m_time; }

◆ get_var()

amrex::MultiFab& TimeInterpolatedData::get_var ( int  var_idx)
inline

Return one stored MultiFab.

Parameters
[in]var_idxindex of the stored MultiFab
106  {
107  return *m_data[var_idx];
108  }

◆ num_vars()

int TimeInterpolatedData::num_vars ( )
inline

Return the number of stored MultiFabs.

113 { return m_data.size(); }

Referenced by clear().

Here is the caller graph for this function:

◆ operator=() [1/2]

TimeInterpolatedData& TimeInterpolatedData::operator= ( const TimeInterpolatedData &  other)
delete

Deleted copy-assignment operator.

Parameters
[in]othersource object

◆ operator=() [2/2]

TimeInterpolatedData& TimeInterpolatedData::operator= ( TimeInterpolatedData &&  other)
inlinenoexcept

Move-assignment operator: frees the data this object owns, then takes over the source's data and ownership, leaving it empty.

Parameters
[in]othersource object
50  {
51  if (this != &other) {
52  clear();
53  m_data = std::move(other.m_data);
54  m_owns_data = std::move(other.m_owns_data);
55  m_time = other.m_time;
56  other.m_data.clear();
57  other.m_owns_data.clear();
58  }
59  return *this;
60  }
Here is the call graph for this function:

◆ set_time()

void TimeInterpolatedData::set_time ( double  time)
inline

Set the time associated with the data.

Parameters
[in]timetime associated with the data
81  {
82  m_time = time;
83  }

Member Data Documentation

◆ m_data

amrex::Vector<amrex::MultiFab*> TimeInterpolatedData::m_data
private

◆ m_owns_data

amrex::Vector<int> TimeInterpolatedData::m_owns_data
private

Referenced by add_var(), clear(), and operator=().

◆ m_time

double TimeInterpolatedData::m_time = 0.0
private

Referenced by clear(), get_time(), operator=(), and set_time().


The documentation for this struct was generated from the following file: