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

Member Typedef Documentation

◆ const_iterator

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

Definition at line 187 of file MFEMContainers.h.

◆ MapType

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

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

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

Referenced by MFEMProblem::addVariable().

◆ createTimeDerivativeName()

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

Definition at line 234 of file MFEMContainers.h.

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

◆ getTimeDerivativeName()

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

Definition at line 210 of file MFEMContainers.h.

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

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

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

◆ hasTimeDerivative()

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

Definition at line 205 of file MFEMContainers.h.

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

◆ isTimeDerivative()

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

Definition at line 195 of file MFEMContainers.h.

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

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

Referenced by getTimeDerivativeName(), and getTimeIntegralName().


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