mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Added addConstant() and multiplyGradient() methods.
So far only to class DGBasisBoundedTotalDegree.
This commit is contained in:
parent
406965124a
commit
5ac24f9b8d
@ -108,6 +108,42 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Modify basis coefficients to add to the function value.
|
||||||
|
/// A function f = sum_i c_i b_i is assumed, and we change
|
||||||
|
/// it to (f + increment) by modifying the c_i. This is done without
|
||||||
|
/// modifying its gradient.
|
||||||
|
/// \param[in] increment Add this value to the function.
|
||||||
|
/// \param[in] dim Number of space dimensions.
|
||||||
|
/// \param[in] degree Polynomial degree of basis.
|
||||||
|
/// \param[out] coefficients Coefficients {c_i} for a single cell.
|
||||||
|
static void addConstant(const double increment,
|
||||||
|
const int /*dim*/,
|
||||||
|
const int /*degree*/,
|
||||||
|
double* coefficients)
|
||||||
|
{
|
||||||
|
coefficients[0] += increment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Modify basis coefficients to change the function's slope.
|
||||||
|
/// A function f = sum_i c_i b_i is assumed, and we change
|
||||||
|
/// it to a function g with the property that grad g = factor * grad f
|
||||||
|
/// by modifying the c_i. This is done without modifying the average,
|
||||||
|
/// i.e. the integrals of g and f over the cell are the same.
|
||||||
|
/// \param[in] factor Multiply gradient by this factor.
|
||||||
|
/// \param[in] dim Number of space dimensions.
|
||||||
|
/// \param[in] degree Polynomial degree of basis.
|
||||||
|
/// \param[out] coefficients Coefficients {c_i} for a single cell.
|
||||||
|
static void multiplyGradient(const double factor,
|
||||||
|
const int dim,
|
||||||
|
const int degree,
|
||||||
|
double* coefficients)
|
||||||
|
{
|
||||||
|
const int nb = numBasisFunc(dim, degree);
|
||||||
|
for (int ix = 1; ix < nb; ++ix) {
|
||||||
|
coefficients[ix] *= factor;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user