42 #ifndef dimensionedConstants_H 43 #define dimensionedConstants_H 75 if (unitDict.found(
group))
82 if (groupDict.
found(varName))
84 return groupDict.
get<
T>(varName);
88 groupDict.
add(varName, defaultValue);
95 unitDict.subDict(
group).add(varName, defaultValue);
103 #define defineDimensionedConstant(Group,Switch,Tag,Name) \ 104 const Foam::dimensionedScalar Switch; \ 105 class add##Tag##ToDimensionedConstant \ 107 public Foam::simpleRegIOobject \ 110 add##Tag##ToDimensionedConstant(const char* name) \ 112 Foam::simpleRegIOobject \ 113 (Foam::debug::addDimensionedConstantObject,name) \ 115 Foam::dimensionedScalar ds \ 117 Foam::dimensionedConstant \ 123 Foam::dimensionedScalar& s = const_cast<Foam::dimensionedScalar&> \ 127 s.dimensions().reset(ds.dimensions()); \ 130 virtual ~add##Tag##ToDimensionedConstant() = default; \ 131 virtual void readData(Foam::Istream& is) \ 133 const_cast<Foam::dimensionedScalar&>(Switch) = \ 134 Foam::dimensionedConstant \ 140 virtual void writeData(Foam::Ostream& os) const \ 145 add##Tag##ToDimensionedConstant add##Tag##ToDimensionedConstant_(Name) 149 #define defineDimensionedConstantWithDefault\ 150 (Group,Switch,DefaultExpr,Tag,Name) \ 151 const Foam::dimensionedScalar Switch; \ 152 class add##Tag##ToDimensionedConstantWithDefault \ 154 public Foam::simpleRegIOobject \ 157 add##Tag##ToDimensionedConstantWithDefault(const char* name) \ 159 Foam::simpleRegIOobject \ 160 (Foam::debug::addDimensionedConstantObject,name) \ 162 Foam::dimensionedScalar ds \ 164 Foam::dimensionedConstant \ 168 Foam::dimensionedScalar(Name,DefaultExpr) \ 171 Foam::dimensionedScalar& s = const_cast<Foam::dimensionedScalar&> \ 175 s.dimensions().reset(ds.dimensions()); \ 178 virtual ~add##Tag##ToDimensionedConstantWithDefault() = default; \ 179 virtual void readData(Foam::Istream& is) \ 181 const_cast<Foam::dimensionedScalar&>(Switch) = \ 182 Foam::dimensionedConstant \ 186 Foam::dimensionedScalar(Name,DefaultExpr) \ 189 virtual void writeData(Foam::Ostream& os) const \ 194 add##Tag##ToDimensionedConstantWithDefault \ 195 add##Tag##ToDimensionedConstantWithDefault_(Name)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
dictionary & dimensionedConstants()
constexpr const char *const group
Group name for atomic constants.
A class for handling words, derived from Foam::string.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
const HashTable< dimensionedScalar > & unitSet()
Set of all dimensions.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensionedScalar dimensionedConstant(const word &group, const word &varName)