viminfo
[gnucap-felix.git] / include / u_opt.h
blobe9e1cc6455f7b78883a3f75a95b34a6799c2f210
1 /*$Id: u_opt.h,v 26.127 2009/11/09 16:06:11 al Exp $ -*- C++ -*-
2 * Copyright (C) 2001 Albert Davis
3 * Author: Albert Davis <aldavis@gnu.org>
5 * This file is part of "Gnucap", the Gnu Circuit Analysis Package
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 *------------------------------------------------------------------
22 * all the options set by the .options card.
24 //testing=script,complete 2006.07.14
25 #ifndef U_OPT_H
26 #define U_OPT_H
27 #include "mode.h"
28 /*--------------------------------------------------------------------------*/
29 class CS;
30 class LANGUAGE;
31 /*--------------------------------------------------------------------------*/
32 /* integration method selector -- not all methods are implemented */
33 enum method_t {meUNKNOWN=0, // no method set
34 meEULER, // backware Euler, unless forced to other
35 meEULERONLY, // backward Euler only
36 meTRAP, // usually trap, but euler where better
37 meTRAPONLY, // always trapezoid
38 meGEAR2, // usually gear2, but euler where better
39 meGEAR2ONLY, // always gear2 (except breakpoints)
40 meTRAPGEAR, // alt trap & gear2
41 meTRAPEULER, // alt trap & euler
42 meNUM_METHODS}; // number of methods (array dimension)
43 inline OMSTREAM& operator<<(OMSTREAM& o, method_t t) {
44 const std::string s[] = {"unknown", "euler", "euleronly", "trap", "traponly",
45 "gear2", "gear2only", "trapgear", "trapeuler"};
46 return (o << s[t]);
48 /*--------------------------------------------------------------------------*/
49 enum order_t {oREVERSE=1, oFORWARD, oAUTO};
50 inline OMSTREAM& operator<<(OMSTREAM& o, order_t t) {
51 const std::string s[] = {"", "reverse", "forward", "auto"};
52 return (o << s[t]);
54 /*--------------------------------------------------------------------------*/
55 enum phase_t {pDEGREES, pRADIANS, pP_DEGREES, pN_DEGREES};
56 inline OMSTREAM& operator<<(OMSTREAM& o, phase_t t) {
57 const std::string s[] = {"degrees", "radians", "+degrees", "-degrees"};
58 return (o << s[t]);
60 /*--------------------------------------------------------------------------*/
61 enum UNITS {uSI, uSPICE};
62 inline OMSTREAM& operator<<(OMSTREAM& o, UNITS t) {
63 const std::string s[] = {"si", "spice"};
64 return (o << s[t]);
66 /*--------------------------------------------------------------------------*/
67 enum {dsINIT=001, dsRANGE=002, dsDEVLIMIT=004, dsDEVREGION=010, dsREVERSE=020};
68 /*--------------------------------------------------------------------------*/
69 class INTERFACE OPT {
70 private:
71 explicit OPT(const OPT&) {unreachable(); incomplete();}
72 public:
73 explicit OPT() {}
74 ~OPT() {}
75 void command(CS& cmd);
76 private:
77 bool set_values(CS& cmd);
78 void print(OMSTREAM& where);
79 public:
80 enum ITL {DCBIAS=1, DCXFER=2, TRLOW=3, TRHIGH=4, TRTOTAL=5, SSTEP=6,
81 WCASE=7, TRACE=8, ITL_COUNT=9};
82 enum {_keep_time_steps = 5};
83 public:
84 static bool acct; // flag: print accounting info
85 static bool listing; // flag: print listing
86 static bool mod; // flag: print models
87 static bool page; // flag: do page ejects
88 static bool node; // flag: print node table
89 static bool opts; // flag: print options
90 static double gmin; // minimum conductance allowed
91 static double bypasstol; // bypass tolerance multiplier
92 static double loadtol; // trace load tolerance multiplier
93 static double reltol; // relative error tolerance
94 static double abstol; // absolute current error tolerance
95 static double vntol; // absolute voltage error tolerance
96 static double trtol; // transient error overestimation factor
97 static double chgtol; // charge tolerance
98 static double pivtol; // minimum acceptable pivot
99 static double pivrel; // max to min ratio in a column?
100 static int numdgt; // number of digits to display
101 static double tnom_c; // nominal temperature
102 static int cptime; // max allowed cpu time (seconds)
103 static int limtim; // amt of time to reserve for plots
104 static int limpts; // max points to print
105 static int lvlcod; // enum: if == 2, solve fast
106 static int lvltim; // enum: how to control time step
107 static method_t method; // enum: integration method
108 static int maxord; // max order of integration
109 static double defl; // MOS default channel length
110 static double defw; // MOS default channel width
111 static double defad; // MOS default drain diffusion area
112 static double defas; // MOS default source diffusion area
114 static bool clobber; // allow to overwrite files without question
115 static bool keys_between_nodes; // allow keywords between nodes
116 static double floor; // display as zero if less than this
117 static double vfloor; // display voltages as zero if less than this
118 static double dampmax; // Newton-Raphson damping coefficient max
119 static double dampmin; // Newton-Raphson damping coefficient min
120 static int dampstrategy; // bit flags, damping strategy options
121 static double roundofftol;// rel tolerance for zeroing after subtraction
122 static double temp_c; // ambient temperature
123 static double shortckt; // short resistance
124 static int picky; // error picky-ness
125 static unsigned outwidth; // width of output devices
126 static double ydivisions; // plot divisions, y axis
127 static phase_t phase; // how to print phase (degrees or radians)
128 static order_t order; // ordering method
129 static smode_t mode; // mixed-mode mode preference
130 static int transits; // number of good transitions for digital
131 static bool dupcheck; // check for duplicates on read
132 static bool bypass; // bypass model evaluation, if appropriate
133 static bool incmode; // make incremental changes to the matrix
134 static bool lcbypass; // bypass L and C evaluation when appropriate
135 static bool lubypass; // bypass parts of LU decomposition, if appropriate
136 static bool fbbypass; // bypass fwd & back sub when last iter converged
137 static bool traceload; // load only elements that need it, using queue
138 static int itermin; // forced min iteration count.
139 static double vmax; // + voltage limit for nonlinear calculations
140 static double vmin; // - voltage limit for nonlinear calculations
141 static double dtmin; // smallest internal step in transient analysis
142 static double dtratio; // ratio of max / min dt in transient analysis
143 static bool rstray; // include stray resistors in models
144 static bool cstray; // include stray capacitors in models
145 static int harmonics; // number of harmonics in fourier analysis
146 static double trstepgrow; // limit of step size growth in transient analysis
147 static double trstephold; // hold step size growth, converges slowly
148 static double trstepshrink;// amt to shrink step size on convergence failure
149 static double trreject; // how bad trunc error has to be to reject a step
150 static int trsteporder; // interpolation order for step size control
151 static double trstepcoef[_keep_time_steps]; // coefficient for step size control
152 static bool showall; // flag: show development flags
153 static int foooo; // a reusable value to aid development
154 static int diodeflags; // convergence heuristic flags for diode
155 static int mosflags; // convergence heuristic flags for mosfet
156 static bool quitconvfail; // quit on convergence failure
157 static bool edit; // use readline - command editing
158 static int recursion; // max recursion depth
159 static LANGUAGE* language; // simulation language
160 static bool case_insensitive;
161 static UNITS units;
163 static double lowlim; // 1 - reltol
164 static double uplim; // 1 + reltol
166 static int itl[ITL_COUNT];// 1=dc (bias) iteration limit
167 // 2=dc transfer iteration limit
168 // 3=lower transient iteration limit
169 // 4=upper transient iteration limit
170 // 5=transient total iterations allowed
171 // 6=source stepping iteration limit
172 // 7=worst case iteration limit
173 // 8=trace nonconvergence start iteration
175 /*--------------------------------------------------------------------------*/
176 class SET_RUN_MODE {
177 private:
178 RUN_MODE _old_run_mode;
179 explicit SET_RUN_MODE() :_old_run_mode(ENV::run_mode) {unreachable();}
180 public:
181 explicit SET_RUN_MODE(RUN_MODE rm)
182 :_old_run_mode(ENV::run_mode)
184 ENV::run_mode = rm;
186 ~SET_RUN_MODE()
188 ENV::run_mode = _old_run_mode;
191 /*--------------------------------------------------------------------------*/
192 /*--------------------------------------------------------------------------*/
193 #endif
194 // vim:ts=8:sw=2:noet: