32#ifndef MADNESS_MRA_FUNCDEFAULTS_H__INCLUDED
33#define MADNESS_MRA_FUNCDEFAULTS_H__INCLUDED
48 template <
typename T, std::
size_t NDIM>
class FunctionImpl;
51 static const int MAXK = 30;
70 template<std::
size_t NDIM=1>
73 else if (treestate==
compressed) os <<
"compressed";
74 else if (treestate==
nonstandard) os <<
"nonstandard";
77 else if (treestate==
redundant) os <<
"redundant";
79 else if (treestate==
on_demand) os <<
"on_demand";
80 else if (treestate==
unknown) os <<
"unknown";
100 template<std::
size_t NDIM>
111 for (std::size_t i=0; i<
NDIM*2; ++i)
bc[i] = code;
123 if (&other !=
this) {
124 for (std::size_t i=0; i<
NDIM*2; ++i)
bc[i] = other.
bc[i];
149 template <
typename Archive>
159 static const char* codes[] = {
"zero",
"periodic",
"free",
"Dirichlet",
"zero Neumann",
"Neumann"};
167 std::vector<bool>
v(
NDIM);
168 for (std::size_t
d=0;
d<
NDIM; ++
d)
176 template <std::
size_t NDIM>
180 s <<
"BoundaryConditions(";
181 for (
unsigned int d=0;
d<
NDIM; ++
d) {
203 template <std::
size_t NDIM>
228 static std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > >
pmap;
438 const double dk = (double)
k;
440 double lo_sim=
lo/Lmax;
488 static std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > >&
get_pmap() {
514 pmap->redistribute(world,newpmap);
523 template <std::
size_t NDIM>
525 for (std::size_t i=0; i<
NDIM; ++i)
532 template <
typename T, std::
size_t NDIM>
535 double twon = std::pow(2.0,
double(n));
536 for (std::size_t i=0; i<
NDIM; ++i) {
543 template <std::
size_t NDIM>
545 for (std::size_t i=0; i<
NDIM; ++i)
This header should include pretty much everything needed for the parallel runtime.
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 funcdefaults.h:101
BCType bc[NDIM *2]
Definition funcdefaults.h:105
BoundaryConditions(BCType code=BC_FREE)
Constructor. Default boundary condition set to free space.
Definition funcdefaults.h:109
BCType operator()(std::size_t d, int i) const
Returns value of boundary condition.
Definition funcdefaults.h:134
BoundaryConditions< NDIM > & operator=(const BoundaryConditions< NDIM > &other)
Assignment makes deep copy.
Definition funcdefaults.h:122
BCType & operator()(std::size_t d, int i)
Returns reference to boundary condition.
Definition funcdefaults.h:144
BoundaryConditions(const BoundaryConditions< NDIM > &other)
Copy constructor is deep.
Definition funcdefaults.h:115
static const char * code_as_string(BCType code)
Translates code into human readable string.
Definition funcdefaults.h:158
void serialize(const Archive &ar)
Definition funcdefaults.h:150
std::vector< bool > is_periodic() const
Convenience for application of integral operators.
Definition funcdefaults.h:166
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:204
static int get_special_level()
Returns the default projection level for special boxes.
Definition funcdefaults.h:296
static Tensor< double > make_default_cell_width()
Definition funcdefaults.h:239
static void set_tensor_type(const TensorType &t)
Sets the default tensor type.
Definition funcdefaults.h:428
static int get_k()
Returns the default wavelet order.
Definition funcdefaults.h:266
static void set_apply_randomize(bool value)
Sets the random load balancing for integral operators flag.
Definition funcdefaults.h:397
static bool get_project_randomize()
Gets the random load balancing for projection flag.
Definition funcdefaults.h:403
static bool truncate_on_project
If true initial projection inserts at n-1 not n.
Definition funcdefaults.h:218
static int get_truncate_mode()
Gets the default truncation mode.
Definition funcdefaults.h:331
static void set_truncate_mode(int value)
Sets the default truncation mode.
Definition funcdefaults.h:338
static bool apply_randomize
If true use randomization for load balancing in apply integral operator.
Definition funcdefaults.h:219
static void set_truncate_on_project(bool value)
Sets the default truncate on project flag.
Definition funcdefaults.h:387
static void set_thresh(double value)
Sets the default threshold.
Definition funcdefaults.h:286
static double cell_volume
Volume of simulation cell.
Definition funcdefaults.h:225
static void set_special_level(int value)
Existing functions are unaffected.
Definition funcdefaults.h:309
static void set_k(int value)
Sets the default wavelet order.
Definition funcdefaults.h:273
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:513
static const double & get_thresh()
Returns the default threshold.
Definition funcdefaults.h:279
static int k
Wavelet order.
Definition funcdefaults.h:209
static double get_cell_volume()
Returns the volume of the user cell.
Definition funcdefaults.h:483
static int get_max_refine_level()
Gets the default maximum adaptive refinement level.
Definition funcdefaults.h:316
static bool get_debug()
Gets the default debug flag (is this used anymore?)
Definition funcdefaults.h:368
static void set_debug(bool value)
Sets the default debug flag (is this used anymore?)
Definition funcdefaults.h:375
static int truncate_mode
Truncation method.
Definition funcdefaults.h:214
static void set_default_pmap(World &world)
Sets the default process map.
Definition mraimpl.h:3550
static bool get_refine()
Gets the default adaptive refinement flag.
Definition funcdefaults.h:344
static Tensor< double > cell_width
Width of simulation cell in each dimension.
Definition funcdefaults.h:223
static BoundaryConditions< NDIM > bc
Default boundary conditions.
Definition funcdefaults.h:221
static void set_autorefine(bool value)
Sets the default adaptive autorefinement flag.
Definition funcdefaults.h:363
static double thresh
Truncation threshold.
Definition funcdefaults.h:210
static void set_bc(const BoundaryConditions< NDIM > &value)
Sets the default boundary conditions.
Definition funcdefaults.h:418
static void set_project_randomize(bool value)
Sets the random load balancing for projection flag.
Definition funcdefaults.h:408
static bool get_autorefine()
Gets the default adaptive autorefinement flag.
Definition funcdefaults.h:356
static bool debug
Controls output of debug info.
Definition funcdefaults.h:217
static int special_level
Minimum level for fine scale projection of special boxes.
Definition funcdefaults.h:212
static double cell_min_width
Size of smallest dimension.
Definition funcdefaults.h:226
static std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > pmap
Default mapping of keys to processes.
Definition funcdefaults.h:228
static TensorType get_tensor_type()
Returns the default tensor type.
Definition funcdefaults.h:423
static const Tensor< double > & get_cell_width()
Returns the width of each user cell dimension.
Definition funcdefaults.h:468
static std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > & get_pmap()
Returns the default process map.
Definition funcdefaults.h:488
static void set_initial_level(int value)
Sets the default initial projection level.
Definition funcdefaults.h:303
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:461
static void set_refine(bool value)
Sets the default adaptive refinement flag.
Definition funcdefaults.h:351
static void set_max_refine_level(int value)
Sets the default maximum adaptive refinement level.
Definition funcdefaults.h:323
static const BoundaryConditions< NDIM > & get_bc()
Returns the default boundary conditions.
Definition funcdefaults.h:413
static Tensor< double > cell
cell[NDIM][2] Simulation cell, cell(0,0)=xlo, cell(0,1)=xhi, ...
Definition funcdefaults.h:222
static void set_cell(const Tensor< double > &value)
Gets the user cell for the simulation.
Definition funcdefaults.h:453
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:504
static int initial_level
Initial level for fine scale projection.
Definition funcdefaults.h:211
static bool autorefine
Whether to autorefine in multiplication, etc.
Definition funcdefaults.h:216
static const Tensor< double > & get_rcell_width()
Returns the reciprocal of the width of each user cell dimension.
Definition funcdefaults.h:473
static Tensor< double > make_default_cell()
Definition funcdefaults.h:230
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:437
static void print()
Definition mraimpl.h:3558
static Tensor< double > rcell_width
Reciprocal of width.
Definition funcdefaults.h:224
static bool get_apply_randomize()
Gets the random load balancing for integral operators flag.
Definition funcdefaults.h:392
static double get_cell_min_width()
Returns the minimum width of any user cell dimension.
Definition funcdefaults.h:478
static void recompute_cell_info()
Definition funcdefaults.h:248
static bool project_randomize
If true use randomization for load balancing in project/refine.
Definition funcdefaults.h:220
static const Tensor< double > & get_cell()
Gets the user cell for the simulation.
Definition funcdefaults.h:446
static void set_defaults(World &world)
Used to set defaults to k=7, thresh=1-5, for a unit cube [0,1].
Definition mraimpl.h:3529
static int max_refine_level
Level at which to stop refinement.
Definition funcdefaults.h:213
static TensorType tt
structure of the tensor in FunctionNode
Definition funcdefaults.h:227
static int get_initial_level()
Returns the default initial projection level.
Definition funcdefaults.h:291
static bool get_truncate_on_project()
Gets the default truncate on project flag.
Definition funcdefaults.h:380
static bool refine
Whether to refine new functions.
Definition funcdefaults.h:215
Key is the index for a node of the 2^NDIM-tree.
Definition key.h:66
A tensor is a multidimension 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:258
static double lo
Definition dirac-hatom.cc:23
static const double v
Definition hatom_sf_dirac.cc:20
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
BCType
Definition funcdefaults.h:56
@ BC_DIRICHLET
Definition funcdefaults.h:56
@ BC_NEUMANN
Definition funcdefaults.h:56
@ BC_ZERO
Definition funcdefaults.h:56
@ BC_PERIODIC
Definition funcdefaults.h:56
@ BC_ZERONEUMANN
Definition funcdefaults.h:56
@ BC_FREE
Definition funcdefaults.h:56
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:533
TreeState
Definition funcdefaults.h:58
@ nonstandard_after_apply
s and d coeffs, state after operator application
Definition funcdefaults.h:63
@ on_demand
no coeffs anywhere, but a functor providing if necessary
Definition funcdefaults.h:66
@ redundant_after_merge
s coeffs everywhere, must be summed up to yield the result
Definition funcdefaults.h:65
@ reconstructed
s coeffs at the leaves only
Definition funcdefaults.h:59
@ nonstandard
s and d coeffs in internal nodes
Definition funcdefaults.h:61
@ unknown
Definition funcdefaults.h:67
@ compressed
d coeffs in internal nodes, s and d coeffs at the root
Definition funcdefaults.h:60
@ redundant
s coeffs everywhere
Definition funcdefaults.h:64
@ nonstandard_with_leaves
like nonstandard, with s coeffs at the leaves
Definition funcdefaults.h:62
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:524
int64_t Translation
Definition key.h:54
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:544
static const int MAXLEVEL
The maximum depth of refinement possible.
Definition funcdefaults.h:54
static const Slice _(0,-1, 1)
int Level
Definition key.h:55
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:2002
static const int MAXK
The maximum wavelet order presently supported.
Definition funcdefaults.h:51
static const double d
Definition nonlinschro.cc:121
Defines and implements most of Tensor.
static const std::size_t NDIM
Definition testpdiff.cc:42
Implement the madness:Vector class, an extension of std::array that supports some mathematical operat...
Implements WorldContainer.