1 /*$Id: s__.h,v 1.9 2009-12-16 17:22:07 felix 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)
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
21 *------------------------------------------------------------------
22 * base class for simulation methods
24 //testing=script,complete 2006.07.14
29 /*--------------------------------------------------------------------------*/
36 /*--------------------------------------------------------------------------*/
37 class INTERFACE SIM
: public CMD
{
38 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
40 enum TRACE
{ // how much diagnostics to show
41 tNONE
= 0, /* no extended diagnostics */
42 tUNDER
, /* show underlying analysis, important pts only */
43 tALLTIME
, /* show every time step, including hidden */
44 tGUESS
, /* show guesses (from predictor) */
45 tREJECTED
, /* show rejected time steps */
46 tITERATION
, /* show every iteration, including nonconverged */
47 tVERBOSE
, /* show extended diagnostics */
48 tMATRIX
= 16, /* dump matrix. */
51 enum ALARM
{ // how much diagnostics to show
52 aNONE
= 0, /* ignore range violations */
53 aREPORT
= 1, /* report range violations */
54 aREDIR
= 2, /* redirect to stderr */
55 aABORT
= 4 /* abort simulation */
57 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
59 OMSTREAM _out
; /* places to send the results */
62 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
64 const std::string
long_label()const {unreachable(); return "";}
66 virtual void setup(CS
&) = 0;
67 virtual void sweep() = 0;
68 virtual void finish() {}
69 virtual bool is_step_rejected()const {return false;}
71 explicit SIM(const SIM
&):CMD(),_scope(NULL
) {unreachable(); incomplete();}
73 explicit SIM(): CMD(),_scope(NULL
) {}
76 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
78 void command_base(CS
&); /* s__init.cc */
79 bool common_options(CS
& Cmd
);
81 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
83 const PROBELIST
& alarmlist()const; /* s__out.cc */
84 const PROBELIST
& plotlist()const;
85 const PROBELIST
& printlist()const;
86 const PROBELIST
& storelist()const;
87 virtual void outdata(double);
88 virtual void head(double,double,const std::string
&);
89 virtual void print_results(double);
91 virtual void store_results(double);
92 virtual void expect_results(double);
96 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
97 protected: /* s__solve.cc */
98 bool solve(OPT::ITL
,TRACE
);
99 bool solve_with_homotopy(OPT::ITL
,TRACE
);
102 void finish_building_evalq();
105 void evaluate_models();
108 void solve_equations(TRACE
);
110 /*--------------------------------------------------------------------------*/
111 /*--------------------------------------------------------------------------*/
113 // vim:ts=8:sw=2:noet: