MADNESS 0.10.1
funcdefaults.h
Go to the documentation of this file.
1/*
2 This file is part of MADNESS.
3
4 Copyright (C) 2007,2010 Oak Ridge National Laboratory
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 For more information please contact:
21
22 Robert J. Harrison
23 Oak Ridge National Laboratory
24 One Bethel Valley Road
25 P.O. Box 2008, MS-6367
26
27 email: harrisonrj@ornl.gov
28 tel: 865-241-3937
29 fax: 865-572-0680
30*/
31
32#ifndef MADNESS_MRA_FUNCDEFAULTS_H__INCLUDED
33#define MADNESS_MRA_FUNCDEFAULTS_H__INCLUDED
34
35
36/// \file funcdefaults.h
37/// \brief Provides FunctionDefaults and utilities for coordinate transformation
38/// \ingroup mrabcext
39
45#include <madness/mra/bc.h>
46#include <madness/mra/key.h>
47
48#include <optional>
49
50namespace madness {
51 template <std::size_t NDIM> class Displacements; // defined in displacements.h, included at the end of this file
52 template <typename T, std::size_t NDIM> class FunctionImpl;
53
54 /// The maximum wavelet order presently supported
55 static const int MAXK = 30;
56
57 /// The maximum depth of refinement possible
58 static const int MAXLEVEL = 8*sizeof(Translation)-2;
59
60 enum TreeState {
61 reconstructed, ///< s coeffs at the leaves only
62 compressed, ///< d coeffs in internal nodes, s and d coeffs at the root, empty leaves may be present
63 nonstandard, ///< s and d coeffs in internal nodes
64 nonstandard_with_leaves, ///< like nonstandard, with s coeffs at the leaves
65 nonstandard_after_apply, ///< s and d coeffs, state after operator application
66 redundant, ///< s coeffs everywhere
67 redundant_after_merge, ///< s coeffs everywhere, must be summed up to yield the result
68 on_demand, ///< no coeffs anywhere, but a functor providing if necessary
70 };
71
72 template<std::size_t NDIM=1>
73 std::ostream& operator<<(std::ostream& os, const TreeState treestate) {
74 if (treestate==reconstructed) os << "reconstructed";
75 else if (treestate==compressed) os << "compressed";
76 else if (treestate==nonstandard) os << "nonstandard";
77 else if (treestate==nonstandard_with_leaves) os << "nonstandard_with_leaves";
78 else if (treestate==nonstandard_after_apply) os << "nonstandard_after_apply";
79 else if (treestate==redundant) os << "redundant";
80 else if (treestate==redundant_after_merge) os << "redundant_after_merge";
81 else if (treestate==on_demand) os << "on_demand";
82 else if (treestate==unknown) os << "unknown";
83 else {
84 MADNESS_EXCEPTION("unknown treestate",1);
85 }
86 return os;
87 }
88
89 /// FunctionDefaults holds default paramaters as static class members
90
91 /// Declared and initialized in mra.cc and/or funcimpl::initialize.
92 ///
93 /// Currently all functions of the same dimension share the same cell dimensions
94 /// since they are stored inside FunctionDefaults ... if you change the
95 /// cell dimensions *all* functions of that dimension are affected.
96 ///
97 /// N.B. Ultimately, we may need to make these defaults specific to each
98 /// world, as should be all global state.
99 /// \ingroup mra
100 template <std::size_t NDIM>
102 MADNESS_PRAGMA_CLANG(diagnostic push)
103 MADNESS_PRAGMA_CLANG(diagnostic ignored "-Wundefined-var-template")
104
105 private:
106 static int k; ///< Wavelet order
107 static double thresh; ///< Truncation threshold
108 static int initial_level; ///< Initial level for fine scale projection
109 static int special_level; ///< Minimum level for fine scale projection of special boxes
110 static int max_refine_level; ///< Level at which to stop refinement
111 static int truncate_mode; ///< Truncation method
112 static bool refine; ///< Whether to refine new functions
113 static bool autorefine; ///< Whether to autorefine in multiplication, etc.
114 static bool debug; ///< Controls output of debug info
115 static bool truncate_on_project; ///< If true initial projection inserts at n-1 not n
116 static bool apply_randomize; ///< If true use randomization for load balancing in apply integral operator
117 static bool project_randomize; ///< If true use randomization for load balancing in project/refine
118 static std::optional<BoundaryConditions<NDIM>> bc; ///< Default boundary conditions, not initialized by default and must be set explicitly before use
119 static Tensor<double> cell ; ///< cell[NDIM][2] Simulation cell, cell(0,0)=xlo, cell(0,1)=xhi, ...
120 static Tensor<double> cell_width;///< Width of simulation cell in each dimension
121 static Tensor<double> rcell_width; ///< Reciprocal of width
122 static double cell_volume; ///< Volume of simulation cell
123 static double cell_min_width; ///< Size of smallest dimension
124 static double cell_geometric_mean_width; ///< volume^(1/NDIM), the mean dimension
125 static TensorType tt; ///< structure of the tensor in FunctionNode
126 static std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > > pmap; ///< Default mapping of keys to processes
127 static int pmap_nproc; ///< Number of processes assumed by pmap, -1 indicates uninitialized pmap
128
130 if (NDIM) {
132 cell(_, 1) = 1.0;
133 return cell;
134 } else
135 return {};
136 }
137
139 if (NDIM) {
141 cell(_) = 1.0;
142 return cell;
143 } else
144 return {};
145 }
146
147 static void recompute_cell_info() {
148 MADNESS_ASSERT(cell.dim(0)==NDIM && cell.dim(1)==2 && cell.ndim()==2);
149 cell_width = cell(_,1)-cell(_,0);
152 cell_geometric_mean_width = (NDIM > 0) ? std::pow(cell_volume, 1.0/double(NDIM)) : 1.0;
154 for (std::size_t i=0; i<NDIM; ++i) rcell_width(i) = 1.0/rcell_width(i);
155 // the standard displacements used to apply operators are ordered by real-space distance,
156 // which depends on the cell; keep them in sync (see Displacements::set_width)
158 }
159
160 public:
161
162
163 /// Used to set defaults to k=7, thresh=1-5, for a unit cube [0,1].
164 /// @warning does not reset the boundary conditions if they are already set
165 static void set_defaults(World& world);
166
167 static void print();
168
169 /// Returns the default wavelet order
170 static int get_k() {
171 return k;
172 }
173
174 /// Sets the default wavelet order
175
176 /// Existing functions are unaffacted.
177 static void set_k(int value) {
178 k=value;
179 MADNESS_ASSERT(k>0 && k<=MAXK);
180 }
181
182 /// Returns the default threshold
183 static const double& get_thresh() {
184 return thresh;
185 }
186
187 /// Sets the default threshold
188
189 /// Existing functions are unaffected
190 static void set_thresh(double value) {
191 thresh=value;
192 }
193
194 /// Returns the default initial projection level
195 static int get_initial_level() {
196 return initial_level;
197 }
198
199 /// Returns the default projection level for special boxes
200 static int get_special_level() {
201 return special_level;
202 }
203
204 /// Sets the default initial projection level
205
206 /// Existing functions are unaffected
207 static void set_initial_level(int value) {
208 initial_level=value;
209 MADNESS_ASSERT(value>0 && value<MAXLEVEL);
210 }
211
212 /// Existing functions are unaffected
213 static void set_special_level(int value) {
214 special_level=value;
215 MADNESS_ASSERT(value>=0 && value<MAXLEVEL);
217 }
218
219 /// Gets the default maximum adaptive refinement level
220 static int get_max_refine_level() {
221 return max_refine_level;
222 }
223
224 /// Sets the default maximum adaptive refinement level
225
226 /// Existing functions are unaffected
233
234 /// Gets the default truncation mode
235 static int get_truncate_mode() {
236 return truncate_mode;
237 }
238
239 /// Sets the default truncation mode
240
241 /// Existing functions are unaffected
242 static void set_truncate_mode(int value) {
243 truncate_mode=value;
244 MADNESS_ASSERT(value>=0 && value<4);
245 }
246
247 /// Gets the default adaptive refinement flag
248 static bool get_refine() {
249 return refine;
250 }
251
252 /// Sets the default adaptive refinement flag
253
254 /// Existing functions are unaffected
255 static void set_refine(bool value) {
256 refine=value;
257 }
258
259 /// Gets the default adaptive autorefinement flag
260 static bool get_autorefine() {
261 return autorefine;
262 }
263
264 /// Sets the default adaptive autorefinement flag
265
266 /// Existing functions are unaffected
267 static void set_autorefine(bool value) {
268 autorefine=value;
269 }
270
271 /// Gets the default debug flag, which gates verbose MRA diagnostics
272 static bool get_debug() {
273 return debug;
274 }
275
276 /// Sets the default debug flag; see get_debug
277 static void set_debug(bool value) {
278 debug=value;
279 }
280
281 /// Gets the default truncate on project flag
283 return truncate_on_project;
284 }
285
286 /// Sets the default truncate on project flag
287
288 /// Existing functions are unaffected
289 static void set_truncate_on_project(bool value) {
291 }
292
293 /// Gets the random load balancing for integral operators flag
294 static bool get_apply_randomize() {
295 return apply_randomize;
296 }
297
298 /// Sets the random load balancing for integral operators flag
299 static void set_apply_randomize(bool value) {
300 apply_randomize=value;
301 }
302
303
304 /// Gets the random load balancing for projection flag
305 static bool get_project_randomize() {
306 return project_randomize;
307 }
308
309 /// Sets the random load balancing for projection flag
310 static void set_project_randomize(bool value) {
311 project_randomize=value;
312 }
313
314 /// Returns the default boundary conditions
316 if (!bc.has_value()) {
317 const std::string msg = "FunctionDefaults<" + std::to_string(NDIM) + ">::get_bc: must initialize boundary conditions by set_bc or set_defaults or startup";
318 MADNESS_EXCEPTION(msg.c_str(), 1);
319 }
320 return bc.value();
321 }
322
323 /// Sets the default boundary conditions
324 static void set_bc(const BoundaryConditions<NDIM>& value) {
325 bc=value;
326 }
327
328 /// Returns the default tensor type
330 return tt;
331 }
332
333 /// Sets the default tensor type
334 static void set_tensor_type(const TensorType& t) {
335#if HAVE_GENTENSOR
336 tt=t;
337#else
338 tt=TT_FULL;
339#endif
340 }
341
342 /// adapt the special level to resolve the smallest length scale
343 static int set_length_scale(const double lo,const size_t k=get_k()) {
344 const double dk = (double) k;
346 double lo_sim=lo/Lmax; // lo in simulation coordinates;
347 const int special_level=Level(-log2(lo_sim*dk));
348 return special_level;
349 }
350
351 /// Gets the user cell for the simulation
352 static const Tensor<double>& get_cell() {
353 return cell;
354 }
355
356 /// clear user cell -- will be reset once a function is loaded from file
357
358 /// Existing functions are probably rendered useless
359 static void clear_cell() {
360 cell.clear();
363 cell_volume = 0.0;
364 cell_min_width = 0.0;
366 }
367
368 /// Sets the user cell for the simulation
369
370 /// Existing functions are probably rendered useless.
371 /// @warning Must be called in a quiescent window: no operator application (FunctionImpl::apply, including
372 /// unfenced ones) may be in flight, since the standard displacements used by operators are
373 /// reordered in place when the cell changes (see Displacements::set_width).
374 static void set_cell(const Tensor<double>& value) {
375 cell=copy(value);
377 }
378
379 /// Sets the user cell to be cubic with each dimension having range \c [lo,hi]
380
381 /// Existing functions are probably rendered useless.
382 /// @warning Same quiescence requirement as set_cell().
383 static void set_cubic_cell(double lo, double hi) {
384 cell(_,0)=lo;
385 cell(_,1)=hi;
387 }
388
389 /// Returns the width of each user cell dimension
391 return cell_width;
392 }
393
394 /// Returns the reciprocal of the width of each user cell dimension
396 return rcell_width;
397 }
398
399 /// Returns the geometric mean width of the user cell, volume^(1/NDIM)
402 }
403
404 /// Returns the minimum width of any user cell dimension
405 static double get_cell_min_width() {
406 return cell_min_width;
407 }
408
409 /// Returns the volume of the user cell
410 static double get_cell_volume() {
411 return cell_volume;
412 }
413
414 /// Returns the default process map that was last initialized via set_default_pmap()
415 static std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > >& get_pmap() {
416 if (pmap)
417 return pmap;
418 else { // try to initialize to default, if not yet
419 if (initialized()) {
421 return pmap;
422 }
423 else
424 return pmap; // null ptr if uninitialized
425 }
426 }
427
428 /// Returns number of the default processes returned by get_pmap()
429 static int get_pmap_nproc() {
430 return pmap_nproc;
431 }
432
433 /// Returns the default process map that can be used with the given world
434 static std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > > get_pmap(World& world) {
435 if (get_pmap_nproc() == world.nproc()) {
436 return get_pmap();
437 }
438 else {
439 return make_default_pmap(world);
440 }
441 }
442
443 /// Sets the default process map (does \em not redistribute existing functions)
444
445 /// Existing functions are probably rendered useless
446 static void set_pmap(const std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > >& value) {
447 pmap = value;
448 }
449
450 /// Makes a default process map for the given \p world
451 static std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > > make_default_pmap(World& world);
452
453 /// Sets the default process map for the use with WorldObjects in \p world
454 /// @note sets default pmap to `make_default_pmap(world)`
455 static void set_default_pmap(World& world);
456
457 /// Sets the default process map and redistributes all functions using the old map
458 static void redistribute(World& world, const std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > >& newpmap) {
459 pmap->redistribute(world,newpmap);
460 pmap = newpmap;
461 }
462
463 MADNESS_PRAGMA_CLANG(diagnostic pop)
464
465 };
466
467 /// Convert user coords (cell[][]) to simulation coords ([0,1]^ndim)
468 template <std::size_t NDIM>
469 static inline void user_to_sim(const Vector<double,NDIM>& xuser, Vector<double,NDIM>& xsim) {
470 for (std::size_t i=0; i<NDIM; ++i)
472 }
473
474 /// Returns the box at level n that contains the given point in simulation coordinates
475 /// @param[in] pt point in simulation coordinates
476 /// @param[in] n the level of the box
477 template <typename T, std::size_t NDIM>
478 static inline Key<NDIM> simpt2key(const Vector<T,NDIM>& pt, Level n){
480 double twon = std::pow(2.0, double(n));
481 for (std::size_t i=0; i<NDIM; ++i) {
482 l[i] = Translation(twon*pt[i]);
483 }
484 return Key<NDIM>(n,l);
485 }
486
487 /// Convert simulation coords ([0,1]^ndim) to user coords (FunctionDefaults<NDIM>::get_cell())
488 template <std::size_t NDIM>
489 static void sim_to_user(const Vector<double,NDIM>& xsim, Vector<double,NDIM>& xuser) {
490 for (std::size_t i=0; i<NDIM; ++i)
492 }
493
494
495}
496
497// Displacements depends on FunctionDefaults (boundary conditions) and FunctionDefaults on Displacements
498// (recompute_cell_info). Displacements is forward-declared above so that FunctionDefaults can be defined first,
499// and its header is included here, after FunctionDefaults is complete; displacements.h in turn includes this
500// header at its top, so either header can be included first (the include guards break the cycle).
502
503#endif // MADNESS_MRA_FUNCDEFAULTS_H__INCLUDED
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
static void set_width(const Tensor< double > &width)
Definition displacements.h:336
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:101
static int get_special_level()
Returns the default projection level for special boxes.
Definition funcdefaults.h:200
static Tensor< double > make_default_cell_width()
Definition funcdefaults.h:138
static void set_tensor_type(const TensorType &t)
Sets the default tensor type.
Definition funcdefaults.h:334
static int get_k()
Returns the default wavelet order.
Definition funcdefaults.h:170
static void set_apply_randomize(bool value)
Sets the random load balancing for integral operators flag.
Definition funcdefaults.h:299
static bool get_project_randomize()
Gets the random load balancing for projection flag.
Definition funcdefaults.h:305
static std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > make_default_pmap(World &world)
Makes a default process map for the given world.
Definition mraimpl.h:3765
static bool truncate_on_project
If true initial projection inserts at n-1 not n.
Definition funcdefaults.h:115
static int get_truncate_mode()
Gets the default truncation mode.
Definition funcdefaults.h:235
static void set_truncate_mode(int value)
Sets the default truncation mode.
Definition funcdefaults.h:242
static bool apply_randomize
If true use randomization for load balancing in apply integral operator.
Definition funcdefaults.h:116
static void set_truncate_on_project(bool value)
Sets the default truncate on project flag.
Definition funcdefaults.h:289
static void set_thresh(double value)
Sets the default threshold.
Definition funcdefaults.h:190
static void clear_cell()
clear user cell – will be reset once a function is loaded from file
Definition funcdefaults.h:359
static double cell_volume
Volume of simulation cell.
Definition funcdefaults.h:122
static void set_special_level(int value)
Existing functions are unaffected.
Definition funcdefaults.h:213
static void set_k(int value)
Sets the default wavelet order.
Definition funcdefaults.h:177
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:458
static const double & get_thresh()
Returns the default threshold.
Definition funcdefaults.h:183
static int k
Wavelet order.
Definition funcdefaults.h:106
static double get_cell_volume()
Returns the volume of the user cell.
Definition funcdefaults.h:410
static int get_max_refine_level()
Gets the default maximum adaptive refinement level.
Definition funcdefaults.h:220
static bool get_debug()
Gets the default debug flag, which gates verbose MRA diagnostics.
Definition funcdefaults.h:272
static void set_debug(bool value)
Sets the default debug flag; see get_debug.
Definition funcdefaults.h:277
static int truncate_mode
Truncation method.
Definition funcdefaults.h:111
static void set_default_pmap(World &world)
Definition mraimpl.h:3772
static int pmap_nproc
Number of processes assumed by pmap, -1 indicates uninitialized pmap.
Definition funcdefaults.h:127
static bool get_refine()
Gets the default adaptive refinement flag.
Definition funcdefaults.h:248
static Tensor< double > cell_width
Width of simulation cell in each dimension.
Definition funcdefaults.h:120
static void set_autorefine(bool value)
Sets the default adaptive autorefinement flag.
Definition funcdefaults.h:267
static double thresh
Truncation threshold.
Definition funcdefaults.h:107
static void set_bc(const BoundaryConditions< NDIM > &value)
Sets the default boundary conditions.
Definition funcdefaults.h:324
static void set_project_randomize(bool value)
Sets the random load balancing for projection flag.
Definition funcdefaults.h:310
static int get_pmap_nproc()
Returns number of the default processes returned by get_pmap()
Definition funcdefaults.h:429
static bool get_autorefine()
Gets the default adaptive autorefinement flag.
Definition funcdefaults.h:260
static bool debug
Controls output of debug info.
Definition funcdefaults.h:114
static int special_level
Minimum level for fine scale projection of special boxes.
Definition funcdefaults.h:109
static double cell_min_width
Size of smallest dimension.
Definition funcdefaults.h:123
static std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > pmap
Default mapping of keys to processes.
Definition funcdefaults.h:126
static TensorType get_tensor_type()
Returns the default tensor type.
Definition funcdefaults.h:329
static const Tensor< double > & get_cell_width()
Returns the width of each user cell dimension.
Definition funcdefaults.h:390
static std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > & get_pmap()
Returns the default process map that was last initialized via set_default_pmap()
Definition funcdefaults.h:415
static void set_initial_level(int value)
Sets the default initial projection level.
Definition funcdefaults.h:207
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:383
static double get_cell_geometric_mean_width()
Returns the geometric mean width of the user cell, volume^(1/NDIM)
Definition funcdefaults.h:400
static double cell_geometric_mean_width
volume^(1/NDIM), the mean dimension
Definition funcdefaults.h:124
static void set_refine(bool value)
Sets the default adaptive refinement flag.
Definition funcdefaults.h:255
static void set_max_refine_level(int value)
Sets the default maximum adaptive refinement level.
Definition funcdefaults.h:227
static const BoundaryConditions< NDIM > & get_bc()
Returns the default boundary conditions.
Definition funcdefaults.h:315
static Tensor< double > cell
cell[NDIM][2] Simulation cell, cell(0,0)=xlo, cell(0,1)=xhi, ...
Definition funcdefaults.h:119
static void set_cell(const Tensor< double > &value)
Sets the user cell for the simulation.
Definition funcdefaults.h:374
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:446
static int initial_level
Initial level for fine scale projection.
Definition funcdefaults.h:108
static bool autorefine
Whether to autorefine in multiplication, etc.
Definition funcdefaults.h:113
static const Tensor< double > & get_rcell_width()
Returns the reciprocal of the width of each user cell dimension.
Definition funcdefaults.h:395
static Tensor< double > make_default_cell()
Definition funcdefaults.h:129
static std::optional< BoundaryConditions< NDIM > > bc
Default boundary conditions, not initialized by default and must be set explicitly before use.
Definition funcdefaults.h:118
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:343
static void print()
Definition mraimpl.h:3779
static std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > get_pmap(World &world)
Returns the default process map that can be used with the given world.
Definition funcdefaults.h:434
static Tensor< double > rcell_width
Reciprocal of width.
Definition funcdefaults.h:121
static bool get_apply_randomize()
Gets the random load balancing for integral operators flag.
Definition funcdefaults.h:294
static double get_cell_min_width()
Returns the minimum width of any user cell dimension.
Definition funcdefaults.h:405
static void recompute_cell_info()
Definition funcdefaults.h:147
static bool project_randomize
If true use randomization for load balancing in project/refine.
Definition funcdefaults.h:117
static const Tensor< double > & get_cell()
Gets the user cell for the simulation.
Definition funcdefaults.h:352
static void set_defaults(World &world)
Definition mraimpl.h:3744
static int max_refine_level
Level at which to stop refinement.
Definition funcdefaults.h:110
static TensorType tt
structure of the tensor in FunctionNode
Definition funcdefaults.h:125
static int get_initial_level()
Returns the default initial projection level.
Definition funcdefaults.h:195
static bool get_truncate_on_project()
Gets the default truncate on project flag.
Definition funcdefaults.h:282
static bool refine
Whether to refine new functions.
Definition funcdefaults.h:112
Key is the index for a node of the 2^NDIM-tree.
Definition key.h:70
A tensor is a multidimensional array.
Definition tensor.h:318
T max(long *ind=0) const
Return the maximum value (and if ind is non-null, its index) in the Tensor.
Definition tensor.h:1704
T product() const
Return the product of all elements of the tensor.
Definition tensor.h:1677
T min(long *ind=0) const
Return the minimum value (and if ind is non-null, its index) in the Tensor.
Definition tensor.h:1684
void clear()
Frees all memory and resests to state of default constructor.
Definition tensor.h:1901
A simple, fixed dimension vector.
Definition vector.h:64
Interface to be provided by any process map.
Definition worlddc.h:125
A parallel world class.
Definition world.h:134
static World & get_default()
Default World object accessor.
Definition world.h:269
ProcessID nproc() const
Returns the number of processes in this World (same as MPI_Comm_size()).
Definition world.h:349
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 DFConvergence.h:9
std::ostream & operator<<(std::ostream &os, const particle< PDIM > &p)
Definition lowrankfunction.h:401
static Key< NDIM > simpt2key(const Vector< T, NDIM > &pt, Level n)
Definition funcdefaults.h:478
TreeState
Definition funcdefaults.h:60
@ nonstandard_after_apply
s and d coeffs, state after operator application
Definition funcdefaults.h:65
@ on_demand
no coeffs anywhere, but a functor providing if necessary
Definition funcdefaults.h:68
@ redundant_after_merge
s coeffs everywhere, must be summed up to yield the result
Definition funcdefaults.h:67
@ reconstructed
s coeffs at the leaves only
Definition funcdefaults.h:61
@ nonstandard
s and d coeffs in internal nodes
Definition funcdefaults.h:63
@ unknown
Definition funcdefaults.h:69
@ compressed
d coeffs in internal nodes, s and d coeffs at the root, empty leaves may be present
Definition funcdefaults.h:62
@ redundant
s coeffs everywhere
Definition funcdefaults.h:66
@ nonstandard_with_leaves
like nonstandard, with s coeffs at the leaves
Definition funcdefaults.h:64
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:469
int64_t Translation
Definition key.h:58
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:489
static const int MAXLEVEL
The maximum depth of refinement possible.
Definition funcdefaults.h:58
static const Slice _(0,-1, 1)
int Level
Definition key.h:59
bool initialized()
Check if the MADNESS runtime has been initialized (and not subsequently finalized).
Definition world.cc:75
static double pop(std::vector< double > &v)
Definition SCF.cc:117
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:2233
static const int MAXK
The maximum wavelet order presently supported.
Definition funcdefaults.h:55
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.