LifeV
BCDataInterpolator Class Reference

BCDataInterpolator - Class for interpolating boundary functions from scattered data. More...

#include <BCDataInterpolator.hpp>

+ Inheritance diagram for BCDataInterpolator:
+ Collaboration diagram for BCDataInterpolator:

Data Structures

struct  BCDataInterpolator_point
 

Private Attributes

matrix_Type M_interpolationMatrix
 
vector_Type M_rhs_x
 
vector_Type M_rhs_y
 
vector_Type M_rhs_z
 
vector_Type M_coeffs_x
 
vector_Type M_coeffs_y
 
vector_Type M_coeffs_z
 
solver_Type M_denseSolver
 
BCInterpolationMethod M_interpolationMethod
 
boost::shared_array< BCDataInterpolator_pointM_dataSites
 
boost::shared_array< BCDataInterpolator_pointM_dataValues
 
boost::shared_array< BCDataInterpolator_pointM_dataValues_timeSamples
 
UInt M_nofControlPoints
 
Int M_filteringLevel
 
Real M_lastInterpolatedAtTime
 
Real M_timePeriod
 
Real M_timeInterval
 
bool M_flagInterpolated
 
bool M_verbose
 

Public Types

enum  BCInterpolationMethod {
  RBF_InverseMultiQuadric, RBF_Gaussian, RBF_ThinPlateSpline, RBF_MultiQuadric,
  RBF_Cubic
}
 
typedef Epetra_SerialDenseSolver solver_Type
 
typedef Epetra_SerialDenseMatrix matrix_Type
 
typedef Epetra_SerialDenseVector vector_Type
 
typedef std::shared_ptr< matrix_TypematrixPtr_Type
 
typedef std::shared_ptr< vector_TypevectorPtr_Type
 

Constructor & Destructor

 BCDataInterpolator ()
 Constructors for an data interpolator. More...
 
virtual ~BCDataInterpolator ()
 Destructor. More...
 

Methods

Assignment operator

Parameters
bdFunctionDirectionalThe BCFunctionDirectional object
Returns
Reference to a new BCFunctionDirectional object which is a copy of bcFunctionDirectional
Real interpolatedDataFunction (const Real &t, const Real &x, const Real &y, const Real &z, const ID &component)
 Evaluate the interpolated function. More...
 
void showMe (bool verbose=false, std::ostream &out=std::cout) const
 Display the content of the variables. More...
 
void readData (const std::string &fileName)
 Read control points and data from a file. More...
 
void exportInterpolationMatrix () const
 Export the interpolation matrix for debugging purposes. More...
 

Set Methods

void setInterpolationMethod (const BCInterpolationMethod &bcInterpolationMethod)
 Set the interpolation method. More...
 
void setFilteringLevel (const Int &filteringLevel)
 Set the filtering level. More...
 

Get Methods

const UIntnofControlPoints () const
 Returns the number of control points. More...
 

Private Methods

void formRBFMatrix ()
 
void solveInterpolationSystem ()
 
BCDataInterpolator_point interpolateVectorialFunction (const Real &t, const Real &x, const Real &y, const Real &z)
 
Real evaluateRBF (const BCDataInterpolator_point point1, const BCDataInterpolator_point point2)
 
bool needSideConstraints () const
 
void formRBFvectors ()
 
void interpolateDataValuesInTime (const Real t)
 
Int indexInTime (const Int dataSite, const Int timeInstant) const
 

Additional Inherited Members

- Public Types inherited from BCFunctionBase
typedef std::function< Real(const Real &, const Real &, const Real &, const Real &, const ID &) > function_Type
 
typedef std::shared_ptr< BCFunctionBaseBCFunctionBasePtr_Type
 
- Public Member Functions inherited from BCFunctionBase
 BCFunctionBase ()
 Empty Constructor. More...
 
 BCFunctionBase (function_Type userDefinedFunction)
 Constructor for a user defined function. More...
 
 BCFunctionBase (const BCFunctionBase &bcFunctionBase)
 Copy Constructor. More...
 
virtual ~BCFunctionBase ()
 Destructor. More...
 
virtual BCFunctionBaseoperator= (const BCFunctionBase &bcFunctionBase)
 Assignment Operator. More...
 
Real operator() (const Real &t, const Real &x, const Real &y, const Real &z, const ID &component) const
 Overloading function operator by calling M_userDefinedFunction. More...
 
void setFunction (function_Type userDefinedFunction)
 Set the user defined function. More...
 
const function_TypeFunction () const
 Get the function. More...
 
virtual BCFunctionBasePtr_Type clone () const
 Clone the current object. More...
 
- Protected Attributes inherited from BCFunctionBase
function_Type M_userDefinedFunction
 user defined function More...
 

Detailed Description

BCDataInterpolator - Class for interpolating boundary functions from scattered data.

Author
Toni Lassila
See also
Radial basis function interpolation [16]

Implements Radial Basis Function (RBF) interpolation of pointwise scalar or vectorial functions defined on a set of scattered interpolation points. Currently implements a variety of different basis functions for interpolation. Temporal interpolation done with trigonometric polynomials.

Inherits BCFunctionBase to facilitate use of interpolated data as boundary condition.

If the interpolated data depends on time, the user must pass the data values at 2n specific time instances, uniformly sampled at interval M_timeInterval and with period M_timePeriod. The values of the data between these time instances is interpolated using Fourier interpolation, i.e. the interpolant is a trigonometric polynomial of order 2n and periodic with period M_timePeriod.

The format of the data file passed to readData() is the following:

HEADER LINE FOR PARAMETERS

nof_data_sites nof_data_dimensions t_interval t_period filtering_level

HEADER LINE FOR DATA SITES

data_site_1_x_coord data_site_1_y_coord data_site_1_z_coord
...
data_site_n_x_coord data_site_n_y_coord data_site_n_z_coord

HEADER LINE FOR DATA VALUES

data_value_1_x_coord data_value_1_y_coord data_value_1_z_coord
...
data_value_n_x_coord data_value_n_y_coord data_value_n_z_coord

HEADER LINE FOR DATA VALUES

data_value_1_x_coord data_value_1_y_coord data_value_1_z_coord
...
data_value_n_x_coord data_value_n_y_coord data_value_n_z_coord

The variable nof_data_dimensions has to equal 1 or 3, depending on whether scalar or vectorial data is being interpolated. The variable nof_data_sites has to equal the number of rows passed in both the section involving the data_sites and the data values. The data value section has to be repeated t_period / t_interval times. The value filtering_level >= 0 is used to drop the most oscillatory terms in the trigonometric polynomial, and should be an integer.

Warning: in the current implementation the data sites are assumed fixed in time and they do not move with the mesh. Thus they should only be used in a Lagrangian frame of reference, i.e. with structural BC's.

Definition at line 100 of file BCDataInterpolator.hpp.

Member Typedef Documentation

◆ solver_Type

typedef Epetra_SerialDenseSolver solver_Type

Definition at line 108 of file BCDataInterpolator.hpp.

◆ matrix_Type

typedef Epetra_SerialDenseMatrix matrix_Type

Definition at line 109 of file BCDataInterpolator.hpp.

◆ vector_Type

typedef Epetra_SerialDenseVector vector_Type

Definition at line 110 of file BCDataInterpolator.hpp.

◆ matrixPtr_Type

typedef std::shared_ptr<matrix_Type> matrixPtr_Type

Definition at line 111 of file BCDataInterpolator.hpp.

◆ vectorPtr_Type

typedef std::shared_ptr<vector_Type> vectorPtr_Type

Definition at line 112 of file BCDataInterpolator.hpp.

Member Enumeration Documentation

◆ BCInterpolationMethod

Enumerator
RBF_InverseMultiQuadric 

Inverse multiquadrics

RBF_Gaussian 

Gaussians

RBF_ThinPlateSpline 

Thin plate splines

RBF_MultiQuadric 

Multiquadrics

RBF_Cubic 

Cubics

Definition at line 122 of file BCDataInterpolator.hpp.

Constructor & Destructor Documentation

◆ BCDataInterpolator()

BCDataInterpolator ( )
explicit

Constructors for an data interpolator.

Definition at line 56 of file BCDataInterpolator.cpp.

+ Here is the caller graph for this function:

◆ ~BCDataInterpolator()

~BCDataInterpolator ( )
virtual

Destructor.

Definition at line 79 of file BCDataInterpolator.cpp.

Member Function Documentation

◆ interpolatedDataFunction()

Real interpolatedDataFunction ( const Real t,
const Real x,
const Real y,
const Real z,
const ID component 
)

Evaluate the interpolated function.

Parameters
tTime
xCoordinate
yCoordinate
zCoordinate
componentThe component of the vector function
Returns
The selected component of the vector function evaluated in (t,x,y,z)

Definition at line 99 of file BCDataInterpolator.cpp.

◆ showMe()

void showMe ( bool  verbose = false,
std::ostream &  out = std::cout 
) const

Display the content of the variables.

Parameters
verboseThe verbosity (default: false)
outThe ostream output (default: std::cout)

Definition at line 124 of file BCDataInterpolator.cpp.

◆ readData()

void readData ( const std::string &  fileName)

Read control points and data from a file.

Parameters
filenameThe filename for the data sites and data values

Definition at line 153 of file BCDataInterpolator.cpp.

◆ exportInterpolationMatrix()

void exportInterpolationMatrix ( ) const

Export the interpolation matrix for debugging purposes.

Definition at line 227 of file BCDataInterpolator.cpp.

◆ setInterpolationMethod()

void setInterpolationMethod ( const BCInterpolationMethod bcInterpolationMethod)
inline

