https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMFunctorMaterial.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#ifdef MOOSE_MFEM_ENABLED
11
12#pragma once
13
14#include "MFEMObject.h"
17#include "CoefficientManager.h"
18
22{
23public:
25
27 virtual ~MFEMFunctorMaterial();
28
29protected:
33 template <typename T>
34 std::vector<T> processLiterals(const std::vector<T> & input);
35
37};
38
39template <typename T>
40std::vector<T>
41MFEMFunctorMaterial::processLiterals(const std::vector<T> & input)
42{
43 std::vector<T> result;
44 bool in_literal = false;
45 T literal;
46 for (const auto & item : input)
47 {
48 if (in_literal)
49 {
50 if (item.front() == '{')
51 mooseError("Nested numeric values are not permitted in ", type(), " prop_values.");
52 else if (item.back() == '}')
53 {
54 in_literal = false;
55 literal += " " + item.substr(0, item.size() - 1);
56 result.push_back(literal);
57 }
58 else
59 literal += " " + item;
60 }
61 else if (item.front() == '{')
62 {
63 if (item.back() == '}')
64 result.push_back(item.substr(1, item.size() - 2));
65 else
66 {
67 in_literal = true;
68 literal = item.substr(1);
69 }
70 }
71 else
72 result.push_back(item);
73 }
74 if (in_literal)
75 mooseError("No closing curly brace for value in ", type(), " prop_values: '{", literal, "'");
76 return result;
77}
78
79#endif
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Base class for construction of an object that is restricted to a subset of subdomains of the problem ...
Base class for construction of an object that is restricted to a subset of boundaries of the problem ...
std::vector< T > processLiterals(const std::vector< T > &input)
Group numerical literal values, which should each be enclosed in curly braces, into single entries of...
Moose::MFEM::CoefficientManager & _properties
static InputParameters validParams()
Thin base for MFEM objects backed directly by MooseObject instead of UserObject.
Definition MFEMObject.h:30
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
const std::string & type() const
Get the type of this class.
Definition MooseBase.h:93
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition MooseBase.h:271
Front-end class for creating and storing MFEM coefficients.