https://mooseframework.inl.gov
Loading...
Searching...
No Matches
DerivativeMaterialPropertyNameInterface.C
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
11
12#include <sstream>
13#include <algorithm>
14
15const MaterialPropertyName
17 const MaterialPropertyName & base, const std::vector<SymbolName> & c) const
18{
19 // to obtain well defined names we sort alphabetically
20 std::vector<SymbolName> a(c);
21 std::sort(a.begin(), a.end());
22
23 // derivative order
24 unsigned int order = a.size();
25 if (order == 0)
26 return base;
27
28 // build the property name as a stringstream
29 std::stringstream name;
30
31 // build numerator
32 name << 'd';
33 if (order > 1)
34 name << '^' << order;
35 name << base << '/';
36
37 // build denominator with 'pretty' names using exponents rather than repeat multiplication
38 unsigned int exponent = 1;
39 for (unsigned i = 1; i <= order; ++i)
40 {
41 if (i == order || a[i - 1] != a[i])
42 {
43 name << 'd' << a[i - 1];
44 if (exponent > 1)
45 name << '^' << exponent;
46 exponent = 1;
47 }
48 else
49 exponent++;
50 }
51
52 return name.str();
53}
54
55const MaterialPropertyName
57 const MaterialPropertyName & base, const SymbolName & c1) const
58{
59 return "d" + base + "/d" + c1;
60}
61
62const MaterialPropertyName
64 const MaterialPropertyName & base, const SymbolName & c1, const SymbolName & c2) const
65{
66 return derivativePropertyName(base, {c1, c2});
67}
68
69const MaterialPropertyName
71 const MaterialPropertyName & base,
72 const SymbolName & c1,
73 const SymbolName & c2,
74 const SymbolName & c3) const
75{
76 return derivativePropertyName(base, {c1, c2, c3});
77}
const MaterialPropertyName derivativePropertyNameThird(const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
Helper functions to generate the material property names for the third derivatives.
const MaterialPropertyName derivativePropertyNameSecond(const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
Helper functions to generate the material property names for the second derivatives.
const MaterialPropertyName derivativePropertyNameFirst(const MaterialPropertyName &base, const SymbolName &c1) const
Helper functions to generate the material property names for the first derivatives.
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.