Set the interpolation method.

Parameters
bcInterpolationMethodThe interpolation method

Definition at line 210 of file BCDataInterpolator.hpp.

◆ setFilteringLevel()

void setFilteringLevel ( const Int filteringLevel)
inline

Set the filtering level.

Parameters
filteringLevelThe filtering level

Definition at line 219 of file BCDataInterpolator.hpp.

◆ nofControlPoints()

const UInt& nofControlPoints ( ) const
inline

Returns the number of control points.

Returns
The number of control points

Definition at line 232 of file BCDataInterpolator.hpp.

◆ formRBFMatrix()

void formRBFMatrix ( )
private

Definition at line 236 of file BCDataInterpolator.cpp.

+ Here is the caller graph for this function:

◆ solveInterpolationSystem()

void solveInterpolationSystem ( )
private

Definition at line 289 of file BCDataInterpolator.cpp.

+ Here is the caller graph for this function:

◆ interpolateVectorialFunction()

BCDataInterpolator::BCDataInterpolator_point interpolateVectorialFunction ( const Real t,
const Real x,
const Real y,
const Real z 
)
private

Definition at line 315 of file BCDataInterpolator.cpp.

+ Here is the caller graph for this function:

◆ evaluateRBF()

Real evaluateRBF ( const BCDataInterpolator_point  point1,
const BCDataInterpolator_point  point2 
)
private

Definition at line 381 of file BCDataInterpolator.cpp.

◆ needSideConstraints()

bool needSideConstraints ( ) const
private

Definition at line 409 of file BCDataInterpolator.cpp.

+ Here is the caller graph for this function:

◆ formRBFvectors()

void formRBFvectors ( )
private

Definition at line 424 of file BCDataInterpolator.cpp.

+ Here is the caller graph for this function:

◆ interpolateDataValuesInTime()

void interpolateDataValuesInTime ( const Real  t)
private

Definition at line 448 of file BCDataInterpolator.cpp.

+ Here is the caller graph for this function:

◆ indexInTime()

Int indexInTime ( const Int  dataSite,
const Int  timeInstant 
) const
inlineprivate

Definition at line 263 of file BCDataInterpolator.hpp.

+ Here is the caller graph for this function:

Field Documentation

◆ M_interpolationMatrix

matrix_Type M_interpolationMatrix
private

Definition at line 270 of file BCDataInterpolator.hpp.

◆ M_rhs_x

vector_Type M_rhs_x
private

Definition at line 272 of file BCDataInterpolator.hpp.

◆ M_rhs_y

vector_Type M_rhs_y
private

Definition at line 272 of file BCDataInterpolator.hpp.

◆ M_rhs_z

vector_Type M_rhs_z
private

Definition at line 272 of file BCDataInterpolator.hpp.

◆ M_coeffs_x

vector_Type M_coeffs_x
private

Definition at line 273 of file BCDataInterpolator.hpp.

◆ M_coeffs_y

vector_Type M_coeffs_y
private

Definition at line 273 of file BCDataInterpolator.hpp.

◆ M_coeffs_z

vector_Type M_coeffs_z
private

Definition at line 273 of file BCDataInterpolator.hpp.

◆ M_denseSolver

solver_Type M_denseSolver
private

Definition at line 275 of file BCDataInterpolator.hpp.

◆ M_interpolationMethod

BCInterpolationMethod M_interpolationMethod
private

Definition at line 277 of file BCDataInterpolator.hpp.

◆ M_dataSites

boost::shared_array<BCDataInterpolator_point> M_dataSites
private

Definition at line 279 of file BCDataInterpolator.hpp.

◆ M_dataValues

boost::shared_array<BCDataInterpolator_point> M_dataValues
private

Definition at line 280 of file BCDataInterpolator.hpp.

◆ M_dataValues_timeSamples

boost::shared_array<BCDataInterpolator_point> M_dataValues_timeSamples
private

Definition at line 281 of file BCDataInterpolator.hpp.

◆ M_nofControlPoints

UInt M_nofControlPoints
private

Definition at line 283 of file BCDataInterpolator.hpp.

◆ M_filteringLevel

Int M_filteringLevel
private

Definition at line 285 of file BCDataInterpolator.hpp.

◆ M_lastInterpolatedAtTime

Real M_lastInterpolatedAtTime
private

Definition at line 287 of file BCDataInterpolator.hpp.

◆ M_timePeriod

Real M_timePeriod
private

Definition at line 288 of file BCDataInterpolator.hpp.

◆ M_timeInterval

Real M_timeInterval
private

Definition at line 289 of file BCDataInterpolator.hpp.

◆ M_flagInterpolated

bool M_flagInterpolated
private

Definition at line 291 of file BCDataInterpolator.hpp.

◆ M_verbose

bool M_verbose
private

Definition at line 292 of file BCDataInterpolator.hpp.


The documentation for this class was generated from the following files: