libMesh
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
libMesh::ParsedFEMFunctionParameter< T > Class Template Reference

Accessor object allowing reading and modification of the independent variables in a parameter sensitivity calculation. More...

#include <parsed_fem_function_parameter.h>

Inheritance diagram for libMesh::ParsedFEMFunctionParameter< T >:
[legend]

Public Member Functions

 ParsedFEMFunctionParameter (ParsedFEMFunction< T > &func_ref, std::string param_name)
 Constructor: take the function to be modified and the name of the inline variable within it which represents our parameter.
 
virtual ParameterAccessor< T > & operator= (T *)
 A simple reseater won't work with a parsed function.
 
virtual void set (const T &new_value) override
 Setter: change the value of the parameter we access.
 
virtual const T & get () const override
 
virtual std::unique_ptr< ParameterAccessor< T > > clone () const override
 
ParameterProxy< T > operator* ()
 Proxy: for backward compatibility, we allow codes to treat a ParameterAccessor as if it were a simple pointer-to-value.
 
ConstParameterProxy< T > operator* () const
 

Private Attributes

ParsedFEMFunction< T > & _func
 
std::string _name
 
libMesh::Number _current_val
 

Detailed Description

template<typename T = Number>
class libMesh::ParsedFEMFunctionParameter< T >

Accessor object allowing reading and modification of the independent variables in a parameter sensitivity calculation.

This ParameterAccessor subclass is specific to ParsedFEMFunction objects: it stores a pointer to the ParsedFEMFunction and a string describing the parameter (an inline variable) name to be accessed.

Author
Roy Stogner
Date
2015

Stores a pointer to a ParsedFEMFunction and a string for the parameter.

Definition at line 50 of file parsed_fem_function_parameter.h.

Constructor & Destructor Documentation

◆ ParsedFEMFunctionParameter()

template<typename T = Number>
libMesh::ParsedFEMFunctionParameter< T >::ParsedFEMFunctionParameter ( ParsedFEMFunction< T > &  func_ref,
std::string  param_name 
)
inline

Constructor: take the function to be modified and the name of the inline variable within it which represents our parameter.

The restrictions of get_inline_value() and set_inline_value() in ParsedFEMFunction apply to this interface as well.

Note
Only the function referred to here is changed by set() - any clones of the function which precede the set() remain at their previous values.

Definition at line 64 of file parsed_fem_function_parameter.h.

65 :
66 _func(func_ref), _name(std::move(param_name)) {}

Member Function Documentation

◆ clone()

template<typename T = Number>
virtual std::unique_ptr< ParameterAccessor< T > > libMesh::ParsedFEMFunctionParameter< T >::clone ( ) const
inlineoverridevirtual
Returns
A new copy of the accessor.

Implements libMesh::ParameterAccessor< T >.

Definition at line 92 of file parsed_fem_function_parameter.h.

92 {
93 return std::make_unique<ParsedFEMFunctionParameter<T>>(_func, _name);
94 }

References libMesh::ParsedFEMFunctionParameter< T >::_func, and libMesh::ParsedFEMFunctionParameter< T >::_name.

◆ get()

template<typename T = Number>
virtual const T & libMesh::ParsedFEMFunctionParameter< T >::get ( ) const
inlineoverridevirtual
Returns
A constant reference to the value of the parameter we access.

Implements libMesh::ParameterAccessor< T >.

Definition at line 84 of file parsed_fem_function_parameter.h.

84 {
85 _current_val = _func.get_inline_value(_name);
86 return _current_val;
87 }

References libMesh::ParsedFEMFunctionParameter< T >::_current_val, libMesh::ParsedFEMFunctionParameter< T >::_func, and libMesh::ParsedFEMFunctionParameter< T >::_name.

◆ operator*() [1/2]

template<typename T = Number>
ParameterProxy< T > libMesh::ParameterAccessor< T >::operator* ( )
inlineinherited

Proxy: for backward compatibility, we allow codes to treat a ParameterAccessor as if it were a simple pointer-to-value.

We can't safely allow "Number * n = parameter_vector[p]" to compile, but we can allow "*parameter_vector[p] += deltap" to work.

Definition at line 80 of file parameter_accessor.h.

80{ return ParameterProxy<T>(*this); }

◆ operator*() [2/2]

template<typename T = Number>
ConstParameterProxy< T > libMesh::ParameterAccessor< T >::operator* ( ) const
inlineinherited

Definition at line 82 of file parameter_accessor.h.

82{ return ConstParameterProxy<T>(*this); }

◆ operator=()

template<typename T = Number>
virtual ParameterAccessor< T > & libMesh::ParsedFEMFunctionParameter< T >::operator= ( T *  )
inlinevirtual

A simple reseater won't work with a parsed function.

Definition at line 72 of file parsed_fem_function_parameter.h.

72{ libmesh_error(); return *this; }

◆ set()

template<typename T = Number>
virtual void libMesh::ParsedFEMFunctionParameter< T >::set ( const T &  new_value)
inlineoverridevirtual

Setter: change the value of the parameter we access.

Implements libMesh::ParameterAccessor< T >.

Definition at line 77 of file parsed_fem_function_parameter.h.

77 {
78 _func.set_inline_value(_name, new_value);
79 }

References libMesh::ParsedFEMFunctionParameter< T >::_func, and libMesh::ParsedFEMFunctionParameter< T >::_name.

Member Data Documentation

◆ _current_val

template<typename T = Number>
libMesh::Number libMesh::ParsedFEMFunctionParameter< T >::_current_val
mutableprivate

◆ _func

template<typename T = Number>
ParsedFEMFunction<T>& libMesh::ParsedFEMFunctionParameter< T >::_func
private

◆ _name

template<typename T = Number>
std::string libMesh::ParsedFEMFunctionParameter< T >::_name
private

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