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/key.h>
46
47namespace madness {
48 template <typename T, std::size_t NDIM> class FunctionImpl;
49
50 /// The maximum wavelet order presently supported
51 static const int MAXK = 30;
52
53 /// The maximum depth of refinement possible
54 static const int MAXLEVEL = 8*sizeof(Translation)-2;
55
57
58 enum TreeState {
59 reconstructed, ///< s coeffs at the leaves only
60 compressed, ///< d coeffs in internal nodes, s and d coeffs at the root
61 nonstandard, ///< s and d coeffs in internal nodes
62 nonstandard_with_leaves, ///< like nonstandard, with s coeffs at the leaves
63 nonstandard_after_apply, ///< s and d coeffs, state after operator application
64 redundant, ///< s coeffs everywhere
65 redundant_after_merge, ///< s coeffs everywhere, must be summed up to yield the result
66 on_demand, ///< no coeffs anywhere, but a functor providing if necessary
68 };
69
70 template<std::size_t NDIM=1>
71 std::ostream& operator<<(std::ostream& os, const TreeState treestate) {
72 if (treestate==reconstructed) os << "reconstructed";
73 else if (treestate==compressed) os << "compressed";
74 else if (treestate==nonstandard) os << "nonstandard";
75 else if (treestate==nonstandard_with_leaves) os << "nonstandard_with_leaves";
76 else if (treestate==nonstandard_after_apply) os << "nonstandard_after_apply";
77 else if (treestate==redundant) os << "redundant";
78 else if (treestate==redundant_after_merge) os << "redundant_after_merge";
79 else if (treestate==on_demand) os << "on_demand";
80 else if (treestate==unknown) os << "unknown";
81 else {
82 MADNESS_EXCEPTION("unknown treestate",1);
83 }
84 return os;
85 }
86
87 /*!
88 \brief This class is used to specify boundary conditions for all operators
89 \ingroup mrabcext
90
91 Exterior boundary conditions (i.e., on the simulation domain)
92 are associated with operators (not functions). The types of
93 boundary conditions available are in the enum BCType.
94
95 The default boundary conditions are obtained from the FunctionDefaults.
96 For non-zero Dirichlet and Neumann conditions additional information
97 must be provided when derivative operators are constructed. For integral
98 operators, only periodic and free space are supported.
99 */
100 template<std::size_t NDIM>
102 private:
103 // Used to use STL vector but static data on a MAC was
104 // causing problems.
106
107 public:
108 /// Constructor. Default boundary condition set to free space
110 {
111 for (std::size_t i=0; i<NDIM*2; ++i) bc[i] = code;
112 }
113
114 /// Copy constructor is deep
116 {
117 *this = other;
118 }
119
120 /// Assignment makes deep copy
123 if (&other != this) {
124 for (std::size_t i=0; i<NDIM*2; ++i) bc[i] = other.bc[i];
125 }
126 return *this;
127 }
128
129 /// Returns value of boundary condition
130
131 /// @param d Dimension (0,...,NDIM-1) for boundary condition
132 /// @param i Side (0=left, 1=right) for boundary condition
133 /// @return Value of boundary condition
134 BCType operator()(std::size_t d, int i) const {
135 MADNESS_ASSERT(d<NDIM && i>=0 && i<2);
136 return bc[2*d+i];
137 }
138
139 /// Returns reference to boundary condition
140
141 /// @param d Dimension (0,...,NDIM-1) for boundary condition
142 /// @param i Side (0=left, 1=right) for boundary condition
143 /// @return Value of boundary condition
144 BCType& operator()(std::size_t d, int i) {
145 MADNESS_ASSERT(d<NDIM && i>=0 && i<2);
146 return bc[2*d+i];
147 }
148
149 template <typename Archive>
150 void serialize(const Archive& ar) {
151 ar & bc;
152 }
153
154 /// Translates code into human readable string
155
156 /// @param code Code for boundary condition
157 /// @return String describing boundary condition code
158 static const char* code_as_string(BCType code) {
159 static const char* codes[] = {"zero","periodic","free","Dirichlet","zero Neumann","Neumann"};
160 return codes[code];
161 }
162
163 /// Convenience for application of integral operators
164
165 /// @return Returns a vector indicating if each dimension is periodic
166 std::vector<bool> is_periodic() const {
167 std::vector<bool> v(NDIM);
168 for (std::size_t d=0; d<NDIM; ++d)
169 v[d] = (bc[2*d]==BC_PERIODIC);
170 return v;
171 }
172 };
173
174
175
176 template <std::size_t NDIM>
177 static
178 inline
179 std::ostream& operator << (std::ostream& s, const BoundaryConditions<NDIM>& bc) {
180 s << "BoundaryConditions(";
181 for (unsigned int d=0; d<NDIM; ++d) {
182 s << bc.code_as_string(bc(d,0)) << ":" << bc.code_as_string(bc(d,1));
183 if (d == NDIM-1)
184 s << ")";
185 else
186 s << ", ";
187 }
188 return s;
189 }
190
191
192 /// FunctionDefaults holds default paramaters as static class members
193
194 /// Declared and initialized in mra.cc and/or funcimpl::initialize.
195 ///
196 /// Currently all functions of the same dimension share the same cell dimensions
197 /// since they are stored inside FunctionDefaults ... if you change the
198 /// cell dimensions *all* functions of that dimension are affected.
199 ///
200 /// N.B. Ultimately, we may need to make these defaults specific to each
201 /// world, as should be all global state.
202 /// \ingroup mra
203 template <std::size_t NDIM>
205 MADNESS_PRAGMA_CLANG(diagnostic push)
206 MADNESS_PRAGMA_CLANG(diagnostic ignored "-Wundefined-var-template")
207
208 private:
209 static int k; ///< Wavelet order
210 static double thresh; ///< Truncation threshold
211 static int initial_level; ///< Initial level for fine scale projection
212 static int special_level; ///< Minimum level for fine scale projection of special boxes
213 static int max_refine_level; ///< Level at which to stop refinement
214 static int truncate_mode; ///< Truncation method
215 static bool refine; ///< Whether to refine new functions
216 static bool autorefine; ///< Whether to autorefine in multiplication, etc.
217 static bool debug; ///< Controls output of debug info
218 static bool truncate_on_project; ///< If true initial projection inserts at n-1 not n
219 static bool apply_randomize; ///< If true use randomization for load balancing in apply integral operator
220 static bool project_randomize; ///< If true use randomization for load balancing in project/refine
221 static BoundaryConditions<NDIM> bc; ///< Default boundary conditions
222 static Tensor<double> cell ; ///< cell[NDIM][2] Simulation cell, cell(0,0)=xlo, cell(0,1)=xhi, ...
223 static Tensor<double> cell_width;///< Width of simulation cell in each dimension
224 static Tensor<double> rcell_width; ///< Reciprocal of width
225 static double cell_volume; ///< Volume of simulation cell
226 static double cell_min_width; ///< Size of smallest dimension
227 static TensorType tt; ///< structure of the tensor in FunctionNode
228 static std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > > pmap; ///< Default mapping of keys to processes
229
231 if (NDIM) {
233 cell(_, 1) = 1.0;
234 return cell;
235 } else
236 return {};
237 }
238
240 if (NDIM) {
242 cell(_) = 1.0;
243 return cell;
244 } else
245 return {};
246 }
247
248 static void recompute_cell_info() {
249 MADNESS_ASSERT(cell.dim(0)==NDIM && cell.dim(1)==2 && cell.ndim()==2);
250 cell_width = cell(_,1)-cell(_,0);
254 for (std::size_t i=0; i<NDIM; ++i) rcell_width(i) = 1.0/rcell_width(i);
255 }
256
257 public:
258
259
260 /// Used to set defaults to k=7, thresh=1-5, for a unit cube [0,1].
261 static void set_defaults(World& world);
262
263 static void print();
264
265 /// Returns the default wavelet order
266 static int get_k() {
267 return k;
268 }
269
270 /// Sets the default wavelet order
271
272 /// Existing functions are unaffacted.
273 static void set_k(int value) {
274 k=value;
275 MADNESS_ASSERT(k>0 && k<=MAXK);
276 }
277
278 /// Returns the default threshold
279 static const double& get_thresh() {
280 return thresh;
281 }
282
283 /// Sets the default threshold
284
285 /// Existing functions are unaffected
286 static void set_thresh(double value) {
287 thresh=value;
288 }
289
290 /// Returns the default initial projection level
291 static int get_initial_level() {
292 return initial_level;
293 }
294
295 /// Returns the default projection level for special boxes
296 static int get_special_level() {
297 return special_level;
298 }
299
300 /// Sets the default initial projection level
301
302 /// Existing functions are unaffected
303 static void set_initial_level(int value) {
304 initial_level=value;
305 MADNESS_ASSERT(value>0 && value<MAXLEVEL);
306 }
307
308 /// Existing functions are unaffected
309 static void set_special_level(int value) {
310 special_level=value;
311 MADNESS_ASSERT(value>=0 && value<MAXLEVEL);
313 }
314
315 /// Gets the default maximum adaptive refinement level
316 static int get_max_refine_level() {
317 return max_refine_level;
318 }
319
320 /// Sets the default maximum adaptive refinement level
321
322 /// Existing functions are unaffected
329
330 /// Gets the default truncation mode
331 static int get_truncate_mode() {
332 return truncate_mode;
333 }
334
335 /// Sets the default truncation mode
336
337 /// Existing functions are unaffected
338 static void set_truncate_mode(int value) {
339 truncate_mode=value;
340 MADNESS_ASSERT(value>=0 && value<4);
341 }
342
343 /// Gets the default adaptive refinement flag
344 static bool get_refine() {
345 return refine;
346 }
347
348 /// Sets the default adaptive refinement flag
349
350 /// Existing functions are unaffected
351 static void set_refine(bool value) {
352 refine=value;
353 }
354
355 /// Gets the default adaptive autorefinement flag
356 static bool get_autorefine() {
357 return autorefine;
358 }
359
360 /// Sets the default adaptive autorefinement flag
361
362 /// Existing functions are unaffected
363 static void set_autorefine(bool value) {
364 autorefine=value;
365 }
366
367 /// Gets the default debug flag (is this used anymore?)
368 static bool get_debug() {
369 return debug;
370 }
371
372 /// Sets the default debug flag (is this used anymore?)
373
374 /// Not sure if this does anything useful
375 static void set_debug(bool value) {
376 debug=value;
377 }
378
379 /// Gets the default truncate on project flag
381 return truncate_on_project;
382 }
383
384 /// Sets the default truncate on project flag
385
386 /// Existing functions are unaffected
387 static void set_truncate_on_project(bool value) {
389 }
390
391 /// Gets the random load balancing for integral operators flag
392 static bool get_apply_randomize() {
393 return apply_randomize;
394 }
395
396 /// Sets the random load balancing for integral operators flag
397 static void set_apply_randomize(bool value) {
398 apply_randomize=value;
399 }
400
401
402 /// Gets the random load balancing for projection flag
403 static bool get_project_randomize() {
404 return project_randomize;
405 }
406
407 /// Sets the random load balancing for projection flag
408 static void set_project_randomize(bool value) {
409 project_randomize=value;
410 }
411
412 /// Returns the default boundary conditions
414 return bc;
415 }
416
417 /// Sets the default boundary conditions
418 static void set_bc(const BoundaryConditions<NDIM>& value) {
419 bc=value;
420 }
421
422 /// Returns the default tensor type
424 return tt;
425 }
426
427 /// Sets the default tensor type
428 static void set_tensor_type(const TensorType& t) {
429#if HAVE_GENTENSOR
430 tt=t;
431#else
432 tt=TT_FULL;
433#endif
434 }
435
436 /// adapt the special level to resolve the smallest length scale
437 static int set_length_scale(const double lo,const size_t k=get_k()) {
438 const double dk = (double) k;
440 double lo_sim=lo/Lmax; // lo in simulation coordinates;
441 const int special_level=Level(-log2(lo_sim*dk));
442 return special_level;
443 }
444
445 /// Gets the user cell for the simulation
446 static const Tensor<double>& get_cell() {
447 return cell;
448 }
449
450 /// Gets the user cell for the simulation
451
452 /// Existing functions are probably rendered useless
453 static void set_cell(const Tensor<double>& value) {
454 cell=copy(value);
456 }
457
458 /// Sets the user cell to be cubic with each dimension having range \c [lo,hi]
459
460 /// Existing functions are probably rendered useless
461 static void set_cubic_cell(double lo, double hi) {
462 cell(_,0)=lo;
463 cell(_,1)=hi;
465 }
466
467 /// Returns the width of each user cell dimension
469 return cell_width;
470 }
471
472 /// Returns the reciprocal of the width of each user cell dimension
474 return rcell_width;
475 }
476
477 /// Returns the minimum width of any user cell dimension
478 static double get_cell_min_width() {
479 return cell_min_width;
480 }
481
482 /// Returns the volume of the user cell
483 static double get_cell_volume() {
484 return cell_volume;
485 }
486
487 /// Returns the default process map
488 static std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > >& get_pmap() {
489 if (pmap)
490 return pmap;
491 else { // try to initialize to default, if not yet
492 if (initialized()) {
494 return pmap;
495 }
496 else
497 return pmap; // null ptr if uninitialized
498 }
499 }
500
501 /// Sets the default process map (does \em not redistribute existing functions)
502
503 /// Existing functions are probably rendered useless
504 static void set_pmap(const std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > >& value) {
505 pmap = value;
506 }
507
508 /// Sets the default process map
509 static void set_default_pmap(World& world);
510
511
512 /// Sets the default process map and redistributes all functions using the old map
513 static void redistribute(World& world, const std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > >& newpmap) {
514 pmap->redistribute(world,newpmap);
515 pmap = newpmap;
516 }
517
518 MADNESS_PRAGMA_CLANG(diagnostic pop)
519
520 };
521
522 /// Convert user coords (cell[][]) to simulation coords ([0,1]^ndim)
523 template <std::size_t NDIM>
524 static inline void user_to_sim(const Vector<double,NDIM>& xuser, Vector<double,NDIM>& xsim) {
525 for (std::size_t i=0; i<NDIM; ++i)
527 }
528
529 /// Returns the box at level n that contains the given point in simulation coordinates
530 /// @param[in] pt point in simulation coordinates
531 /// @param[in] n the level of the box
532 template <typename T, std::size_t NDIM>
533 static inline Key<NDIM> simpt2key(const Vector<T,NDIM>& pt, Level n){
535 double twon = std::pow(2.0, double(n));
536 for (std::size_t i=0; i<NDIM; ++i) {
537 l[i] = Translation(twon*pt[i]);
538 }
539 return Key<NDIM>(n,l);
540 }
541
542 /// Convert simulation coords ([0,1]^ndim) to user coords (FunctionDefaults<NDIM>::get_cell())
543 template <std::size_t NDIM>
544 static void sim_to_user(const Vector<double,NDIM>& xsim, Vector<double,NDIM>& xuser) {
545 for (std::size_t i=0; i<NDIM; ++i)
547 }
548
549
550}
551#endif // MADNESS_MRA_FUNCDEFAULTS_H__INCLUDED
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.