MADNESS 0.10.1
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 >:
Collaboration diagram for madness::FunctionFactory< T, NDIM >:

Public Member Functions

 FunctionFactory (World &world)
virtual ~FunctionFactory ()
FunctionFactory & autorefine ()
FunctionFactory & compressed (bool value=true)
FunctionFactory & empty ()
FunctionFactory & f (T(*f)(const coordT &))
FunctionFactory & fence (bool fence=true)
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
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
FunctionFactory & functor (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
World & get_world () const
FunctionFactory & initial_level (int initial_level)
virtual FunctionFactory & is_on_demand ()
virtual FunctionFactory & k (int k)
FunctionFactory & max_refine_level (int max_refine_level)
FunctionFactory & no_functor ()
FunctionFactory & noautorefine ()
FunctionFactory & nofence ()
FunctionFactory & norefine (bool norefine=true)
FunctionFactory & notruncate_on_project ()
FunctionFactory & pmap (const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap)
FunctionFactory & refine (bool refine=true)
FunctionFactory & self ()
 implement this in all derived classes for correct chaining
FunctionFactory & special_level (int special_level)
FunctionFactory & special_points (const std::vector< Vector< double, NDIM > > &special_points)
virtual FunctionFactory & thresh (double thresh)
FunctionFactory & treestate (const TreeState state)
FunctionFactory & truncate_mode (int truncate_mode)
FunctionFactory & truncate_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, NDIM > coordT
 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(World &world)
Definition function_factory.h:120
FunctionFactory & f(T(*f)(const coordT &))
Definition function_factory.h:187
A multiresolution adaptive numerical function.
Definition mra.h:141
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()

◆ empty()

◆ f()

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

Referenced by madness::SCF::analyze_vectors(), bind_function_type(), check_multiplication_table_c2v(), check_operator_multiplications_2d(), check_operator_multiplications_3d(), compute_update(), cplxfunc0(), cplxfunc1(), cplxfunc2(), doit(), expV(), madness::CompositeFactory< T, NDIM, MDIM >::g12(), data< T, NDIM >::initialize(), DF::iterate(), madness::CompositeFactory< T, NDIM, MDIM >::ket(), madness::CompositeFactory< T, NDIM, MDIM >::ket(), main(), madness::smooth< T, NDIM >::make_inv_mask(), make_potential(), madness::LRFunctorF12< T, NDIM, LDIM >::norm2(), madness::CompositeFactory< T, NDIM, MDIM >::particle1(), madness::CompositeFactory< T, NDIM, MDIM >::particle1(), madness::CompositeFactory< T, NDIM, MDIM >::particle2(), madness::CompositeFactory< T, NDIM, MDIM >::particle2(), plot_symmetry_operators(), print_info(), propagate(), propagate(), propagate(), q_c(), madness::InitParameters::read(), realfunc0(), realfunc1(), realfunc2(), run(), run(), run_one(), run_tests(), solve(), test(), test(), madness::smooth< T, NDIM >::test_1d(), test_adaptive_tree(), test_add(), test_chin_chen(), test_compress(), test_consolidate_vs_direct(), test_convolution(), test_ctor_orthonormalization(), test_diagnose_GQKffK(), test_diagnose_GQUe(), test_diagnose_GUe(), test_diagnose_Ue(), test_driver_keeps_root(), test_driver_rejects_nonfinite_cost(), test_exchange(), test_gconv(), test_GQUe(), test_GUe(), test_hartree_product(), test_he(), test_he_potential(), test_hf_be(), test_hf_h2(), test_hf_he(), test_hydro(), test_inner(), test_meta_gga(), test_meta_gga_one_orbital_energy(), test_modified(), test_multiply(), test_node_replicated_function(), test_orthogonalization(), madness::CCPotentials::test_pairs(), test_per(), test_periodic(), test_periodic1(), test_periodic2(), test_periodic_bsh(), test_project_ab(), test_projector(), test_projector_outer(), test_recursive_application(), test_replicate(), madness::CCPotentials::test_singles_potential(), test_slater_exchange(), test_sum_down(), test_swap_particles(), test_trotter(), test_truncation(), test_tt2d_summation(), test_vector_composite(), test_Vphi_ij_u(), test_with_function(), test_with_function_vector(), test_xc2(), testbsh(), testNavierStokes(), testPeriodicCoulomb3d(), madness::CompositeFactory< T, NDIM, MDIM >::V_for_particle1(), and madness::CompositeFactory< T, NDIM, MDIM >::V_for_particle2().

◆ fence()

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

Referenced by madness::apply().

◆ functor() [1/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

◆ functor() [2/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

◆ 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

Referenced by madness::Diamagnetic_potential_factor::Diamagnetic_potential_factor(), KPeriodicBSHOperator::KPeriodicBSHOperator(), KPeriodicBSHOperator::KPeriodicBSHOperator(), LProjector::LProjector(), SVPESolver::SVPESolver(), madness::SCF::analyze_vectors(), madness::Solver< T, NDIM >::apply_hf_exchange4(), apply_periodic_bsh(), madness::Diamagnetic_potential_factor::bare_diamagnetic_potential(), bench_cell(), Calculation::calc_optimal_coeffs(), madness::MolecularOrbitals< T, NDIM >::compute_center(), madness::guessfactory::compute_centroid(), madness::guessfactory::compute_centroids(), madness::Nemo::compute_cphf_parallel_term(), madness::OEP::compute_dcep_correction(), madness::OEP::compute_exchange_energy_vir(), madness::Znemo::compute_linear_moment(), madness::Diamagnetic_potential_factor::compute_lz_commutator(), madness::Znemo::compute_magnetic_vector_potential(), madness::OEP::compute_mrks_correction(), madness::Diamagnetic_potential_factor::compute_nabla_R_div_R(), madness::Diamagnetic_potential_factor::compute_R_times_T_commutator_scalar_term_numerically(), Calculation::compute_residuals(), madness::OEP::compute_slater_potential(), madness::OEP::compute_total_kinetic_density(), madness::Diamagnetic_potential_factor::compute_U2(), madness::NemoBase::construct_nuclear_correlation_factor(), madness::Diamagnetic_potential_factor::custom_factor(), madness::Znemo::custom_guess(), madness::SCF::dipole(), dnuclear_anchor_test(), MiniDFT::doit(), Plotter::doplot1(), exchange_anchor_test(), madness::exchange_anchor_test(), madness::FunctionFactory< double, 3 >::f(), madness::Diamagnetic_potential_factor::factor_with_phase(), fixphases(), madness::NuclearCorrelationFactor::function(), ExactSpinor::get_spinor(), sgl_guess::get_wf(), golden_check_ndim(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::harmonic_basis(), madness::Znemo::hcore_guess(), madness::Nemo::hessian(), madness::SCF::initial_guess_ao_eigenvectors(), madness::NuclearCorrelationFactor::initialize(), madness::LRFunctorF12< T, NDIM, LDIM >::inner(), madness::NuclearCorrelationFactor::inverse(), madness::Localizer::localize_boys(), main(), make_basis(), madness::Nemo::make_cphf_constant_term(), madness::Nemo::make_ddensity(), madness::Diamagnetic_potential_factor::make_fake_orbitals(), DF::make_fermi_potential(), DF::make_gaussian_potential(), DF::make_gaussian_potential(), Ansatz0::make_guess(), make_Hd(), make_Hv(), madness::Nemo::make_incomplete_hessian(), make_nuclear_charge_density(), make_nuclear_charge_density_individual(), make_operands(), DF::make_point_potential(), DF::make_point_potential(), madness::GTHPseudopotential< Q >::make_pseudo_potential(), Calculation::make_reference(), make_ri_basis(), madness::Nemo::make_sigma(), Calculation::make_Upsi(), madness::TDHF::make_virtuals(), makeao(), MiniDFT::makeao(), makeao_slow(), moments(), madness::ProjRLMStore::nlmproj(), nuclear_anchor_test(), BoysLocalization::operator()(), madness::DNuclear< T, NDIM >::operator()(), madness::Lz< T, NDIM >::operator()(), madness::TDHF::oscillator_strength_length(), project(), madness::Solver< T, NDIM >::project_ao_basis(), madness::SCF::project_ao_basis_only(), Ansatz0::R(), random_gaussians(), madness::Znemo::recompute_factors_and_potentials(), Ansatz0::Rinv(), run(), run_batched_cell(), run_correctness_cell(), madness::XCOperator< T, NDIM >::set_tau(), simple_example(), madness::Nemo::solve_cphf(), madness::NuclearCorrelationFactor::square(), madness::NuclearCorrelationFactor::square_times_V_derivative(), test(), test(), test2(), test_adaptive_diagnosis(), test_adaptive_grid_projection(), test_adaptive_project(), test_add(), test_apply_push_1d(), test_arithmetic(), test_asymmetric(), test_basic(), test_bsh(), test_combined_operators(), madness::Znemo::test_compute_current_density(), test_construction(), test_conv(), test_converged_function(), test_convergence(), test_conversion(), test_copy_function_from_other_world(), test_copy_function_from_other_world_through_cloud(), test_coulomb(), test_cross(), test_diff(), test_direct_projection(), test_dot(), madness::test_exchange(), test_exchange(), madness::Diamagnetic_potential_factor::test_factor(), test_fock(), test_gaussian_num_coeffs(), madness::Diamagnetic_potential_factor::test_harmonic_potential(), test_hermiticity(), test_hf_he(), test_inner(), test_inner(), test_integration(), test_invrsq_operator(), test_io(), test_kinetic(), madness::Znemo::test_landau_wave_function(), test_lowrank_function(), test_math(), test_matrix_mul_sparse(), test_multi_to_multi_op(), test_nuclear_potential(), test_numerics(), test_op(), test_opdir(), test_operator_apply(), test_orthonormalize_canonical(), test_orthonormalize_symmetric(), test_output_param_overload(), test_partial_inner(), test_plot(), test_pointer_to_funcimpl(), test_proj(), test_projector(), test_Q12_projector(), test_qm(), test_redistribute_to_batches(), test_remove_lindep(), test_replication_policy(), test_rot(), test_size(), test_spherical_box(), test_tight_diffuse(), test_transform(), test_unaryop(), test_weighted_bra_exchange(), test_XCOperator(), test_XCOperator_matrix(), testgradG(), and madness::LowRankFunctionFactory< T, NDIM, LDIM >::Yformer().

◆ 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 >.

◆ 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()

◆ is_on_demand()

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

◆ k()

◆ 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()

◆ norefine()

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

Referenced by test_conv(), and test_per().

◆ 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()

◆ special_level()

◆ special_points()

◆ thresh()

◆ treestate()

template<typename T, std::size_t NDIM>
FunctionFactory & madness::FunctionFactory< T, NDIM >::treestate ( const TreeState state)
inline

◆ truncate_mode()

◆ truncate_on_project()

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

Referenced by KPeriodicBSHOperator::KPeriodicBSHOperator(), KPeriodicBSHOperator::KPeriodicBSHOperator(), apply_periodic_bsh(), madness::Nemo::compute_cphf_parallel_term(), madness::OEP::compute_total_kinetic_density(), madness::Diamagnetic_potential_factor::compute_U2(), dnuclear_anchor_test(), MiniDFT::doit(), exchange_anchor_test(), madness::exchange_anchor_test(), fixphases(), madness::NuclearCorrelationFactor::function(), madness::Nemo::hessian(), madness::SCF::initial_guess_ao_eigenvectors(), madness::NuclearCorrelationFactor::initialize(), madness::NuclearCorrelationFactor::inverse(), main(), make_basis(), madness::Nemo::make_cphf_constant_term(), madness::Nemo::make_ddensity(), DF::make_gaussian_potential(), DF::make_gaussian_potential(), make_nuclear_charge_density(), make_nuclear_charge_density_individual(), DF::make_point_potential(), DF::make_point_potential(), madness::GTHPseudopotential< Q >::make_pseudo_potential(), makeao(), MiniDFT::makeao(), makeao_slow(), madness::ProjRLMStore::nlmproj(), nuclear_anchor_test(), madness::DNuclear< T, NDIM >::operator()(), print_info(), madness::Solver< T, NDIM >::project_ao_basis(), madness::SCF::project_ao_basis_only(), Calculation::project_potential_basis(), q_c(), madness::XCOperator< T, NDIM >::set_tau(), madness::Nemo::solve_cphf(), madness::NuclearCorrelationFactor::square(), madness::NuclearCorrelationFactor::square_times_V_derivative(), test_asymmetric(), test_coulomb(), madness::test_exchange(), test_exchange(), test_fock(), test_gaussian_num_coeffs(), test_hermiticity(), test_kinetic(), test_slater_exchange(), test_XCOperator_matrix(), and testNavierStokes().

◆ 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: