Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_ANP_AnalysisManager.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_ANP_AnalysisManager.C,v $
27 // Purpose : This file contains the functions which define the time
28 // domain & integration algorithm classes.
29 // Special Notes :
30 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
31 // Creation Date : 01/24/08
32 //
33 // Revision Information:
34 // ---------------------
35 // Revision Number: $Revision: 1.144.2.5 $
36 // Revision Date : $Date: 2014/08/28 21:00:43 $
37 // Current Owner : $Author: dgbaur $
38 //-----------------------------------------------------------------------------
39 
40 #include <Xyce_config.h>
41 
42 // ---------- Standard Includes ----------
43 #include <ctime>
44 #include <iostream>
45 #include <sstream>
46 
47 #include <N_ANP_AnalysisManager.h>
48 
49 #include <N_ANP_AC.h>
50 #include <N_ANP_DCSweep.h>
51 #include <N_ANP_Dakota.h>
52 #include <N_ANP_HB.h>
53 #include <N_ANP_MOR.h>
54 #include <N_ANP_MPDE.h>
55 #include <N_ANP_OutputMgrAdapter.h>
56 #include <N_ANP_Report.h>
57 #include <N_ANP_Step.h>
58 #include <N_ANP_Transient.h>
59 #include <N_IO_CmdParse.h>
60 #include <N_IO_OutputMgr.h>
61 #include <N_IO_ActiveOutput.h>
62 #include <N_IO_RestartMgr.h>
63 #include <N_LAS_LAFactory.h>
64 #include <N_LAS_Matrix.h>
65 #include <N_LAS_System.h>
66 #include <N_LAS_Vector.h>
67 #include <N_LOA_CktLoader.h>
68 #include <N_LOA_Loader.h>
69 #include <N_LOA_NonlinearEquationLoader.h>
70 #include <N_MPDE_Manager.h>
71 #include <N_NLS_Manager.h>
72 #include <N_PDS_Comm.h>
73 #include <N_PDS_Manager.h>
74 #include <N_TIA_DataStore.h>
75 #include <N_TIA_MPDEInterface.h>
76 #include <N_TIA_StepErrorControl.h>
77 #include <N_TIA_TIAParams.h>
78 #include <N_TIA_TimeIntInfo.h>
80 #include <N_TIA_TwoLevelError.h>
81 #include <N_TOP_Topology.h>
82 #include <N_UTL_BreakPoint.h>
83 #include <N_UTL_OptionBlock.h>
84 #include <N_UTL_Stats.h>
85 #include <N_UTL_Timer.h>
86 
87 namespace Xyce {
88 namespace Analysis {
89 
90 namespace {
91 
92 // .RESULTS
93 struct AnalysisManager_ResultOptionsReg : public IO::PkgOptionsReg
94 {
95  AnalysisManager_ResultOptionsReg(AnalysisManager &analysis_manager)
96  : analysisManager_(analysis_manager)
97  {}
98 
99  bool operator()(const Util::OptionBlock & option_block)
100  {
101  analysisManager_.getOutputManagerAdapter().addOutputResults(option_block);
102 
103  return true;
104  }
105 
106 private:
107  AnalysisManager & analysisManager_;
108 };
109 
110  // .TRAN
111  struct AnalysisManager_TransAnalysisReg : public IO::PkgOptionsReg
112  {
113  AnalysisManager_TransAnalysisReg( AnalysisManager * mgr )
114  : Mgr(mgr)
115  {}
116 
117  bool operator()( const N_UTL_OptionBlock & options )
118  { return Mgr->setTranAnalysisParams( options ); }
119 
120  AnalysisManager * Mgr;
121  };
122 
123  // .options TIMEINT
124  struct AnalysisManager_TranOptionsReg : public IO::PkgOptionsReg
125  {
126  AnalysisManager_TranOptionsReg( AnalysisManager * mgr )
127  : Mgr(mgr)
128  {}
129 
130  bool operator()( const N_UTL_OptionBlock & options )
131  { return Mgr->setTranOptions( options ); }
132 
133  AnalysisManager * Mgr;
134  };
135 
136  // .DC
137  struct AnalysisManager_DCAnalysisReg : public IO::PkgOptionsReg
138  {
139  AnalysisManager_DCAnalysisReg( AnalysisManager * mgr )
140  : Mgr(mgr)
141  {}
142 
143  bool operator()( const N_UTL_OptionBlock & options )
144  { return Mgr->setDCAnalysisParams( options ); }
145 
146  AnalysisManager * Mgr;
147  };
148 
149  // .options OP_IO
150  struct AnalysisManager_DCOPOptionsReg : public IO::PkgOptionsReg
151  {
152  AnalysisManager_DCOPOptionsReg( AnalysisManager * mgr )
153  : Mgr(mgr)
154  {}
155 
156  bool operator()( const N_UTL_OptionBlock & options )
157  { return Mgr->setDCOPRestartParams( options ); }
158 
159  AnalysisManager * Mgr;
160  };
161 
162 
163  // .OP
164  struct AnalysisManager_OPAnalysisReg : public IO::PkgOptionsReg
165  {
166  AnalysisManager_OPAnalysisReg( AnalysisManager * mgr )
167  : Mgr(mgr)
168  {}
169 
170  bool operator()( const N_UTL_OptionBlock & options )
171  { return Mgr->setOPAnalysisParams( options ); }
172 
173  AnalysisManager * Mgr;
174  };
175 
176  // .STEP
177  struct AnalysisManager_STEPAnalysisReg : public IO::PkgOptionsReg
178  {
179  AnalysisManager_STEPAnalysisReg( AnalysisManager * mgr )
180  : Mgr(mgr)
181  {}
182 
183  bool operator()( const N_UTL_OptionBlock & options )
184  { return Mgr->setSTEPAnalysisParams( options ); }
185 
186  AnalysisManager * Mgr;
187  };
188 
189  // .options SAVE
190  struct AnalysisManager_SaveOptionsReg : public IO::PkgOptionsReg
191  {
192  AnalysisManager_SaveOptionsReg( AnalysisManager * mgr )
193  : Mgr(mgr)
194  {}
195 
196  bool operator()( const N_UTL_OptionBlock & options )
197  { return Mgr->setSaveOptions( options ); }
198 
199  AnalysisManager * Mgr;
200  };
201 
202  // .MPDE
203  struct AnalysisManager_MPDE_AnalysisReg : public IO::PkgOptionsReg
204  {
205  AnalysisManager_MPDE_AnalysisReg( AnalysisManager * anpInt )
206  : anpInt_(anpInt)
207  {}
208 
209  bool operator()( const N_UTL_OptionBlock & options )
210  { return anpInt_->setMPDEAnalysisParams( options ); }
211 
212  AnalysisManager * anpInt_;
213  };
214 
215  // .HB
216  struct AnalysisManager_HB_AnalysisReg : public IO::PkgOptionsReg
217  {
218  AnalysisManager_HB_AnalysisReg( AnalysisManager * anpInt )
219  : anpInt_(anpInt)
220  {}
221 
222  bool operator()( const N_UTL_OptionBlock & options )
223  { return anpInt_->setHBAnalysisParams( options ); }
224 
225  AnalysisManager * anpInt_;
226  };
227 
228  // .options HBINT
229  struct AnalysisManager_HB_OptionsReg : public IO::PkgOptionsReg
230  {
231  AnalysisManager_HB_OptionsReg( AnalysisManager * anpInt )
232  : anpInt_(anpInt)
233  {}
234 
235  bool operator()( const N_UTL_OptionBlock & options )
236  { return anpInt_->setHBOptions( options ); }
237 
238  AnalysisManager * anpInt_;
239  };
240 
241  // .options LINSOL
242  struct AnalysisManager_LinSolReg : public IO::PkgOptionsReg
243  {
244  AnalysisManager_LinSolReg( AnalysisManager * anpInt )
245  : anpInt_(anpInt)
246  {}
247 
248  bool operator()( const N_UTL_OptionBlock & options )
249  { return anpInt_->setLinSol( options ); }
250 
251  AnalysisManager * anpInt_;
252  };
253 
254  // .options LINSOL-HB
255  struct AnalysisManager_HB_LinSolReg : public IO::PkgOptionsReg
256  {
257  AnalysisManager_HB_LinSolReg( AnalysisManager * anpInt )
258  : anpInt_(anpInt)
259  {}
260 
261  bool operator()( const N_UTL_OptionBlock & options )
262  { return anpInt_->setHBLinSol( options ); }
263 
264  AnalysisManager * anpInt_;
265  };
266 
267  // .options MPDEINT
268  struct AnalysisManager_MPDE_OptionsReg : public IO::PkgOptionsReg
269  {
270  AnalysisManager_MPDE_OptionsReg( AnalysisManager * anpInt )
271  : anpInt_(anpInt)
272  {}
273 
274  bool operator()( const N_UTL_OptionBlock & options )
275  { return anpInt_->setMPDEOptions( options ); }
276 
277  AnalysisManager * anpInt_;
278  };
279 
280  // .options TIMEINT-MPDE
281  struct AnalysisManager_MPDE_TranMPDEOptionsReg : public IO::PkgOptionsReg
282  {
283  AnalysisManager_MPDE_TranMPDEOptionsReg( AnalysisManager * anpInt )
284  : anpInt_(anpInt)
285  {}
286 
287  bool operator()( const N_UTL_OptionBlock & options )
288  { return anpInt_->setTRANMPDEOptions( options ); }
289 
290  AnalysisManager * anpInt_;
291  };
292 
293  // .AC
294  struct AnalysisManager_AC_AnalysisReg : public IO::PkgOptionsReg
295  {
296  AnalysisManager_AC_AnalysisReg( AnalysisManager * anpInt )
297  : anpInt_(anpInt)
298  {}
299 
300  bool operator()( const N_UTL_OptionBlock & options )
301  { return anpInt_->setACAnalysisParams( options ); }
302 
303  AnalysisManager * anpInt_;
304  };
305 
306  // .MOR
307  struct AnalysisManager_MOR_AnalysisReg : public IO::PkgOptionsReg
308  {
309  AnalysisManager_MOR_AnalysisReg( AnalysisManager * anpInt )
310  : anpInt_(anpInt)
311  {}
312 
313  bool operator()( const N_UTL_OptionBlock & options )
314  { return anpInt_->setMORAnalysisParams( options ); }
315 
316  AnalysisManager * anpInt_;
317  };
318 
319  // .options MOR_OPTS
320  struct AnalysisManager_MOR_OptionsReg : public IO::PkgOptionsReg
321  {
322  AnalysisManager_MOR_OptionsReg( AnalysisManager * anpInt )
323  : anpInt_(anpInt)
324  {}
325 
326  bool operator()( const N_UTL_OptionBlock & options )
327  { return anpInt_->setMOROptions( options ); }
328 
329  AnalysisManager * anpInt_;
330  };
331 
332 
333  // .options SENS
334  struct AnalysisManager_SensOptionsReg : public IO::PkgOptionsReg
335  {
336  AnalysisManager_SensOptionsReg( AnalysisManager * anpInt )
337  : anpInt_(anpInt)
338  {}
339 
340  bool operator()( const N_UTL_OptionBlock & options )
341  { return anpInt_->setSensOptions( options ); }
342 
343  AnalysisManager * anpInt_;
344  };
345 
346 
347 } // namespace <unnamed>
348 
349 
350 const char *
352 {
353  static const char * const mode_names[] = {"Invalid", "DC OP", "DC Sweep", "Transient", "MPDE", "HB", "AC", "MOR"};
354 
355  if (mode < sizeof(mode_names)/sizeof(mode_names[0]))
356  return mode_names[mode];
357  else
358  return mode_names[0];
359 }
360 
361 //-----------------------------------------------------------------------------
362 // Function : AnalysisManager::AnalysisManager
363 // Purpose : constructor
364 // Special Notes :
365 // Scope : public
366 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
367 // Creation Date : 01/24/08
368 //-----------------------------------------------------------------------------
369 
370 AnalysisManager::AnalysisManager(IO::CmdParse & cp, Stats::Stat root_stat)
371  : Util::Notifier<StepEvent>(),
372  Util::Notifier<AnalysisEvent>(),
373  Util::ListenerAutoSubscribe<StepEvent>(this),
374  Util::ListenerAutoSubscribe<AnalysisEvent>(this),
375  commandLine_(cp),
376  tiaParams_(cp),
377  workingIntgMethod_(0),
378  stepErrorControl_(0),
379  linearSystem_(0),
380  nlsMgrPtr_(0),
381  loader_(0),
382  cktLoaderPtr_(0),
383  restartPtr_(0),
384  pkgOptMgrPtr_(0),
385  nonlinearEquationLoaderPtr_(0),
386  devInterfacePtr_(0),
387  topoMgrPtr_(0),
388  outMgrPtr_(0),
389  appBuilderPtr_(0),
390  pdsMgrPtr_(0),
391  outputManagerAdapter_(0),
392  tiaDataStore_(0),
393  analysisMode_(ANP_MODE_TRANSIENT),
394  analysisParamsRegistered(false),
395  firstTime(true),
396  oldPercentComplete(0.0),
397  startSimTime(-1.0),
398  calledBeforeTwoLevelTran_(false),
399  switchIntegrator_(false),
400  initializeAllFlag_(false),
401  startTRANtime_(0.0),
402  stepLoopFlag_(false),
403  stepLoopInitialized_(false),
404  dcLoopInitialized_(false),
405  gui_(false),
406  daeStateDerivFlag_(true),
407  initializeSolvers_mixedSignal_(false),
408  dcLoopSize_(0),
409  sweepSourceResetFlag_(true),
410  progressFlag_(true),
411  rootStat_("Analysis Manager", root_stat),
412  xyceTranTimerPtr_(0),
413  elapsedTimerPtr_(0),
414  solverStartTime_(0.0),
415  dakotaRunFlag_(false),
416  dakotaIterationNumber_(0),
417  saveTime_(0.0),
418  saveTimeGiven_(false),
419  saveFlag_(false),
420  savedAlready_(false),
421  dcopRestartFlag_(false),
422  dotOpSpecified_(false),
423  initialOutputInterval_(0.0),
424  outputIntervals_(),
425  nextOutputTime_(0.0),
426  initialRestartInterval_(0.0),
427  restartIntervals_(),
428  nextRestartSaveTime_(0.0),
429  blockAnalysisFlag_(false),
430  hbFlag_(false),
431  mpdeFlag_(false),
432  sensFlag_(false),
433  analysisObject_(),
434  stepAnalysisTarget_(),
435  dakotaAnalysisTarget_(),
436  primaryAnalysisObject_(),
437  mpdeMgrPtr_(0),
438  tiaMPDEIfacePtr_(),
439  twoLevelAnalysisObject_(),
440  mixedSignalAnalysisObject_(),
441  breakPointRestartStep(0),
442  currentMode_(CURRENT_MODE_TRANOP)
443 {
444  gui_ = commandLine_.argExists("-gui");
445 
446  // check for maximum order on the command line
447  if ( commandLine_.argExists ("-maxord") )
448  {
450  atoi( commandLine_.getArgumentValue( "-maxord" ).c_str() );
451 
452  if ( tiaParams_.maxOrder < 1) tiaParams_.maxOrder = 1;
453  if ( tiaParams_.maxOrder > 5) tiaParams_.maxOrder = 5;
454  }
455 
456  // Create the MPDEIface object and register it with tiaControl
458  tiaMPDEIfacePtr_->registerTIAControl(this);
459 
460  return;
461 }
462 
463 //-----------------------------------------------------------------------------
464 // Function : AnalysisManager::~AnalysisManager
465 //
466 // Purpose : destructor
467 // Special Notes :
468 // Scope : public
469 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
470 // Creation Date : 01/24/08
471 //-----------------------------------------------------------------------------
473 {
474  delete cktLoaderPtr_;
476  delete outputManagerAdapter_;
477  delete mpdeMgrPtr_;
478  delete workingIntgMethod_;
479  delete tiaDataStore_;
480  delete stepErrorControl_;
481  delete xyceTranTimerPtr_;
482 }
483 
484 
485 //-----------------------------------------------------------------------------
486 // Function : AnalysisManager::notify
487 // Purpose :
488 // Special Notes :
489 // Scope : public
490 // Creator : David G. Baur Raytheon Sandia National Laboratories 1355
491 // Creation Date : Mon Jul 14 12:15:30 2014
492 //-----------------------------------------------------------------------------
493 ///
494 /// Notification that there is a StepEvent.
495 ///
496 /// @param step_event information about the event
497 ///
498 void
500  const StepEvent & step_event)
501 {
502  if (step_event.state_ == StepEvent::STEP_STARTED) {
504  }
505 }
506 
507 //-----------------------------------------------------------------------------
508 // Function : AnalysisManager::notify
509 // Purpose :
510 // Special Notes :
511 // Scope : public
512 // Creator : David G. Baur Raytheon Sandia National Laboratories 1355
513 // Creation Date : Mon Jul 14 12:15:30 2014
514 //-----------------------------------------------------------------------------
515 ///
516 /// Notification that there is a AnalysisEvent.
517 ///
518 /// @param time_integrator_event information about the event
519 ///
520 void
522  const AnalysisEvent & analysis_event)
523 {
524 // Xyce::dout() << Dump<AnalysisEvent>(analysis_event) << std::endl;
525 }
526 
527 
528 //-----------------------------------------------------------------------------
529 // Function : AnalysisManager::resetAll
530 //
531 // Purpose : just like a destructor without the death
532 // Special Notes :
533 // Scope : public
534 // Creator : Todd Coffey, Rich Schiek, Ting Mei
535 // Creation Date : 7/24/08
536 //-----------------------------------------------------------------------------
538 {
539  // tiaDataStore_ is created in initializeAll
540  delete tiaDataStore_;
541  tiaDataStore_ = 0;
542 
543  // stepErrorControl_ is created in initializeAll
544  delete stepErrorControl_;
545  stepErrorControl_ = 0;
546 
547  // wimPtr is created in initializeAll
548  delete workingIntgMethod_;
549  workingIntgMethod_ = 0;
550 
551  // Reset step statistics to zero.
552  primaryAnalysisObject_->resetAll();
553 
554  initializeAllFlag_ = false;
555 }
556 
557 //-----------------------------------------------------------------------------
558 // Function : AnalysisManager::getBlockAnalysisFlag
559 // Purpose : "get" function for MPDE flag. (true if not IC)
560 // Special Notes :
561 // Scope : public
562 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
563 // Creation Date : 01/31/08
564 //-----------------------------------------------------------------------------
566 {
567  if (!mpdeMgrPtr_)
568  {
569  return blockAnalysisFlag_;
570  }
571  return mpdeMgrPtr_->blockAnalysisFlag();
572 }
573 
574 //-----------------------------------------------------------------------------
575 // Function : AnalysisManager::getMPDEFlag
576 // Purpose : "get" function for MPDE flag. (true if not IC)
577 // Special Notes :
578 // Scope : public
579 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
580 // Creation Date : 01/31/08
581 //-----------------------------------------------------------------------------
583 {
584  if (!mpdeMgrPtr_)
585  {
586  return mpdeFlag_;
587  }
588  return mpdeMgrPtr_->getMPDEFlag();
589 }
590 
591 //-----------------------------------------------------------------------------
592 // Function : AnalysisManager::getMPDEStartupFlag
593 // Purpose :
594 // Special Notes :
595 // Scope : public
596 // Creator : Todd Coffey, Rich Schiek, Ting Mei
597 // Creation Date : 7/24/08
598 //-----------------------------------------------------------------------------
600 {
601  if (!mpdeMgrPtr_)
602  {
603  return false;
604  }
605  return mpdeMgrPtr_->getMPDEStartupFlag();
606 }
607 
608 //-----------------------------------------------------------------------------
609 // Function : AnalysisManager::getMPDEIcFlag
610 // Purpose : get function for MPDE initial condition flag (true if MPDE & IC
611 // Special Notes :
612 // Scope : public
613 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
614 // Creation Date : 01/31/08
615 //-----------------------------------------------------------------------------
617 {
618  if (!mpdeMgrPtr_)
619  {
620  return false;
621  }
622  return mpdeMgrPtr_->getMPDEIcFlag();
623 }
624 
625 
626 //-----------------------------------------------------------------------------
627 // Function : AnalysisManager::getWaMPDEFlag ()
628 // Purpose : "get" function for WaMPDE flag. (true if not IC)
629 // Special Notes :
630 // Scope : public
631 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
632 // Creation Date : 01/31/08
633 //-----------------------------------------------------------------------------
635 {
636  if (!mpdeMgrPtr_)
637  {
638  return false;
639  }
640  return mpdeMgrPtr_->getWaMPDEFlag();
641 }
642 
643 //-----------------------------------------------------------------------------
644 // Function : AnalysisManager::isPaused
645 //
646 // Purpose : return the true if the simulation is currently paused
647 //
648 // Special Notes :
649 // Scope : public
650 // Creator : Rich Schiek, SNL, Electrical and Microsystems Simulation
651 // Creation Date : 02/18/2008
652 //-----------------------------------------------------------------------------
654 {
655  return stepErrorControl_->isPauseTime();
656 }
657 
658 //-----------------------------------------------------------------------------
659 // Function : AnalysisManager::initializeAll
660 // Purpose : This function performs the final initializations. Mainly,
661 // it initializes the two data container classes, DataStore and
662 // StepErrorControl. It also registers the neccessary vectors
663 // with the LAS system class.
664 // Special Notes : This function should *only* be called after all the
665 // registrations have all been performed. In particular, the
666 // N_LAS_System class *must* be registered before this function
667 // is called.
668 // Scope : public
669 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
670 // Creation Date : 6/09/00
671 //-----------------------------------------------------------------------------
672 bool AnalysisManager::initializeAll(N_LOA_Loader * tmpLoaderPtr)
673 {
674  static Stats::Stat initialize_stat("Initialize", rootStat_);
675 
676  Stats::TimeBlock x(initialize_stat);
677 
678  if (!linearSystem_)
679  {
680  Report::DevelFatal0().in("AnalysisManager::initializeAll")
681  << "Register LAS system first.";
682  }
683 
684  tiaParams_.solutionSize = linearSystem_->getSolutionSize();
685  tiaParams_.stateSize = linearSystem_->getStateSize();
686 
687  // allocate data store class, which will allocate all the vectors.
688 #ifdef Xyce_DEBUG_ANALYSIS
689  if (tiaParams_.debugLevel > 0)
690  {
691  Xyce::dout() << "AnalysisManager::initializeAll. " ;
692  Xyce::dout() << " maximum order = " << tiaParams_.maxOrder << std::endl;
693  }
694 #endif
695 
696  // Allocate circuit loader: (must be before step error control allocation)
697  if (tmpLoaderPtr==0)
698  {
699  loader_ = cktLoaderPtr_ = new N_LOA_CktLoader();
700  cktLoaderPtr_->registerDeviceInterface(devInterfacePtr_);
701  }
702  else
703  {
704  loader_ = tmpLoaderPtr;
705  }
706 
707  delete tiaDataStore_;
710 
711  delete stepErrorControl_;
713 
714  if (mpdeMgrPtr_)
715  {
716  mpdeMgrPtr_->registerApplicationLoader(loader_);
717  }
718 
719  // Now that data store has been created, we can also create the
720  // working integration method object.
721  delete workingIntgMethod_;
724 
725  // allocate nls equation loader (must be after sec and wim allocation)
728  nonlinearEquationLoaderPtr_->registerDeviceInterface(devInterfacePtr_);
729 
731 
732  tiaMPDEIfacePtr_->registerTIADataStore(&*tiaDataStore_);
733  tiaMPDEIfacePtr_->registerTIAStepErrorControl(&*stepErrorControl_);
734  // The final time has to be forced to be a "paused" breakpoint,
735  // after any registerTIAParams call.
736  // RLS: May need to conditionally call this only when this is an MPDE run
737  // not sure if we know that when this routine is called.
738  //setPauseTime(tiaParams_.finalTime);
739 
742 
743  // register current:
744  linearSystem_->registerCurrStaVector(&(tiaDataStore_->currStatePtr));
745  linearSystem_->registerCurrSolVector(&(tiaDataStore_->currSolutionPtr));
746 
747  // register next:
748  linearSystem_->registerNextStaVector(&(tiaDataStore_->nextStatePtr));
749  linearSystem_->registerNextSolVector(&(tiaDataStore_->nextSolutionPtr));
750 
751  // register last:
752  linearSystem_->registerLastStaVector(&(tiaDataStore_->lastStatePtr));
753  linearSystem_->registerLastSolVector(&(tiaDataStore_->lastSolutionPtr));
754 
755  linearSystem_->registerFlagSolVector(&(tiaDataStore_->flagSolutionPtr));
756 
757  // register temporaries:
758  linearSystem_->registerTmpSolVector(&(tiaDataStore_->tmpSolVectorPtr));
759  linearSystem_->registerTmpStaVector(&(tiaDataStore_->tmpStaVectorPtr));
760  linearSystem_->registerTmpStaDerivVector(&(tiaDataStore_->tmpStaDerivPtr));
761  linearSystem_->registerTmpStaDivDiffVector(&(tiaDataStore_->tmpStaDivDiffPtr));
762 
763  // register next derivatives:
764  linearSystem_->registerNextSolDerivVector(&(tiaDataStore_->nextSolutionDerivPtr));
765  linearSystem_->registerNextStaDerivVector(&(tiaDataStore_->nextStateDerivPtr));
766 
767  // register the device mask
768  linearSystem_->registerDeviceMaskVector(&(tiaDataStore_->deviceMaskPtr));
769 
770  // Get the RHS and the Jacobian
771  tiaDataStore_->JMatrixPtr = linearSystem_->getJacobianMatrix();
772  tiaDataStore_->RHSVectorPtr = linearSystem_->getRHSVector();
773 
774  // DAE formulation vectors
775  linearSystem_->registerDAEQVector ( tiaDataStore_->daeQVectorPtr );
776  linearSystem_->registerDAEFVector ( tiaDataStore_->daeFVectorPtr );
777  linearSystem_->registerDAEBVector ( tiaDataStore_->daeBVectorPtr );
778 
779  // DAE formulation matrices
780  linearSystem_->registerDAEdQdxMatrix ( tiaDataStore_->dQdxMatrixPtr );
781  linearSystem_->registerDAEdFdxMatrix ( tiaDataStore_->dFdxMatrixPtr );
782 
783  // Get the limiter vectors
784  tiaDataStore_->dFdxdVpVectorPtr = linearSystem_->getdFdxdVpVector ();
785  tiaDataStore_->dQdxdVpVectorPtr = linearSystem_->getdQdxdVpVector ();
786 
787  tiaDataStore_->limiterFlag = loader_->getLimiterFlag ();
788 
789  // This should probably be moved elsewhere later. If the user has
790  // specified that steps should only be accepted when the nonlinear solver
791  // truly converges, then the "nearConvergence" return code needs to be
792  // negative. ERK. 7/02/03
793  if ( !(tiaParams_.nlNearConvFlag) )
794  {
795  N_NLS_ReturnCodes retCodes;
796  retCodes.nearConvergence = -3;
797  nlsMgrPtr_->setReturnCodes(retCodes);
798  }
799 
800  // same for the "small update" case.
801  if ( !(tiaParams_.nlSmallUpdateFlag) )
802  {
803  N_NLS_ReturnCodes retCodes;
804  retCodes.smallUpdate = -4;
805  nlsMgrPtr_->setReturnCodes(retCodes);
806  }
807 
808  // check if analysis was specified. If not, but .OP was specified,
809  // then set up a DC calculation.
811  {
812  if ( dotOpSpecified_ )
813  {
816  }
817  else // flag an error.
818  {
819  Report::UserError0() << "No analysis statement in the netlist";
820  return false;
821  }
822  }
823 
824  // Allocate analysis objects, and also set up params.
826 
827  initializeAllFlag_ = true;
828  return true;
829 }
830 
831 //-----------------------------------------------------------------------------
832 // Function : AnalysisManager::run
833 // Purpose : Execute the control loop for the set analysis type.
834 // Special Notes :
835 // Scope : public
836 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
837 // Creation Date : 01/24/08
838 //-----------------------------------------------------------------------------
840 {
841  std::string msg;
842 
843  if (initializeAllFlag_ == false)
844  {
845  Report::DevelFatal0().in("AnalysisManager::run")
846  << "Call the initializeAll function first";
847  }
848 
850  {
851  Report::UserError0() << "No analysis statement in the netlist";
852  return false;
853  }
854 
855  // now that the problem is set up, we can tell the datastore what the var type are
856  // this info can be used by the time integrator to control error in a way that is
857  // appropriate for different variable types (like V's and I's).
858  std::vector<char> varTypes;
859  topoMgrPtr_->returnVarTypeVec( varTypes );
860  tiaDataStore_->varTypeVec = varTypes;
861 
862  bool runStatus = false;
863  {
864  // This prepares the outputters for this analysis mode
865  IO::ActiveOutput active(outputManagerAdapter_->getOutputManager());
866 
867  active.setStepSweep(outputManagerAdapter_->getStepParamVec());
868  active.setDCSweep(outputManagerAdapter_->getDCParamVec());
869  active.add(pdsMgrPtr_->getPDSComm()->comm(), analysisMode_);
870 
871 #ifdef Xyce_VERBOSE_TIME
873 #endif
874 
875 #ifndef Xyce_NO_MASKED_WRMS_NORMS
876  if (loader_->loadDeviceMask())
877  {
878  //Xyce::dout() << " Nontrivial mask! " << std::endl;
879  }
880  else
881  {
882  // Xyce::dout() << " Trivial mask! " << std::endl;
883  }
884 #endif
885 
886  // 6/24/2010: ERK Note: this needs a refactor!
887  // For HB and MPDE, it is necessary to reallocate different analysis types as the simulation
888  // progresses fr// om the initial condition phase to the block analysis phase. For example,
889  // in MPDE, it is common to solve a DC, then a series of transients, and then the full MPDE
890  // simulation.
891  //
892  // I recently moved some stuff from the analysis manager down into specific analysis type
893  // classes, which is where they really belong. However, doing this required that the
894  // order of setup change somewhat. DC and sweep parameters now cannot be processed until
895  // the DCSweep or Step classes are allocated. They are now primarily allocated
896  // in the intializeAll function. They need to be allocated prior to this ::run function,
897  // because they need to happen before restart files are read in.
898  //
899  // However, to preserve MPDE and HB, there has to be an option of reallocating analysis
900  // classes here. So, that is still the case, but this should be refactored to make
901  // it cleaner.
902  if ( getBlockAnalysisFlag () )
903  {
905  }
906 
907  Report::safeBarrier(pdsMgrPtr_->getPDSComm()->comm());
908 
909  solverStartTime_ = elapsedTimerPtr_->elapsedTime();
910 
911  // Start the solvers timers.
912  xyceTranTimerPtr_->resetStartTime();
913 
914  runStatus = analysisObject_->run();
915 
917  {
918  conductanceTest ();
919  }
920  }
921 
922  return runStatus;
923 }
924 
925 //-----------------------------------------------------------------------------
926 // Function : AnalysisManager::allocateAnalysisObject_
927 // Purpose : Allocate analysis objects, and also setup params.
928 // Special Notes :
929 // Scope : private
930 // Creator : Eric Keiter, SNL
931 // Creation Date : 06/24/10
932 //-----------------------------------------------------------------------------
934 {
935  std::string msg("");
936 
937  if( !tiaParams_.resume )
938  {
940  {
941  analysisObject_ = Teuchos::rcp(new Transient(*this));
942  analysisObject_->setAnalysisParams(tranParamsBlock);
944  }
945  else if (analysisMode_ == ANP_MODE_DC_SWEEP)
946  {
947  analysisObject_ = Teuchos::rcp(new DCSweep(*this));
948  for (int i=0;i<(int)dcParamsBlockVec.size();++i)
949  {
950  analysisObject_->setAnalysisParams(dcParamsBlockVec[i]);
951  }
952  }
953  else if (analysisMode_ == ANP_MODE_MPDE)
954  {
955  analysisObject_ = Teuchos::rcp(new MPDE(*this));
956  analysisObject_->setAnalysisParams(mpdeParamsBlock);
957  }
958  else if (analysisMode_ == ANP_MODE_HB)
959  {
960  analysisObject_ = Teuchos::rcp(new HB(*this));
961  analysisObject_->setAnalysisParams(hbParamsBlock);
962  Teuchos::rcp_dynamic_cast<HB>(analysisObject_)->setHBOptions(hbOptionsBlock);
963  Teuchos::rcp_dynamic_cast<HB>(analysisObject_)->setHBLinSol(hbLinSolBlock);
964  Teuchos::rcp_dynamic_cast<HB>(analysisObject_)->setLinSol(linSolBlock);
965  setHBFlag( true );
966  }
967  else if ( analysisMode_ == ANP_MODE_AC)
968  {
969  analysisObject_ = Teuchos::rcp(new AC(*this));
970  analysisObject_->setAnalysisParams(acParamsBlock);
971  }
972  else if ( analysisMode_ == ANP_MODE_MOR)
973  {
974  analysisObject_ = Teuchos::rcp(new MOR(*this));
975  analysisObject_->setAnalysisParams(morParamsBlock);
976  }
977  else
978  {
979  Report::UserError0() << "Unknown type of analysis";
980  return;
981  }
982 
983  if( !is_null(analysisObject_) )
984  {
985  analysisObject_->setParamsWithOutputMgrAdapter ( *outputManagerAdapter_ );
986  }
987 
988  // need to throw an error here as this really shouldn't happen.
989  if( is_null( analysisObject_ ) )
990  {
991  Report::DevelFatal0().in("AnalysisManager::initializeAll")
992  << "Unable to allocate analysis type";
993  }
994 
995  // ultimately sensitivity calculation should get its own analysis object.
996  if (sensFlag_)
997  {
998  analysisObject_->setSensFlag();
999  }
1000 
1001  // The primary analysis object is stored in case there is an outer
1002  // loop analysis such as .STEP or .DAKOTA. Many accessors such
1003  // as "getStepNumber" need to access this object rather than the
1004  // step object.
1006 
1007  if( stepLoopFlag_ )
1008  {
1010  analysisObject_ = Teuchos::rcp(new Step(*this, *stepAnalysisTarget_.get()));
1011  for (int i=0;i<(int)stepParamsBlockVec.size();++i)
1012  {
1013  analysisObject_->setAnalysisParams(stepParamsBlockVec[i]);
1014  }
1015  analysisObject_->setParamsWithOutputMgrAdapter ( *outputManagerAdapter_ );
1016  }
1017 
1018  if (dakotaRunFlag_ && is_null(dakotaAnalysisTarget_) )
1019  {
1021  analysisObject_ = Teuchos::rcp(new Dakota(*this, *dakotaAnalysisTarget_.get()));
1022  analysisObject_->setAnalysisParams(dakotaParamsBlock);
1023  analysisObject_->setParamsWithOutputMgrAdapter ( *outputManagerAdapter_ );
1024  }
1025  }
1026 }
1027 
1028 //-----------------------------------------------------------------------------
1029 // Function : AnalysisManager::printLoopInfo
1030 // Purpose : Prints out time loop information.
1031 // Special Notes : Prints stats from save point start to save point finish.
1032 // Special case 0,0 is entire run to this point
1033 // Scope : public
1034 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1035 // Creation Date : 6/26/00
1036 //-----------------------------------------------------------------------------
1037 bool AnalysisManager::printLoopInfo(int start, int finish)
1038 {
1039  return primaryAnalysisObject_->printLoopInfo (start,finish);
1040 }
1041 
1042 //-----------------------------------------------------------------------------
1043 // Function : AnalysisManager::testDCOPOutputTime_
1044 // Purpose : Similar to testOutputTime, except that this is for
1045 // DCOP restart files.
1046 // Special Notes :
1047 // Scope : public
1048 // Creator : Eric Keiter, SNL
1049 // Creation Date : 10/18/07
1050 //-----------------------------------------------------------------------------
1052 {
1053  bool flag(true);
1054 
1055  if( !dcopRestartFlag_ )
1056  {
1057  flag = false;
1058  }
1059 
1060  return flag;
1061 }
1062 
1063 //-----------------------------------------------------------------------------
1064 // Function : AnalysisManager::testSaveOutputTime_
1065 // Purpose : Similar to testOutputTime, except that this is for
1066 // .SAVE files.
1067 // Special Notes : Only outputs 1x.
1068 // Scope : public
1069 // Creator : Eric Keiter, SNL
1070 // Creation Date : 10/18/07
1071 //-----------------------------------------------------------------------------
1073 {
1074  bool flag(true);
1075 
1076  if( !saveFlag_ )
1077  {
1078  flag = false;
1079  }
1081  {
1082  flag = false;
1083  }
1084  else if (savedAlready_)
1085  {
1086  flag = false;
1087  }
1088 
1089  if (flag==true)
1090  {
1091  savedAlready_ = true;
1092  Xyce::dout() <<"Calling SAVE outputs!" <<std::endl;
1093  }
1094 
1095  return flag;
1096 }
1097 
1098 //-----------------------------------------------------------------------------
1099 // Function : AnalysisManager::testRestartSaveTime_
1100 // Purpose :
1101 // Special Notes :
1102 // Scope : public
1103 // Creator : Rob Hoekstra, SNL, Parallel ComputationalSciences.
1104 // Creation Date : 07/31/01
1105 //-----------------------------------------------------------------------------
1107 ()
1108 {
1109  bool flag;
1110 
1111 #ifdef Xyce_DEBUG_RESTART
1112  Xyce::dout() << "TESTING FOR RESTART SAVE" << std::endl
1113  << Xyce::subsection_divider << std::endl
1114  << "stepErrorControl_->currentTime: " << stepErrorControl_->currentTime << std::endl
1115  << "nextSaveTime: " << nextRestartSaveTime_ << std::endl
1116  << "initialRestartInterval_: " << initialRestartInterval_ << std::endl;
1117  if (!(restartIntervals_.empty()))
1118  {
1119  Xyce::dout() << "First restart interval: " << restartIntervals_[0].first << std::endl;
1120  }
1121  else
1122  {
1123  Xyce::dout() << "restartIntervals_ is empty" << std::endl;
1124  }
1125 #endif
1126 
1127  if (initialRestartInterval_ == 0.0)
1128  {
1129  flag = false;
1130  }
1131  else if (stepErrorControl_->currentTime < nextRestartSaveTime_)
1132  {
1133  flag = false;
1134  }
1135  else if (restartIntervals_.empty())
1136  {
1137  while (nextRestartSaveTime_ <= stepErrorControl_->currentTime)
1138  {
1139  nextRestartSaveTime_ += initialRestartInterval_;
1140  }
1141  flag = true;
1142  }
1143  else if (stepErrorControl_->currentTime < restartIntervals_[0].first)
1144  {
1145  while (nextRestartSaveTime_ <= stepErrorControl_->currentTime)
1146  {
1147  nextRestartSaveTime_ += initialRestartInterval_;
1148  }
1149  if (nextRestartSaveTime_ > restartIntervals_[0].first)
1150  {
1151  nextRestartSaveTime_ = restartIntervals_[0].first;
1152  }
1153  flag = true;
1154  }
1155  else
1156  {
1157  std::pair<double, double> currInterval, nextInterval;
1158  int size = restartIntervals_.size();
1159  for (int i = 0; i < size; ++i)
1160  {
1161  if (restartIntervals_[i].first <= stepErrorControl_->currentTime)
1162  {
1163  currInterval = restartIntervals_[i];
1164  if ((i+1) < (int)restartIntervals_.size())
1165  {
1166  nextInterval = restartIntervals_[i+1];
1167  }
1168  }
1169  }
1170  int step = static_cast <int> ((stepErrorControl_->currentTime-currInterval.first) /
1171  currInterval.second);
1172  nextRestartSaveTime_ = currInterval.first + (step+1)*currInterval.second;
1173 
1174  if (nextInterval.first && (nextInterval.first!=currInterval.first)
1175  && (nextRestartSaveTime_>=nextInterval.first))
1176  {
1177  nextRestartSaveTime_ = nextInterval.first;
1178  }
1179  flag = true;
1180  }
1181 
1182 #ifdef Xyce_DEBUG_RESTART
1183  Xyce::dout() << "new nextSaveTime: " << nextRestartSaveTime_ << std::endl
1184  << "restart flag: " << flag << std::endl
1185  << Xyce::subsection_divider << std::endl;
1186 #endif
1187 
1188  return flag;
1189 }
1190 
1191 
1192 //-----------------------------------------------------------------------------
1193 // Function : AnalysisManager::partialTimeDerivative
1194 // Purpose : Returns the current partial time derivative for either the
1195 // solution or state vector.
1196 // Special Notes :
1197 // Scope : public
1198 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1199 // Creation Date : 6/12/00
1200 //-----------------------------------------------------------------------------
1202 {
1203  double partDT = workingIntgMethod_->partialTimeDeriv();
1204 
1205  // Add a check here to try to prevent capacitive spiral of death.
1206  // This is still a "research" option, so is not on by default.
1208  {
1209 #ifdef Xyce_DEBUG_ANALYSIS
1210  if (tiaParams_.debugLevel > 0)
1211  {
1212  Xyce::dout() << "AnalysisManager::partialTimeDerivative.";
1213  Xyce::dout() << " Using jac limit = " << tiaParams_.jacLimit << std::endl;
1214  }
1215 #endif
1216  if (partDT > tiaParams_.jacLimit)
1217  {
1218  partDT = tiaParams_.jacLimit;
1219  }
1220  }
1221 
1222  return partDT;
1223 }
1224 
1225 //-----------------------------------------------------------------------------
1226 // Function : AnalysisManager::getBreakpointTol
1227 // Purpose : Returns the breakpoint tolerance.
1228 // Special Notes :
1229 // Scope : public
1230 // Creator : Tom Russo, SNL, Component Information and Models
1231 // Creation Date : 03/7/02
1232 //-----------------------------------------------------------------------------
1234 {
1235  return N_UTL_BreakPoint::getBPTol();
1236 }
1237 
1238 //-----------------------------------------------------------------------------
1239 // Function : AnalysisManager::setBreakpointTol
1240 // Purpose : Sets the breakpoint tolerance.
1241 // Special Notes :
1242 // Scope : public
1243 // Creator : Tom Russo, SNL, Component Information and Models
1244 // Creation Date : 03/7/02
1245 //-----------------------------------------------------------------------------
1247 {
1248  N_UTL_BreakPoint::setBPTol(bptol);
1249 }
1250 
1251 //-----------------------------------------------------------------------------
1252 // Function : AnalysisManager::registerRestartIntervals
1253 // Purpose :
1254 // Special Notes :
1255 // Scope : public
1256 // Creator : Rob Hoekstra, SNL, Computational Sciences
1257 // Creation Date : 07/31/01
1258 //-----------------------------------------------------------------------------
1260 {
1261  double initInt;
1262  std::vector< std::pair<double,double> > intPairs;
1263  restartPtr_->getRestartIntervals(initInt, intPairs);
1264  initialRestartInterval_ = initInt;
1266  restartIntervals_ = intPairs;
1267  return true;
1268 }
1269 
1270 //-----------------------------------------------------------------------------
1271 // Function : AnalysisManager::registerOutputIntevals
1272 // Purpose :
1273 // Special Notes :
1274 // Scope : public
1275 // Creator : Rob Hoekstra, SNL, Computational Sciences
1276 // Creation Date : 07/31/01
1277 //-----------------------------------------------------------------------------
1279 {
1280  double initInt;
1281  std::vector< std::pair<double,double> > intPairs;
1282  outputManagerAdapter_->getOutputIntervals( initInt, & intPairs );
1283  initialOutputInterval_ = initInt;
1285  outputIntervals_ = intPairs;
1286  return true;
1287 }
1288 
1289 //-----------------------------------------------------------------------------
1290 // Function : AnalysisManager::setTranAnalysisParams
1291 // Purpose : Sets transient analysis parameters (from .TRAN)
1292 // Special Notes :
1293 // Scope : public
1294 // Creator : Eric R. Keiter, SNL, Computational Sciences
1295 // Creation Date : 04/17/02
1296 //-----------------------------------------------------------------------------
1298  const N_UTL_OptionBlock & paramsBlock)
1299 {
1300  analysisParamsRegistered = true;
1302  tranParamsBlock = paramsBlock; // save a copy for later.
1303  return true;
1304 }
1305 
1306 //-----------------------------------------------------------------------------
1307 // Function : AnalysisManager::setDCAnalysisParams
1308 // Purpose : Sets the DC sweep calculation parameters (from .DC)
1309 //
1310 // Special Notes : This function will be called multiple times if there is more
1311 // than one sweep variable. The parser separates each variable
1312 // into separate option blocks prior to calling this function.
1313 //
1314 // Scope : public
1315 // Creator : Eric R. Keiter, SNL
1316 // Creation Date : 04/18/02
1317 //-----------------------------------------------------------------------------
1319  (const N_UTL_OptionBlock & paramsBlock)
1320 {
1321  analysisParamsRegistered = true;
1322  analysisMode_ = ANP_MODE_DC_SWEEP;
1323  // before saving a copy of paramsBlock, check and see if it already
1324  // is in the dcParamsBlockVec. If so then replace the original copy.
1325  // This replacement is necessary if the first copy had an expression
1326  // element that was resolved in later parsing.
1327 
1328  bool foundMatch = false;
1329  std::vector<N_UTL_OptionBlock>::iterator paramsBlockVecItr = dcParamsBlockVec.begin();
1330  std::vector<N_UTL_OptionBlock>::iterator paramsBlockVecEnd = dcParamsBlockVec.end();
1331  while( paramsBlockVecItr != paramsBlockVecEnd )
1332  {
1333  if( paramsBlockVecItr->compareParamLists( paramsBlock ) )
1334  {
1335  // these are the same
1336  foundMatch = true;
1337  break;
1338  }
1339  paramsBlockVecItr++;
1340  }
1341 
1342  if( foundMatch )
1343  {
1344  // replace the existing one with the new one
1345  *paramsBlockVecItr = paramsBlock;
1346  }
1347  else
1348  {
1349  // save the new one.
1350  dcParamsBlockVec.push_back (paramsBlock); // save a copy for later.
1351  }
1352  return true;
1353 }
1354 
1355 //-----------------------------------------------------------------------------
1356 // Function : AnalysisManager::setOPAnalysisParams
1357 // Purpose : Handle OP statement. (.OP)
1358 // Special Notes :
1359 // Scope : public
1360 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1361 // Creation Date : 10/15/07
1362 //-----------------------------------------------------------------------------
1364  const N_UTL_OptionBlock & paramsBlock)
1365 {
1366  dotOpSpecified_ = true;
1367  opParamsBlock = paramsBlock; // save a copy for later.
1368  return true;
1369 }
1370 
1371 //-----------------------------------------------------------------------------
1372 // Function : AnalysisManager::setSTEPAnalysisParams
1373 // Purpose : Sets the STEP calculation parameters. (from .STEP)
1374 // Special Notes :
1375 // Scope : public
1376 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1377 // Creation Date : 10/30/03
1378 //-----------------------------------------------------------------------------
1380  const N_UTL_OptionBlock & paramsBlock)
1381 {
1382  stepLoopFlag_ = true;
1383  // before saving a copy of paramsBlock, check and see if it already
1384  // is in the stepParamsBlockVec. If so then replace the original copy.
1385  // This replacement is necessary if the first copy had an expression
1386  // element that was resolved in later parsing.
1387  bool foundMatch = false;
1388  std::vector<N_UTL_OptionBlock>::iterator paramsBlockVecItr = stepParamsBlockVec.begin();
1389  std::vector<N_UTL_OptionBlock>::iterator paramsBlockVecEnd = stepParamsBlockVec.end();
1390  while( paramsBlockVecItr != paramsBlockVecEnd )
1391  {
1392  if( paramsBlockVecItr->compareParamLists( paramsBlock ) )
1393  {
1394  // these are the same
1395  foundMatch = true;
1396  break;
1397  }
1398  paramsBlockVecItr++;
1399  }
1400 
1401  if( foundMatch )
1402  {
1403  // replace the existing one with the new one
1404  *paramsBlockVecItr = paramsBlock;
1405  }
1406  else
1407  {
1408  // save the new one.
1409  stepParamsBlockVec.push_back (paramsBlock); // save a copy for later.
1410  }
1411  return true;
1412 }
1413 
1414 //-----------------------------------------------------------------------------
1415 // Function : AnalysisManager::setSaveOptions
1416 // Purpose : Sets the Save parameters.
1417 // Special Notes : Most of these parameters are handled in the output manager,
1418 // rather than here. So, most params are a noop here, except
1419 // for "TIME".
1420 // Scope : public
1421 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1422 // Creation Date : 10/18/07
1423 //-----------------------------------------------------------------------------
1425  const N_UTL_OptionBlock & OB)
1426 {
1427 #ifdef Xyce_DEBUG_ANALYSIS
1428  if (tiaParams_.debugLevel > 0)
1429  {
1430  Xyce::dout() << "In AnalysisManager::setSaveOptions" << std::endl;
1431  }
1432 #endif
1433 
1434  saveFlag_ = true;
1435 
1436  Util::ParameterList::const_iterator iterPL = OB.getParams().begin();
1437  Util::ParameterList::const_iterator iterPL_end = OB.getParams().end();
1438 
1439  while (iterPL != iterPL_end)
1440  {
1441 #ifdef Xyce_DEBUG_IO
1442  Xyce::dout() << "iterPL->tag = " << iterPL->tag() << std::endl;
1443 #endif
1444  if (iterPL->tag() == "TYPE")
1445  {
1446  // noop
1447  }
1448  else if (iterPL->tag() == "FILE")
1449  {
1450  // noop
1451  }
1452  else if (iterPL->tag() == "TIME")
1453  {
1454  saveTime_ = iterPL->getImmutableValue<double>();
1455  saveTimeGiven_ = true;
1456  }
1457  else if (iterPL->tag() == "LEVEL")
1458  {
1459  // noop
1460  }
1461  else
1462  {
1463  // noop. If it gets here there is an error on the .SAVE line.
1464  // However, the IO manager has a trap for this, so do nothing
1465  // here.
1466  }
1467 
1468  ++iterPL;
1469  }
1470 
1471  return true;
1472 }
1473 
1474 //-----------------------------------------------------------------------------
1475 // Function : AnalysisManager::setACAnalysisParams
1476 // Purpose : Sets the AC sweep calculation parameters (from .AC)
1477 //
1478 // Special Notes :
1479 // Scope : public
1480 // Creator : Eric R. Keiter, SNL
1481 // Creation Date : 04/18/02
1482 //-----------------------------------------------------------------------------
1484  (const N_UTL_OptionBlock & paramsBlock)
1485 {
1486  analysisParamsRegistered = true;
1487  analysisMode_ = ANP_MODE_AC;
1488  acParamsBlock = paramsBlock; // save a copy for later.
1489  return true;
1490 }
1491 
1492 //-----------------------------------------------------------------------------
1493 // Function : AnalysisManager::setMORAnalysisParams
1494 // Purpose : Sets the MOR calculation parameters (from .MOR)
1495 //
1496 // Special Notes :
1497 // Scope : public
1498 // Creator : Heidi Thornquist and Ting Mei, SNL
1499 // Creation Date : 05/29/12
1500 //-----------------------------------------------------------------------------
1502  (const N_UTL_OptionBlock & paramsBlock)
1503 {
1504  analysisParamsRegistered = true;
1505  analysisMode_ = ANP_MODE_MOR;
1506  morParamsBlock = paramsBlock; // save a copy for later.
1507  return true;
1508 }
1509 
1510 //-----------------------------------------------------------------------------
1511 // Function : AnalysisManager::setMOROptions
1512 // Purpose :
1513 // Special Notes : These are from '.options mor'
1514 // Scope : public
1515 // Creator : Heidi Thornquist and Ting Mei, SNL
1516 // Creation Date : 05/31/12
1517 //-----------------------------------------------------------------------------
1518 bool AnalysisManager::setMOROptions(const N_UTL_OptionBlock & OB)
1519 {
1520  Util::ParameterList::const_iterator it_tpL;
1521  Util::ParameterList::const_iterator first = OB.getParams().begin();
1522  Util::ParameterList::const_iterator last = OB.getParams().end();
1523 
1524  for (it_tpL = first; it_tpL != last; ++it_tpL)
1525  {
1526  if (it_tpL->uTag()=="METHOD")
1527  {
1528  ExtendedString stringVal ( it_tpL->stringValue() );
1529  stringVal.toUpper();
1530  tiaParams_.morMethod = stringVal;
1531  }
1532  else if (it_tpL->uTag()=="SAVEREDSYS")
1533  {
1534  tiaParams_.morSaveRedSys = static_cast<bool>(it_tpL->getImmutableValue<int>());
1535  }
1536  else if (it_tpL->uTag()=="COMPORIGTF")
1537  {
1538  tiaParams_.morCompOrigTF = static_cast<bool>(it_tpL->getImmutableValue<int>());
1539  }
1540  else if (it_tpL->uTag()=="COMPREDTF")
1541  {
1542  tiaParams_.morCompRedTF = static_cast<bool>(it_tpL->getImmutableValue<int>());
1543  }
1544  else if (it_tpL->uTag()=="COMPTYPE")
1545  {
1546  ExtendedString stringVal ( it_tpL->stringValue() );
1547  stringVal.toUpper();
1548  tiaParams_.morCompType = stringVal;
1549  }
1550  else if (it_tpL->uTag()=="COMPNP")
1551  {
1552  tiaParams_.morCompNP = it_tpL->getImmutableValue<int>();
1553  }
1554  else if (it_tpL->uTag()=="COMPFSTART")
1555  {
1556  tiaParams_.morCompFStart = it_tpL->getImmutableValue<double>();
1557  }
1558  else if (it_tpL->uTag()=="COMPFSTOP")
1559  {
1560  tiaParams_.morCompFStop = it_tpL->getImmutableValue<double>();
1561  }
1562  else if (it_tpL->uTag()=="EXPPOINT")
1563  {
1564  tiaParams_.morExpPoint = it_tpL->getImmutableValue<double>();
1565  }
1566  else if (it_tpL->uTag()=="SCALETYPE")
1567  {
1568  tiaParams_.morScaleType = it_tpL->getImmutableValue<int>();
1569  }
1570  else if (it_tpL->uTag()=="SCALEFACTOR")
1571  {
1572  tiaParams_.morScaleFactor = it_tpL->getImmutableValue<double>();
1573  }
1574  else if (it_tpL->uTag()=="SCALEFACTOR1")
1575  {
1576  tiaParams_.morScaleFactor1 = it_tpL->getImmutableValue<double>();
1577  }
1578  else if (it_tpL->uTag()=="SPARSIFICATIONTYPE")
1579  {
1580  tiaParams_.morSparsificationType = it_tpL->getImmutableValue<int>();
1581  }
1582  else
1583  {
1584  Report::UserError0() << it_tpL->uTag() << " is not a recognized model-order reduction option.";
1585  }
1586  }
1587 
1588  // If we are computing the transfer function, make sure the frequency range is valid.
1590  {
1592  {
1593  Report::UserError() << ".options mor COMPFSTART = " << tiaParams_.morCompFStart << " > " << tiaParams_.morCompFStop << " = COMPFSTOP!";
1594  }
1595  }
1596 
1597  return true;
1598 }
1599 
1600 //-----------------------------------------------------------------------------
1601 // Function : AnalysisManager::setDCOPRestartParams
1602 // Purpose : Sets the DCOP restart parameters.
1603 // Special Notes : Most of the dcop restart parameters are used and handled by
1604 // the IO::OutputMgr class, so this function here doens't need
1605 // to do very much.
1606 // Scope : public
1607 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1608 // Creation Date : 10/18/07
1609 //-----------------------------------------------------------------------------
1610 bool AnalysisManager::setDCOPRestartParams(const N_UTL_OptionBlock & OB)
1611 {
1612  dcopRestartFlag_ = true;
1613 
1614  Util::ParameterList::const_iterator iterPL = OB.getParams().begin();
1615  Util::ParameterList::const_iterator iterPL_end = OB.getParams().end();
1616 
1617  while (iterPL != iterPL_end)
1618  {
1619 #ifdef Xyce_DEBUG_IO
1620  Xyce::dout() << "iterPL->tag = " << iterPL->tag() << std::endl;
1621 #endif
1622 
1623  if (iterPL->tag() == "INPUT")
1624  {
1625  // do nothing, this is handled in the output manager.
1626  }
1627  else if (iterPL->tag() == "OUTPUT")
1628  {
1629  // do nothing, this is handled in the output manager.
1630  }
1631  else if (iterPL->tag() == "TIME")
1632  {
1633  saveTime_ = iterPL->getImmutableValue<double>();
1634  saveTimeGiven_ = true;
1635  }
1636  else
1637  {
1638  // noop. If it gets here there is an error on the .SAVE line.
1639  // However, the IO manager has a trap for this, so do nothing
1640  // here.
1641  }
1642 
1643  ++iterPL;
1644  }
1645 
1646  return true;
1647 }
1648 
1649 //-----------------------------------------------------------------------------
1650 // Function : AnalysisManager::setTranOptions
1651 // Purpose :
1652 // Special Notes : These are from '.options timeint'
1653 // Scope : public
1654 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1655 // Creation Date : 04/18/02
1656 //-----------------------------------------------------------------------------
1657 bool AnalysisManager::setTranOptions(const N_UTL_OptionBlock & OB)
1658 {
1659  Util::ParameterList::const_iterator it_tpL;
1660  Util::ParameterList::const_iterator first = OB.getParams().begin();
1661  Util::ParameterList::const_iterator last = OB.getParams().end();
1662 
1663  for (it_tpL = first; it_tpL != last; ++it_tpL)
1664  {
1665  if (it_tpL->uTag()=="METHOD")
1666  {
1667 // tiaParams_.integrationMethod=it_tpL->iVal();
1668 
1669  if (it_tpL->isInteger())
1670  tiaParams_.integrationMethod=it_tpL->getImmutableValue<int>();
1671  else
1672  {
1673 
1674  ExtendedString stringVal ( it_tpL->stringValue() );
1675  stringVal.toUpper();
1676 
1677  if (stringVal == "TRAP" || stringVal == "TRAPEZOIDAL")
1679  else if (stringVal == "BDF")
1681  else if (stringVal == "GEAR")
1683  else
1684  {
1685  Report::UserError0() << "Unsupported transient method type";
1686  }
1687  }
1688 
1689  }
1690 #ifdef Xyce_DEBUG_ANALYSIS
1691  else if (it_tpL->uTag()=="CONSTSTEP")
1692  {
1694  = static_cast<bool> (it_tpL->getImmutableValue<int>());
1695  }
1696 #endif
1697  else if (it_tpL->uTag()=="USEDEVICEMAX")
1698  {
1699  tiaParams_.useDeviceTimeStepMax = static_cast<bool> (it_tpL->getImmutableValue<int>());
1700  }
1701  else if (it_tpL->uTag()=="RELTOL")
1702  {
1703  tiaParams_.relErrorTol=it_tpL->getImmutableValue<double>();
1705  }
1706  else if (it_tpL->uTag()=="ABSTOL")
1707  {
1708  tiaParams_.absErrorTol=it_tpL->getImmutableValue<double>();
1709  }
1710  else if (it_tpL->uTag()=="DOUBLEDCOPSTEP")
1711  {
1712  tiaParams_.doubleDCOPStep=it_tpL->getImmutableValue<int>();
1713  }
1714  else if (it_tpL->uTag()=="FIRSTDCOPSTEP")
1715  {
1716  tiaParams_.firstDCOPStep=it_tpL->getImmutableValue<int>();
1717  }
1718  else if (it_tpL->uTag()=="LASTDCOPSTEP")
1719  {
1720  tiaParams_.lastDCOPStep=it_tpL->getImmutableValue<int>();
1721  }
1722  else if (it_tpL->uTag()=="BPENABLE" )
1723  {
1724  tiaParams_.bpEnable = static_cast<bool> (it_tpL->getImmutableValue<int>());
1725  }
1726  else if (it_tpL->uTag()=="RESTARTSTEPSCALE" )
1727  {
1728  tiaParams_.restartTimeStepScale=it_tpL->getImmutableValue<double>();
1729  }
1730  else if (it_tpL->uTag()=="EXITTIME" )
1731  {
1732  tiaParams_.exitTime=it_tpL->getImmutableValue<double>();
1733  }
1734  else if (it_tpL->uTag()=="EXITSTEP" )
1735  {
1736  tiaParams_.exitStep=it_tpL->getImmutableValue<int>();
1737  }
1738  else if (it_tpL->uTag() == "MINTIMESTEPSBP")
1739  {
1740  tiaParams_.minTimeStepsBP = it_tpL->getImmutableValue<int>();
1742  }
1743  else if (it_tpL->uTag()=="ERROPTION" )
1744  {
1745  tiaParams_.errorAnalysisOption=it_tpL->getImmutableValue<int>();
1746  // tscoffe/tmei 12/7/07: If error option = 1 (NO LTE) then make sure minTimeStepBP is enabled.
1748  {
1750  {
1752  }
1753  }
1754  }
1755  else if (it_tpL->uTag()=="NLNEARCONV" )
1756  {
1757  tiaParams_.nlNearConvFlag = static_cast<bool> (it_tpL->getImmutableValue<int>());
1758  }
1759  else if (it_tpL->uTag()=="NLSMALLUPDATE" )
1760  {
1761  tiaParams_.nlSmallUpdateFlag = static_cast<bool> (it_tpL->getImmutableValue<int>());
1762  }
1763  else if (it_tpL->uTag()=="JACLIMITFLAG" )
1764  {
1765  tiaParams_.jacLimitFlag= static_cast<bool> (it_tpL->getImmutableValue<int>());
1766  }
1767  else if (it_tpL->uTag()=="JACLIMIT" )
1768  {
1769  tiaParams_.jacLimit = it_tpL->getImmutableValue<double>();
1770  }
1771  else if (it_tpL->uTag()=="DAESTATEDERIV" )
1772  {
1773  daeStateDerivFlag_ = static_cast<bool> (it_tpL->getImmutableValue<int>());
1774  }
1775  else if (it_tpL->uTag()=="MAXORD" )
1776  {
1777  tiaParams_.maxOrder = it_tpL->getImmutableValue<int>();
1778  }
1779  else if (it_tpL->uTag()=="MINORD" )
1780  {
1781  tiaParams_.minOrder = it_tpL->getImmutableValue<int>();
1782  }
1783  else if (it_tpL->uTag()=="TIMESTEPSREVERSAL" )
1784  {
1785  tiaParams_.timestepsReversal =it_tpL->getImmutableValue<bool>();
1786  }
1787  else if (it_tpL->uTag()=="TESTFIRSTSTEP" )
1788  {
1789  tiaParams_.testFirstStep = static_cast<bool> (it_tpL->getImmutableValue<int>());
1790  }
1791  else if (it_tpL->uTag()=="DELMAX" )
1792  {
1793  tiaParams_.delmax =it_tpL->getImmutableValue<double>();
1794  tiaParams_.delmaxGiven = true;
1795 // tiaParams_.delmax =it_tpL->iVal();
1796  }
1797  else if (it_tpL->uTag()=="NLMIN" )
1798  {
1799  tiaParams_.NLmin=it_tpL->getImmutableValue<int>();
1800  }
1801  else if (it_tpL->uTag()=="NLMAX" )
1802  {
1803  tiaParams_.NLmax=it_tpL->getImmutableValue<int>();
1804  }
1805  else if (it_tpL->uTag()=="OUTPUTINTERPMPDE")
1806  {
1807  tiaParams_.outputInterpMPDE = static_cast<bool> (it_tpL->getImmutableValue<int>());
1808  }
1809  else if (it_tpL->uTag()=="NEWLTE")
1810  {
1811  tiaParams_.newLte =it_tpL->getImmutableValue<double>();
1812  }
1813  else if (it_tpL->uTag()=="NEWBPSTEPPING")
1814  {
1815  tiaParams_.newBPStepping = it_tpL->getImmutableValue<double>();
1816  }
1817  else if (it_tpL->uTag()=="INTERPOUTPUT")
1818  {
1819  tiaParams_.interpOutputFlag = static_cast<bool> (it_tpL->getImmutableValue<int>());
1820  }
1821  else if (it_tpL->uTag()=="CONDTEST")
1822  {
1823  tiaParams_.condTestFlag = static_cast<bool> (it_tpL->getImmutableValue<int>());
1824  }
1825  else if (it_tpL->uTag()=="CONDTESTDEVICENAME")
1826  {
1827  tiaParams_.condTestDeviceNames.push_back(it_tpL->stringValue() );
1828  }
1829  else if (it_tpL->uTag() == "DTMIN")
1830  {
1831  tiaParams_.userSpecMinTimeStep = it_tpL->getImmutableValue<double>();
1833  }
1834  else if (it_tpL->uTag() == "PASSNLSTALL")
1835  {
1836  tiaParams_.passNLStall = it_tpL->getImmutableValue<bool>();
1837  }
1838  else if (it_tpL->uTag() == "FASTTESTS")
1839  {
1840  tiaParams_.fastTests = it_tpL->getImmutableValue<bool>();
1841  }
1842  else if (it_tpL->uTag() == "MINTIMESTEPRECOVERY")
1843  {
1844  tiaParams_.minTimeStepRecoveryCounter = it_tpL->getImmutableValue<int>();
1845  }
1846  else if (it_tpL->uTag()=="VOLTZEROTOL" )
1847  {
1848  tiaParams_.voltZeroTol=it_tpL->getImmutableValue<double>();
1849  }
1850  else if (it_tpL->uTag()=="CURRZEROTOL" )
1851  {
1852  tiaParams_.currZeroTol=it_tpL->getImmutableValue<double>();
1853  }
1854  else if (it_tpL->uTag()=="DEBUGLEVEL" )
1855  {
1856 #ifdef Xyce_DEBUG_TIME
1857  // set (or override) debug levels based on command line options
1858  if ( commandLine_.argExists( "-tdl" ) )
1859  {
1860  tiaParams_.debugLevel = atoi( commandLine_.getArgumentValue( "-tdl" ).c_str() );
1861  }
1862 
1863  else
1864  {
1865  tiaParams_.debugLevel = it_tpL->getImmutableValue<int>();
1866  }
1867 #endif
1868  }
1869  else if (it_tpL->uTag()=="HISTORYTRACKINGDEPTH" )
1870  {
1871  tiaParams_.historyTrackingDepth = it_tpL->getImmutableValue<int>();
1872  }
1873  else
1874  {
1875  Report::UserError() << it_tpL->uTag() << " is not a recognized time integration option";
1876  }
1877  }
1878 
1880  {
1881  Report::UserError() << ".options timeint NLMIN = " << tiaParams_.NLmin << " > " << tiaParams_.NLmax << " = NLMAX!";
1882  }
1883 
1888 
1889  // check for maximum order on the command line
1890  if ( commandLine_.argExists ("-maxord") )
1891  {
1892 
1894  atoi( commandLine_.getArgumentValue( "-maxord" ).c_str() );
1895  }
1896 
1897  if ( tiaParams_.maxOrder < 1) tiaParams_.maxOrder = 1;
1898  if ( tiaParams_.maxOrder > 5) tiaParams_.maxOrder = 5;
1899 
1900  if (tiaParams_.newLte == true)
1901  {
1902  if (tiaParams_.relErrorTolGiven != true)
1903  tiaParams_.relErrorTol = 1.0e-3;
1904  }
1905 
1906  return true;
1907 
1908 }
1909 
1910 //-----------------------------------------------------------------------------
1911 // Function : AnalysisManager::setMPDEAnalysisParams
1912 // Purpose : Sets the MPDE sweep calculation parameters (from .MPDE)
1913 // Special Notes :
1914 // Scope : public
1915 // Creator : Todd Coffey, 1414
1916 // Creation Date : 7/23/08
1917 //-----------------------------------------------------------------------------
1918 bool AnalysisManager::setMPDEAnalysisParams(const N_UTL_OptionBlock & OB)
1919 {
1920  if (!mpdeMgrPtr_)
1921  {
1922  setupMPDEMgr_();
1923  }
1924  bool bsuccess = mpdeMgrPtr_->setMPDEAnalysisParams(OB);
1926  analysisParamsRegistered = true;
1927  mpdeParamsBlock = OB;
1928  return bsuccess;
1929 }
1930 
1931 //-----------------------------------------------------------------------------
1932 // Function : AnalysisManager::setMPDEOptions
1933 // Purpose :
1934 // Special Notes : from '.options mpdeint'
1935 // Scope : public
1936 // Creator : Todd Coffey, 1414
1937 // Creation Date : 7/23/08
1938 //-----------------------------------------------------------------------------
1939 bool AnalysisManager::setMPDEOptions(const N_UTL_OptionBlock & OB)
1940 {
1941  if (!mpdeMgrPtr_)
1942  {
1943  setupMPDEMgr_();
1944  }
1945  mpdeMgrPtr_->setMPDEOptions(OB);
1946  return true;
1947 }
1948 
1949 //-----------------------------------------------------------------------------
1950 // Function : AnalysisManager::setHBAnalysisParams
1951 // Purpose : Sets the HB sweep calculation parameters (from .HB)
1952 // Special Notes :
1953 // Scope : public
1954 // Creator : Todd Coffey, Ting Mei
1955 // Creation Date : 7/30/08
1956 //-----------------------------------------------------------------------------
1957 bool AnalysisManager::setHBAnalysisParams(const N_UTL_OptionBlock & OB)
1958 {
1959  Util::ParameterList::const_iterator it_tpL;
1960  Util::ParameterList::const_iterator first = OB.getParams().begin();
1961  Util::ParameterList::const_iterator last = OB.getParams().end();
1962 
1963  for (it_tpL = first; it_tpL != last; ++it_tpL)
1964  {
1965  if (it_tpL->uTag() == "FREQ")
1966  {
1967 
1968  tiaParams_.freqs = it_tpL->getValue<std::vector<double> >();
1969  tiaParams_.freqGiven = true;
1970  }
1971  }
1972 
1973  if (tiaParams_.freqs[0] <= 0.0 )
1974  {
1975  Report::UserError() << "Frequency of oscillation " << tiaParams_.freqs[0] << " is less than or equal to zero, invalid .HB specification";
1976  }
1977 
1978  if ((DEBUG_ANALYSIS & tiaParams_.debugLevel) > 0)
1979  {
1980  dout() << section_divider << std::endl
1981  << "HB transient simulation parameters"
1982  //<< Util::push << std::endl
1983  << std::endl
1984  << "HB frequency = " << tiaParams_.freqs[0] << std::endl
1985  //<< Util::pop << std::endl;
1986  << std::endl;
1987  }
1988 
1989  setBlockAnalysisFlag( true );
1992  analysisParamsRegistered = true;
1993  hbParamsBlock = OB;
1994  return true;
1995 }
1996 
1997 //-----------------------------------------------------------------------------
1998 // Function : AnalysisManager::setHBOptions
1999 // Purpose :
2000 // Special Notes : from '.options hb'
2001 // Scope : public
2002 // Creator : Todd Coffey, 1414
2003 // Creation Date : 7/23/08
2004 //-----------------------------------------------------------------------------
2005 bool AnalysisManager::setHBOptions(const N_UTL_OptionBlock & OB)
2006 {
2007  hbOptionsBlock = OB;
2008  return true;
2009 }
2010 
2011 //-----------------------------------------------------------------------------
2012 // Function : AnalysisManager::setLinSol
2013 // Purpose :
2014 // Special Notes :
2015 // Scope : public
2016 // Creator : Eric R. Keiter, SNL
2017 // Creation Date : 07/12/2013
2018 //-----------------------------------------------------------------------------
2019 bool AnalysisManager::setLinSol(const N_UTL_OptionBlock & OB)
2020 {
2021  linSolBlock = OB;
2022  return true;
2023 }
2024 
2025 //-----------------------------------------------------------------------------
2026 // Function : AnalysisManager::setHBLinSol
2027 // Purpose :
2028 // Special Notes :
2029 // Scope : public
2030 // Creator : Heidi Thornquist, 1437
2031 // Creation Date : 11/11/08
2032 //-----------------------------------------------------------------------------
2033 bool AnalysisManager::setHBLinSol(const N_UTL_OptionBlock & OB)
2034 {
2035  hbLinSolBlock = OB;
2036  return true;
2037 }
2038 
2039 //-----------------------------------------------------------------------------
2040 // Function : AnalysisManager::setTRANMPDEOptions
2041 // Purpose :
2042 // Special Notes : from '.options timeint-mpde'
2043 // Scope : public
2044 // Creator : Todd Coffey, 1414
2045 // Creation Date : 7/23/08
2046 //-----------------------------------------------------------------------------
2047 bool AnalysisManager::setTRANMPDEOptions(const N_UTL_OptionBlock & OB)
2048 {
2049  if (!mpdeMgrPtr_)
2050  {
2051  setupMPDEMgr_();
2052  }
2053  mpdeMgrPtr_->registerTranMPDEOptions(OB);
2054  return true;
2055 }
2056 
2057 //-----------------------------------------------------------------------------
2058 // Function : AnalysisManager::setSensOptions
2059 // Purpose :
2060 // Special Notes :
2061 // Scope : public
2062 // Creator : Eric Keiter, Sandia
2063 // Creation Date : 6/5/13
2064 //-----------------------------------------------------------------------------
2065 bool AnalysisManager::setSensOptions(const N_UTL_OptionBlock & OB)
2066 {
2067  sensFlag_=true;
2068  return true;
2069 }
2070 
2071 //-----------------------------------------------------------------------------
2072 // Function : AnalysisManager::completeOPStartStep
2073 // Purpose : Call to rotate next state to current state following a
2074 // : constrained DCOP solve when using a previous operating point
2075 // Special Notes : Called from the Xyce-LOCA interface.
2076 // Scope : public
2077 // Creator : Dave Shirley
2078 // Creation Date : 06/27/2006
2079 //-----------------------------------------------------------------------------
2081 {
2082  bool bsuccess = true;
2083 
2084  bsuccess = tiaDataStore_->updateStateDataArrays ();
2087 
2088  return bsuccess;
2089 }
2090 
2091 //-----------------------------------------------------------------------------
2092 // Function : AnalysisManager::completeHomotopyStep
2093 // Purpose : Call to do final cleanup after a single,
2094 // successful homotopy step.
2095 // Special Notes : Called from the Xyce-LOCA interface.
2096 // Scope : public
2097 // Creator : Eric Keiter, SNL
2098 // Creation Date : 03/20/2006
2099 //-----------------------------------------------------------------------------
2101  ( const std::vector<std::string> & paramNames,
2102  const std::vector<double> & paramVals,
2103  N_LAS_Vector * solnVecPtr )
2104 {
2105  bool bsuccess = true;
2106 
2107 #ifdef Xyce_DEBUG_ANALYSIS
2108  std::string netListFile = commandLine_.getArgumentValue("netlist");
2109  Xyce::dout() << "\n " << netListFile;
2110  Xyce::dout() << " AnalysisManager::completeHomotopyStep " << std::endl;
2111 #endif
2112 
2113  // Rotate the data vectors:
2114  bool bs1 = tiaDataStore_->updateStateDataArrays (); bsuccess = bsuccess && bs1;
2115  tiaDataStore_->setConstantHistory();
2116  tiaDataStore_->equateTmpVectors();
2117 
2118  // Pass info in to the lower level solver:
2119  loader_->homotopyStepSuccess (paramNames,paramVals);
2120 
2121  // Call output
2122  outputManagerAdapter_->outputHomotopy( paramNames, paramVals, *solnVecPtr );
2123 
2124  return bsuccess;
2125 }
2126 
2127 //-----------------------------------------------------------------------------
2128 // Function : AnalysisManager::failHomotopyStep
2129 // Purpose : Call to do final cleanup after a single,
2130 // failed homotopy step.
2131 // Special Notes : Called from the Xyce-LOCA interface.
2132 // Scope : public
2133 // Creator : Eric Keiter, SNL
2134 // Creation Date : 03/30/2006
2135 //-----------------------------------------------------------------------------
2137 {
2138  bool bsuccess = true;
2139 
2140 #ifdef Xyce_DEBUG_ANALYSIS
2141  std::string netListFile = commandLine_.getArgumentValue("netlist");
2142  Xyce::dout() << "\n " << netListFile;
2143  Xyce::dout() << " AnalysisManager::failHomotopyStep " << std::endl;
2144 #endif
2145 
2146  // Pass info in to the lower level solver:
2147  loader_->homotopyStepFailure ();
2148 
2149  return bsuccess;
2150 }
2151 
2152 //-----------------------------------------------------------------------------
2153 // Function : AnalysisManager::setupMPDEMgr_
2154 // Purpose :
2155 // Special Notes :
2156 // Scope : private
2157 // Creator : Todd Coffey, 1414
2158 // Creation Date : 7/23/08
2159 //-----------------------------------------------------------------------------
2161 {
2162  // Allocate new MPDE Manager
2163  mpdeMgrPtr_ = new N_MPDE_Manager(commandLine_);
2164 
2165  // Register MPDE manager with everything
2166  bool bs1 = true;
2167  bool bsuccess = true;
2168  bs1 = doMPDEregistrations_();
2169  bsuccess = bsuccess && bs1;
2170 
2171  if (!bsuccess)
2172  {
2173  Report::DevelFatal0().in("AnalysisManager::setupMPDEMgr_") << "Registration function failed";
2174  }
2175 }
2176 
2177 //-----------------------------------------------------------------------------
2178 // Function : AnalysisManager::registerPkgOptionsMgr
2179 // Purpose :
2180 // Special Notes :
2181 // Scope : public
2182 // Creator : Rich Schiek, 1437
2183 // Creation Date : 10/21/08
2184 //-----------------------------------------------------------------------------
2185 bool AnalysisManager::registerPkgOptionsMgr( IO::PkgOptionsMgr *pkgOptPtr )
2186 {
2187  pkgOptMgrPtr_ = pkgOptPtr;
2188 
2189  // this work was in the constructor, but now we don't know the pkgOptMgrPtr_ until
2190  // it is registered. So, do this work now.
2191  std::string netListFile = "";
2192  if (commandLine_.getArgumentValue("netlist") != "")
2193  {
2194  netListFile = commandLine_.getArgumentValue("netlist");
2195  }
2196 
2197  pkgOptMgrPtr_->submitRegistration(
2198  "TIMEINT", netListFile, new AnalysisManager_TranOptionsReg( this ) );
2199 
2200  pkgOptMgrPtr_->submitRegistration(
2201  "TRAN", netListFile, new AnalysisManager_TransAnalysisReg( this ) );
2202 
2203  pkgOptMgrPtr_->submitRegistration(
2204  "RESULT", netListFile, new AnalysisManager_ResultOptionsReg( *this ) );
2205 
2206  pkgOptMgrPtr_->submitRegistration(
2207  "DC", netListFile, new AnalysisManager_DCAnalysisReg( this ) );
2208 
2209  pkgOptMgrPtr_->submitRegistration(
2210  "OP", netListFile, new AnalysisManager_OPAnalysisReg( this ) );
2211 
2212  pkgOptMgrPtr_->submitRegistration(
2213  "STEP", netListFile, new AnalysisManager_STEPAnalysisReg( this ) );
2214 
2215  pkgOptMgrPtr_->submitRegistration(
2216  "OP_IO", netListFile, new AnalysisManager_DCOPOptionsReg( this ) );
2217 
2218  pkgOptMgrPtr_->submitRegistration(
2219  "SAVE", netListFile, new AnalysisManager_SaveOptionsReg( this ) );
2220 
2221  // MPDE specific netlist lines
2222  pkgOptMgrPtr_->submitRegistration(
2223  "MPDE", netListFile, new AnalysisManager_MPDE_AnalysisReg( this ) );
2224 
2225  pkgOptMgrPtr_->submitRegistration(
2226  "MPDEINT", netListFile, new AnalysisManager_MPDE_OptionsReg( this ) );
2227 
2228  pkgOptMgrPtr_->submitRegistration(
2229  "TIMEINT-MPDE", netListFile, new AnalysisManager_MPDE_TranMPDEOptionsReg( this ) );
2230 
2231  // HB Specific netlist lines
2232  pkgOptMgrPtr_->submitRegistration(
2233  "HB", netListFile, new AnalysisManager_HB_AnalysisReg( this ) );
2234 
2235  pkgOptMgrPtr_->submitRegistration(
2236  "HBINT", netListFile, new AnalysisManager_HB_OptionsReg( this ) );
2237 
2238  pkgOptMgrPtr_->submitRegistration(
2239  "LINSOL-HB", netListFile, new AnalysisManager_HB_LinSolReg( this ) );
2240 
2241  pkgOptMgrPtr_->submitRegistration(
2242  "LINSOL", netListFile, new AnalysisManager_LinSolReg( this ) );
2243 
2244  // AC Specific netlist lines
2245  pkgOptMgrPtr_->submitRegistration(
2246  "AC", netListFile, new AnalysisManager_AC_AnalysisReg( this ) );
2247 
2248  // MOR Specific netlist lines
2249  pkgOptMgrPtr_->submitRegistration(
2250  "MOR", netListFile, new AnalysisManager_MOR_AnalysisReg( this ) );
2251 
2252  // MOR Specific netlist lines
2253  pkgOptMgrPtr_->submitRegistration(
2254  "MOR_OPTS", netListFile, new AnalysisManager_MOR_OptionsReg( this ) );
2255 
2256  pkgOptMgrPtr_->submitRegistration(
2257  "SENS", netListFile, new AnalysisManager_SensOptionsReg( this ) );
2258 
2259  return true;
2260 }
2261 
2262 //-----------------------------------------------------------------------------
2263 // Function : AnalysisManager::doMPDEregistrations_
2264 // Purpose :
2265 // Special Notes :
2266 // Scope : private
2267 // Creator : Eric Keiter
2268 // Creation Date : 5/23/2014
2269 //-----------------------------------------------------------------------------
2271 {
2272  bool bs=true;
2273 
2274  if (mpdeMgrPtr_)
2275  {
2276  mpdeMgrPtr_->registerAnalysisManager(this);
2277  mpdeMgrPtr_->registerDeviceInterface(devInterfacePtr_);
2278  mpdeMgrPtr_->registerParallelManager(pdsMgrPtr_);
2279  mpdeMgrPtr_->registerTopology(topoMgrPtr_);
2280  mpdeMgrPtr_->registerRestartManager(restartPtr_);
2281  mpdeMgrPtr_->registerOutputManager(outMgrPtr_);
2282  mpdeMgrPtr_->registerApplicationLoader(loader_);
2283  mpdeMgrPtr_->registerNonlinearEquationLoader(nonlinearEquationLoaderPtr_);
2284  mpdeMgrPtr_->registerApplicationBuilder(appBuilderPtr_);
2285  mpdeMgrPtr_->registerLinearSystem(linearSystem_);
2286 
2287  mpdeMgrPtr_->registerTIAMPDEInterface(tiaMPDEIfacePtr_);
2288  }
2289  else
2290  {
2291  bs=false;
2292  }
2293  return bs;
2294 }
2295 
2296 //-----------------------------------------------------------------------------
2297 // Function : AnalysisManager::initializeTransientModel
2298 // Purpose : ModelEvaluator Interface
2299 // Special Notes :
2300 // Scope : private
2301 // Creator : Coffey, Schiek, Mei
2302 // Creation Date : 05/29/09
2303 //-----------------------------------------------------------------------------
2305 {
2307 }
2308 
2309 //-----------------------------------------------------------------------------
2310 // Function : AnalysisManager::evalTransientModel
2311 // Purpose : ModelEvaluator Interface
2312 // Special Notes :
2313 // Scope : private
2314 // Creator : Coffey, Schiek, Mei
2315 // Creation Date : 05/27/09
2316 //-----------------------------------------------------------------------------
2318  double t,
2319  N_LAS_Vector * SolVectorPtr,
2320  N_LAS_Vector * CurrSolVectorPtr,
2321  N_LAS_Vector * LastSolVectorPtr,
2322  N_LAS_Vector * StaVectorPtr,
2323  N_LAS_Vector * CurrStaVectorPtr,
2324  N_LAS_Vector * LastStaVectorPtr,
2325  N_LAS_Vector * StaDerivVectorPtr,
2326  N_LAS_Vector * StoVectorPtr,
2327  N_LAS_Vector * CurrStoVectorPtr,
2328  N_LAS_Vector * LastStoVectorPtr,
2329  N_LAS_Vector * stoLeadCurrQVectorPtr,
2330  N_LAS_Vector * QVectorPtr,
2331  N_LAS_Vector * FVectorPtr,
2332  N_LAS_Vector * BVectorPtr,
2333  N_LAS_Vector * dFdxdVpVectorPtr,
2334  N_LAS_Vector * dQdxdVpVectorPtr,
2335  N_LAS_Matrix * dQdxMatrixPtr,
2336  N_LAS_Matrix * dFdxMatrixPtr
2337  )
2338 {
2339  // This is F,Q load:
2340  bool bsuccess = loader_->loadDAEVectors(
2341  SolVectorPtr,
2342  CurrSolVectorPtr,
2343  LastSolVectorPtr,
2344  StaVectorPtr,
2345  CurrStaVectorPtr,
2346  LastStaVectorPtr,
2347  StaDerivVectorPtr,
2348  StoVectorPtr,
2349  CurrStoVectorPtr,
2350  LastStoVectorPtr,
2351  stoLeadCurrQVectorPtr,
2352  QVectorPtr,
2353  FVectorPtr,
2354  BVectorPtr,
2355  dFdxdVpVectorPtr,
2356  dQdxdVpVectorPtr
2357  );
2358  // This is dQdx, dFdx load:
2359  bsuccess = bsuccess && loader_->loadDAEMatrices(
2360  SolVectorPtr,
2361  StaVectorPtr,
2362  StaDerivVectorPtr,
2363  StoVectorPtr,
2364  dQdxMatrixPtr,
2365  dFdxMatrixPtr);
2366  return bsuccess;
2367 }
2368 
2369 //-----------------------------------------------------------------------------
2370 // Function : AnalysisManager::evalTransientModelState
2371 // Purpose : ModelEvaluator Interface
2372 // Special Notes :
2373 // Scope : private
2374 // Creator : Coffey, Schiek, Mei
2375 // Creation Date : 05/29/09
2376 //-----------------------------------------------------------------------------
2378  double t,
2379  N_LAS_Vector * SolVectorPtr,
2380  N_LAS_Vector * StaVectorPtr,
2381  N_LAS_Vector * StoVectorPtr
2382  )
2383 {
2384  // This is part of state vector load:
2387  loader_->updateSources(); // updates source values wrt time t.
2388  bool bsuccess = loader_->updateState(
2389  SolVectorPtr,
2390  SolVectorPtr,
2391  SolVectorPtr,
2392  StaVectorPtr,
2393  StaVectorPtr,
2394  StaVectorPtr,
2395  StoVectorPtr,
2396  StoVectorPtr,
2397  StoVectorPtr
2398  );
2399  return bsuccess;
2400 }
2401 
2402 // ***** Accessor methods *****
2403 //-----------------------------------------------------------------------------
2404 // Function : AnalysisManager::setBeginningIntegrationFlag
2405 // Purpose :
2406 // Special Notes :
2407 // Scope : public
2408 // Creator : Eric R. Keiter, SNL
2409 // Creation Date :
2410 //-----------------------------------------------------------------------------
2412 {
2413  primaryAnalysisObject_->setBeginningIntegrationFlag(bif);
2414 }
2415 
2416 //-----------------------------------------------------------------------------
2417 // Function : AnalysisManager::getBeginningIntegrationFlag
2418 // Purpose :
2419 // Special Notes :
2420 // Scope : public
2421 // Creator : Eric R. Keiter, SNL
2422 // Creation Date :
2423 //-----------------------------------------------------------------------------
2425 {
2426  return primaryAnalysisObject_->getBeginningIntegrationFlag();
2427 }
2428 
2429 //-----------------------------------------------------------------------------
2430 // Function : AnalysisManager::setIntegrationMethod
2431 // Purpose :
2432 // Special Notes :
2433 // Scope : public
2434 // Creator : Eric R. Keiter, SNL
2435 // Creation Date :
2436 //-----------------------------------------------------------------------------
2438 {
2439  primaryAnalysisObject_->setIntegrationMethod (im);
2440 }
2441 
2442 //-----------------------------------------------------------------------------
2443 // Function : AnalysisManager::getIntegrationMethod
2444 // Purpose :
2445 // Special Notes :
2446 // Scope : public
2447 // Creator : Eric R. Keiter, SNL
2448 // Creation Date :
2449 //-----------------------------------------------------------------------------
2451 {
2452  return primaryAnalysisObject_->getIntegrationMethod ();
2453 }
2454 
2455 
2456 //-----------------------------------------------------------------------------
2457 // Function : AnalysisManager::getTotalLinearSolutionTime
2458 // Purpose :
2459 // Special Notes :
2460 // Scope : public
2461 // Creator : Eric R. Keiter, SNL
2462 // Creation Date :
2463 //-----------------------------------------------------------------------------
2465 {
2466  return primaryAnalysisObject_->getTotalLinearSolutionTime();
2467 }
2468 
2469 //-----------------------------------------------------------------------------
2470 // Function : AnalysisManager::getTotalResidualLoadTime
2471 // Purpose :
2472 // Special Notes :
2473 // Scope : public
2474 // Creator : Eric R. Keiter, SNL
2475 // Creation Date :
2476 //-----------------------------------------------------------------------------
2478 {
2479  return primaryAnalysisObject_->getTotalResidualLoadTime();
2480 }
2481 
2482 //-----------------------------------------------------------------------------
2483 // Function : AnalysisManager::getTotalJacobianLoadTime
2484 // Purpose :
2485 // Special Notes :
2486 // Scope : public
2487 // Creator : Eric R. Keiter, SNL
2488 // Creation Date :
2489 //-----------------------------------------------------------------------------
2491 {
2492  return primaryAnalysisObject_->getTotalJacobianLoadTime();
2493 }
2494 
2495 //-----------------------------------------------------------------------------
2496 // Function : AnalysisManager::getDoubleDCOPEnabled ()
2497 // Purpose :
2498 // Special Notes :
2499 // Scope : public
2500 // Creator :
2501 // Creation Date :
2502 //-----------------------------------------------------------------------------
2504 {
2505  return primaryAnalysisObject_->getDoubleDCOPEnabled ();
2506 }
2507 
2508 //-----------------------------------------------------------------------------
2509 // Function : AnalysisManager::isSimulationComplete
2510 // Purpose : return boolean signifying whether simulation complete or
2511 // not.
2512 //
2513 // Special Notes :THIS VERSION IS ONLY VALID FOR TRANSIENT RUNS, where
2514 // completion of the simulation means integration to final
2515 // time.
2516 // Scope : public
2517 // Creator : Tom Russo, SNL, Component Information and Models
2518 // Creation Date : 05/06/2004
2519 //-----------------------------------------------------------------------------
2521 {
2523  {
2524  return (stepErrorControl_->isFinished());
2525  }
2526  else
2527  {
2528  Report::DevelFatal0().in("AnalysisManager::simulationComplete") << "Called for non-transient run, not currently valid";
2529  return false;
2530  }
2531 }
2532 
2533 //-----------------------------------------------------------------------------
2534 // Function : AnalysisManager::getPauseTime
2535 //
2536 // Purpose : return the time at which the simulation will pause
2537 //
2538 // Special Notes :
2539 // Scope : public
2540 // Creator : Tom Russo, SNL, Component Information and Models
2541 // Creation Date : 04/29/2004
2542 //-----------------------------------------------------------------------------
2544 {
2545  return(tiaParams_.pauseTime);
2546 }
2547 
2548 //-----------------------------------------------------------------------------
2549 // Function : AnalysisManager::getStepNumber
2550 // Purpose :
2551 // Special Notes :
2552 // Scope : public
2553 // Creator :
2554 // Creation Date : 12/16/2010
2555 //-----------------------------------------------------------------------------
2557 {
2558  int number=0;
2559  if( !is_null( primaryAnalysisObject_ ) )
2560  {
2561  number = primaryAnalysisObject_->getStepNumber();
2562  }
2563  return number;
2564 }
2565 
2566 //-----------------------------------------------------------------------------
2567 // Function : AnalysisManager::getTranStepNumber
2568 // Purpose :
2569 // Special Notes :
2570 // Scope : public
2571 // Creator :
2572 // Creation Date : 12/16/2010
2573 //-----------------------------------------------------------------------------
2575 {
2576  int number=0;
2578  {
2579  number = primaryAnalysisObject_->getTranStepNumber();
2580  }
2581  return number;
2582 }
2583 
2584 //-----------------------------------------------------------------------------
2585 // Function : AnalysisManager::setStepNumber
2586 // Purpose :
2587 // Special Notes :
2588 // Scope : public
2589 // Creator :
2590 // Creation Date : 12/16/2010
2591 //-----------------------------------------------------------------------------
2593 {
2594  if( !is_null( primaryAnalysisObject_ ) )
2595  {
2596  primaryAnalysisObject_->setStepNumber(step);
2597  }
2598 }
2599 
2600 //-----------------------------------------------------------------------------
2601 // Function : AnalysisManager::setTranStepNumber
2602 // Purpose :
2603 // Special Notes :
2604 // Scope : public
2605 // Creator :
2606 // Creation Date : 12/16/2010
2607 //-----------------------------------------------------------------------------
2609 {
2610  if( !is_null( primaryAnalysisObject_ ) )
2611  {
2612  primaryAnalysisObject_->setTranStepNumber(step);
2613  }
2614 }
2615 
2616 
2617 //-----------------------------------------------------------------------------
2618 // Function : AnalysisManager::getInitTranFlag
2619 // Purpose :
2620 // Special Notes :
2621 // Scope : public
2622 // Creator :
2623 // Creation Date : 12/16/2010
2624 //-----------------------------------------------------------------------------
2626 {
2627  int stepNum = getStepNumber();
2628  return (stepNum <= 0);
2629 }
2630 
2631 //-----------------------------------------------------------------------------
2632 // Function : AnalysisManager::getTime
2633 // Purpose : Gets the next time value.
2634 // Special Notes :
2635 // Scope : public
2636 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2637 // Creation Date : 6/27/00
2638 //-----------------------------------------------------------------------------
2640 {
2641  return stepErrorControl_->nextTime;
2642 }
2643 
2644 //-----------------------------------------------------------------------------
2645 // Function : AnalysisManager::getCurrentTime
2646 // Purpose : Gets the current time value.
2647 // Special Notes :
2648 // Scope : public
2649 // Creator : Richard Schiek, Electrical and Mems Modeling
2650 // Creation Date : 8/21/2009
2651 //-----------------------------------------------------------------------------
2653 {
2655 }
2656 
2657 //-----------------------------------------------------------------------------
2658 // Function : AnalysisManager::getFinalTime
2659 // Purpose : Gets the final time-step value.
2660 // Special Notes :
2661 // Scope : public
2662 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2663 // Creation Date : 6/27/00
2664 //-----------------------------------------------------------------------------
2666 {
2667  return stepErrorControl_->finalTime;
2668 }
2669 
2670 //-----------------------------------------------------------------------------
2671 // Function : AnalysisManager::getInitialTime
2672 // Purpose : Gets the initial time-step value.
2673 // Special Notes :
2674 // Scope : public
2675 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2676 // Creation Date : 6/27/00
2677 //-----------------------------------------------------------------------------
2679 {
2681 }
2682 
2683 //-----------------------------------------------------------------------------
2684 // Function : AnalysisManager::getStartingTimeStep
2685 // Purpose : Gets the starting time-step value.
2686 // Special Notes :
2687 // Scope : public
2688 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2689 // Creation Date : 6/27/00
2690 //-----------------------------------------------------------------------------
2692 {
2694 }
2695 
2696 //-----------------------------------------------------------------------------
2697 // Function : AnalysisManager::getTimeIntMode
2698 // Purpose : Gets the time-integration method.
2699 // Special Notes :
2700 // Scope : public
2701 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2702 // Creation Date : 03/02/01
2703 //-----------------------------------------------------------------------------
2705 {
2706  return primaryAnalysisObject_->getIntegrationMethod();
2707 }
2708 
2709 //-----------------------------------------------------------------------------
2710 // Function : AnalysisManager::getDCOPFlag
2711 // Purpose : Gets a flag indicating we are in steady state.
2712 // (steady=true)
2713 // Special Notes :
2714 // Scope : public
2715 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2716 // Creation Date : 03/02/01
2717 //-----------------------------------------------------------------------------
2719 {
2720  if ( !is_null(primaryAnalysisObject_) )
2721  {
2722  return (primaryAnalysisObject_->getDCOPFlag());
2723  }
2724  return false;
2725 }
2726 
2727 //-----------------------------------------------------------------------------
2728 // Function : AnalysisManager::getInputOPFlag
2729 // Purpose : Gets a flag indicating we are starting from a previous OP
2730 // Special Notes :
2731 // Scope : public
2732 // Creator : Dave Shirley, PSSI
2733 // Creation Date : 04/13/06
2734 //-----------------------------------------------------------------------------
2736 {
2737  return primaryAnalysisObject_->getInputOPFlag();
2738 }
2739 
2740 //-----------------------------------------------------------------------------
2741 // Function : AnalysisManager::getTranOPFlag
2742 // Purpose : Gets a flag indicating we are in a DCOP calculation that is
2743 // the initialization for a transient simulation.
2744 // Special Notes :
2745 // Scope : public
2746 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2747 // Creation Date : 02/28/05
2748 //-----------------------------------------------------------------------------
2750 {
2752  && (primaryAnalysisObject_->getIntegrationMethod())==TIAMethod_NONE);
2753 }
2754 
2755 //-----------------------------------------------------------------------------
2756 // Function : AnalysisManager::getACOPFlag
2757 // Purpose : Gets a flag indicating we are in a DCOP calculation that is
2758 // the initialization for a transient simulation.
2759 // Special Notes :
2760 // Scope : public
2761 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2762 // Creation Date : 04/16/12
2763 //-----------------------------------------------------------------------------
2765 {
2766  return ((analysisMode_ == ANP_MODE_AC || primaryAnalysisObject_->isAnalysis(ANP_MODE_AC))
2767  && (primaryAnalysisObject_->getIntegrationMethod())==TIAMethod_NONE);
2768 }
2769 
2770 //-----------------------------------------------------------------------------
2771 // Function : AnalysisManager::getDCSweepFlag
2772 // Purpose :
2773 // Special Notes :
2774 // Scope : public
2775 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2776 // Creation Date : 02/28/05
2777 //-----------------------------------------------------------------------------
2779 {
2781 }
2782 
2783 //-----------------------------------------------------------------------------
2784 // Function : AnalysisManager::getTransientFlag
2785 // Purpose :
2786 // Special Notes :
2787 // Scope : public
2788 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2789 // Creation Date : 02/28/05
2790 //-----------------------------------------------------------------------------
2792 {
2794  && (primaryAnalysisObject_->getIntegrationMethod()) !=TIAMethod_NONE));
2795 }
2796 
2797 //-----------------------------------------------------------------------------
2798 // Function : AnalysisManager::getDoubleDCOPStep
2799 // Purpose : Gets the double DC Operating Point step value.
2800 // Special Notes :
2801 // Scope : public
2802 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2803 // Creation Date : 04/25/01
2804 //-----------------------------------------------------------------------------
2806 {
2807  return primaryAnalysisObject_->getDoubleDCOPStep();
2808 }
2809 
2810 //-----------------------------------------------------------------------------
2811 // Function : AnalysisManager::getCurrentStepSize
2812 // Purpose : Returns the "current" time step size.
2813 // Special Notes :
2814 // Scope : public
2815 // Creator : Eric R. Keiter, SNL, Computational Sciences
2816 // Creation Date : 07/15/01
2817 //-----------------------------------------------------------------------------
2819 {
2821 }
2822 
2823 //-----------------------------------------------------------------------------
2824 // Function : AnalysisManager::getLastStepSize
2825 // Purpose : Returns the "last" time step size.
2826 // Special Notes :
2827 // Scope : public
2828 // Creator : Eric R. Keiter, SNL, Computational Sciences
2829 // Creation Date : 07/15/01
2830 //-----------------------------------------------------------------------------
2832 {
2834 }
2835 
2836 //-----------------------------------------------------------------------------
2837 // Function : AnalysisManager::updateDerivs
2838 // Purpose : Calls the time int. method to update the corrector
2839 // derivatives.
2840 // Special Notes :
2841 // Scope : public
2842 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2843 // Creation Date : 6/13/00
2844 //-----------------------------------------------------------------------------
2846 {
2848  return true;
2849 }
2850 
2851 //-----------------------------------------------------------------------------
2852 // Function : AnalysisManager::updateDivDiffs
2853 // Purpose : Updates the divided difference values.
2854 // Special Notes :
2855 // Scope : public
2856 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2857 // Creation Date : 6/27/00
2858 //-----------------------------------------------------------------------------
2860 {
2862  return true;
2863 }
2864 
2865 //-----------------------------------------------------------------------------
2866 // Function : AnalysisManager::updateDerivsBlock
2867 // Purpose :
2868 // Special Notes :
2869 // Scope : public
2870 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2871 // Creation Date : 01/10/01
2872 //-----------------------------------------------------------------------------
2874  const std::list<index_pair> & solGIDList,
2875  const std::list<index_pair> & staGIDList)
2876 {
2877  tiaDataStore_->computeDivDiffsBlock(solGIDList,staGIDList);
2878  workingIntgMethod_->updateDerivsBlock (solGIDList, staGIDList);
2879 
2880  return true;
2881 }
2882 
2883 //-----------------------------------------------------------------------------
2884 // Function : AnalysisManager::equateTmpVectors
2885 // Purpose :
2886 // Special Notes :
2887 // Scope : public
2888 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2889 // Creation Date : 01/24/02
2890 //-----------------------------------------------------------------------------
2892 {
2893  return tiaDataStore_->equateTmpVectors();
2894 }
2895 
2896 //-----------------------------------------------------------------------------
2897 // Function : AnalysisManager::registerElapsedTimer
2898 // Purpose :
2899 // Special Notes :
2900 // Scope : public
2901 // Creator : Dave Shirley, PSSI
2902 // Creation Date : 02/24/06
2903 //-----------------------------------------------------------------------------
2905 {
2906  elapsedTimerPtr_ = et;
2907 
2908  return true;
2909 }
2910 
2911 //-----------------------------------------------------------------------------
2912 // Function : AnalysisManager::restartDataSize
2913 // Purpose :
2914 // Special Notes :
2915 // Scope : public
2916 // Creator : Rob Hoekstra, SNL, Computational Sciences
2917 // Creation Date : 07/31/01
2918 //-----------------------------------------------------------------------------
2920 {
2921  return stepErrorControl_->restartDataSize( pack );
2922 }
2923 
2924 //-----------------------------------------------------------------------------
2925 // Function : AnalysisManager::dumpRestartData
2926 // Purpose :
2927 // Special Notes :
2928 // Scope : public
2929 // Creator : Rob Hoekstra, SNL, Computational Sciences
2930 // Creation Date : 07/31/01
2931 //-----------------------------------------------------------------------------
2933  (char * buf, int bsize, int & pos, N_PDS_Comm * comm, bool pack)
2934 {
2935  return stepErrorControl_->dumpRestartData(buf, bsize, pos, comm, pack);
2936 }
2937 
2938 //-----------------------------------------------------------------------------
2939 // Function : AnalysisManager::restoreRestartData
2940 // Purpose :
2941 // Special Notes :
2942 // Scope : public
2943 // Creator : Rob Hoekstra, SNL, Computational Sciences
2944 // Creation Date : 07/31/01
2945 //-----------------------------------------------------------------------------
2947  (char * buf, int bsize, int & pos, N_PDS_Comm * comm, bool pack)
2948 {
2949  return stepErrorControl_->restoreRestartData(buf, bsize, pos, comm, pack);
2950 }
2951 
2952 //-----------------------------------------------------------------------------
2953 // Function : AnalysisManager::getSolnVarData
2954 // Purpose :
2955 // Special Notes :
2956 // Scope : public
2957 // Creator : Rob Hoekstra, SNL, Computational Sciences
2958 // Creation Date : 07/31/01
2959 //-----------------------------------------------------------------------------
2960 bool AnalysisManager::getSolnVarData( const int & gid,
2961  std::vector<double> & varData )
2962 {
2963  return tiaDataStore_->getSolnVarData( gid, varData );
2964 }
2965 
2966 //-----------------------------------------------------------------------------
2967 // Function : AnalysisManager::getStateVarData
2968 // Purpose :
2969 // Special Notes :
2970 // Scope : public
2971 // Creator : Rob Hoekstra, SNL, Computational Sciences
2972 // Creation Date : 07/31/01
2973 //-----------------------------------------------------------------------------
2974 bool AnalysisManager::getStateVarData( const int & gid,
2975  std::vector<double> & varData )
2976 {
2977  return tiaDataStore_->getStateVarData( gid, varData );
2978 }
2979 
2980 //-----------------------------------------------------------------------------
2981 // Function : AnalysisManager::getStoreVarData
2982 // Purpose :
2983 // Special Notes :
2984 // Scope : public
2985 // Creator : Eric Keiter
2986 // Creation Date :
2987 //-----------------------------------------------------------------------------
2988 bool AnalysisManager::getStoreVarData( const int & gid,
2989  std::vector<double> & varData )
2990 {
2991  return tiaDataStore_->getStoreVarData( gid, varData );
2992 }
2993 
2994 //-----------------------------------------------------------------------------
2995 // Function : AnalysisManager::getOrder
2996 // Purpose :
2997 // Special Notes :
2998 // Scope : public
2999 // Creator : Eric Keiter, SNL, Computational Sciences
3000 // Creation Date : 02/15/07
3001 //-----------------------------------------------------------------------------
3003 {
3004  return workingIntgMethod_->getOrder();
3005 }
3006 
3007 //-----------------------------------------------------------------------------
3008 // Function : AnalysisManager::getNumberOfSteps
3009 // Purpose :
3010 // Special Notes :
3011 // Scope : public
3012 // Creator : Eric Keiter, SNL, Computational Sciences
3013 // Creation Date : 03/01/07
3014 //-----------------------------------------------------------------------------
3016 {
3018 }
3019 
3020 //-----------------------------------------------------------------------------
3021 // Function : AnalysisManager::getUsedOrder
3022 // Purpose :
3023 // Special Notes :
3024 // Scope : public
3025 // Creator : Eric Keiter, SNL, Computational Sciences
3026 // Creation Date : 03/01/07
3027 //-----------------------------------------------------------------------------
3029 {
3030  return workingIntgMethod_->getUsedOrder();
3031 }
3032 
3033 //-----------------------------------------------------------------------------
3034 // Function : AnalysisManager::getNscsco
3035 // Purpose :
3036 // Special Notes :
3037 // Scope : public
3038 // Creator : Eric Keiter, SNL, Computational Sciences
3039 // Creation Date : 03/01/07
3040 //-----------------------------------------------------------------------------
3042 {
3043  return workingIntgMethod_->getNscsco();
3044 }
3045 
3046 //-----------------------------------------------------------------------------
3047 // Function : AnalysisManager::setSolnVarData
3048 // Purpose :
3049 // Special Notes :
3050 // Scope : public
3051 // Creator : Rob Hoekstra, SNL, Computational Sciences
3052 // Creation Date : 07/31/01
3053 //-----------------------------------------------------------------------------
3054 bool AnalysisManager::setSolnVarData( const int & gid,
3055  const std::vector<double> & varData )
3056 {
3057  return tiaDataStore_->setSolnVarData( gid, varData );
3058 }
3059 
3060 //-----------------------------------------------------------------------------
3061 // Function : AnalysisManager::setStateVarData
3062 // Purpose :
3063 // Special Notes :
3064 // Scope : public
3065 // Creator : Rob Hoekstra, SNL, Computational Sciences
3066 // Creation Date : 07/31/01
3067 //-----------------------------------------------------------------------------
3068 bool AnalysisManager::setStateVarData( const int & gid,
3069  const std::vector<double> & varData )
3070 {
3071  return tiaDataStore_->setStateVarData( gid, varData );
3072 }
3073 
3074 //-----------------------------------------------------------------------------
3075 // Function : AnalysisManager::setStoreVarData
3076 // Purpose :
3077 // Special Notes :
3078 // Scope : public
3079 // Creator : Eric Keiter
3080 // Creation Date :
3081 //-----------------------------------------------------------------------------
3082 bool AnalysisManager::setStoreVarData( const int & gid,
3083  const std::vector<double> & varData )
3084 {
3085  return tiaDataStore_->setStoreVarData( gid, varData );
3086 }
3087 
3088 //-----------------------------------------------------------------------------
3089 // Function : AnalysisManager::registerTIAParams
3090 // Purpose :
3091 // Special Notes :
3092 // Scope : public
3093 // Creator : Eric R. Keiter, SNL, Computational Sciences
3094 // Creation Date : 09/06/01
3095 //-----------------------------------------------------------------------------
3097 {
3098  tiaParams_ = tia_params;
3099 
3100  if (stepErrorControl_)
3102 
3103  return true;
3104 }
3105 
3106 //-----------------------------------------------------------------------------
3107 // Function : AnalysisManager::registerLinearSystem
3108 // Purpose :
3109 // Special Notes :
3110 // Scope : public
3111 // Creator : Eric R. Keiter, SNL, Computational Sciences
3112 // Creation Date : 04/17/02
3113 //-----------------------------------------------------------------------------
3114 bool AnalysisManager::registerLinearSystem(N_LAS_System * linear_system)
3115 {
3116  linearSystem_ = linear_system;
3117 
3118  return true;
3119 }
3120 
3121 //-----------------------------------------------------------------------------
3122 // Function : AnalysisManager::registerNLSManager
3123 // Purpose :
3124 // Special Notes :
3125 // Scope : public
3126 // Creator : Eric R. Keiter, SNL, Computational Sciences
3127 // Creation Date : 04/17/02
3128 //-----------------------------------------------------------------------------
3130 {
3131  nlsMgrPtr_ = nlsMgrPtr_tmp;
3132 
3133  return true;
3134 }
3135 
3136 //-----------------------------------------------------------------------------
3137 // Function : AnalysisManager::registerLoader
3138 // Purpose :
3139 // Special Notes :
3140 // Scope : public
3141 // Creator : Eric R. Keiter, SNL, Computational Sciences
3142 // Creation Date : 04/18/02
3143 //-----------------------------------------------------------------------------
3144 bool AnalysisManager::registerLoader(N_LOA_Loader * loader)
3145 {
3146  loader_ = loader;
3147 
3148  return true;
3149 }
3150 
3151 //-----------------------------------------------------------------------------
3152 // Function : AnalysisManager::registerOutputMgr
3153 // Purpose :
3154 // Special Notes :
3155 // Scope : public
3156 // Creator : Eric R. Keiter, SNL, Computational Sciences
3157 // Creation Date : 04/18/02
3158 //-----------------------------------------------------------------------------
3159 bool AnalysisManager::registerOutputMgr(IO::OutputMgr * output_manager)
3160 {
3161  outMgrPtr_ = output_manager;
3162  outputManagerAdapter_ = new OutputMgrAdapter(pdsMgrPtr_->getPDSComm()->comm(), *this);
3163 
3165 
3166  return true;
3167 }
3168 
3169 //-----------------------------------------------------------------------------
3170 // Function : AnalysisManager::registerRestartMgr
3171 // Purpose :
3172 // Special Notes :
3173 // Scope : public
3174 // Creator : Eric R. Keiter, SNL, Computational Sciences
3175 // Creation Date : 04/18/02
3176 //-----------------------------------------------------------------------------
3178  IO::RestartMgr * restartPtr_tmp)
3179 {
3180  restartPtr_ = restartPtr_tmp;
3181 
3182  return true;
3183 }
3184 
3185 //-----------------------------------------------------------------------------
3186 // Function : AnalysisManager::registerDeviceInterface
3187 // Purpose :
3188 // Special Notes :
3189 // Scope : public
3190 // Creator : Todd Coffey, 1414
3191 // Creation Date : 07/23/08
3192 //-----------------------------------------------------------------------------
3194 {
3195  devInterfacePtr_ = devInterfacePtr_tmp;
3196  return true;
3197 }
3198 
3199 
3200 //-----------------------------------------------------------------------------
3201 // Function : AnalysisManager::registerTopology
3202 // Purpose :
3203 // Special Notes :
3204 // Scope : public
3205 // Creator : Todd Coffey, 1414
3206 // Creation Date : 07/23/08
3207 //-----------------------------------------------------------------------------
3208 bool AnalysisManager::registerTopology( N_TOP_Topology * topoMgrPtr_tmp )
3209 {
3210  topoMgrPtr_ = topoMgrPtr_tmp;
3211 
3212  return true;
3213 }
3214 
3215 
3216 //-----------------------------------------------------------------------------
3217 // Function : AnalysisManager::registerApplicationBuilder
3218 // Purpose :
3219 // Special Notes :
3220 // Scope : public
3221 // Creator : Todd Coffey, 1414
3222 // Creation Date : 07/23/08
3223 //-----------------------------------------------------------------------------
3224 bool AnalysisManager::registerApplicationBuilder( N_LAS_Builder * appBuilderPtr_tmp )
3225 {
3226  appBuilderPtr_ = appBuilderPtr_tmp;
3227 
3228  return true;
3229 }
3230 
3231 //-----------------------------------------------------------------------------
3232 // Function : AnalysisManager::registerParallelServices
3233 // Purpose :
3234 // Special Notes :
3235 // Scope : public
3236 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
3237 // Creation Date : 04/19/02
3238 //-----------------------------------------------------------------------------
3240 {
3241  pdsMgrPtr_ = pds;
3242 
3243  xyceTranTimerPtr_ = new Util::Timer(*pds->getPDSComm());
3244 
3245  return true;
3246 }
3247 
3248 //-----------------------------------------------------------------------------
3249 // Function : AnalysisManager::setNextSolVectorPtr
3250 // Purpose :
3251 // Special Notes :
3252 // Scope : public
3253 // Creator : Eric R. Keiter,SNL, Computational Sciences
3254 // Creation Date : 04/22/2003
3255 //-----------------------------------------------------------------------------
3256 bool AnalysisManager::setNextSolVectorPtr (N_LAS_Vector * solVecPtr)
3257 {
3258  return tiaDataStore_->setNextSolVectorPtr (solVecPtr);
3259 }
3260 
3261 //-----------------------------------------------------------------------------
3262 // Function : AnalysisManager::setPauseTime
3263 //
3264 // Purpose : Set the time at which to pause the simulation
3265 //
3266 // Special Notes : This is a temporary implementation that I'm using to
3267 // begin the process of hiding time integrator internals from
3268 // the "N_CIR_Xyce::simulateUntil" method, so that I can
3269 // ultimately change those internals without the simulateUntil
3270 // method
3271 // In the zero order version, just sets tiaParams_.pauseTime
3272 // Scope : public
3273 // Creator : Tom Russo, SNL, Component Information and Models
3274 // Creation Date : 04/29/2004
3275 //-----------------------------------------------------------------------------
3276 void AnalysisManager::setPauseTime(double pauseTime)
3277 {
3278  stepErrorControl_->setBreakPoint(N_UTL_BreakPoint(pauseTime, Util::PAUSE_BREAKPOINT));
3279 }
3280 
3281 
3282 
3283 //-----------------------------------------------------------------------------
3284 // Function : AnalysisManager::resumeSimulation
3285 //
3286 // Purpose : set flag to signify that simulation is continuation of
3287 // previously paused simulation.
3288 //
3289 // Special Notes : This is a temporary implementation that I'm using to
3290 // begin the process of hiding time integrator internals from
3291 // the "N_CIR_Xyce::simulateUntil" method, so that I can
3292 // ultimately change those internals without the simulateUntil
3293 // method
3294 // In the zero order version, just sets tiaParams_.resume=true
3295 // Scope : public
3296 // Creator : Tom Russo, SNL, Component Information and Models
3297 // Creation Date : 04/29/2004
3298 //-----------------------------------------------------------------------------
3300 {
3301  tiaParams_.resume=true;
3302 }
3303 
3304 //-----------------------------------------------------------------------------
3305 // Function : AnalysisManager::unset_resumeSimulation
3306 // Purpose : UN-set flag to signify that simulation is continuation of
3307 // previously paused simulation.
3308 // Special Notes :
3309 // Scope : public
3310 // Creator : Eric Keiter
3311 // Creation Date : 06/12/2013
3312 //-----------------------------------------------------------------------------
3314 {
3315  tiaParams_.resume=false;
3316 }
3317 
3318 //-----------------------------------------------------------------------------
3319 // Function : AnalysisManager::outputIntervalSpecified_
3320 // Purpose : Return true if user has specified output control options
3321 // Special Notes :
3322 // Scope : public
3323 // Creator : Tom Russo, SNL, Electrical and Microsystems modeling
3324 // Creation Date : 2/12/07
3325 //-----------------------------------------------------------------------------
3327 {
3328  // This is necessary and sufficient ---
3329  return (initialOutputInterval_ > 0.0);
3330 }
3331 
3332 // routines to get/set Dakota run flags and actually run a Dakota iteration
3333 //-----------------------------------------------------------------------------
3334 // Function : AnalysisManager::getDakotaRunFlag
3335 // Purpose :
3336 // Special Notes :
3337 // Scope : public
3338 // Creator : Richard Schiek
3339 // Creation Date :
3340 //-----------------------------------------------------------------------------
3342 {
3343  return dakotaRunFlag_;
3344 }
3345 
3346 
3347 //-----------------------------------------------------------------------------
3348 // Function : AnalysisManager::setDakotaRunFlag
3349 // Purpose :
3350 // Special Notes :
3351 // Scope : public
3352 // Creator : Richard Schiek
3353 // Creation Date :
3354 //-----------------------------------------------------------------------------
3356 {
3357  dakotaRunFlag_ = flag;
3358 }
3359 
3360 
3361 //-----------------------------------------------------------------------------
3362 // Function : AnalysisManager::getDakotaIteration
3363 // Purpose :
3364 // Special Notes :
3365 // Scope : public
3366 // Creator : Richard Schiek
3367 // Creation Date :
3368 //-----------------------------------------------------------------------------
3370 {
3371  return dakotaIterationNumber_;
3372 }
3373 
3374 //-----------------------------------------------------------------------------
3375 // Function : AnalysisManager::setDakotaIteration
3376 // Purpose :
3377 // Special Notes :
3378 // Scope : public
3379 // Creator : Richard Schiek
3380 // Creation Date :
3381 //-----------------------------------------------------------------------------
3383 {
3384  dakotaIterationNumber_ = iterNumber;
3385 }
3386 
3387 //-----------------------------------------------------------------------------
3388 // Function : AnalysisManager::getTimeIntInfo
3389 // Purpose :
3390 // Special Notes :
3391 // Scope : public
3392 // Creator : Eric Keiter
3393 // Creation Date :
3394 //-----------------------------------------------------------------------------
3396 {
3397  tiInfo.currentOrder = getOrder ();
3398  tiInfo.numberOfSteps = getNumberOfSteps ();
3399  tiInfo.usedOrder = getUsedOrder ();
3400  tiInfo.nscsco = getNscsco ();
3401 
3402  tiInfo.pdt = partialTimeDerivative(); // alpha/DT
3403  tiInfo.nextTimeStep = getCurrentStepSize();
3404  tiInfo.currTimeStep = getLastStepSize();
3406  tiInfo.nextTime = getTime();
3407  tiInfo.finalTime = getFinalTime();
3409  tiInfo.bpTol = getBreakpointTol();
3410 
3411  tiInfo.dcopFlag = getDCOPFlag ();
3412  tiInfo.inputOPFlag = getInputOPFlag ();
3413  tiInfo.tranopFlag = getTranOPFlag ();
3414  tiInfo.acopFlag = getACOPFlag ();
3415  tiInfo.transientFlag = getTransientFlag ();
3416  tiInfo.dcsweepFlag = getDCSweepFlag ();
3418 
3419  tiInfo.timeStepNumber = getStepNumber();
3420  tiInfo.initTranFlag = getInitTranFlag ();
3422 
3423  tiInfo.doubleDCOPStep = getDoubleDCOPStep();
3425 
3426  tiInfo.stepLoopIter = 0;
3427  if( stepLoopFlag_ )
3428  {
3429  analysisObject_->getStepIter();
3430  }
3431 
3432  tiInfo.timeIntMode = getTimeIntMode();
3433 }
3434 
3435 //-----------------------------------------------------------------------------
3436 // Function : AnalysisManager::silenceProgress
3437 // Purpose : Shut up "Percent Complete" noises
3438 // Special Notes :
3439 // Scope : public
3440 // Creator : Tom Russo
3441 // Creation Date : 11 Feb 2009
3442 //-----------------------------------------------------------------------------
3444 {
3445  progressFlag_ = false;
3446 }
3447 
3448 //-----------------------------------------------------------------------------
3449 // Function : AnalysisManager::enableProgress
3450 // Purpose : stop shutting up "Percent Complete" noises
3451 // Special Notes :
3452 // Scope : public
3453 // Creator : Tom Russo
3454 // Creation Date : 11 Feb 2009
3455 //-----------------------------------------------------------------------------
3457 {
3458  progressFlag_ = true;
3459 }
3460 
3461 N_PDS_Comm &
3463  return *pdsMgrPtr_->getPDSComm();
3464 }
3465 
3466 //-----------------------------------------------------------------------------
3467 // Function : anpAnalysisModeToNLS
3468 // Purpose : Converte between N_NLS_Manager.h AnalysisMode enum and
3469 // : expanded ANP_AnalysisManager.h ANP_Analysis_Mode enum.
3470 // Special Notes :
3471 // Scope :
3472 // Creator : Todd Coffey, 1414
3473 // Creation Date : 07/23/08
3474 //-----------------------------------------------------------------------------
3476 {
3477  Nonlinear::AnalysisMode outMode;
3478  if (mode == ANP_MODE_TRANSIENT)
3479  {
3480  outMode = Nonlinear::TRANSIENT;
3481  }
3482  else if (mode == ANP_MODE_DC_OP)
3483  {
3484  outMode = Nonlinear::DC_OP;
3485  }
3486  else if (mode == ANP_MODE_DC_SWEEP)
3487  {
3488  outMode = Nonlinear::DC_SWEEP;
3489  }
3490  else if (mode == ANP_MODE_HB)
3491  {
3492  outMode = Nonlinear::HB_MODE;
3493  }
3494  else
3495  {
3496  outMode = Nonlinear::NUM_MODES; // Should be this be TRANSIENT?
3497  }
3498  return outMode;
3499 }
3500 
3501 } // namespace Analysis
3502 } // namespace Xyce