https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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.
 
virtual bool isInPhysicalBounds (const Point &point) const override
 Determines if the point provided is in within the physical bounds.
 
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.
 
virtual const std::vector< Real > & getStandardizedFunctionLimits () const override
 Returns a vector of the lower and upper bounds of the standard functional space.
 
virtual bool isCacheInvalid () const final
 Whether the cached values correspond to the current point.
 
virtual void setLocation (const Point &point) final
 Set the location that will be used by the series to compute values.
 
virtual void setOrder (const std::vector< std::size_t > &orders) final
 Set the order of the series.
 
virtual void setPhysicalBounds (const std::vector< Real > &bounds) final
 Sets the bounds of the series.
 
std::size_t getOrder (std::size_t domain) const
 Returns the order of the particular domain index.
 
Real operator[] (std::size_t index) const
 Returns the current evaluation at the given index.
 
const std::vector< Real > & getAllGeneration ()
 Returns an array reference containing the value of each generation term.
 
const std::vector< Real > & getAllExpansion ()
 Returns an array reference containing the value of each expansion term.
 
std::size_t getNumberOfTerms () const
 Returns the number of terms in the series.
 
Real getGeneration ()
 Gets the last term of the generation functional basis.
 
Real getGenerationSeriesSum ()
 Gets the sum of all terms in the generation functional basis.
 
Real getExpansion ()
 Gets the #_order-th term of the expansion functional basis.
 
Real getExpansionSeriesSum ()
 Evaluates the sum of all terms in the expansion functional basis up to #_order.
 
bool isGeneration () const
 Returns true if the current evaluation is generation.
 
bool isExpansion () const
 Returns true if the current evaluation is expansion.
 

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.
 

Static Public Attributes

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

Protected Member Functions

void evaluateOrthonormal ()
 Evaluates the orthonormal form of the basis functions.
 
void evaluateStandard ()
 Evaluates the standard form of the basis functions.
 
void evaluateSqrtMu ()
 Evaluates the 1/sqrt(mu) normalized form of the basis functions.
 
virtual void checkPhysicalBounds (const std::vector< Real > &bounds) const override
 Checks the physical bounds according to the actual implementation.
 
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.
 
virtual void evaluateGeneration () override
 Evaluate the generation form of the functional basis.
 
virtual void evaluateExpansion () override
 Evaluate the expansion form of the functional basis.
 
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.
 
Real load (std::size_t index) const
 Helper function to load a value from #_series.
 
void save (std::size_t index, Real value)
 Helper function to store a value in #_series.
 

Protected Attributes

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

Private Member Functions

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

Private Attributes

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

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 ( )

◆ 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}
void mooseError(Args &&... args)
MooseEnum expansion_type
MooseEnum generation_type
void evaluateSqrtMu()
Evaluates the 1/sqrt(mu) normalized form of the basis functions.
Definition Legendre.C:259
void evaluateStandard()
Evaluates the standard form of the basis functions.
Definition Legendre.C:174
void evaluateOrthonormal()
Evaluates the orthonormal form of the basis functions.
Definition Legendre.C:61
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
std::function< void()> _evaluateGenerationWrapper
The generation evaluation wrapper.
std::function< void()> _evaluateExpansionWrapper
The expansion evaluation wrapper.

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()

void FunctionalBasisInterface::clearBasisEvaluation ( const unsigned int number_of_terms)
privatevirtualinherited

Set all entries of the basis evaluation to zero.

Reimplemented from FunctionalBasisInterface.

Definition at line 120 of file FunctionalBasisInterface.C.

146{
147 _basis_evaluation.assign(number_of_terms, 0.0);
148 _basis_evaluation.shrink_to_fit();
149}
std::vector< Real > _basis_evaluation
Stores the values of the basis evaluation.

Referenced by 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.

◆ evaluateGeneration()

void SingleSeriesBasisInterface::evaluateGeneration ( )
overrideprotectedvirtualinherited

Evaluate the generation form of the functional basis.

Implements FunctionalBasisInterface.

Definition at line 51 of file SingleSeriesBasisInterface.C.

◆ evaluateOrthonormal()

void Legendre::evaluateOrthonormal ( )
protected

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}
const std::vector< double > x
Real load(std::size_t index) const
Helper function to load a value from #_series.
void save(std::size_t index, Real value)
Helper function to store a value in #_series.
std::vector< std::size_t > _orders
The order of the series.
std::vector< Real > _standardized_location
The standardized location of evaluation.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Referenced by Legendre().

◆ evaluateSqrtMu()

void Legendre::evaluateSqrtMu ( )
protected

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}
std::size_t getNumberOfTerms() const
Returns the number of terms in the series.

Referenced by Legendre().

◆ evaluateStandard()

void Legendre::evaluateStandard ( )
protected

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}
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 ...

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 73 of file FunctionalBasisInterface.C.

74{
76 {
78
80
81 _is_generation = false;
82 _is_cache_invalid = false;
83 }
84
85 return _basis_evaluation;
86}
bool _is_cache_invalid
indicates if the evaluated values correspond to the current location
virtual void evaluateExpansion()=0
Evaluate the expansion form of the functional basis.
bool _is_generation
Indicates whether the current evaluation is expansion or generation.
unsigned int _number_of_terms
The number of terms in the series.
bool isGeneration() const
Returns true if the current evaluation is generation.
virtual void clearBasisEvaluation(const unsigned int &number_of_terms)
Set all entries of the basis evaluation to zero.
virtual bool isCacheInvalid() const =0
Whether the cached values correspond to the current point.

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 57 of file FunctionalBasisInterface.C.

58{
59 if (isExpansion() || isCacheInvalid())
60 {
62
64
65 _is_generation = true;
66 _is_cache_invalid = false;
67 }
68
69 return _basis_evaluation;
70}
virtual void evaluateGeneration()=0
Evaluate the generation form of the functional basis.
bool isExpansion() const
Returns true if the current evaluation is expansion.

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 114 of file FunctionalBasisInterface.C.

115{
116 // Use getAllExpansion() which will lazily evaluate the series as needed
117 return getAllExpansion().back();
118}
const std::vector< Real > & getAllExpansion()
Returns an array reference containing the value of each expansion term.

◆ getExpansionSeriesSum()

Real FunctionalBasisInterface::getExpansionSeriesSum ( )
inherited

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

Definition at line 121 of file FunctionalBasisInterface.C.

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

Referenced by TEST(), and TEST().

◆ getGeneration()

Real FunctionalBasisInterface::getGeneration ( )
inherited

Gets the last term of the generation functional basis.

Definition at line 95 of file FunctionalBasisInterface.C.

96{
97 // Use getAllGeneration() which will lazily evaluate the series as needed
98 return getAllGeneration().back();
99}
const std::vector< Real > & getAllGeneration()
Returns an array reference containing the value of each generation term.

◆ getGenerationSeriesSum()

Real FunctionalBasisInterface::getGenerationSeriesSum ( )
inherited

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

Definition at line 102 of file FunctionalBasisInterface.C.

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

Referenced by TEST(), and TEST().

◆ getNumberOfTerms()

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

Returns the number of terms in the series.

Definition at line 89 of file FunctionalBasisInterface.C.

90{
91 return _number_of_terms;
92}

Referenced by evaluateSqrtMu(), TEST(), TEST(), TEST(), 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}
std::vector< Real > _physical_bounds
The physical bounds of the series.

◆ 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}
bool _is_cache_invalid
indicates if the evaluated values correspond to the current location

◆ isExpansion()

bool FunctionalBasisInterface::isExpansion ( ) const
inherited

Returns true if the current evaluation is expansion.

Definition at line 51 of file FunctionalBasisInterface.C.

52{
53 return !_is_generation;
54}

Referenced by FunctionalBasisInterface::getAllGeneration().

◆ isGeneration()

bool FunctionalBasisInterface::isGeneration ( ) const
inherited

Returns true if the current evaluation is generation.

Definition at line 45 of file FunctionalBasisInterface.C.

46{
47 return _is_generation;
48}

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}
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...

◆ 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 39 of file FunctionalBasisInterface.C.

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

◆ 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}
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...
bool _are_physical_bounds_specified
Flag for if the physical bounds are specified for this series.
std::vector< Real > _location
The domain locations of the current evaluation.

Referenced by TEST(), TEST(), TEST(), TEST(), and 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}
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.
virtual void clearBasisEvaluation(const unsigned int &number_of_terms)
Set all entries of the basis evaluation to zero.

◆ 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}
virtual void checkPhysicalBounds(const std::vector< Real > &bounds) const =0
Checks the physical bounds according to the actual implementation.

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 114 of file FunctionalBasisInterface.h.

Referenced by FunctionSeries::FunctionSeries(), SingleSeriesBasisInterface::SingleSeriesBasisInterface(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), 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

◆ _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: