https://mooseframework.inl.gov
InputMatrixSampler.C
Go to the documentation of this file.
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 #include "InputMatrixSampler.h"
11 
12 registerMooseObjectAliased("StochasticToolsApp", InputMatrixSampler, "InputMatrix");
13 
16 {
18  params.addClassDescription("Sampler that utilizes a sampling matrix defined at input.");
19  params.addRequiredParam<RealEigenMatrix>("matrix", "Sampling matrix.");
20  return params;
21 }
22 
24  : Sampler(parameters), _data(getParam<RealEigenMatrix>("matrix"))
25 {
26  setNumberOfRows(_data.rows());
27  setNumberOfCols(_data.cols());
28 }
29 
30 Real
32 {
33  // Checks to make sure that the row and column indices are not out of bounds
34  // Static cast to avoid compiler warning and not lose information
35  mooseAssert(static_cast<Real>(row_index) < static_cast<Real>(_data.rows()),
36  "row_index cannot be out of bounds of the data.");
37  mooseAssert(static_cast<Real>(col_index) < static_cast<Real>(_data.cols()),
38  "col_index cannot be out of bounds of the data.");
39 
40  return _data(row_index, col_index);
41 }
void setNumberOfRows(dof_id_type n_rows)
static InputParameters validParams()
registerMooseObjectAliased("StochasticToolsApp", InputMatrixSampler, "InputMatrix")
static InputParameters validParams()
const RealEigenMatrix & _data
Data read from input.
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual Real computeSample(dof_id_type row_index, dof_id_type col_index) override
Return the sample for the given row and column.
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic > RealEigenMatrix
A class used to construct a sampling matrix from input.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void setNumberOfCols(dof_id_type n_cols)
void addClassDescription(const std::string &doc_string)
InputMatrixSampler(const InputParameters &parameters)
uint8_t dof_id_type