https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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 182 of file MFEMContainers.h.

Member Typedef Documentation

◆ const_iterator

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

Definition at line 186 of file MFEMContainers.h.

◆ MapType

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

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

190 {
191 _field_map.emplace(var_name, time_derivative_var_name);
192 }

Referenced by MFEMProblem::addVariable().

◆ createTimeDerivativeName()

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

Definition at line 233 of file MFEMContainers.h.

234 {
235 return std::string("d") + std::string(name) + std::string("_dt");
236 }

◆ getTimeDerivativeName()

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

Definition at line 209 of file MFEMContainers.h.

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

222 {
223 for (auto const & [map_var_name, map_time_derivative_var_name] : _field_map)
224 {
225 if (map_time_derivative_var_name == time_derivative_var_name)
226 return map_var_name;
227 }
229 "No variable representing the time integral of ", time_derivative_var_name, " found.");
230 return null_str;
231 }

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

◆ hasTimeDerivative()

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

Definition at line 204 of file MFEMContainers.h.

205 {
206 return _field_map.count(var_name);
207 }

◆ isTimeDerivative()

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

Definition at line 194 of file MFEMContainers.h.

195 {
196 for (auto const & [map_var_name, map_time_derivative_var_name] : _field_map)
197 {
198 if (map_time_derivative_var_name == time_derivative_var_name)
199 return true;
200 }
201 return false;
202 }

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

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

Referenced by getTimeDerivativeName(), and getTimeIntegralName().


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