MADNESS 0.10.1
Public Member Functions | Protected Attributes | Private Types | Private Attributes | Friends | List of all members
madness::FunctionFactory< T, NDIM > Class Template Reference

FunctionFactory implements the named-parameter idiom for Function. More...

#include <function_factory.h>

Inheritance diagram for madness::FunctionFactory< T, NDIM >:
Inheritance graph
[legend]
Collaboration diagram for madness::FunctionFactory< T, NDIM >:
Collaboration graph
[legend]

Public Member Functions

 FunctionFactory (World &world)
 
virtual ~FunctionFactory ()
 
FunctionFactoryautorefine ()
 
FunctionFactorycompressed (bool value=true)
 
FunctionFactoryempty ()
 
FunctionFactoryf (T(*f)(const coordT &))
 
FunctionFactoryfence (bool fence=true)
 
template<typename opT >
std::enable_if< std::is_base_of< FunctionFunctorInterface< T, NDIM >, opT >::value, FunctionFactory & >::type functor (const opT &op)
 pass in a functor that is derived from FunctionFunctorInterface
 
template<typename opT >
std::enable_if< notstd::is_base_of< FunctionFunctorInterface< T, NDIM >, opT >::value, FunctionFactory & >::type functor (const opT &op)
 pass in a functor that is not derived from FunctionFunctorInterface
 
FunctionFactoryfunctor (const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > &f)
 
virtual std::shared_ptr< FunctionFunctorInterface< T, NDIM > > get_functor () const
 return the functor; override this if the functor needs deferred construction
 
int get_k () const
 
double get_thresh () const
 
Worldget_world () const
 
FunctionFactoryinitial_level (int initial_level)
 
virtual FunctionFactoryis_on_demand ()
 
virtual FunctionFactoryk (int k)
 
FunctionFactorymax_refine_level (int max_refine_level)
 
FunctionFactoryno_functor ()
 
FunctionFactorynoautorefine ()
 
FunctionFactorynofence ()
 
FunctionFactorynorefine (bool norefine=true)
 
FunctionFactorynotruncate_on_project ()
 
FunctionFactorypmap (const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap)
 
FunctionFactoryrefine (bool refine=true)
 
FunctionFactoryself ()
 implement this in all derived classes for correct chaining
 
FunctionFactoryspecial_level (int special_level)
 
FunctionFactoryspecial_points (std::vector< Vector< double, NDIM > > &special_points)
 
virtual FunctionFactorythresh (double thresh)
 
FunctionFactorytruncate_mode (int truncate_mode)
 
FunctionFactorytruncate_on_project ()
 

Protected Attributes

bool _autorefine
 
bool _empty
 
bool _fence
 
int _initial_level = FunctionDefaults<NDIM>::get_initial_level()
 
int _k
 
int _max_refine_level
 
std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > _pmap
 
bool _refine
 
int _special_level = FunctionDefaults<NDIM>::get_special_level()
 
std::vector< Vector< double, NDIM > > _special_points
 
double _thresh
 
TreeState _tree_state
 
int _truncate_mode
 
bool _truncate_on_project
 
World_world
 

Private Types

typedef Vector< double, NDIMcoordT
 Type of vector holding coordinates.
 

Private Attributes

std::shared_ptr< FunctionFunctorInterface< T, NDIM > > _functor
 

Friends

class FunctionImpl< T, NDIM >
 

Detailed Description

template<typename T, std::size_t NDIM>
class madness::FunctionFactory< T, NDIM >

FunctionFactory implements the named-parameter idiom for Function.

C++ does not provide named arguments (as does, e.g., Python). This class provides something very close. Create functions as follows

