Xyce  6.1
LOADTest.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // File : LOADTest.C
3 //
4 // Purpose : This function is the test driver for the Loader Services
5 // package.
6 //
7 // Special Notes :
8 //
9 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
10 //
11 // Creation Date : 5/27/00
12 //-----------------------------------------------------------------------------
13 
14 // ---------- Standard Includes ----------
15 #include <iostream>
16 #include <vector>
17 #include <list>
18 #include <string>
19 
20 // ---------- Xyce Includes ----------
21 #include <LOADTest.h>
22 #include <N_LOA_LoaderMgr.h>
23 
24 //-----------------------------------------------------------------------------
25 // Function : LOADTestor::LOADTestor
26 // Purpose : constructor
27 // Special Notes :
28 // Scope : public
29 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
30 // Creation Date : 5/27/00
31 //-----------------------------------------------------------------------------
33 {
34 
35 }
36 
37 //-----------------------------------------------------------------------------
38 // Function : LOADTestor::~LOADTestor
39 // Purpose : destructor
40 // Special Notes :
41 // Scope : public
42 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
43 // Creation Date : 5/27/00
44 //-----------------------------------------------------------------------------
46 {
47 
48 }
49 
50 //-----------------------------------------------------------------------------
51 // Function : LOADTestor::doAllocations
52 // Purpose :
53 // Special Notes :
54 // Scope : private
55 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
56 // Creation Date : 5/27/00
57 //-----------------------------------------------------------------------------
59 {
60  bool bsuccess = STATUS_SUCCESS;
61 
62  cout << endl;
63  cout << "Performing allocations" << endl;
64 
65  //ERH_Ptr_ = new N_ERH_ErrorMgr (); // Allocate Error handler
66  LOA_LoaderMgrPtr_ = new N_LOA_LoaderMgr (); // Allocate Loader manager
67  DEV_DeviceMgrPtr_ = N_DEV_DeviceMgr::factory(); // Allocate Device manager.
68 
69  //bsuccess = bsuccess && (ERH_Ptr_ != NULL);
70  bsuccess = bsuccess && (LOA_LoaderMgrPtr_ != NULL);
71  bsuccess = bsuccess && (DEV_DeviceMgrPtr_ != NULL);
72 
73  cout << "Done with allocations";
74  cout << endl;
75 
76  return bsuccess;
77 }
78 
79 //-----------------------------------------------------------------------------
80 // Function : LOADTestor::doRegistrations
81 // Purpose :
82 // Special Notes :
83 // Scope : private
84 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
85 // Creation Date : 5/27/00
86 //-----------------------------------------------------------------------------
88 {
89  bool bsuccess = STATUS_SUCCESS;
90 
91  cout << endl;
92  cout << "Performing registrations";
93  cout << endl;
94 
95  LOA_LoaderMgrPtr_->registerDeviceManager (DEV_DeviceMgrPtr_);
96 
97  cout << "Done with registrations";
98  cout << endl;
99 
100  return bsuccess;
101 }
102 
103 //-----------------------------------------------------------------------------
104 // Function : LOADTestor::doDeAllocations
105 // Purpose :
106 // Special Notes :
107 // Scope : private
108 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
109 // Creation Date : 5/27/00
110 //-----------------------------------------------------------------------------
112 {
113  bool bsuccess = STATUS_SUCCESS;
114 
115  cout << endl;
116  cout << "Performing de-allocations";
117  cout << endl;
118 
119  delete LOA_LoaderMgrPtr_;
120  delete DEV_DeviceMgrPtr_;
121  //delete ERH_Ptr_;
122 
123  cout << "Done with de-allocations";
124  cout << endl;
125 
126  return bsuccess;
127 }
128 
129 //-----------------------------------------------------------------------------
130 // Function : LOADTestor::doInitialization
131 // Purpose : Tells the loader manager to allocate one of the
132 // various loaders.
133 // Special Notes :
134 // Scope : private
135 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
136 // Creation Date : 5/27/00
137 //-----------------------------------------------------------------------------
139 {
140  bool bsuccess = STATUS_SUCCESS;
141 
142  cout << "Performing initializations" << endl;
143 
144  LOA_LoaderMgrPtr_->createLoader(0);
145 
146  cout << "Done Initializations" << endl;
147  cout << endl;
148 
149  return bsuccess;
150 }
151 
152 //-----------------------------------------------------------------------------
153 // Function : LOADTestor::doLoad
154 // Purpose : Tells the loader manager to perform a RHS and a Jacobian
155 // load.
156 // Special Notes :
157 // Scope : private
158 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
159 // Creation Date : 5/27/00
160 //-----------------------------------------------------------------------------
162 {
163  bool bsuccess = STATUS_SUCCESS;
164  bool btmp;
165 
166  cout << "Performing load tests:\n";
167 
168  btmp = LOA_LoaderMgrPtr_->loadJacobian (); bsuccess = bsuccess && btmp;
169  cout << "Done with Jacobian\n";
170  btmp = LOA_LoaderMgrPtr_->loadRHS (); bsuccess = bsuccess && btmp;
171  cout << "Done with RHS\n";
172 
173  cout << "done performing load tests:\n";
174 
175  return bsuccess;
176 }
177 
178 //-----------------------------------------------------------------------------
179 // Function : LOADTestor::runTests
180 // Purpose :
181 // Special Notes :
182 // Scope : public
183 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
184 // Creation Date : 5/27/00
185 //-----------------------------------------------------------------------------
186 bool LOADTestor::runTests (int iargs_tmp, char *cargs_tmp[])
187 {
188  bool bsuccess;
189  bool btmp;
190 
191  iargs = iargs_tmp; cargs = cargs_tmp;
192 
193  cout << endl;
194  cout << "Welcome to the Loader Services testing program";
195  cout << endl;
196 
197  bsuccess = doAllocations ();
198  btmp = doRegistrations (); bsuccess = bsuccess && btmp;
199  btmp = doInitialization (); bsuccess = bsuccess && btmp;
200  btmp = doLoad (); bsuccess = bsuccess && btmp;
201  btmp = doDeAllocations (); bsuccess = bsuccess && btmp;
202 
203  cout << endl;
204  cout << "Done testing the Loader Services";
205  cout << endl;
206  cout << endl;
207 
208  return bsuccess;
209 }
210 
211 //-----------------------------------------------------------------------------
212 // Function : main
213 // Purpose :
214 // Special Notes :
215 // Scope : public
216 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
217 // Creation Date : 5/27/00
218 //-----------------------------------------------------------------------------
219 int main (int iargs, char *cargs[])
220 {
221  LOADTestor *LOADPtr = new LOADTestor ();
222 
223  bool bsuccess = LOADPtr->runTests (iargs, cargs);
224 
225  delete LOADPtr;
226 
227  return 0;
228 }
229 
bool doAllocations()
Definition: LOADTest.C:58
char ** cargs
Definition: LOADTest.h:71
N_DEV_DeviceMgr * DEV_DeviceMgrPtr_
Definition: LOADTest.h:66
bool doDeAllocations()
Definition: LOADTest.C:111
int main(int iargs, char *cargs[])
Definition: LOADTest.C:219
bool runTests(int iargs, char *cargs[])
Definition: LOADTest.C:186
bool doRegistrations()
Definition: LOADTest.C:87
N_LOA_LoaderMgr * LOA_LoaderMgrPtr_
Definition: LOADTest.h:67
bool doLoad()
Definition: LOADTest.C:161
int iargs
Definition: LOADTest.h:70
~LOADTestor()
Definition: LOADTest.C:45
LOADTestor()
Definition: LOADTest.C:32
bool doInitialization()
Definition: LOADTest.C:138