fix 2 compiler warnings in modelgen
[gnucap-felix.git] / modules / d_rcd_sym.cc
blob2d61be80f1ff0c80f91225a6f6a07c5fcf1aba7a
1 /* vim:ts=8:sw=2:et:
3 * (c)2010 felix salfelder
4 * nonGPL ?
5 */
8 #include "e_aux.h"
9 #include "e_storag.h"
11 #define ADD_VERSION
12 #include "globals.h"
13 #include "e_elemnt.h"
14 #include "e_adp.h"
15 #include "d_rcd_sym.h"
17 /*--------------------------------------------------------------------------*/
18 double MODEL_BUILT_IN_RCD_SYM::P( const COMPONENT* brh) const
20 const DEV_BUILT_IN_RCD* c = prechecked_cast<const DEV_BUILT_IN_RCD*>(brh);
21 const COMMON_BUILT_IN_RCD* cc = prechecked_cast<const COMMON_BUILT_IN_RCD*>(c->common());
22 if (_sim->analysis_is_tt()) { untested();
23 return (cc->_zero + c->_Ccgfill->tt()) * cc->_weight * cc->_wcorr; // shifted
24 } else { untested();
25 assert(is_number( c->_Ccgfill->tt() * cc->_weight * cc->_wcorr));
26 // return c->_Ccgfill->tt() * cc->_weight * cc->_wcorr;
28 return double((c->_tr_fill + c->_Ccgfill->tt() + cc->_zero ) * cc->_weight * cc->_wcorr); // shifted
31 /*--------------------------------------------------------------------------*/
32 void MODEL_BUILT_IN_RCD_SYM::do_stress_apply( COMPONENT* ) const
34 if (!_sim->analysis_is_tt()){
35 // _Ccgfill->
38 /*--------------------------------------------------------------------------*/
39 void DEV_BUILT_IN_RCD_SYM::tr_stress()
41 #if 0
42 const COMMON_BUILT_IN_RCD* c = static_cast<const COMMON_BUILT_IN_RCD*>(common());
43 assert(c);
44 assert(c->model());
45 const MODEL_BUILT_IN_RCD* m = prechecked_cast<const MODEL_BUILT_IN_RCD*>(c->model());
46 assert(m);
47 assert(c->sdp());
48 #endif
50 unreachable(); //obsolete.
51 assert(false);
53 ///*--------------------------------------------------------------------------*/
54 namespace MODEL_BUILT_IN_RCD_DISPATCHER {
55 static DEV_BUILT_IN_RCD_SYM p2d;
56 static MODEL_BUILT_IN_RCD_SYM p2(&p2d);
57 static DISPATCHER<MODEL_CARD>::INSTALL
58 d2(&model_dispatcher, "rcdsym_base", &p2);
60 ///*--------------------------------------------------------------------------*/
61 void MODEL_BUILT_IN_RCD_SYM::do_expand( COMPONENT* ) const
64 /*--------------------------------------------------------------------------*/
65 std::string MODEL_BUILT_IN_RCD_SYM::dev_type()const
67 return "rcdsym";
69 /*--------------------------------------------------------------------------*/
70 MODEL_BUILT_IN_RCD_SYM::MODEL_BUILT_IN_RCD_SYM(const BASE_SUBCKT* p)
71 : MODEL_BUILT_IN_RCD(p){ }
72 /*--------------------------------------------------------------------------*/
73 MODEL_BUILT_IN_RCD_SYM::MODEL_BUILT_IN_RCD_SYM(const MODEL_BUILT_IN_RCD_SYM& p)
74 : MODEL_BUILT_IN_RCD(p){ }
75 /*--------------------------------------------------------------------------*/
76 void DEV_BUILT_IN_RCD_SYM::expand() {
77 assert(_n);
78 assert(common());
79 const COMMON_BUILT_IN_RCD* c = static_cast<const COMMON_BUILT_IN_RCD*>(common());
80 assert(c);
81 assert(c->model());
82 const MODEL_BUILT_IN_RCD* m = prechecked_cast<const MODEL_BUILT_IN_RCD*>(c->model());
83 assert(m); USE(m);
84 assert(c->sdp());
85 const SDP_BUILT_IN_RCD* s = prechecked_cast<const SDP_BUILT_IN_RCD*>(c->sdp());
86 assert(s); USE(s);
88 trace0("DEV_BUILT_IN_RCD_SYM::expand()");
90 if (_sim->is_first_expand()) {
91 precalc_first();
92 precalc_last();
93 // local nodes
94 //assert(!(_n[n_ic].n_()));
95 //BUG// this assert fails on a repeat elaboration after a change.
96 //not sure of consequences when new_model_node called twice.
97 #if 0
98 if (!(_n[n_ic].n_())) {
99 if (false) {
100 _n[n_ic] = _n[n_b];
101 }else{
102 _n[n_ic].new_model_node("." + long_label() + ".ic", this);
104 }else{
105 if (false) {
106 assert(_n[n_ic] == _n[n_b]);
107 }else{
108 //_n[n_ic].new_model_node("ic." + long_label(), this);
111 #endif
114 /*--------------------------------------------------------------------------*/
115 void MODEL_BUILT_IN_RCD_SYM::do_tr_stress( const COMPONENT*) const
117 assert(false); // use DEV::tr_stress
119 /*--------------------------------------------------------------------------*/
120 void MODEL_BUILT_IN_RCD_SYM::do_tt_prepare( COMPONENT* brh) const
122 const DEV_BUILT_IN_RCD* c = prechecked_cast<const DEV_BUILT_IN_RCD*>(brh);
123 const COMMON_BUILT_IN_RCD* cc = prechecked_cast<const COMMON_BUILT_IN_RCD*>(c->common());
124 assert(is_number(cc->_zero));
126 trace7( "MODEL_BUILT_IN_RCD_SYM_V2::do_tt_prepare", brh->short_label(),
127 -cc->_wcorr, cc->_zero, c->_Ccgfill->tt(), hp(c->_Ccgfill), c->_Ccgfill->m_(), _sim->_adp_nodes);
129 if(!_sim->_tt_uic) {
130 assert(is_number(cc->_zero));
131 assert(is_number(c->_Ccgfill->tt()));
132 assert(c->_Ccgfill->tt() == 0); //shifted
133 } else {
136 /*--------------------------------------------------------------------------*/
137 DEV_BUILT_IN_RCD_SYM::DEV_BUILT_IN_RCD_SYM()
138 :DEV_BUILT_IN_RCD()
140 // _n = _nodes;
141 // attach_common(&Default_BUILT_IN_RCD);
143 // ++_count;
144 // overrides
146 /*--------------------------------------------------------------------------*/
147 int MODEL_BUILT_IN_RCD_SYM::tt_region(const COMPONENT* brh) const
148 { untested();
149 const DEV_BUILT_IN_RCD* c = (const DEV_BUILT_IN_RCD*) brh;
151 assert(c);
152 return ( (c->_Ccgfill)->region() );
154 /*--------------------------------------------------------------------------*/
155 //double MODEL_BUILT_IN_RCD_SYM::__Edu(double s, const COMMON_COMPONENT* c ) const
157 // const COMMON_BUILT_IN_RCD* cc = dynamic_cast<const COMMON_BUILT_IN_RCD*>(c) ;
158 // double te = __Re( s, cc);
159 // double tc = __Rc( s, cc);
160 // double dte = __dRe( s, cc);
161 // double dtc = __dRc( s, cc);
162 // double ret = (dtc * ( te + tc ) - ( dte + dtc ) * tc) / ( dte + dtc ) / ( dte + dtc ) ;
163 // assert(is_number(ret));
164 // return ret;
166 /*--------------------------------------------------------------------------*/
167 /*--------------------------------------------------------------------------*/
168 //ADP_NODE_RCD* MODEL_BUILT_IN_RCD_SYM::new_adp_node(const COMPONENT* c) const{
169 // return new ADP_NODE_RCD(c);