Xyce  6.1
N_DEV_Source.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2015 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-------------------------------------------------------------------------
26 // Filename : $RCSfile: N_DEV_Source.C,v $
27 //
28 // Purpose :
29 //
30 // Special Notes :
31 //
32 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
33 //
34 // Creation Date : 02/28/00
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.34 $
40 //
41 // Revision Date : $Date: 2015/04/24 20:25:43 $
42 //
43 // Current Owner : $Author: dgbaur $
44 //-------------------------------------------------------------------------
45 
46 #include <Xyce_config.h>
47 
48 #include <N_DEV_Source.h>
49 #include <N_DEV_SourceData.h>
50 #include <N_DEV_SolverState.h>
51 
52 namespace Xyce {
53 namespace Device {
54 
55 // SourceInstance
56 //-----------------------------------------------------------------------------
57 // Function : SourceInstance::SourceInstance
58 // Purpose : constructor
59 // Special Notes :
60 // Scope : public
61 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
62 // Creation Date : 3/16/00
63 //-----------------------------------------------------------------------------
65  const InstanceBlock & IB,
66  ParametricData<void> & parametric_data,
67  const FactoryBlock & factory_block)
68  : DeviceInstance(IB, parametric_data, factory_block),
69  tranSourceData_(0),
70  acSourceData_(0),
71  dcSourceData_(0),
72  sourceType(_SIN_DATA)
73 {}
74 
75 
76 //-----------------------------------------------------------------------------
77 // Function : SourceInstance::~SourceInstance
78 // Purpose : destructor
79 // Special Notes :
80 // Scope : public
81 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
82 // Creation Date : 3/16/00
83 //-----------------------------------------------------------------------------
85 {}
86 
87 
88 //-----------------------------------------------------------------------------
89 // Function : SourceInstance::setFastSourceFlag
90 // Purpose :
91 // Special Notes :
92 // Scope : public
93 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
94 // Creation Date : 03/27/04
95 //-----------------------------------------------------------------------------
97 {
98  if (tranSourceData_ != 0)
99  {
101  }
102 }
103 
104 //-----------------------------------------------------------------------------
105 // Function : SourceInstance::getFastSourceFlag
106 // Purpose :
107 // Special Notes :
108 // Scope : public
109 // Creator : Robert Hoekstra, SNL, Parallel Computational Sciences
110 // Creation Date : 04/1/04
111 //-----------------------------------------------------------------------------
113 {
114  bool flag = false;
115  if (tranSourceData_ != 0)
116  {
118  }
119  return flag;
120 }
121 
122 //-----------------------------------------------------------------------------
123 // Function : SourceInstance::period
124 // Purpose : Time period of periodic sources
125 // Special Notes :
126 // Scope : public
127 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
128 // Creation Date : 03/31/04
129 //-----------------------------------------------------------------------------
131 {
132  double per = 0.0;
133  if (tranSourceData_ != 0)
134  {
135  per = tranSourceData_->period();
136  }
137  return per;
138 }
139 
140 //-----------------------------------------------------------------------------
141 // Function : SourceInstance::getResetFlag
142 // Purpose :
143 // Special Notes :
144 // Scope : public
145 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
146 // Creation Date : 07/30/04
147 //-----------------------------------------------------------------------------
149 {
150  if (tranSourceData_ != 0)
151  {
153  }
154  return true;
155 }
156 
157 //-----------------------------------------------------------------------------
158 // Function : SourceInstance::getInstanceBreakPoints
159 // Purpose :
160 // Special Notes :
161 // Scope : public
162 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
163 // Creation Date : 02/05/06
164 //-----------------------------------------------------------------------------
165 bool
167  std::vector<Util::BreakPoint> & breakPointTimes)
168 {
169  bool fast_source_flag = false;
170 
171  if (!getSolverState().blockAnalysisFlag_)
172  {
173  fast_source_flag = getFastSourceFlag();
174  }
175 
176  bool tmpBool = true;
177  if (!fast_source_flag && tranSourceData_ != 0)
178  {
179  tmpBool = tranSourceData_->getBreakPoints(breakPointTimes);
180  }
181 
182  return tmpBool;
183 }
184 
185 //-----------------------------------------------------------------------------
186 // Function : SourceInstance::updateSource
187 // Purpose :
188 // Special Notes :
189 // Scope : public
190 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
191 // Creation Date : 02/05/06
192 //-----------------------------------------------------------------------------
194 {
195  if (tranSourceData_ != 0)
196  {
198  }
199  if (dcSourceData_ != 0)
200  {
202  }
203  if (acSourceData_ != 0)
204  {
206  }
207 
208  return true;
209 }
210 
211 } // namespace Device
212 } // namespace Xyce
SourceInstance(const InstanceBlock &IB, ParametricData< void > &parametric_data, const FactoryBlock &factory_block)
Definition: N_DEV_Source.C:64
Pure virtual class to augment a linear system.
const T & value(const ParameterBase &entity, const Descriptor &descriptor)
Returns the value of the parameter for the entity.
Definition: N_DEV_Pars.h:1224
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
Class ParametricData manages the configuration information and the parameter binding map...
Definition: N_DEV_Pars.h:1303
virtual bool getBreakPoints(std::vector< Util::BreakPoint > &breakPointTimes)
virtual bool getInstanceBreakPoints(std::vector< Util::BreakPoint > &breakPointTimes)
Definition: N_DEV_Source.C:166
void setFastTimeScaleFlag(bool fastTimeScaleFlag)
const SolverState & getSolverState() const
bool getFastTimeScaleFlag() const
virtual bool updateSource()=0
void setFastSourceFlag(bool value)
Definition: N_DEV_Source.C:96
InstanceBlock represent a device instance line from the netlist.