libMesh
Public Member Functions | Private Attributes | List of all members
libMesh::ParameterPointer< T > Class Template Reference

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

#include <parameter_pointer.h>

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

Public Member Functions

 ParameterPointer (T *param_ptr)
 Constructor: take the raw pointer to the parameter. More...
 
virtual void set (const T &new_value) override
 Setter: change the value of the parameter we access. More...
 
virtual const T & get () const override
 Getter: get the value of the parameter we access. More...
 
virtual ParameterAccessor< T > & operator= (T *new_ptr) override
 Reseater: change the location of the parameter we access. More...
 
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. More...
 
ConstParameterProxy< T > operator* () const
 

Private Attributes

T * _ptr
 

Detailed Description

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

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

This is the "default" ParameterAccessor subclass: it simply stores a user-provided pointer to the parameter, and modifies the value at that location in memory.

Author
Roy Stogner
Date
2015 Stores/modifies a user-provided pointer to a parameter.

Definition at line 45 of file parameter_pointer.h.

Constructor & Destructor Documentation

◆ ParameterPointer()

template<typename T = Number>
libMesh::ParameterPointer< T >::ParameterPointer ( T *  param_ptr)

Constructor: take the raw pointer to the parameter.

Definition at line 51 of file parameter_pointer.h.

51 : _ptr(param_ptr) {}

Member Function Documentation

◆ clone()

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

Implements libMesh::ParameterAccessor< T >.

Definition at line 83 of file parameter_pointer.h.

References libMesh::ParameterPointer< T >::_ptr.

84  {
85  return libmesh_make_unique<ParameterPointer<T>>(_ptr);
86  }

◆ get()

template<typename T = Number>
virtual const T& libMesh::ParameterPointer< T >::get ( ) const
overridevirtual

Getter: get the value of the parameter we access.

Implements libMesh::ParameterAccessor< T >.

Definition at line 61 of file parameter_pointer.h.

References libMesh::ParameterPointer< T >::_ptr.

62  { libmesh_assert(_ptr); return *_ptr; }

◆ operator*() [1/2]

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

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 91 of file parameter_accessor.h.

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

◆ operator*() [2/2]

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

Definition at line 93 of file parameter_accessor.h.

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

◆ operator=()

template<typename T = Number>
virtual ParameterAccessor<T>& libMesh::ParameterPointer< T >::operator= ( T *  new_ptr)
overridevirtual

Reseater: change the location of the parameter we access.

Deprecated:
This is included for backward compatibility, but should no longer be used.

Reimplemented from libMesh::ParameterAccessor< T >.

Definition at line 72 of file parameter_pointer.h.

References libMesh::ParameterPointer< T >::_ptr.

73  {
74  libmesh_deprecated();
75  _ptr = new_ptr;
76  return *this;
77  }

◆ set()

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

Setter: change the value of the parameter we access.

Implements libMesh::ParameterAccessor< T >.

Definition at line 55 of file parameter_pointer.h.

References libMesh::ParameterPointer< T >::_ptr.

56  { libmesh_assert(_ptr); *_ptr = new_value; }

Member Data Documentation

◆ _ptr

template<typename T = Number>
T* libMesh::ParameterPointer< T >::_ptr
private

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