NLMech  0.1.0
util::function Namespace Reference

Provides geometrical methods such as point inside rectangle. More...

Functions

double derLinearStepFunc (const double &x, const double &x1, const double &x2)
 Compute derivative of linear step function. More...
 
double doubleGaussian2d (const util::Point3 &x, const size_t &dof, const std::vector< double > &params)
 Compute sum of two Gaussian function in 2-d. More...
 
double gaussian (const double &r, const double &a, const double &beta)
 Compute Gaussian function in 1-d. More...
 
double gaussian2d (const util::Point3 &x, const size_t &dof, const std::vector< double > &params)
 Compute Gaussian function in 2-d. More...
 
double getDeterminant (const std::vector< util::Point3 > &rows)
 Get determinant of 3-d matrix. More...
 
double hatFunction (const double &x, const double &x_min, const double &x_max)
 Computes hat function at given point. More...
 
double hatFunctionQuick (const double &x, const double &x_min, const double &x_max)
 Computes hat function at given point. More...
 
double linearStepFunc (const double &x, const double &x1, const double &x2)
 Compute linear step function. More...
 
util::Point3 signVector (const util::Point3 &v)
 Get vector with plus or minus 1 depending on the sign of component of another vector. More...
 

Detailed Description

Provides geometrical methods such as point inside rectangle.

Function Documentation

◆ derLinearStepFunc()

double util::function::derLinearStepFunc ( const double &  x,
const double &  x1,
const double &  x2 
)

Compute derivative of linear step function.

Parameters
xPoint in real line
x1Point such that function is linear with slope 1 in [0, x1)
x2Point such that function is constant in [x1, x1 + x2)
Returns
value Derivative of step function at x

Referenced by loading::ULoading::apply().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ doubleGaussian2d()

double util::function::doubleGaussian2d ( const util::Point3 x,
const size_t &  dof,
const std::vector< double > &  params 
)

Compute sum of two Gaussian function in 2-d.

Double Gaussian (2-d) function:

\[ f(x,y) = (f_1(x,y), f_2(x,y)) + (g_1(x,y), g_2(x,y)), \]

where $ (f_1,f_2)$ and $(g_1, g_2)$ are two Gaussian 2-d function as described in Gaussian2d() with different values of $ (x_c, y_c), a, (d_1, d_2)$.

Parameters
xCoordinates of point
paramsList of parameters
dofComponent of Gaussian function
Returns
value Component of Gaussian 2-d vector function along dof

Referenced by loading::InitialCondition::getICFormula().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gaussian()

double util::function::gaussian ( const double &  r,
const double &  a,
const double &  beta 
)

Compute Gaussian function in 1-d.

Gaussian (1-d) function: $ f(r) = a \exp(-\frac{r^2}{\beta}). $

Here $ a$ is the amplitude and $ \beta $ is the exponential factor.

Parameters
rDistance from origin
aAmplitude
betaFactor in exponential function
Returns
value Component of Gaussian 1-d function

Referenced by doubleGaussian2d(), and gaussian2d().

Here is the caller graph for this function:

◆ gaussian2d()

double util::function::gaussian2d ( const util::Point3 x,
const size_t &  dof,
const std::vector< double > &  params 
)

Compute Gaussian function in 2-d.

Gaussian (2-d) function:

\[ f(x,y) = (f_1(x,y), f_2(x,y)), \]

where

\[ f_1(x,y) = a \exp(-\frac{(x-x_c)^2 + (y-y_c)^2}{\beta}) d_1, \quad f_1(x,y) = a \exp(-\frac{(x-x_c)^2 + (y-y_c)^2}{\beta}) d_2. \]

Here $ (x_c,y_c) $ is the center of the pulse, $ a$ is the amplitude, $ \beta $ is the exponential factor, and $ (d_1,d_2)$ is the direction of the pulse.

Parameters
xCoordinates of point
paramsList of parameters
dofComponent of Gaussian function
Returns
value Component of Gaussian 2-d vector function along dof

Referenced by loading::InitialCondition::getICFormula().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDeterminant()

double util::function::getDeterminant ( const std::vector< util::Point3 > &  rows)

Get determinant of 3-d matrix.

Parameters
rowsThree rows of matrix
Returns
det Determinant

Referenced by util::geometry::getTetVolume().

Here is the caller graph for this function:

◆ hatFunction()

double util::function::hatFunction ( const double &  x,
const double &  x_min,
const double &  x_max 
)

Computes hat function at given point.

Hat function: f ^ | | 1 o | /|\ | / | \ | / | \ | / | \ | / | \ | / | \ o____________o____________o______\ x / x_min x_max

Parameters
xPoint in real line
x_minLeft side point in real line
x_maxRight side point in real line
Returns
value Evaluation of hat function at x

Referenced by loading::FLoading::apply().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hatFunctionQuick()

double util::function::hatFunctionQuick ( const double &  x,
const double &  x_min,
const double &  x_max 
)

Computes hat function at given point.

This version does not test if point x is in valid interval.

Hat function: f ^ | | 1 o | /|\ | / | \ | / | \ | / | \ | / | \ | / | \ o____________o____________o______\ x / x_min x_max

Parameters
xPoint in real line
x_minLeft side point in real line
x_maxRight side point in real line
Returns
value Evaluation of hat function at x
Here is the call graph for this function:

◆ linearStepFunc()

double util::function::linearStepFunc ( const double &  x,
const double &  x1,
const double &  x2 
)

Compute linear step function.

Step function:

f ^ | __________ | / | / | _______/ | / | / |/_________________________ t x1 x1+x2

  • Linear (with slope 1) in [0,l1), constant in [l1,l1+l2)
  • Periodic with periodicity l1+l2
Parameters
xPoint in real line
x1Point such that function is linear with slope 1 in [0, x1)
x2Point such that function is constant in [x1, x1 + x2)
Returns
value Evaluation of step function at x

Referenced by loading::FLoading::apply(), and loading::ULoading::apply().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ signVector()

util::Point3 util::function::signVector ( const util::Point3 v)

Get vector with plus or minus 1 depending on the sign of component of another vector.

Parameters
vVector from which a new vector is created
Returns
vec Vector
Here is the call graph for this function: