Line data Source code
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 : 10 : #pragma once 11 : 12 : #include "MooseEnum.h" 13 : #include "MooseError.h" 14 : #include "MooseTypes.h" 15 : 16 : // Shortened typename 17 : 18 : /** 19 : * This class provides the basis for any custom functional basis, and is the parent class of both 20 : * SingleSeriesBasisInterface and CompositeSeriesBasisInterface 21 : */ 22 742 : class FunctionalBasisInterface 23 : { 24 : public: 25 : FunctionalBasisInterface(); 26 : FunctionalBasisInterface(const unsigned int number_of_terms); 27 : 28 : /** 29 : * Returns the current evaluation at the given index 30 : */ 31 : Real operator[](std::size_t index) const; 32 : 33 : /** 34 : * Returns an array reference containing the value of each generation term 35 : */ 36 : const std::vector<Real> & getAllGeneration(); 37 : 38 : /** 39 : * Returns an array reference containing the value of each expansion term 40 : */ 41 : const std::vector<Real> & getAllExpansion(); 42 : 43 : /** 44 : * Returns the number of terms in the series 45 : */ 46 : std::size_t getNumberOfTerms() const; 47 : 48 : /** 49 : * Gets the last term of the generation functional basis 50 : */ 51 : Real getGeneration(); 52 : 53 : /** 54 : * Gets the sum of all terms in the generation functional basis 55 : */ 56 : Real getGenerationSeriesSum(); 57 : 58 : /** 59 : * Gets the #_order-th term of the expansion functional basis 60 : */ 61 : Real getExpansion(); 62 : 63 : /** 64 : * Evaluates the sum of all terms in the expansion functional basis up to #_order 65 : */ 66 : Real getExpansionSeriesSum(); 67 : 68 : /** 69 : * Returns a vector of the lower and upper bounds of the standard functional space 70 : */ 71 : virtual const std::vector<Real> & getStandardizedFunctionLimits() const = 0; 72 : 73 : /** 74 : * Returns the volume within the standardized function local_limits 75 : */ 76 : virtual Real getStandardizedFunctionVolume() const = 0; 77 : 78 : /** 79 : * Returns true if the current evaluation is generation 80 : */ 81 : bool isGeneration() const; 82 : 83 : /** 84 : * Returns true if the current evaluation is expansion 85 : */ 86 : bool isExpansion() const; 87 : 88 : /** 89 : * Whether the cached values correspond to the current point 90 : */ 91 : virtual bool isCacheInvalid() const = 0; 92 : 93 : /** 94 : * Determines if the point provided is in within the physical bounds 95 : */ 96 : virtual bool isInPhysicalBounds(const Point & point) const = 0; 97 : 98 : /** 99 : * Set the location that will be used by the series to compute values 100 : */ 101 : virtual void setLocation(const Point & point) = 0; 102 : 103 : /** 104 : * Set the order of the series 105 : */ 106 : virtual void setOrder(const std::vector<std::size_t> & orders) = 0; 107 : 108 : /** 109 : * Sets the bounds of the series 110 : */ 111 : virtual void setPhysicalBounds(const std::vector<Real> & bounds) = 0; 112 : 113 : /// An enumeration of the domains available to each functional series 114 : static MooseEnum _domain_options; 115 : 116 : protected: 117 : /** 118 : * Set all entries of the basis evaluation to zero. 119 : */ 120 : virtual void clearBasisEvaluation(const unsigned int & number_of_terms); 121 : 122 : /** 123 : * Evaluate the generation form of the functional basis 124 : */ 125 : virtual void evaluateGeneration() = 0; 126 : 127 : /** 128 : * Evaluate the expansion form of the functional basis 129 : */ 130 : virtual void evaluateExpansion() = 0; 131 : 132 : /** 133 : * Helper function to load a value from #_series 134 : */ 135 : Real load(std::size_t index) const; 136 : 137 : /** 138 : * Helper function to store a value in #_series 139 : */ 140 : void save(std::size_t index, Real value); 141 : 142 : /// The number of terms in the series 143 : unsigned int _number_of_terms; 144 : 145 : /// indicates if the evaluated values correspond to the current location 146 : bool _is_cache_invalid; 147 : 148 : private: 149 : /// Stores the values of the basis evaluation 150 : std::vector<Real> _basis_evaluation; 151 : 152 : /// Indicates whether the current evaluation is expansion or generation 153 : bool _is_generation; 154 : };