Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-2014 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.27.2.1 $
41 //
42 // Revision Date : $Date: 2014/03/06 23:33:44 $
43 //
44 // Current Owner : $Author: tvrusso $
45 //-------------------------------------------------------------------------
46 
47 #include <Xyce_config.h>
48 
49 #include <iostream>
50 
51 #ifdef HAVE_CMATH
52 #include <cmath>
53 #else
54 #include <math.h>
55 #endif
56 
57 #include <N_DEV_DeviceOptions.h>
58 #include <N_DEV_DiodePDE.h>
59 #include <N_DEV_ExternData.h>
60 #include <N_DEV_MatrixLoadData.h>
61 #include <N_DEV_SolverState.h>
62 #include <N_UTL_Misc.h>
63 
64 namespace Xyce {
65 namespace Device {
66 
67 namespace DiodePDE {
68 
70 {}
71 
72 //-----------------------------------------------------------------------------
73 // Function : Model::processParams
74 // Purpose :
75 // Special Notes :
76 // Scope : public
77 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
78 // Creation Date : 6/03/02
79 //-----------------------------------------------------------------------------
81 {
82  return true;
83 }
84 
85 //----------------------------------------------------------------------------
86 // Function : Model::processInstanceParams
87 // Purpose :
88 // Special Notes :
89 // Scope : public
90 // Creator : Dave Shirely, PSSI
91 // Creation Date : 03/23/06
92 //----------------------------------------------------------------------------
94 {
95 
96  std::vector<Instance*>::iterator iter;
97  std::vector<Instance*>::iterator first = instanceContainer.begin();
98  std::vector<Instance*>::iterator last = instanceContainer.end();
99 
100  for (iter=first; iter!=last; ++iter)
101  {
102  (*iter)->processParams();
103  }
104 
105  return true;
106 }
107 
108 //-----------------------------------------------------------------------------
109 // Function : Model::Model
110 // Purpose : model block constructor
111 // Special Notes :
112 // Scope : public
113 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
114 // Creation Date : 6/29/00
115 //-----------------------------------------------------------------------------
116 
118  const Configuration & configuration,
119  const ModelBlock & MB,
120  const FactoryBlock & factory_block)
121  : DevicePDEModel(MB, configuration.getModelParameters(), factory_block)
122 {
123  processParams ();
124 }
125 
126 //-----------------------------------------------------------------------------
127 // Function : Model::Model
128 // Purpose : destructor
129 // Special Notes :
130 // Scope : public
131 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
132 // Creation Date : 6/29/00
133 //-----------------------------------------------------------------------------
135 {
136  std::vector<Instance*>::iterator iter;
137  std::vector<Instance*>::iterator first = instanceContainer.begin();
138  std::vector<Instance*>::iterator last = instanceContainer.end();
139 
140  for (iter=first; iter!=last; ++iter)
141  {
142  delete (*iter);
143  }
144 
145 }
146 
147 //-----------------------------------------------------------------------------
148 // Function : Model::printOutInstances
149 // Purpose : debugging tool.
150 // Special Notes :
151 // Scope : public
152 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
153 // Creation Date : 6/29/00
154 //-----------------------------------------------------------------------------
155 std::ostream &Model::printOutInstances(std::ostream &os) const
156 {
157  std::vector<Instance*>::const_iterator iter;
158  std::vector<Instance*>::const_iterator first = instanceContainer.begin();
159  std::vector<Instance*>::const_iterator last = instanceContainer.end();
160 
161  int i;
162  os << std::endl;
163  os << " name model name Parameters" << std::endl;
164  for (i = 0, iter = first; iter != last; ++iter, ++i)
165  {
166  os << " " << i << ": " << (*iter)->getName() << " ";
167  os << getName();
168  //os << " C = " << (*iter)-> C;
169  //os << " IC = " << (*iter)->IC;
170  os << std::endl;
171  }
172  os << std::endl;
173 
174  return os;
175 }
176 
177 //-----------------------------------------------------------------------------
178 // Function : Model::forEachInstance
179 // Purpose :
180 // Special Notes :
181 // Scope : public
182 // Creator : David Baur
183 // Creation Date : 2/4/2014
184 //-----------------------------------------------------------------------------
185 /// Apply a device instance "op" to all instances associated with this
186 /// model
187 ///
188 /// @param[in] op Operator to apply to all instances.
189 ///
190 ///
191 void Model::forEachInstance(DeviceInstanceOp &op) const /* override */
192 {
193  for (std::vector<Instance *>::const_iterator it = instanceContainer.begin(); it != instanceContainer.end(); ++it)
194  op(*it);
195 }
196 
197 
198 } // namespace DiodePDE
199 } // namespace Device
200 } // namespace Xyce