/[escript]/trunk/escriptcore/src/EscriptParams.cpp
ViewVC logotype

Annotation of /trunk/escriptcore/src/EscriptParams.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2501 - (hide annotations)
Tue Jun 30 04:43:01 2009 UTC (9 years, 9 months ago) by jfenwick
Original Path: trunk/escript/src/EscriptParams.cpp
File size: 2285 byte(s)
Caching now works.
Number of levels and nodes permitted in a lazy expression has increased to 70 and 15000.
1 jfenwick 1897
2    
3     /*******************************************************
4     *
5     * Copyright (c) 2003-2008 by University of Queensland
6     * Earth Systems Science Computational Center (ESSCC)
7     * http://www.uq.edu.au/esscc
8     *
9     * Primary Business: Queensland, Australia
10     * Licensed under the Open Software License version 3.0
11     * http://www.opensource.org/licenses/osl-3.0.php
12     *
13     *******************************************************/
14    
15 jfenwick 2142 #include "EscriptParams.h"
16 jfenwick 1897 #include <cstring>
17 jfenwick 2142 #include <boost/python/tuple.hpp>
18 jfenwick 1897
19     namespace escript
20     {
21    
22     EscriptParams escriptParams; // externed in header file
23    
24    
25     EscriptParams::EscriptParams()
26     {
27     too_many_lines=80;
28 jfenwick 2146 autolazy=0;
29 jfenwick 2501 too_many_levels=70;
30     too_many_nodes=15000;
31 jfenwick 2273 // These #defs are for performance testing only
32     // in general, I don't want people tweaking the
33     // default value using compiler options
34     // I've provided a python interface for that
35     #ifdef FAUTOLAZYON
36     autolazy=1;
37     #endif
38     #ifdef FAUTOLAZYOFF
39     autolazy=0;
40     #endif
41 jfenwick 1897 }
42    
43     int
44     EscriptParams::getInt(const char* name, int sentinel) const
45     {
46     if (!strcmp(name,"TOO_MANY_LINES"))
47     {
48     return too_many_lines;
49     }
50 jfenwick 2146 if (!strcmp(name,"AUTOLAZY"))
51     {
52     return autolazy;
53     }
54 jfenwick 2472 if (!strcmp(name,"TOO_MANY_LEVELS"))
55     {
56     return too_many_levels;
57     }
58     if (!strcmp(name,"TOO_MANY_NODES"))
59     {
60     return too_many_nodes;
61     }
62 jfenwick 1897 return sentinel;
63     }
64    
65     void
66     EscriptParams::setInt(const char* name, int value)
67     {
68     if (!strcmp(name,"TOO_MANY_LINES"))
69     {
70     too_many_lines=value;
71     }
72 jfenwick 2146 if (!strcmp(name,"AUTOLAZY"))
73     {
74     autolazy=!(value==0); // set to 1 or zero
75     }
76 jfenwick 2472 if (!strcmp(name,"TOO_MANY_LEVELS"))
77     {
78     too_many_levels=value;
79     }
80     if (!strcmp(name,"TOO_MANY_NODES"))
81     {
82     too_many_nodes=value;
83     }
84 jfenwick 1897 }
85    
86     void
87     setEscriptParamInt(const char* name, int value)
88     {
89     escriptParams.setInt(name,value);
90     }
91    
92    
93     int
94     getEscriptParamInt(const char* name, int sentinel)
95     {
96     return escriptParams.getInt(name, sentinel);
97     }
98    
99 jfenwick 2142 boost::python::list
100     listEscriptParams()
101     {
102     using namespace boost::python;
103     boost::python::list l;
104     l.append(make_tuple("TOO_MANY_LINES","Maximum number of lines to output when printing data before printing a summary instead."));
105 jfenwick 2146 l.append(make_tuple("AUTOLAZY","{0,1} Operations involving Expanded Data will create lazy results."));
106 jfenwick 2142 return l;
107     }
108 jfenwick 1897
109 jfenwick 2142
110 jfenwick 1897 } // end namespace

  ViewVC Help
Powered by ViewVC 1.1.26