double myfunc(const double x[]);
Function<double,3> f = FunctionFactory<double,3>(world).f(myfunc).k(11).thresh(1e-9).debug()
FunctionFactory implements the named-parameter idiom for Function.
Definition function_factory.h:86
virtual FunctionFactory & thresh(double thresh)
Definition function_factory.h:191
FunctionFactory & f(T(*f)(const coordT &))
Definition function_factory.h:180
virtual FunctionFactory & k(int k)
Definition function_factory.h:186
A multiresolution adaptive numerical function.
Definition mra.h:122
NDIM & f
Definition mra.h:2416
void e()
Definition test_sig.cc:75

where the methods of function factory, which specify the non-default arguments eventually passed to the Function constructor, can be used in any order.

Need to add a general functor for initial projection with a standard interface.

Member Typedef Documentation

◆ coordT

template<typename T , std::size_t NDIM>
typedef Vector<double, NDIM> madness::FunctionFactory< T, NDIM >::coordT
private

Type of vector holding coordinates.

Constructor & Destructor Documentation

◆ FunctionFactory()

template<typename T , std::size_t NDIM>
madness::FunctionFactory< T, NDIM >::FunctionFactory ( World world)
inline

◆ ~FunctionFactory()

template<typename T , std::size_t NDIM>
virtual madness::FunctionFactory< T, NDIM >::~FunctionFactory ( )
inlinevirtual

Member Function Documentation

◆ autorefine()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::autorefine ( )
inline

◆ compressed()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::compressed ( bool  value = true)
inline

◆ empty()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::empty ( )
inline

◆ f()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::f ( T(*)(const coordT &)  f)
inline

◆ fence()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::fence ( bool  fence = true)
inline

◆ functor() [1/3]

template<typename T , std::size_t NDIM>
template<typename opT >
std::enable_if< std::is_base_of< FunctionFunctorInterface< T, NDIM >, opT >::value, FunctionFactory & >::type madness::FunctionFactory< T, NDIM >::functor ( const opT &  op)
inline

pass in a functor that is derived from FunctionFunctorInterface

similar to the first version of functor, but easy-to-use FunctionFunctorInterface must be a public base of opT

References madness::FunctionFactory< T, NDIM >::_functor, op(), and madness::FunctionFactory< T, NDIM >::self().

◆ functor() [2/3]

template<typename T , std::size_t NDIM>
template<typename opT >
std::enable_if< notstd::is_base_of< FunctionFunctorInterface< T, NDIM >, opT >::value, FunctionFactory & >::type madness::FunctionFactory< T, NDIM >::functor ( const opT &  op)
inline

pass in a functor that is not derived from FunctionFunctorInterface

similar to the first version of functor, but easy-to-use

References madness::FunctionFactory< T, NDIM >::_functor, op(), and madness::FunctionFactory< T, NDIM >::self().

◆ functor() [3/3]

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::functor ( const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > &  f)
inline

◆ get_functor()

template<typename T , std::size_t NDIM>
virtual std::shared_ptr< FunctionFunctorInterface< T, NDIM > > madness::FunctionFactory< T, NDIM >::get_functor ( ) const
inlinevirtual

return the functor; override this if the functor needs deferred construction

Reimplemented in madness::CompositeFactory< T, NDIM, MDIM >, and madness::TwoElectronFactory< T, NDIM >.

References madness::FunctionFactory< T, NDIM >::_functor.

◆ get_k()

template<typename T , std::size_t NDIM>
int madness::FunctionFactory< T, NDIM >::get_k ( ) const
inline

◆ get_thresh()

template<typename T , std::size_t NDIM>
double madness::FunctionFactory< T, NDIM >::get_thresh ( ) const
inline

◆ get_world()

template<typename T , std::size_t NDIM>
World & madness::FunctionFactory< T, NDIM >::get_world ( ) const
inline

◆ initial_level()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::initial_level ( int  initial_level)
inline

◆ is_on_demand()

template<typename T , std::size_t NDIM>
virtual FunctionFactory & madness::FunctionFactory< T, NDIM >::is_on_demand ( )
inlinevirtual

◆ k()

