MADNESS 0.10.1
madness::DerivativeBase< T, NDIM > Class Template Referenceabstract

Tri-diagonal operator traversing tree primarily for derivative operator. More...

#include <derivative.h>

Inheritance diagram for madness::DerivativeBase< T, NDIM >:
Collaboration diagram for madness::DerivativeBase< T, NDIM >:

Classes

struct  submit_op
 Body of FunctionImpl::diff's submission loop, as a functor for taskq.for_each. More...

Public Types

typedef std::pair< keyT, coeffT > argT
typedef GenTensor< T > coeffT
 holding the node's coeffs (possibly low rank)
typedef WorldContainer< Key< NDIM >, FunctionNode< T, NDIM > > dcT
typedef Function< T, NDIM > functionT
typedef FunctionImpl< T, NDIM > implT
typedef Key< NDIM > keyT
typedef FunctionNode< T, NDIM > nodeT
typedef Tensor< T > tensorT
 regular tensors, like rm, etc
Public Types inherited from madness::WorldObject< DerivativeBase< T, NDIM > >
typedef WorldObject< DerivativeBase< T, NDIM > > objT

Public Member Functions

 DerivativeBase (World &world, std::size_t axis, int k, BoundaryConditions< NDIM > bc)
virtual ~DerivativeBase ()
void do_diff1 (const implT *f, implT *df, const keyT &key, const argT &left, const argT &center, const argT &right) const
virtual void do_diff2b (const implT *f, implT *df, const keyT &key, const argT &left, const argT &center, const argT &right) const =0
virtual void do_diff2i (const implT *f, implT *df, const keyT &key, const argT &left, const argT &center, const argT &right) const =0
Future< argT > find_neighbor (const implT *f, const Key< NDIM > &key, int step) const
void forward_do_diff1 (const implT *f, implT *df, const keyT &key, const argT &left, const argT &center, const argT &right) const
Key< NDIM > neighbor (const keyT &key, int step) const
Function< T, NDIM > operator() (const functionT &f, bool fence=true) const
 Differentiate w.r.t. given coordinate (x=0, y=1, ...) with optional fence.
template<typename Archive>
void serialize (const Archive &ar) const
void stage_halo (const implT *f, bool fence=true) const
 Push f's remote same-level neighbor coefficients to the ranks that will need them.
void submit_diff_tasks (const implT *f, implT *df) const
 Parallel form of FunctionImpl::diff's submission loop; the caller owns the fence.
Public Member Functions inherited from madness::WorldObject< DerivativeBase< T, NDIM > >
 WorldObject (const WorldObject &other)
 WorldObject (World &world)
 Constructor that associates an object (via the derived class) with a globally unique ID.
virtual ~WorldObject ()
WorldObject & operator= (const WorldObject &)=delete
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8, const a9T &a9) const
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8, const a9T &a9, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5,a6,a7,a8,a9).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5,a6,a7,a8).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5,a6,a7).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5,a6).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)().
Public Member Functions inherited from madness::WorldObjectBase
virtual ~WorldObjectBase ()
World & get_world () const
World & get_world_noexcept () const noexcept
 Get the world to which this object belongs, without risking a throw.
const uniqueidT & id () const
 Returns the globally unique object ID.
bool world_is_alive () const noexcept
 Reports whether the world to which this object belongs still exists.

Static Public Member Functions

static bool enforce_bc (int bc_left, int bc_right, Level n, Translation &l)

Public Attributes

bool parallel_submit_ = false
 Spawn diff's per-node tasks from the task pool instead of the main thread.

Protected Attributes

const std::size_t axis
 Axis along which the operation is performed.
const BoundaryConditions< NDIM > bc
const int k
 Number of wavelets of the function.
const std::vector< long > vk
 (k,...) used to initialize Tensors
World & world

Private Types

typedef WorldObject< DerivativeBase< T, NDIM > > woT

Friends

class FunctionImpl< T, NDIM >

Additional Inherited Members

Protected Member Functions inherited from madness::WorldObject< DerivativeBase< T, NDIM > >
void process_pending ()
 To be called from derived constructor to process pending messages.
Protected Member Functions inherited from madness::WorldObjectBase
 WorldObjectBase (const WorldObjectBase &other)
 Copy constructor; produces an unregistered object.
 WorldObjectBase (World &w)
 Construct a new WorldObjectBase.
World & get_world_unchecked () const noexcept
 Unchecked access to the memoized world reference.
template<typename DerivedT>
void register_self (DerivedT *this_ptr)
 Registers this object with its world, making it globally addressable.

Detailed Description

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

Tri-diagonal operator traversing tree primarily for derivative operator.

Member Typedef Documentation

◆ argT

template<typename T, std::size_t NDIM>
typedef std::pair<keyT,coeffT> madness::DerivativeBase< T, NDIM >::argT

◆ coeffT

template<typename T, std::size_t NDIM>
typedef GenTensor<T> madness::DerivativeBase< T, NDIM >::coeffT

holding the node's coeffs (possibly low rank)

◆ dcT

template<typename T, std::size_t NDIM>
typedef WorldContainer<Key<NDIM> , FunctionNode<T, NDIM> > madness::DerivativeBase< T, NDIM >::dcT

◆ functionT

template<typename T, std::size_t NDIM>
typedef Function<T,NDIM> madness::DerivativeBase< T, NDIM >::functionT

◆ implT

template<typename T, std::size_t NDIM>
typedef FunctionImpl<T,NDIM> madness::DerivativeBase< T, NDIM >::implT

◆ keyT

template<typename T, std::size_t NDIM>
typedef Key<NDIM> madness::DerivativeBase< T, NDIM >::keyT

◆ nodeT

template<typename T, std::size_t NDIM>
typedef FunctionNode<T,NDIM> madness::DerivativeBase< T, NDIM >::nodeT

◆ tensorT

template<typename T, std::size_t NDIM>
typedef Tensor<T> madness::DerivativeBase< T, NDIM >::tensorT

regular tensors, like rm, etc

◆ woT

template<typename T, std::size_t NDIM>
typedef WorldObject< DerivativeBase<T, NDIM> > madness::DerivativeBase< T, NDIM >::woT
private

Constructor & Destructor Documentation

◆ DerivativeBase()

◆ ~DerivativeBase()

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

Member Function Documentation

◆ do_diff1()

template<typename T, std::size_t NDIM>
void madness::DerivativeBase< T, NDIM >::do_diff1 ( const implT * f,
implT * df,
const keyT & key,
const argT & left,
const argT & center,
const argT & right ) const
inline

◆ do_diff2b()

template<typename T, std::size_t NDIM>
virtual void madness::DerivativeBase< T, NDIM >::do_diff2b ( const implT * f,
implT * df,
const keyT & key,
const argT & left,
const argT & center,
const argT & right ) const
pure virtual

Implemented in madness::Derivative< T, NDIM >.

References madness::f.

Referenced by forward_do_diff1().

◆ do_diff2i()

template<typename T, std::size_t NDIM>
virtual void madness::DerivativeBase< T, NDIM >::do_diff2i ( const implT * f,
implT * df,
const keyT & key,
const argT & left,
const argT & center,
const argT & right ) const
pure virtual

Implemented in madness::Derivative< T, NDIM >.

References madness::f.

Referenced by forward_do_diff1().

◆ enforce_bc()

template<typename T, std::size_t NDIM>
bool madness::DerivativeBase< T, NDIM >::enforce_bc ( int bc_left,
int bc_right,
Level n,
Translation & l )
inlinestatic

◆ find_neighbor()

◆ forward_do_diff1()

◆ neighbor()

template<typename T, std::size_t NDIM>
Key< NDIM > madness::DerivativeBase< T, NDIM >::neighbor ( const keyT & key,
int step ) const
inline

◆ operator()()

template<typename T, std::size_t NDIM>
Function< T, NDIM > madness::DerivativeBase< T, NDIM >::operator() ( const functionT & f,
bool fence = true ) const
inline

Differentiate w.r.t. given coordinate (x=0, y=1, ...) with optional fence.

Returns a new function with the same distribution

References madness::f, madness::Function< T, NDIM >::get_impl(), MADNESS_CHECK_THROW, madness::reconstructed, madness::Function< T, NDIM >::set_impl(), and VERIFY_TREE.

◆ serialize()

template<typename T, std::size_t NDIM>
template<typename Archive>
void madness::DerivativeBase< T, NDIM >::serialize ( const Archive & ar) const
inline

◆ stage_halo()

template<typename T, std::size_t NDIM>
void madness::DerivativeBase< T, NDIM >::stage_halo ( const implT * f,
bool fence = true ) const
inline

Push f's remote same-level neighbor coefficients to the ranks that will need them.

Node M is the neighbor of M-1 and M+1, so its owner pushes it to the owners of those keys without being asked, one batched message per destination. This is the axis-specific staging policy for FunctionImpl's halo table; halo_clear() frees the result. The pushes arrive as tasks, so the fence is what separates staging from differentiating.

References d, madness::f, madness::TaskAttributes::hipri(), madness::Key< NDIM >::is_invalid(), neighbor(), madness::WorldContainer< keyT, valueT, hashfunT >::owner(), madness::FunctionImpl< T, NDIM >::receive_halo(), and world.

◆ submit_diff_tasks()

template<typename T, std::size_t NDIM>
void madness::DerivativeBase< T, NDIM >::submit_diff_tasks ( const implT * f,
implT * df ) const
inline

Parallel form of FunctionImpl::diff's submission loop; the caller owns the fence.

References madness::f, madness::World::taskq, and madness::FunctionImpl< T, NDIM >::world.

◆ FunctionImpl< T, NDIM >

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

References NDIM, and vk.

Member Data Documentation

◆ axis

◆ bc

◆ k

◆ parallel_submit_

template<typename T, std::size_t NDIM>
bool madness::DerivativeBase< T, NDIM >::parallel_submit_ = false

Spawn diff's per-node tasks from the task pool instead of the main thread.

The same tasks are produced, so the result is unchanged. Per instance and off by default, since it only pays off when many functions are differentiated at once.

◆ vk

template<typename T, std::size_t NDIM>
const std::vector<long> madness::DerivativeBase< T, NDIM >::vk
protected

(k,...) used to initialize Tensors

Referenced by DerivativeBase(), find_neighbor(), and FunctionImpl< T, NDIM >.

◆ world

template<typename T, std::size_t NDIM>
World& madness::DerivativeBase< T, NDIM >::world
protected

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