20namespace tinyxml2 {
class XMLElement; }
52 using Point = std::pair<Real,Real>;
70 LinearFunc(
const std::vector<Real>& x,
const std::vector<Real>& y);
73 bool isZero()
const override;
96 using Point = std::pair<Real,Vec3>;
104 explicit LinVecFunc(
const char* file,
int c = 2);
107 bool isZero()
const override;
480 :
rX(retX),
A(a),
x0(x_0),
y0(y_0) {}
510 :
fv(v),
x0(a),
x1(b),
d(dir) {}
643 const std::string& type =
"expression",
650 const std::string& type);
657 const std::string& type =
"expression",
681 const std::string& type =
"expression",
682 const std::string& variables =
"");
688 const std::string& type);
695 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:222
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:230
Real fval
The function value.
Definition Functions.h:223
ConstFunc(Real v)
Constructor initializing the function value.
Definition Functions.h:227
Real evaluate(const Vec3 &) const override
Evaluates the constant function.
Definition Functions.h:234
A scalar-valued spatial function, constant in space, varying in time.
Definition Functions.h:243
const ScalarFunc * tfunc
The time-dependent function value.
Definition Functions.h:244
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:248
bool isConstant() const override
Returns whether the function is time-independent or not.
Definition Functions.h:255
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:253
virtual ~ConstTimeFunc()
The destructor frees the time function.
Definition Functions.h:250
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:596
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:604
ConstVecFunc(const Vec3 &v)
Constructor initializing the function value.
Definition Functions.h:601
Vec3 evaluate(const Vec3 &) const override
Evaluates the constant function.
Definition Functions.h:608
Vec3 fval
The function value.
Definition Functions.h:597
A scalar-valued constant function.
Definition Functions.h:30
Real evaluate(const Real &) const override
Evaluates the constant function.
Definition Functions.h:42
Real fval
The function value.
Definition Functions.h:31
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:38
ConstantFunc(Real v)
Constructor initializing the function value.
Definition Functions.h:35
A scalar-valued dirac function.
Definition Functions.h:149
DiracFunc(Real a=Real(1), Real x=Real(0))
Constructor initializing the function parameters.
Definition Functions.h:155
Real amp
The amplitude of the dirac function.
Definition Functions.h:150
Real xmax
Associated x value.
Definition Functions.h:151
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:158
Real evaluate(const Real &x) const override
Evaluates the function at x.
Definition Functions.C:377
A real-valued integer function.
Definition Functions.h:617
Real evaluate(const int &x) const override
Evaluates the linear function.
Definition Functions.h:628
Real sf
Scaling factor.
Definition Functions.h:619
Real f0
Function value offset.
Definition Functions.h:620
IntFunc(Real s=Real(1), Real ofs=Real(0))
Constructor initializing the function parameters.
Definition Functions.h:624
A scalar-valued spatial function, linear interpolation.
Definition Functions.h:554
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:578
int dir
In which direction to perform the interpolation.
Definition Functions.h:556
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:573
Real time
Ramp-up time.
Definition Functions.h:557
LinearFunc lfunc
The piece-wise linear function doing the interpolation.
Definition Functions.h:555
Interpolate1D(const char *file, int dir_, int col=2, Real ramp=Real(0))
Constructor initializing the function parameters from a file.
Definition Functions.h:565
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:580
A vector-valued linear function.
Definition Functions.h:95
std::pair< Real, Vec3 > Point
Convenience type.
Definition Functions.h:96
bool isConstant() const override
Returns whether the function is constant or not.
Definition Functions.h:109
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:98
Vec3 evaluate(const Real &x) const override
Evaluates the function at x.
Definition Functions.C:339
A scalar-valued linear function.
Definition Functions.h:51
LinearFunc(Real s=Real(1))
Constructor initializing the scaling parameter.
Definition Functions.h:59
std::vector< Point > fvals
Values for piece-wise linear function.
Definition Functions.h:54
bool isConstant() const override
Returns whether the function is constant or not.
Definition Functions.h:75
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.C:230
Real scale
Scaling factor.
Definition Functions.h:55
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:52
A scalar-valued spatial function, defining a rotation about the Z-axis.
Definition Functions.h:471
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:483
bool rX
Flag telling whether to return the X- (true) or Y-component.
Definition Functions.h:472
bool isConstant() const override
Returns whether the function is time-independent or not.
Definition Functions.h:485
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:475
Real A
Magnitude of the rotation.
Definition Functions.h:473
LinearRotZFunc(bool retX, Real a, Real x_0=Real(0), Real y_0=Real(0))
Constructor initializing the function parameters.
Definition Functions.h:479
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:474
A scalar-valued spatial function, linear in x.
Definition Functions.h:304
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:305
Real b
The function value at x = 0.
Definition Functions.h:306
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:313
LinearXFunc(Real A, Real B=Real(0))
Constructor initializing the function parameters.
Definition Functions.h:310
A scalar-valued spatial function, linear in y.
Definition Functions.h:329
LinearYFunc(Real A, Real B=Real(0))
Constructor initializing the function parameters.
Definition Functions.h:335
Real b
The function value at y = 0.
Definition Functions.h:331
Real evaluate(const Vec3 &X) const override
Evaluates the linear function.
Definition Functions.C:460
Real a
The function derivative.
Definition Functions.h:330
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:338
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:354
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:363
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:355
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:360
Real b
The function value at z = 0.
Definition Functions.h:356
A scalar-valued spatial function, quadratic in x.
Definition Functions.h:379
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:389
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:386
Real b
Second root where function is zero.
Definition Functions.h:382
Real max
Max value of function.
Definition Functions.h:380
Real a
First root where function is zero.
Definition Functions.h:381
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:407
QuadraticYFunc(Real MAX, Real A, Real B)
Constructor initializing the function parameters.
Definition Functions.h:414
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:409
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:417
Real max
Max value of function.
Definition Functions.h:408
Real b
Second root where function is zero.
Definition Functions.h:410
A scalar-valued spatial function, quadratic in z.
Definition Functions.h:435
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:436
QuadraticZFunc(Real MAX, Real A, Real B)
Constructor initializing the function parameters.
Definition Functions.h:442
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:445
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:437
Real b
Second root where function is zero.
Definition Functions.h:438
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:122
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:123
Real xmax
The function is linear from x = 0 to x = xmax.
Definition Functions.h:124
bool isConstant() const override
Returns whether the function is time-independent or not.
Definition Functions.h:133
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:131
RampFunc(Real f=Real(1), Real x=Real(1))
Constructor initializing the function parameters.
Definition Functions.h:128
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:193
Real freq
Angular frequency of the sine function.
Definition Functions.h:195
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:200
Real scale
Amplitude of the sine function.
Definition Functions.h:194
Real phase
Phase shift of the sine function.
Definition Functions.h:196
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:204
bool isConstant() const override
Returns whether the function is time-independent or not.
Definition Functions.h:206
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:273
SpaceTimeFunc(const RealFunc *s, const ScalarFunc *t)
Constructor initializing the function terms.
Definition Functions.h:279
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:281
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:284
const ScalarFunc * tfunc
The time-dependent term.
Definition Functions.h:275
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:274
bool isConstant() const override
Returns whether the function is time-independent or not.
Definition Functions.h:286
Real evaluate(const Vec3 &X) const override
Evaluates the space-time function.
Definition Functions.C:417
A scalar-valued step function.
Definition Functions.h:171
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:180
Real xmax
Associated x value.
Definition Functions.h:173
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:172
StepFunc(Real a, Real x=Real(0))
Constructor initializing the function parameters.
Definition Functions.h:177
A scalar-valued spatial function, step in x.
Definition Functions.h:501
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:513
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:504
Real x0
The function is zero for x < x0.
Definition Functions.h:503
char d
Coordinate to step in (default X).
Definition Functions.h:505
Real fv
The non-zero function value.
Definition Functions.h:502
StepXFunc(Real v, Real a=Real(0), Real b=Real(1), char dir='X')
Constructor initializing the function parameters.
Definition Functions.h:509
A scalar-valued spatial function, step in x and y.
Definition Functions.h:526
Real y0
The function is zero for y < y0.
Definition Functions.h:529
bool isZero() const override
Returns whether the function is identically zero or not.
Definition Functions.h:541
Real fv
The non-zero function value.
Definition Functions.h:527
Real x0
The function is zero for x < x0.
Definition Functions.h:528
Real y1
The function is zero for y > y1.
Definition Functions.h:531
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:530
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:535
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:869
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:1004
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:850
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:1036
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:945