IFEM 90A354
Functions.h
Go to the documentation of this file.
1// $Id$
2//==============================================================================
12//==============================================================================
13
14#ifndef _FUNCTIONS_H
15#define _FUNCTIONS_H
16
17#include "Function.h"
18
19class TensorFunc;
20namespace tinyxml2 { class XMLElement; }
21
23
24
30{
32
33public:
35 explicit ConstantFunc(Real v) : fval(v) {}
36
38 bool isZero() const override { return fval == Real(0); }
39
40protected:
42 Real evaluate(const Real&) const override { return fval; }
43};
44
45
50class LinearFunc : public ScalarFunc
51{
52 using Point = std::pair<Real,Real>;
53
54 std::vector<Point> fvals;
56
57public:
59 explicit LinearFunc(Real s = Real(1)) : scale(s) {}
60
65 explicit LinearFunc(const char* file, int c = 2, Real s = Real(1));
66
70 LinearFunc(const std::vector<Real>& x, const std::vector<Real>& y);
71
73 bool isZero() const override;
75 bool isConstant() const override { return fvals.size() == 1; }
76
78 Real deriv(Real x) const override;
79
80protected:
82 Real evaluate(const Real& x) const override;
83
84private:
86 size_t locate(Real x) const;
87};
88
89
94class LinVecFunc : public VecTimeFunc
95{
96 using Point = std::pair<Real,Vec3>;
97
98 std::vector<Point> fvals;
99
100public:
104 explicit LinVecFunc(const char* file, int c = 2);
105
107 bool isZero() const override;
109 bool isConstant() const override { return fvals.size() == 1; }
110
111protected:
113 Vec3 evaluate(const Real& x) const override;
114};
115
116
121class RampFunc : public ScalarFunc
122{
125
126public:
128 explicit RampFunc(Real f = Real(1), Real x = Real(1)) : fval(f), xmax(x) {}
129
131 bool isZero() const override { return fval == Real(0); }
133 bool isConstant() const override { return xmax <= Real(0); }
134
136 Real deriv(Real x) const override;
137
138protected:
140 Real evaluate(const Real& x) const override;
141};
142
143
148class DiracFunc : public ScalarFunc
149{
152
153public:
155 explicit DiracFunc(Real a = Real(1), Real x = Real(0)) : amp(a), xmax(x) {}
156
158 bool isZero() const override { return amp == Real(0); }
159
160protected:
162 Real evaluate(const Real& x) const override;
163};
164
165
170class StepFunc : public ScalarFunc
171{
174
175public:
177 explicit StepFunc(Real a, Real x = Real(0)) : amp(a), xmax(x) {}
178
180 bool isZero() const override { return amp == Real(0); }
181
182protected:
184 Real evaluate(const Real& x) const override;
185};
186
187
192class SineFunc : public ScalarFunc
193{
197
198public:
200 explicit SineFunc(Real s = Real(1), Real f = Real(1), Real p = Real(0))
201 : scale(s), freq(f), phase(p) {}
202
204 bool isZero() const override { return scale == Real(0); }
206 bool isConstant() const override { return this->isZero(); }
207
209 Real deriv(Real x) const override;
210
211protected:
213 Real evaluate(const Real& x) const override;
214};
215
216
221class ConstFunc : public RealFunc
222{
224
225public:
227 explicit ConstFunc(Real v) : fval(v) {}
228
230 bool isZero() const override { return fval == Real(0); }
231
232protected:
234 Real evaluate(const Vec3&) const override { return fval; }
235};
236
237
243{
245
246public:
248 explicit ConstTimeFunc(const ScalarFunc* f) : tfunc(f) {}
250 virtual ~ConstTimeFunc() { delete tfunc; }
251
253 bool isZero() const override { return tfunc->isZero(); }
255 bool isConstant() const override { return tfunc->isConstant(); }
256
258 Real deriv(const Vec3& X, int dir) const override;
259
260protected:
262 Real evaluate(const Vec3& X) const override;
263};
264
265
273{
276
277public:
279 SpaceTimeFunc(const RealFunc* s, const ScalarFunc* t) : sfunc(s), tfunc(t) {}
281 virtual ~SpaceTimeFunc() { delete sfunc; delete tfunc; }
282
284 bool isZero() const override { return sfunc->isZero() || tfunc->isZero(); }
286 bool isConstant() const override { return tfunc->isConstant(); }
287
289 Real deriv(const Vec3& X, int dir) const override;
291 Real dderiv(const Vec3& X, int dir1, int dir2) const override;
292
293protected:
295 Real evaluate(const Vec3& X) const override;
296};
297
298
303class LinearXFunc : public RealFunc
304{
307
308public:
310 explicit LinearXFunc(Real A, Real B = Real(0)) : a(A), b(B) {}
311
313 bool isZero() const override { return a == Real(0) && b == Real(0); }
314
316 Real deriv(const Vec3&, int dir) const override;
317
318protected:
320 Real evaluate(const Vec3& X) const override;
321};
322
323
328class LinearYFunc : public RealFunc
329{
332
333public:
335 explicit LinearYFunc(Real A, Real B = Real(0)) : a(A), b(B) {}
336
338 bool isZero() const override { return a == Real(0) && b == Real(0); }
339
341 Real deriv(const Vec3&, int dir) const override;
342
343protected:
345 Real evaluate(const Vec3& X) const override;
346};
347
348
353class LinearZFunc : public RealFunc
354{
357
358public:
360 explicit LinearZFunc(Real A, Real B = Real(0)) : a(A), b(B) {}
361
363 bool isZero() const override { return a == Real(0) && b == Real(0); }
364
366 Real deriv(const Vec3&, int dir) const override;
367
368protected:
370 Real evaluate(const Vec3& X) const override;
371};
372
373
379{
383
384public:
386 QuadraticXFunc(Real MAX, Real A, Real B) : max(MAX), a(A), b(B) {}
387
389 bool isZero() const override { return max == Real(0); }
390
392 Real deriv(const Vec3& X, int dir) const override;
394 Real dderiv(const Vec3&, int dir1, int dir2) const override;
395
396protected:
398 Real evaluate(const Vec3& X) const override;
399};
400
401
407{
411
412public:
414 QuadraticYFunc(Real MAX, Real A, Real B) : max(MAX), a(A), b(B) {}
415
417 bool isZero() const override { return max == Real(0); }
418
420 Real deriv(const Vec3& X, int dir) const override;
422 Real dderiv(const Vec3&, int dir1, int dir2) const override;
423
424protected:
426 Real evaluate(const Vec3& X) const override;
427};
428
429
435{
439
440public:
442 QuadraticZFunc(Real MAX, Real A, Real B) : max(MAX), a(A), b(B) {}
443
445 bool isZero() const override { return max == Real(0); }
446
448 Real deriv(const Vec3& X, int dir) const override;
450 Real dderiv(const Vec3&, int dir1, int dir2) const override;
451
452protected:
454 Real evaluate(const Vec3& X) const override;
455};
456
457
471{
472 bool rX;
476
477public:
479 LinearRotZFunc(bool retX, Real a, Real x_0 = Real(0), Real y_0 = Real(0))
480 : rX(retX), A(a), x0(x_0), y0(y_0) {}
481
483 bool isZero() const override { return A == Real(0); }
485 bool isConstant() const override { return this->isZero(); }
486
488 Real deriv(const Vec3&, int dir) const override;
489
490protected:
492 Real evaluate(const Vec3& X) const override;
493};
494
495
500class StepXFunc : public RealFunc
501{
505 char d;
506
507public:
509 explicit StepXFunc(Real v, Real a = Real(0), Real b = Real(1), char dir = 'X')
510 : fv(v), x0(a), x1(b), d(dir) {}
511
513 bool isZero() const override { return fv == Real(0); }
514
515protected:
517 Real evaluate(const Vec3& X) const override;
518};
519
520
525class StepXYFunc : public RealFunc
526{
532
533public:
535 explicit StepXYFunc(Real v,
536 Real X1 = Real( 1), Real Y1 = Real( 1),
537 Real X0 = Real(-1), Real Y0 = Real(-1))
538 : fv(v), x0(X0), y0(Y0), x1(X1), y1(Y1) {}
539
541 bool isZero() const override { return fv == Real(0); }
542
543protected:
545 Real evaluate(const Vec3& X) const override;
546};
547
548
554{
556 int dir;
558
559public:
565 Interpolate1D(const char* file, int dir_, int col = 2, Real ramp = Real(0))
566 : lfunc(file,col), dir(dir_), time(ramp) {}
567
573 Interpolate1D(const std::vector<Real>& xVal, const std::vector<Real>& yVal,
574 int dir_ = 1, Real ramp = Real(0))
575 : lfunc(xVal,yVal), dir(dir_), time(ramp) {}
576
578 bool isZero() const override { return lfunc.isZero(); }
580 bool isConstant() const override { return time <= Real(0); }
581
583 Real deriv(const Vec3&, int ddir) const override;
584
585protected:
587 Real evaluate(const Vec3& X) const override;
588};
589
590
595class ConstVecFunc : public VecFunc
596{
598
599public:
601 explicit ConstVecFunc(const Vec3& v) : fval(v) {}
602
604 bool isZero() const override { return fval.isZero(0.0); }
605
606protected:
608 Vec3 evaluate(const Vec3&) const override { return fval; }
609};
610
611
616class IntFunc : public utl::Function<int,Real>
617{
618protected:
621
622public:
624 explicit IntFunc(Real s = Real(1), Real ofs = Real(0)) : sf(s), f0(ofs) {}
625
626protected:
628 Real evaluate(const int& x) const override { return f0 + sf*Real(x); }
629};
630
631
632namespace utl
633{
635 const RealFunc* parseRealFunc(char* cline, Real A = Real(1),
636 bool print = true);
637
642 ScalarFunc* parseTimeFunc(const char* func,
643 const std::string& type = "expression",
644 Real eps = Real(1.0e-8));
645
649 VecTimeFunc* parseVecTimeFunc(const char* func,
650 const std::string& type);
651
656 RealFunc* parseRealFunc(const std::string& func,
657 const std::string& type = "expression",
658 bool print = true);
659
666 RealFunc* parseExprRealFunc(const std::string& function, bool autodiff);
667
674 VecFunc* parseExprVecFunc(const std::string& function, bool autodiff);
675
680 VecFunc* parseVecFunc(const std::string& func,
681 const std::string& type = "expression",
682 const std::string& variables = "");
683
687 TensorFunc* parseTensorFunc(const std::string& func,
688 const std::string& type);
689
694 TractionFunc* parseTracFunc(const std::string& func,
695 const std::string& type = "expression",
696 int dir = 0);
697
700 TractionFunc* parseTracFunc(const tinyxml2::XMLElement* elem);
701}
702
703#endif
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