32#ifndef MADNESS_MRA_FUNCDEFAULTS_H__INCLUDED
33#define MADNESS_MRA_FUNCDEFAULTS_H__INCLUDED
51 template <
typename T, std::
size_t NDIM>
class FunctionImpl;
54 static const int MAXK = 30;
71 template<std::
size_t NDIM=1>
74 else if (treestate==
compressed) os <<
"compressed";
75 else if (treestate==
nonstandard) os <<
"nonstandard";
78 else if (treestate==
redundant) os <<
"redundant";
80 else if (treestate==
on_demand) os <<
"on_demand";
81 else if (treestate==
unknown) os <<
"unknown";
99 template <std::
size_t NDIM>
117 static std::optional<BoundaryConditions<NDIM>>
bc;
124 static std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > >
pmap;
311 if (!
bc.has_value()) {
312 const std::string msg =
"FunctionDefaults<" + std::to_string(
NDIM) +
">::get_bc: must initialize boundary conditions by set_bc or set_defaults or startup";
339 const double dk = (double)
k;
341 double lo_sim=
lo/Lmax;
389 static std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > >&
get_pmap() {
415 pmap->redistribute(world,newpmap);
424 template <std::
size_t NDIM>
426 for (std::size_t i=0; i<
NDIM; ++i)
433 template <
typename T, std::
size_t NDIM>
436 double twon = std::pow(2.0,
double(n));
437 for (std::size_t i=0; i<
NDIM; ++i) {
444 template <std::
size_t NDIM>
446 for (std::size_t i=0; i<
NDIM; ++i)
This header should include pretty much everything needed for the parallel runtime.
Provides BoundaryConditions.
long dim(int i) const
Returns the size of dimension i.
Definition basetensor.h:147
long ndim() const
Returns the number of dimensions in the tensor.
Definition basetensor.h:144
This class is used to specify boundary conditions for all operators.
Definition bc.h:72
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:100
static int get_special_level()
Returns the default projection level for special boxes.
Definition funcdefaults.h:193
static Tensor< double > make_default_cell_width()
Definition funcdefaults.h:135
static void set_tensor_type(const TensorType &t)
Sets the default tensor type.
Definition funcdefaults.h:329
static int get_k()
Returns the default wavelet order.
Definition funcdefaults.h:163
static void set_apply_randomize(bool value)
Sets the random load balancing for integral operators flag.
Definition funcdefaults.h:294
static bool get_project_randomize()
Gets the random load balancing for projection flag.
Definition funcdefaults.h:300
static bool truncate_on_project
If true initial projection inserts at n-1 not n.
Definition funcdefaults.h:114
static int get_truncate_mode()
Gets the default truncation mode.
Definition funcdefaults.h:228
static void set_truncate_mode(int value)
Sets the default truncation mode.
Definition funcdefaults.h:235
static bool apply_randomize
If true use randomization for load balancing in apply integral operator.
Definition funcdefaults.h:115
static void set_truncate_on_project(bool value)
Sets the default truncate on project flag.
Definition funcdefaults.h:284
static void set_thresh(double value)
Sets the default threshold.
Definition funcdefaults.h:183
static double cell_volume
Volume of simulation cell.
Definition funcdefaults.h:121
static void set_special_level(int value)
Existing functions are unaffected.
Definition funcdefaults.h:206
static void set_k(int value)
Sets the default wavelet order.
Definition funcdefaults.h:170
static void redistribute(World &world, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &newpmap)
Sets the default process map and redistributes all functions using the old map.
Definition funcdefaults.h:414
static const double & get_thresh()
Returns the default threshold.
Definition funcdefaults.h:176
static int k
Wavelet order.
Definition funcdefaults.h:105
static double get_cell_volume()
Returns the volume of the user cell.
Definition funcdefaults.h:384
static int get_max_refine_level()
Gets the default maximum adaptive refinement level.
Definition funcdefaults.h:213
static bool get_debug()
Gets the default debug flag (is this used anymore?)
Definition funcdefaults.h:265
static void set_debug(bool value)
Sets the default debug flag (is this used anymore?)
Definition funcdefaults.h:272
static int truncate_mode
Truncation method.
Definition funcdefaults.h:110
static void set_default_pmap(World &world)
Sets the default process map.
Definition mraimpl.h:3574
static bool get_refine()
Gets the default adaptive refinement flag.
Definition funcdefaults.h:241
static Tensor< double > cell_width
Width of simulation cell in each dimension.
Definition funcdefaults.h:119
static void set_autorefine(bool value)
Sets the default adaptive autorefinement flag.
Definition funcdefaults.h:260
static double thresh
Truncation threshold.
Definition funcdefaults.h:106
static void set_bc(const BoundaryConditions< NDIM > &value)
Sets the default boundary conditions.
Definition funcdefaults.h:319
static void set_project_randomize(bool value)
Sets the random load balancing for projection flag.
Definition funcdefaults.h:305
static bool get_autorefine()
Gets the default adaptive autorefinement flag.
Definition funcdefaults.h:253
static bool debug
Controls output of debug info.
Definition funcdefaults.h:113
static int special_level
Minimum level for fine scale projection of special boxes.
Definition funcdefaults.h:108
static double cell_min_width
Size of smallest dimension.
Definition funcdefaults.h:122
static std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > pmap
Default mapping of keys to processes.
Definition funcdefaults.h:124
static TensorType get_tensor_type()
Returns the default tensor type.
Definition funcdefaults.h:324
static const Tensor< double > & get_cell_width()
Returns the width of each user cell dimension.
Definition funcdefaults.h:369
static std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > & get_pmap()
Returns the default process map.
Definition funcdefaults.h:389
static void set_initial_level(int value)
Sets the default initial projection level.
Definition funcdefaults.h:200
static void set_cubic_cell(double lo, double hi)
Sets the user cell to be cubic with each dimension having range [lo,hi].
Definition funcdefaults.h:362
static void set_refine(bool value)
Sets the default adaptive refinement flag.
Definition funcdefaults.h:248
static void set_max_refine_level(int value)
Sets the default maximum adaptive refinement level.
Definition funcdefaults.h:220
static const BoundaryConditions< NDIM > & get_bc()
Returns the default boundary conditions.
Definition funcdefaults.h:310
static Tensor< double > cell
cell[NDIM][2] Simulation cell, cell(0,0)=xlo, cell(0,1)=xhi, ...
Definition funcdefaults.h:118
static void set_cell(const Tensor< double > &value)
Gets the user cell for the simulation.
Definition funcdefaults.h:354
static void set_pmap(const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &value)
Sets the default process map (does not redistribute existing functions)
Definition funcdefaults.h:405
static int initial_level
Initial level for fine scale projection.
Definition funcdefaults.h:107
static bool autorefine
Whether to autorefine in multiplication, etc.
Definition funcdefaults.h:112
static const Tensor< double > & get_rcell_width()
Returns the reciprocal of the width of each user cell dimension.
Definition funcdefaults.h:374
static Tensor< double > make_default_cell()
Definition funcdefaults.h:126
static std::optional< BoundaryConditions< NDIM > > bc
Default boundary conditions, not initialized by default and must be set explicitly before use.
Definition funcdefaults.h:117
static int set_length_scale(const double lo, const size_t k=get_k())
adapt the special level to resolve the smallest length scale
Definition funcdefaults.h:338
static void print()
Definition mraimpl.h:3582
static Tensor< double > rcell_width
Reciprocal of width.
Definition funcdefaults.h:120
static bool get_apply_randomize()
Gets the random load balancing for integral operators flag.
Definition funcdefaults.h:289
static double get_cell_min_width()
Returns the minimum width of any user cell dimension.
Definition funcdefaults.h:379
static void recompute_cell_info()
Definition funcdefaults.h:144
static bool project_randomize
If true use randomization for load balancing in project/refine.
Definition funcdefaults.h:116
static const Tensor< double > & get_cell()
Gets the user cell for the simulation.
Definition funcdefaults.h:347
static void set_defaults(World &world)
Definition mraimpl.h:3553
static int max_refine_level
Level at which to stop refinement.
Definition funcdefaults.h:109
static TensorType tt
structure of the tensor in FunctionNode
Definition funcdefaults.h:123
static int get_initial_level()
Returns the default initial projection level.
Definition funcdefaults.h:188
static bool get_truncate_on_project()
Gets the default truncate on project flag.
Definition funcdefaults.h:277
static bool refine
Whether to refine new functions.
Definition funcdefaults.h:111
Key is the index for a node of the 2^NDIM-tree.
Definition key.h:68
A tensor is a multidimensional array.
Definition tensor.h:317
T max(long *ind=0) const
Return the maximum value (and if ind is non-null, its index) in the Tensor.
Definition tensor.h:1703
T product() const
Return the product of all elements of the tensor.
Definition tensor.h:1676
T min(long *ind=0) const
Return the minimum value (and if ind is non-null, its index) in the Tensor.
Definition tensor.h:1683
A simple, fixed dimension vector.
Definition vector.h:64
Interface to be provided by any process map.
Definition worlddc.h:82
A parallel world class.
Definition world.h:132
static World & get_default()
Default World object accessor.
Definition world.h:260
static double lo
Definition dirac-hatom.cc:23
Multidimension Key for MRA tree and associated iterators.
#define MADNESS_PRAGMA_CLANG(x)
Definition madness_config.h:200
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition madness_exception.h:134
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
std::ostream & operator<<(std::ostream &os, const particle< PDIM > &p)
Definition lowrankfunction.h:397
static Key< NDIM > simpt2key(const Vector< T, NDIM > &pt, Level n)
Definition funcdefaults.h:434
TreeState
Definition funcdefaults.h:59
@ nonstandard_after_apply
s and d coeffs, state after operator application
Definition funcdefaults.h:64
@ on_demand
no coeffs anywhere, but a functor providing if necessary
Definition funcdefaults.h:67
@ redundant_after_merge
s coeffs everywhere, must be summed up to yield the result
Definition funcdefaults.h:66
@ reconstructed
s coeffs at the leaves only
Definition funcdefaults.h:60
@ nonstandard
s and d coeffs in internal nodes
Definition funcdefaults.h:62
@ unknown
Definition funcdefaults.h:68
@ compressed
d coeffs in internal nodes, s and d coeffs at the root
Definition funcdefaults.h:61
@ redundant
s coeffs everywhere
Definition funcdefaults.h:65
@ nonstandard_with_leaves
like nonstandard, with s coeffs at the leaves
Definition funcdefaults.h:63
static void user_to_sim(const Vector< double, NDIM > &xuser, Vector< double, NDIM > &xsim)
Convert user coords (cell[][]) to simulation coords ([0,1]^ndim)
Definition funcdefaults.h:425
int64_t Translation
Definition key.h:56
static void sim_to_user(const Vector< double, NDIM > &xsim, Vector< double, NDIM > &xuser)
Convert simulation coords ([0,1]^ndim) to user coords (FunctionDefaults<NDIM>::get_cell())
Definition funcdefaults.h:445
static const int MAXLEVEL
The maximum depth of refinement possible.
Definition funcdefaults.h:57
static const Slice _(0,-1, 1)
int Level
Definition key.h:57
bool initialized()
Check if the MADNESS runtime has been initialized (and not subsequently finalized).
Definition world.cc:74
static double pop(std::vector< double > &v)
Definition SCF.cc:113
TensorType
low rank representations of tensors (see gentensor.h)
Definition gentensor.h:120
@ TT_FULL
Definition gentensor.h:120
Function< T, NDIM > copy(const Function< T, NDIM > &f, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool fence=true)
Create a new copy of the function with different distribution and optional fence.
Definition mra.h:2037
static const int MAXK
The maximum wavelet order presently supported.
Definition funcdefaults.h:54
Defines and implements most of Tensor.
constexpr std::size_t NDIM
Definition testgconv.cc:54
Implement the madness:Vector class, an extension of std::array that supports some mathematical operat...
Implements WorldContainer.