1 /*$Id: e_adplist.cc,v 1.10 2010-09-20 08:21:54 felix Exp $ -*- C++ -*-
3 * Copyright (C) 2001 Albert Davis
4 * Author: Albert Davis <aldavis@gnu.org>
6 * This file is part of "Gnucap", the Gnu Circuit Analysis Package
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3, or (at your option)
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 *------------------------------------------------------------------
23 * Base class for "adp" in the circuit description file
24 * This file contains functions that process a list of adp
26 //testing=script 2006.07.10
28 #include "u_nodemap.h"
30 #include "e_adplist.h"
33 #include "u_time_pair.h"
35 /*--------------------------------------------------------------------------*/
36 ADP_NODE_LIST::ADP_NODE_LIST()
43 /*--------------------------------------------------------------------------*/
44 ADP_NODE_LIST::~ADP_NODE_LIST()
47 /*--------------------------------------------------------------------------*/
48 ADP_NODE_LIST
& ADP_NODE_LIST::erase(ADP_NODE
* c
)
54 /*--------------------------------------------------------------------------*/
55 PARAM_LIST
* ADP_NODE_LIST::params()
59 _params
= new PARAM_LIST
;
64 /*--------------------------------------------------------------------------*/
65 PARAM_LIST
* ADP_NODE_LIST::params()const
70 static PARAM_LIST empty_params
;
74 /*--------------------------------------------------------------------------*/
75 //ADP_NODE_LIST::iterator ADP_NODE_LIST::find_again(const std::string& short_name,
76 // ADP_NODE_LIST::iterator Begin)
78 // return notstd::find_ptr(Begin, end(), short_name);
80 ///*--------------------------------------------------------------------------*/
81 //ADP_NODE_LIST::const_iterator ADP_NODE_LIST::find_again(const std::string& short_name,
82 // ADP_NODE_LIST::const_iterator Begin)const
84 // return notstd::find_ptr(Begin, end(), short_name);
86 /*--------------------------------------------------------------------------*/
87 /* erase_all: empty the list, destroy contents
88 * Beware: something else may be pointing to them, leaving dangling ptr.
90 ADP_NODE_LIST
& ADP_NODE_LIST::erase_all()
92 while (!_al
.empty()) {
98 /* tr_iwant_matrix: allocate solution matrix
99 * also sets some flags for mixed-mode
101 /*--------------------------------------------------------------------------*/
102 /* apply things to all cards */
103 ADP_NODE_LIST
& ADP_NODE_LIST::do_forall( void (ADP_NODE::*thing
)( ) )
105 // #pragma omp parallel for
106 for (iterator ci
=begin(); ci
!=end(); ++ci
) {
111 /*--------------------------------------------------------------------------*/
112 /* tr_accept: final acceptance of a time step, before moving on
113 * (ab) used to collect stress...
115 ADP_LIST
& ADP_LIST::tr_accept()
117 for (iterator ci
=begin(); ci
!=end(); ++ci
) {
118 // trace_func_comp();
123 /*--------------------------------------------------------------------------*/
124 TIME_PAIR
ADP_NODE_LIST::tt_review()
128 trace0(("ADP_NODE_LIST::tt_review\n"));
129 // put review into DEVICE?
132 ADP_NODE
* minnode
=NULL
;
134 for (iterator ci
=begin(); ci
!=end(); ++ci
) {
136 TIME_PAIR tmp
= (*ci
)->tt_review();
137 trace1(("ADP_NODE_LIST::tt_review at " + (*ci
)->short_label()).c_str(), tmp
._event
);
141 trace1(("ADP_NODE_LIST::tt_review min at" +minnode
->short_label()).c_str(), tmp
._event
);
150 std::cout
<< "* wdT min by " << minnode
->short_label() << ": " <<
151 event
<< " gain " << event
/CKT_BASE::_sim
->_dTmin
<< "\n";
157 /*--------------------------------------------------------------------------*/
158 TIME_PAIR
ADP_NODE_LIST::tt_preview()
161 for (iterator ci
=begin(); ci
!=end(); ++ci
) {
162 //time_by.min((**ci).tt_preview());
167 /*--------------------------------------------------------------------------*/
168 /*--------------------------------------------------------------------------*/
169 /*--------------------------------------------------------------------------*/
177 /*--------------------------------------------------------------------------*/
178 ADP_LIST::~ADP_LIST()
181 /*--------------------------------------------------------------------------*/
182 PARAM_LIST
* ADP_LIST::params()
186 _params
= new PARAM_LIST
;
191 /*--------------------------------------------------------------------------*/
192 PARAM_LIST
* ADP_LIST::params()const
197 static PARAM_LIST empty_params
;
198 return &empty_params
;
201 /*--------------------------------------------------------------------------*/
202 //ADP_LIST::iterator ADP_LIST::find_again(const std::string& short_name,
203 // ADP_LIST::iterator Begin)
205 // return notstd::find_ptr(Begin, end(), short_name);
207 ///*--------------------------------------------------------------------------*/
208 //ADP_LIST::const_iterator ADP_LIST::find_again(const std::string& short_name,
209 // ADP_LIST::const_iterator Begin)const
211 // return notstd::find_ptr(Begin, end(), short_name);
213 /*--------------------------------------------------------------------------*/
214 /* erase_all: empty the list, destroy contents
215 * Beware: something else may be pointing to them, leaving dangling ptr.
217 ADP_LIST
& ADP_LIST::erase_all()
219 while (!_al
.empty()) {
225 /* tr_iwant_matrix: allocate solution matrix
226 * also sets some flags for mixed-mode
228 /*--------------------------------------------------------------------------*/
229 /* apply things to all cards
231 ADP_LIST
& ADP_LIST::do_forall( void (ADP_CARD::*thing
)( ) )
233 for (iterator ci
=begin(); ci
!=end(); ++ci
) {
238 /*--------------------------------------------------------------------------*/
239 TIME_PAIR
ADP_LIST::tt_review() const
242 for (const_iterator ci
=begin(); ci
!=end(); ++ci
) {
243 TIME_PAIR buf
=(**ci
).tt_review();
246 std::cerr
<< "ADP_LIST::tt_review 0 -- not implemented?\n";
252 /*--------------------------------------------------------------------------*/
253 TIME_PAIR
ADP_LIST::tt_preview()
256 for (iterator ci
=begin(); ci
!=end(); ++ci
) {
257 time_by
.min((**ci
).tt_preview());
261 /*--------------------------------------------------------------------------*/