template<typename T , std::size_t NDIM>
virtual FunctionFactory & madness::FunctionFactory< T, NDIM >::k ( int  k)
inlinevirtual

◆ max_refine_level()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::max_refine_level ( int  max_refine_level)
inline

◆ no_functor()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::no_functor ( )
inline

◆ noautorefine()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::noautorefine ( )
inline

◆ nofence()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::nofence ( )
inline

◆ norefine()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::norefine ( bool  norefine = true)
inline

◆ notruncate_on_project()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::notruncate_on_project ( )
inline

◆ pmap()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::pmap ( const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &  pmap)
inline

◆ refine()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::refine ( bool  refine = true)
inline

◆ self()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::self ( )
inline

◆ special_level()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::special_level ( int  special_level)
inline

◆ special_points()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::special_points ( std::vector< Vector< double, NDIM > > &  special_points)
inline

◆ thresh()

template<typename T , std::size_t NDIM>
virtual FunctionFactory & madness::FunctionFactory< T, NDIM >::thresh ( double  thresh)
inlinevirtual

◆ truncate_mode()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::truncate_mode ( int  truncate_mode)
inline

◆ truncate_on_project()

template<typename T , std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::truncate_on_project ( )
inline

Friends And Related Symbol Documentation

◆ FunctionImpl< T, NDIM >

template<typename T , std::size_t NDIM>
friend class FunctionImpl< T, NDIM >
friend

Member Data Documentation

◆ _autorefine

template<typename T , std::size_t NDIM>
bool madness::FunctionFactory< T, NDIM >::_autorefine
protected

◆ _empty

template<typename T , std::size_t NDIM>
bool madness::FunctionFactory< T, NDIM >::_empty
protected

◆ _fence

template<typename T , std::size_t NDIM>
bool madness::FunctionFactory< T, NDIM >::_fence
protected

◆ _functor

template<typename T , std::size_t NDIM>
std::shared_ptr<FunctionFunctorInterface<T, NDIM> > madness::FunctionFactory< T, NDIM >::_functor
private

◆ _initial_level

template<typename T , std::size_t NDIM>
int madness::FunctionFactory< T, NDIM >::_initial_level = FunctionDefaults<NDIM>::get_initial_level()
protected

◆ _k

template<typename T , std::size_t NDIM>
int madness::FunctionFactory< T, NDIM >::_k
protected

◆ _max_refine_level

template<typename T , std::size_t NDIM>
int madness::FunctionFactory< T, NDIM >::_max_refine_level
protected

◆ _pmap

template<typename T , std::size_t NDIM>
std::shared_ptr<WorldDCPmapInterface<Key<NDIM> > > madness::FunctionFactory< T, NDIM >::_pmap
protected

◆ _refine

template<typename T , std::size_t NDIM>
bool madness::FunctionFactory< T, NDIM >::_refine
protected

◆ _special_level

template<typename T , std::size_t NDIM>
int madness::FunctionFactory< T, NDIM >::_special_level = FunctionDefaults<NDIM>::get_special_level()
protected

◆ _special_points

template<typename T , std::size_t NDIM>
std::vector<Vector<double, NDIM> > madness::FunctionFactory< T, NDIM >::_special_points
protected

◆ _thresh

template<typename T , std::size_t NDIM>
double madness::FunctionFactory< T, NDIM >::_thresh
protected

◆ _tree_state

template<typename T , std::size_t NDIM>
TreeState madness::FunctionFactory< T, NDIM >::_tree_state
protected

◆ _truncate_mode

template<typename T , std::size_t NDIM>
int madness::FunctionFactory< T, NDIM >::_truncate_mode
protected

◆ _truncate_on_project

template<typename T , std::size_t NDIM>
bool madness::FunctionFactory< T, NDIM >::_truncate_on_project
protected

◆ _world

template<typename T , std::size_t NDIM>
World& madness::FunctionFactory< T, NDIM >::_world
protected

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