mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Added evalFunc() method.
This public method is not virtual, and implemented in the base class using calls to the virtual methods. Not yet used by the DG solver.
This commit is contained in:
@@ -25,12 +25,30 @@
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
// ---------------- Methods for class DGBasisInterface ----------------
|
||||
|
||||
|
||||
/// Virtual destructor.
|
||||
DGBasisInterface::~DGBasisInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/// Evaluate function f = sum_i c_i b_i at the point x.
|
||||
/// Note that this function is not virtual, but implemented in
|
||||
/// terms of the virtual functions of the class.
|
||||
/// \param[in] cell Cell index
|
||||
/// \param[in] coefficients Coefficients {c_i} for a single cell.
|
||||
/// \param[in] x Point at which to compute f(x).
|
||||
double DGBasisInterface::evalFunc(const int cell,
|
||||
const double* coefficients,
|
||||
const double* x) const
|
||||
{
|
||||
bvals_.resize(numBasisFunc());
|
||||
eval(cell, x, &bvals_[0]);
|
||||
return std::inner_product(bvals_.begin(), bvals_.end(), coefficients, 0.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ---------------- Methods for class DGBasisBoundedTotalDegree ----------------
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef OPM_DGBASIS_HEADER_INCLUDED
|
||||
#define OPM_DGBASIS_HEADER_INCLUDED
|
||||
|
||||
#include <vector>
|
||||
|
||||
struct UnstructuredGrid;
|
||||
|
||||
namespace Opm
|
||||
@@ -76,9 +78,22 @@ namespace Opm
|
||||
virtual void multiplyGradient(const double factor,
|
||||
double* coefficients) const = 0;
|
||||
|
||||
/// Evaluate function f = sum_i c_i b_i at the point x.
|
||||
/// Note that this function is not virtual, but implemented in
|
||||
/// terms of the virtual functions of the class.
|
||||
/// \param[in] cell Cell index
|
||||
/// \param[in] coefficients Coefficients {c_i} for a single cell.
|
||||
/// \param[in] x Point at which to compute f(x).
|
||||
double evalFunc(const int cell,
|
||||
const double* coefficients,
|
||||
const double* x) const;
|
||||
|
||||
/// Compute the average of the function f = sum_i c_i b_i.
|
||||
/// \param[in] coefficients Coefficients {c_i} for a single cell.
|
||||
virtual double functionAverage(const double* coefficients) const = 0;
|
||||
|
||||
private:
|
||||
mutable std::vector<double> bvals_; // For evalFunc().
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user