/[escript]/trunk/escript/src/EscriptParams.h
ViewVC logotype

Contents of /trunk/escript/src/EscriptParams.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2721 - (show annotations)
Fri Oct 16 05:40:12 2009 UTC (10 years, 8 months ago) by jfenwick
File MIME type: text/plain
File size: 3317 byte(s)
minval and maxval are now lazy operations (they weren't before).
Whether or not Lsup, sup and inf resolve their arguments before computing answers is controlled by the escriptParam 'RESOLVE_COLLECTIVE'.
Note: integrate() still forces a resolve.

Added some unit tests for operations which weren't tested before.
Added deepcopy implementations for lazy operations which got missed somehow.
1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2009 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14 #ifndef escript_EscriptParams_H
15 #define escript_EscriptParams_H
16 #include "system_dep.h"
17 #include <boost/python/list.hpp>
18 #include "Data.h" // for the operators
19
20 namespace escript
21 {
22
23 class Data;
24 class DataLazy;
25
26 class EscriptParams
27 {
28 public:
29 ESCRIPT_DLL_API
30 EscriptParams();
31
32 ESCRIPT_DLL_API
33 int getInt(const char* name, int sentinel=0) const;
34
35 ESCRIPT_DLL_API
36 void setInt(const char* name, int value);
37
38 boost::python::list
39 listEscriptParams();
40
41 private:
42
43 // If we get more params we can replace this with a map
44 int too_many_lines;
45 int autolazy;
46 int too_many_levels;
47 int too_many_nodes;
48 int resolve_collective;
49
50 protected:
51 // This is to provide fast access for methods in Data.
52 // Its a little bit ugly, needing all those friends but I really want to
53 // limit outside access to the char* interface
54
55 int getTOO_MANY_LINES() {return too_many_lines;}
56 int getAUTOLAZY() { return autolazy;}
57 int getTOO_MANY_LEVELS() {return too_many_levels;}
58 int getTOO_MANY_NODES() {return too_many_nodes;}
59 int getRESOLVE_COLLECTIVE() {return resolve_collective;}
60
61 friend class escript::Data;
62 friend class escript::DataLazy;
63 friend Data operator+(const boost::python::api::object&, const escript::Data&);
64 friend Data operator-(const boost::python::api::object&, const escript::Data&);
65 friend Data operator*(const boost::python::api::object&, const escript::Data&);
66 friend Data operator/(const boost::python::api::object&, const escript::Data&);
67 friend Data operator+(const escript::Data&, const escript::Data&);
68 friend Data operator-(const escript::Data&, const escript::Data&);
69 friend Data operator*(const escript::Data&, const escript::Data&);
70 friend Data operator/(const escript::Data&, const escript::Data&);
71 friend Data operator+(const escript::Data&, const boost::python::api::object&);
72 friend Data operator-(const escript::Data&, const boost::python::api::object&);
73 friend Data operator*(const escript::Data&, const boost::python::api::object&);
74 friend Data operator/(const escript::Data&, const boost::python::api::object&);
75 friend Data C_GeneralTensorProduct(escript::Data& arg_0, escript::Data& arg_1,
76 int axis_offset, int transpose);
77 };
78
79
80 extern EscriptParams escriptParams;
81
82 /**
83 \brief Set the value of a named parameter.
84 See listEscriptParams() (showEscriptParams() in python) for available parameters.
85 */
86 ESCRIPT_DLL_API
87 void setEscriptParamInt(const char* name, int value);
88
89 /**
90 \brief get the value of a named parameter.
91 See listEscriptParams() (showEscriptParams() in python) for available parameters.
92 */
93 ESCRIPT_DLL_API
94 int getEscriptParamInt(const char* name, int sentinel=0);
95
96 /**
97 \brief describe available paramters.
98 \return a list of tuples (parameter name, value, description)
99 */
100 ESCRIPT_DLL_API
101 inline boost::python::list listEscriptParams()
102 {
103 return escriptParams.listEscriptParams();
104 }
105
106
107
108 }
109 #endif

  ViewVC Help
Powered by ViewVC 1.1.26