22 _series.push_back(std::make_unique<Legendre>());
31 const std::vector<std::size_t> & orders,
32 std::vector<MooseEnum> series_types,
33 const std::string & who_is_using_me)
38 " calling CSBI::CSBI(...): Incorrect number of 'orders' specified for "
39 "'FunctionSeries'! Check that 'orders' is the correct length and no invalid "
40 "enumerations are specified for the series.");
51 std::vector<std::vector<Real>> single_series_basis_evaluation;
53 single_series_basis_evaluation.push_back(series->getAllGeneration());
60 const std::vector<std::vector<Real>> & single_series_basis_evaluations)
69 if (single_series_basis_evaluations.size() == 1)
70 for (std::size_t i = 0; i <
_series[0]->getNumberOfTerms(); ++i, ++term)
71 save(term, single_series_basis_evaluations[0][i]);
73 if (single_series_basis_evaluations.size() == 2)
74 for (std::size_t i = 0; i <
_series[0]->getNumberOfTerms(); ++i)
76 f1 = single_series_basis_evaluations[0][i];
77 for (std::size_t j = 0; j <
_series[1]->getNumberOfTerms(); ++j, ++term)
79 f2 = single_series_basis_evaluations[1][j];
84 if (single_series_basis_evaluations.size() == 3)
85 for (std::size_t i = 0; i <
_series[0]->getNumberOfTerms(); ++i)
87 f1 = single_series_basis_evaluations[0][i];
88 for (std::size_t j = 0; j <
_series[1]->getNumberOfTerms(); ++j)
90 f2 = single_series_basis_evaluations[1][j];
91 for (std::size_t k = 0; k <
_series[2]->getNumberOfTerms(); ++k, ++term)
93 f3 = single_series_basis_evaluations[2][k];
94 save(term, f1 * f2 * f3);
108 std::vector<std::vector<Real>> single_series_basis_evaluation;
110 single_series_basis_evaluation.push_back(series->getAllExpansion());
115const std::vector<Real> &
120 return function_limits;
126 Real function_volume = 1.0;
129 function_volume *= series->getStandardizedFunctionVolume();
131 return function_volume;
137 std::vector<Real> function_limits;
141 std::vector<Real> local_limits = series->getStandardizedFunctionLimits();
142 for (
auto & limit : local_limits)
143 function_limits.push_back(limit);
146 return function_limits;
151 const std::vector<Real> & coefficients)
const
154 std::ostringstream formatted, domains, orders;
155 std::size_t term = 0;
157 stream <<
"---------------- Coefficients ----------------\n"
158 <<
" == Subindices ==\n";
162 orders <<
" Orders: " << std::setw(3) <<
_series[0]->getOrder(0) <<
"\n";
163 domains <<
" == Index == " << std::setw(3) <<
_series[0]->_domains[0]
164 <<
" === Value ===\n"
165 <<
"----------------------------------------------\n";
167 for (std::size_t i = 0; i <
_series[0]->getNumberOfTerms(); ++i, ++term)
168 formatted <<
" " << std::setw(4) << term
169 <<
" " << std::setw(3) << i
170 <<
" " << std::setw(12) << coefficients[term] <<
"\n";
174 orders <<
" Orders: " << std::setw(3) <<
_series[0]->getOrder(0)
175 <<
" " << std::setw(3) <<
_series[1]->getOrder(0) <<
"\n";
176 domains <<
" == Index == " << std::setw(3) <<
_series[0]->_domains[0]
177 <<
" " << std::setw(3) <<
_series[1]->_domains[0]
178 <<
" === Value ===\n"
179 <<
"----------------------------------------------\n";
181 for (std::size_t i = 0; i <
_series[0]->getNumberOfTerms(); ++i)
183 for (std::size_t j = 0; j <
_series[1]->getNumberOfTerms(); ++j, ++term)
184 formatted <<
" " << std::setw(4) << term
185 <<
" " << std::setw(3) << i
186 <<
" " << std::setw(3) << j
187 <<
" " << std::setw(12) << coefficients[term] <<
"\n";
192 orders <<
" Orders: " << std::setw(3) <<
_series[0]->getOrder(0)
193 <<
" " << std::setw(3) <<
_series[1]->getOrder(0)
194 <<
" " << std::setw(3) <<
_series[2]->getOrder(0) <<
"\n";
195 domains <<
" == Index == " << std::setw(3) <<
_series[0]->_domains[0]
196 <<
" " << std::setw(3) <<
_series[1]->_domains[0]
197 <<
" " << std::setw(3) <<
_series[2]->_domains[0]
198 <<
" === Value ===\n"
199 <<
"----------------------------------------------\n";
201 for (std::size_t i = 0; i <
_series[0]->getNumberOfTerms(); ++i)
203 for (std::size_t j = 0; j <
_series[1]->getNumberOfTerms(); ++j)
205 for (std::size_t k = 0; k <
_series[2]->getNumberOfTerms(); ++k, ++term)
206 formatted <<
" " << std::setw(4) << term
207 <<
" " << std::setw(3) << i
208 <<
" " << std::setw(3) << j
209 <<
" " << std::setw(3) << k
210 <<
" " << std::setw(12) << coefficients[term] <<
"\n";
216 stream << orders.str() << domains.str() << formatted.str() << std::flush;
227 if (series->isCacheInvalid())
241 if (!series->isInPhysicalBounds(point))
250 unsigned int number_of_terms = 1;
254 number_of_terms *= series->getNumberOfTerms();
269 if (orders.size() !=
_series.size())
271 " calling CSBI::setOrder(): Mismatch between the orders provided and the number of "
272 "series in the functional basis!");
275 for (std::size_t i = 0; i <
_series.size(); ++i)
295 series->setLocation(point);
void mooseError(Args &&... args)
virtual void setOrder(const std::vector< std::size_t > &orders) final
Set the order of the series.
void evaluateSeries(const std::vector< std::vector< Real > > &single_series_basis_evaluations)
Evaluates the values of _basis_evaluation for either evaluateGeneration() or evaluateExpansion()
virtual void evaluateExpansion() final
Evaluate the expansion form of the functional basis.
std::vector< std::unique_ptr< SingleSeriesBasisInterface > > _series
A pointer to the single series type (one for each entry in _domains)
virtual void setLocation(const Point &p) final
Set the location that will be used by the series to compute values.
virtual Real getStandardizedFunctionVolume() const final
Returns the volume within the standardized function local_limits.
virtual ~CompositeSeriesBasisInterface()
virtual void evaluateGeneration() final
Evaluate the generation form of the functional basis.
Point _previous_point
The previous point at which the series was evaluated.
virtual const std::vector< Real > & getStandardizedFunctionLimits() const final
Returns a vector of the lower and upper bounds of the standard functional space.
virtual void formatCoefficients(std::ostream &stream, const std::vector< Real > &coefficients) const
Appends a tabulated form of the coefficients to the stream.
std::vector< MooseEnum > _series_types
The series types in this composite series.
virtual bool isInPhysicalBounds(const Point &point) const final
Determines if the point provided is in within the physical bounds.
virtual void clearBasisEvaluation(const unsigned int &number_of_terms)
Set all entries of the basis evaluation to zero.
void setNumberOfTerms()
Initialize the number of terms in the composite series by looping over the single series.
CompositeSeriesBasisInterface(const std::string &who_is_using_me)
const std::string & _who_is_using_me
The name of the MooseObject that is using this class.
std::vector< Real > combineStandardizedFunctionLimits() const
Get the function limits by looping over each of the single series.
virtual bool isCacheInvalid() const final
Whether the cached values correspond to the current point.
This class provides the basis for any custom functional basis, and is the parent class of both Single...
unsigned int _number_of_terms
The number of terms in the series.
void save(std::size_t index, Real value)
Helper function to store a value in #_series.