www.mooseframework.org
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Legendre Class Referencefinal

This class provides the algorithms and properties of the Legendre polynomial series. More...

#include <Legendre.h>

Inheritance diagram for Legendre:
[legend]

Public Member Functions

 Legendre ()
 
 Legendre (const std::vector< MooseEnum > &domain, const std::vector< std::size_t > &order, MooseEnum expansion_type, MooseEnum generation_type)
 
virtual Real getStandardizedFunctionVolume () const override
 Returns the volume within the standardized function local_limits. More...
 
virtual bool isInPhysicalBounds (const Point &point) const override
 Determines if the point provided is in within the physical bounds. More...
 
virtual std::size_t calculatedNumberOfTermsBasedOnOrder (const std::vector< std::size_t > &order) const override
 Returns the number of terms in the single series given a value for the order. More...
 
virtual const std::vector< Real > & getStandardizedFunctionLimits () const override
 Returns a vector of the lower and upper bounds of the standard functional space. More...
 
virtual bool isCacheInvalid () const final
 Whether the cached values correspond to the current point. More...
 
virtual void setLocation (const Point &point) final
 Set the location that will be used by the series to compute values. More...
 
virtual void setOrder (const std::vector< std::size_t > &orders) final
 Set the order of the series. More...
 
virtual void setPhysicalBounds (const std::vector< Real > &bounds) final
 Sets the bounds of the series. More...
 
std::size_t getOrder (std::size_t domain) const
 Returns the order of the particular domain index. More...
 
Real operator[] (std::size_t index) const
 Returns the current evaluation at the given index. More...
 
const std::vector< Real > & getAllGeneration ()
 Returns an array reference containing the value of each generation term. More...
 
const std::vector< Real > & getAllExpansion ()
 Returns an array reference containing the value of each expansion term. More...
 
std::size_t getNumberOfTerms () const
 Returns the number of terms in the series. More...
 
Real getGeneration ()
 Gets the last term of the generation functional basis. More...
 
Real getGenerationSeriesSum ()
 Gets the sum of all terms in the generation functional basis. More...
 
Real getExpansion ()
 Gets the #_order-th term of the expansion functional basis. More...
 
Real getExpansionSeriesSum ()
 Evaluates the sum of all terms in the expansion functional basis up to #_order. More...
 
bool isGeneration () const
 Returns true if the current evaluation is generation. More...
 
bool isExpansion () const
 Returns true if the current evaluation is expansion. More...
 

Public Attributes

const std::vector< MooseEnum > _domains
 An ordered list of the x, y, and/or z domains needed by the functional basis to convert a point to a standardized location. More...
 

Static Public Attributes

static MooseEnum _domain_options
 An enumeration of the domains available to each functional series. More...
 

Protected Member Functions

virtual void evaluateOrthonormal ()
 Evaluates the orthonormal form of the basis functions. More...
 
virtual void evaluateStandard ()
 Evaluates the standard form of the basis functions. More...
 
virtual void evaluateSqrtMu ()
 Evaluates the 1/sqrt(mu) normalized form of the basis functions. More...
 
virtual void checkPhysicalBounds (const std::vector< Real > &bounds) const override
 Checks the physical bounds according to the actual implementation. More...
 
virtual std::vector< Real > getStandardizedLocation (const std::vector< Real > &location) const override
 Standardize the location according to the requirements of the underlying basis, which may actually convert the Cartesian coordinates into a more suitable system. More...
 
virtual void evaluateGeneration () override
 Evaluate the generation form of the functional basis. More...
 
virtual void evaluateExpansion () override
 Evaluate the expansion form of the functional basis. More...
 
std::vector< Real > extractLocationFromPoint (const Point &point) const
 Convert a spatial point to a location that the series will use to determine the value at which to evaluate the series. More...
 
virtual void clearBasisEvaluation (const unsigned int &number_of_terms)
 Set all entries of the basis evaluation to zero. More...
 
Real load (std::size_t index) const
 Helper function to load a value from #_series. More...
 
void save (std::size_t index, Real value)
 Helper function to store a value in #_series. More...
 

Protected Attributes

std::vector< std::size_t > _orders
 The order of the series. More...
 
std::vector< Real > _physical_bounds
 The physical bounds of the series. More...
 
std::vector< Real > _standardized_location
 The standardized location of evaluation. More...
 
std::function< void()> _evaluateExpansionWrapper
 The expansion evaluation wrapper. More...
 
std::function< void()> _evaluateGenerationWrapper
 The generation evaluation wrapper. More...
 
unsigned int _number_of_terms
 The number of terms in the series. More...
 

Private Member Functions

virtual void clearBasisEvaluation (const unsigned int &number_of_terms)
 Set all entries of the basis evaluation to zero. More...
 

Private Attributes

bool _are_physical_bounds_specified
 Flag for if the physical bounds are specified for this series. More...
 
std::vector< Real > _location
 The domain locations of the current evaluation. More...
 
bool _is_cache_invalid
 indicates if the evaluated values correspond to the current location More...
 
std::vector< Real > _basis_evaluation
 Stores the values of the basis evaluation. More...
 
bool _is_generation
 Indicates whether the current evaluation is expansion or generation. More...
 

Detailed Description

This class provides the algorithms and properties of the Legendre polynomial series.

Definition at line 17 of file Legendre.h.

Constructor & Destructor Documentation

◆ Legendre() [1/2]

Legendre::Legendre ( )

Definition at line 19 of file Legendre.C.

◆ Legendre() [2/2]

Legendre::Legendre ( const std::vector< MooseEnum > &  domain,
const std::vector< std::size_t > &  order,
MooseEnum  expansion_type,
MooseEnum  generation_type 
)

Definition at line 21 of file Legendre.C.

26 {
27  if (expansion_type == "orthonormal")
28  _evaluateExpansionWrapper = [this]() { this->evaluateOrthonormal(); };
29  else if (expansion_type == "sqrt_mu")
30  _evaluateExpansionWrapper = [this]() { this->evaluateSqrtMu(); };
31  else if (expansion_type == "standard")
32  _evaluateExpansionWrapper = [this]() { this->evaluateStandard(); };
33  else
34  mooseError("The specified type of normalization for expansion does not exist");
35 
36  if (generation_type == "orthonormal")
37  _evaluateGenerationWrapper = [this]() { this->evaluateOrthonormal(); };
38  else if (generation_type == "sqrt_mu")
39  _evaluateGenerationWrapper = [this]() { this->evaluateSqrtMu(); };
40  else if (generation_type == "standard")
41  _evaluateGenerationWrapper = [this]() { this->evaluateStandard(); };
42  else
43  mooseError("The specified type of normalization for generation does not exist");
44 }

Member Function Documentation

◆ calculatedNumberOfTermsBasedOnOrder()

std::size_t Legendre::calculatedNumberOfTermsBasedOnOrder ( const std::vector< std::size_t > &  order) const
overridevirtual

Returns the number of terms in the single series given a value for the order.

Implements SingleSeriesBasisInterface.

Definition at line 47 of file Legendre.C.

48 {
49  return order[0] + 1;
50 }

◆ checkPhysicalBounds()

void Legendre::checkPhysicalBounds ( const std::vector< Real > &  bounds) const
overrideprotectedvirtual

Checks the physical bounds according to the actual implementation.

Implements SingleSeriesBasisInterface.

Definition at line 53 of file Legendre.C.

54 {
55  // Each Legendre series should have a min and max bound
56  if (bounds.size() != 2)
57  mooseError("Legend: Invalid number of bounds specified for single series!");
58 }

◆ clearBasisEvaluation() [1/2]

void FunctionalBasisInterface::clearBasisEvaluation
privateinherited

Set all entries of the basis evaluation to zero.

Definition at line 144 of file FunctionalBasisInterface.C.

145 {
146  _basis_evaluation.assign(number_of_terms, 0.0);
147  _basis_evaluation.shrink_to_fit();
148 }

◆ clearBasisEvaluation() [2/2]

void FunctionalBasisInterface::clearBasisEvaluation ( const unsigned int &  number_of_terms)
protectedvirtualinherited

Set all entries of the basis evaluation to zero.

Definition at line 144 of file FunctionalBasisInterface.C.

145 {
146  _basis_evaluation.assign(number_of_terms, 0.0);
147  _basis_evaluation.shrink_to_fit();
148 }

Referenced by FunctionalBasisInterface::getAllExpansion(), FunctionalBasisInterface::getAllGeneration(), CompositeSeriesBasisInterface::setNumberOfTerms(), and SingleSeriesBasisInterface::setOrder().

◆ evaluateExpansion()

void SingleSeriesBasisInterface::evaluateExpansion ( )
overrideprotectedvirtualinherited

Evaluate the expansion form of the functional basis.

Implements FunctionalBasisInterface.

Definition at line 57 of file SingleSeriesBasisInterface.C.

58 {
60 }

◆ evaluateGeneration()

void SingleSeriesBasisInterface::evaluateGeneration ( )
overrideprotectedvirtualinherited

Evaluate the generation form of the functional basis.

Implements FunctionalBasisInterface.

Definition at line 51 of file SingleSeriesBasisInterface.C.

52 {
54 }

◆ evaluateOrthonormal()

void Legendre::evaluateOrthonormal ( )
protectedvirtual

Evaluates the orthonormal form of the basis functions.

Definition at line 61 of file Legendre.C.

62 {
63  std::size_t k;
64  const Real & x = _standardized_location[0];
65  const Real x2 = x * x;
66 
67  /*
68  * Use direct formula to efficiently evaluate the polynomials for n <= 12
69  *
70  * The performance benefit diminishes for higher n. It is expected that the cost of the direct
71  * calculation nears that of the recurrence relation in the neighborhood of n == 15, although this
72  * theory is untested due to only implementing the direct calculations up to n == 12.
73  *
74  * If you want to calculate the higher-order Legendre Coefficients and code them in then be my
75  * guest.
76  */
77  // clang-format off
78  switch (_orders[0])
79  {
80  default:
81  case MAX_DIRECT_CALCULATION_LEGENDRE: /* 12 */
82  save(12, ((((((676039 * x2 - 1939938) * x2 + 2078505) * x2 - 1021020) * x2 + 225225) * x2 - 18018) * x2 + 231) / 1024
83  * 12.5);
84  libmesh_fallthrough();
85 
86  case 11:
87  save(11, (((((88179 * x2 - 230945) * x2 + 218790) * x2 - 90090) * x2 + 15015) * x2 - 693) * x / 256
88  * 11.5);
89  libmesh_fallthrough();
90 
91  case 10:
92  save(10, (((((46189 * x2 - 109395) * x2 + 90090) * x2 - 30030) * x2 + 3465) * x2 - 63) / 256
93  * 10.5);
94  libmesh_fallthrough();
95 
96  case 9:
97  save(9, ((((12155 * x2 - 25740) * x2 + 18018) * x2 - 4620) * x2 + 315) * x / 128
98  * 9.5);
99  libmesh_fallthrough();
100 
101  case 8:
102  save(8, ((((6435 * x2 - 12012) * x2 + 6930) * x2 - 1260) * x2 + 35) / 128
103  * 8.5);
104  libmesh_fallthrough();
105 
106  case 7:
107  save(7, (((429 * x2 - 693) * x2 + 315) * x2 - 35) * x / 16
108  * 7.5);
109  libmesh_fallthrough();
110 
111  case 6:
112  save(6, (((231 * x2 - 315) * x2 + 105) * x2 - 5) / 16
113  * 6.5);
114  libmesh_fallthrough();
115 
116  case 5:
117  save(5, ((63 * x2 - 70) * x2 + 15) * x / 8
118  * 5.5);
119  libmesh_fallthrough();
120 
121  case 4:
122  save(4, ((35 * x2 - 30) * x2 + 3) / 8
123  * 4.5);
124  libmesh_fallthrough();
125 
126  case 3:
127  save(3, (5 * x2 - 3) * x / 2
128  * 3.5);
129  libmesh_fallthrough();
130 
131  case 2:
132  save(2, (3 * x2 - 1) / 2
133  * 2.5);
134  libmesh_fallthrough();
135 
136  case 1:
137  save(1, x
138  * 1.5);
139  libmesh_fallthrough();
140 
141  case 0:
142  save(0, 1
143  * 0.5);
144  }
145  // clang-format on
146 
147  /*
148  * Evaluate any remaining polynomials.
149  *
150  * The original recurrence relation is:
151  * (2 * k - 1) * x * L_(k-1) - (k - 1) * L_(k-2)
152  * L_k = ---------------------------------------------
153  * k
154  *
155  * However, for FXs we are using a the orthonormalized version of the polynomials, so each
156  * polynomial L_k is multiplied by:
157  * (2 * k + 1)
158  * ----------- essentially: k + 0.5
159  * 2
160  * Reversing this in the previous polynomials and implementing for the current polynomial results
161  * in the orthonormalized recurrence:
162  * (2 * k + 1) / (k - 1) \
163  * L_k = ----------- * | x * L_(k-1) - ----------- * L_(k-2) |
164  * k \ (2 * k - 3) /
165  *
166  * The options are 1) to use this form, or 2) to not apply the orthonormalization at first, and
167  * then loop through all the values in a second loop and then apply the orthonormalization.
168  */
169  for (k = MAX_DIRECT_CALCULATION_LEGENDRE + 1; k <= _orders[0]; ++k)
170  save(k, ((k + k + 1) / Real(k)) * (x * load(k - 1) - ((k - 1) / (k + k - 3.0)) * load(k - 2)));
171 }

Referenced by Legendre().

◆ evaluateSqrtMu()

void Legendre::evaluateSqrtMu ( )
protectedvirtual

Evaluates the 1/sqrt(mu) normalized form of the basis functions.

Definition at line 259 of file Legendre.C.

260 {
262  for (size_t i = 0; i < getNumberOfTerms(); ++i)
263  save(i, load(i) * std::sqrt(i + 0.5));
264 }

Referenced by Legendre().

◆ evaluateStandard()

void Legendre::evaluateStandard ( )
protectedvirtual

Evaluates the standard form of the basis functions.

Definition at line 174 of file Legendre.C.

175 {
176  std::size_t k;
177  const Real x = _standardized_location[0];
178  const Real x2 = x * x;
179 
180  /*
181  * Use direct formula to efficiently evaluate the polynomials for n <= 12
182  *
183  * The performance benefit diminishes for higher n. It is expected that the cost of the direct
184  * calculation nears that of the recurrence relation in the neighborhood of n == 15, although this
185  * theory is untested due to only implementing the direct calculations up to n == 12.
186  *
187  * If you want to calculate the higher-order Legendre Coefficients and
188  * code them in then be my guest.
189  */
190  // clang-format off
191  switch (_orders[0])
192  {
193  default:
194  case MAX_DIRECT_CALCULATION_LEGENDRE: /* 12 */
195  save(12, ((((((676039 * x2 - 1939938) * x2 + 2078505) * x2 - 1021020) * x2 + 225225) * x2 - 18018) * x2 + 231) / 1024);
196  libmesh_fallthrough();
197 
198  case 11:
199  save(11, (((((88179 * x2 - 230945) * x2 + 218790) * x2 - 90090) * x2 + 15015) * x2 - 693) * x / 256);
200  libmesh_fallthrough();
201 
202  case 10:
203  save(10, (((((46189 * x2 - 109395) * x2 + 90090) * x2 - 30030) * x2 + 3465) * x2 - 63) / 256);
204  libmesh_fallthrough();
205 
206  case 9:
207  save(9, ((((12155 * x2 - 25740) * x2 + 18018) * x2 - 4620) * x2 + 315) * x / 128);
208  libmesh_fallthrough();
209 
210  case 8:
211  save(8, ((((6435 * x2 - 12012) * x2 + 6930) * x2 - 1260) * x2 + 35) / 128);
212  libmesh_fallthrough();
213 
214  case 7:
215  save(7, (((429 * x2 - 693) * x2 + 315) * x2 - 35) * x / 16);
216  libmesh_fallthrough();
217 
218  case 6:
219  save(6, (((231 * x2 - 315) * x2 + 105) * x2 - 5) / 16);
220  libmesh_fallthrough();
221 
222  case 5:
223  save(5, ((63 * x2 - 70) * x2 + 15) * x / 8);
224  libmesh_fallthrough();
225 
226  case 4:
227  save(4, ((35 * x2 - 30) * x2 + 3) / 8);
228  libmesh_fallthrough();
229 
230  case 3:
231  save(3, (5 * x2 - 3) * x / 2);
232  libmesh_fallthrough();
233 
234  case 2:
235  save(2, (3 * x2 - 1) / 2);
236  libmesh_fallthrough();
237 
238  case 1:
239  save(1, x);
240  libmesh_fallthrough();
241 
242  case 0:
243  save(0, 1);
244  }
245  // clang-format on
246 
247  /*
248  * Evaluate any remaining polynomials.
249  * The recurrence relation is:
250  * (2 * k - 1) * x * L_(k-1) - (k - 1) * L_(k-2)
251  * L_k = ---------------------------------------------
252  * k
253  */
254  for (k = MAX_DIRECT_CALCULATION_LEGENDRE + 1; k <= _orders[0]; ++k)
255  save(k, (((2 * k - 1) * x * load(k - 1)) - ((k - 1) * load(k - 2))) / Real(k));
256 }

Referenced by evaluateSqrtMu(), and Legendre().

◆ extractLocationFromPoint()

std::vector< Real > SingleSeriesBasisInterface::extractLocationFromPoint ( const Point &  point) const
protectedinherited

Convert a spatial point to a location that the series will use to determine the value at which to evaluate the series.

Definition at line 122 of file SingleSeriesBasisInterface.C.

123 {
124  std::vector<Real> location(_domains.size());
125 
126  // Update the locations as specified by _domain
127  for (std::size_t index = 0; index < _domains.size(); ++index)
128  location[index] = point(_domains[index]);
129  return location;
130 }

Referenced by isInPhysicalBounds(), Zernike::isInPhysicalBounds(), and SingleSeriesBasisInterface::setLocation().

◆ getAllExpansion()

const std::vector< Real > & FunctionalBasisInterface::getAllExpansion ( )
inherited

Returns an array reference containing the value of each expansion term.

Definition at line 72 of file FunctionalBasisInterface.C.

73 {
74  if (isGeneration() || isCacheInvalid())
75  {
77 
79 
80  _is_generation = false;
81  _is_cache_invalid = false;
82  }
83 
84  return _basis_evaluation;
85 }

Referenced by FunctionalBasisInterface::getExpansion(), and FunctionalBasisInterface::getExpansionSeriesSum().

◆ getAllGeneration()

const std::vector< Real > & FunctionalBasisInterface::getAllGeneration ( )
inherited

Returns an array reference containing the value of each generation term.

Definition at line 56 of file FunctionalBasisInterface.C.

57 {
58  if (isExpansion() || isCacheInvalid())
59  {
61 
63 
64  _is_generation = true;
65  _is_cache_invalid = false;
66  }
67 
68  return _basis_evaluation;
69 }

Referenced by FunctionalBasisInterface::getGeneration(), and FunctionalBasisInterface::getGenerationSeriesSum().

◆ getExpansion()

Real FunctionalBasisInterface::getExpansion ( )
inherited

Gets the #_order-th term of the expansion functional basis.

Definition at line 113 of file FunctionalBasisInterface.C.

114 {
115  // Use getAllExpansion() which will lazily evaluate the series as needed
116  return getAllExpansion().back();
117 }

◆ getExpansionSeriesSum()

Real FunctionalBasisInterface::getExpansionSeriesSum ( )
inherited

Evaluates the sum of all terms in the expansion functional basis up to #_order.

Definition at line 120 of file FunctionalBasisInterface.C.

121 {
122  Real sum = 0.0;
123 
124  // Use getAllExpansion() which will lazily evaluate the series as needed
125  for (auto term : getAllExpansion())
126  sum += term;
127 
128  return sum;
129 }

Referenced by TEST().

◆ getGeneration()

Real FunctionalBasisInterface::getGeneration ( )
inherited

Gets the last term of the generation functional basis.

Definition at line 94 of file FunctionalBasisInterface.C.

95 {
96  // Use getAllGeneration() which will lazily evaluate the series as needed
97  return getAllGeneration().back();
98 }

◆ getGenerationSeriesSum()

Real FunctionalBasisInterface::getGenerationSeriesSum ( )
inherited

Gets the sum of all terms in the generation functional basis.

Definition at line 101 of file FunctionalBasisInterface.C.

102 {
103  Real sum = 0.0;
104 
105  // Use getAllGeneration() which will lazily evaluate the series as needed
106  for (auto term : getAllGeneration())
107  sum += term;
108 
109  return sum;
110 }

Referenced by TEST().

◆ getNumberOfTerms()

std::size_t FunctionalBasisInterface::getNumberOfTerms ( ) const
inherited

Returns the number of terms in the series.

Definition at line 88 of file FunctionalBasisInterface.C.

89 {
90  return _number_of_terms;
91 }

Referenced by evaluateSqrtMu(), and TEST().

◆ getOrder()

std::size_t SingleSeriesBasisInterface::getOrder ( std::size_t  domain) const
inherited

Returns the order of the particular domain index.

Definition at line 133 of file SingleSeriesBasisInterface.C.

134 {
135  return domain < _orders.size() ? _orders[domain] : -1;
136 }

◆ getStandardizedFunctionLimits()

const std::vector< Real > & Legendre::getStandardizedFunctionLimits ( ) const
overridevirtual

Returns a vector of the lower and upper bounds of the standard functional space.

Implements FunctionalBasisInterface.

Definition at line 267 of file Legendre.C.

268 {
269  // Lazily instantiate the function limits array
270  static const std::vector<Real> standardizedFunctionLimits = {-1, 1};
271 
272  return standardizedFunctionLimits;
273 }

◆ getStandardizedFunctionVolume()

Real Legendre::getStandardizedFunctionVolume ( ) const
overridevirtual

Returns the volume within the standardized function local_limits.

Implements FunctionalBasisInterface.

Definition at line 276 of file Legendre.C.

277 {
278  return 2.0; // Span of [-1, 1]
279 }

◆ getStandardizedLocation()

std::vector< Real > Legendre::getStandardizedLocation ( const std::vector< Real > &  location) const
overrideprotectedvirtual

Standardize the location according to the requirements of the underlying basis, which may actually convert the Cartesian coordinates into a more suitable system.

The second version exists simply to return the value.

Implements SingleSeriesBasisInterface.

Definition at line 282 of file Legendre.C.

283 {
284  const Real difference = location[0] - _physical_bounds[0];
285  const Real span = _physical_bounds[1] - _physical_bounds[0];
286 
287  // Convert to [0, 1] (assuming that location[0] is within _physical_bounds)
288  const Real ratio = difference / span;
289 
290  // Legendre space is [-1, 1]
291  return {ratio * 2 - 1};
292 }

◆ isCacheInvalid()

bool SingleSeriesBasisInterface::isCacheInvalid ( ) const
finalvirtualinherited

Whether the cached values correspond to the current point.

Implements FunctionalBasisInterface.

Definition at line 45 of file SingleSeriesBasisInterface.C.

46 {
47  return _is_cache_invalid;
48 }

◆ isExpansion()

bool FunctionalBasisInterface::isExpansion ( ) const
inherited

Returns true if the current evaluation is expansion.

Definition at line 50 of file FunctionalBasisInterface.C.

51 {
52  return !_is_generation;
53 }

Referenced by FunctionalBasisInterface::getAllGeneration().

◆ isGeneration()

bool FunctionalBasisInterface::isGeneration ( ) const
inherited

Returns true if the current evaluation is generation.

Definition at line 44 of file FunctionalBasisInterface.C.

45 {
46  return _is_generation;
47 }

Referenced by FunctionalBasisInterface::getAllExpansion().

◆ isInPhysicalBounds()

bool Legendre::isInPhysicalBounds ( const Point &  point) const
overridevirtual

Determines if the point provided is in within the physical bounds.

Implements FunctionalBasisInterface.

Definition at line 295 of file Legendre.C.

296 {
297  std::vector<Real> location = extractLocationFromPoint(point);
298 
299  if (location[0] < _physical_bounds[0] || _physical_bounds[1] < location[0])
300  return false;
301  else
302  return true;
303 }

◆ load()

Real FunctionalBasisInterface::load ( std::size_t  index) const
protectedinherited

◆ operator[]()

Real FunctionalBasisInterface::operator[] ( std::size_t  index) const
inherited

Returns the current evaluation at the given index.

Definition at line 38 of file FunctionalBasisInterface.C.

39 {
40  return (index > _basis_evaluation.size() ? 0.0 : _basis_evaluation[index]);
41 }

◆ save()

void FunctionalBasisInterface::save ( std::size_t  index,
Real  value 
)
protectedinherited

◆ setLocation()

void SingleSeriesBasisInterface::setLocation ( const Point &  point)
finalvirtualinherited

Set the location that will be used by the series to compute values.

Implements FunctionalBasisInterface.

Definition at line 102 of file SingleSeriesBasisInterface.C.

103 {
104  std::vector<Real> oldLocation(_location);
105 
106  // Update the physical-space location
108 
109  // Standardize the location if standardized bounds exist
112  else
114 
115  // Once the location is changed, the cached values correspond to an old location
116  for (std::size_t i = 0; !_is_cache_invalid && (i < _location.size()); ++i)
117  if (oldLocation[i] != _location[i])
118  _is_cache_invalid = true;
119 }

Referenced by TEST().

◆ setOrder()

void SingleSeriesBasisInterface::setOrder ( const std::vector< std::size_t > &  orders)
finalvirtualinherited

Set the order of the series.

Implements FunctionalBasisInterface.

Definition at line 63 of file SingleSeriesBasisInterface.C.

64 {
65  if (orders.size() != _orders.size())
66  mooseError("SSBI: Invalid 'orders' use in setOrder()!");
67 
68  /*
69  * Do nothing if the order isn't changed. Note that this only compares the first value - it is
70  * assumed that a single series only needs to be described using a single order.
71  */
72  if (orders[0] == _orders[0])
73  return;
74 
75  _orders = orders;
76 
77  // Set the new number of terms in the single series
79 
80  // Zero the basis evaluation
82  _is_cache_invalid = true;
83 }

◆ setPhysicalBounds()

void SingleSeriesBasisInterface::setPhysicalBounds ( const std::vector< Real > &  bounds)
finalvirtualinherited

Sets the bounds of the series.

Implements FunctionalBasisInterface.

Definition at line 86 of file SingleSeriesBasisInterface.C.

87 {
88  // Use the concrete implementation to check the validity of the bounds
89  checkPhysicalBounds(bounds);
90 
91  _physical_bounds = bounds;
93 
94  /*
95  * Once the physical bounds have been changed, the normalization of a point will change, so the
96  * cached values will also be incorrect
97  */
98  _is_cache_invalid = true;
99 }

Member Data Documentation

◆ _are_physical_bounds_specified

bool SingleSeriesBasisInterface::_are_physical_bounds_specified
privateinherited

Flag for if the physical bounds are specified for this series.

Definition at line 95 of file SingleSeriesBasisInterface.h.

Referenced by SingleSeriesBasisInterface::setLocation(), and SingleSeriesBasisInterface::setPhysicalBounds().

◆ _basis_evaluation

std::vector<Real> FunctionalBasisInterface::_basis_evaluation
privateinherited

◆ _domain_options

MooseEnum FunctionalBasisInterface::_domain_options
staticinherited

An enumeration of the domains available to each functional series.

Definition at line 115 of file FunctionalBasisInterface.h.

Referenced by FunctionSeries::FunctionSeries(), SingleSeriesBasisInterface::SingleSeriesBasisInterface(), and TEST().

◆ _domains

const std::vector<MooseEnum> SingleSeriesBasisInterface::_domains
inherited

An ordered list of the x, y, and/or z domains needed by the functional basis to convert a point to a standardized location.

Definition at line 60 of file SingleSeriesBasisInterface.h.

Referenced by SingleSeriesBasisInterface::extractLocationFromPoint().

◆ _evaluateExpansionWrapper

std::function<void()> SingleSeriesBasisInterface::_evaluateExpansionWrapper
protectedinherited

The expansion evaluation wrapper.

Definition at line 88 of file SingleSeriesBasisInterface.h.

Referenced by SingleSeriesBasisInterface::evaluateExpansion(), Legendre(), and Zernike::Zernike().

◆ _evaluateGenerationWrapper

std::function<void()> SingleSeriesBasisInterface::_evaluateGenerationWrapper
protectedinherited

The generation evaluation wrapper.

Definition at line 91 of file SingleSeriesBasisInterface.h.

Referenced by SingleSeriesBasisInterface::evaluateGeneration(), Legendre(), and Zernike::Zernike().

◆ _is_cache_invalid

bool FunctionalBasisInterface::_is_cache_invalid
privateinherited

indicates if the evaluated values correspond to the current location

Definition at line 147 of file FunctionalBasisInterface.h.

◆ _is_generation

bool FunctionalBasisInterface::_is_generation
privateinherited

◆ _location

std::vector<Real> SingleSeriesBasisInterface::_location
privateinherited

The domain locations of the current evaluation.

This is private so that derived classes will be required to use _standardized_location, essentially forcing location-awareness compliance

Definition at line 99 of file SingleSeriesBasisInterface.h.

Referenced by SingleSeriesBasisInterface::setLocation().

◆ _number_of_terms

unsigned int FunctionalBasisInterface::_number_of_terms
protectedinherited

◆ _orders

std::vector<std::size_t> SingleSeriesBasisInterface::_orders
protectedinherited

◆ _physical_bounds

std::vector<Real> SingleSeriesBasisInterface::_physical_bounds
protectedinherited

◆ _standardized_location

std::vector<Real> SingleSeriesBasisInterface::_standardized_location
protectedinherited

The documentation for this class was generated from the following files:
SingleSeriesBasisInterface::_evaluateGenerationWrapper
std::function< void()> _evaluateGenerationWrapper
The generation evaluation wrapper.
Definition: SingleSeriesBasisInterface.h:91
SingleSeriesBasisInterface::_domains
const std::vector< MooseEnum > _domains
An ordered list of the x, y, and/or z domains needed by the functional basis to convert a point to a ...
Definition: SingleSeriesBasisInterface.h:60
SingleSeriesBasisInterface::_evaluateExpansionWrapper
std::function< void()> _evaluateExpansionWrapper
The expansion evaluation wrapper.
Definition: SingleSeriesBasisInterface.h:88
SingleSeriesBasisInterface::_location
std::vector< Real > _location
The domain locations of the current evaluation.
Definition: SingleSeriesBasisInterface.h:99
FunctionalBasisInterface::evaluateGeneration
virtual void evaluateGeneration()=0
Evaluate the generation form of the functional basis.
SingleSeriesBasisInterface::SingleSeriesBasisInterface
SingleSeriesBasisInterface()
Definition: SingleSeriesBasisInterface.C:20
FunctionalBasisInterface::load
Real load(std::size_t index) const
Helper function to load a value from #_series.
Definition: FunctionalBasisInterface.C:132
FunctionalBasisInterface::isCacheInvalid
virtual bool isCacheInvalid() const =0
Whether the cached values correspond to the current point.
expansion_type
MooseEnum expansion_type
Legendre::evaluateOrthonormal
virtual void evaluateOrthonormal()
Evaluates the orthonormal form of the basis functions.
Definition: Legendre.C:61
FunctionalBasisInterface::_is_generation
bool _is_generation
Indicates whether the current evaluation is expansion or generation.
Definition: FunctionalBasisInterface.h:154
SingleSeriesBasisInterface::_standardized_location
std::vector< Real > _standardized_location
The standardized location of evaluation.
Definition: SingleSeriesBasisInterface.h:85
Legendre::evaluateSqrtMu
virtual void evaluateSqrtMu()
Evaluates the 1/sqrt(mu) normalized form of the basis functions.
Definition: Legendre.C:259
FunctionalBasisInterface::getAllGeneration
const std::vector< Real > & getAllGeneration()
Returns an array reference containing the value of each generation term.
Definition: FunctionalBasisInterface.C:56
Legendre::calculatedNumberOfTermsBasedOnOrder
virtual std::size_t calculatedNumberOfTermsBasedOnOrder(const std::vector< std::size_t > &order) const override
Returns the number of terms in the single series given a value for the order.
Definition: Legendre.C:47
SingleSeriesBasisInterface::_are_physical_bounds_specified
bool _are_physical_bounds_specified
Flag for if the physical bounds are specified for this series.
Definition: SingleSeriesBasisInterface.h:95
FunctionalBasisInterface::_number_of_terms
unsigned int _number_of_terms
The number of terms in the series.
Definition: FunctionalBasisInterface.h:144
FunctionalBasisInterface::isExpansion
bool isExpansion() const
Returns true if the current evaluation is expansion.
Definition: FunctionalBasisInterface.C:50
generation_type
MooseEnum generation_type
SingleSeriesBasisInterface::_physical_bounds
std::vector< Real > _physical_bounds
The physical bounds of the series.
Definition: SingleSeriesBasisInterface.h:82
FunctionalBasisInterface::clearBasisEvaluation
virtual void clearBasisEvaluation(const unsigned int &number_of_terms)
Set all entries of the basis evaluation to zero.
Definition: FunctionalBasisInterface.C:144
FunctionalBasisInterface::evaluateExpansion
virtual void evaluateExpansion()=0
Evaluate the expansion form of the functional basis.
FunctionalBasisInterface::isGeneration
bool isGeneration() const
Returns true if the current evaluation is generation.
Definition: FunctionalBasisInterface.C:44
Legendre::evaluateStandard
virtual void evaluateStandard()
Evaluates the standard form of the basis functions.
Definition: Legendre.C:174
FunctionalBasisInterface::save
void save(std::size_t index, Real value)
Helper function to store a value in #_series.
Definition: FunctionalBasisInterface.C:138
FunctionalBasisInterface::_is_cache_invalid
bool _is_cache_invalid
indicates if the evaluated values correspond to the current location
Definition: FunctionalBasisInterface.h:147
SingleSeriesBasisInterface::checkPhysicalBounds
virtual void checkPhysicalBounds(const std::vector< Real > &bounds) const =0
Checks the physical bounds according to the actual implementation.
FunctionalBasisInterface::getAllExpansion
const std::vector< Real > & getAllExpansion()
Returns an array reference containing the value of each expansion term.
Definition: FunctionalBasisInterface.C:72
FunctionalBasisInterface::getNumberOfTerms
std::size_t getNumberOfTerms() const
Returns the number of terms in the series.
Definition: FunctionalBasisInterface.C:88
SingleSeriesBasisInterface::_orders
std::vector< std::size_t > _orders
The order of the series.
Definition: SingleSeriesBasisInterface.h:79
FunctionalBasisInterface::_basis_evaluation
std::vector< Real > _basis_evaluation
Stores the values of the basis evaluation.
Definition: FunctionalBasisInterface.h:151
SingleSeriesBasisInterface::calculatedNumberOfTermsBasedOnOrder
virtual std::size_t calculatedNumberOfTermsBasedOnOrder(const std::vector< std::size_t > &order) const =0
Returns the number of terms in the single series given a value for the order.
SingleSeriesBasisInterface::getStandardizedLocation
virtual std::vector< Real > getStandardizedLocation(const std::vector< Real > &location) const =0
Standardize the location according to the requirements of the underlying basis, which may actually co...
SingleSeriesBasisInterface::extractLocationFromPoint
std::vector< Real > extractLocationFromPoint(const Point &point) const
Convert a spatial point to a location that the series will use to determine the value at which to eva...
Definition: SingleSeriesBasisInterface.C:122