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

Member Typedef Documentation

◆ const_iterator

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

Definition at line 198 of file MFEMContainers.h.

◆ MapType

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

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

Referenced by MFEMProblem::addVariable().

202  {
203  _field_map.emplace(var_name, time_derivative_var_name);
204  }

◆ createTimeDerivativeName()

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

Definition at line 245 of file MFEMContainers.h.

246  {
247  return std::string("d") + std::string(name) + std::string("_dt");
248  }

◆ getTimeDerivativeName()

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

Definition at line 221 of file MFEMContainers.h.

Referenced by Moose::MFEM::TimeDependentEquationSystem::ApplyEssentialBCs(), Moose::MFEM::TimeDependentEquationSystem::BuildBilinearForms(), Moose::MFEM::TimeDependentEquationSystem::BuildMixedBilinearForms(), and Moose::MFEM::TimeDependentEquationSystem::SetTrialVariableNames().

222  {
223  auto it = _field_map.find(var_name);
224  if (it != _field_map.end())
225  return it->second;
226  else
227  {
228  mooseError("No variable representing the time derivative of ", var_name, " found.");
229  return null_str;
230  }
231  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323

◆ getTimeIntegralName()

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

Definition at line 233 of file MFEMContainers.h.

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

234  {
235  for (auto const & [map_var_name, map_time_derivative_var_name] : _field_map)
236  {
237  if (map_time_derivative_var_name == time_derivative_var_name)
238  return map_var_name;
239  }
240  mooseError(
241  "No variable representing the time integral of ", time_derivative_var_name, " found.");
242  return null_str;
243  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323

◆ hasTimeDerivative()

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

Definition at line 216 of file MFEMContainers.h.

217  {
218  return _field_map.count(var_name);
219  }

◆ isTimeDerivative()

bool Moose::MFEM::TimeDerivativeMap::isTimeDerivative ( 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 true;
212  }
213  return false;
214  }

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

Referenced by getTimeDerivativeName().


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