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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2146 - (show annotations)
Wed Dec 10 02:59:46 2008 UTC (10 years, 10 months ago) by jfenwick
File size: 1667 byte(s)
Replaced duplicate code in Data with macro calls.
Added AUTOLAZY parameter (defaults to off for now.)
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 }
30
31 int
32 EscriptParams::getInt(const char* name, int sentinel) const
33 {
34 if (!strcmp(name,"TOO_MANY_LINES"))
35 {
36 return too_many_lines;
37 }
38 if (!strcmp(name,"AUTOLAZY"))
39 {
40 return autolazy;
41 }
42 return sentinel;
43 }
44
45 void
46 EscriptParams::setInt(const char* name, int value)
47 {
48 if (!strcmp(name,"TOO_MANY_LINES"))
49 {
50 too_many_lines=value;
51 }
52 if (!strcmp(name,"AUTOLAZY"))
53 {
54 autolazy=!(value==0); // set to 1 or zero
55 }
56 }
57
58 void
59 setEscriptParamInt(const char* name, int value)
60 {
61 escriptParams.setInt(name,value);
62 }
63
64
65 int
66 getEscriptParamInt(const char* name, int sentinel)
67 {
68 return escriptParams.getInt(name, sentinel);
69 }
70
71 boost::python::list
72 listEscriptParams()
73 {
74 using namespace boost::python;
75 boost::python::list l;
76 l.append(make_tuple("TOO_MANY_LINES","Maximum number of lines to output when printing data before printing a summary instead."));
77 l.append(make_tuple("AUTOLAZY","{0,1} Operations involving Expanded Data will create lazy results."));
78 return l;
79 }
80
81
82 } // end namespace

  ViewVC Help
Powered by ViewVC 1.1.26