20 namespace tinyxml2 {
class XMLElement; }
53 using Point = std::pair<Real,Real>;
71 LinearFunc(
const std::vector<Real>& x,
const std::vector<Real>& y);
74 bool isZero()
const override;
97 using Point = std::pair<Real,Vec3>;
105 explicit LinVecFunc(
const char* file,
int c = 2);
108 bool isZero()
const override;
481 :
rX(retX),
A(a),
x0(x_0),
y0(y_0) {}
511 :
fv(v),
x0(a),
x1(b),
d(dir) {}
624 const std::string& type =
"expression",
631 const std::string& type);
638 const std::string& type =
"expression",
661 const std::string& type =
"expression");
668 const std::string& type =
"expression",
669 const std::string& variables =
"");
675 const std::string& type);
682 const std::string& type =
"expression",
General functions with arbitrary argument and value type.
#define Real
The floating point type to use.
Definition: ImmersedBoundaries.h:18
A scalar-valued spatial function, constant in space and time.
Definition: Functions.h:223
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:231
Real fval
The function value.
Definition: Functions.h:224
ConstFunc(Real v)
Constructor initializing the function value.
Definition: Functions.h:228
Real evaluate(const Vec3 &) const override
Evaluates the constant function.
Definition: Functions.h:235
A scalar-valued spatial function, constant in space, varying in time.
Definition: Functions.h:244
const ScalarFunc * tfunc
The time-dependent function value.
Definition: Functions.h:245
Real deriv(const Vec3 &X, int dir) const override
Returns first-derivative of the function.
Definition: Functions.C:408
ConstTimeFunc(const ScalarFunc *f)
Constructor initializing the function value.
Definition: Functions.h:249
bool isConstant() const override
Returns whether the function is time-independent or not.
Definition: Functions.h:256
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:254
virtual ~ConstTimeFunc()
The destructor frees the time function.
Definition: Functions.h:251
Real evaluate(const Vec3 &X) const override
Evaluates the time-varying function.
Definition: Functions.C:401
A vector-valued spatial function, constant in space and time.
Definition: Functions.h:597
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:605
ConstVecFunc(const Vec3 &v)
Constructor initializing the function value.
Definition: Functions.h:602
Vec3 evaluate(const Vec3 &) const override
Evaluates the constant function.
Definition: Functions.h:609
Vec3 fval
The function value.
Definition: Functions.h:598
A scalar-valued constant function.
Definition: Functions.h:31
Real evaluate(const Real &) const override
Evaluates the constant function.
Definition: Functions.h:43
Real fval
The function value.
Definition: Functions.h:32
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:39
ConstantFunc(Real v)
Constructor initializing the function value.
Definition: Functions.h:36
A scalar-valued dirac function.
Definition: Functions.h:150
DiracFunc(Real a=Real(1), Real x=Real(0))
Constructor initializing the function parameters.
Definition: Functions.h:156
Real amp
The amplitude of the dirac function.
Definition: Functions.h:151
Real xmax
Associated x value.
Definition: Functions.h:152
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:159
Real evaluate(const Real &x) const override
Evaluates the function at x.
Definition: Functions.C:377
A scalar-valued spatial function, linear interpolation.
Definition: Functions.h:555
Real deriv(const Vec3 &, int ddir) const override
Returns first-derivative of the function.
Definition: Functions.C:614
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:579
int dir
In which direction to perform the interpolation.
Definition: Functions.h:557
Interpolate1D(const std::vector< Real > &xVal, const std::vector< Real > &yVal, int dir_=1, Real ramp=Real(0))
Constructor initializing the function parameters from two lists.
Definition: Functions.h:574
Real time
Ramp-up time.
Definition: Functions.h:558
LinearFunc lfunc
The piece-wise linear function doing the interpolation.
Definition: Functions.h:556
Interpolate1D(const char *file, int dir_, int col=2, Real ramp=Real(0))
Constructor initializing the function parameters from a file.
Definition: Functions.h:566
Real evaluate(const Vec3 &X) const override
Evaluates the function by interpolation.
Definition: Functions.C:602
bool isConstant() const override
Returns whether the function is time-independent or not.
Definition: Functions.h:581
A vector-valued linear function.
Definition: Functions.h:96
LinVecFunc(const char *file, int c=2)
Constructor initializing piece-wise linear function values.
Definition: Functions.C:278
std::pair< Real, Vec3 > Point
Convenience type.
Definition: Functions.h:97
bool isConstant() const override
Returns whether the function is constant or not.
Definition: Functions.h:110
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.C:329
std::vector< Point > fvals
Values for piece-wise linear function.
Definition: Functions.h:99
Vec3 evaluate(const Real &x) const override
Evaluates the function at x.
Definition: Functions.C:339
A scalar-valued linear function.
Definition: Functions.h:52
LinearFunc(Real s=Real(1))
Constructor initializing the scaling parameter.
Definition: Functions.h:60
std::vector< Point > fvals
Values for piece-wise linear function.
Definition: Functions.h:55
bool isConstant() const override
Returns whether the function is constant or not.
Definition: Functions.h:76
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.C:230
Real scale
Scaling factor.
Definition: Functions.h:56
size_t locate(Real x) const
Retuns the index of the first point after x.
Definition: Functions.C:220
Real deriv(Real x) const override
Returns the first-derivative of the function.
Definition: Functions.C:240
Real evaluate(const Real &x) const override
Evaluates the function at x.
Definition: Functions.C:258
std::pair< Real, Real > Point
Convenience type.
Definition: Functions.h:53
A scalar-valued spatial function, defining a rotation about the Z-axis.
Definition: Functions.h:472
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:484
bool rX
Flag telling whether to return the X- (true) or Y-component.
Definition: Functions.h:473
bool isConstant() const override
Returns whether the function is time-independent or not.
Definition: Functions.h:486
Real deriv(const Vec3 &, int dir) const override
Returns first-derivative of the function.
Definition: Functions.C:573
Real y0
Global Y-coordinate of rotation centre.
Definition: Functions.h:476
Real A
Magnitude of the rotation.
Definition: Functions.h:474
LinearRotZFunc(bool retX, Real a, Real x_0=Real(0), Real y_0=Real(0))
Constructor initializing the function parameters.
Definition: Functions.h:480
Real evaluate(const Vec3 &X) const override
Evaluates the rotation function.
Definition: Functions.C:559
Real x0
Global X-coordinate of rotation centre.
Definition: Functions.h:475
A scalar-valued spatial function, linear in x.
Definition: Functions.h:305
Real evaluate(const Vec3 &X) const override
Evaluates the linear function.
Definition: Functions.C:448
Real deriv(const Vec3 &, int dir) const override
Returns first-derivative of the function.
Definition: Functions.C:454
Real a
The function derivative.
Definition: Functions.h:306
Real b
The function value at x = 0.
Definition: Functions.h:307
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:314
LinearXFunc(Real A, Real B=Real(0))
Constructor initializing the function parameters.
Definition: Functions.h:311
A scalar-valued spatial function, linear in y.
Definition: Functions.h:330
LinearYFunc(Real A, Real B=Real(0))
Constructor initializing the function parameters.
Definition: Functions.h:336
Real b
The function value at y = 0.
Definition: Functions.h:332
Real evaluate(const Vec3 &X) const override
Evaluates the linear function.
Definition: Functions.C:460
Real a
The function derivative.
Definition: Functions.h:331
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:339
Real deriv(const Vec3 &, int dir) const override
Returns first-derivative of the function.
Definition: Functions.C:466
A scalar-valued spatial function, linear in z.
Definition: Functions.h:355
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:364
Real deriv(const Vec3 &, int dir) const override
Returns first-derivative of the function.
Definition: Functions.C:478
Real a
The function derivative.
Definition: Functions.h:356
Real evaluate(const Vec3 &X) const override
Evaluates the linear function.
Definition: Functions.C:472
LinearZFunc(Real A, Real B=Real(0))
Constructor initializing the function parameters.
Definition: Functions.h:361
Real b
The function value at z = 0.
Definition: Functions.h:357
A scalar-valued spatial function, quadratic in x.
Definition: Functions.h:380
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:390
Real deriv(const Vec3 &X, int dir) const override
Returns first-derivative of the function.
Definition: Functions.C:491
QuadraticXFunc(Real MAX, Real A, Real B)
Constructor initializing the function parameters.
Definition: Functions.h:387
Real b
Second root where function is zero.
Definition: Functions.h:383
Real max
Max value of function.
Definition: Functions.h:381
Real a
First root where function is zero.
Definition: Functions.h:382
Real evaluate(const Vec3 &X) const override
Evaluates the quadratic function.
Definition: Functions.C:484
Real dderiv(const Vec3 &, int dir1, int dir2) const override
Returns second-derivative of the function.
Definition: Functions.C:500
A scalar-valued spatial function, quadratic in y.
Definition: Functions.h:408
QuadraticYFunc(Real MAX, Real A, Real B)
Constructor initializing the function parameters.
Definition: Functions.h:415
Real dderiv(const Vec3 &, int dir1, int dir2) const override
Returns second-derivative of the function.
Definition: Functions.C:525
Real a
First root where function is zero.
Definition: Functions.h:410
Real deriv(const Vec3 &X, int dir) const override
Returns first-derivative of the function.
Definition: Functions.C:516
Real evaluate(const Vec3 &X) const override
Evaluates the quadratic function.
Definition: Functions.C:509
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:418
Real max
Max value of function.
Definition: Functions.h:409
Real b
Second root where function is zero.
Definition: Functions.h:411
A scalar-valued spatial function, quadratic in z.
Definition: Functions.h:436
Real dderiv(const Vec3 &, int dir1, int dir2) const override
Returns second-derivative of the function.
Definition: Functions.C:541
Real max
Max value of function.
Definition: Functions.h:437
QuadraticZFunc(Real MAX, Real A, Real B)
Constructor initializing the function parameters.
Definition: Functions.h:443
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:446
Real deriv(const Vec3 &X, int dir) const override
Returns first-derivative of the function.
Definition: Functions.C:550
Real a
First root where function is zero.
Definition: Functions.h:438
Real b
Second root where function is zero.
Definition: Functions.h:439
Real evaluate(const Vec3 &X) const override
Evaluates the quadratic function.
Definition: Functions.C:534
A scalar-valued ramp function, linear up to xmax.
Definition: Functions.h:123
Real deriv(Real x) const override
Returns the first-derivative of the function.
Definition: Functions.C:371
Real fval
Max function value.
Definition: Functions.h:124
Real xmax
The function is linear from x = 0 to x = xmax.
Definition: Functions.h:125
bool isConstant() const override
Returns whether the function is time-independent or not.
Definition: Functions.h:134
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:132
RampFunc(Real f=Real(1), Real x=Real(1))
Constructor initializing the function parameters.
Definition: Functions.h:129
Real evaluate(const Real &x) const override
Evaluates the function at x.
Definition: Functions.C:365
Scalar-valued unary function of a spatial point.
Definition: Function.h:193
Scalar-valued unary function of a scalar value.
Definition: Function.h:127
A scalar-valued sinusoidal function.
Definition: Functions.h:194
Real freq
Angular frequency of the sine function.
Definition: Functions.h:196
Real evaluate(const Real &x) const override
Evaluates the function at x.
Definition: Functions.C:389
SineFunc(Real s=Real(1), Real f=Real(1), Real p=Real(0))
Constructor initializing the function parameters.
Definition: Functions.h:201
Real scale
Amplitude of the sine function.
Definition: Functions.h:195
Real phase
Phase shift of the sine function.
Definition: Functions.h:197
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:205
bool isConstant() const override
Returns whether the function is time-independent or not.
Definition: Functions.h:207
Real deriv(Real x) const override
Returns the first-derivative of the function.
Definition: Functions.C:395
A scalar-valued spatial function, varying in space and time.
Definition: Functions.h:274
SpaceTimeFunc(const RealFunc *s, const ScalarFunc *t)
Constructor initializing the function terms.
Definition: Functions.h:280
Real dderiv(const Vec3 &X, int dir1, int dir2) const override
Returns second-derivative of the function.
Definition: Functions.C:434
virtual ~SpaceTimeFunc()
The destructor frees the space and time functions.
Definition: Functions.h:282
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:285
const ScalarFunc * tfunc
The time-dependent term.
Definition: Functions.h:276
Real deriv(const Vec3 &X, int dir) const override
Returns first-derivative of the function.
Definition: Functions.C:424
const RealFunc * sfunc
The space-dependent term.
Definition: Functions.h:275
bool isConstant() const override
Returns whether the function is time-independent or not.
Definition: Functions.h:287
Real evaluate(const Vec3 &X) const override
Evaluates the space-time function.
Definition: Functions.C:417
A scalar-valued step function.
Definition: Functions.h:172
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:181
Real xmax
Associated x value.
Definition: Functions.h:174
Real evaluate(const Real &x) const override
Evaluates the function at x.
Definition: Functions.C:383
Real amp
The amplitude of the step function.
Definition: Functions.h:173
StepFunc(Real a, Real x=Real(0))
Constructor initializing the function parameters.
Definition: Functions.h:178
A scalar-valued spatial function, step in x.
Definition: Functions.h:502
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:514
Real evaluate(const Vec3 &X) const override
Evaluates the step function.
Definition: Functions.C:590
Real x1
The function is zero for x > x1.
Definition: Functions.h:505
Real x0
The function is zero for x < x0.
Definition: Functions.h:504
char d
Coordinate to step in (default X).
Definition: Functions.h:506
Real fv
The non-zero function value.
Definition: Functions.h:503
StepXFunc(Real v, Real a=Real(0), Real b=Real(1), char dir='X')
Constructor initializing the function parameters.
Definition: Functions.h:510
A scalar-valued spatial function, step in x and y.
Definition: Functions.h:527
Real y0
The function is zero for y < y0.
Definition: Functions.h:530
bool isZero() const override
Returns whether the function is identically zero or not.
Definition: Functions.h:542
Real fv
The non-zero function value.
Definition: Functions.h:528
Real x0
The function is zero for x < x0.
Definition: Functions.h:529
Real y1
The function is zero for y > y1.
Definition: Functions.h:532
Real evaluate(const Vec3 &X) const override
Evaluates the step function.
Definition: Functions.C:596
Real x1
The function is zero for x > x1.
Definition: Functions.h:531
StepXYFunc(Real v, Real X1=Real(1), Real Y1=Real(1), Real X0=Real(-1), Real Y0=Real(-1))
Constructor initializing the function parameters.
Definition: Functions.h:536
Tensor-valued unary function of a spatial point.
Definition: TensorFunction.h:27
Vector-valued binary function of a spatial point and normal vector.
Definition: Function.h:292
Simple class for representing a point in 3D space.
Definition: Vec3.h:27
bool isZero(double tol=1.0e-6) const
Check if the vector is zero with the given tolerance.
Definition: Vec3.h:144
Vector-valued unary function of a spatial point.
Definition: Function.h:242
Base class for unary functions of arbitrary result and argument type.
Definition: Function.h:31
virtual bool isZero() const
Returns whether the function is identically zero or not.
Definition: Function.h:41
virtual bool isConstant() const
Returns whether the function is time-independent or not.
Definition: Function.h:43
General utility classes and functions.
Definition: SIMoptions.h:22
VecTimeFunc * parseVecTimeFunc(const char *func, const std::string &type)
Creates a vector-valued time function by parsing a char string.
Definition: Functions.C:962
const RealFunc * parseRealFunc(char *cline, Real A=Real(1), bool print=true)
Creates a scalar-valued function by parsing a character string.
Definition: Functions.C:647
RealFunc * parseExprRealFunc(const std::string &function, bool autodiff)
Creates a scalar-valued function by parsing a character string.
Definition: ExprFunctions.C:722
TensorFunc * parseTensorFunc(const std::string &func, const std::string &type)
Creates a tensor-valued function by parsing a character string.
Definition: Functions.C:1097
IntFunc * parseIntFunc(const std::string &func, const std::string &type="expression")
Creates a scalar-valued int function by parsing a character string.
Definition: Functions.C:850
ScalarFunc * parseTimeFunc(const char *func, const std::string &type="expression", Real eps=Real(1.0e-8))
Creates a time function by parsing a character string.
Definition: Functions.C:943
TractionFunc * parseTracFunc(const std::string &func, const std::string &type="expression", int dir=0)
Creates a vector-valued function defining a surface traction.
Definition: Functions.C:1129
VecFunc * parseExprVecFunc(const std::string &function, bool autodiff)
Creates a Vector-valued function by parsing a character string.
Definition: ExprFunctions.C:731
VecFunc * parseVecFunc(const std::string &func, const std::string &type="expression", const std::string &variables="")
Creates a vector-valued function by parsing a character string.
Definition: Functions.C:1038