MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::PiecewiseSpacingFunction Class Reference

Piecewise spacing function, with spacing functions defining spacing within arbitarily many fixed subintervals of the unit interval. More...

#include <spacing.hpp>

Inheritance diagram for mfem::PiecewiseSpacingFunction:
[legend]
Collaboration diagram for mfem::PiecewiseSpacingFunction:
[legend]

Public Member Functions

 PiecewiseSpacingFunction (int n, int np, bool r, Array< int > const &relN, Array< int > const &ipar, Vector const &dpar)
 Constructor for PiecewiseSpacingFunction.
 
 PiecewiseSpacingFunction (const PiecewiseSpacingFunction &sf)
 Copy constructor (deep-copy all data, including SpacingFunction pieces)
 
PiecewiseSpacingFunctionoperator= (const PiecewiseSpacingFunction &sf)
 
 PiecewiseSpacingFunction (PiecewiseSpacingFunction &&sf)=default
 
PiecewiseSpacingFunctionoperator= (PiecewiseSpacingFunction &&sf)=default
 
void SetSize (int size) override
 Sets the size, or number of intervals (elements).
 
real_t Eval (int p) const override
 Returns the width of interval p (between 0 and Size() - 1).
 
void ScaleParameters (real_t a) override
 Scales parameters by the factor a associated with Size().
 
void Print (std::ostream &os) const override
 Prints all the data necessary to define the spacing function and its current state (size and other parameters).
 
std::unique_ptr< SpacingFunctionClone () const override
 Returns a clone (deep-copy) of this spacing function.
 
void SetupPieces (Array< int > const &ipar, Vector const &dpar)
 
SpacingType GetSpacingType () const override
 Returns the spacing type, indicating the derived class.
 
int NumIntParameters () const override
 Returns the number of integer parameters defining the spacing function.
 
int NumDoubleParameters () const override
 Returns the number of double parameters defining the spacing function.
 
void GetIntParameters (Array< int > &p) const override
 
void GetDoubleParameters (Vector &p) const override
 
bool Nested () const override
 Returns true if the spacing function is nested during refinement.
 
- Public Member Functions inherited from mfem::SpacingFunction
 SpacingFunction (int n, bool r=false, bool s=false)
 Base class constructor.
 
int Size () const
 Returns the size, or number of intervals (elements).
 
void SetReverse (bool r)
 Sets the property that determines whether the spacing is reversed.
 
void EvalAll (Vector &s) const
 Returns the width of all intervals, resizing s to Size().
 
virtual ~SpacingFunction ()=default
 

Additional Inherited Members

- Protected Attributes inherited from mfem::SpacingFunction
int n
 Size, or number of intervals (elements)
 
bool reverse
 Whether to reverse the spacing.
 
bool scale
 Whether to scale parameters in ScaleParameters.
 

Detailed Description

Piecewise spacing function, with spacing functions defining spacing within arbitarily many fixed subintervals of the unit interval.

The number of elements in each piece (or subinterval) is determined by the constructor input relN, which is the relative number of intervals. For equal numbers, relN would be all 1's. The total number of elements for this spacing function must be an integer multiple of the sum of entries in relN (stored in n0).

The scaling of parameters is done for the spacing function on each subinterval separately. This function is nested if and only if the functions on all subintervals are nested.

Definition at line 616 of file spacing.hpp.

Constructor & Destructor Documentation

◆ PiecewiseSpacingFunction() [1/3]

mfem::PiecewiseSpacingFunction::PiecewiseSpacingFunction ( int n,
int np,
bool r,
Array< int > const & relN,
Array< int > const & ipar,
Vector const & dpar )
inline

Constructor for PiecewiseSpacingFunction.

Parameters
[in]nSize or number of intervals, which defines elements.
[in]npNumber of pieces (subintervals of unit interval).
[in]rWhether to reverse the spacings.
[in]relNRelative number of elements per piece.
[in]iparInteger parameters for all np spacing functions. For each piece, these parameters are type, number of integer parameters, number of double parameters, integer parameters.
[in]dparDouble parameters for all np spacing functions. The first np - 1 entries define the partition of the unit interval, and the remaining are for the pieces.

Definition at line 631 of file spacing.hpp.

◆ PiecewiseSpacingFunction() [2/3]

mfem::PiecewiseSpacingFunction::PiecewiseSpacingFunction ( const PiecewiseSpacingFunction & sf)
inline

Copy constructor (deep-copy all data, including SpacingFunction pieces)

Definition at line 641 of file spacing.hpp.

◆ PiecewiseSpacingFunction() [3/3]

mfem::PiecewiseSpacingFunction::PiecewiseSpacingFunction ( PiecewiseSpacingFunction && sf)
default

Member Function Documentation

◆ Clone()

std::unique_ptr< SpacingFunction > mfem::PiecewiseSpacingFunction::Clone ( ) const
inlineoverridevirtual

Returns a clone (deep-copy) of this spacing function.

Reimplemented from mfem::SpacingFunction.

Definition at line 675 of file spacing.hpp.

◆ Eval()

real_t mfem::PiecewiseSpacingFunction::Eval ( int p) const
inlineoverridevirtual

Returns the width of interval p (between 0 and Size() - 1).

Implements mfem::SpacingFunction.

Definition at line 665 of file spacing.hpp.

◆ GetDoubleParameters()

void mfem::PiecewiseSpacingFunction::GetDoubleParameters ( Vector & p) const
inlineoverridevirtual

Returns the array of double parameters defining the spacing function.

Parameters
[out]pArray of double parameters, resized appropriately.

Implements mfem::SpacingFunction.

Definition at line 696 of file spacing.hpp.

◆ GetIntParameters()

void mfem::PiecewiseSpacingFunction::GetIntParameters ( Array< int > & p) const
inlineoverridevirtual

Returns the array of integer parameters defining the spacing function.

Parameters
[out]pArray of integer parameters, resized appropriately.

Implements mfem::SpacingFunction.

Definition at line 687 of file spacing.hpp.

◆ GetSpacingType()

SpacingType mfem::PiecewiseSpacingFunction::GetSpacingType ( ) const
inlineoverridevirtual

Returns the spacing type, indicating the derived class.

Implements mfem::SpacingFunction.

Definition at line 683 of file spacing.hpp.

◆ Nested()

bool mfem::PiecewiseSpacingFunction::Nested ( ) const
overridevirtual

Returns true if the spacing function is nested during refinement.

Implements mfem::SpacingFunction.

Definition at line 598 of file spacing.cpp.

◆ NumDoubleParameters()

int mfem::PiecewiseSpacingFunction::NumDoubleParameters ( ) const
inlineoverridevirtual

Returns the number of double parameters defining the spacing function.

Implements mfem::SpacingFunction.

Definition at line 685 of file spacing.hpp.

◆ NumIntParameters()

int mfem::PiecewiseSpacingFunction::NumIntParameters ( ) const
inlineoverridevirtual

Returns the number of integer parameters defining the spacing function.

Implements mfem::SpacingFunction.

Definition at line 684 of file spacing.hpp.

◆ operator=() [1/2]

PiecewiseSpacingFunction & mfem::PiecewiseSpacingFunction::operator= ( const PiecewiseSpacingFunction & sf)
inline

Definition at line 649 of file spacing.hpp.

◆ operator=() [2/2]

PiecewiseSpacingFunction & mfem::PiecewiseSpacingFunction::operator= ( PiecewiseSpacingFunction && sf)
default

◆ Print()

void mfem::PiecewiseSpacingFunction::Print ( std::ostream & os) const
overridevirtual

Prints all the data necessary to define the spacing function and its current state (size and other parameters).

The format is generally SpacingType numIntParam numDoubleParam {int params} {double params}

Implements mfem::SpacingFunction.

Definition at line 477 of file spacing.cpp.

◆ ScaleParameters()

void mfem::PiecewiseSpacingFunction::ScaleParameters ( real_t a)
overridevirtual

Scales parameters by the factor a associated with Size().

Note that parameters may be scaled inversely during coarsening and refining, so the scaling should be linear in the sense that scaling by a number followed by scaling by its inverse has no effect on parameters.

Reimplemented from mfem::SpacingFunction.

Definition at line 472 of file spacing.cpp.

◆ SetSize()

void mfem::PiecewiseSpacingFunction::SetSize ( int size)
inlineoverridevirtual

Sets the size, or number of intervals (elements).

Implements mfem::SpacingFunction.

Definition at line 659 of file spacing.hpp.

◆ SetupPieces()

void mfem::PiecewiseSpacingFunction::SetupPieces ( Array< int > const & ipar,
Vector const & dpar )

Definition at line 407 of file spacing.cpp.


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