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
SingleSeriesBasisInterface Class Referenceabstract

This class is a simple wrapper around FunctionalBasisInterface, and intended for use by any single functional series like Legendre, Zernike, etc... More...

#include <SingleSeriesBasisInterface.h>

Inheritance diagram for SingleSeriesBasisInterface:
[legend]

Public Member Functions

 SingleSeriesBasisInterface ()
 
 SingleSeriesBasisInterface (const std::vector< MooseEnum > &domains, const std::vector< std::size_t > &orders, const unsigned int number_of_terms)
 
virtual ~SingleSeriesBasisInterface ()
 
 SingleSeriesBasisInterface (const SingleSeriesBasisInterface &)=delete
 
 SingleSeriesBasisInterface (SingleSeriesBasisInterface &&)=delete
 
void operator= (const SingleSeriesBasisInterface &)=delete
 
SingleSeriesBasisInterfaceoperator= (SingleSeriesBasisInterface &&)=delete
 
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.
 
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 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 convert the Cartesian coordinates into a more suitable system.
 
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.
 
virtual const std::vector< Real > & getStandardizedFunctionLimits () const =0
 Returns a vector of the lower and upper bounds of the standard functional space.
 
virtual Real getStandardizedFunctionVolume () const =0
 Returns the volume within the standardized function local_limits.
 
bool isGeneration () const
 Returns true if the current evaluation is generation.
 
bool isExpansion () const
 Returns true if the current evaluation is expansion.
 
virtual bool isInPhysicalBounds (const Point &point) const =0
 Determines if the point provided is in within the physical bounds.
 

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

virtual void evaluateGeneration () override
 Evaluate the generation form of the functional basis.
 
virtual void evaluateExpansion () override
 Evaluate the expansion form of the functional basis.
 
virtual void checkPhysicalBounds (const std::vector< Real > &bounds) const =0
 Checks the physical bounds according to the actual implementation.
 
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 is a simple wrapper around FunctionalBasisInterface, and intended for use by any single functional series like Legendre, Zernike, etc...

Definition at line 19 of file SingleSeriesBasisInterface.h.

Constructor & Destructor Documentation

◆ SingleSeriesBasisInterface() [1/4]

SingleSeriesBasisInterface::SingleSeriesBasisInterface ( )

Definition at line 20 of file SingleSeriesBasisInterface.C.

23 _orders({0}),
24 _physical_bounds(2, 0.0),
27 _location(_domains.size(), 0.0)
28{
29}
static MooseEnum _domain_options
An enumeration of the domains available to each functional series.
std::vector< Real > _physical_bounds
The physical bounds of the series.
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 ...
std::vector< std::size_t > _orders
The order of the series.
std::vector< Real > _standardized_location
The standardized location of evaluation.
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.

◆ SingleSeriesBasisInterface() [2/4]

SingleSeriesBasisInterface::SingleSeriesBasisInterface ( const std::vector< MooseEnum > &  domains,
const std::vector< std::size_t > &  orders,
const unsigned int  number_of_terms 
)

Definition at line 31 of file SingleSeriesBasisInterface.C.

34 : FunctionalBasisInterface(number_of_terms),
35 _domains(domains),
36 _orders(orders),
37 _physical_bounds(2, 0.0),
40 _location(_domains.size(), 0.0)
41{
42}

◆ ~SingleSeriesBasisInterface()

SingleSeriesBasisInterface::~SingleSeriesBasisInterface ( )
virtual

Definition at line 138 of file SingleSeriesBasisInterface.C.

138{}

◆ SingleSeriesBasisInterface() [3/4]

SingleSeriesBasisInterface::SingleSeriesBasisInterface ( const SingleSeriesBasisInterface )
delete

◆ SingleSeriesBasisInterface() [4/4]

SingleSeriesBasisInterface::SingleSeriesBasisInterface ( SingleSeriesBasisInterface &&  )
delete

Member Function Documentation

◆ calculatedNumberOfTermsBasedOnOrder()

virtual std::size_t SingleSeriesBasisInterface::calculatedNumberOfTermsBasedOnOrder ( const std::vector< std::size_t > &  order) const
pure virtual

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

Implemented in Legendre, and Zernike.

Referenced by setOrder().

◆ checkPhysicalBounds()

virtual void SingleSeriesBasisInterface::checkPhysicalBounds ( const std::vector< Real > &  bounds) const
protectedpure virtual

Checks the physical bounds according to the actual implementation.

Implemented in Legendre, and Zernike.

Referenced by setPhysicalBounds().

◆ clearBasisEvaluation()

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

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

◆ evaluateExpansion()

void SingleSeriesBasisInterface::evaluateExpansion ( )
overrideprotectedvirtual

Evaluate the expansion form of the functional basis.

Implements FunctionalBasisInterface.

Definition at line 57 of file SingleSeriesBasisInterface.C.

58{
60}
std::function< void()> _evaluateExpansionWrapper
The expansion evaluation wrapper.

◆ evaluateGeneration()

void SingleSeriesBasisInterface::evaluateGeneration ( )
overrideprotectedvirtual

Evaluate the generation form of the functional basis.

Implements FunctionalBasisInterface.

Definition at line 51 of file SingleSeriesBasisInterface.C.

52{
54}
std::function< void()> _evaluateGenerationWrapper
The generation evaluation wrapper.

◆ extractLocationFromPoint()

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

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 Legendre::isInPhysicalBounds(), Zernike::isInPhysicalBounds(), and 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}
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

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 Legendre::evaluateSqrtMu(), TEST(), TEST(), TEST(), and TEST().

◆ getOrder()

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

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

virtual const std::vector< Real > & FunctionalBasisInterface::getStandardizedFunctionLimits ( ) const
pure virtualinherited

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

Implemented in CompositeSeriesBasisInterface, Legendre, and Zernike.

◆ getStandardizedFunctionVolume()

virtual Real FunctionalBasisInterface::getStandardizedFunctionVolume ( ) const
pure virtualinherited

Returns the volume within the standardized function local_limits.

Implemented in CompositeSeriesBasisInterface, Legendre, and Zernike.

◆ getStandardizedLocation()

virtual std::vector< Real > SingleSeriesBasisInterface::getStandardizedLocation ( const std::vector< Real > &  location) const
pure virtual

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.

Implemented in Legendre, and Zernike.

Referenced by setLocation().

◆ isCacheInvalid()

bool SingleSeriesBasisInterface::isCacheInvalid ( ) const
finalvirtual

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

virtual bool FunctionalBasisInterface::isInPhysicalBounds ( const Point &  point) const
pure virtualinherited

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

Implemented in CompositeSeriesBasisInterface, Legendre, and Zernike.

◆ load()

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

◆ operator=() [1/2]

void SingleSeriesBasisInterface::operator= ( const SingleSeriesBasisInterface )
delete

◆ operator=() [2/2]

SingleSeriesBasisInterface & SingleSeriesBasisInterface::operator= ( SingleSeriesBasisInterface &&  )
delete

◆ 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)
finalvirtual

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

Referenced by TEST(), TEST(), TEST(), TEST(), and TEST().

◆ setOrder()

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

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}
void mooseError(Args &&... args)
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)
finalvirtual

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
private

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

Definition at line 95 of file SingleSeriesBasisInterface.h.

Referenced by setLocation(), and 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(), 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

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

◆ _evaluateExpansionWrapper

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

The expansion evaluation wrapper.

Definition at line 88 of file SingleSeriesBasisInterface.h.

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

◆ _evaluateGenerationWrapper

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

The generation evaluation wrapper.

Definition at line 91 of file SingleSeriesBasisInterface.h.

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

◆ _is_cache_invalid

bool FunctionalBasisInterface::_is_cache_invalid
private

indicates if the evaluated values correspond to the current location

Definition at line 146 of file FunctionalBasisInterface.h.

Referenced by isCacheInvalid(), setLocation(), setOrder(), and setPhysicalBounds().

◆ _is_generation

bool FunctionalBasisInterface::_is_generation
privateinherited

◆ _location

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

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

◆ _number_of_terms

unsigned int FunctionalBasisInterface::_number_of_terms
protectedinherited

◆ _orders

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

◆ _physical_bounds

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

◆ _standardized_location

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

The documentation for this class was generated from the following files: