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

Geometric spacing function. More...

#include <spacing.hpp>

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

Public Member Functions

 GeometricSpacingFunction (int n, bool r, real_t s, bool scale)
 
void SetSize (int size) override
 Sets the size, or number of intervals (elements).
 
void ScaleParameters (real_t a) override
 Scales parameters by the factor a associated with Size().
 
real_t Eval (int p) const override
 Returns the width of interval p (between 0 and Size() - 1).
 
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).
 
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.
 
std::unique_ptr< SpacingFunctionClone () const override
 Returns a clone (deep-copy) of this spacing function.
 
- 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

Geometric spacing function.

The spacing of interval i is s*r^i for 0 <= i < n, with s + s*r + s*r^2 + ... + s*r^(n-1) = 1 s * (r^n - 1) / (r - 1) = 1 The initial spacing s and number of intervals n are inputs, and r is solved for by Newton's method. The parameter s can be scaled. This function is not nested.

Definition at line 275 of file spacing.hpp.

Constructor & Destructor Documentation

◆ GeometricSpacingFunction()

mfem::GeometricSpacingFunction::GeometricSpacingFunction ( int n,
bool r,
real_t s,
bool scale )
inline

Definition at line 278 of file spacing.hpp.

Member Function Documentation

◆ Clone()

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

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

Reimplemented from mfem::SpacingFunction.

Definition at line 333 of file spacing.hpp.

◆ Eval()

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

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

Implements mfem::SpacingFunction.

Definition at line 299 of file spacing.hpp.

◆ GetDoubleParameters()

void mfem::GeometricSpacingFunction::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 325 of file spacing.hpp.

◆ GetIntParameters()

void mfem::GeometricSpacingFunction::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 317 of file spacing.hpp.

◆ GetSpacingType()

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

Returns the spacing type, indicating the derived class.

Implements mfem::SpacingFunction.

Definition at line 312 of file spacing.hpp.

◆ Nested()

bool mfem::GeometricSpacingFunction::Nested ( ) const
inlineoverridevirtual

Returns true if the spacing function is nested during refinement.

Implements mfem::SpacingFunction.

Definition at line 331 of file spacing.hpp.

◆ NumDoubleParameters()

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

Returns the number of double parameters defining the spacing function.

Implements mfem::SpacingFunction.

Definition at line 315 of file spacing.hpp.

◆ NumIntParameters()

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

Returns the number of integer parameters defining the spacing function.

Implements mfem::SpacingFunction.

Definition at line 314 of file spacing.hpp.

◆ Print()

void mfem::GeometricSpacingFunction::Print ( std::ostream & os) const
inlineoverridevirtual

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 305 of file spacing.hpp.

◆ ScaleParameters()

void mfem::GeometricSpacingFunction::ScaleParameters ( real_t a)
inlineoverridevirtual

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 290 of file spacing.hpp.

◆ SetSize()

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

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

Implements mfem::SpacingFunction.

Definition at line 284 of file spacing.hpp.


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