www.mooseframework.org
DerivativeMaterialPropertyNameInterface.C
Go to the documentation of this file.
2 
3 #include <sstream>
4 #include <algorithm>
5 
6 const MaterialPropertyName
7 DerivativeMaterialPropertyNameInterface::propertyName(const MaterialPropertyName & base,
8  const std::vector<VariableName> & c) const
9 {
10  // to obtain well defined names we sort alphabetically
11  std::vector<VariableName> a(c);
12  std::sort(a.begin(), a.end());
13 
14  // derivative order
15  unsigned int order = a.size();
16  if (order == 0)
17  return base;
18 
19  // build the property name as a stringstream
20  std::stringstream name;
21 
22  // build numerator
23  name << 'd';
24  if (order > 1)
25  name << '^' << order;
26  name << base << '/';
27 
28  // build denominator with 'pretty' names using exponents rather than repeat multiplication
29  unsigned int exponent = 1;
30  for (unsigned i = 1; i <= order; ++i)
31  {
32  if (i == order || a[i - 1] != a[i])
33  {
34  name << 'd' << a[i - 1];
35  if (exponent > 1)
36  name << '^' << exponent;
37  exponent = 1;
38  }
39  else
40  exponent++;
41  }
42 
43  return name.str();
44 }
45 
46 const MaterialPropertyName
48  const VariableName & c1) const
49 {
50  return "d" + base + "/d" + c1;
51 }
52 
53 const MaterialPropertyName
55  const VariableName & c1,
56  const VariableName & c2) const
57 {
58  return propertyName(base, {c1, c2});
59 }
60 
61 const MaterialPropertyName
63  const VariableName & c1,
64  const VariableName & c2,
65  const VariableName & c3) const
66 {
67  return propertyName(base, {c1, c2, c3});
68 }
const MaterialPropertyName propertyNameSecond(const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2) const
Helper functions to generate the material property names for the second derivatives.
const MaterialPropertyName propertyNameThird(const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2, const VariableName &c3) const
Helper functions to generate the material property names for the third derivatives.
const MaterialPropertyName propertyName(const MaterialPropertyName &base, const std::vector< VariableName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.
const MaterialPropertyName propertyNameFirst(const MaterialPropertyName &base, const VariableName &c1) const
Helper functions to generate the material property names for the first derivatives.