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 178 of file MFEMContainers.h.

Member Typedef Documentation

◆ const_iterator

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

Definition at line 182 of file MFEMContainers.h.

◆ MapType

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

Definition at line 181 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 184 of file MFEMContainers.h.

Referenced by MFEMProblem::addVariable().

186  {
187  _field_map.emplace(var_name, time_derivative_var_name);
188  }

◆ createTimeDerivativeName()

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

Definition at line 229 of file MFEMContainers.h.

230  {
231  return std::string("d") + std::string(name) + std::string("_dt");
232  }

◆ getTimeDerivativeName()

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

Definition at line 205 of file MFEMContainers.h.

206  {
207  auto it = _field_map.find(var_name);
208  if (it != _field_map.end())
209  return it->second;
210  else
211  {
212  mooseError("No variable representing the time derivative of ", var_name, " found.");
213  return null_str;
214  }
215  }
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 217 of file MFEMContainers.h.

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

218  {
219  for (auto const & [map_var_name, map_time_derivative_var_name] : _field_map)
220  {
221  if (map_time_derivative_var_name == time_derivative_var_name)
222  return map_var_name;
223  }
224  mooseError(
225  "No variable representing the time integral of ", time_derivative_var_name, " found.");
226  return null_str;
227  }
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 200 of file MFEMContainers.h.

201  {
202  return _field_map.count(var_name);
203  }

◆ isTimeDerivative()

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

Definition at line 190 of file MFEMContainers.h.

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

191  {
192  for (auto const & [map_var_name, map_time_derivative_var_name] : _field_map)
193  {
194  if (map_time_derivative_var_name == time_derivative_var_name)
195  return true;
196  }
197  return false;
198  }

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 236 of file MFEMContainers.h.

Referenced by getTimeDerivativeName().


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