libMesh::ParameterPointer< T > Class Template Reference

Stores/modifies a user-provided pointer to a parameter. More...

#include <parameter_pointer.h>

Inheritance diagram for libMesh::ParameterPointer< T >:

Public Member Functions

 ParameterPointer (T *param_ptr)
 
virtual void set (const T &new_value) libmesh_override
 
virtual const T & get () const libmesh_override
 
virtual ParameterAccessor< T > & operator= (T *new_ptr) libmesh_override
 
virtual UniquePtr< ParameterAccessor< T > > clone () const libmesh_override
 
ParameterProxy< T > operator* ()
 
ConstParameterProxy< T > operator* () const
 

Private Attributes

T * _ptr
 

Detailed Description

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

Stores/modifies a user-provided pointer to a parameter.

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

Definition at line 44 of file parameter_pointer.h.

Constructor & Destructor Documentation

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

Constructor: take the raw pointer to the parameter

Definition at line 50 of file parameter_pointer.h.

50 : _ptr(param_ptr) {}

Member Function Documentation

template<typename T = Number>
virtual UniquePtr<ParameterAccessor<T> > libMesh::ParameterPointer< T >::clone ( ) const
inlinevirtual

Returns a new copy of the accessor.

Implements libMesh::ParameterAccessor< T >.

Definition at line 78 of file parameter_pointer.h.

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

79  {
80  return UniquePtr<ParameterAccessor<T> >(new ParameterPointer<T>(_ptr));
81  }
template<typename T = Number>
virtual const T& libMesh::ParameterPointer< T >::get ( ) const
inlinevirtual

Getter: get the value of the parameter we access.

Implements libMesh::ParameterAccessor< T >.

Definition at line 60 of file parameter_pointer.h.

References libMesh::ParameterPointer< T >::_ptr, and libMesh::libmesh_assert().

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

86 { return ParameterProxy<T>(*this); }
template<typename T = Number>
ConstParameterProxy<T> libMesh::ParameterAccessor< T >::operator* ( ) const
inlineinherited

Definition at line 88 of file parameter_accessor.h.

References libMesh::ParameterAccessor< T >::clone().

88 { return ConstParameterProxy<T>(*this); }
template<typename T = Number>
virtual ParameterAccessor<T>& libMesh::ParameterPointer< T >::operator= ( T *  new_ptr)
inlinevirtual

Reseater: change the location of the parameter we access. This is included for backward compatibility, but is deprecated.

Reimplemented from libMesh::ParameterAccessor< T >.

Definition at line 68 of file parameter_pointer.h.

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

69  {
70  libmesh_deprecated();
71  _ptr = new_ptr;
72  return *this;
73  }
template<typename T = Number>
virtual void libMesh::ParameterPointer< T >::set ( const T &  new_value)
inlinevirtual

Setter: change the value of the parameter we access.

Implements libMesh::ParameterAccessor< T >.

Definition at line 54 of file parameter_pointer.h.

References libMesh::ParameterPointer< T >::_ptr, and libMesh::libmesh_assert().

55  { libmesh_assert(_ptr); *_ptr = new_value; }
libmesh_assert(j)

Member Data Documentation


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