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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2273 - (show annotations)
Tue Feb 17 01:22:48 2009 UTC (10 years, 9 months ago) by jfenwick
File size: 1943 byte(s)
Added compile flags to turn autolazy on and off.
These are for testing purposes only.

1
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 #include "EscriptParams.h"
16 #include <cstring>
17 #include <boost/python/tuple.hpp>
18
19 namespace escript
20 {
21
22 EscriptParams escriptParams; // externed in header file
23
24
25 EscriptParams::EscriptParams()
26 {
27 too_many_lines=80;
28 autolazy=0;
29 // These #defs are for performance testing only
30 // in general, I don't want people tweaking the
31 // default value using compiler options
32 // I've provided a python interface for that
33 #ifdef FAUTOLAZYON
34 autolazy=1;
35 #endif
36 #ifdef FAUTOLAZYOFF
37 autolazy=0;
38 #endif
39 }
40
41 int
42 EscriptParams::getInt(const char* name, int sentinel) const
43 {
44 if (!strcmp(name,"TOO_MANY_LINES"))
45 {
46 return too_many_lines;
47 }
48 if (!strcmp(name,"AUTOLAZY"))
49 {
50 return autolazy;
51 }
52 return sentinel;
53 }
54
55 void
56 EscriptParams::setInt(const char* name, int value)
57 {
58 if (!strcmp(name,"TOO_MANY_LINES"))
59 {
60 too_many_lines=value;
61 }
62 if (!strcmp(name,"AUTOLAZY"))
63 {
64 autolazy=!(value==0); // set to 1 or zero
65 }
66 }
67
68 void
69 setEscriptParamInt(const char* name, int value)
70 {
71 escriptParams.setInt(name,value);
72 }
73
74
75 int
76 getEscriptParamInt(const char* name, int sentinel)
77 {
78 return escriptParams.getInt(name, sentinel);
79 }
80
81 boost::python::list
82 listEscriptParams()
83 {
84 using namespace boost::python;
85 boost::python::list l;
86 l.append(make_tuple("TOO_MANY_LINES","Maximum number of lines to output when printing data before printing a summary instead."));
87 l.append(make_tuple("AUTOLAZY","{0,1} Operations involving Expanded Data will create lazy results."));
88 return l;
89 }
90
91
92 } // end namespace

  ViewVC Help
Powered by ViewVC 1.1.26