1 #ifndef ABLATELIBRARY_LINEAR_FUNCTION_HPP
2 #define ABLATELIBRARY_LINEAR_FUNCTION_HPP
4 #include "formulaBase.hpp"
6 namespace ablate::mathFunctions {
13 const std::vector<double> startValue;
14 const std::vector<double> endValue;
19 static PetscErrorCode LinearPetscFunction(PetscInt dim, PetscReal time,
const PetscReal x[], PetscInt Nf, PetscScalar* u,
void* ctx);
30 inline static double Interpolate(
double x,
double x0,
double x1,
double y0,
double y1) {
37 return y0 + (x - x0) * (y1 - y0) / (x1 - x0);
49 inline double DetermineDirectionValue(
double x,
double y,
double z)
const {
64 void operator=(
const Linear&) =
delete;
74 explicit Linear(std::vector<double> startValue, std::vector<double> endValue,
double start,
double end,
int dir);
76 double Eval(
const double& x,
const double& y,
const double& z,
const double& t)
const override;
78 double Eval(
const double* xyz,
const int& ndims,
const double& t)
const override;
80 void Eval(
const double& x,
const double& y,
const double& z,
const double& t, std::vector<double>& result)
const override;
82 void Eval(
const double* xyz,
const int& ndims,
const double& t, std::vector<double>& result)
const override;
Definition: linear.hpp:11
void * GetContext() override
Definition: linear.hpp:84
PetscFunction GetPetscFunction() override
Definition: linear.hpp:86
double Eval(const double &x, const double &y, const double &z, const double &t) const override
Definition: linear.cpp:18
Definition: mathFunction.hpp:13