testing
[gnucap-felix.git] / src / e_model.h
blob3333bb583e3d091f45c85a6dc584348d5f62ea2a
1 /*$Id: e_model.h 2015/01/27 al $ -*- 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 * base class for all models
24 #ifndef E_MODEL_H
25 #define E_MODEL_H
26 #include "u_parameter.h"
27 #include "e_card.h"
28 #include "e_adp.h"
29 /*--------------------------------------------------------------------------*/
30 // external
31 class COMPONENT;
32 /*--------------------------------------------------------------------------*/
33 class SDP_CARD {
34 private:
35 explicit SDP_CARD() {unreachable();}
36 explicit SDP_CARD(const SDP_CARD&) {unreachable();}
37 public:
38 explicit SDP_CARD(const COMMON_COMPONENT*) {}
39 virtual ~SDP_CARD() {}
40 virtual void init(const COMMON_COMPONENT*) {}
42 /*--------------------------------------------------------------------------*/
43 class INTERFACE MODEL_CARD : public CARD{
44 bool _frozen; // indicate no change since last _sim->init
45 explicit MODEL_CARD() {unreachable();}
46 protected:
47 explicit MODEL_CARD(const MODEL_CARD& p);
48 public:
49 explicit MODEL_CARD(const COMPONENT* p);
50 ~MODEL_CARD();
52 public: // override virtuals
53 char id_letter()const {untested();return '\0';}
54 CARD* clone_instance()const
55 {assert(_component_proto); return _component_proto->clone();}
56 void precalc_first();
57 void expand_last(){_frozen=true;}
58 void set_param_by_index(int, string&, int);
59 void set_param_by_name(string Name, string Value);
60 bool param_is_printable(int)const;
61 std::string value_name()const {untested();return "";}
62 std::string param_name(int)const;
63 std::string param_name(int,int)const;
64 std::string param_value(int)const;
65 int param_count()const {return (1 + CARD::param_count());}
66 public:
67 bool frozen()const{return _frozen;}
68 virtual void tr_eval(COMPONENT*)const{unreachable();}
69 virtual void ac_eval(COMPONENT*)const{unreachable();}
70 virtual COMMON_COMPONENT* new_common()const {return 0;}
71 virtual SDP_CARD* new_sdp(COMMON_COMPONENT*)const {unreachable();return 0;};
72 virtual bool parse_params_obsolete_callback(CS&) {unreachable(); return false;}
73 virtual bool is_valid(const COMPONENT*)const {return true;}
74 const CARD* component_proto()const {untested(); return _component_proto;}
75 protected:
76 const CARD* _component_proto;
77 public:
78 PARAMETER<double> _tnom_c;
79 public:
81 virtual void do_tt_commit(COMPONENT*)const{ untested();}
82 virtual void do_stress_apply(COMPONENT*)const{ trace0("model.h stress apply(C)") ;}
83 void do_stress_apply()const{unreachable();} // not used for models.
85 // void stress_calc(COMPONENT*)const{ ;} //sollte eval heissen...
86 // void stress_calc( )const{ ;} //sollte eval heissen...?
88 virtual ADP_CARD* new_adp( COMPONENT* d)const
90 trace1("MODEL_CARD::new_adp. empty adpcard", d->short_label());
91 return NULL;
92 ///return( new ADP_CARD(d) ); // empty adpcard...
97 /*--------------------------------------------------------------------------*/
98 /*--------------------------------------------------------------------------*/
99 #endif
100 // vim:ts=8:sw=2:noet: