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.113.2.1 $
36 // Revision Date : $Date: 2014/03/04 23:50:53 $
37 // Current Owner : $Author: tvrusso $
38 //-----------------------------------------------------------------------------
39 
40 #include <Xyce_config.h>
41 
42 
43 // ---------- Standard Includes ----------
44 #include <N_UTL_Misc.h>
45 
46 #include <iostream>
47 #include <ctime>
48 
49 #ifdef HAVE_CSTDIO
50 #include <cstdio>
51 #else
52 #include <stdio.h>
53 #endif
54 
55 #ifdef HAVE_CMATH
56 #include <cmath>
57 #else
58 #include <math.h>
59 #endif
60 
61 #include <sstream>
62 
63 #include <N_UTL_fwd.h>
64 #include <N_TIA_Assembler.h>
65 #include <N_ANP_AnalysisManager.h>
66 
67 #include <N_ANP_Transient.h>
68 #include <N_ANP_DCSweep.h>
69 #include <N_ANP_Step.h>
70 #include <N_ANP_Dakota.h>
71 #include <N_ANP_MPDE.h>
72 #include <N_ANP_HB.h>
73 #include <N_ANP_AC.h>
74 #include <N_ANP_MOR.h>
75 #include <N_ANP_Report.h>
76 
78 #include <N_TIA_StepErrorControl.h>
79 #include <N_TIA_DataStore.h>
80 #include <N_TIA_TIAParams.h>
81 
82 #include <N_TIA_TimeIntInfo.h>
83 #include <N_TIA_TwoLevelError.h>
84 
85 #include <N_TIA_MPDEInterface.h>
86 
87 #include <N_ERH_ErrorMgr.h>
88 
89 #include <N_LAS_System.h>
90 #include <N_LAS_LAFactory.h>
91 #include <N_LAS_Vector.h>
92 #include <N_LAS_Matrix.h>
93 
94 #include <N_NLS_Manager.h>
95 
96 #include <N_LOA_Loader.h>
97 
98 #include <N_PDS_Manager.h>
99 #include <N_PDS_Comm.h>
100 
101 #include <N_UTL_OptionBlock.h>
102 #include <N_UTL_Timer.h>
103 #include <N_UTL_BreakPoint.h>
104 
105 #include <N_IO_OutputMgr.h>
106 #include <N_ANP_OutputMgrAdapter.h>
107 
108 #include <N_IO_RestartMgr.h>
109 
110 #include <N_IO_CmdParse.h>
111 
112 #include <N_MPDE_Manager.h>
113 
114 namespace Xyce {
115 namespace Analysis {
116 
117 //-----------------------------------------------------------------------------
118 // Function : AnalysisManager::AnalysisManager
119 // Purpose : constructor
120 // Special Notes :
121 // Scope : public
122 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
123 // Creation Date : 01/24/08
124 //-----------------------------------------------------------------------------
125 
126 AnalysisManager::AnalysisManager(N_IO_CmdParse & cp, AnalysisInterface * anaIntPtr_tmp)
127  :
128  calledBeforeTwoLevelTran_(false),
129  breakPointRestartStep(0),
130  tiaParams(cp),
131  anaIntPtr(anaIntPtr_tmp,false),
132  analysis(ANP_MODE_TRANSIENT),
133  analysisParamsRegistered(false),
134  currentMode_(0),
135  firstTime(true),
136  oldPercentComplete(0.0),
137  startSimTime(-1.0),
138  switchIntegrator_(false),
139  initializeAllFlag_(false),
140  startTRANtime(0.0),
141  stepLoopFlag_(false),
142  stepLoopInitialized_(false),
143  dcLoopInitialized_(false),
144  gui_(false),
145  daeStateDerivFlag_(true),
146  initializeSolvers_mixedSignal_(false),
147  dcLoopSize_(0),
148  sweepSourceResetFlag_(true),
149  progressFlag_(true),
150  solverStartTime_(0.0),
151  dakotaRunFlag_(false),
152  dakotaIterationNumber_(0),
153  saveTime_(0.0),
154  saveTimeGiven_(false),
155  saveFlag_(false),
156  savedAlready_(false),
157  dcopRestartFlag_(false),
158  dotOpSpecified_(false),
159  initialOutputInterval_(0.0),
160  nextOutputTime_(0.0),
161  initialRestartInterval_(0.0),
162  nextRestartSaveTime_(0.0),
163  blockAnalysisFlag_(false),
164  hbFlag_(false),
165  mpdeFlag_(false),
166  sensFlag_(false),
167  commandLine_(cp)
168 {
169  gui_ = commandLine_.argExists("-gui");
170 
171  // check for maximum order on the command line
172  if ( commandLine_.argExists ("-maxord") )
173  {
175  atoi( commandLine_.getArgumentValue( "-maxord" ).c_str() );
176 
177  if ( tiaParams.maxOrder < 1) tiaParams.maxOrder = 1;
178  if ( tiaParams.maxOrder > 5) tiaParams.maxOrder = 5;
179  }
180 
181  // Create the MPDEIface object and register it with tiaControl
183  tiaMPDEIfacePtr_->registerTIAControl(this);
184 
185  return;
186 }
187 
188 //-----------------------------------------------------------------------------
189 // Function : AnalysisManager::~AnalysisManager
190 //
191 // Purpose : destructor
192 // Special Notes :
193 // Scope : public
194 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
195 // Creation Date : 01/24/08
196 //-----------------------------------------------------------------------------
198 {
199 }
200 
201 //-----------------------------------------------------------------------------
202 // Function : AnalysisManager::resetAll
203 //
204 // Purpose : just like a destructor without the death
205 // Special Notes :
206 // Scope : public
207 // Creator : Todd Coffey, Rich Schiek, Ting Mei
208 // Creation Date : 7/24/08
209 //-----------------------------------------------------------------------------
211 {
212  // tiaDataStore_ is created in initializeAll
213  tiaDataStore_ = Teuchos::null;
214  // secPtr_ is created in initializeAll
215  secPtr_ = Teuchos::null;
216  // wimPtr is created in initializeAll
217  wimPtr = Teuchos::null;
218 
219  // xyceTranTimerPtr_ is created in run
220  xyceTranTimerPtr_ = Teuchos::null;
221 
222  // tiaMPDEIfacePtr_'s copy to tiaDataStore_ and secPtr_ are reset in intializeAll, we don't need to delete it.
223 
224  // assemblerPtr is created in initializeAll
225  assemblerPtr = Teuchos::null;
226 
227  // Reset step statistics to zero.
228  primaryAnalysisObject_->resetAll ();
229 
230  initializeAllFlag_ = false;
231 
232 }
233 
234 //-----------------------------------------------------------------------------
235 // Function : AnalysisManager::getBlockAnalysisFlag
236 // Purpose : "get" function for MPDE flag. (true if not IC)
237 // Special Notes :
238 // Scope : public
239 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
240 // Creation Date : 01/31/08
241 //-----------------------------------------------------------------------------
243 {
244  if (Teuchos::is_null(mpdeMgrPtr_))
245  {
246  return blockAnalysisFlag_;
247  }
248  return mpdeMgrPtr_->blockAnalysisFlag();
249 }
250 
251 //-----------------------------------------------------------------------------
252 // Function : AnalysisManager::getMPDEFlag
253 // Purpose : "get" function for MPDE flag. (true if not IC)
254 // Special Notes :
255 // Scope : public
256 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
257 // Creation Date : 01/31/08
258 //-----------------------------------------------------------------------------
260 {
261  if (Teuchos::is_null(mpdeMgrPtr_))
262  {
263  return mpdeFlag_;
264  }
265  return mpdeMgrPtr_->getMPDEFlag();
266 }
267 
268 //-----------------------------------------------------------------------------
269 // Function : AnalysisManager::getMPDEStartupFlag
270 // Purpose :
271 // Special Notes :
272 // Scope : public
273 // Creator : Todd Coffey, Rich Schiek, Ting Mei
274 // Creation Date : 7/24/08
275 //-----------------------------------------------------------------------------
277 {
278  if (Teuchos::is_null(mpdeMgrPtr_))
279  {
280  return false;
281  }
282  return mpdeMgrPtr_->getMPDEStartupFlag();
283 }
284 
285 //-----------------------------------------------------------------------------
286 // Function : AnalysisManager::getMPDEIcFlag
287 // Purpose : get function for MPDE initial condition flag (true if MPDE & IC
288 // Special Notes :
289 // Scope : public
290 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
291 // Creation Date : 01/31/08
292 //-----------------------------------------------------------------------------
294 {
295  if (Teuchos::is_null(mpdeMgrPtr_))
296  {
297  return false;
298  }
299  return mpdeMgrPtr_->getMPDEIcFlag();
300 }
301 
302 
303 //-----------------------------------------------------------------------------
304 // Function : AnalysisManager::getWaMPDEFlag ()
305 // Purpose : "get" function for WaMPDE flag. (true if not IC)
306 // Special Notes :
307 // Scope : public
308 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
309 // Creation Date : 01/31/08
310 //-----------------------------------------------------------------------------
312 {
313  if (Teuchos::is_null(mpdeMgrPtr_))
314  {
315  return false;
316  }
317  return mpdeMgrPtr_->getWaMPDEFlag();
318 }
319 
320 //-----------------------------------------------------------------------------
321 // Function : AnalysisManager::isPaused
322 //
323 // Purpose : return the true if the simulation is currently paused
324 //
325 // Special Notes :
326 // Scope : public
327 // Creator : Rich Schiek, SNL, Electrical and Microsystems Simulation
328 // Creation Date : 02/18/2008
329 //-----------------------------------------------------------------------------
331 {
332  return secPtr_->isPauseTime();
333 }
334 
335 //-----------------------------------------------------------------------------
336 // Function : AnalysisManager::initializeAll
337 // Purpose : This function performs the final initializations. Mainly,
338 // it initializes the two data container classes, DataStore and
339 // StepErrorControl. It also registers the neccessary vectors
340 // with the LAS system class.
341 // Special Notes : This function should *only* be called after all the
342 // registrations have all been performed. In particular, the
343 // N_LAS_System class *must* be registered before this function
344 // is called.
345 // Scope : public
346 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
347 // Creation Date : 6/09/00
348 //-----------------------------------------------------------------------------
350 {
351  std::string msg;
352 
353  if (Teuchos::is_null(lasSysPtr))
354  {
355  Report::DevelFatal0().in("AnalysisManager::initializeAll")
356  << "Register LAS system first.";
357  }
358 
359  tiaParams.solutionSize = lasSysPtr->getSolutionSize();
360  tiaParams.stateSize = lasSysPtr->getStateSize();
361 
362  // allocate data store class, which will allocate all the vectors.
363 #ifdef Xyce_DEBUG_ANALYSIS
364  if (tiaParams.debugLevel > 0)
365  {
366  Xyce::dout() << "AnalysisManager::initializeAll. " ;
367  Xyce::dout() << " maximum order = " << tiaParams.maxOrder << std::endl;
368  }
369 #endif
370 
373 
374  // Now that data store has been created, we can also create the
375  // working integration method object.
377 
378  secPtr_->registerWIMPtr(&*wimPtr);
379 
381 
382  tiaMPDEIfacePtr_->registerTIADataStore(&*tiaDataStore_);
383  tiaMPDEIfacePtr_->registerTIAStepErrorControl(&*secPtr_);
384  // The final time has to be forced to be a "paused" breakpoint,
385  // after any registerTIAParams call.
386  // RLS: May need to conditionally call this only when this is an MPDE run
387  // not sure if we know that when this routine is called.
388  //setPauseTime(tiaParams.finalTime);
389 
392 
393  // register current:
394  lasSysPtr->registerCurrStaVector(&(tiaDataStore_->currStatePtr));
395  lasSysPtr->registerCurrSolVector(&(tiaDataStore_->currSolutionPtr));
396 
397  // register next:
398  lasSysPtr->registerNextStaVector(&(tiaDataStore_->nextStatePtr));
399  lasSysPtr->registerNextSolVector(&(tiaDataStore_->nextSolutionPtr));
400 
401  // register last:
402  lasSysPtr->registerLastStaVector(&(tiaDataStore_->lastStatePtr));
403  lasSysPtr->registerLastSolVector(&(tiaDataStore_->lastSolutionPtr));
404 
405  lasSysPtr->registerFlagSolVector(&(tiaDataStore_->flagSolutionPtr));
406 
407  // register temporaries:
408  lasSysPtr->registerTmpSolVector(&(tiaDataStore_->tmpSolVectorPtr));
409  lasSysPtr->registerTmpStaVector(&(tiaDataStore_->tmpStaVectorPtr));
410  lasSysPtr->registerTmpStaDerivVector(&(tiaDataStore_->tmpStaDerivPtr));
411  lasSysPtr->registerTmpStaDivDiffVector(&(tiaDataStore_->tmpStaDivDiffPtr));
412 
413  // register next derivatives:
414  lasSysPtr->registerNextSolDerivVector(&(tiaDataStore_->nextSolutionDerivPtr));
415  lasSysPtr->registerNextStaDerivVector(&(tiaDataStore_->nextStateDerivPtr));
416 
417  // register the device mask
418  lasSysPtr->registerDeviceMaskVector(&(tiaDataStore_->deviceMaskPtr));
419 
420  // Get the RHS and the Jacobian
421  tiaDataStore_->JMatrixPtr = lasSysPtr->getJacobianMatrix();
422  tiaDataStore_->RHSVectorPtr = lasSysPtr->getRHSVector();
423 
424  // DAE formulation vectors
425  lasSysPtr->registerDAEQVector ( tiaDataStore_->daeQVectorPtr );
426  lasSysPtr->registerDAEFVector ( tiaDataStore_->daeFVectorPtr );
427 
428  // DAE formulation matrices
429  lasSysPtr->registerDAEdQdxMatrix ( tiaDataStore_->dQdxMatrixPtr );
430  lasSysPtr->registerDAEdFdxMatrix ( tiaDataStore_->dFdxMatrixPtr );
431 
432  // Get the RHS and the Jacobian
433  //tiaDataStore_->JMatrixPtr = lasSysPtr->getJacobianMatrix();
434  //tiaDataStore_->RHSVectorPtr = lasSysPtr->getRHSVector();
435 
436  tiaDataStore_->dFdxdVpVectorPtr = lasSysPtr->getdFdxdVpVector ();
437  tiaDataStore_->dQdxdVpVectorPtr = lasSysPtr->getdQdxdVpVector ();
438 
439  tiaDataStore_->limiterFlag = loaderPtr->getLimiterFlag ();
440 
441  // This should probably be moved elsewhere later. If the user has
442  // specified that steps should only be accepted when the nonlinear solver
443  // truly converges, then the "nearConvergence" return code needs to be
444  // negative. ERK. 7/02/03
445  if ( !(tiaParams.nlNearConvFlag) )
446  {
447  N_NLS_ReturnCodes retCodes;
448  retCodes.nearConvergence = -3;
449  nlsMgrPtr->setReturnCodes(retCodes);
450  }
451 
452  // same for the "small update" case.
453  if ( !(tiaParams.nlSmallUpdateFlag) )
454  {
455  N_NLS_ReturnCodes retCodes;
456  retCodes.smallUpdate = -4;
457  nlsMgrPtr->setReturnCodes(retCodes);
458  }
459 
460  // check if analysis was specified. If not, but .OP was specified,
461  // then set up a DC calculation.
463  {
464  if ( dotOpSpecified_ )
465  {
468  }
469  else // flag an error.
470  {
471  Report::UserError0() << "No analysis statement in the netlist";
472  return false;
473  }
474  }
475 
476  // Allocate analysis objects, and also set up params.
478 
479  initializeAllFlag_ = true;
480  return true;
481 }
482 
483 //-----------------------------------------------------------------------------
484 // Function : AnalysisManager::run
485 // Purpose : Execute the control loop for the set analysis type.
486 // Special Notes :
487 // Scope : public
488 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
489 // Creation Date : 01/24/08
490 //-----------------------------------------------------------------------------
492 {
493  std::string msg;
494 
495  if (initializeAllFlag_ == false)
496  {
497  Report::DevelFatal0().in("AnalysisManager::run")
498  << "Call the initializeAll function first";
499  }
500 
502  {
503  Report::UserError0() << "No analysis statement in the netlist";
504  return false;
505  }
506 
507  // now that the problem is set up, we can tell the datastore what the var type are
508  // this info can be used by the time integrator to control error in a way that is
509  // appropriate for different variable types (like V's and I's).
510  std::vector<char> varTypes;
511  topoMgrPtr->returnVarTypeVec( varTypes );
512  tiaDataStore_->varTypeVec = varTypes;
513 
514  // This checks to make sure that all quantities in the .print are valid before
515  // we continue.
516  outputMgrAdapterRCPtr_->check_output( analysis );
517 
518 #ifdef Xyce_VERBOSE_TIME
520 #endif
521 
522 #ifndef Xyce_NO_MASKED_WRMS_NORMS
523  if (loaderPtr->loadDeviceMask())
524  {
525  //Xyce::dout() << " Nontrivial mask! " << std::endl;
526  }
527  else
528  {
529  // Xyce::dout() << " Trivial mask! " << std::endl;
530  }
531 #endif
532 //
533 
534  // 6/24/2010: ERK Note: this needs a refactor!
535  // For HB and MPDE, it is necessary to reallocate different analysis types as the simulation
536  // progresses from the initial condition phase to the block analysis phase. For example,
537  // in MPDE, it is common to solve a DC, then a series of transients, and then the full MPDE
538  // simulation.
539  //
540  // I recently moved some stuff from the analysis manager down into specific analysis type
541  // classes, which is where they really belong. However, doing this required that the
542  // order of setup change somewhat. DC and sweep parameters now cannot be processed until
543  // the DCSweep or Step classes are allocated. They are now primarily allocated
544  // in the intializeAll function. They need to be allocated prior to this ::run function,
545  // because they need to happen before restart files are read in.
546  //
547  // However, to preserve MPDE and HB, there has to be an option of reallocating analysis
548  // classes here. So, that is still the case, but this should be refactored to make
549  // it cleaner.
550  if ( getBlockAnalysisFlag () )
551  {
553  }
554 
555  Report::safeBarrier(pdsMgrPtr->getPDSComm()->comm());
556 
557  solverStartTime_ = elapsedTimerPtr_->elapsedTime();
558 
559  // Start the solvers timers.
560  xyceTranTimerPtr_ = rcp(new N_UTL_Timer(*(pdsMgrPtr->getPDSComm())));
561 
562  bool runStatus = analysisObject_->run();
563 
565  {
566  conductanceTest ();
567  }
568 
569  return runStatus;
570 }
571 
572 //-----------------------------------------------------------------------------
573 // Function : AnalysisManager::allocateAnalysisObject_
574 // Purpose : Allocate analysis objects, and also setup params.
575 // Special Notes :
576 // Scope : private
577 // Creator : Eric Keiter, SNL
578 // Creation Date : 06/24/10
579 //-----------------------------------------------------------------------------
581 {
582  std::string msg("");
583 
584  if( !tiaParams.resume )
585  {
587  {
588  analysisObject_ = Teuchos::rcp(new Transient(this));
589  analysisObject_->setAnalysisParams(tranParamsBlock);
590  secPtr_->resetAll();
591  }
592  else if (analysis == ANP_MODE_DC_SWEEP)
593  {
594  analysisObject_ = Teuchos::rcp(new DCSweep(this));
595  for (int i=0;i<(int)dcParamsBlockVec.size();++i)
596  {
597  analysisObject_->setAnalysisParams(dcParamsBlockVec[i]);
598  }
599  }
600  else if (analysis == ANP_MODE_MPDE)
601  {
602  analysisObject_ = Teuchos::rcp(new MPDE(this));
603  analysisObject_->setAnalysisParams(mpdeParamsBlock);
604  }
605  else if (analysis == ANP_MODE_HB)
606  {
607  analysisObject_ = Teuchos::rcp(new HB(this));
608  analysisObject_->setAnalysisParams(hbParamsBlock);
609  Teuchos::rcp_dynamic_cast<HB>(analysisObject_)->setHBOptions(hbOptionsBlock);
610  Teuchos::rcp_dynamic_cast<HB>(analysisObject_)->setHBLinSol(hbLinSolBlock);
611  Teuchos::rcp_dynamic_cast<HB>(analysisObject_)->setLinSol(linSolBlock);
612  setHBFlag( true );
613  }
614  else if ( analysis == ANP_MODE_AC)
615  {
616  analysisObject_ = Teuchos::rcp(new AC(this));
617  analysisObject_->setAnalysisParams(acParamsBlock);
618  }
619  else if ( analysis == ANP_MODE_MOR)
620  {
621  analysisObject_ = Teuchos::rcp(new MOR(this));
622  analysisObject_->setAnalysisParams(morParamsBlock);
623  }
624  else
625  {
626  Report::UserError0() << "Unknown type of analysis";
627  return;
628  }
629 
630  if( !is_null(analysisObject_) )
631  {
632  analysisObject_->setParamsWithOutputMgrAdapter ( outputMgrAdapterRCPtr_ );
633  }
634 
635  // need to throw an error here as this really shouldn't happen.
636  if( is_null( analysisObject_ ) )
637  {
638  Report::DevelFatal0().in("AnalysisManager::initializeAll")
639  << "Unable to allocate analysis type";
640  }
641 
642  // ultimately sensitivity calculation should get its own analysis object.
643  if (sensFlag_)
644  {
645  analysisObject_->setSensFlag();
646  }
647 
648  // The primary analysis object is stored in case there is an outer
649  // loop analysis such as .STEP or .DAKOTA. Many accessors such
650  // as "getStepNumber" need to access this object rather than the
651  // step object.
653 
654  if( stepLoopFlag_ )
655  {
657  analysisObject_ = Teuchos::rcp(new Step(this, stepAnalysisTarget_.get()));
658  for (int i=0;i<(int)stepParamsBlockVec.size();++i)
659  {
660  analysisObject_->setAnalysisParams(stepParamsBlockVec[i]);
661  }
662  analysisObject_->setParamsWithOutputMgrAdapter ( outputMgrAdapterRCPtr_ );
663  }
664 
665  if (dakotaRunFlag_ && is_null(dakotaAnalysisTarget_) )
666  {
668  analysisObject_ = Teuchos::rcp(new Dakota(this, dakotaAnalysisTarget_.get()));
669  analysisObject_->setAnalysisParams(dakotaParamsBlock);
670  analysisObject_->setParamsWithOutputMgrAdapter ( outputMgrAdapterRCPtr_ );
671  }
672  }
673 }
674 
675 //-----------------------------------------------------------------------------
676 // Function : AnalysisManager::printLoopInfo
677 // Purpose : Prints out time loop information.
678 // Special Notes : Prints stats from save point start to save point finish.
679 // Special case 0,0 is entire run to this point
680 // Scope : public
681 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
682 // Creation Date : 6/26/00
683 //-----------------------------------------------------------------------------
684 bool AnalysisManager::printLoopInfo(int start, int finish)
685 {
686  return primaryAnalysisObject_->printLoopInfo (start,finish);
687 }
688 
689 //-----------------------------------------------------------------------------
690 // Function : AnalysisManager::testDCOPOutputTime_
691 // Purpose : Similar to testOutputTime, except that this is for
692 // DCOP restart files.
693 // Special Notes :
694 // Scope : public
695 // Creator : Eric Keiter, SNL
696 // Creation Date : 10/18/07
697 //-----------------------------------------------------------------------------
699 {
700  bool flag(true);
701 
702  if( !dcopRestartFlag_ )
703  {
704  flag = false;
705  }
706 
707  return flag;
708 }
709 
710 //-----------------------------------------------------------------------------
711 // Function : AnalysisManager::testSaveOutputTime_
712 // Purpose : Similar to testOutputTime, except that this is for
713 // .SAVE files.
714 // Special Notes : Only outputs 1x.
715 // Scope : public
716 // Creator : Eric Keiter, SNL
717 // Creation Date : 10/18/07
718 //-----------------------------------------------------------------------------
720 {
721  bool flag(true);
722 
723  if( !saveFlag_ )
724  {
725  flag = false;
726  }
727  else if (secPtr_->currentTime < saveTime_)
728  {
729  flag = false;
730  }
731  else if (savedAlready_)
732  {
733  flag = false;
734  }
735 
736  if (flag==true)
737  {
738  savedAlready_ = true;
739  Xyce::dout() <<"Calling SAVE outputs!" <<std::endl;
740  }
741 
742  return flag;
743 }
744 
745 //-----------------------------------------------------------------------------
746 // Function : AnalysisManager::testRestartSaveTime_
747 // Purpose :
748 // Special Notes :
749 // Scope : public
750 // Creator : Rob Hoekstra, SNL, Parallel ComputationalSciences.
751 // Creation Date : 07/31/01
752 //-----------------------------------------------------------------------------
754 {
755  bool flag;
756 
757 #ifdef Xyce_DEBUG_RESTART
758  Xyce::dout() << "TESTING FOR RESTART SAVE" << std::endl
759  << Xyce::subsection_divider << std::endl
760  << "secPtr_->currentTime: " << secPtr_->currentTime << std::endl
761  << "nextSaveTime: " << nextRestartSaveTime_ << std::endl
762  << "initialRestartInterval_: " << initialRestartInterval_ << std::endl;
763  if (!(restartIntervals_.empty()))
764  {
765  Xyce::dout() << "First restart interval: " << restartIntervals_[0].first << std::endl;
766  }
767  else
768  {
769  Xyce::dout() << "restartIntervals_ is empty" << std::endl;
770  }
771 #endif
772 
773  if (initialRestartInterval_ == 0.0)
774  {
775  flag = false;
776  }
777  else if (secPtr_->currentTime < nextRestartSaveTime_)
778  {
779  flag = false;
780  }
781  else if (restartIntervals_.empty())
782  {
783  while (nextRestartSaveTime_ <= secPtr_->currentTime)
784  {
786  }
787  flag = true;
788  }
789  else if (secPtr_->currentTime < restartIntervals_[0].first)
790  {
791  while (nextRestartSaveTime_ <= secPtr_->currentTime)
792  {
794  }
796  {
798  }
799  flag = true;
800  }
801  else
802  {
803  std::pair<double, double> currInterval, nextInterval;
804  int size = restartIntervals_.size();
805  for (int i = 0; i < size; ++i)
806  {
807  if (restartIntervals_[i].first <= secPtr_->currentTime)
808  {
809  currInterval = restartIntervals_[i];
810  if ((i+1) < (int)restartIntervals_.size())
811  {
812  nextInterval = restartIntervals_[i+1];
813  }
814  }
815  }
816  int step = static_cast <int> ((secPtr_->currentTime-currInterval.first) /
817  currInterval.second);
818  nextRestartSaveTime_ = currInterval.first + (step+1)*currInterval.second;
819 
820  if (nextInterval.first && (nextInterval.first!=currInterval.first)
821  && (nextRestartSaveTime_>=nextInterval.first))
822  {
823  nextRestartSaveTime_ = nextInterval.first;
824  }
825  flag = true;
826  }
827 
828 #ifdef Xyce_DEBUG_RESTART
829  Xyce::dout() << "new nextSaveTime: " << nextRestartSaveTime_ << std::endl
830  << "restart flag: " << flag << std::endl
831  << Xyce::subsection_divider << std::endl;
832 #endif
833 
834  return flag;
835 }
836 
837 
838 //-----------------------------------------------------------------------------
839 // Function : AnalysisManager::partialTimeDerivative
840 // Purpose : Returns the current partial time derivative for either the
841 // solution or state vector.
842 // Special Notes :
843 // Scope : public
844 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
845 // Creation Date : 6/12/00
846 //-----------------------------------------------------------------------------
848 {
849  double partDT = wimPtr->partialTimeDeriv();
850 
851  // Add a check here to try to prevent capacitive spiral of death.
852  // This is still a "research" option, so is not on by default.
854  {
855 #ifdef Xyce_DEBUG_ANALYSIS
856  if (tiaParams.debugLevel > 0)
857  {
858  Xyce::dout() << "AnalysisManager::partialTimeDerivative.";
859  Xyce::dout() << " Using jac limit = " << tiaParams.jacLimit << std::endl;
860  }
861 #endif
862  if (partDT > tiaParams.jacLimit)
863  {
864  partDT = tiaParams.jacLimit;
865  }
866  }
867 
868  return partDT;
869 }
870 
871 //-----------------------------------------------------------------------------
872 // Function : AnalysisManager::getBreakpointTol
873 // Purpose : Returns the breakpoint tolerance.
874 // Special Notes :
875 // Scope : public
876 // Creator : Tom Russo, SNL, Component Information and Models
877 // Creation Date : 03/7/02
878 //-----------------------------------------------------------------------------
880 {
881  return N_UTL_BreakPoint::getBPTol();
882 }
883 
884 //-----------------------------------------------------------------------------
885 // Function : AnalysisManager::setBreakpointTol
886 // Purpose : Sets the breakpoint tolerance.
887 // Special Notes :
888 // Scope : public
889 // Creator : Tom Russo, SNL, Component Information and Models
890 // Creation Date : 03/7/02
891 //-----------------------------------------------------------------------------
893 {
894  N_UTL_BreakPoint::setBPTol(bptol);
895 }
896 
897 //-----------------------------------------------------------------------------
898 // Function : AnalysisManager::registerRestartIntervals
899 // Purpose :
900 // Special Notes :
901 // Scope : public
902 // Creator : Rob Hoekstra, SNL, Computational Sciences
903 // Creation Date : 07/31/01
904 //-----------------------------------------------------------------------------
906 {
907  double initInt;
908  std::vector< std::pair<double,double> > intPairs;
909  restartPtr->getRestartIntervals(initInt, intPairs);
910  initialRestartInterval_ = initInt;
911  nextRestartSaveTime_ = secPtr_->initialTime;
912  restartIntervals_ = intPairs;
913  return true;
914 }
915 
916 //-----------------------------------------------------------------------------
917 // Function : AnalysisManager::registerOutputIntevals
918 // Purpose :
919 // Special Notes :
920 // Scope : public
921 // Creator : Rob Hoekstra, SNL, Computational Sciences
922 // Creation Date : 07/31/01
923 //-----------------------------------------------------------------------------
925 {
926  double initInt;
927  std::vector< std::pair<double,double> > intPairs;
928  outputMgrAdapterRCPtr_->getOutputIntervals( initInt, & intPairs );
929  initialOutputInterval_ = initInt;
930  nextOutputTime_ = secPtr_->initialTime;
931  outputIntervals_ = intPairs;
932  return true;
933 }
934 
935 //-----------------------------------------------------------------------------
936 // Function : AnalysisManager::setTranAnalysisParams
937 // Purpose : Sets transient analysis parameters (from .TRAN)
938 // Special Notes :
939 // Scope : public
940 // Creator : Eric R. Keiter, SNL, Computational Sciences
941 // Creation Date : 04/17/02
942 //-----------------------------------------------------------------------------
944  const N_UTL_OptionBlock & paramsBlock)
945 {
948  tranParamsBlock = paramsBlock; // save a copy for later.
949  return true;
950 }
951 
952 //-----------------------------------------------------------------------------
953 // Function : AnalysisManager::setDCAnalysisParams
954 // Purpose : Sets the DC sweep calculation parameters (from .DC)
955 //
956 // Special Notes : This function will be called multiple times if there is more
957 // than one sweep variable. The parser separates each variable
958 // into separate option blocks prior to calling this function.
959 //
960 // Scope : public
961 // Creator : Eric R. Keiter, SNL
962 // Creation Date : 04/18/02
963 //-----------------------------------------------------------------------------
965  (const N_UTL_OptionBlock & paramsBlock)
966 {
967  analysisParamsRegistered = true;
968  analysis = ANP_MODE_DC_SWEEP;
969  // before saving a copy of paramsBlock, check and see if it already
970  // is in the dcParamsBlockVec. If so then replace the original copy.
971  // This replacement is necessary if the first copy had an expression
972  // element that was resolved in later parsing.
973 
974  bool foundMatch = false;
975  std::vector<N_UTL_OptionBlock>::iterator paramsBlockVecItr = dcParamsBlockVec.begin();
976  std::vector<N_UTL_OptionBlock>::iterator paramsBlockVecEnd = dcParamsBlockVec.end();
977  while( paramsBlockVecItr != paramsBlockVecEnd )
978  {
979  if( paramsBlockVecItr->compareParamLists( paramsBlock ) )
980  {
981  // these are the same
982  foundMatch = true;
983  break;
984  }
985  paramsBlockVecItr++;
986  }
987 
988  if( foundMatch )
989  {
990  // replace the existing one with the new one
991  *paramsBlockVecItr = paramsBlock;
992  }
993  else
994  {
995  // save the new one.
996  dcParamsBlockVec.push_back (paramsBlock); // save a copy for later.
997  }
998  return true;
999 }
1000 
1001 //-----------------------------------------------------------------------------
1002 // Function : AnalysisManager::setOPAnalysisParams
1003 // Purpose : Handle OP statement. (.OP)
1004 // Special Notes :
1005 // Scope : public
1006 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1007 // Creation Date : 10/15/07
1008 //-----------------------------------------------------------------------------
1010  const N_UTL_OptionBlock & paramsBlock)
1011 {
1012  dotOpSpecified_ = true;
1013  opParamsBlock = paramsBlock; // save a copy for later.
1014  return true;
1015 }
1016 
1017 //-----------------------------------------------------------------------------
1018 // Function : AnalysisManager::setSTEPAnalysisParams
1019 // Purpose : Sets the STEP calculation parameters. (from .STEP)
1020 // Special Notes :
1021 // Scope : public
1022 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1023 // Creation Date : 10/30/03
1024 //-----------------------------------------------------------------------------
1026  const N_UTL_OptionBlock & paramsBlock)
1027 {
1028  stepLoopFlag_ = true;
1029  // before saving a copy of paramsBlock, check and see if it already
1030  // is in the stepParamsBlockVec. If so then replace the original copy.
1031  // This replacement is necessary if the first copy had an expression
1032  // element that was resolved in later parsing.
1033  bool foundMatch = false;
1034  std::vector<N_UTL_OptionBlock>::iterator paramsBlockVecItr = stepParamsBlockVec.begin();
1035  std::vector<N_UTL_OptionBlock>::iterator paramsBlockVecEnd = stepParamsBlockVec.end();
1036  while( paramsBlockVecItr != paramsBlockVecEnd )
1037  {
1038  if( paramsBlockVecItr->compareParamLists( paramsBlock ) )
1039  {
1040  // these are the same
1041  foundMatch = true;
1042  break;
1043  }
1044  paramsBlockVecItr++;
1045  }
1046 
1047  if( foundMatch )
1048  {
1049  // replace the existing one with the new one
1050  *paramsBlockVecItr = paramsBlock;
1051  }
1052  else
1053  {
1054  // save the new one.
1055  stepParamsBlockVec.push_back (paramsBlock); // save a copy for later.
1056  }
1057  return true;
1058 }
1059 
1060 //-----------------------------------------------------------------------------
1061 // Function : AnalysisManager::setSaveOptions
1062 // Purpose : Sets the Save parameters.
1063 // Special Notes : Most of these parameters are handled in the output manager,
1064 // rather than here. So, most params are a noop here, except
1065 // for "TIME".
1066 // Scope : public
1067 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1068 // Creation Date : 10/18/07
1069 //-----------------------------------------------------------------------------
1071  const N_UTL_OptionBlock & OB)
1072 {
1073 #ifdef Xyce_DEBUG_ANALYSIS
1074  if (tiaParams.debugLevel > 0)
1075  {
1076  Xyce::dout() << "In AnalysisManager::setSaveOptions" << std::endl;
1077  }
1078 #endif
1079 
1080  saveFlag_ = true;
1081 
1082  std::list<N_UTL_Param>::const_iterator iterPL = OB.getParams().begin();
1083  std::list<N_UTL_Param>::const_iterator iterPL_end = OB.getParams().end();
1084 
1085  while (iterPL != iterPL_end)
1086  {
1087 #ifdef Xyce_DEBUG_IO
1088  Xyce::dout() << "iterPL->tag = " << iterPL->tag() << std::endl;
1089 #endif
1090  if (iterPL->tag() == "TYPE")
1091  {
1092  // noop
1093  }
1094  else if (iterPL->tag() == "FILE")
1095  {
1096  // noop
1097  }
1098  else if (iterPL->tag() == "TIME")
1099  {
1100  saveTime_ = iterPL->getImmutableValue<double>();
1101  saveTimeGiven_ = true;
1102  }
1103  else if (iterPL->tag() == "LEVEL")
1104  {
1105  // noop
1106  }
1107  else
1108  {
1109  // noop. If it gets here there is an error on the .SAVE line.
1110  // However, the IO manager has a trap for this, so do nothing
1111  // here.
1112  }
1113 
1114  ++iterPL;
1115  }
1116 
1117  return true;
1118 }
1119 
1120 //-----------------------------------------------------------------------------
1121 // Function : AnalysisManager::setACAnalysisParams
1122 // Purpose : Sets the AC sweep calculation parameters (from .AC)
1123 //
1124 // Special Notes :
1125 // Scope : public
1126 // Creator : Eric R. Keiter, SNL
1127 // Creation Date : 04/18/02
1128 //-----------------------------------------------------------------------------
1130  (const N_UTL_OptionBlock & paramsBlock)
1131 {
1132  analysisParamsRegistered = true;
1133  analysis = ANP_MODE_AC;
1134  acParamsBlock = paramsBlock; // save a copy for later.
1135  return true;
1136 }
1137 
1138 //-----------------------------------------------------------------------------
1139 // Function : AnalysisManager::setMORAnalysisParams
1140 // Purpose : Sets the MOR calculation parameters (from .MOR)
1141 //
1142 // Special Notes :
1143 // Scope : public
1144 // Creator : Heidi Thornquist and Ting Mei, SNL
1145 // Creation Date : 05/29/12
1146 //-----------------------------------------------------------------------------
1148  (const N_UTL_OptionBlock & paramsBlock)
1149 {
1150  analysisParamsRegistered = true;
1151  analysis = ANP_MODE_MOR;
1152  morParamsBlock = paramsBlock; // save a copy for later.
1153  return true;
1154 }
1155 
1156 //-----------------------------------------------------------------------------
1157 // Function : AnalysisManager::setMOROptions
1158 // Purpose :
1159 // Special Notes : These are from '.options mor'
1160 // Scope : public
1161 // Creator : Heidi Thornquist and Ting Mei, SNL
1162 // Creation Date : 05/31/12
1163 //-----------------------------------------------------------------------------
1164 bool AnalysisManager::setMOROptions(const N_UTL_OptionBlock & OB)
1165 {
1166  std::list<N_UTL_Param>::const_iterator it_tpL;
1167  std::list<N_UTL_Param>::const_iterator first = OB.getParams().begin();
1168  std::list<N_UTL_Param>::const_iterator last = OB.getParams().end();
1169 
1170  for (it_tpL = first; it_tpL != last; ++it_tpL)
1171  {
1172  if (it_tpL->uTag()=="METHOD")
1173  {
1174  ExtendedString stringVal ( it_tpL->stringValue() );
1175  stringVal.toUpper();
1176  tiaParams.morMethod = stringVal;
1177  }
1178  else if (it_tpL->uTag()=="SAVEREDSYS")
1179  {
1180  tiaParams.morSaveRedSys = static_cast<bool>(it_tpL->getImmutableValue<int>());
1181  }
1182  else if (it_tpL->uTag()=="COMPORIGTF")
1183  {
1184  tiaParams.morCompOrigTF = static_cast<bool>(it_tpL->getImmutableValue<int>());
1185  }
1186  else if (it_tpL->uTag()=="COMPREDTF")
1187  {
1188  tiaParams.morCompRedTF = static_cast<bool>(it_tpL->getImmutableValue<int>());
1189  }
1190  else if (it_tpL->uTag()=="COMPTYPE")
1191  {
1192  ExtendedString stringVal ( it_tpL->stringValue() );
1193  stringVal.toUpper();
1194  tiaParams.morCompType = stringVal;
1195  }
1196  else if (it_tpL->uTag()=="COMPNP")
1197  {
1198  tiaParams.morCompNP = it_tpL->getImmutableValue<int>();
1199  }
1200  else if (it_tpL->uTag()=="COMPFSTART")
1201  {
1202  tiaParams.morCompFStart = it_tpL->getImmutableValue<double>();
1203  }
1204  else if (it_tpL->uTag()=="COMPFSTOP")
1205  {
1206  tiaParams.morCompFStop = it_tpL->getImmutableValue<double>();
1207  }
1208  else if (it_tpL->uTag()=="EXPPOINT")
1209  {
1210  tiaParams.morExpPoint = it_tpL->getImmutableValue<double>();
1211  }
1212  else if (it_tpL->uTag()=="SCALETYPE")
1213  {
1214  tiaParams.morScaleType = it_tpL->getImmutableValue<int>();
1215  }
1216  else if (it_tpL->uTag()=="SCALEFACTOR")
1217  {
1218  tiaParams.morScaleFactor = it_tpL->getImmutableValue<double>();
1219  }
1220  else if (it_tpL->uTag()=="SCALEFACTOR1")
1221  {
1222  tiaParams.morScaleFactor1 = it_tpL->getImmutableValue<double>();
1223  }
1224  else if (it_tpL->uTag()=="SPARSIFICATIONTYPE")
1225  {
1226  tiaParams.morSparsificationType = it_tpL->getImmutableValue<int>();
1227  }
1228  else
1229  {
1230  Report::UserError0() << it_tpL->uTag() << " is not a recognized model-order reduction option.";
1231  }
1232  }
1233 
1234  // If we are computing the transfer function, make sure the frequency range is valid.
1236  {
1238  {
1239  Report::UserError() << ".options mor COMPFSTART = " << tiaParams.morCompFStart << " > " << tiaParams.morCompFStop << " = COMPFSTOP!";
1240  }
1241  }
1242 
1243  return true;
1244 }
1245 
1246 //-----------------------------------------------------------------------------
1247 // Function : AnalysisManager::setDCOPRestartParams
1248 // Purpose : Sets the DCOP restart parameters.
1249 // Special Notes : Most of the dcop restart parameters are used and handled by
1250 // the N_IO_OutputMgr class, so this function here doens't need
1251 // to do very much.
1252 // Scope : public
1253 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1254 // Creation Date : 10/18/07
1255 //-----------------------------------------------------------------------------
1256 bool AnalysisManager::setDCOPRestartParams(const N_UTL_OptionBlock & OB)
1257 {
1258  dcopRestartFlag_ = true;
1259 
1260  std::list<N_UTL_Param>::const_iterator iterPL = OB.getParams().begin();
1261  std::list<N_UTL_Param>::const_iterator iterPL_end = OB.getParams().end();
1262 
1263  while (iterPL != iterPL_end)
1264  {
1265 #ifdef Xyce_DEBUG_IO
1266  Xyce::dout() << "iterPL->tag = " << iterPL->tag() << std::endl;
1267 #endif
1268 
1269  if (iterPL->tag() == "INPUT")
1270  {
1271  // do nothing, this is handled in the output manager.
1272  }
1273  else if (iterPL->tag() == "OUTPUT")
1274  {
1275  // do nothing, this is handled in the output manager.
1276  }
1277  else if (iterPL->tag() == "TIME")
1278  {
1279  saveTime_ = iterPL->getImmutableValue<double>();
1280  saveTimeGiven_ = true;
1281  }
1282  else
1283  {
1284  // noop. If it gets here there is an error on the .SAVE line.
1285  // However, the IO manager has a trap for this, so do nothing
1286  // here.
1287  }
1288 
1289  ++iterPL;
1290  }
1291 
1292  return true;
1293 }
1294 
1295 //-----------------------------------------------------------------------------
1296 // Function : AnalysisManager::setTranOptions
1297 // Purpose :
1298 // Special Notes : These are from '.options timeint'
1299 // Scope : public
1300 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1301 // Creation Date : 04/18/02
1302 //-----------------------------------------------------------------------------
1303 bool AnalysisManager::setTranOptions(const N_UTL_OptionBlock & OB)
1304 {
1305  std::list<N_UTL_Param>::const_iterator it_tpL;
1306  std::list<N_UTL_Param>::const_iterator first = OB.getParams().begin();
1307  std::list<N_UTL_Param>::const_iterator last = OB.getParams().end();
1308 
1309  for (it_tpL = first; it_tpL != last; ++it_tpL)
1310  {
1311  if (it_tpL->uTag()=="METHOD")
1312  {
1313 // tiaParams.integrationMethod=it_tpL->iVal();
1314 
1315  if (it_tpL->isInteger())
1316  tiaParams.integrationMethod=it_tpL->getImmutableValue<int>();
1317  else
1318  {
1319 
1320  ExtendedString stringVal ( it_tpL->stringValue() );
1321  stringVal.toUpper();
1322 
1323  if (stringVal == "TRAP" || stringVal == "TRAPEZOIDAL")
1325  else if (stringVal == "BDF")
1327  else if (stringVal == "GEAR")
1329  else
1330  {
1331  Report::UserError0() << "Unsupported transient method type";
1332  }
1333  }
1334 
1335  }
1336 #ifdef Xyce_DEBUG_ANALYSIS
1337  else if (it_tpL->uTag()=="CONSTSTEP")
1338  {
1340  = static_cast<bool> (it_tpL->getImmutableValue<int>());
1341  }
1342 #endif
1343  else if (it_tpL->uTag()=="USEDEVICEMAX")
1344  {
1345  tiaParams.useDeviceTimeStepMax = static_cast<bool> (it_tpL->getImmutableValue<int>());
1346  }
1347  else if (it_tpL->uTag()=="RELTOL")
1348  {
1349  tiaParams.relErrorTol=it_tpL->getImmutableValue<double>();
1350  tiaParams.relErrorTolGiven = true;
1351  }
1352  else if (it_tpL->uTag()=="ABSTOL")
1353  {
1354  tiaParams.absErrorTol=it_tpL->getImmutableValue<double>();
1355  }
1356  else if (it_tpL->uTag()=="DOUBLEDCOPSTEP")
1357  {
1358  tiaParams.doubleDCOPStep=it_tpL->getImmutableValue<int>();
1359  }
1360  else if (it_tpL->uTag()=="FIRSTDCOPSTEP")
1361  {
1362  tiaParams.firstDCOPStep=it_tpL->getImmutableValue<int>();
1363  }
1364  else if (it_tpL->uTag()=="LASTDCOPSTEP")
1365  {
1366  tiaParams.lastDCOPStep=it_tpL->getImmutableValue<int>();
1367  }
1368  else if (it_tpL->uTag()=="BPENABLE" )
1369  {
1370  tiaParams.bpEnable = static_cast<bool> (it_tpL->getImmutableValue<int>());
1371  }
1372  else if (it_tpL->uTag()=="RESTARTSTEPSCALE" )
1373  {
1374  tiaParams.restartTimeStepScale=it_tpL->getImmutableValue<double>();
1375  }
1376  else if (it_tpL->uTag()=="EXITTIME" )
1377  {
1378  tiaParams.exitTime=it_tpL->getImmutableValue<double>();
1379  }
1380  else if (it_tpL->uTag()=="EXITSTEP" )
1381  {
1382  tiaParams.exitStep=it_tpL->getImmutableValue<int>();
1383  }
1384  else if (it_tpL->uTag() == "MINTIMESTEPSBP")
1385  {
1386  tiaParams.minTimeStepsBP = it_tpL->getImmutableValue<int>();
1388  }
1389  else if (it_tpL->uTag()=="ERROPTION" )
1390  {
1391  tiaParams.errorAnalysisOption=it_tpL->getImmutableValue<int>();
1392  // tscoffe/tmei 12/7/07: If error option = 1 (NO LTE) then make sure minTimeStepBP is enabled.
1393  if (tiaParams.errorAnalysisOption == 1)
1394  {
1396  {
1398  }
1399  }
1400  }
1401  else if (it_tpL->uTag()=="NLNEARCONV" )
1402  {
1403  tiaParams.nlNearConvFlag = static_cast<bool> (it_tpL->getImmutableValue<int>());
1404  }
1405  else if (it_tpL->uTag()=="NLSMALLUPDATE" )
1406  {
1407  tiaParams.nlSmallUpdateFlag = static_cast<bool> (it_tpL->getImmutableValue<int>());
1408  }
1409  else if (it_tpL->uTag()=="JACLIMITFLAG" )
1410  {
1411  tiaParams.jacLimitFlag= static_cast<bool> (it_tpL->getImmutableValue<int>());
1412  }
1413  else if (it_tpL->uTag()=="JACLIMIT" )
1414  {
1415  tiaParams.jacLimit = it_tpL->getImmutableValue<double>();
1416  }
1417  else if (it_tpL->uTag()=="DAESTATEDERIV" )
1418  {
1419  daeStateDerivFlag_ = static_cast<bool> (it_tpL->getImmutableValue<int>());
1420  }
1421  else if (it_tpL->uTag()=="MAXORD" )
1422  {
1423  tiaParams.maxOrder = it_tpL->getImmutableValue<int>();
1424  }
1425  else if (it_tpL->uTag()=="MINORD" )
1426  {
1427  tiaParams.minOrder = it_tpL->getImmutableValue<int>();
1428  }
1429  else if (it_tpL->uTag()=="TIMESTEPSREVERSAL" )
1430  {
1431  tiaParams.timestepsReversal =it_tpL->getImmutableValue<bool>();
1432  }
1433  else if (it_tpL->uTag()=="TESTFIRSTSTEP" )
1434  {
1435  tiaParams.testFirstStep = static_cast<bool> (it_tpL->getImmutableValue<int>());
1436  }
1437  else if (it_tpL->uTag()=="DELMAX" )
1438  {
1439  tiaParams.delmax =it_tpL->getImmutableValue<double>();
1440  tiaParams.delmaxGiven = true;
1441 // tiaParams.delmax =it_tpL->iVal();
1442  }
1443  else if (it_tpL->uTag()=="NLMIN" )
1444  {
1445  tiaParams.NLmin=it_tpL->getImmutableValue<int>();
1446  }
1447  else if (it_tpL->uTag()=="NLMAX" )
1448  {
1449  tiaParams.NLmax=it_tpL->getImmutableValue<int>();
1450  }
1451  else if (it_tpL->uTag()=="OUTPUTINTERPMPDE")
1452  {
1453  tiaParams.outputInterpMPDE = static_cast<bool> (it_tpL->getImmutableValue<int>());
1454  }
1455  else if (it_tpL->uTag()=="NEWLTE")
1456  {
1457  tiaParams.newLte =it_tpL->getImmutableValue<double>();
1458  }
1459  else if (it_tpL->uTag()=="NEWBPSTEPPING")
1460  {
1461  tiaParams.newBPStepping = it_tpL->getImmutableValue<double>();
1462  }
1463  else if (it_tpL->uTag()=="INTERPOUTPUT")
1464  {
1465  tiaParams.interpOutputFlag = static_cast<bool> (it_tpL->getImmutableValue<int>());
1466  }
1467  else if (it_tpL->uTag()=="CONDTEST")
1468  {
1469  tiaParams.condTestFlag = static_cast<bool> (it_tpL->getImmutableValue<int>());
1470  }
1471  else if (it_tpL->uTag()=="CONDTESTDEVICENAME")
1472  {
1473  tiaParams.condTestDeviceNames.push_back(it_tpL->stringValue() );
1474  }
1475  else if (it_tpL->uTag() == "DTMIN")
1476  {
1477  tiaParams.userSpecMinTimeStep = it_tpL->getImmutableValue<double>();
1479  }
1480  else if (it_tpL->uTag() == "PASSNLSTALL")
1481  {
1482  tiaParams.passNLStall = it_tpL->getImmutableValue<bool>();
1483  }
1484  else if (it_tpL->uTag() == "FASTTESTS")
1485  {
1486  tiaParams.fastTests = it_tpL->getImmutableValue<bool>();
1487  }
1488  else if (it_tpL->uTag() == "MINTIMESTEPRECOVERY")
1489  {
1490  tiaParams.minTimeStepRecoveryCounter = it_tpL->getImmutableValue<int>();
1491  }
1492  else if (it_tpL->uTag()=="VOLTZEROTOL" )
1493  {
1494  tiaParams.voltZeroTol=it_tpL->getImmutableValue<double>();
1495  }
1496  else if (it_tpL->uTag()=="CURRZEROTOL" )
1497  {
1498  tiaParams.currZeroTol=it_tpL->getImmutableValue<double>();
1499  }
1500  else if (it_tpL->uTag()=="DEBUGLEVEL" )
1501  {
1502 #ifdef Xyce_DEBUG_TIME
1503  // set (or override) debug levels based on command line options
1504  if ( commandLine_.argExists( "-tdl" ) )
1505  {
1506  tiaParams.debugLevel = atoi( commandLine_.getArgumentValue( "-tdl" ).c_str() );
1507  }
1508 
1509  else
1510  {
1511  tiaParams.debugLevel = it_tpL->getImmutableValue<int>();
1512  }
1513 #endif
1514  }
1515  else if (it_tpL->uTag()=="HISTORYTRACKINGDEPTH" )
1516  {
1517  tiaParams.historyTrackingDepth = it_tpL->getImmutableValue<int>();
1518  }
1519  else
1520  {
1521  Report::UserError() << it_tpL->uTag() << " is not a recognized time integration option";
1522  }
1523  }
1524 
1526  {
1527  Report::UserError() << ".options timeint NLMIN = " << tiaParams.NLmin << " > " << tiaParams.NLmax << " = NLMAX!";
1528  }
1529 
1534 
1535  // check for maximum order on the command line
1536  if ( commandLine_.argExists ("-maxord") )
1537  {
1538 
1540  atoi( commandLine_.getArgumentValue( "-maxord" ).c_str() );
1541  }
1542 
1543  if ( tiaParams.maxOrder < 1) tiaParams.maxOrder = 1;
1544  if ( tiaParams.maxOrder > 5) tiaParams.maxOrder = 5;
1545 
1546  if (tiaParams.newLte == true)
1547  {
1548  if (tiaParams.relErrorTolGiven != true)
1549  tiaParams.relErrorTol = 1.0e-3;
1550  }
1551 
1552  return true;
1553 
1554 }
1555 
1556 //-----------------------------------------------------------------------------
1557 // Function : AnalysisManager::setMPDEAnalysisParams
1558 // Purpose : Sets the MPDE sweep calculation parameters (from .MPDE)
1559 // Special Notes :
1560 // Scope : public
1561 // Creator : Todd Coffey, 1414
1562 // Creation Date : 7/23/08
1563 //-----------------------------------------------------------------------------
1564 bool AnalysisManager::setMPDEAnalysisParams(const N_UTL_OptionBlock & OB)
1565 {
1566  if (Teuchos::is_null(mpdeMgrPtr_))
1567  {
1568  setupMPDEMgr_();
1569  }
1570  bool bsuccess = mpdeMgrPtr_->setMPDEAnalysisParams(OB);
1572  analysisParamsRegistered = true;
1573  mpdeParamsBlock = OB;
1574  return bsuccess;
1575 }
1576 
1577 //-----------------------------------------------------------------------------
1578 // Function : AnalysisManager::setMPDEOptions
1579 // Purpose :
1580 // Special Notes : from '.options mpdeint'
1581 // Scope : public
1582 // Creator : Todd Coffey, 1414
1583 // Creation Date : 7/23/08
1584 //-----------------------------------------------------------------------------
1585 bool AnalysisManager::setMPDEOptions(const N_UTL_OptionBlock & OB)
1586 {
1587  if (Teuchos::is_null(mpdeMgrPtr_))
1588  {
1589  setupMPDEMgr_();
1590  }
1591  mpdeMgrPtr_->setMPDEOptions(OB);
1592  return true;
1593 }
1594 
1595 //-----------------------------------------------------------------------------
1596 // Function : AnalysisManager::setHBAnalysisParams
1597 // Purpose : Sets the HB sweep calculation parameters (from .HB)
1598 // Special Notes :
1599 // Scope : public
1600 // Creator : Todd Coffey, Ting Mei
1601 // Creation Date : 7/30/08
1602 //-----------------------------------------------------------------------------
1603 bool AnalysisManager::setHBAnalysisParams(const N_UTL_OptionBlock & OB)
1604 {
1605  std::list<N_UTL_Param>::const_iterator it_tpL;
1606  std::list<N_UTL_Param>::const_iterator first = OB.getParams().begin();
1607  std::list<N_UTL_Param>::const_iterator last = OB.getParams().end();
1608 
1609  for (it_tpL = first; it_tpL != last; ++it_tpL)
1610  {
1611  if (it_tpL->uTag() == "FREQ")
1612  {
1613 
1614  tiaParams.freqs = it_tpL->getValue<std::vector<double> >();
1615  tiaParams.freqGiven = true;
1616  }
1617  }
1618 
1619  if (tiaParams.freqs[0] <= 0.0 )
1620  {
1621  Report::UserError() << "Frequency of oscillation " << tiaParams.freqs[0] << " is less than or equal to zero, invalid .HB specification";
1622  }
1623 
1624  if ((DEBUG_ANALYSIS & tiaParams.debugLevel) > 0)
1625  {
1626  dout() << section_divider << std::endl
1627  << "HB transient simulation parameters"
1628  //<< Util::push << std::endl
1629  << std::endl
1630  << "HB frequency = " << tiaParams.freqs[0] << std::endl
1631  //<< Util::pop << std::endl;
1632  << std::endl;
1633  }
1634 
1635  setBlockAnalysisFlag( true );
1636  devInterfacePtr->setBlockAnalysisFlag( true );
1638  analysisParamsRegistered = true;
1639  hbParamsBlock = OB;
1640  return true;
1641 }
1642 
1643 //-----------------------------------------------------------------------------
1644 // Function : AnalysisManager::setHBOptions
1645 // Purpose :
1646 // Special Notes : from '.options hb'
1647 // Scope : public
1648 // Creator : Todd Coffey, 1414
1649 // Creation Date : 7/23/08
1650 //-----------------------------------------------------------------------------
1651 bool AnalysisManager::setHBOptions(const N_UTL_OptionBlock & OB)
1652 {
1653  hbOptionsBlock = OB;
1654  return true;
1655 }
1656 
1657 //-----------------------------------------------------------------------------
1658 // Function : AnalysisManager::setLinSol
1659 // Purpose :
1660 // Special Notes :
1661 // Scope : public
1662 // Creator : Eric R. Keiter, SNL
1663 // Creation Date : 07/12/2013
1664 //-----------------------------------------------------------------------------
1665 bool AnalysisManager::setLinSol(const N_UTL_OptionBlock & OB)
1666 {
1667  linSolBlock = OB;
1668  return true;
1669 }
1670 
1671 //-----------------------------------------------------------------------------
1672 // Function : AnalysisManager::setHBLinSol
1673 // Purpose :
1674 // Special Notes :
1675 // Scope : public
1676 // Creator : Heidi Thornquist, 1437
1677 // Creation Date : 11/11/08
1678 //-----------------------------------------------------------------------------
1679 bool AnalysisManager::setHBLinSol(const N_UTL_OptionBlock & OB)
1680 {
1681  hbLinSolBlock = OB;
1682  return true;
1683 }
1684 
1685 //-----------------------------------------------------------------------------
1686 // Function : AnalysisManager::setTRANMPDEOptions
1687 // Purpose :
1688 // Special Notes : from '.options timeint-mpde'
1689 // Scope : public
1690 // Creator : Todd Coffey, 1414
1691 // Creation Date : 7/23/08
1692 //-----------------------------------------------------------------------------
1693 bool AnalysisManager::setTRANMPDEOptions(const N_UTL_OptionBlock & OB)
1694 {
1695  if (Teuchos::is_null(mpdeMgrPtr_))
1696  {
1697  setupMPDEMgr_();
1698  }
1699  mpdeMgrPtr_->registerTranMPDEOptions(OB);
1700  return true;
1701 }
1702 
1703 //-----------------------------------------------------------------------------
1704 // Function : AnalysisManager::setSensOptions
1705 // Purpose :
1706 // Special Notes :
1707 // Scope : public
1708 // Creator : Eric Keiter, Sandia
1709 // Creation Date : 6/5/13
1710 //-----------------------------------------------------------------------------
1711 bool AnalysisManager::setSensOptions(const N_UTL_OptionBlock & OB)
1712 {
1713  sensFlag_=true;
1714  return true;
1715 }
1716 
1717 //-----------------------------------------------------------------------------
1718 // Function : AnalysisManager::completeOPStartStep
1719 // Purpose : Call to rotate next state to current state following a
1720 // : constrained DCOP solve when using a previous operating point
1721 // Special Notes : Called from the Xyce-LOCA interface.
1722 // Scope : public
1723 // Creator : Dave Shirley
1724 // Creation Date : 06/27/2006
1725 //-----------------------------------------------------------------------------
1727 {
1728  bool bsuccess = true;
1729 
1730  bsuccess = tiaDataStore_->updateStateDataArrays ();
1731  tiaDataStore_->setConstantHistory();
1732  tiaDataStore_->equateTmpVectors();
1733 
1734  return bsuccess;
1735 }
1736 
1737 //-----------------------------------------------------------------------------
1738 // Function : AnalysisManager::completeHomotopyStep
1739 // Purpose : Call to do final cleanup after a single,
1740 // successful homotopy step.
1741 // Special Notes : Called from the Xyce-LOCA interface.
1742 // Scope : public
1743 // Creator : Eric Keiter, SNL
1744 // Creation Date : 03/20/2006
1745 //-----------------------------------------------------------------------------
1747  ( const std::vector<std::string> & paramNames,
1748  const std::vector<double> & paramVals,
1749  N_LAS_Vector * solnVecPtr )
1750 {
1751  bool bsuccess = true;
1752 
1753 #ifdef Xyce_DEBUG_ANALYSIS
1754  std::string netListFile = commandLine_.getArgumentValue("netlist");
1755  Xyce::dout() << "\n " << netListFile;
1756  Xyce::dout() << " AnalysisManager::completeHomotopyStep " << std::endl;
1757 #endif
1758 
1759  // Rotate the data vectors:
1760  bool bs1 = tiaDataStore_->updateStateDataArrays (); bsuccess = bsuccess && bs1;
1761  tiaDataStore_->setConstantHistory();
1762  tiaDataStore_->equateTmpVectors();
1763 
1764  // Pass info in to the lower level solver:
1765  loaderPtr->homotopyStepSuccess (paramNames,paramVals);
1766 
1767  // Call output
1768  outputMgrAdapterRCPtr_->outputHomotopy( paramNames, paramVals, *solnVecPtr );
1769 
1770  return bsuccess;
1771 }
1772 
1773 //-----------------------------------------------------------------------------
1774 // Function : AnalysisManager::failHomotopyStep
1775 // Purpose : Call to do final cleanup after a single,
1776 // failed homotopy step.
1777 // Special Notes : Called from the Xyce-LOCA interface.
1778 // Scope : public
1779 // Creator : Eric Keiter, SNL
1780 // Creation Date : 03/30/2006
1781 //-----------------------------------------------------------------------------
1783 {
1784  bool bsuccess = true;
1785 
1786 #ifdef Xyce_DEBUG_ANALYSIS
1787  std::string netListFile = commandLine_.getArgumentValue("netlist");
1788  Xyce::dout() << "\n " << netListFile;
1789  Xyce::dout() << " AnalysisManager::failHomotopyStep " << std::endl;
1790 #endif
1791 
1792  // Pass info in to the lower level solver:
1793  loaderPtr->homotopyStepFailure ();
1794 
1795  return bsuccess;
1796 }
1797 
1798 //-----------------------------------------------------------------------------
1799 // Function : AnalysisManager::setupMPDEMgr_
1800 // Purpose :
1801 // Special Notes :
1802 // Scope : private
1803 // Creator : Todd Coffey, 1414
1804 // Creation Date : 7/23/08
1805 //-----------------------------------------------------------------------------
1807 {
1808 
1809  // Allocate new MPDE Manager
1810  mpdeMgrPtr_ = rcp(new N_MPDE_Manager(commandLine_));
1811 
1812  // Register MPDE manager with everything
1813  bool bs1 = true;
1814  bool bsuccess = true;
1815  bs1 = outMgrPtr->registerMPDEManager(&*mpdeMgrPtr_);
1816  bsuccess = bsuccess && bs1;
1817  mpdeMgrPtr_->registerAnalysisInterface(anaIntPtr);
1818  mpdeMgrPtr_->registerNonlinearSolver(nlsMgrPtr);
1819  mpdeMgrPtr_->registerDeviceInterface(devInterfacePtr);
1820  mpdeMgrPtr_->registerParallelManager(pdsMgrPtr);
1821  mpdeMgrPtr_->registerTopology(topoMgrPtr);
1822  mpdeMgrPtr_->registerRestartManager(restartPtr);
1823  mpdeMgrPtr_->registerOutputManager(outMgrPtr);
1824  mpdeMgrPtr_->registerApplicationLoader(loaderPtr);
1825  mpdeMgrPtr_->registerNonlinearEquationLoader(nonlinearEquationLoaderPtr);
1826  mpdeMgrPtr_->registerApplicationBuilder(appBuilderPtr);
1827  mpdeMgrPtr_->registerLinearSystem(lasSysPtr);
1828  mpdeMgrPtr_->registerElapsedTimer(elapsedTimerPtr_);
1829 
1830  mpdeMgrPtr_->registerTIAMPDEInterface(tiaMPDEIfacePtr_);
1831 
1832  if (!bsuccess)
1833  {
1834  Report::DevelFatal0().in("AnalysisManager::setupMPDEMgr_") << "Registration function failed";
1835  }
1836 }
1837 
1838 //-----------------------------------------------------------------------------
1839 // Function : AnalysisManager::initializeTransientModel
1840 // Purpose : ModelEvaluator Interface
1841 // Special Notes :
1842 // Scope : private
1843 // Creator : Coffey, Schiek, Mei
1844 // Creation Date : 05/29/09
1845 //-----------------------------------------------------------------------------
1847 {
1848  wimPtr->createTimeIntegMethod(TIAMethod_BACKWARD_DIFFERENTIATION_15);
1849 }
1850 
1851 //-----------------------------------------------------------------------------
1852 // Function : AnalysisManager::evalTransientModel
1853 // Purpose : ModelEvaluator Interface
1854 // Special Notes :
1855 // Scope : private
1856 // Creator : Coffey, Schiek, Mei
1857 // Creation Date : 05/27/09
1858 //-----------------------------------------------------------------------------
1860  double t,
1861  N_LAS_Vector * SolVectorPtr,
1862  N_LAS_Vector * CurrSolVectorPtr,
1863  N_LAS_Vector * LastSolVectorPtr,
1864  N_LAS_Vector * StaVectorPtr,
1865  N_LAS_Vector * CurrStaVectorPtr,
1866  N_LAS_Vector * LastStaVectorPtr,
1867  N_LAS_Vector * StaDerivVectorPtr,
1868  N_LAS_Vector * StoVectorPtr,
1869  N_LAS_Vector * CurrStoVectorPtr,
1870  N_LAS_Vector * LastStoVectorPtr,
1871  N_LAS_Vector * stoLeadCurrQCompVectorPtr,
1872  N_LAS_Vector * QVectorPtr,
1873  N_LAS_Vector * FVectorPtr,
1874  N_LAS_Vector * dFdxdVpVectorPtr,
1875  N_LAS_Vector * dQdxdVpVectorPtr,
1876  N_LAS_Matrix * dQdxMatrixPtr,
1877  N_LAS_Matrix * dFdxMatrixPtr
1878  )
1879 {
1880  // This is F,Q load:
1881  bool bsuccess = loaderPtr->loadDAEVectors(
1882  SolVectorPtr,
1883  CurrSolVectorPtr,
1884  LastSolVectorPtr,
1885  StaVectorPtr,
1886  CurrStaVectorPtr,
1887  LastStaVectorPtr,
1888  StaDerivVectorPtr,
1889  StoVectorPtr,
1890  CurrStoVectorPtr,
1891  LastStoVectorPtr,
1892  stoLeadCurrQCompVectorPtr,
1893  QVectorPtr,
1894  FVectorPtr,
1895  dFdxdVpVectorPtr,
1896  dQdxdVpVectorPtr
1897  );
1898  // This is dQdx, dFdx load:
1899  bsuccess = bsuccess && loaderPtr->loadDAEMatrices(
1900  SolVectorPtr,
1901  StaVectorPtr,
1902  StaDerivVectorPtr,
1903  StoVectorPtr,
1904  dQdxMatrixPtr,
1905  dFdxMatrixPtr);
1906  return bsuccess;
1907 }
1908 
1909 //-----------------------------------------------------------------------------
1910 // Function : AnalysisManager::evalTransientModelState
1911 // Purpose : ModelEvaluator Interface
1912 // Special Notes :
1913 // Scope : private
1914 // Creator : Coffey, Schiek, Mei
1915 // Creation Date : 05/29/09
1916 //-----------------------------------------------------------------------------
1918  double t,
1919  N_LAS_Vector * SolVectorPtr,
1920  N_LAS_Vector * StaVectorPtr,
1921  N_LAS_Vector * StoVectorPtr
1922  )
1923 {
1924  // This is part of state vector load:
1925  secPtr_->currentTime = t;
1926  secPtr_->nextTime = t;
1927  loaderPtr->updateSources(); // updates source values wrt time t.
1928  bool bsuccess = loaderPtr->updateState(
1929  SolVectorPtr,
1930  SolVectorPtr,
1931  SolVectorPtr,
1932  StaVectorPtr,
1933  StaVectorPtr,
1934  StaVectorPtr,
1935  StoVectorPtr,
1936  StoVectorPtr,
1937  StoVectorPtr
1938  );
1939  return bsuccess;
1940 }
1941 
1942 // ***** Accessor methods *****
1943 //-----------------------------------------------------------------------------
1944 // Function : AnalysisManager::setBeginningIntegrationFlag
1945 // Purpose :
1946 // Special Notes :
1947 // Scope : public
1948 // Creator : Eric R. Keiter, SNL
1949 // Creation Date :
1950 //-----------------------------------------------------------------------------
1952 {
1953  primaryAnalysisObject_->setBeginningIntegrationFlag(bif);
1954 }
1955 
1956 //-----------------------------------------------------------------------------
1957 // Function : AnalysisManager::getBeginningIntegrationFlag
1958 // Purpose :
1959 // Special Notes :
1960 // Scope : public
1961 // Creator : Eric R. Keiter, SNL
1962 // Creation Date :
1963 //-----------------------------------------------------------------------------
1965 {
1966  return primaryAnalysisObject_->getBeginningIntegrationFlag();
1967 }
1968 
1969 //-----------------------------------------------------------------------------
1970 // Function : AnalysisManager::setIntegrationMethod
1971 // Purpose :
1972 // Special Notes :
1973 // Scope : public
1974 // Creator : Eric R. Keiter, SNL
1975 // Creation Date :
1976 //-----------------------------------------------------------------------------
1978 {
1979  primaryAnalysisObject_->setIntegrationMethod (im);
1980 }
1981 
1982 //-----------------------------------------------------------------------------
1983 // Function : AnalysisManager::getIntegrationMethod
1984 // Purpose :
1985 // Special Notes :
1986 // Scope : public
1987 // Creator : Eric R. Keiter, SNL
1988 // Creation Date :
1989 //-----------------------------------------------------------------------------
1991 {
1992  return primaryAnalysisObject_->getIntegrationMethod ();
1993 }
1994 
1995 
1996 //-----------------------------------------------------------------------------
1997 // Function : AnalysisManager::getTotalLinearSolutionTime
1998 // Purpose :
1999 // Special Notes :
2000 // Scope : public
2001 // Creator : Eric R. Keiter, SNL
2002 // Creation Date :
2003 //-----------------------------------------------------------------------------
2005 {
2006  return primaryAnalysisObject_->getTotalLinearSolutionTime();
2007 }
2008 
2009 //-----------------------------------------------------------------------------
2010 // Function : AnalysisManager::getTotalResidualLoadTime
2011 // Purpose :
2012 // Special Notes :
2013 // Scope : public
2014 // Creator : Eric R. Keiter, SNL
2015 // Creation Date :
2016 //-----------------------------------------------------------------------------
2018 {
2019  return primaryAnalysisObject_->getTotalResidualLoadTime();
2020 }
2021 
2022 //-----------------------------------------------------------------------------
2023 // Function : AnalysisManager::getTotalJacobianLoadTime
2024 // Purpose :
2025 // Special Notes :
2026 // Scope : public
2027 // Creator : Eric R. Keiter, SNL
2028 // Creation Date :
2029 //-----------------------------------------------------------------------------
2031 {
2032  return primaryAnalysisObject_->getTotalJacobianLoadTime();
2033 }
2034 
2035 //-----------------------------------------------------------------------------
2036 // Function : AnalysisManager::getDoubleDCOPEnabled ()
2037 // Purpose :
2038 // Special Notes :
2039 // Scope : public
2040 // Creator :
2041 // Creation Date :
2042 //-----------------------------------------------------------------------------
2044 {
2045  return primaryAnalysisObject_->getDoubleDCOPEnabled ();
2046 }
2047 
2048 //-----------------------------------------------------------------------------
2049 // Function : AnalysisManager::simulationComplete
2050 // Purpose : return boolean signifying whether simulation complete or
2051 // not.
2052 //
2053 // Special Notes :THIS VERSION IS ONLY VALID FOR TRANSIENT RUNS, where
2054 // completion of the simulation means integration to final
2055 // time.
2056 // Scope : public
2057 // Creator : Tom Russo, SNL, Component Information and Models
2058 // Creation Date : 05/06/2004
2059 //-----------------------------------------------------------------------------
2061 {
2063  {
2064  return (secPtr_->finished());
2065  }
2066  else
2067  {
2068  Report::DevelFatal0().in("AnalysisManager::simulationComplete") << "Called for non-transient run, not currently valid";
2069  return false;
2070  }
2071 }
2072 
2073 //-----------------------------------------------------------------------------
2074 // Function : AnalysisManager::getPauseTime
2075 //
2076 // Purpose : return the time at which the simulation will pause
2077 //
2078 // Special Notes :
2079 // Scope : public
2080 // Creator : Tom Russo, SNL, Component Information and Models
2081 // Creation Date : 04/29/2004
2082 //-----------------------------------------------------------------------------
2084 {
2085  return(tiaParams.pauseTime);
2086 }
2087 
2088 //-----------------------------------------------------------------------------
2089 // Function : AnalysisManager::getStepNumber
2090 // Purpose :
2091 // Special Notes :
2092 // Scope : public
2093 // Creator :
2094 // Creation Date : 12/16/2010
2095 //-----------------------------------------------------------------------------
2097 {
2098  int number=0;
2099  if( !is_null( primaryAnalysisObject_ ) )
2100  {
2101  number = primaryAnalysisObject_->getStepNumber();
2102  }
2103  return number;
2104 }
2105 
2106 //-----------------------------------------------------------------------------
2107 // Function : AnalysisManager::getTranStepNumber
2108 // Purpose :
2109 // Special Notes :
2110 // Scope : public
2111 // Creator :
2112 // Creation Date : 12/16/2010
2113 //-----------------------------------------------------------------------------
2115 {
2116  int number=0;
2117  if (analysis == ANP_MODE_TRANSIENT && !is_null(primaryAnalysisObject_) )
2118  {
2119  number = primaryAnalysisObject_->getTranStepNumber();
2120  }
2121  return number;
2122 }
2123 
2124 //-----------------------------------------------------------------------------
2125 // Function : AnalysisManager::setStepNumber
2126 // Purpose :
2127 // Special Notes :
2128 // Scope : public
2129 // Creator :
2130 // Creation Date : 12/16/2010
2131 //-----------------------------------------------------------------------------
2133 {
2134  if( !is_null( primaryAnalysisObject_ ) )
2135  {
2136  primaryAnalysisObject_->setStepNumber(step);
2137  }
2138 }
2139 
2140 //-----------------------------------------------------------------------------
2141 // Function : AnalysisManager::setTranStepNumber
2142 // Purpose :
2143 // Special Notes :
2144 // Scope : public
2145 // Creator :
2146 // Creation Date : 12/16/2010
2147 //-----------------------------------------------------------------------------
2149 {
2150  if( !is_null( primaryAnalysisObject_ ) )
2151  {
2152  primaryAnalysisObject_->setTranStepNumber(step);
2153  }
2154 }
2155 
2156 
2157 //-----------------------------------------------------------------------------
2158 // Function : AnalysisManager::getInitTranFlag
2159 // Purpose :
2160 // Special Notes :
2161 // Scope : public
2162 // Creator :
2163 // Creation Date : 12/16/2010
2164 //-----------------------------------------------------------------------------
2166 {
2167  int stepNum = getStepNumber();
2168  return (stepNum <= 0);
2169 }
2170 
2171 //-----------------------------------------------------------------------------
2172 // Function : AnalysisManager::getTime
2173 // Purpose : Gets the next time value.
2174 // Special Notes :
2175 // Scope : public
2176 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2177 // Creation Date : 6/27/00
2178 //-----------------------------------------------------------------------------
2180 {
2181  return secPtr_->nextTime;
2182 }
2183 
2184 //-----------------------------------------------------------------------------
2185 // Function : AnalysisManager::getCurrentTime
2186 // Purpose : Gets the current time value.
2187 // Special Notes :
2188 // Scope : public
2189 // Creator : Richard Schiek, Electrical and Mems Modeling
2190 // Creation Date : 8/21/2009
2191 //-----------------------------------------------------------------------------
2193 {
2194  return secPtr_->currentTime;
2195 }
2196 
2197 //-----------------------------------------------------------------------------
2198 // Function : AnalysisManager::getFinalTime
2199 // Purpose : Gets the final time-step value.
2200 // Special Notes :
2201 // Scope : public
2202 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2203 // Creation Date : 6/27/00
2204 //-----------------------------------------------------------------------------
2206 {
2207  return secPtr_->finalTime;
2208 }
2209 
2210 //-----------------------------------------------------------------------------
2211 // Function : AnalysisManager::getInitialTime
2212 // Purpose : Gets the initial time-step value.
2213 // Special Notes :
2214 // Scope : public
2215 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2216 // Creation Date : 6/27/00
2217 //-----------------------------------------------------------------------------
2219 {
2220  return secPtr_->initialTime;
2221 }
2222 
2223 //-----------------------------------------------------------------------------
2224 // Function : AnalysisManager::getStartingTimeStep
2225 // Purpose : Gets the starting time-step value.
2226 // Special Notes :
2227 // Scope : public
2228 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2229 // Creation Date : 6/27/00
2230 //-----------------------------------------------------------------------------
2232 {
2233  return secPtr_->startingTimeStep;
2234 }
2235 
2236 //-----------------------------------------------------------------------------
2237 // Function : AnalysisManager::getTimeIntMode
2238 // Purpose : Gets the time-integration method.
2239 // Special Notes :
2240 // Scope : public
2241 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2242 // Creation Date : 03/02/01
2243 //-----------------------------------------------------------------------------
2245 {
2246  return primaryAnalysisObject_->getIntegrationMethod();
2247 }
2248 
2249 //-----------------------------------------------------------------------------
2250 // Function : AnalysisManager::getSteadyStateFlag
2251 // Purpose : Gets a flag indicating we are in steady state.
2252 // (steady=true)
2253 // Special Notes :
2254 // Scope : public
2255 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2256 // Creation Date : 03/02/01
2257 //-----------------------------------------------------------------------------
2259 {
2260  return ((primaryAnalysisObject_->getIntegrationMethod())==TIAMethod_NONE);
2261 }
2262 
2263 //-----------------------------------------------------------------------------
2264 // Function : AnalysisManager::getInputOPFlag
2265 // Purpose : Gets a flag indicating we are starting from a previous OP
2266 // Special Notes :
2267 // Scope : public
2268 // Creator : Dave Shirley, PSSI
2269 // Creation Date : 04/13/06
2270 //-----------------------------------------------------------------------------
2272 {
2273  return primaryAnalysisObject_->getInputOPFlag();
2274 }
2275 
2276 //-----------------------------------------------------------------------------
2277 // Function : AnalysisManager::getTranOPFlag
2278 // Purpose : Gets a flag indicating we are in a DCOP calculation that is
2279 // the initialization for a transient simulation.
2280 // Special Notes :
2281 // Scope : public
2282 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2283 // Creation Date : 02/28/05
2284 //-----------------------------------------------------------------------------
2286 {
2288  && (primaryAnalysisObject_->getIntegrationMethod())==TIAMethod_NONE);
2289 }
2290 
2291 //-----------------------------------------------------------------------------
2292 // Function : AnalysisManager::getACOPFlag
2293 // Purpose : Gets a flag indicating we are in a DCOP calculation that is
2294 // the initialization for a transient simulation.
2295 // Special Notes :
2296 // Scope : public
2297 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2298 // Creation Date : 04/16/12
2299 //-----------------------------------------------------------------------------
2301 {
2302  return ((analysis == ANP_MODE_AC || primaryAnalysisObject_->isAnalysis(ANP_MODE_AC))
2303  && (primaryAnalysisObject_->getIntegrationMethod())==TIAMethod_NONE);
2304 }
2305 
2306 //-----------------------------------------------------------------------------
2307 // Function : AnalysisManager::getDCSweepFlag
2308 // Purpose :
2309 // Special Notes :
2310 // Scope : public
2311 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2312 // Creation Date : 02/28/05
2313 //-----------------------------------------------------------------------------
2315 {
2317 }
2318 
2319 //-----------------------------------------------------------------------------
2320 // Function : AnalysisManager::getTransientFlag
2321 // Purpose :
2322 // Special Notes :
2323 // Scope : public
2324 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2325 // Creation Date : 02/28/05
2326 //-----------------------------------------------------------------------------
2328 {
2330  && (primaryAnalysisObject_->getIntegrationMethod()) !=TIAMethod_NONE));
2331 }
2332 
2333 //-----------------------------------------------------------------------------
2334 // Function : AnalysisManager::getDoubleDCOPStep
2335 // Purpose : Gets the double DC Operating Point step value.
2336 // Special Notes :
2337 // Scope : public
2338 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2339 // Creation Date : 04/25/01
2340 //-----------------------------------------------------------------------------
2342 {
2343  return primaryAnalysisObject_->getDoubleDCOPStep();
2344 }
2345 
2346 //-----------------------------------------------------------------------------
2347 // Function : AnalysisManager::getCurrentStepSize
2348 // Purpose : Returns the "current" time step size.
2349 // Special Notes :
2350 // Scope : public
2351 // Creator : Eric R. Keiter, SNL, Computational Sciences
2352 // Creation Date : 07/15/01
2353 //-----------------------------------------------------------------------------
2355 {
2356  return secPtr_->currentTimeStep;
2357 }
2358 
2359 //-----------------------------------------------------------------------------
2360 // Function : AnalysisManager::getLastStepSize
2361 // Purpose : Returns the "last" time step size.
2362 // Special Notes :
2363 // Scope : public
2364 // Creator : Eric R. Keiter, SNL, Computational Sciences
2365 // Creation Date : 07/15/01
2366 //-----------------------------------------------------------------------------
2368 {
2369  return secPtr_->lastTimeStep;
2370 }
2371 
2372 //-----------------------------------------------------------------------------
2373 // Function : AnalysisManager::updateDerivs
2374 // Purpose : Calls the time int. method to update the corrector
2375 // derivatives.
2376 // Special Notes :
2377 // Scope : public
2378 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2379 // Creation Date : 6/13/00
2380 //-----------------------------------------------------------------------------
2382 {
2383  wimPtr->obtainCorrectorDeriv();
2384  return true;
2385 }
2386 
2387 //-----------------------------------------------------------------------------
2388 // Function : AnalysisManager::updateDivDiffs
2389 // Purpose : Updates the divided difference values.
2390 // Special Notes :
2391 // Scope : public
2392 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2393 // Creation Date : 6/27/00
2394 //-----------------------------------------------------------------------------
2396 {
2397  tiaDataStore_->computeDividedDifferences();
2398  return true;
2399 }
2400 
2401 //-----------------------------------------------------------------------------
2402 // Function : AnalysisManager::updateDerivsBlock
2403 // Purpose :
2404 // Special Notes :
2405 // Scope : public
2406 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2407 // Creation Date : 01/10/01
2408 //-----------------------------------------------------------------------------
2410  const std::list<index_pair> & solGIDList,
2411  const std::list<index_pair> & staGIDList)
2412 {
2413  tiaDataStore_->computeDivDiffsBlock(solGIDList,staGIDList);
2414  wimPtr->updateDerivsBlock (solGIDList, staGIDList);
2415 
2416  return true;
2417 }
2418 
2419 //-----------------------------------------------------------------------------
2420 // Function : AnalysisManager::equateTmpVectors
2421 // Purpose :
2422 // Special Notes :
2423 // Scope : public
2424 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
2425 // Creation Date : 01/24/02
2426 //-----------------------------------------------------------------------------
2428 {
2429  return tiaDataStore_->equateTmpVectors();
2430 }
2431 
2432 //-----------------------------------------------------------------------------
2433 // Function : AnalysisManager::registerElapsedTimer
2434 // Purpose :
2435 // Special Notes :
2436 // Scope : public
2437 // Creator : Dave Shirley, PSSI
2438 // Creation Date : 02/24/06
2439 //-----------------------------------------------------------------------------
2441 {
2442  elapsedTimerPtr_ = rcp(et,false);
2443  return true;
2444 }
2445 
2446 //-----------------------------------------------------------------------------
2447 // Function : AnalysisManager::restartDataSize
2448 // Purpose :
2449 // Special Notes :
2450 // Scope : public
2451 // Creator : Rob Hoekstra, SNL, Computational Sciences
2452 // Creation Date : 07/31/01
2453 //-----------------------------------------------------------------------------
2455 {
2456  return secPtr_->restartDataSize( pack );
2457 }
2458 
2459 //-----------------------------------------------------------------------------
2460 // Function : AnalysisManager::dumpRestartData
2461 // Purpose :
2462 // Special Notes :
2463 // Scope : public
2464 // Creator : Rob Hoekstra, SNL, Computational Sciences
2465 // Creation Date : 07/31/01
2466 //-----------------------------------------------------------------------------
2468  (char * buf, int bsize, int & pos, N_PDS_Comm * comm, bool pack)
2469 {
2470  return secPtr_->dumpRestartData(buf, bsize, pos, comm, pack);
2471 }
2472 
2473 //-----------------------------------------------------------------------------
2474 // Function : AnalysisManager::restoreRestartData
2475 // Purpose :
2476 // Special Notes :
2477 // Scope : public
2478 // Creator : Rob Hoekstra, SNL, Computational Sciences
2479 // Creation Date : 07/31/01
2480 //-----------------------------------------------------------------------------
2482  (char * buf, int bsize, int & pos, N_PDS_Comm * comm, bool pack)
2483 {
2484  return secPtr_->restoreRestartData(buf, bsize, pos, comm, pack);
2485 }
2486 
2487 //-----------------------------------------------------------------------------
2488 // Function : AnalysisManager::getSolnVarData
2489 // Purpose :
2490 // Special Notes :
2491 // Scope : public
2492 // Creator : Rob Hoekstra, SNL, Computational Sciences
2493 // Creation Date : 07/31/01
2494 //-----------------------------------------------------------------------------
2495 bool AnalysisManager::getSolnVarData( const int & gid,
2496  std::vector<double> & varData )
2497 {
2498  return tiaDataStore_->getSolnVarData( gid, varData );
2499 }
2500 
2501 //-----------------------------------------------------------------------------
2502 // Function : AnalysisManager::getStateVarData
2503 // Purpose :
2504 // Special Notes :
2505 // Scope : public
2506 // Creator : Rob Hoekstra, SNL, Computational Sciences
2507 // Creation Date : 07/31/01
2508 //-----------------------------------------------------------------------------
2509 bool AnalysisManager::getStateVarData( const int & gid,
2510  std::vector<double> & varData )
2511 {
2512  return tiaDataStore_->getStateVarData( gid, varData );
2513 }
2514 
2515 //-----------------------------------------------------------------------------
2516 // Function : AnalysisManager::getStoreVarData
2517 // Purpose :
2518 // Special Notes :
2519 // Scope : public
2520 // Creator : Eric Keiter
2521 // Creation Date :
2522 //-----------------------------------------------------------------------------
2523 bool AnalysisManager::getStoreVarData( const int & gid,
2524  std::vector<double> & varData )
2525 {
2526  return tiaDataStore_->getStoreVarData( gid, varData );
2527 }
2528 
2529 //-----------------------------------------------------------------------------
2530 // Function : AnalysisManager::getOrder
2531 // Purpose :
2532 // Special Notes :
2533 // Scope : public
2534 // Creator : Eric Keiter, SNL, Computational Sciences
2535 // Creation Date : 02/15/07
2536 //-----------------------------------------------------------------------------
2538 {
2539  return wimPtr->getOrder();
2540 }
2541 
2542 //-----------------------------------------------------------------------------
2543 // Function : AnalysisManager::getNumberOfSteps
2544 // Purpose :
2545 // Special Notes :
2546 // Scope : public
2547 // Creator : Eric Keiter, SNL, Computational Sciences
2548 // Creation Date : 03/01/07
2549 //-----------------------------------------------------------------------------
2551 {
2552  return wimPtr->getNumberOfSteps();
2553 }
2554 
2555 //-----------------------------------------------------------------------------
2556 // Function : AnalysisManager::getUsedOrder
2557 // Purpose :
2558 // Special Notes :
2559 // Scope : public
2560 // Creator : Eric Keiter, SNL, Computational Sciences
2561 // Creation Date : 03/01/07
2562 //-----------------------------------------------------------------------------
2564 {
2565  return wimPtr->getUsedOrder();
2566 }
2567 
2568 //-----------------------------------------------------------------------------
2569 // Function : AnalysisManager::getNscsco
2570 // Purpose :
2571 // Special Notes :
2572 // Scope : public
2573 // Creator : Eric Keiter, SNL, Computational Sciences
2574 // Creation Date : 03/01/07
2575 //-----------------------------------------------------------------------------
2577 {
2578  return wimPtr->getNscsco();
2579 }
2580 
2581 //-----------------------------------------------------------------------------
2582 // Function : AnalysisManager::setSolnVarData
2583 // Purpose :
2584 // Special Notes :
2585 // Scope : public
2586 // Creator : Rob Hoekstra, SNL, Computational Sciences
2587 // Creation Date : 07/31/01
2588 //-----------------------------------------------------------------------------
2589 bool AnalysisManager::setSolnVarData( const int & gid,
2590  const std::vector<double> & varData )
2591 {
2592  return tiaDataStore_->setSolnVarData( gid, varData );
2593 }
2594 
2595 //-----------------------------------------------------------------------------
2596 // Function : AnalysisManager::setStateVarData
2597 // Purpose :
2598 // Special Notes :
2599 // Scope : public
2600 // Creator : Rob Hoekstra, SNL, Computational Sciences
2601 // Creation Date : 07/31/01
2602 //-----------------------------------------------------------------------------
2603 bool AnalysisManager::setStateVarData( const int & gid,
2604  const std::vector<double> & varData )
2605 {
2606  return tiaDataStore_->setStateVarData( gid, varData );
2607 }
2608 
2609 //-----------------------------------------------------------------------------
2610 // Function : AnalysisManager::setStoreVarData
2611 // Purpose :
2612 // Special Notes :
2613 // Scope : public
2614 // Creator : Eric Keiter
2615 // Creation Date :
2616 //-----------------------------------------------------------------------------
2617 bool AnalysisManager::setStoreVarData( const int & gid,
2618  const std::vector<double> & varData )
2619 {
2620  return tiaDataStore_->setStoreVarData( gid, varData );
2621 }
2622 
2623 //-----------------------------------------------------------------------------
2624 // Function : AnalysisManager::registerTIAParams
2625 // Purpose :
2626 // Special Notes :
2627 // Scope : public
2628 // Creator : Eric R. Keiter, SNL, Computational Sciences
2629 // Creation Date : 09/06/01
2630 //-----------------------------------------------------------------------------
2632 {
2633  tiaParams = tiaParams_tmp;
2634 
2635  if (!Teuchos::is_null(secPtr_))
2636  {
2637  secPtr_->setTIAParams();
2638  }
2639 
2640  return true;
2641 }
2642 
2643 //-----------------------------------------------------------------------------
2644 // Function : AnalysisManager::registerMPDEInterface
2645 // Purpose :
2646 // Special Notes :
2647 // Scope : public
2648 // Creator : Todd S. Coffey, 9214
2649 // Creation Date : 03/26/04
2650 //-----------------------------------------------------------------------------
2652 {
2653  tiaMPDEIfacePtr_ = rcp(tiaMPDEIface_tmp,false);
2654  return true;
2655 }
2656 
2657 //-----------------------------------------------------------------------------
2658 // Function : AnalysisManager::registerLinearSystem
2659 // Purpose : Added to make it easier for the lasSysPtr pointer to be
2660 // non-static.
2661 // Special Notes :
2662 // Scope : public
2663 // Creator : Eric R. Keiter, SNL, Computational Sciences
2664 // Creation Date : 04/17/02
2665 //-----------------------------------------------------------------------------
2666 bool AnalysisManager::registerLinearSystem(N_LAS_System * lasSysPtr_tmp)
2667 {
2668  lasSysPtr = rcp(lasSysPtr_tmp,false);
2669  return true;
2670 }
2671 
2672 //-----------------------------------------------------------------------------
2673 // Function : AnalysisManager::registerNLSManager
2674 // Purpose : Added to make it easier for the nlsSysPtr pointer to be
2675 // non-static.
2676 // Special Notes :
2677 // Scope : public
2678 // Creator : Eric R. Keiter, SNL, Computational Sciences
2679 // Creation Date : 04/17/02
2680 //-----------------------------------------------------------------------------
2682 {
2683  nlsMgrPtr = rcp(nlsMgrPtr_tmp,false);
2684  return true;
2685 }
2686 
2687 //-----------------------------------------------------------------------------
2688 // Function : AnalysisManager::registerLoader
2689 // Purpose : Added to make it easier for the loaderPtr pointer to be
2690 // non-static.
2691 // Special Notes :
2692 // Scope : public
2693 // Creator : Eric R. Keiter, SNL, Computational Sciences
2694 // Creation Date : 04/18/02
2695 //-----------------------------------------------------------------------------
2696 bool AnalysisManager::registerLoader(N_LOA_Loader * loaderPtr_tmp)
2697 {
2698  loaderPtr = rcp(loaderPtr_tmp,false);
2699  return true;
2700 }
2701 
2702 //-----------------------------------------------------------------------------
2703 // Function : AnalysisManager::registerOutputMgr
2704 // Purpose : Added to make it easier for the outputPtr pointer to be
2705 // non-static.
2706 // Special Notes :
2707 // Scope : public
2708 // Creator : Eric R. Keiter, SNL, Computational Sciences
2709 // Creation Date : 04/18/02
2710 //-----------------------------------------------------------------------------
2711 bool AnalysisManager::registerOutputMgr(N_IO_OutputMgr * outputPtr_tmp)
2712 {
2713  outMgrPtr = rcp(outputPtr_tmp,false);
2715  outputMgrAdapterRCPtr_->registerOutputMgr( outputPtr_tmp );
2716 
2717  return true;
2718 }
2719 
2720 //-----------------------------------------------------------------------------
2721 // Function : AnalysisManager::registerRestartMgr
2722 // Purpose : Added to make it easier for the restartPtr pointer to be
2723 // non-static.
2724 // Special Notes :
2725 // Scope : public
2726 // Creator : Eric R. Keiter, SNL, Computational Sciences
2727 // Creation Date : 04/18/02
2728 //-----------------------------------------------------------------------------
2730  N_IO_RestartMgr * restartPtr_tmp)
2731 {
2732  restartPtr = rcp(restartPtr_tmp,false);
2733  return true;
2734 }
2735 
2736 //-----------------------------------------------------------------------------
2737 // Function : AnalysisManager::registerNonlinearEquationLoader
2738 // Purpose :
2739 // Special Notes :
2740 // Scope : public
2741 // Creator : Todd Coffey, 1414
2742 // Creation Date : 07/23/08
2743 //-----------------------------------------------------------------------------
2744 bool AnalysisManager::registerNonlinearEquationLoader( N_LOA_NonlinearEquationLoader * nonlinearEquationLoaderPtr_tmp )
2745 {
2746  nonlinearEquationLoaderPtr = rcp(nonlinearEquationLoaderPtr_tmp,false);
2747  return true;
2748 }
2749 
2750 //-----------------------------------------------------------------------------
2751 // Function : AnalysisManager::registerDeviceInterface
2752 // Purpose :
2753 // Special Notes :
2754 // Scope : public
2755 // Creator : Todd Coffey, 1414
2756 // Creation Date : 07/23/08
2757 //-----------------------------------------------------------------------------
2759 {
2760  devInterfacePtr = rcp(devInterfacePtr_tmp,false);
2761  return true;
2762 }
2763 
2764 
2765 //-----------------------------------------------------------------------------
2766 // Function : AnalysisManager::registerTopology
2767 // Purpose :
2768 // Special Notes :
2769 // Scope : public
2770 // Creator : Todd Coffey, 1414
2771 // Creation Date : 07/23/08
2772 //-----------------------------------------------------------------------------
2773 bool AnalysisManager::registerTopology( N_TOP_Topology * topoMgrPtr_tmp )
2774 {
2775  topoMgrPtr = rcp(topoMgrPtr_tmp,false);
2776  return true;
2777 }
2778 
2779 
2780 //-----------------------------------------------------------------------------
2781 // Function : AnalysisManager::registerApplicationBuilder
2782 // Purpose :
2783 // Special Notes :
2784 // Scope : public
2785 // Creator : Todd Coffey, 1414
2786 // Creation Date : 07/23/08
2787 //-----------------------------------------------------------------------------
2788 bool AnalysisManager::registerApplicationBuilder( N_LAS_Builder * appBuilderPtr_tmp )
2789 {
2790  appBuilderPtr = rcp(appBuilderPtr_tmp,false);
2791  return true;
2792 }
2793 
2794 //-----------------------------------------------------------------------------
2795 // Function : AnalysisManager::registerParallelServices
2796 // Purpose :
2797 // Special Notes :
2798 // Scope : public
2799 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
2800 // Creation Date : 04/19/02
2801 //-----------------------------------------------------------------------------
2802 bool AnalysisManager::registerParallelServices(N_PDS_Manager * pds_tmp)
2803 {
2804  pdsMgrPtr = rcp(pds_tmp,false);
2805  return true;
2806 }
2807 
2808 //-----------------------------------------------------------------------------
2809 // Function : AnalysisManager::setNextSolVectorPtr
2810 // Purpose :
2811 // Special Notes :
2812 // Scope : public
2813 // Creator : Eric R. Keiter,SNL, Computational Sciences
2814 // Creation Date : 04/22/2003
2815 //-----------------------------------------------------------------------------
2816 bool AnalysisManager::setNextSolVectorPtr (N_LAS_Vector * solVecPtr)
2817 {
2818  return tiaDataStore_->setNextSolVectorPtr (solVecPtr);
2819 }
2820 
2821 //-----------------------------------------------------------------------------
2822 // Function : AnalysisManager::setPauseTime
2823 //
2824 // Purpose : Set the time at which to pause the simulation
2825 //
2826 // Special Notes : This is a temporary implementation that I'm using to
2827 // begin the process of hiding time integrator internals from
2828 // the "N_CIR_Xyce::simulateUntil" method, so that I can
2829 // ultimately change those internals without the simulateUntil
2830 // method
2831 // In the zero order version, just sets tiaParams.pauseTime
2832 // Scope : public
2833 // Creator : Tom Russo, SNL, Component Information and Models
2834 // Creation Date : 04/29/2004
2835 //-----------------------------------------------------------------------------
2836 void AnalysisManager::setPauseTime(double pauseTime)
2837 {
2838  secPtr_->setBreakPoint(N_UTL_BreakPoint(pauseTime, Util::PAUSE_BREAKPOINT));
2839 }
2840 
2841 
2842 
2843 //-----------------------------------------------------------------------------
2844 // Function : AnalysisManager::resumeSimulation
2845 //
2846 // Purpose : set flag to signify that simulation is continuation of
2847 // previously paused simulation.
2848 //
2849 // Special Notes : This is a temporary implementation that I'm using to
2850 // begin the process of hiding time integrator internals from
2851 // the "N_CIR_Xyce::simulateUntil" method, so that I can
2852 // ultimately change those internals without the simulateUntil
2853 // method
2854 // In the zero order version, just sets tiaParams.resume=true
2855 // Scope : public
2856 // Creator : Tom Russo, SNL, Component Information and Models
2857 // Creation Date : 04/29/2004
2858 //-----------------------------------------------------------------------------
2860 {
2861  tiaParams.resume=true;
2862 }
2863 
2864 //-----------------------------------------------------------------------------
2865 // Function : AnalysisManager::unset_resumeSimulation
2866 // Purpose : UN-set flag to signify that simulation is continuation of
2867 // previously paused simulation.
2868 // Special Notes :
2869 // Scope : public
2870 // Creator : Eric Keiter
2871 // Creation Date : 06/12/2013
2872 //-----------------------------------------------------------------------------
2874 {
2875  tiaParams.resume=false;
2876 }
2877 
2878 //-----------------------------------------------------------------------------
2879 // Function : AnalysisManager::outputIntervalSpecified_
2880 // Purpose : Return true if user has specified output control options
2881 // Special Notes :
2882 // Scope : public
2883 // Creator : Tom Russo, SNL, Electrical and Microsystems modeling
2884 // Creation Date : 2/12/07
2885 //-----------------------------------------------------------------------------
2887 {
2888  // This is necessary and sufficient ---
2889  return (initialOutputInterval_ > 0.0);
2890 }
2891 
2892 // routines to get/set Dakota run flags and actually run a Dakota iteration
2893 //-----------------------------------------------------------------------------
2894 // Function : AnalysisManager::getDakotaRunFlag
2895 // Purpose :
2896 // Special Notes :
2897 // Scope : public
2898 // Creator : Richard Schiek
2899 // Creation Date :
2900 //-----------------------------------------------------------------------------
2902 {
2903  return dakotaRunFlag_;
2904 }
2905 
2906 
2907 //-----------------------------------------------------------------------------
2908 // Function : AnalysisManager::setDakotaRunFlag
2909 // Purpose :
2910 // Special Notes :
2911 // Scope : public
2912 // Creator : Richard Schiek
2913 // Creation Date :
2914 //-----------------------------------------------------------------------------
2916 {
2917  dakotaRunFlag_ = flag;
2918 }
2919 
2920 
2921 //-----------------------------------------------------------------------------
2922 // Function : AnalysisManager::getDakotaIteration
2923 // Purpose :
2924 // Special Notes :
2925 // Scope : public
2926 // Creator : Richard Schiek
2927 // Creation Date :
2928 //-----------------------------------------------------------------------------
2930 {
2931  return dakotaIterationNumber_;
2932 }
2933 
2934 //-----------------------------------------------------------------------------
2935 // Function : AnalysisManager::setDakotaIteration
2936 // Purpose :
2937 // Special Notes :
2938 // Scope : public
2939 // Creator : Richard Schiek
2940 // Creation Date :
2941 //-----------------------------------------------------------------------------
2943 {
2944  dakotaIterationNumber_ = iterNumber;
2945 }
2946 
2947 //-----------------------------------------------------------------------------
2948 // Function : AnalysisManager::getTimeIntInfo
2949 // Purpose :
2950 // Special Notes :
2951 // Scope : public
2952 // Creator : Eric Keiter
2953 // Creation Date :
2954 //-----------------------------------------------------------------------------
2956 {
2957  tiInfo.currentOrder = getOrder ();
2958  tiInfo.numberOfSteps = getNumberOfSteps ();
2959  tiInfo.usedOrder = getUsedOrder ();
2960  tiInfo.nscsco = getNscsco ();
2961 
2962  tiInfo.pdt = partialTimeDerivative(); // alpha/DT
2963  tiInfo.nextTimeStep = getCurrentStepSize();
2964  tiInfo.currTimeStep = getLastStepSize();
2965  tiInfo.currentTime = secPtr_->currentTime;
2966  tiInfo.nextTime = getTime();
2967  tiInfo.finalTime = getFinalTime();
2969  tiInfo.bpTol = getBreakpointTol();
2970 
2971  tiInfo.dcopFlag = getSteadyStateFlag ();
2972  tiInfo.inputOPFlag = getInputOPFlag ();
2973  tiInfo.tranopFlag = getTranOPFlag ();
2974  tiInfo.acopFlag = getACOPFlag ();
2975  tiInfo.transientFlag = getTransientFlag ();
2976  tiInfo.dcsweepFlag = getDCSweepFlag ();
2978 
2979  tiInfo.timeStepNumber = getStepNumber();
2980  tiInfo.initTranFlag = getInitTranFlag ();
2982 
2983  tiInfo.doubleDCOPStep = getDoubleDCOPStep();
2985 
2986  tiInfo.stepLoopIter = 0;
2987  if( stepLoopFlag_ )
2988  {
2989  analysisObject_->getStepIter();
2990  }
2991 
2992  tiInfo.timeIntMode = getTimeIntMode();
2993 }
2994 
2995 //-----------------------------------------------------------------------------
2996 // Function : AnalysisManager::silenceProgress
2997 // Purpose : Shut up "Percent Complete" noises
2998 // Special Notes :
2999 // Scope : public
3000 // Creator : Tom Russo
3001 // Creation Date : 11 Feb 2009
3002 //-----------------------------------------------------------------------------
3004 {
3005  progressFlag_ = false;
3006 }
3007 
3008 //-----------------------------------------------------------------------------
3009 // Function : AnalysisManager::enableProgress
3010 // Purpose : stop shutting up "Percent Complete" noises
3011 // Special Notes :
3012 // Scope : public
3013 // Creator : Tom Russo
3014 // Creation Date : 11 Feb 2009
3015 //-----------------------------------------------------------------------------
3017 {
3018  progressFlag_ = true;
3019 }
3020 
3021 } // namespace Analysis
3022 } // namespace Xyce