Xyce  6.1
N_DEV_MatrixLoadData.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_MatrixLoadData.C,v $
27 //
28 // Purpose :
29 //
30 // Special Notes :
31 //
32 // Creator : Eric R. Keiter, SNL
33 //
34 // Creation Date : 4/30/02
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.19.6.1 $
40 //
41 // Revision Date : $Date: 2015/04/02 18:20:09 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-------------------------------------------------------------------------
45 
46 #include <Xyce_config.h>
47 
48 
49 // ---------- Standard Includes ----------
50 
51 // ---------- Xyce Includes ----------
52 #include <N_DEV_MatrixLoadData.h>
53 #include <N_DEV_DeviceInstance.h>
54 
55 namespace Xyce {
56 namespace Device {
57 
58 
59 // --------- Other Includes -----------
60 
61 // --------- Helper Classes ------------
62 
63 
64 //-----------------------------------------------------------------------------
65 // Function : MatrixLoadData::MatrixLoadData
66 // Purpose : Constructor
67 // Special Notes :
68 // Scope : public
69 // Creator : Eric R. Keiter, SNL
70 // Creation Date : 4/30/02
71 //-----------------------------------------------------------------------------
73  isize(0),
74  isizeNumJac(0)
75 {
76 
77 }
78 
79 //-----------------------------------------------------------------------------
80 // Function : MatrixLoadData::MatrixLoadData
81 // Purpose : Copy Constructor
82 // Special Notes :
83 // Scope : public
84 // Creator : Eric R. Keiter, SNL
85 // Creation Date : 4/30/02
86 //-----------------------------------------------------------------------------
88  :
89  isize (right.isize),
90  isizeNumJac (right.isizeNumJac),
91  cols (right.cols),
92  vals (right.vals) ,
93  Qvals (right.Qvals) ,
94  val_local (right.val_local),
95  Qval_local (right.Qval_local),
96  col_local (right.col_local),
97  row_local (right.row_local),
98  internalFlag (right.internalFlag),
99 
100  numJac(right.numJac),
101  saveJac(right.saveJac),
102  devJac(right.devJac),
103  diffJac(right.diffJac),
104  relJac(right.relJac),
105 
106  numJacQ(right.numJacQ),
107  saveJacQ(right.saveJacQ),
108  devJacQ(right.devJacQ),
109  diffJacQ(right.diffJacQ),
110  relJacQ(right.relJacQ),
111 
112  status(right.status),
113  stencil(right.stencil),
114 
115  statusQ(right.statusQ),
116 
117  saveRHS(right.saveRHS),
118  pertRHS(right.pertRHS),
119  origRHS(right.origRHS),
120 
121  saveQ(right.saveQ),
122  pertQ(right.pertQ),
123  origQ(right.origQ),
124 
125  saveSoln(right.saveSoln),
126  pertSoln(right.pertSoln),
127  saveCurrSoln(right.saveCurrSoln),
128  saveLastState(right.saveLastState),
129  saveCurrState(right.saveCurrState),
130  saveNextState(right.saveNextState),
131  saveStateDerivs(right.saveStateDerivs)
132 {
133 
134 }
135 
136 //-----------------------------------------------------------------------------
137 // Function : MatrixLoadData::~MatrixLoadData
138 // Purpose : Destructor
139 // Special Notes :
140 // Scope : public
141 // Creator : Eric R. Keiter, SNL
142 // Creation Date : 4/30/02
143 //-----------------------------------------------------------------------------
145 {
146 
147 }
148 
149 //-----------------------------------------------------------------------------
150 // Function : MatrixLoadData::initializeAll
151 // Purpose : this function initializes the data structures,
152 // if neccessary.
153 // Special Notes :
154 // Scope : public
155 // Creator : Eric R. Keiter, SNL
156 // Creation Date : 5/02/02
157 //-----------------------------------------------------------------------------
158 bool MatrixLoadData::initializeAll (int isizeTmp)
159 {
160 
161 
162  if (vals.size() < isizeTmp)
163  {
164  isize = isizeTmp;
165  vals.resize (isize,0.0);
166  Qvals.resize (isize,0.0);
167  cols.resize (isize,-1);
168  }
169 
170  if (row_local.size() < isizeTmp)
171  {
172  isizeNumJac = isizeTmp;
173  row_local.resize(isizeNumJac);
174  internalFlag.resize(isizeNumJac);
175 
176  val_local.resize(isizeNumJac);
177  Qval_local.resize(isizeNumJac);
178  col_local.resize(isizeNumJac);
179  for (int i=0;i<isizeNumJac;++i)
180  {
181  val_local[i].val.resize(isizeNumJac,0.0);
182  Qval_local[i].val.resize(isizeNumJac,0.0);
183  col_local[i].col.resize(isizeNumJac,-1);
184  }
185  }
186 
187  return true;
188 }
189 
190 
191 //-----------------------------------------------------------------------------
192 // Function : MatrixLoadData::resizeTestJacSolData
193 // Purpose :
194 // Special Notes :
195 // Scope : public
196 // Creator : Eric R. Keiter, SNL
197 // Creation Date : 12/14/06
198 //-----------------------------------------------------------------------------
200 {
201  numJac.resize(size);
202  saveJac.resize(size);
203  devJac.resize(size);
204  diffJac.resize(size);
205  relJac.resize(size);
206  status.resize(size);
207  stencil.resize(size);
208 
209  // Allocate matrix structures
210  for (int i=0 ; i<size ; ++i)
211  {
212  saveJac[i].resize(size,0.0);
213  numJac[i].resize(size,0.0);
214  devJac[i].resize(size,0.0);
215  diffJac[i].resize(size,0.0);
216  relJac[i].resize(size,0.0);
217  status[i].resize(size,0);
218  stencil[i].resize(size,0);
219  }
220 
221  saveRHS.resize(size,0.0);
222  pertRHS.resize(size,0.0);
223  origRHS.resize(size,0.0);
224  saveSoln.resize(size,0.0);
225  pertSoln.resize(size,0.0);
226  saveCurrSoln.resize(size,0.0);
227 }
228 
229 //-----------------------------------------------------------------------------
230 // Function : MatrixLoadData::resizeTestJacQData
231 // Purpose :
232 // Special Notes :
233 // Scope : public
234 // Creator : Eric R. Keiter, SNL
235 // Creation Date : 12/14/06
236 //-----------------------------------------------------------------------------
238 {
239  numJacQ.resize(size);
240  saveJacQ.resize(size);
241  devJacQ.resize(size);
242  diffJacQ.resize(size);
243  relJacQ.resize(size);
244  statusQ.resize(size);
245 
246  // Allocate matrix structures
247  for (int i=0 ; i<size ; ++i)
248  {
249  saveJacQ[i].resize(size,0.0);
250  numJacQ[i].resize(size,0.0);
251  devJacQ[i].resize(size,0.0);
252  diffJacQ[i].resize(size,0.0);
253  relJacQ[i].resize(size,0.0);
254  statusQ[i].resize(size,0);
255  }
256 
257  saveQ.resize(size,0.0);
258  pertQ.resize(size,0.0);
259  origQ.resize(size,0.0);
260 }
261 
262 //-----------------------------------------------------------------------------
263 // Function : MatrixLoadData::resizeTestJacStateData
264 // Purpose :
265 // Special Notes :
266 // Scope : public
267 // Creator : Eric R. Keiter, SNL
268 // Creation Date : 12/14/06
269 //-----------------------------------------------------------------------------
271 {
272  saveLastState.resize(size,0.0);
273  saveCurrState.resize(size,0.0);
274  saveNextState.resize(size,0.0);
275  saveStateDerivs.resize(size,0.0);
276 }
277 
278 } // namespace Device
279 } // namespace Xyce
std::vector< double > saveStateDerivs
std::vector< valData > Qval_local
Pure virtual class to augment a linear system.
std::vector< double > saveLastState
std::vector< std::vector< double > > numJac
std::vector< std::vector< double > > devJac
std::vector< std::vector< int > > statusQ
std::vector< std::vector< double > > diffJacQ
std::vector< std::vector< int > > status
std::vector< colData > col_local
std::vector< std::vector< double > > relJacQ
std::vector< std::vector< double > > saveJac
std::vector< double > saveCurrSoln
std::vector< double > saveCurrState
std::vector< std::vector< double > > saveJacQ
bool initializeAll(int isizeTmp=100)
std::vector< std::vector< double > > devJacQ
std::vector< std::vector< int > > stencil
std::vector< std::vector< double > > relJac
std::vector< std::vector< double > > numJacQ
std::vector< double > saveNextState
std::vector< valData > val_local
std::vector< std::vector< double > > diffJac