Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_DEV_DeviceInterface.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 // Filename : $RCSfile: N_DEV_DeviceInterface.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.171.2.1 $
40 //
41 // Revision Date : $Date: 2014/08/25 20:12:49 $
42 //
43 // Current Owner : $Author: dgbaur $
44 //-------------------------------------------------------------------------
45 
46 #include <Xyce_config.h>
47 
48 #include <algorithm>
49 
50 #include <N_DEV_DeviceInterface.h>
51 #include <N_DEV_DeviceMgr.h>
52 #include <N_ERH_ErrorMgr.h>
53 #include <N_UTL_BreakPoint.h>
54 #include <N_TIA_TwoLevelError.h>
55 
56 namespace Xyce {
57 namespace Device {
58 
59 //-----------------------------------------------------------------------------
60 // Function : DeviceInterface::factory
61 // Purpose : factory function
62 // Special Notes :
63 // Scope : public
64 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
65 // Creation Date : 03/05/02
66 //-----------------------------------------------------------------------------
68 {
69  DeviceInterface * DI_ptr = new DeviceInterface(cp);
70  return DI_ptr;
71 }
72 
73 //-----------------------------------------------------------------------------
74 // Function : DeviceInterface::DeviceInterface
75 // Purpose : constructor
76 // Special Notes :
77 // Scope : private
78 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
79 // Creation Date : 03/05/02
80 //-----------------------------------------------------------------------------
82 {
84 }
85 
86 //-----------------------------------------------------------------------------
87 // Function : DeviceInterface::~DeviceInterface
88 // Purpose : destructor
89 // Special Notes :
90 // Scope : public
91 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
92 // Creation Date : 03/05/02
93 //-----------------------------------------------------------------------------
95 {
96  delete devMgrPtr_;
97 }
98 
99 //-----------------------------------------------------------------------------
100 // Function : DeviceInterface::registerLinearSystem
101 // Purpose :
102 // Special Notes :
103 // Scope : public
104 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
105 // Creation Date : 03/05/02
106 //-----------------------------------------------------------------------------
107 bool DeviceInterface::registerLinearSystem (N_LAS_System * tmp_system_ptr)
108 {
109  return devMgrPtr_->registerLinearSystem(tmp_system_ptr);
110 }
111 
112 //-----------------------------------------------------------------------------
113 // Function : DeviceInterface::registerAnalysisManager
114 // Purpose :
115 // Special Notes :
116 // Scope : public
117 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
118 // Creation Date : 03/05/02
119 //-----------------------------------------------------------------------------
121 {
122  return devMgrPtr_->registerAnalysisManager (tmp_anaIntPtr);
123 }
124 
125 //-----------------------------------------------------------------------------
126 // Function : DeviceInterface::registerOutputManager
127 // Purpose :
128 // Special Notes :
129 // Scope : public
130 // Creator : Dave Shirley, PSSI
131 // Creation Date : 08/15/06
132 //-----------------------------------------------------------------------------
133 bool DeviceInterface::registerOutputMgr(N_IO_OutputMgr * tmp_outputMgrPtr)
134 {
135  return devMgrPtr_->registerOutputMgr(tmp_outputMgrPtr);
136 }
137 
138 //-----------------------------------------------------------------------------
139 // Function : DeviceInterface::registerOutputManager
140 // Purpose :
141 // Special Notes :
142 // Scope : public
143 // Creator : Dave Shirley, PSSI
144 // Creation Date : 08/15/06
145 //-----------------------------------------------------------------------------
146 bool DeviceInterface::registerMeasureMgr(N_IO_MeasureMgr * measure_manager)
147 {
148  return devMgrPtr_->registerMeasureMgr(measure_manager);
149 }
150 
151 //-----------------------------------------------------------------------------
152 // Function : DeviceInterface::registerParallelMgr
153 // Purpose :
154 // Special Notes :
155 // Scope : public
156 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
157 // Creation Date : 6/29/01
158 //-----------------------------------------------------------------------------
159 bool DeviceInterface::registerParallelMgr (N_PDS_Manager * tmp_pdsMgrPtr )
160 {
161  return devMgrPtr_->registerParallelMgr(tmp_pdsMgrPtr);
162 }
163 
164 //-----------------------------------------------------------------------------
165 // Function : DeviceInterface::registerNonlinearSolver
166 // Purpose :
167 // Special Notes :
168 // Scope : public
169 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
170 // Creation Date : 03/05/02
171 //-----------------------------------------------------------------------------
173 {
174  return devMgrPtr_->registerNonlinearSolver(tmp_nlsMgrPtr);
175 }
176 
177 //-----------------------------------------------------------------------------
178 // Function : DeviceInterface::registerPkgOptionsMgr
179 // Purpose :
180 // Special Notes :
181 // Scope : public
182 // Creator : Richard Schiek, Electrical and Mems Modeling
183 // Creation Date : 10/20/2008
184 //-----------------------------------------------------------------------------
185 bool DeviceInterface::registerPkgOptionsMgr( N_IO_PkgOptionsMgr *pkgOptPtr )
186 {
187  return devMgrPtr_->registerPkgOptionsMgr(pkgOptPtr);
188 }
189 
190 //-----------------------------------------------------------------------------
191 // Function : DeviceInterface::getFastSourcePeriod
192 // Purpose :
193 // Special Notes :
194 // Scope : public
195 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
196 // Creation Date : 03/27/04
197 //-----------------------------------------------------------------------------
198 std::vector<double> DeviceInterface::getFastSourcePeriod (std::vector<std::string>& sourceNames)
199 {
200  return devMgrPtr_->getFastSourcePeriod (sourceNames);
201 }
202 
203 //-----------------------------------------------------------------------------
204 // Function : DeviceInterface::registerFastSources
205 // Purpose :
206 // Special Notes :
207 // Scope : public
208 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
209 // Creation Date : 03/27/04
210 //-----------------------------------------------------------------------------
211 std::vector<double> DeviceInterface::registerFastSources(std::vector<std::string>& sourceNames)
212 {
213  return devMgrPtr_->registerFastSources (sourceNames);
214 }
215 
216 //-----------------------------------------------------------------------------
217 // Function : DeviceInterface::deRegisterFastSources
218 // Purpose :
219 // Special Notes :
220 // Scope : public
221 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
222 // Creation Date : 06/12/2013
223 //-----------------------------------------------------------------------------
224 void DeviceInterface::deRegisterFastSources(std::vector<std::string>& sourceNames)
225 {
226  return devMgrPtr_->deRegisterFastSources (sourceNames);
227 }
228 
229 //-----------------------------------------------------------------------------
230 // Function : N_DEV_DeviceInterface::registerLeadCurrentRequests
231 // Purpose : this function is called from the output manager to inform the
232 // device package of the devices for which lead currents have
233 // been requested. The device manager will take care of doing
234 // isolated F and Q loads for these devices so the lead currents
235 // can be calculated
236 // Special Notes :
237 // Scope : public
238 // Creator : Richard Schiek, SNL, Electrical Systems Modeling
239 // Creation Date : 03/20/13
240 //-----------------------------------------------------------------------------
241 bool DeviceInterface::setLeadCurrentRequests( const std::set<std::string> & deviceNames )
242 {
243  return devMgrPtr_->setLeadCurrentRequests( deviceNames );
244 }
245 
246 
247 //-----------------------------------------------------------------------------
248 // Function : N_DEV_DeviceInterface::deactivateSlowSources
249 // Purpose :
250 // Special Notes :
251 // Scope : public
252 // Creator : Richard Schiek, SNL, Parallel Computational Sciences
253 // Creation Date : 03/22/07
254 //-----------------------------------------------------------------------------
256 {
258 }
259 
260 
261 //-----------------------------------------------------------------------------
262 // Function : DeviceInterface::activateSlowSources
263 // Purpose :
264 // Special Notes :
265 // Scope : public
266 // Creator : Richard Schiek, SNL, Parallel Computational Sciences
267 // Creation Date : 03/22/07
268 //-----------------------------------------------------------------------------
270 {
272 }
273 
274 //-----------------------------------------------------------------------------
275 // Function : DeviceInterface::setMPDEFlag
276 // Purpose :
277 // Special Notes :
278 // Scope : public
279 // Creator : Richard Schiek, SNL, Parallel Computational Sciences
280 // Creation Date : 07/21/08
281 //-----------------------------------------------------------------------------
282 void DeviceInterface::setMPDEFlag( bool flagVal )
283 {
284  devMgrPtr_->setMPDEFlag( flagVal );
285 }
286 
287 //-----------------------------------------------------------------------------
288 // Function : DeviceInterface::setBlockAnalysisFlag
289 // Purpose :
290 // Special Notes :
291 // Scope : public
292 // Creator : Richard Schiek, SNL, Parallel Computational Sciences
293 // Creation Date : 07/21/08
294 //-----------------------------------------------------------------------------
296 {
297  devMgrPtr_->setBlockAnalysisFlag( flagVal );
298 }
299 
300 //-----------------------------------------------------------------------------
301 // Function : DeviceInterface::setFastTime
302 // Purpose :
303 // Special Notes :
304 // Scope : public
305 // Creator : Richard Schiek, SNL, Parallel Computational Sciences
306 // Creation Date : 07/21/08
307 //-----------------------------------------------------------------------------
308 void DeviceInterface::setFastTime( double timeVal )
309 {
310  devMgrPtr_->setFastTime( timeVal );
311 }
312 
313 //-----------------------------------------------------------------------------
314 // Function : DeviceInterface::initializeAll
315 // Purpose : This function, via the LAS system class, sets up
316 // the pointers to the various linear algebra entities.
317 // Special Notes :
318 // Scope : protected
319 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
320 // Creation Date : 6/12/00
321 //-----------------------------------------------------------------------------
323 {
324  return devMgrPtr_->initializeAll();
325 }
326 
327 //-----------------------------------------------------------------------------
328 // Function : DeviceInterface::addDeviceModel
329 // Purpose :
330 // Special Notes :
331 // Scope : public
332 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
333 // Creation Date : 03/05/02
334 //-----------------------------------------------------------------------------
335 bool DeviceInterface::addDeviceModel (const ModelBlock & model_block)
336 {
337  return devMgrPtr_->addDeviceModel(model_block);
338 }
339 
340 
341 //-----------------------------------------------------------------------------
342 // Function : DeviceInterface::verifyDeviceInstance
343 // Purpose : This funciton verifies a device instance prior to instantiating.
344 // Theoretically, we could do this in addDeviceInstance() and
345 // not make a device if it fails some verification criteria (a
346 // resistor with zero resistance is the primary case here). However,
347 // later unlinking of redundant devices that are connected to just
348 // one node is difficut after addDeviceInstance() is called because
349 // the device instance pointer can be placed in many other containers
350 // It could be done, but this is a simpler first step to having the
351 // device manager be in charge of device verification -- rather
352 // than have it in toplogy or io.
353 //
354 // Special Notes : return true if this device is ok to instantiate, false otherwise
355 // Scope : public
356 // Creator : Richard Schiek, Electrical and Microsystems Modeling
357 // Creation Date : 2/18/2010
358 //-----------------------------------------------------------------------------
360 {
361  return devMgrPtr_->verifyDeviceInstance( instance_block );
362 }
363 
364 //-----------------------------------------------------------------------------
365 // Function : DeviceInterface::addDeviceInstance
366 // Purpose : addDeviceInstance will create a new instance of the
367 // designated device type. This version of the function
368 // accepts a parameter list as one of the arguments,
369 // so it is assumed that a parameter instance will
370 // also have to be allocated for it.
371 //
372 // Special Notes :
373 // Scope : public
374 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
375 // Creation Date : 03/05/02
376 //-----------------------------------------------------------------------------
378 {
379  return devMgrPtr_->addDeviceInstance(instance_block);
380 }
381 
382 //-----------------------------------------------------------------------------
383 // Function : DeviceInterface::deleteDeviceInstance
384 // Purpose :
385 // Special Notes :
386 // Scope : public
387 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
388 // Creation Date : 03/05/02
389 //-----------------------------------------------------------------------------
390 bool DeviceInterface::deleteDeviceInstance (const std::string & name)
391 {
392  return devMgrPtr_->deleteDeviceInstance(name);
393 }
394 
395 //----------------------------------------------------------------------------
396 // Function : DeviceInterface::getDeviceCountMap
397 // Purpose :
398 // Special Notes :
399 // Scope : public
400 // Creator : Eric R. Keiter, SNL.
401 // Creation Date : 05/07/2010
402 //----------------------------------------------------------------------------
403 const std::map<std::string,int> & DeviceInterface::getDeviceCountMap()
404 {
405  return devMgrPtr_->getDeviceCountMap();
406 }
407 
408 void DeviceInterface::addDeviceToCount(const std::string & device_name, int num_devs)
409 {
410  devMgrPtr_->addDeviceToCount(device_name, num_devs);
411 }
412 
413 void DeviceInterface::addDevicesToCount(const std::map<std::string,int> & device_map)
414 {
415  devMgrPtr_->addDevicesToCount(device_map);
416 }
417 
418 //-----------------------------------------------------------------------------
419 // Function : DeviceInterface::printOutLists
420 // Purpose : This function will send output to stdout of all the
421 // allocated model and instance lists.
422 // Special Notes :
423 // Scope : public
424 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
425 // Creation Date : 03/05/02
426 //-----------------------------------------------------------------------------
427 // void DeviceInterface::printOutLists()
428 // {
429 // devMgrPtr_->printOutLists();
430 // }
431 
432 //-----------------------------------------------------------------------------
433 // Function : DeviceInterface::loadDeviceMask
434 // Purpose : This function loads the mask elements for all
435 // of the circuit devices.
436 // Special Notes :
437 // Scope : public
438 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
439 // Creation Date : 01/19/07
440 //-----------------------------------------------------------------------------
442 {
443  return devMgrPtr_->loadDeviceMask();
444 }
445 
446 //-----------------------------------------------------------------------------
447 // Function : DeviceInterface::setInitialGuess
448 // Purpose :
449 // Special Notes :
450 // Scope : public
451 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
452 // Creation Date : 05/02/03
453 //-----------------------------------------------------------------------------
455  (N_LAS_Vector * solVectorPtr)
456 {
457  return devMgrPtr_->setInitialGuess(solVectorPtr);
458 }
459 
460 
461 //-----------------------------------------------------------------------------
462 // Function : DeviceInterface::getAnalyticSensitivities
463 // Purpose :
464 // Special Notes :
465 // Scope : public
466 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
467 // Creation Date : 05/30/2014
468 //-----------------------------------------------------------------------------
470  (std::string & name,
471  std::vector<double> & dfdpVec,
472  std::vector<double> & dqdpVec,
473  std::vector<double> & dbdpVec,
474  std::vector<int> & FindicesVec,
475  std::vector<int> & QindicesVec,
476  std::vector<int> & BindicesVec)
477 {
478  return devMgrPtr_->getAnalyticSensitivities
479  (name, dfdpVec, dqdpVec, dbdpVec,
480  FindicesVec, QindicesVec, BindicesVec);
481 }
482 
483 //-----------------------------------------------------------------------------
484 // Function : DeviceInterface::analyticSensitivitiesAvailable
485 // Purpose :
486 // Special Notes :
487 // Scope : public
488 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
489 // Creation Date : 05/30/2014
490 //-----------------------------------------------------------------------------
492 {
494 }
495 
496 //-----------------------------------------------------------------------------
497 // Function : DeviceInterface::setParam
498 // Purpose :
499 // Special Notes :
500 // Scope : public
501 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
502 // Creation Date : 05/02/03
503 //-----------------------------------------------------------------------------
504 bool DeviceInterface::setParam(std::string & name, double val)
505 {
506  return devMgrPtr_->setParam (name,val);
507 }
508 
509 //-----------------------------------------------------------------------------
510 // Function : DeviceInterface::getParam
511 // Purpose :
512 // Special Notes :
513 // Scope : public
514 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
515 // Creation Date : 05/02/03
516 //-----------------------------------------------------------------------------
517 double DeviceInterface::getParamAndReduce(const std::string & name)
518 {
519  return devMgrPtr_->getParamAndReduce(name);
520 }
521 
522 //-----------------------------------------------------------------------------
523 // Function : DeviceInterface::getParam
524 // Purpose :
525 // Special Notes :
526 // Scope : public
527 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
528 // Creation Date : 05/02/03
529 //-----------------------------------------------------------------------------
530 bool DeviceInterface::getParamAndReduce(const std::string & name, double & val)
531 {
532  return devMgrPtr_->getParamAndReduce(name, val);
533 }
534 
535 bool DeviceInterface::findParam(const std::string & name) const
536 {
537  return devMgrPtr_->findParam (name);
538 }
539 
540 double DeviceInterface::getParamNoReduce(const std::string &name) const
541 {
542  return devMgrPtr_->getParamNoReduce(name);
543 }
544 
545 EntityTypeId DeviceInterface::getModelGroup(const std::string &model_type_name)
546 {
547  return devMgrPtr_->getModelGroup(model_type_name);
548 }
549 
550 DeviceEntity * DeviceInterface::getDeviceEntity(const std::string & full_param_name) const
551 {
552  return devMgrPtr_->getDeviceEntity(full_param_name);
553 }
554 
555 
556 //-----------------------------------------------------------------------------
557 // Function : DeviceInterface::updateSources
558 // Purpose : This function function updates sources for the present
559 // time step.
560 // Special Notes :
561 // Scope : public
562 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
563 // Creation Date : 03/05/02
564 //-----------------------------------------------------------------------------
566 {
567  return devMgrPtr_->updateSources ();
568 }
569 
570 //-----------------------------------------------------------------------------
571 // Function : DeviceInterface::setICs
572 // Purpose : This function function sets initial conditions for devices
573 // Special Notes :
574 // Scope : public
575 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
576 // Creation Date : 03/05/02
577 //-----------------------------------------------------------------------------
579  N_LAS_Vector * tmpSolVectorPtr,
580  N_LAS_Vector * tmpCurrSolVectorPtr,
581  N_LAS_Vector * tmpLastSolVectorPtr,
582  N_LAS_Vector * tmpStaVectorPtr,
583  N_LAS_Vector * tmpCurrStaVectorPtr,
584  N_LAS_Vector * tmpLastStaVectorPtr,
585  N_LAS_Vector * tmpStaDerivVectorPtr,
586  N_LAS_Vector * tmpStoVectorPtr,
587  N_LAS_Vector * tmpCurrStoVectorPtr,
588  N_LAS_Vector * tmpLastStoVectorPtr,
589  N_LAS_Vector * tmpQVectorPtr,
590  N_LAS_Vector * tmpFVectorPtr,
591  N_LAS_Vector * tmpBVectorPtr,
592  N_LAS_Vector * tmpdFdxdVpVectorPtr,
593  N_LAS_Vector * tmpdQdxdVpVectorPtr)
594 {
595  return devMgrPtr_->setICs( tmpSolVectorPtr,
596  tmpCurrSolVectorPtr,
597  tmpLastSolVectorPtr,
598  tmpStaVectorPtr,
599  tmpCurrStaVectorPtr,
600  tmpLastStaVectorPtr,
601  tmpStaDerivVectorPtr,
602  tmpStoVectorPtr,
603  tmpCurrStoVectorPtr,
604  tmpLastStoVectorPtr,
605  tmpQVectorPtr,
606  tmpFVectorPtr,
607  tmpBVectorPtr,
608  tmpdFdxdVpVectorPtr,
609  tmpdQdxdVpVectorPtr );
610 }
611 
612 //-----------------------------------------------------------------------------
613 // Function : DeviceInterface::getLinearSystemFlag
614 // Purpose :
615 // Special Notes :
616 // Scope : public
617 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
618 // Creation Date : 03/05/02
619 //-----------------------------------------------------------------------------
621 {
622  return devMgrPtr_->getLinearSystemFlag ();
623 }
624 
625 //-----------------------------------------------------------------------------
626 // Function : DeviceInterface::getVoltageLimterFlag
627 // Purpose :
628 // Special Notes :
629 // Scope : public
630 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
631 // Creation Date : 03/11/04
632 //-----------------------------------------------------------------------------
634 {
636 }
637 
638 //-----------------------------------------------------------------------------
639 // Function : DeviceInterface::getPDESystemFlag
640 // Purpose :
641 // Special Notes :
642 // Scope : public
643 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
644 // Creation Date : 03/05/02
645 //-----------------------------------------------------------------------------
647 {
648  return devMgrPtr_->getPDESystemFlag ();
649 }
650 
651 //-----------------------------------------------------------------------------
652 // Function : DeviceInterface::output
653 // Purpose :
654 // Special Notes :
655 // Scope : public
656 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
657 // Creation Date : 03/05/02
658 //-----------------------------------------------------------------------------
660 {
661  return devMgrPtr_->output ();
662 }
663 
664 //-----------------------------------------------------------------------------
665 // Function : DeviceInterface::finishOutput
666 // Purpose :
667 // Special Notes :
668 // Scope : public
669 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
670 // Creation Date : 06/19/04
671 //-----------------------------------------------------------------------------
673 {
674  return devMgrPtr_->finishOutput ();
675 }
676 
677 //-----------------------------------------------------------------------------
678 // Function : DeviceInterface:: dotOpOutput
679 // Purpose :
680 // Special Notes :
681 // Scope : public
682 // Creator : Eric R. Keiter, SNL
683 // Creation Date : 5/3/12
684 //-----------------------------------------------------------------------------
686 {
687  return devMgrPtr_->dotOpOutput ();
688 }
689 
690 //-----------------------------------------------------------------------------
691 // Function : DeviceInterface::setGlobalFlags
692 // Purpose :
693 // Special Notes :
694 // Scope : public
695 // Creator : Eric R. Keiter, SNL
696 // Creation Date : 11/2/12
697 //-----------------------------------------------------------------------------
699 {
700  return devMgrPtr_->setGlobalFlags ();
701 }
702 
703 //-----------------------------------------------------------------------------
704 // Function : DeviceInterface::getBreakPoints
705 // Purpose :
706 // Special Notes :
707 // Scope : public
708 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
709 // Creation Date : 03/05/02
710 //-----------------------------------------------------------------------------
711 bool DeviceInterface::getBreakPoints ( std::vector<N_UTL_BreakPoint> & breakPointTimes )
712 {
713 
714  return devMgrPtr_->getBreakPoints (breakPointTimes);
715 }
716 
717 //-----------------------------------------------------------------------------
718 // Function : DeviceInterface::getMaxTimeStepSize
719 // Purpose :
720 // Special Notes :
721 // Scope : public
722 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
723 // Creation Date : 03/05/02
724 //-----------------------------------------------------------------------------
726 {
727  return devMgrPtr_->getMaxTimeStepSize ();
728 }
729 
730 
731 //-----------------------------------------------------------------------------
732 // Function : DeviceInterface::registerOptions
733 // Purpose :
734 // Special Notes :
735 // Scope : public
736 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
737 // Creation Date : 03/05/02
738 //-----------------------------------------------------------------------------
739 bool DeviceInterface::registerOptions(const Util::OptionBlock & OB)
740 
741 {
742  return devMgrPtr_->registerOptions(OB);
743 }
744 
745 //-----------------------------------------------------------------------------
746 // Function : DeviceInterface::registerSensParams
747 // Purpose :
748 // Special Notes :
749 // Scope : public
750 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
751 // Creation Date : 06/03/02
752 //-----------------------------------------------------------------------------
753 bool DeviceInterface::registerSensParams (const Util::OptionBlock & OB)
754 
755 {
756  return devMgrPtr_->registerSensParams (OB);
757 }
758 
759 //-----------------------------------------------------------------------------
760 // Function : DeviceInterface::registerICLoads
761 // Purpose :
762 // Special Notes :
763 // Scope : public
764 // Creator : Eric R. Keiter, SNL, Computational Sciences
765 // Creation Date : 03/05/02
766 //-----------------------------------------------------------------------------
767 bool DeviceInterface::registerICLoads( std::vector< std::pair<int,double> > * icLoads )
768 {
769  return devMgrPtr_->registerICLoads(icLoads);
770 }
771 
772 //-----------------------------------------------------------------------------
773 // Function : DeviceInterface::enablePDEContinuation
774 // Purpose :
775 // Special Notes :
776 // Scope : public
777 // Creator : Eric R. Keiter, SNL, Computational Sciences
778 // Creation Date : 10/22/02
779 //-----------------------------------------------------------------------------
781 {
783 }
784 
785 //-----------------------------------------------------------------------------
786 // Function : DeviceInterface::disablePDEContinuation
787 // Purpose :
788 // Special Notes :
789 // Scope : public
790 // Creator : Eric R. Keiter, SNL, Computational Sciences
791 // Creation Date : 10/22/02
792 //-----------------------------------------------------------------------------
794 {
796 }
797 
798 //-----------------------------------------------------------------------------
799 // Function : DeviceInterface::getNumInterfaceNodes
800 // Purpose :
801 // Special Notes :
802 // Scope : public
803 // Creator : Eric R. Keiter, SNL, Computational Sciences
804 // Creation Date : 12/03/02
805 //-----------------------------------------------------------------------------
806 void DeviceInterface::getNumInterfaceNodes (std::vector<int> & numINodes)
807 {
808  devMgrPtr_->getNumInterfaceNodes (numINodes);
809 }
810 
811 //-----------------------------------------------------------------------------
812 // Function : DeviceInterface::loadCouplingRHS
813 // Purpose :
814 // Special Notes :
815 // Scope : public
816 // Creator : Eric R. Keiter, SNL, Computational Sciences
817 // Creation Date : 12/03/02
818 //-----------------------------------------------------------------------------
819 bool DeviceInterface::loadCouplingRHS (int iPDEDevice, int iElectrode, N_LAS_Vector * dfdvPtr)
820 {
821  return devMgrPtr_->loadCouplingRHS (iPDEDevice, iElectrode,dfdvPtr);
822 }
823 
824 //-----------------------------------------------------------------------------
825 // Function : DeviceInterface::calcCouplingTerms
826 // Purpose :
827 // Special Notes :
828 // Scope : public
829 // Creator : Eric R. Keiter, SNL, Computational Sciences
830 // Creation Date : 12/03/02
831 //-----------------------------------------------------------------------------
832 bool DeviceInterface::calcCouplingTerms (int iSubProblem, int iElectrode, const N_LAS_Vector * dxdvPtr)
833 {
834  return devMgrPtr_->calcCouplingTerms (iSubProblem, iElectrode, dxdvPtr);
835 }
836 
837 //-----------------------------------------------------------------------------
838 // Function : DeviceInterface::raiseDebugLevel
839 // Purpose :
840 // Special Notes :
841 // Scope : public
842 // Creator : Eric R. Keiter, SNL, Computational Sciences
843 // Creation Date : 04/23/03
844 //-----------------------------------------------------------------------------
846 {
847  return devMgrPtr_->raiseDebugLevel(increment);
848 }
849 
850 //-----------------------------------------------------------------------------
851 // Function : DeviceInterface::loadDAEMatrices
852 // Purpose :
853 // Special Notes :
854 // Scope : public
855 // Creator : Eric R. Keiter, SNL, Computational Sciences
856 // Creation Date : 03/03/04
857 //-----------------------------------------------------------------------------
859  N_LAS_Vector * tmpSolVectorPtr,
860  N_LAS_Vector * tmpStaVectorPtr,
861  N_LAS_Vector * tmpStaDerivVectorPtr,
862  N_LAS_Vector * tmpStoVectorPtr,
863  N_LAS_Matrix * tmpdQdxMatrixPtr,
864  N_LAS_Matrix * tmpdFdxMatrixPtr)
865 {
866  return devMgrPtr_->loadDAEMatrices (
867  tmpSolVectorPtr,
868  tmpStaVectorPtr,
869  tmpStaDerivVectorPtr,
870  tmpStoVectorPtr,
871  tmpdQdxMatrixPtr,
872  tmpdFdxMatrixPtr);
873 }
874 
875 //-----------------------------------------------------------------------------
876 // Function : DeviceInterface::loadDAEVectors
877 // Purpose :
878 // Special Notes :
879 // Scope : public
880 // Creator : Eric R. Keiter, SNL, Computational Sciences
881 // Creation Date : 02/20/03
882 //-----------------------------------------------------------------------------
884  N_LAS_Vector * tmpSolVectorPtr,
885  N_LAS_Vector * tmpCurrSolVectorPtr,
886  N_LAS_Vector * tmpLastSolVectorPtr,
887  N_LAS_Vector * tmpStaVectorPtr,
888  N_LAS_Vector * tmpCurrStaVectorPtr,
889  N_LAS_Vector * tmpLastStaVectorPtr,
890  N_LAS_Vector * tmpStaDerivVectorPtr,
891  N_LAS_Vector * tmpStoVectorPtr,
892  N_LAS_Vector * tmpCurrStoVectorPtr,
893  N_LAS_Vector * tmpLastStoVectorPtr,
894  N_LAS_Vector * tmpStoLeadCurrQCompVectorPtr,
895  N_LAS_Vector * tmpQVectorPtr,
896  N_LAS_Vector * tmpFVectorPtr,
897  N_LAS_Vector * tmpBVectorPtr,
898  N_LAS_Vector * tmpdFdxdVpVectorPtr,
899  N_LAS_Vector * tmpdQdxdVpVectorPtr)
900 
901 {
902  return devMgrPtr_->loadDAEVectors ( tmpSolVectorPtr,
903  tmpCurrSolVectorPtr,
904  tmpLastSolVectorPtr,
905  tmpStaVectorPtr,
906  tmpCurrStaVectorPtr,
907  tmpLastStaVectorPtr,
908  tmpStaDerivVectorPtr,
909  tmpStoVectorPtr,
910  tmpCurrStoVectorPtr,
911  tmpLastStoVectorPtr,
912  tmpStoLeadCurrQCompVectorPtr,
913  tmpQVectorPtr,
914  tmpFVectorPtr,
915  tmpBVectorPtr,
916  tmpdFdxdVpVectorPtr,
917  tmpdQdxdVpVectorPtr );
918 }
919 
920 //-----------------------------------------------------------------------------
921 // Function : DeviceInterface::updateState
922 // Purpose :
923 // Special Notes :
924 // Scope : public
925 // Creator : Eric R. Keiter, SNL, Computational Sciences
926 // Creation Date : 11/17/05
927 //-----------------------------------------------------------------------------
929  N_LAS_Vector * nextSolVectorPtr,
930  N_LAS_Vector * currSolVectorPtr,
931  N_LAS_Vector * lastSolVectorPtr,
932  N_LAS_Vector * nextStaVectorPtr,
933  N_LAS_Vector * currStaVectorPtr,
934  N_LAS_Vector * lastStaVectorPtr,
935  N_LAS_Vector * nextStoVectorPtr,
936  N_LAS_Vector * currStoVectorPtr,
937  N_LAS_Vector * lastStoVectorPtr
938  )
939 {
940  return devMgrPtr_->updateState (
941  nextSolVectorPtr, currSolVectorPtr, lastSolVectorPtr,
942  nextStaVectorPtr, currStaVectorPtr, lastStaVectorPtr,
943  nextStoVectorPtr, currStoVectorPtr, lastStoVectorPtr
944  );
945 }
946 
947 //-----------------------------------------------------------------------------
948 // Function : DeviceInterface::setVoltageLimiterFlag
949 // Purpose :
950 // Special Notes :
951 // Scope : public
952 // Creator : Eric R. Keiter, SNL, Computational Sciences
953 // Creation Date : 04/20/04
954 //-----------------------------------------------------------------------------
955 /*void DeviceInterface::setVoltageLimiterFlag ()
956 {
957  devMgrPtr_->setVoltageLimiterFlag ();
958 }*/
959 
960 //-----------------------------------------------------------------------------
961 // Function : DeviceInterface::unsetVoltageLimiterFlag
962 // Purpose :
963 // Special Notes :
964 // Scope : public
965 // Creator : Eric R. Keiter, SNL, Computational Sciences
966 // Creation Date : 04/20/04
967 //-----------------------------------------------------------------------------
969 {
971 }
972 void setVoltageLimiterFlag (bool flagVal);
973 
974 
975 //-----------------------------------------------------------------------------
976 // Function : DeviceInterface::setVoltageLimiterFlag
977 // Purpose :
978 // Special Notes :
979 // Scope : public
980 // Creator : Ting Mei, SNL
981 // Creation Date : 02/18/14
982 //-----------------------------------------------------------------------------
984 {
985  devMgrPtr_->setVoltageLimiterFlag ( flagVal );
986 }
987 
988 
989 //-----------------------------------------------------------------------------
990 // Function : DeviceInterface::loadBVectorsforAC
991 // Purpose :
992 // Special Notes :
993 // Scope : public
994 // Creator : Ting Mei, SNL
995 // Creation Date :
996 //-----------------------------------------------------------------------------
997 bool DeviceInterface::loadBVectorsforAC (N_LAS_Vector * bVecRealPtr,
998  N_LAS_Vector * bVecImagPtr)
999 {
1000  return devMgrPtr_->loadBVectorsforAC (bVecRealPtr, bVecImagPtr);
1001 }
1002 
1003 bool DeviceInterface::getBMatrixEntriesforMOR(std::vector<int>& bMatEntriesVec,
1004  std::vector<int>& bMatPosEntriesVec)
1005 {
1006  return devMgrPtr_->getBMatrixEntriesforMOR( bMatEntriesVec, bMatPosEntriesVec );
1007 }
1008 
1009 //-----------------------------------------------------------------------------
1010 // Function : DeviceInterface::getHomotopyBlockSize
1011 // Purpose : Returns the block size for block gainscale continuation.
1012 // Special Notes : This call is virtual and should be overridden by
1013 // the DeviceMgr
1014 // Scope : public
1015 // Creator : Roger Pawlowski, SNL, Computational Sciences
1016 // Creation Date : 01/26/2005
1017 //----------------------------------------------------------------------------
1019 {
1020  return devMgrPtr_->getHomotopyBlockSize();
1021 }
1022 
1023 //-----------------------------------------------------------------------------
1024 // Function : DeviceInterface::addGlobalPar
1025 // Purpose : Add global parameter
1026 // Special Notes :
1027 // Scope : public
1028 // Creator : Dave Shirley, PSSI
1029 // Creation Date : 11/18/2005
1030 //----------------------------------------------------------------------------
1031 void DeviceInterface::addGlobalPar(const Util::Param & par)
1032 {
1033  devMgrPtr_->addGlobalPar(par);
1034 }
1035 
1036 
1037 //-----------------------------------------------------------------------------
1038 // Function : DeviceInterface::getGlobalPar
1039 // Purpose : get the value of a global parameter
1040 // Special Notes :
1041 // Scope : public
1042 // Creator : Rich Schiek, SNL, Electrical Systems Modeling
1043 // Creation Date : 01/25/2013
1044 //----------------------------------------------------------------------------
1045 double DeviceInterface::getGlobalPar( const std::string & parName ) const
1046 {
1047  return devMgrPtr_->getGlobalPar( parName );
1048 }
1049 
1050 const double *DeviceInterface::findGlobalPar(const std::string & parName) const
1051 {
1052  return devMgrPtr_->findGlobalPar(parName);
1053 }
1054 
1055 //-----------------------------------------------------------------------------
1056 // Function : DeviceMgr::allDevsConverged
1057 // Purpose : Check whether any device has taken an action that renders
1058 // normal convergence checks invalid (i.e. that the current
1059 // step must be assumed unconverged).
1060 // Special Notes :
1061 // Scope : public
1062 // Creator : Tom Russo, SNL, Component Information and Models
1063 // Creation Date : 03/22/05
1064 //-----------------------------------------------------------------------------
1066 {
1067  return devMgrPtr_->allDevsConverged();
1068 }
1069 
1070 //-----------------------------------------------------------------------------
1071 // Function : DeviceMgr::innerDevsConverged
1072 // Purpose :
1073 // Special Notes :
1074 // Scope : public
1075 // Creator : Eric Keiter, SNL
1076 // Creation Date : 03/22/06
1077 //-----------------------------------------------------------------------------
1079 {
1080  return devMgrPtr_->innerDevsConverged();
1081 }
1082 
1083 //-----------------------------------------------------------------------------
1084 // Function : DeviceMgr::setupExternalDevices
1085 // Purpose : Setup external devices, especially critical for parallel
1086 // Special Notes : needed for 2-level.
1087 // Scope : public
1088 // Creator : Robert Hoekstra, Elec. & MicroSystems Engring
1089 // Creation Date : 03/11/06
1090 //-----------------------------------------------------------------------------
1092 {
1094 }
1095 
1096 //-----------------------------------------------------------------------------
1097 // Function : DeviceInterface::homotopyStepSuccess
1098 // Purpose :
1099 // Special Notes : needed for 2-level.
1100 // Scope : public
1101 // Creator : Eric R. Keiter, SNL
1102 // Creation Date : 03/20/06
1103 //-----------------------------------------------------------------------------
1105  (const std::vector<std::string> & paramNames,
1106  const std::vector<double> & paramVals)
1107 {
1108  return devMgrPtr_->homotopyStepSuccess (paramNames, paramVals);
1109 }
1110 
1111 //-----------------------------------------------------------------------------
1112 // Function : DeviceInterface::homotopyStepFailure
1113 // Purpose :
1114 // Special Notes : needed for 2-level.
1115 // Scope : public
1116 // Creator : Eric R. Keiter, SNL
1117 // Creation Date : 03/30/06
1118 //-----------------------------------------------------------------------------
1120 {
1121  return devMgrPtr_->homotopyStepFailure ();
1122 }
1123 
1124 //-----------------------------------------------------------------------------
1125 // Function : DeviceInterface::stepSuccess
1126 // Purpose :
1127 // Special Notes : needed for 2-level.
1128 // Scope : public
1129 // Creator : Eric R. Keiter, SNL
1130 // Creation Date : 03/12/06
1131 //-----------------------------------------------------------------------------
1133 {
1134  return devMgrPtr_->stepSuccess(analysis);
1135 }
1136 
1137 //-----------------------------------------------------------------------------
1138 // Function : DeviceInterface::stepFailure
1139 // Purpose :
1140 // Special Notes : needed for 2-level.
1141 // Scope : public
1142 // Creator : Eric R. Keiter, SNL
1143 // Creation Date : 03/12/06
1144 //-----------------------------------------------------------------------------
1146 {
1147  return devMgrPtr_->stepFailure(analysis);
1148 }
1149 
1150 //-----------------------------------------------------------------------------
1151 // Function : DeviceInterface::acceptStep
1152 // Purpose :
1153 // Special Notes :
1154 // Scope : public
1155 // Creator : Tom Russo, SNL
1156 // Creation Date : 01/23/07
1157 //-----------------------------------------------------------------------------
1159 {
1160  devMgrPtr_->acceptStep ();
1161 }
1162 
1163 //-----------------------------------------------------------------------------
1164 // Function : DeviceInterface::getInitialQnorm
1165 // Purpose :
1166 // Special Notes : needed for 2-level.
1167 // Scope : public
1168 // Creator : Eric R. Keiter, SNL
1169 // Creation Date : 03/18/07
1170 //-----------------------------------------------------------------------------
1171 bool DeviceInterface::getInitialQnorm (std::vector<N_TIA_TwoLevelError> & tleVec )
1172 {
1173  return devMgrPtr_->getInitialQnorm (tleVec);
1174 }
1175 
1176 //-----------------------------------------------------------------------------
1177 // Function : DeviceInterface::getInnerLoopErrorSums
1178 // Purpose :
1179 // Special Notes : needed for 2-level.
1180 // Scope : public
1181 // Creator : Eric R. Keiter, SNL
1182 // Creation Date : 03/15/06
1183 //-----------------------------------------------------------------------------
1184 bool DeviceInterface::getInnerLoopErrorSums (std::vector<N_TIA_TwoLevelError> & tleVec)
1185 {
1186  return devMgrPtr_->getInnerLoopErrorSums (tleVec);
1187 }
1188 
1189 //-----------------------------------------------------------------------------
1190 // Function : DeviceInterface::updateStateArrays()
1191 // Purpose :
1192 // Special Notes : needed for 2-level.
1193 // Scope : public
1194 // Creator : Eric R. Keiter, SNL
1195 // Creation Date : 03/15/06
1196 //-----------------------------------------------------------------------------
1198 {
1199  return devMgrPtr_->updateStateArrays();
1200 }
1201 
1202 //-----------------------------------------------------------------------------
1203 // Function : DeviceInterface::startTimeStep
1204 // Purpose :
1205 // Special Notes : needed for 2-level.
1206 // Scope : public
1207 // Creator : Eric R. Keiter, SNL
1208 // Creation Date : 03/20/06
1209 //-----------------------------------------------------------------------------
1211 {
1212  return devMgrPtr_->startTimeStep ();
1213 }
1214 
1215 
1216 //-----------------------------------------------------------------------------
1217 // Function : DeviceInterface::setExternalSolverState
1218 // Purpose :
1219 // Special Notes : needed for 2-level.
1220 // Scope : public
1221 // Creator : Eric R. Keiter, SNL
1222 // Creation Date : 03/20/06
1223 //-----------------------------------------------------------------------------
1225 {
1227 }
1228 
1229 //-----------------------------------------------------------------------------
1230 // Function : DeviceInterface::updateSolverState
1231 // Purpose :
1232 // Special Notes : needed for mixed signal
1233 // Scope : public
1234 // Creator : Eric R. Keiter, SNL
1235 // Creation Date : 05/22/09
1236 //-----------------------------------------------------------------------------
1238 {
1239  bool tmp = devMgrPtr_->setupSolverInfo();
1240 }
1241 
1242 //-----------------------------------------------------------------------------
1243 // Function : DeviceInterface::restartDataSize
1244 // Purpose :
1245 // Special Notes :
1246 // Scope : public
1247 // Creator : Eric R. Keiter, SNL
1248 // Creation Date : 06/26/2013
1249 //-----------------------------------------------------------------------------
1251 {
1252  return devMgrPtr_->restartDataSize(pack );
1253 }
1254 
1255 //-----------------------------------------------------------------------------
1256 // Function : DeviceInterface::dumpRestartData
1257 // Purpose : Output restart data.
1258 // Special Notes :
1259 // Scope : public
1260 // Creator : Eric R. Keiter, SNL
1261 // Creation Date : 06/26/2013
1262 //-----------------------------------------------------------------------------
1264 (char * buf, int bsize, int & pos, N_PDS_Comm * comm, bool pack )
1265 {
1266  return devMgrPtr_->dumpRestartData(buf, bsize, pos, comm, pack );
1267 }
1268 
1269 //-----------------------------------------------------------------------------
1270 // Function : DeviceInterface::restoreRestartData
1271 // Purpose : Load restart data.
1272 // Special Notes :
1273 // Scope : public
1274 // Creator : Eric R. Keiter, SNL
1275 // Creation Date : 06/26/2013
1276 //-----------------------------------------------------------------------------
1278 (char * buf, int bsize, int & pos, N_PDS_Comm * comm, bool pack )
1279 {
1280  return devMgrPtr_->restoreRestartData(buf, bsize, pos, comm, pack);
1281 }
1282 
1284 {
1285  return devMgrPtr_->getDevice(model_type_id);
1286 }
1287 
1288 
1289 } // namespace Device
1290 } // namespace Xyce