33 #ifndef MADNESS_MRA_FUNCDEFAULTS_H__INCLUDED
34 #define MADNESS_MRA_FUNCDEFAULTS_H__INCLUDED
51 static const int MAXK = 30;
54 static const int MAXLEVEL = 8*
sizeof(
Translation)-2;
71 template<std::
size_t NDIM>
82 for (std::size_t i=0; i<
NDIM*2; ++i) bc[i] = code;
95 for (std::size_t i=0; i<
NDIM*2; ++i) bc[i] = other.bc[i];
106 MADNESS_ASSERT(d<NDIM && i>=0 && i<2);
116 MADNESS_ASSERT(d<NDIM && i>=0 && i<2);
120 template <
typename Archive>
130 static const char* codes[] = {
"zero",
"periodic",
"free",
"Dirichlet",
"zero Neumann",
"Neumann"};
138 std::vector<bool> v(
NDIM);
139 for (std::size_t d=0; d<
NDIM; ++d)
147 template <std::
size_t NDIM>
150 std::ostream& operator << (std::ostream& s, const BoundaryConditions<NDIM>& bc) {
151 s <<
"BoundaryConditions(";
152 for (
int d=0; d<
NDIM; ++d) {
153 s << bc.code_as_string(bc(d,0)) <<
":" << bc.code_as_string(bc(d,1));
174 template <std::
size_t NDIM>
178 static double thresh;
179 static int initial_level;
180 static int max_refine_level;
181 static int truncate_mode;
183 static bool autorefine;
185 static bool truncate_on_project;
186 static bool apply_randomize;
187 static bool project_randomize;
189 static Tensor<double> cell ;
190 static Tensor<double> cell_width;
191 static Tensor<double> rcell_width;
192 static double cell_volume;
193 static double cell_min_width;
197 static void recompute_cell_info() {
198 MADNESS_ASSERT(cell.dim(0)==NDIM && cell.dim(1)==2 && cell.ndim()==2);
199 cell_width = cell(_,1)-cell(_,0);
200 cell_volume = cell_width.product();
201 cell_min_width = cell_width.min();
202 rcell_width =
copy(cell_width);
203 for (std::size_t i=0; i<
NDIM; ++i) rcell_width(i) = 1.0/rcell_width(i);
221 MADNESS_ASSERT(k>0 && k<=MAXK);
238 return initial_level;
246 MADNESS_ASSERT(value>0 && value<MAXLEVEL);
251 return max_refine_level;
258 max_refine_level=value;
259 MADNESS_ASSERT(value>0 && value<MAXLEVEL);
264 return truncate_mode;
272 MADNESS_ASSERT(value>=0 && value<3);
313 return truncate_on_project;
320 truncate_on_project=value;
325 return apply_randomize;
330 apply_randomize=value;
336 return project_randomize;
341 project_randomize=value;
376 static void set_cell(
const Tensor<double>& value) {
378 recompute_cell_info();
387 recompute_cell_info();
402 return cell_min_width;
424 pmap->redistribute(world,newpmap);
432 template <std::
size_t NDIM>
433 static inline void user_to_sim(
const Vector<double,NDIM>& xuser, Vector<double,NDIM>& xsim) {
434 for (std::size_t i=0; i<
NDIM; ++i)
440 template <std::
size_t NDIM>
441 static void sim_to_user(
const Vector<double,NDIM>& xsim, Vector<double,NDIM>& xuser) {
442 for (std::size_t i=0; i<
NDIM; ++i)
448 #endif // MADNESS_MRA_FUNCDEFAULTS_H__INCLUDED
static const char * code_as_string(BCType code)
Translates code into human readable string.
Definition: funcdefaults.h:129
static bool get_truncate_on_project()
Gets the default truncate on project flag.
Definition: funcdefaults.h:312
Definition: shared_ptr_bits.h:38
BoundaryConditions(const BoundaryConditions< NDIM > &other)
Copy constructor is deep.
Definition: funcdefaults.h:86
FunctionDefaults holds default paramaters as static class members.
Definition: funcdefaults.h:175
static void set_bc(const BoundaryConditions< NDIM > &value)
Sets the default boundary conditions.
Definition: funcdefaults.h:350
static void set_autorefine(bool value)
Sets the default adaptive autorefinement flag.
Definition: funcdefaults.h:295
TensorType
low rank representations of tensors (see gentensor.h)
Definition: tensor.h:275
static double get_cell_min_width()
Returns the minimum width of any user cell dimension.
Definition: funcdefaults.h:401
const int NDIM
Definition: tdse1.cc:44
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:3309
static void set_initial_level(int value)
Sets the default initial projection level.
Definition: funcdefaults.h:244
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:423
static void set_truncate_on_project(bool value)
Sets the default truncate on project flag.
Definition: funcdefaults.h:319
static double get_cell_volume()
Returns the volume of the user cell.
Definition: funcdefaults.h:406
static void set_refine(bool value)
Sets the default adaptive refinement flag.
Definition: funcdefaults.h:283
Definition: funcdefaults.h:56
static const double & get_thresh()
Returns the default threshold.
Definition: funcdefaults.h:225
static bool get_apply_randomize()
Gets the random load balancing for integral operators flag.
Definition: funcdefaults.h:324
FunctionImpl holds all Function state to facilitate shallow copy semantics.
Definition: funcdefaults.h:48
static const Tensor< double > & get_cell()
Gets the user cell for the simulation.
Definition: funcdefaults.h:369
This header should include pretty much everything needed for the parallel runtime.
static bool get_debug()
Gets the default debug flag (is this used anymore?)
Definition: funcdefaults.h:300
static void set_project_randomize(bool value)
Sets the random load balancing for projection flag.
Definition: funcdefaults.h:340
Defines and implements most of Tensor.
static const BoundaryConditions< NDIM > & get_bc()
Returns the default boundary conditions.
Definition: funcdefaults.h:345
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:418
static void set_cell(const Tensor< double > &value)
Gets the user cell for the simulation.
Definition: funcdefaults.h:376
static bool get_autorefine()
Gets the default adaptive autorefinement flag.
Definition: funcdefaults.h:288
static void set_truncate_mode(int value)
Sets the default truncation mode.
Definition: funcdefaults.h:270
std::vector< bool > is_periodic() const
Convenience for application of integral operators.
Definition: funcdefaults.h:137
BCType operator()(std::size_t d, int i) const
Returns value of boundary condition.
Definition: funcdefaults.h:105
static bool get_refine()
Gets the default adaptive refinement flag.
Definition: funcdefaults.h:276
static int get_k()
Returns the default wavelet order.
Definition: funcdefaults.h:212
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:1835
BoundaryConditions< NDIM > & operator=(const BoundaryConditions< NDIM > &other)
Assignment makes deep copy.
Definition: funcdefaults.h:93
This class is used to specify boundary conditions for all operatorsExterior boundary conditions (i...
Definition: funcdefaults.h:72
static void set_debug(bool value)
Sets the default debug flag (is this used anymore?)
Definition: funcdefaults.h:307
static TensorType get_tensor_type()
Returns the default tensor type.
Definition: funcdefaults.h:355
static void set_tensor_type(const TensorType &t)
Sets the default tensor type.
Definition: funcdefaults.h:360
BCType & operator()(std::size_t d, int i)
Returns reference to boundary condition.
Definition: funcdefaults.h:115
Definition: funcdefaults.h:56
A parallel world with full functionality wrapping an MPI communicator.
Definition: worldfwd.h:416
static int get_initial_level()
Returns the default initial projection level.
Definition: funcdefaults.h:237
static std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > & get_pmap()
Returns the default process map.
Definition: funcdefaults.h:411
static void set_thresh(double value)
Sets the default threshold.
Definition: funcdefaults.h:232
static const Tensor< double > & get_rcell_width()
Returns the reciprocal of the width of each user cell dimension.
Definition: funcdefaults.h:396
void serialize(const Archive &ar)
Definition: funcdefaults.h:121
static int get_max_refine_level()
Gets the default maximum adaptive refinement level.
Definition: funcdefaults.h:250
static void set_max_refine_level(int value)
Sets the default maximum adaptive refinement level.
Definition: funcdefaults.h:257
static void set_apply_randomize(bool value)
Sets the random load balancing for integral operators flag.
Definition: funcdefaults.h:329
static const Tensor< double > & get_cell_width()
Returns the width of each user cell dimension.
Definition: funcdefaults.h:391
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:384
BCType
Definition: funcdefaults.h:56
Implements WorldContainer.
Definition: funcdefaults.h:56
Definition: funcdefaults.h:56
Interface to be provided by any process map.
Definition: worlddc.h:64
Definition: funcdefaults.h:56
static bool get_project_randomize()
Gets the random load balancing for projection flag.
Definition: funcdefaults.h:335
Multidimension Key for MRA tree and associated iterators.
static int get_truncate_mode()
Gets the default truncation mode.
Definition: funcdefaults.h:263
int64_t Translation
Definition: key.h:57
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45
Definition: funcdefaults.h:56
Key is the index for a node of the 2^NDIM-tree.
Definition: key.h:69
static void set_k(int value)
Sets the default wavelet order.
Definition: funcdefaults.h:219
BoundaryConditions(BCType code=BC_FREE)
Constructor. Default boundary condition set to free space.
Definition: funcdefaults.h:80