https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
Moose::MFEM::TimeDerivativeMap Class Reference

Lightweight adaptor over a std::map relating names of GridFunctions with the name of their time derivatives. More...

#include <MFEMContainers.h>

Public Types

using MapType = std::map< std::string, std::string >
 
using const_iterator = typename MapType::const_iterator
 

Public Member Functions

void addTimeDerivativeAssociation (const std::string &var_name, const std::string &time_derivative_var_name)
 
bool isTimeDerivative (const std::string &time_derivative_var_name) const
 
bool hasTimeDerivative (const std::string &var_name) const
 
const std::string & getTimeDerivativeName (const std::string &var_name) const
 
const std::string & getTimeIntegralName (const std::string &time_derivative_var_name) const
 

Static Public Member Functions

static std::string createTimeDerivativeName (std::string_view name)
 

Private Attributes

MapType _field_map
 
const std::string null_str
 

Detailed Description

Lightweight adaptor over a std::map relating names of GridFunctions with the name of their time derivatives.

Definition at line 167 of file MFEMContainers.h.

Member Typedef Documentation

◆ const_iterator

using Moose::MFEM::TimeDerivativeMap::const_iterator = typename MapType::const_iterator

Definition at line 171 of file MFEMContainers.h.

◆ MapType

using Moose::MFEM::TimeDerivativeMap::MapType = std::map<std::string, std::string>

Definition at line 170 of file MFEMContainers.h.

Member Function Documentation

◆ addTimeDerivativeAssociation()

void Moose::MFEM::TimeDerivativeMap::addTimeDerivativeAssociation ( const std::string &  var_name,
const std::string &  time_derivative_var_name 
)
inline

Definition at line 173 of file MFEMContainers.h.

Referenced by MFEMProblem::addVariable().

175  {
176  _field_map.emplace(var_name, time_derivative_var_name);
177  }

◆ createTimeDerivativeName()

static std::string Moose::MFEM::TimeDerivativeMap::createTimeDerivativeName ( std::string_view  name)
inlinestatic

Definition at line 218 of file MFEMContainers.h.

219  {
220  return std::string("d") + std::string(name) + std::string("_dt");
221  }

◆ getTimeDerivativeName()

const std::string& Moose::MFEM::TimeDerivativeMap::getTimeDerivativeName ( const std::string &  var_name) const
inline

Definition at line 194 of file MFEMContainers.h.

195  {
196  auto it = _field_map.find(var_name);
197  if (it != _field_map.end())
198  return it->second;
199  else
200  {
201  mooseError("No variable representing the time derivative of ", var_name, " found.");
202  return null_str;
203  }
204  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311

◆ getTimeIntegralName()

const std::string& Moose::MFEM::TimeDerivativeMap::getTimeIntegralName ( const std::string &  time_derivative_var_name) const
inline

Definition at line 206 of file MFEMContainers.h.

Referenced by Moose::MFEM::TimeDependentEquationSystem::AddKernel().

207  {
208  for (auto const & [map_var_name, map_time_derivative_var_name] : _field_map)
209  {
210  if (map_time_derivative_var_name == time_derivative_var_name)
211  return map_var_name;
212  }
213  mooseError(
214  "No variable representing the time integral of ", time_derivative_var_name, " found.");
215  return null_str;
216  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311

◆ hasTimeDerivative()

bool Moose::MFEM::TimeDerivativeMap::hasTimeDerivative ( const std::string &  var_name) const
inline

Definition at line 189 of file MFEMContainers.h.

190  {
191  return _field_map.count(var_name);
192  }

◆ isTimeDerivative()

bool Moose::MFEM::TimeDerivativeMap::isTimeDerivative ( const std::string &  time_derivative_var_name) const
inline

Definition at line 179 of file MFEMContainers.h.

Referenced by Moose::MFEM::TimeDependentEquationSystem::AddKernel().

180  {
181  for (auto const & [map_var_name, map_time_derivative_var_name] : _field_map)
182  {
183  if (map_time_derivative_var_name == time_derivative_var_name)
184  return true;
185  }
186  return false;
187  }

Member Data Documentation

◆ _field_map

MapType Moose::MFEM::TimeDerivativeMap::_field_map
private

◆ null_str

const std::string Moose::MFEM::TimeDerivativeMap::null_str
private

Definition at line 225 of file MFEMContainers.h.

Referenced by getTimeDerivativeName().


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