MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::SpacingFunction Class Referenceabstract

#include <spacing.hpp>

Inheritance diagram for mfem::SpacingFunction:
[legend]

Public Member Functions

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

Protected Attributes

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

Class for spacing functions that define meshes in a dimension, using a formula or method implemented in a derived class.

Definition at line 29 of file spacing.hpp.

Constructor & Destructor Documentation

◆ SpacingFunction()

mfem::SpacingFunction::SpacingFunction ( int n,
bool r = false,
bool s = false )
inline

Base class constructor.

Parameters
[in]nSize or number of intervals, which defines elements.
[in]rWhether to reverse the spacings, false by default.
[in]sWhether to scale parameters by the refinement or coarsening factor, in the function SpacingFunction::ScaleParameters.

Definition at line 38 of file spacing.hpp.

◆ ~SpacingFunction()

virtual mfem::SpacingFunction::~SpacingFunction ( )
virtualdefault

Member Function Documentation

◆ Clone()

std::unique_ptr< SpacingFunction > mfem::SpacingFunction::Clone ( ) const
virtual

◆ Eval()

virtual real_t mfem::SpacingFunction::Eval ( int p) const
pure virtual

◆ EvalAll()

void mfem::SpacingFunction::EvalAll ( Vector & s) const
inline

Returns the width of all intervals, resizing s to Size().

Definition at line 54 of file spacing.hpp.

◆ GetDoubleParameters()

virtual void mfem::SpacingFunction::GetDoubleParameters ( Vector & p) const
pure virtual

Returns the array of double parameters defining the spacing function.

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

Implemented in mfem::BellSpacingFunction, mfem::GaussianSpacingFunction, mfem::GeometricSpacingFunction, mfem::LinearSpacingFunction, mfem::LogarithmicSpacingFunction, mfem::PiecewiseSpacingFunction, and mfem::UniformSpacingFunction.

◆ GetIntParameters()

virtual void mfem::SpacingFunction::GetIntParameters ( Array< int > & p) const
pure virtual

Returns the array of integer parameters defining the spacing function.

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

Implemented in mfem::BellSpacingFunction, mfem::GaussianSpacingFunction, mfem::GeometricSpacingFunction, mfem::LinearSpacingFunction, mfem::LogarithmicSpacingFunction, mfem::PiecewiseSpacingFunction, and mfem::UniformSpacingFunction.

◆ GetSpacingType()

virtual SpacingType mfem::SpacingFunction::GetSpacingType ( ) const
pure virtual

◆ Nested()

virtual bool mfem::SpacingFunction::Nested ( ) const
pure virtual

◆ NumDoubleParameters()

virtual int mfem::SpacingFunction::NumDoubleParameters ( ) const
pure virtual

◆ NumIntParameters()

virtual int mfem::SpacingFunction::NumIntParameters ( ) const
pure virtual

◆ Print()

virtual void mfem::SpacingFunction::Print ( std::ostream & os) const
pure virtual

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}

Implemented in mfem::BellSpacingFunction, mfem::GaussianSpacingFunction, mfem::GeometricSpacingFunction, mfem::LinearSpacingFunction, mfem::LogarithmicSpacingFunction, mfem::PiecewiseSpacingFunction, and mfem::UniformSpacingFunction.

◆ ScaleParameters()

virtual void mfem::SpacingFunction::ScaleParameters ( real_t a)
inlinevirtual

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 in mfem::BellSpacingFunction, mfem::GaussianSpacingFunction, mfem::GeometricSpacingFunction, mfem::LinearSpacingFunction, and mfem::PiecewiseSpacingFunction.

Definition at line 68 of file spacing.hpp.

◆ SetReverse()

void mfem::SpacingFunction::SetReverse ( bool r)
inline

Sets the property that determines whether the spacing is reversed.

Definition at line 48 of file spacing.hpp.

◆ SetSize()

virtual void mfem::SpacingFunction::SetSize ( int size)
pure virtual

◆ Size()

int mfem::SpacingFunction::Size ( ) const
inline

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

Definition at line 42 of file spacing.hpp.

Member Data Documentation

◆ n

int mfem::SpacingFunction::n
protected

Size, or number of intervals (elements)

Definition at line 103 of file spacing.hpp.

◆ reverse

bool mfem::SpacingFunction::reverse
protected

Whether to reverse the spacing.

Definition at line 104 of file spacing.hpp.

◆ scale

bool mfem::SpacingFunction::scale
protected

Whether to scale parameters in ScaleParameters.

Definition at line 105 of file spacing.hpp.


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