-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy paths__init.cc
108 lines (103 loc) · 3.13 KB
/
s__init.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* $Id: s__init.cc 2016/03/28 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis <aldavis@gnu.org>
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* initialization (allocation, node mapping, etc)
*/
//testing=obsolete
#include "u_sim_data.h"
#include "e_cardlist.h"
#include "u_status.h"
#include "s__.h"
/*--------------------------------------------------------------------------*/
void SIM::command_base(CS& cmd)
{
assert(_sim);
reset_timers();
_sim->reset_iteration_counter(_sim->_mode);
_sim->reset_iteration_counter(iPRINTSTEP);
try {
setup(cmd);
_sim->init(_scope);
_scope->precalc_last();
for(auto i = _scope->begin(); i!=_scope->end(); ++i){
CARD* deflated = (*i)->deflate();
if(*i!=deflated){ untested();
delete *i;
*i = deflated;
}else{
}
}
_sim->alloc_vectors();
_sim->_aa.reallocate();
_sim->_aa.dezero(OPT::gmin);
_sim->_aa.set_min_pivot(OPT::pivtol);
_sim->_lu.reallocate();
_sim->_lu.dezero(OPT::gmin);
_sim->_lu.set_min_pivot(OPT::pivtol);
assert(_sim->_nstat);
::status.set_up.stop();
switch (ENV::run_mode) {
case rPRE_MAIN: unreachable(); break;
case rBATCH:
case rINTERACTIVE:
case rSCRIPT: sweep(); break;
case rPRESET: /*nothing*/ break;
}
}catch (Exception& e) { untested();
error(bDANGER, e.message() + '\n');
_sim->count_iterations(iTOTAL);
_sim->_lu.unallocate();
_sim->_aa.unallocate();
}
_sim->unalloc_vectors();
finish();
::status.total.stop();
}
/*--------------------------------------------------------------------------*/
SIM::~SIM()
{
//assert(!_scope);
if (_sim) {
_sim->uninit();
}else{ untested();
}
}
/*--------------------------------------------------------------------------*/
void SIM::reset_timers()
{
::status.advance.reset();
::status.queue.reset();
::status.evaluate.reset();
::status.load.reset();
::status.lud.reset();
::status.back.reset();
::status.review.reset();
::status.accept.reset();
::status.output.reset();
::status.aux1.reset();
::status.aux2.reset();
::status.aux3.reset();
::status.set_up.reset().start();
::status.total.reset().start();
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet: