Xyce  6.1
N_DEV_DiodePDEModel.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 //-------------------------------------------------------------------------
27 // Filename : $RCSfile: N_DEV_DiodePDEModel.C,v $
28 //
29 // Purpose : One dimensional PDE device, model class implementation.
30 //
31 // Special Notes :
32 //
33 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
34 //
35 // Creation Date : 07/06/03
36 //
37 // Revision Information:
38 // ---------------------
39 //
40 // Revision Number: $Revision: 1.30.2.1 $
41 //
42 // Revision Date : $Date: 2015/04/02 18:20:12 $
43 //
44 // Current Owner : $Author: tvrusso $
45 //-------------------------------------------------------------------------
46 
47 #include <Xyce_config.h>
48 
49 #include <iostream>
50 #include <N_UTL_Math.h>
51 
52 #include <N_DEV_DeviceOptions.h>
53 #include <N_DEV_DiodePDE.h>
54 #include <N_DEV_ExternData.h>
55 #include <N_DEV_MatrixLoadData.h>
56 #include <N_DEV_SolverState.h>
57 
58 namespace Xyce {
59 namespace Device {
60 
61 namespace DiodePDE {
62 
64 {}
65 
66 //-----------------------------------------------------------------------------
67 // Function : Model::processParams
68 // Purpose :
69 // Special Notes :
70 // Scope : public
71 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
72 // Creation Date : 6/03/02
73 //-----------------------------------------------------------------------------
75 {
76  return true;
77 }
78 
79 //----------------------------------------------------------------------------
80 // Function : Model::processInstanceParams
81 // Purpose :
82 // Special Notes :
83 // Scope : public
84 // Creator : Dave Shirely, PSSI
85 // Creation Date : 03/23/06
86 //----------------------------------------------------------------------------
88 {
89 
90  std::vector<Instance*>::iterator iter;
91  std::vector<Instance*>::iterator first = instanceContainer.begin();
92  std::vector<Instance*>::iterator last = instanceContainer.end();
93 
94  for (iter=first; iter!=last; ++iter)
95  {
96  (*iter)->processParams();
97  }
98 
99  return true;
100 }
101 
102 //-----------------------------------------------------------------------------
103 // Function : Model::Model
104 // Purpose : model block constructor
105 // Special Notes :
106 // Scope : public
107 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
108 // Creation Date : 6/29/00
109 //-----------------------------------------------------------------------------
110 
112  const Configuration & configuration,
113  const ModelBlock & MB,
114  const FactoryBlock & factory_block)
115  : DevicePDEModel(MB, configuration.getModelParameters(), factory_block)
116 {
117  processParams ();
118 }
119 
120 //-----------------------------------------------------------------------------
121 // Function : Model::Model
122 // Purpose : destructor
123 // Special Notes :
124 // Scope : public
125 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
126 // Creation Date : 6/29/00
127 //-----------------------------------------------------------------------------
129 {
130  std::vector<Instance*>::iterator iter;
131  std::vector<Instance*>::iterator first = instanceContainer.begin();
132  std::vector<Instance*>::iterator last = instanceContainer.end();
133 
134  for (iter=first; iter!=last; ++iter)
135  {
136  delete (*iter);
137  }
138 
139 }
140 
141 //-----------------------------------------------------------------------------
142 // Function : Model::printOutInstances
143 // Purpose : debugging tool.
144 // Special Notes :
145 // Scope : public
146 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
147 // Creation Date : 6/29/00
148 //-----------------------------------------------------------------------------
149 std::ostream &Model::printOutInstances(std::ostream &os) const
150 {
151  std::vector<Instance*>::const_iterator iter;
152  std::vector<Instance*>::const_iterator first = instanceContainer.begin();
153  std::vector<Instance*>::const_iterator last = instanceContainer.end();
154 
155  int i;
156  os << std::endl;
157  os << " name model name Parameters" << std::endl;
158  for (i = 0, iter = first; iter != last; ++iter, ++i)
159  {
160  os << " " << i << ": " << (*iter)->getName() << " ";
161  os << getName();
162  //os << " C = " << (*iter)-> C;
163  //os << " IC = " << (*iter)->IC;
164  os << std::endl;
165  }
166  os << std::endl;
167 
168  return os;
169 }
170 
171 //-----------------------------------------------------------------------------
172 // Function : Model::forEachInstance
173 // Purpose :
174 // Special Notes :
175 // Scope : public
176 // Creator : David Baur
177 // Creation Date : 2/4/2014
178 //-----------------------------------------------------------------------------
179 /// Apply a device instance "op" to all instances associated with this
180 /// model
181 ///
182 /// @param[in] op Operator to apply to all instances.
183 ///
184 ///
185 void Model::forEachInstance(DeviceInstanceOp &op) const /* override */
186 {
187  for (std::vector<Instance *>::const_iterator it = instanceContainer.begin(); it != instanceContainer.end(); ++it)
188  op(*it);
189 }
190 
191 
192 } // namespace DiodePDE
193 } // namespace Device
194 } // namespace Xyce
Pure virtual class to augment a linear system.
bool processParams()
processParams
const std::string & getName() const
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
std::vector< Instance * > instanceContainer
virtual std::ostream & printOutInstances(std::ostream &os) const
bool processInstanceParams()
processInstanceParams
Class Configuration contains device configuration data.
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
ModelBlock represents a .MODEL line from the netlist.
Manages parameter binding for class C.
Definition: N_DEV_Pars.h:214
static void loadModelParameters(ParametricData< Model > &model_parameters)