Xyce  6.1
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-2015 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-----------------------------------------------------------------------------
26 // Filename : $RCSfile: N_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.243.2.1 $
36 // Revision Date : $Date: 2015/04/02 18:20:07 $
37 // Current Owner : $Author: tvrusso $
38 //-----------------------------------------------------------------------------
39 
40 #include <Xyce_config.h>
41 
42 // ---------- Standard Includes ----------
43 #include <ctime>
44 #include <iostream>
45 #include <sstream>
46 
47 #include <N_ANP_AnalysisManager.h>
48 
49 #include <N_ANP_AC.h>
50 #include <N_ANP_DCSweep.h>
51 #include <N_ANP_Dakota.h>
52 #include <N_ANP_Factory.h>
53 #include <N_ANP_HB.h>
54 #include <N_ANP_MOR.h>
55 #include <N_ANP_MPDE.h>
56 #include <N_ANP_NOISE.h>
57 #include <N_ANP_OutputMgrAdapter.h>
58 #include <N_ANP_Report.h>
59 #include <N_ANP_Step.h>
60 #include <N_ANP_Transient.h>
61 #include <N_DEV_DeviceMgr.h>
62 #include <N_IO_ActiveOutput.h>
63 #include <N_IO_CmdParse.h>
64 #include <N_IO_OutputMgr.h>
65 #include <N_IO_PkgOptionsMgr.h>
66 #include <N_IO_RestartMgr.h>
67 #include <N_LAS_LAFactory.h>
68 #include <N_LAS_Matrix.h>
69 #include <N_LAS_System.h>
70 #include <N_LAS_Vector.h>
71 #include <N_LOA_CktLoader.h>
72 #include <N_LOA_Loader.h>
74 #include <N_NLS_Manager.h>
77 #include <N_TIA_DataStore.h>
79 #include <N_TIA_StepErrorControl.h>
80 #include <N_TIA_TIAParams.h>
81 #include <N_TIA_TimeIntInfo.h>
83 #include <N_TIA_TwoLevelError.h>
84 #include <N_UTL_BreakPoint.h>
85 #include <N_UTL_Diagnostic.h>
86 #include <N_UTL_ExtendedString.h>
87 #include <N_UTL_FeatureTest.h>
88 #include <N_UTL_OptionBlock.h>
89 #include <N_UTL_Stats.h>
90 #include <N_UTL_Timer.h>
91 
92 namespace Xyce {
93 namespace Analysis {
94 
95 //-----------------------------------------------------------------------------
96 // Function : analysisModeName
97 // Purpose :
98 // Special Notes :
99 // Scope : public
100 // Creator : David G. Baur Raytheon Sandia National Laboratories 1355
101 // Creation Date : Tue Oct 21 11:22:31 2014
102 //-----------------------------------------------------------------------------
103 ///
104 /// Returns a const char pointer to a name representing the mode.
105 ///
106 /// @param mode Analysis mode to get name of
107 ///
108 /// @return Name corresponding to the mode
109 ///
110 ///
111 const char *
113  Mode mode)
114 {
115  static const char * const mode_names[] = {"Invalid", "DC OP", "DC Sweep", "Transient", "MPDE", "HB", "AC", "NOISE", "MOR"};
116 
117  if (mode < sizeof(mode_names)/sizeof(mode_names[0]))
118  return mode_names[mode];
119  else
120  return mode_names[0];
121 }
122 
123 //-----------------------------------------------------------------------------
124 // Function : nonlinearAnalysisMode
125 // Purpose : Convert between Nonlinear::Manager AnalysisMode enum and
126 // : expanded AnalysisManager::Manager::Mode enum.
127 // Special Notes :
128 // Scope :
129 // Creator : Todd Coffey, 1414
130 // Creation Date : 07/23/08
131 //-----------------------------------------------------------------------------
132 ///
133 /// Returns the nonlinear analysis mode given the analysis mode
134 ///
135 /// @param mode Analysis mode
136 ///
137 /// @return Nonlinear analysis mode
138 ///
139 ///
142  Mode mode)
143 {
144  Nonlinear::AnalysisMode outMode;
145  if (mode == ANP_MODE_TRANSIENT)
146  {
147  outMode = Nonlinear::TRANSIENT;
148  }
149  else if (mode == ANP_MODE_DC_OP)
150  {
151  outMode = Nonlinear::DC_OP;
152  }
153  else if (mode == ANP_MODE_DC_SWEEP)
154  {
155  outMode = Nonlinear::DC_SWEEP;
156  }
157  else if (mode == ANP_MODE_HB)
158  {
159  outMode = Nonlinear::HB_MODE;
160  }
161  else
162  {
163  outMode = Nonlinear::NUM_MODES; // Should be this be TRANSIENT?
164  }
165  return outMode;
166 }
167 
168 //-----------------------------------------------------------------------------
169 // Function : AnalysisManager::AnalysisManager
170 // Purpose : constructor
171 // Special Notes :
172 // Scope : public
173 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
174 // Creation Date : 01/24/08
175 //-----------------------------------------------------------------------------
176 ///
177 /// Constructs the analysis manager. The analysis manager is responsible for the construction and control of the top
178 /// level analysis.
179 ///
180 /// @invariant
181 ///
182 /// @param command_line Command line that started Xyce
183 /// @param restart_manager
184 /// @param output_manager_adapter
185 /// @param analysis_stat Base node of the analysis stats collection
186 ///
187 ///
189  const IO::CmdParse & command_line,
190  IO::RestartMgr & restart_manager,
191  OutputMgrAdapter & output_manager_adapter,
192  Stats::Stat analysis_stat)
193  : StepEventNotifier(),
195  StepEventListener(this),
196  AnalysisEventListener(this),
197  commandLine_(command_line),
198  netlistFilename_(command_line.getArgumentValue("netlist")),
199  restartManager_(restart_manager),
200  outputManagerAdapter_(output_manager_adapter),
201  workingIntgMethod_(0),
202  stepErrorControl_(0),
203  nonlinearEquationLoader_(0),
204  loader_(0),
205  cktLoaderPtr_(0),
206  parallelManager_(0),
207  dataStore_(0),
208  activeOutput_(0),
209  analysisMode_(ANP_MODE_TRANSIENT),
210  resumeSimulation_(false),
211  blockAnalysisFlag_(false),
212  daeStateDerivFlag_(true),
213  dcopRestartFlag_(false),
214  saveFlag_(false),
215  dotOpSpecified_(false),
216  gui_(command_line.argExists("-gui")),
217  progressFlag_(true),
218  saveTimeGiven_(false),
219  savedAlready_(false),
220  sensFlag_(false),
221  sweepSourceResetFlag_(true),
222  switchIntegrator_(false),
223  xyceTranTimerPtr_(),
224  elapsedTimerPtr_(0),
225  solverStartTime_(0.0),
226  saveTime_(0.0),
227  nextOutputTime_(0.0),
228  nextRestartSaveTime_(0.0),
229  analysisObject_(0),
230  primaryAnalysisObject_(0),
231  breakPointRestartStep(0),
232  analysisStat_(analysis_stat),
233  twoLevelMode_(TWO_LEVEL_MODE_TRANSIENT_DCOP)
234 {
235  IO::setTimeIntegratorDebugLevel(command_line, 1);
236 }
237 
238 //-----------------------------------------------------------------------------
239 // Function : AnalysisManager::~AnalysisManager
240 //
241 // Purpose : destructor
242 // Special Notes :
243 // Scope : public
244 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
245 // Creation Date : 01/24/08
246 //-----------------------------------------------------------------------------
248 {
249  delete cktLoaderPtr_;
251  delete workingIntgMethod_;
252  delete dataStore_;
253  delete stepErrorControl_;
254 
255  for (std::vector<AnalysisBase *>::iterator it = analysisVector_.begin(), end = analysisVector_.end(); it !=end; ++it)
256  delete (*it);
257 
258  for (Registry::iterator it = registry_.begin(), end = registry_.end(); it !=end; ++it)
259  delete (*it);
260 }
261 
262 
263 //-----------------------------------------------------------------------------
264 // Function : AnalysisManager::notify
265 // Purpose :
266 // Special Notes :
267 // Scope : public
268 // Creator : David G. Baur Raytheon Sandia National Laboratories 1355
269 // Creation Date : Mon Jul 14 12:15:30 2014
270 //-----------------------------------------------------------------------------
271 ///
272 /// Notification that there is a StepEvent.
273 ///
274 /// @param step_event information about the event
275 ///
276 void
278  const StepEvent & step_event)
279 {
280  if (step_event.state_ == StepEvent::STEP_STARTED) {
282  }
283 }
284 
285 //-----------------------------------------------------------------------------
286 // Function : AnalysisManager::notify
287 // Purpose :
288 // Special Notes :
289 // Scope : public
290 // Creator : David G. Baur Raytheon Sandia National Laboratories 1355
291 // Creation Date : Mon Jul 14 12:15:30 2014
292 //-----------------------------------------------------------------------------
293 ///
294 /// Notification that there is a AnalysisEvent.
295 ///
296 /// @param time_integrator_event information about the event
297 ///
298 void
300  const AnalysisEvent & analysis_event)
301 {
302 // Xyce::dout() << Dump<AnalysisEvent>(analysis_event) << std::endl;
303 }
304 
305 
306 void
308  const TimeIntg::TIAParams & tia_params,
309  const unsigned int integration_method)
310 {
311  workingIntgMethod_->createTimeIntegMethod(integration_method, tia_params, *stepErrorControl_, *dataStore_);
312 }
313 
314 //-----------------------------------------------------------------------------
315 // Function : AnalysisManager::resetSolverSystem
316 //
317 // Purpose : just like a destructor without the death
318 // Special Notes :
319 // Scope : public
320 // Creator : Todd Coffey, Rich Schiek, Ting Mei
321 // Creation Date : 7/24/08
322 //-----------------------------------------------------------------------------
324 {
325  // dataStore_ is created in initializeAll
326  delete dataStore_;
327  dataStore_ = 0;
328 
329  // stepErrorControl_ is created in initializeAll
330  delete stepErrorControl_;
331  stepErrorControl_ = 0;
332 
333  // workingIntgMethod_ is created in initializeAll
334  delete workingIntgMethod_;
335  workingIntgMethod_ = 0;
336 
337  // Reset step statistics to zero.
339 }
340 
341 //-----------------------------------------------------------------------------
342 // Function : AnalysisManager::isPaused
343 //
344 // Purpose : return the true if the simulation is currently paused
345 //
346 // Special Notes :
347 // Scope : public
348 // Creator : Rich Schiek, SNL, Electrical and Microsystems Simulation
349 // Creation Date : 02/18/2008
350 //-----------------------------------------------------------------------------
352 {
353  return stepErrorControl_->isPauseTime();
354 }
355 
356 //-----------------------------------------------------------------------------
357 // Function : AnalysisManager::createLoader
358 // Purpose :
359 // Special Notes :
360 // Scope : public
361 // Creator : David G. Baur Raytheon Sandia National Laboratories 1355
362 // Creation Date : Mon Mar 16 14:04:17 2015
363 //-----------------------------------------------------------------------------
364 ///
365 /// Creates the defaults circuit loader.
366 ///
367 /// @invariant This circuit loader is owned by the manager and will be destroyed during manager destruction.
368 ///
369 /// @param device_manager Device manager needed to construct the circuit loader.
370 ///
371 /// @return default circuit loader
372 ///
373 ///
376 {
377  cktLoaderPtr_ = new Loader::CktLoader(device_manager);
378 
379  return *cktLoaderPtr_;
380 }
381 
382 //-----------------------------------------------------------------------------
383 // Function : AnalysisManager::initializeSolverSystem
384 // Purpose :
385 // Special Notes :
386 // Scope : public
387 // Creator : David G. Baur Raytheon Sandia National Laboratories 1355
388 // Creation Date : Mon Mar 16 14:06:00 2015
389 //-----------------------------------------------------------------------------
390 ///
391 /// Initializes the solver system. Called on initial analysis assembly and on change of time integrator.
392 ///
393 /// @invariant There be gremlins here. The datas tore, step error control, time integrator (managed by the working
394 /// integrator method) and nonlinear equation loader are destroyed and recreated. Hopefully none of the subordinate
395 /// users of those objects are stll hanging on. The linear system will have much of its information replaced by data
396 /// from the newly created datastore and vice versa.
397 ///
398 ///
399 ///
400 /// @param tia_params Time integrator parameters to construct new time integrator
401 /// @param loader Loader to loader linear system
402 /// @param linear_system Linear system
403 /// @param nonlinear_manager Nonlinear system
404 /// @param device_manager Device Manager
405 ///
406 /// @return true if initialization was successful
407 ///
408 ///
410  const TimeIntg::TIAParams & tia_params,
411  Loader::Loader & loader,
412  Linear::System & linear_system,
413  Nonlinear::Manager & nonlinear_manager,
414  Device::DeviceMgr & device_manager)
415 {
416  Stats::Stat stat(std::string(analysisObject_->getName()), analysisStat_);
417 
418  int solutionSize = linear_system.getSolutionSize();
419  int stateSize = linear_system.getStateSize();
420 
421  // allocate data store class, which will allocate all the vectors.
422  delete dataStore_;
423  delete stepErrorControl_;
424  delete workingIntgMethod_;
426 
427  dataStore_ = new TimeIntg::DataStore(solutionSize, stateSize, tia_params.maxOrder, linear_system, linear_system.builder());
429  stepErrorControl_ = new TimeIntg::StepErrorControl(netlistFilename_, *this, *workingIntgMethod_, tia_params);
430  nonlinearEquationLoader_ = new Loader::NonlinearEquationLoader(*dataStore_, loader, device_manager, *workingIntgMethod_, daeStateDerivFlag_);
431 
432  dataStore_->resetAll(tia_params.absErrorTol, tia_params.relErrorTol);
433 
436 
437  // register current:
438  linear_system.registerCurrStaVector(&dataStore_->currStatePtr);
439  linear_system.registerCurrSolVector(&dataStore_->currSolutionPtr);
440 
441  // register next:
442  linear_system.registerNextStaVector(&dataStore_->nextStatePtr);
443  linear_system.registerNextSolVector(&dataStore_->nextSolutionPtr);
444 
445  // register last:
446  linear_system.registerLastStaVector(&dataStore_->lastStatePtr);
447  linear_system.registerLastSolVector(&dataStore_->lastSolutionPtr);
448 
449  linear_system.registerFlagSolVector(&dataStore_->flagSolutionPtr);
450 
451  // register temporaries:
452  linear_system.registerTmpSolVector(&dataStore_->tmpSolVectorPtr);
453  linear_system.registerTmpStaVector(&dataStore_->tmpStaVectorPtr);
454  linear_system.registerTmpStaDerivVector(&dataStore_->tmpStaDerivPtr);
455  linear_system.registerTmpStaDivDiffVector(&dataStore_->tmpStaDivDiffPtr);
456 
457  // register next derivatives:
458  linear_system.registerNextSolDerivVector(&dataStore_->nextSolutionDerivPtr);
459  linear_system.registerNextStaDerivVector(&dataStore_->nextStateDerivPtr);
460 
461  // register the device mask
462  linear_system.registerDeviceMaskVector(&dataStore_->deviceErrorWeightMask_);
463 
464  // Get the RHS and the Jacobian
465  dataStore_->JMatrixPtr = linear_system.getJacobianMatrix();
466  dataStore_->RHSVectorPtr = linear_system.getRHSVector();
467 
468  // DAE formulation vectors
469  linear_system.registerDAEQVector(dataStore_->daeQVectorPtr);
470  linear_system.registerDAEFVector(dataStore_->daeFVectorPtr);
471  linear_system.registerDAEBVector(dataStore_->daeBVectorPtr);
472 
473  // DAE formulation matrices
474  linear_system.registerDAEdQdxMatrix(dataStore_->dQdxMatrixPtr);
475  linear_system.registerDAEdFdxMatrix(dataStore_->dFdxMatrixPtr);
476 
477  // Get the limiter vectors
478  dataStore_->dFdxdVpVectorPtr = linear_system.getdFdxdVpVector();
479  dataStore_->dQdxdVpVectorPtr = linear_system.getdQdxdVpVector();
480 
482 
483  return true;
484 }
485 
486 //-----------------------------------------------------------------------------
487 // Function : AnalysisManager::getBlockAnalysisFlag
488 // Purpose :
489 // Special Notes :
490 // Scope : public
491 // Creator : David G. Baur Raytheon Sandia National Laboratories 1355
492 // Creation Date : Mon Mar 16 14:12:17 2015
493 //-----------------------------------------------------------------------------
494 ///
495 /// Return true if primary analysis is HB or MPDE.
496 ///
497 ///
498 /// @return true if primary analysis is HB or MPDE.
499 ///
500 ///
501 bool
503 {
504  return dynamic_cast<Analysis::HB *>(primaryAnalysisObject_) || dynamic_cast<Analysis::MPDE *>(primaryAnalysisObject_);
505 }
506 
507 //-----------------------------------------------------------------------------
508 // Function : AnalysisManager::run
509 // Purpose : Execute the control loop for the set analysis type.
510 // Special Notes :
511 // Scope : public
512 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
513 // Creation Date : 01/24/08
514 //-----------------------------------------------------------------------------
515 ///
516 /// Runs the top level analysis.
517 ///
518 /// @invariant
519 ///
520 ///
521 /// @return
522 ///
523 ///
524 bool
526 {
527  Stats::StatTop _analysisStat("Analysis");
528  Stats::TimeBlock _analysisTimer(_analysisStat);
529 
531  {
532  Report::UserError0() << "No analysis statement in the netlist";
533  return false;
534  }
535 
536  bool runStatus = false;
537  {
538  // This prepares the outputters for this analysis mode
539  IO::ActiveOutput active(outputManagerAdapter_.getOutputManager());
540 
541  active.setStepSweepVector(outputManagerAdapter_.getStepSweepVector());
542  active.setDCSweepVector(outputManagerAdapter_.getDCSweepVector());
543  active.add(parallelManager_->getPDSComm()->comm(), analysisMode_);
544 
545  if (VERBOSE_TIME)
547 
549 
550  Report::safeBarrier(parallelManager_->getPDSComm()->comm());
551 
552  solverStartTime_ = elapsedTimerPtr_->elapsedTime();
553 
554  // Start the solvers timers.
555  xyceTranTimerPtr_.resetStartTime();
556 
557  runStatus = analysisObject_->run();
558  }
559 
560  return runStatus;
561 }
562 
563 //-----------------------------------------------------------------------------
564 // Function : AnalysisManager::allocateAnalysisObject
565 // Purpose : Allocate analysis objects, and also setup params.
566 // Special Notes :
567 // Scope : private
568 // Creator : Eric Keiter, SNL
569 // Creation Date : 06/24/10
570 //-----------------------------------------------------------------------------
571 ///
572 /// Creates the primary analysis and driving analysis (.STEP, dakota).
573 ///
574 /// If no analysis was specified and .OP was specified, create a DC analysis as the primary analysis
575 ///
576 /// @invariant
577 ///
578 ///
579 void
581 {
582  // .OP, but no analysis creates a dcsweep analysis.
583  if (dotOpSpecified_ && (creatorVector_.empty() || (creatorVector_.size() == 1 && creatorVector_.front()->isType<Step>())))
584  {
585  for (CreatorVector::const_iterator it = registry_.begin(), end = registry_.end(); it != end; ++it) {
586  if ((*it)->isType<DCSweep>()) {
588  primaryAnalysisObject_ = (*it)->create();
590  }
591  }
592  }
593 
594  // CRAZY HACK UNTIL PRIORITY QUEUE OR SOMETHING CLEVER ON ANALYSIS TYPES
595  for (CreatorVector::const_iterator it = creatorVector_.begin(), end = creatorVector_.end(); it != end; ++it) {
596  if (!(*it)->isType<Step>()) {
597  primaryAnalysisObject_ = (*it)->create();
599  }
600  }
601  for (CreatorVector::const_iterator it = creatorVector_.begin(), end = creatorVector_.end(); it != end; ++it) {
602  if ((*it)->isType<Step>()) {
603  analysisObject_ = (*it)->create();
604  analysisVector_.push_back(analysisObject_);
606  }
607  }
608 
610  {
611  Report::UserError() << "Analysis mode " << analysisMode_ << " is not available";
612  return;
613  }
614 
616 
617  if (!analysisObject_)
619 }
620 
621 //-----------------------------------------------------------------------------
622 // Function : AnalysisManager::printLoopInfo
623 // Purpose : Prints out time loop information.
624 // Special Notes : Prints stats from save point start to save point finish.
625 // Special case 0,0 is entire run to this point
626 // Scope : public
627 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
628 // Creation Date : 6/26/00
629 //-----------------------------------------------------------------------------
630 bool AnalysisManager::printLoopInfo(int start, int finish)
631 {
632  return primaryAnalysisObject_->printLoopInfo(start, finish);
633 }
634 
635 //-----------------------------------------------------------------------------
636 // Function : AnalysisManager::testDCOPOutputTime_
637 // Purpose : Similar to testOutputTime, except that this is for
638 // DCOP restart files.
639 // Special Notes :
640 // Scope : public
641 // Creator : Eric Keiter, SNL
642 // Creation Date : 10/18/07
643 //-----------------------------------------------------------------------------
644 ///
645 /// Returns true if the DCOP Restart parameters have been set
646 ///
647 /// @return true if the DCOP Restart parameters have been set
648 ///
650 {
651  return dcopRestartFlag_;
652 }
653 
654 //-----------------------------------------------------------------------------
655 // Function : AnalysisManager::testSaveOutputTime
656 // Purpose : Similar to testOutputTime, except that this is for
657 // .SAVE files.
658 // Special Notes : Only outputs 1x.
659 // Scope : public
660 // Creator : Eric Keiter, SNL
661 // Creation Date : 10/18/07
662 //-----------------------------------------------------------------------------
664 {
665  bool flag = true;
666 
667  if( !saveFlag_ )
668  {
669  flag = false;
670  }
672  {
673  flag = false;
674  }
675  else if (savedAlready_)
676  {
677  flag = false;
678  }
679 
680  if (flag)
681  {
682  savedAlready_ = true;
683  Xyce::dout() << "Calling SAVE outputs!" <<std::endl;
684  }
685 
686  return flag;
687 }
688 
689 //-----------------------------------------------------------------------------
690 // Function : AnalysisManager::testRestartSaveTime_
691 // Purpose :
692 // Special Notes :
693 // Scope : public
694 // Creator : Rob Hoekstra, SNL, Parallel ComputationalSciences.
695 // Creation Date : 07/31/01
696 //-----------------------------------------------------------------------------
697 bool
699 {
700  double initial_restart_interval = restartManager_.getInitialRestartInterval();
701  const IO::IntervalVector &restart_intervals = restartManager_.getRestartIntervals();
702 
703  if (DEBUG_RESTART)
704  {
705  Xyce::dout() << "TESTING FOR RESTART SAVE" << std::endl
706  << Xyce::subsection_divider << std::endl
707  << "stepErrorControl_->currentTime: " << stepErrorControl_->currentTime << std::endl
708  << "nextSaveTime: " << nextRestartSaveTime_ << std::endl
709  << "initial_restart_interval: " << initial_restart_interval << std::endl;
710  if (!restart_intervals.empty())
711  {
712  Xyce::dout() << "First restart interval: " << restart_intervals[0].first << std::endl;
713  }
714  else
715  {
716  Xyce::dout() << "restart_intervals is empty" << std::endl;
717  }
718  }
719 
720  bool flag = false;
721  if (initial_restart_interval == 0.0)
722  {
723  flag = false;
724  }
726  {
727  flag = false;
728  }
729  else if (restart_intervals.empty())
730  {
731  while (nextRestartSaveTime_ <= stepErrorControl_->currentTime)
732  {
733  nextRestartSaveTime_ += initial_restart_interval;
734  }
735  flag = true;
736  }
737  else if (stepErrorControl_->currentTime < restart_intervals[0].first)
738  {
739  while (nextRestartSaveTime_ <= stepErrorControl_->currentTime)
740  {
741  nextRestartSaveTime_ += initial_restart_interval;
742  }
743  if (nextRestartSaveTime_ > restart_intervals[0].first)
744  {
745  nextRestartSaveTime_ = restart_intervals[0].first;
746  }
747  flag = true;
748  }
749  else
750  {
751  std::pair<double, double> currInterval, nextInterval;
752  int size = restart_intervals.size();
753  for (int i = 0; i < size; ++i)
754  {
755  if (restart_intervals[i].first <= stepErrorControl_->currentTime)
756  {
757  currInterval = restart_intervals[i];
758  if ((i+1) < (int)restart_intervals.size())
759  {
760  nextInterval = restart_intervals[i+1];
761  }
762  }
763  }
764  int step = static_cast <int> ((stepErrorControl_->currentTime-currInterval.first) /
765  currInterval.second);
766  nextRestartSaveTime_ = currInterval.first + (step+1)*currInterval.second;
767 
768  if (nextInterval.first && (nextInterval.first!=currInterval.first)
769  && (nextRestartSaveTime_>=nextInterval.first))
770  {
771  nextRestartSaveTime_ = nextInterval.first;
772  }
773  flag = true;
774  }
775 
776  if (DEBUG_RESTART)
777  Xyce::dout() << "new nextSaveTime: " << nextRestartSaveTime_ << std::endl
778  << "restart flag: " << flag << std::endl
779  << Xyce::subsection_divider << std::endl;
780 
781  return flag;
782 }
783 
784 
785 //-----------------------------------------------------------------------------
786 // Function : AnalysisManager::setOPAnalysisParams
787 // Purpose : Handle OP statement. (.OP)
788 // Special Notes :
789 // Scope : public
790 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
791 // Creation Date : 10/15/07
792 //-----------------------------------------------------------------------------
794  const Util::OptionBlock & paramsBlock)
795 {
796  dotOpSpecified_ = true;
797 
798  return true;
799 }
800 
801 //-----------------------------------------------------------------------------
802 // Function : AnalysisManager::setSaveOptions
803 // Purpose : Sets the Save parameters.
804 // Special Notes : Most of these parameters are handled in the output manager,
805 // rather than here. So, most params are a noop here, except
806 // for "TIME".
807 // Scope : public
808 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
809 // Creation Date : 10/18/07
810 //-----------------------------------------------------------------------------
812  const Util::OptionBlock & options)
813 {
814  saveFlag_ = true;
815 
816  for (Util::ParamList::const_iterator it = options.begin(), end = options.end(); it != end; ++it)
817  if ((*it).tag() == "TIME")
818  saveTime_ = (*it).getImmutableValue<double>();
819 
820  return true;
821 }
822 
823 //-----------------------------------------------------------------------------
824 // Function : AnalysisManager::setDCOPRestartParams
825 // Purpose : Sets the DCOP restart parameters.
826 // Special Notes : Most of the dcop restart parameters are used and handled by
827 // the IO::OutputMgr class, so this function here doens't need
828 // to do very much.
829 // Scope : public
830 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
831 // Creation Date : 10/18/07
832 //-----------------------------------------------------------------------------
833 bool AnalysisManager::setDCOPRestartParams(const Util::OptionBlock &option_block)
834 {
835  dcopRestartFlag_ = true;
836 
837  for (Util::ParamList::const_iterator it = option_block.begin(),
838  end = option_block.end(); it != end; ++it)
839  {
840  if ((*it).tag() == "TIME")
841  {
842  saveTime_ = (*it).getImmutableValue<double>();
843  }
844  }
845 
846  return true;
847 }
848 
849 //-----------------------------------------------------------------------------
850 // Function : AnalysisManager::setSensOptions
851 // Purpose :
852 // Special Notes :
853 // Scope : public
854 // Creator : Eric Keiter, Sandia
855 // Creation Date : 6/5/13
856 //-----------------------------------------------------------------------------
857 bool AnalysisManager::setSensOptions(const Util::OptionBlock & OB)
858 {
859  sensFlag_ = true;
860  return true;
861 }
862 
863 //-----------------------------------------------------------------------------
864 // Function : AnalysisManager::completeOPStartStep
865 // Purpose : Call to rotate next state to current state following a
866 // : constrained DCOP solve when using a previous operating point
867 // Special Notes : Called from the Xyce-LOCA interface.
868 // Scope : public
869 // Creator : Dave Shirley
870 // Creation Date : 06/27/2006
871 //-----------------------------------------------------------------------------
873 {
874  bool bsuccess = true;
875 
876  bsuccess = dataStore_->updateStateDataArrays ();
879 
880  return bsuccess;
881 }
882 
883 //-----------------------------------------------------------------------------
884 // Function : AnalysisManager::completeHomotopyStep
885 // Purpose : Call to do final cleanup after a single,
886 // successful homotopy step.
887 // Special Notes : Called from the Xyce-LOCA interface.
888 // Scope : public
889 // Creator : Eric Keiter, SNL
890 // Creation Date : 03/20/2006
891 //-----------------------------------------------------------------------------
892 bool
895  const std::vector<std::string> & paramNames,
896  const std::vector<double> & paramVals,
897  Linear::Vector * solnVecPtr )
898 {
899  bool bsuccess = true;
900 
901  if (DEBUG_ANALYSIS)
902  Xyce::dout() << "\n " << netlistFilename_
903  << " AnalysisManager::completeHomotopyStep " << std::endl;
904 
905  // Rotate the data vectors:
906  bool bs1 = dataStore_->updateStateDataArrays ();
907  bsuccess = bsuccess && bs1;
910 
911  // Pass info in to the lower level solver:
912  loader.homotopyStepSuccess(paramNames,paramVals);
913 
914  // Call output
915  outputManagerAdapter_.outputHomotopy( paramNames, paramVals, *solnVecPtr );
916 
917  return bsuccess;
918 }
919 
920 //-----------------------------------------------------------------------------
921 // Function : AnalysisManager::failHomotopyStep
922 // Purpose : Call to do final cleanup after a single,
923 // failed homotopy step.
924 // Special Notes : Called from the Xyce-LOCA interface.
925 // Scope : public
926 // Creator : Eric Keiter, SNL
927 // Creation Date : 03/30/2006
928 //-----------------------------------------------------------------------------
930 {
931  if (DEBUG_ANALYSIS)
932  Xyce::dout() << "\n " << netlistFilename_
933  << " AnalysisManager::failHomotopyStep " << std::endl;
934 
935 // Pass info in to the lower level solver:
936  loader.homotopyStepFailure();
937 
938  return true;
939 }
940 
941 //-----------------------------------------------------------------------------
942 // Function : AnalysisManager::initializeTransientModel
943 // Purpose : ModelEvaluator Interface
944 // Special Notes :
945 // Scope : private
946 // Creator : Coffey, Schiek, Mei
947 // Creation Date : 05/29/09
948 //-----------------------------------------------------------------------------
950  const TimeIntg::TIAParams & tia_params)
951 {
953 }
954 
955 //-----------------------------------------------------------------------------
956 // Function : AnalysisManager::evalTransientModel
957 // Purpose : ModelEvaluator Interface
958 // Special Notes :
959 // Scope : private
960 // Creator : Coffey, Schiek, Mei
961 // Creation Date : 05/27/09
962 //-----------------------------------------------------------------------------
964  Loader::Loader & loader,
965  double t,
966  Linear::Vector * SolVectorPtr,
967  Linear::Vector * CurrSolVectorPtr,
968  Linear::Vector * LastSolVectorPtr,
969  Linear::Vector * StaVectorPtr,
970  Linear::Vector * CurrStaVectorPtr,
971  Linear::Vector * LastStaVectorPtr,
972  Linear::Vector * StaDerivVectorPtr,
973  Linear::Vector * StoVectorPtr,
974  Linear::Vector * CurrStoVectorPtr,
975  Linear::Vector * LastStoVectorPtr,
976  Linear::Vector * stoLeadCurrQVectorPtr,
977  Linear::Vector * NextLeadFVectorPtr,
978  Linear::Vector * CurrLeadFVectorPtr,
979  Linear::Vector * LastLeadFVectorPtr,
980  Linear::Vector * LeadQVectorPtr,
981  Linear::Vector * NextJunctionVVectorPtr,
982  Linear::Vector * CurrJunctionVVectorPtr,
983  Linear::Vector * LastJunctionVVectorPtr,
984  Linear::Vector * QVectorPtr,
985  Linear::Vector * FVectorPtr,
986  Linear::Vector * BVectorPtr,
987  Linear::Vector * dFdxdVpVectorPtr,
988  Linear::Vector * dQdxdVpVectorPtr,
989  Linear::Matrix * dQdxMatrixPtr,
990  Linear::Matrix * dFdxMatrixPtr)
991 {
992  // This is F,Q load:
993  bool bsuccess = loader.loadDAEVectors(
994  SolVectorPtr,
995  CurrSolVectorPtr,
996  LastSolVectorPtr,
997  StaVectorPtr,
998  CurrStaVectorPtr,
999  LastStaVectorPtr,
1000  StaDerivVectorPtr,
1001  StoVectorPtr,
1002  CurrStoVectorPtr,
1003  LastStoVectorPtr,
1004  stoLeadCurrQVectorPtr,
1005  NextLeadFVectorPtr,
1006  CurrLeadFVectorPtr,
1007  LastLeadFVectorPtr,
1008  LeadQVectorPtr,
1009  NextJunctionVVectorPtr,
1010  CurrJunctionVVectorPtr,
1011  LastJunctionVVectorPtr,
1012  QVectorPtr,
1013  FVectorPtr,
1014  BVectorPtr,
1015  dFdxdVpVectorPtr,
1016  dQdxdVpVectorPtr);
1017 
1018  // This is dQdx, dFdx load:
1019  bsuccess = bsuccess && loader.loadDAEMatrices(
1020  SolVectorPtr,
1021  StaVectorPtr,
1022  StaDerivVectorPtr,
1023  StoVectorPtr,
1024  dQdxMatrixPtr,
1025  dFdxMatrixPtr);
1026 
1027  return bsuccess;
1028 }
1029 
1030 //-----------------------------------------------------------------------------
1031 // Function : AnalysisManager::evalTransientModelState
1032 // Purpose : ModelEvaluator Interface
1033 // Special Notes :
1034 // Scope : private
1035 // Creator : Coffey, Schiek, Mei
1036 // Creation Date : 05/29/09
1037 //-----------------------------------------------------------------------------
1038 bool
1040  TimeIntg::StepErrorControl & step_error_control,
1041  Loader::Loader & loader,
1042  double t,
1043  Linear::Vector * SolVectorPtr,
1044  Linear::Vector * StaVectorPtr,
1045  Linear::Vector * StoVectorPtr)
1046 {
1047  // This is part of state vector load:
1048  step_error_control.currentTime = t;
1049  step_error_control.nextTime = t;
1050  loader.updateSources(); // updates source values wrt time t.
1051  bool bsuccess = loader.updateState(
1052  SolVectorPtr,
1053  SolVectorPtr,
1054  SolVectorPtr,
1055  StaVectorPtr,
1056  StaVectorPtr,
1057  StaVectorPtr,
1058  StoVectorPtr,
1059  StoVectorPtr,
1060  StoVectorPtr
1061  );
1062  return bsuccess;
1063 }
1064 
1065 // ***** Accessor methods *****
1066 //-----------------------------------------------------------------------------
1067 // Function : AnalysisManager::setBeginningIntegrationFlag
1068 // Purpose :
1069 // Special Notes :
1070 // Scope : public
1071 // Creator : Eric R. Keiter, SNL
1072 // Creation Date :
1073 //-----------------------------------------------------------------------------
1075 {
1076  currentAnalysisStack_.back()->setBeginningIntegrationFlag(bif);
1078 }
1079 
1080 //-----------------------------------------------------------------------------
1081 // Function : AnalysisManager::getBeginningIntegrationFlag
1082 // Purpose :
1083 // Special Notes :
1084 // Scope : public
1085 // Creator : Eric R. Keiter, SNL
1086 // Creation Date :
1087 //-----------------------------------------------------------------------------
1089 {
1090  return currentAnalysisStack_.back()->getBeginningIntegrationFlag();
1091 // return primaryAnalysisObject_->getBeginningIntegrationFlag();
1092 }
1093 
1094 //-----------------------------------------------------------------------------
1095 // Function : AnalysisManager::setIntegrationMethod
1096 // Purpose :
1097 // Special Notes :
1098 // Scope : public
1099 // Creator : Eric R. Keiter, SNL
1100 // Creation Date :
1101 //-----------------------------------------------------------------------------
1103 {
1104  currentAnalysisStack_.back()->setIntegrationMethod(im);
1105 }
1106 
1107 //-----------------------------------------------------------------------------
1108 // Function : AnalysisManager::getIntegrationMethod
1109 // Purpose :
1110 // Special Notes :
1111 // Scope : public
1112 // Creator : Eric R. Keiter, SNL
1113 // Creation Date :
1114 //-----------------------------------------------------------------------------
1116 {
1117  return currentAnalysisStack_.back()->getIntegrationMethod();
1118 }
1119 
1120 
1121 //-----------------------------------------------------------------------------
1122 // Function : AnalysisManager::getTotalLinearSolutionTime
1123 // Purpose :
1124 // Special Notes :
1125 // Scope : public
1126 // Creator : Eric R. Keiter, SNL
1127 // Creation Date :
1128 //-----------------------------------------------------------------------------
1130 {
1132 }
1133 
1134 //-----------------------------------------------------------------------------
1135 // Function : AnalysisManager::getTotalResidualLoadTime
1136 // Purpose :
1137 // Special Notes :
1138 // Scope : public
1139 // Creator : Eric R. Keiter, SNL
1140 // Creation Date :
1141 //-----------------------------------------------------------------------------
1143 {
1145 }
1146 
1147 //-----------------------------------------------------------------------------
1148 // Function : AnalysisManager::getTotalJacobianLoadTime
1149 // Purpose :
1150 // Special Notes :
1151 // Scope : public
1152 // Creator : Eric R. Keiter, SNL
1153 // Creation Date :
1154 //-----------------------------------------------------------------------------
1156 {
1158 }
1159 
1160 //-----------------------------------------------------------------------------
1161 // Function : AnalysisManager::getDoubleDCOPEnabled ()
1162 // Purpose :
1163 // Special Notes :
1164 // Scope : public
1165 // Creator :
1166 // Creation Date :
1167 //-----------------------------------------------------------------------------
1169 {
1171 }
1172 
1173 //-----------------------------------------------------------------------------
1174 // Function : AnalysisManager::isSimulationComplete
1175 // Purpose : return boolean signifying whether simulation complete or
1176 // not.
1177 //
1178 // Special Notes :THIS VERSION IS ONLY VALID FOR TRANSIENT RUNS, where
1179 // completion of the simulation means integration to final
1180 // time.
1181 // Scope : public
1182 // Creator : Tom Russo, SNL, Component Information and Models
1183 // Creation Date : 05/06/2004
1184 //-----------------------------------------------------------------------------
1186 {
1188  {
1189  return stepErrorControl_->isFinished();
1190  }
1191  else
1192  {
1193  Report::DevelFatal0().in("AnalysisManager::simulationComplete")
1194  << "Called for non-transient run, not currently valid";
1195  return false;
1196  }
1197 }
1198 
1199 //-----------------------------------------------------------------------------
1200 // Function : AnalysisManager::getPauseTime
1201 //
1202 // Purpose : return the time at which the simulation will pause
1203 //
1204 // Special Notes :
1205 // Scope : public
1206 // Creator : Tom Russo, SNL, Component Information and Models
1207 // Creation Date : 04/29/2004
1208 //-----------------------------------------------------------------------------
1210 {
1211  return stepErrorControl_->pauseTime;
1212 }
1213 
1214 //-----------------------------------------------------------------------------
1215 // Function : AnalysisManager::getStepNumber
1216 // Purpose :
1217 // Special Notes :
1218 // Scope : public
1219 // Creator :
1220 // Creation Date : 12/16/2010
1221 //-----------------------------------------------------------------------------
1223 {
1224  if (!currentAnalysisStack_.empty())
1225  return currentAnalysisStack_.back()->getStepNumber();
1226 
1227  return 0;
1228 }
1229 
1230 //-----------------------------------------------------------------------------
1231 // Function : AnalysisManager::setStepNumber
1232 // Purpose :
1233 // Special Notes :
1234 // Scope : public
1235 // Creator :
1236 // Creation Date : 12/16/2010
1237 //-----------------------------------------------------------------------------
1239 {
1242 }
1243 
1244 //-----------------------------------------------------------------------------
1245 // Function : AnalysisManager::getTranStepNumber
1246 // Purpose :
1247 // Special Notes :
1248 // Scope : public
1249 // Creator :
1250 // Creation Date : 12/16/2010
1251 //-----------------------------------------------------------------------------
1253 {
1254  int number = 0;
1255 
1258 
1259  return number;
1260 }
1261 
1262 //-----------------------------------------------------------------------------
1263 // Function : AnalysisManager::setTranStepNumber
1264 // Purpose :
1265 // Special Notes :
1266 // Scope : public
1267 // Creator :
1268 // Creation Date : 12/16/2010
1269 //-----------------------------------------------------------------------------
1271 {
1274 }
1275 
1276 
1277 //-----------------------------------------------------------------------------
1278 // Function : AnalysisManager::getInitTranFlag
1279 // Purpose :
1280 // Special Notes :
1281 // Scope : public
1282 // Creator :
1283 // Creation Date : 12/16/2010
1284 //-----------------------------------------------------------------------------
1286 {
1287  return getStepNumber() <= 0;
1288 }
1289 
1290 //-----------------------------------------------------------------------------
1291 // Function : AnalysisManager::getTime
1292 // Purpose : Gets the next time value.
1293 // Special Notes :
1294 // Scope : public
1295 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1296 // Creation Date : 6/27/00
1297 //-----------------------------------------------------------------------------
1299 {
1300  return stepErrorControl_->nextTime;
1301 }
1302 
1303 //-----------------------------------------------------------------------------
1304 // Function : AnalysisManager::getFinalTime
1305 // Purpose : Gets the final time-step value.
1306 // Special Notes :
1307 // Scope : public
1308 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1309 // Creation Date : 6/27/00
1310 //-----------------------------------------------------------------------------
1312 {
1313  return stepErrorControl_->finalTime;
1314 }
1315 
1316 //-----------------------------------------------------------------------------
1317 // Function : AnalysisManager::getInitialTime
1318 // Purpose : Gets the initial time-step value.
1319 // Special Notes :
1320 // Scope : public
1321 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1322 // Creation Date : 6/27/00
1323 //-----------------------------------------------------------------------------
1325 {
1327 }
1328 
1329 //-----------------------------------------------------------------------------
1330 // Function : AnalysisManager::getDCOPFlag
1331 // Purpose : Gets a flag indicating we are in steady state.
1332 // (steady=true)
1333 // Special Notes :
1334 // Scope : public
1335 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1336 // Creation Date : 03/02/01
1337 //-----------------------------------------------------------------------------
1339 {
1341 }
1342 
1343 //-----------------------------------------------------------------------------
1344 // Function : AnalysisManager::getTranOPFlag
1345 // Purpose : Gets a flag indicating we are in a DCOP calculation that is
1346 // the initialization for a transient simulation.
1347 // Special Notes :
1348 // Scope : public
1349 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1350 // Creation Date : 02/28/05
1351 //-----------------------------------------------------------------------------
1353 {
1356 }
1357 
1358 //-----------------------------------------------------------------------------
1359 // Function : AnalysisManager::getACOPFlag
1360 // Purpose : Gets a flag indicating we are in a DCOP calculation that is
1361 // the initialization for a AC simulation.
1362 // Special Notes :
1363 // Scope : public
1364 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1365 // Creation Date : 04/16/12
1366 //-----------------------------------------------------------------------------
1368 {
1371 
1372  // if the analysis type is noise, this flag must also be set, as it is based on an
1373  // AC-style calculation.
1376 
1377  return (return1 || return2);
1378 }
1379 
1380 //-----------------------------------------------------------------------------
1381 // Function : AnalysisManager::getDCSweepFlag
1382 // Purpose :
1383 // Special Notes :
1384 // Scope : public
1385 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1386 // Creation Date : 02/28/05
1387 //-----------------------------------------------------------------------------
1389 {
1391 }
1392 
1393 //-----------------------------------------------------------------------------
1394 // Function : AnalysisManager::getTransientFlag
1395 // Purpose :
1396 // Special Notes :
1397 // Scope : public
1398 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1399 // Creation Date : 02/28/05
1400 //-----------------------------------------------------------------------------
1402 {
1405 }
1406 
1407 //-----------------------------------------------------------------------------
1408 // Function : AnalysisManager::getDoubleDCOPStep
1409 // Purpose : Gets the double DC Operating Point step value.
1410 // Special Notes :
1411 // Scope : public
1412 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1413 // Creation Date : 04/25/01
1414 //-----------------------------------------------------------------------------
1416 {
1418 }
1419 
1420 //-----------------------------------------------------------------------------
1421 // Function : AnalysisManager::updateDerivs
1422 // Purpose : Calls the time int. method to update the corrector
1423 // derivatives.
1424 // Special Notes :
1425 // Scope : public
1426 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1427 // Creation Date : 6/13/00
1428 //-----------------------------------------------------------------------------
1430 {
1432 
1433  return true;
1434 }
1435 
1436 //-----------------------------------------------------------------------------
1437 // Function : AnalysisManager::updateDivDiffs
1438 // Purpose : Updates the divided difference values.
1439 // Special Notes :
1440 // Scope : public
1441 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1442 // Creation Date : 6/27/00
1443 //-----------------------------------------------------------------------------
1445 {
1447 
1448  return true;
1449 }
1450 
1451 //-----------------------------------------------------------------------------
1452 // Function : AnalysisManager::updateDerivsBlock
1453 // Purpose :
1454 // Special Notes :
1455 // Scope : public
1456 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1457 // Creation Date : 01/10/01
1458 //-----------------------------------------------------------------------------
1460  const std::list<IndexPair> & solGIDList,
1461  const std::list<IndexPair> & staGIDList)
1462 {
1463  dataStore_->computeDivDiffsBlock(solGIDList, staGIDList);
1464  workingIntgMethod_->updateDerivsBlock (solGIDList, staGIDList);
1465 
1466  return true;
1467 }
1468 
1469 //-----------------------------------------------------------------------------
1470 // Function : AnalysisManager::registerElapsedTimer
1471 // Purpose :
1472 // Special Notes :
1473 // Scope : public
1474 // Creator : Dave Shirley, PSSI
1475 // Creation Date : 02/24/06
1476 //-----------------------------------------------------------------------------
1478 {
1479  elapsedTimerPtr_ = et;
1480 
1481  return true;
1482 }
1483 
1484 //-----------------------------------------------------------------------------
1485 // Function : AnalysisManager::getRestartDataSize
1486 // Purpose :
1487 // Special Notes :
1488 // Scope : public
1489 // Creator : Rob Hoekstra, SNL, Computational Sciences
1490 // Creation Date : 07/31/01
1491 //-----------------------------------------------------------------------------
1493 {
1494  return stepErrorControl_->getRestartDataSize( pack );
1495 }
1496 
1497 //-----------------------------------------------------------------------------
1498 // Function : AnalysisManager::dumpRestartData
1499 // Purpose :
1500 // Special Notes :
1501 // Scope : public
1502 // Creator : Rob Hoekstra, SNL, Computational Sciences
1503 // Creation Date : 07/31/01
1504 //-----------------------------------------------------------------------------
1506  char * buf,
1507  int bsize,
1508  int & pos,
1509  Parallel::Communicator * comm,
1510  bool pack)
1511 {
1512  return stepErrorControl_->dumpRestartData(buf, bsize, pos, comm, pack);
1513 }
1514 
1515 //-----------------------------------------------------------------------------
1516 // Function : AnalysisManager::restoreRestartData
1517 // Purpose :
1518 // Special Notes :
1519 // Scope : public
1520 // Creator : Rob Hoekstra, SNL, Computational Sciences
1521 // Creation Date : 07/31/01
1522 //-----------------------------------------------------------------------------
1523 bool
1525  char * buf,
1526  int bsize,
1527  int & pos,
1528  Parallel::Communicator * comm,
1529  bool pack)
1530 {
1531  return stepErrorControl_->restoreRestartData(buf, bsize, pos, comm, pack, getTIAParams().initialTime);
1532 }
1533 
1534 //-----------------------------------------------------------------------------
1535 // Function : AnalysisManager::getSolnVarData
1536 // Purpose :
1537 // Special Notes :
1538 // Scope : public
1539 // Creator : Rob Hoekstra, SNL, Computational Sciences
1540 // Creation Date : 07/31/01
1541 //-----------------------------------------------------------------------------
1542 bool AnalysisManager::getSolnVarData( const int & gid,
1543  std::vector<double> & varData ) const
1544 {
1545  return dataStore_->getSolnVarData( gid, varData );
1546 }
1547 
1548 //-----------------------------------------------------------------------------
1549 // Function : AnalysisManager::getStateVarData
1550 // Purpose :
1551 // Special Notes :
1552 // Scope : public
1553 // Creator : Rob Hoekstra, SNL, Computational Sciences
1554 // Creation Date : 07/31/01
1555 //-----------------------------------------------------------------------------
1556 bool
1558  const int & gid,
1559  std::vector<double> & varData ) const
1560 {
1561  return dataStore_->getStateVarData( gid, varData );
1562 }
1563 
1564 //-----------------------------------------------------------------------------
1565 // Function : AnalysisManager::getStoreVarData
1566 // Purpose :
1567 // Special Notes :
1568 // Scope : public
1569 // Creator : Eric Keiter
1570 // Creation Date :
1571 //-----------------------------------------------------------------------------
1572 bool AnalysisManager::getStoreVarData( const int & gid,
1573  std::vector<double> & varData ) const
1574 {
1575  return dataStore_->getStoreVarData( gid, varData );
1576 }
1577 //-----------------------------------------------------------------------------
1578 // Function : AnalysisManager::setSolnVarData
1579 // Purpose :
1580 // Special Notes :
1581 // Scope : public
1582 // Creator : Rob Hoekstra, SNL, Computational Sciences
1583 // Creation Date : 07/31/01
1584 //-----------------------------------------------------------------------------
1585 bool AnalysisManager::setSolnVarData( const int & gid,
1586  const std::vector<double> & varData )
1587 {
1588  return dataStore_->setSolnVarData( gid, varData );
1589 }
1590 
1591 //-----------------------------------------------------------------------------
1592 // Function : AnalysisManager::setStateVarData
1593 // Purpose :
1594 // Special Notes :
1595 // Scope : public
1596 // Creator : Rob Hoekstra, SNL, Computational Sciences
1597 // Creation Date : 07/31/01
1598 //-----------------------------------------------------------------------------
1599 bool AnalysisManager::setStateVarData( const int & gid,
1600  const std::vector<double> & varData )
1601 {
1602  return dataStore_->setStateVarData( gid, varData );
1603 }
1604 
1605 //-----------------------------------------------------------------------------
1606 // Function : AnalysisManager::setStoreVarData
1607 // Purpose :
1608 // Special Notes :
1609 // Scope : public
1610 // Creator : Eric Keiter
1611 // Creation Date :
1612 //-----------------------------------------------------------------------------
1613 bool AnalysisManager::setStoreVarData( const int & gid,
1614  const std::vector<double> & varData )
1615 {
1616  return dataStore_->setStoreVarData( gid, varData );
1617 }
1618 
1619 
1620 const TimeIntg::TIAParams &
1622 {
1624 }
1625 
1628 {
1630 }
1631 
1632 //-----------------------------------------------------------------------------
1633 // Function : AnalysisManager::registerLoader
1634 // Purpose :
1635 // Special Notes :
1636 // Scope : public
1637 // Creator : Eric R. Keiter, SNL, Computational Sciences
1638 // Creation Date : 04/18/02
1639 //-----------------------------------------------------------------------------
1641 {
1642  loader_ = &loader;
1643 
1644  return true;
1645 }
1646 
1647 //-----------------------------------------------------------------------------
1648 // Function : AnalysisManager::registerParallelServices
1649 // Purpose :
1650 // Special Notes :
1651 // Scope : public
1652 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1653 // Creation Date : 04/19/02
1654 //-----------------------------------------------------------------------------
1656 {
1657  parallelManager_ = pds;
1658 
1659  return true;
1660 }
1661 
1662 //-----------------------------------------------------------------------------
1663 // Function : AnalysisManager::setNextSolVectorPtr
1664 // Purpose :
1665 // Special Notes :
1666 // Scope : public
1667 // Creator : Eric R. Keiter,SNL, Computational Sciences
1668 // Creation Date : 04/22/2003
1669 //-----------------------------------------------------------------------------
1670 bool AnalysisManager::setNextSolVectorPtr (Linear::Vector * solVecPtr)
1671 {
1672  return dataStore_->setNextSolVectorPtr (solVecPtr);
1673 }
1674 
1675 //-----------------------------------------------------------------------------
1676 // Function : AnalysisManager::setPauseTime
1677 //
1678 // Purpose : Set the time at which to pause the simulation
1679 //
1680 // Special Notes : This is a temporary implementation that I'm using to
1681 // begin the process of hiding time integrator internals from
1682 // the "N_CIR_Xyce::simulateUntil" method, so that I can
1683 // ultimately change those internals without the simulateUntil
1684 // method
1685 // Scope : public
1686 // Creator : Tom Russo, SNL, Component Information and Models
1687 // Creation Date : 04/29/2004
1688 //-----------------------------------------------------------------------------
1689 void
1691  double pause_time,
1692  double initial_time)
1693 {
1694  stepErrorControl_->setBreakPoint(Util::BreakPoint(pause_time, Util::BreakPoint::PAUSE), initial_time);
1695 }
1696 
1697 //-----------------------------------------------------------------------------
1698 // Function : AnalysisManager::getTimeIntInfo
1699 // Purpose :
1700 // Special Notes :
1701 // Scope : public
1702 // Creator : Eric Keiter
1703 // Creation Date :
1704 //-----------------------------------------------------------------------------
1705 void getTimeIntInfo(const AnalysisManager &analysis_manager, TimeIntg::TimeIntInfo & tiInfo)
1706 {
1707  tiInfo.currentOrder = analysis_manager.getWorkingIntegrationMethod().getOrder();
1708  tiInfo.numberOfSteps = analysis_manager.getWorkingIntegrationMethod().getNumberOfSteps();
1709  tiInfo.usedOrder = analysis_manager.getWorkingIntegrationMethod().getUsedOrder();
1710  tiInfo.nscsco = analysis_manager.getWorkingIntegrationMethod().getNscsco();
1711  tiInfo.pdt = analysis_manager.getWorkingIntegrationMethod().partialTimeDeriv();
1712 
1713  tiInfo.nextTimeStep = analysis_manager.getStepErrorControl().currentTimeStep;
1714  tiInfo.currTimeStep = analysis_manager.getStepErrorControl().lastTimeStep;
1715  tiInfo.currentTime = analysis_manager.getStepErrorControl().currentTime;
1716  tiInfo.nextTime = analysis_manager.getStepErrorControl().nextTime;
1717  tiInfo.finalTime = analysis_manager.getStepErrorControl().finalTime;
1718  tiInfo.startingTimeStep = analysis_manager.getStepErrorControl().startingTimeStep;
1719  tiInfo.bpTol = analysis_manager.getStepErrorControl().getBreakPointLess().tolerance_;
1720 
1721  tiInfo.dcopFlag = analysis_manager.getAnalysisObject().getDCOPFlag();
1722  tiInfo.inputOPFlag = analysis_manager.getAnalysisObject().getInputOPFlag();
1723  tiInfo.tranopFlag = analysis_manager.getTranOPFlag();
1724  tiInfo.acopFlag = analysis_manager.getACOPFlag();
1725  tiInfo.transientFlag = analysis_manager.getTransientFlag();
1726  tiInfo.dcsweepFlag = analysis_manager.getDCSweepFlag();
1727  tiInfo.sweepSourceResetFlag = analysis_manager.getSweepSourceResetFlag();
1728 
1729  tiInfo.timeStepNumber = analysis_manager.getStepNumber();
1730  tiInfo.initTranFlag = analysis_manager.getInitTranFlag();
1731  tiInfo.beginIntegrationFlag = analysis_manager.getBeginningIntegrationFlag();
1732 
1733  tiInfo.doubleDCOPStep = analysis_manager.getDoubleDCOPStep();
1734  tiInfo.doubleDCOPEnabled = analysis_manager.getDoubleDCOPEnabled();
1735 
1736  tiInfo.timeIntMode = analysis_manager.getAnalysisObject().getIntegrationMethod();
1737 }
1738 
1739 //-----------------------------------------------------------------------------
1740 // Function : AnalysisManager::writeConductanceFile
1741 // Purpose :
1742 // Special Notes :
1743 // Scope : public
1744 // Creator : Eric Keiter, SNL
1745 // Creation Date : 03/06/2006
1746 //-----------------------------------------------------------------------------
1747 void writeConductanceFile(const std::vector<std::string> &device_names, Nonlinear::ConductanceExtractor &conductance_extractor, const std::string &filename)
1748 {
1749  std::map<std::string,double> inputMap;
1750 
1751  // load inputMap from tiaParam.device_names option
1752  for (std::vector<std::string>::const_iterator it = device_names.begin(), end = device_names.end(); it != end; ++it)
1753  inputMap[*it] = 0.0;
1754 
1755  // if (DEBUG_ANALYSIS && isActive(Diag::TIME_PARAMETERS))
1756  // {
1757  // Xyce::dout() << "AnalysisManager::conductanceTest()" << std::endl;
1758  // for (std::list<std::string>::const_iterator it = tia_params.device_names.begin(), end = tia_params.device_names.end(); it != end; ++it)
1759  // Xyce::dout() << "current device name = \"" << *it
1760  // << "\" added to inputMap[ " << *it << " ] = " << inputMap[ *it ] << std::endl;
1761  // }
1762 
1763  int isize = inputMap.size();
1764  std::vector<double> outputVector(isize, 0.0);
1765  std::vector< std::vector<double> > jacobian(isize);
1766  for (int i = 0; i < isize; ++i)
1767  {
1768  jacobian[i].resize(isize, 0.0);
1769  }
1770 
1771  bool b1 = conductance_extractor.extract(inputMap, outputVector, jacobian);
1772 
1773  int iE1, iE2;
1774  int numElectrodes = isize;
1775 
1776  FILE *fp1;
1777  fp1 = fopen(filename.c_str(), "w");
1778 
1779  fprintf(fp1, "%s", "Conductance array: \n");
1780  fprintf(fp1,"%s", " ");
1781  if (b1)
1782  {
1783  std::map<std::string,double>::const_iterator iterM = inputMap.begin();
1784  std::map<std::string,double>::const_iterator endM = inputMap.end ();
1785  for (iE2 = 0; iE2 < numElectrodes; ++iE2, ++iterM)
1786  {
1787  std::string srcname = iterM->first;
1788  fprintf(fp1, "\t%14s", srcname.c_str());
1789  }
1790  fprintf(fp1, "%s", "\n");
1791 
1792  iterM = inputMap.begin();
1793  for (iE1 = 0; iE1 < numElectrodes; ++iE1, ++iterM)
1794  {
1795  std::string srcname = iterM->first;
1796  fprintf(fp1,"%14s",srcname.c_str());
1797  for (iE2 = 0; iE2 < numElectrodes; ++iE2)
1798  {
1799  fprintf(fp1,"\t%14.4e",jacobian[iE1][iE2]);
1800  }
1801  fprintf(fp1,"%s", "\n");
1802  }
1803  fprintf(fp1,"%s", "\n");
1804  }
1805  else
1806  {
1807  fprintf(fp1,"%s", "\nConductance calculation failed!\n");
1808  }
1809 
1810  fclose(fp1);
1811 }
1812 
1813 //-----------------------------------------------------------------------------
1814 // Namespace : Unnamed
1815 // Purpose : Options parsing
1816 // Special Notes :
1817 // Scope : public
1818 // Creator : David G. Baur Raytheon Sandia National Laboratories 1355
1819 // Creation Date : Mon Mar 16 14:24:58 2015
1820 //-----------------------------------------------------------------------------
1821 
1822 namespace {
1823 
1824 // .RESULTS
1825 struct ResultOptionsReg : public IO::PkgOptionsReg
1826 {
1827  ResultOptionsReg(AnalysisManager &analysis_manager)
1828  : analysisManager_(analysis_manager)
1829  {}
1830 
1831  bool operator()(const Util::OptionBlock & option_block)
1832  {
1833  analysisManager_.getOutputManagerAdapter().addOutputResults(option_block);
1834 
1835  return true;
1836  }
1837 
1838 private:
1839  AnalysisManager & analysisManager_;
1840 };
1841 
1842 // .options OP_IO
1843 struct DCOPRestartOptionsReg : public IO::PkgOptionsReg
1844 {
1845  DCOPRestartOptionsReg( AnalysisManager & manager )
1846  : manager_(manager)
1847  {}
1848 
1849  bool operator()( const Util::OptionBlock & options )
1850  { return manager_.setDCOPRestartParams( options ); }
1851 
1852  AnalysisManager & manager_;
1853 };
1854 
1855 
1856 // .OP
1857 struct OPAnalysisReg : public IO::PkgOptionsReg
1858 {
1859  OPAnalysisReg( AnalysisManager & manager )
1860  : manager_(manager)
1861  {}
1862 
1863  bool operator()( const Util::OptionBlock & options )
1864  { return manager_.setOPAnalysisParams( options ); }
1865 
1866  AnalysisManager & manager_;
1867 };
1868 
1869 // .options SAVE
1870 struct SaveOptionsReg : public IO::PkgOptionsReg
1871 {
1872  SaveOptionsReg( AnalysisManager & manager )
1873  : manager_(manager)
1874  {}
1875 
1876  bool operator()( const Util::OptionBlock & options )
1877  { return manager_.setSaveOptions( options ); }
1878 
1879  AnalysisManager & manager_;
1880 };
1881 
1882 // .options SENS
1883 struct SensOptionsReg : public IO::PkgOptionsReg
1884 {
1885  SensOptionsReg( AnalysisManager & manager )
1886  : manager_(manager)
1887  {}
1888 
1889  bool operator()( const Util::OptionBlock & options )
1890  { return manager_.setSensOptions( options ); }
1891 
1892  AnalysisManager & manager_;
1893 };
1894 
1895 } // namespace <unnamed>
1896 
1897 //-----------------------------------------------------------------------------
1898 // Function : AnalysisManager::registerPkgOptionsMgr
1899 // Purpose :
1900 // Special Notes :
1901 // Scope : public
1902 // Creator : Rich Schiek, 1437
1903 // Creation Date : 10/21/08
1904 //-----------------------------------------------------------------------------
1905 bool registerPkgOptionsMgr(AnalysisManager &analysis_manager, const std::string &netlist_filename, IO::PkgOptionsMgr &options_manager)
1906 {
1907  options_manager.submitRegistration(
1908  "RESULT", netlist_filename, new ResultOptionsReg( analysis_manager ) );
1909 
1910  options_manager.submitRegistration(
1911  "OP", netlist_filename, new OPAnalysisReg( analysis_manager ) );
1912 
1913  options_manager.submitRegistration(
1914  "OP_IO", netlist_filename, new DCOPRestartOptionsReg( analysis_manager ) );
1915 
1916  options_manager.submitRegistration(
1917  "SAVE", netlist_filename, new SaveOptionsReg( analysis_manager ) );
1918 
1919  options_manager.submitRegistration(
1920  "SENS", netlist_filename, new SensOptionsReg( analysis_manager ) );
1921 
1922  return true;
1923 }
1924 
1925 //-----------------------------------------------------------------------------
1926 // Function : registerAnalysisFactory
1927 // Purpose :
1928 // Special Notes :
1929 // Scope : public
1930 // Creator : David G. Baur Raytheon Sandia National Laboratories 1355
1931 // Creation Date : Mon Mar 16 14:26:41 2015
1932 //-----------------------------------------------------------------------------
1933 ///
1934 /// Registers the analysis factories.
1935 ///
1936 /// In the future this is intended to become a pluggable factory allowing new analysis type to be added with no invasion
1937 /// into the rest of the analysis code. Whether anyone will actually create an analysis outside the system is academic
1938 /// and creating this interface will result in defining the roles and interactions between the various analyses.
1939 ///
1940 /// @invariant
1941 ///
1942 /// @param netlist_filename
1943 /// @param options_manager
1944 /// @param analysis_manager
1945 /// @param linear_system
1946 /// @param nonlinear_manager
1947 /// @param device_manager
1948 /// @param builder
1949 /// @param topology
1950 ///
1951 ///
1952 void
1954  const std::string & netlist_filename,
1955  IO::PkgOptionsMgr & options_manager,
1956  AnalysisManager & analysis_manager,
1957  Linear::System & linear_system,
1958  Nonlinear::Manager & nonlinear_manager,
1959  Device::DeviceMgr & device_manager,
1960  Linear::Builder & builder,
1961  Topo::Topology & topology)
1962 {
1963  registerDCSweepFactory(netlist_filename, options_manager, analysis_manager, linear_system, nonlinear_manager, topology);
1964  registerACFactory(netlist_filename, options_manager, analysis_manager, linear_system, nonlinear_manager, topology);
1965  registerTransientFactory(netlist_filename, options_manager, analysis_manager, linear_system, nonlinear_manager, topology);
1966  registerHBFactory(netlist_filename, options_manager, analysis_manager, linear_system, nonlinear_manager, device_manager, builder, topology);
1967  registerMPDEFactory(netlist_filename, options_manager, analysis_manager, linear_system, nonlinear_manager, device_manager, builder, topology);
1968  registerNOISEFactory(netlist_filename, options_manager, analysis_manager, linear_system, nonlinear_manager, topology);
1969  registerMORFactory(netlist_filename, options_manager, analysis_manager, linear_system, nonlinear_manager, topology);
1970  registerStepFactory(netlist_filename, options_manager, analysis_manager, linear_system, nonlinear_manager);
1971 }
1972 
1973 } // namespace Analysis
1974 } // namespace Xyce
bool setNextSolVectorPtr(Linear::Vector *solVecPtr)
bool dcopFlag
Analysis DCOP flag.
Linear::Vector * lastSolutionPtr
double finalTime
Step error control final time.
const char * analysisModeName(Mode mode)
Returns the name of the analysis mode given by mode.
bool run()
Runs the top level analysis.
void notify(const StepEvent &step_event)
Notification that there is a StepEvent.
bool tranopFlag
Analysis TransientOP flag.
int numberOfSteps
Time integrator step.
bool getStateVarData(const int &gid, std::vector< double > &varData) const
bool dumpRestartData(char *buf, int bsize, int &pos, N_PDS_Comm *comm, bool pack)
const std::string netlistFilename_
Netlist file name.
Util::ListenerAutoSubscribe< AnalysisEvent > AnalysisEventListener
TimeIntg::DataStore * dataStore_
Data store object.
Pure virtual class to augment a linear system.
bool inputOPFlag
Analysis InputOP flag.
bool setDCOPRestartParams(const Util::OptionBlock &OB)
Linear::Vector * nextSolutionDerivPtr
bool dumpRestartData(char *buf, int bsize, int &pos, Parallel::Communicator *comm, bool pack)
bool resetAll(double absolute_error_tolerance, double relative_error_tolerance)
bool registerTransientFactory(const std::string &netlist_filename, IO::PkgOptionsMgr &options_manager, AnalysisManager &analysis_manager, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager, Topo::Topology &topology)
Loader::Loader * loader_
Pointer to the nonlinear loader object.
virtual bool loadDAEVectors(Linear::Vector *nextSolVectorPtr, Linear::Vector *currSolVectorPtr, Linear::Vector *lastSolVectorPtr, Linear::Vector *nextStaVectorPtr, Linear::Vector *currStaVectorPtr, Linear::Vector *lastStaVectorPtr, Linear::Vector *StaDerivVectorPtr, Linear::Vector *nextStoVectorPtr, Linear::Vector *currStoVectorPtr, Linear::Vector *lastStoVectorPtr, Linear::Vector *stoLeadCurrQVectorPtr, Linear::Vector *nextLeadFVectorPtr, Linear::Vector *currLeadFVectorPtr, Linear::Vector *lastLeadFVectorPtr, Linear::Vector *nextLeadQVectorPtr, Linear::Vector *nextJunctionVVectorPtr, Linear::Vector *currJunctionVVectorPtr, Linear::Vector *lastJunctionVVectorPtr, Linear::Vector *QVectorPtr, Linear::Vector *FVectorPtr, Linear::Vector *BVectorPtr, Linear::Vector *dFdxdVpVectorPtr, Linear::Vector *dQdxdVpVectorPtr)
Definition: N_LOA_Loader.h:121
void pushActiveAnalysis(AnalysisBase *analysis)
void allocateAnalysisObject()
Creates the primary analysis and driving analysis (.STEP, dakota).
double getTotalLinearSolutionTime() const
bool registerNOISEFactory(const std::string &netlist_filename, IO::PkgOptionsMgr &options_manager, AnalysisManager &analysis_manager, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager, Topo::Topology &topology)
Definition: N_ANP_NOISE.C:1781
Linear::Vector * tmpStaVectorPtr
void updateDerivsBlock(const std::list< IndexPair > &solGIDList, const std::list< IndexPair > &staGIDList)
const Analysis::SweepVector & getDCSweepVector() const
Linear::Vector * lastStatePtr
Linear::Vector * tmpSolVectorPtr
bool registerMPDEFactory(const std::string &netlist_filename, IO::PkgOptionsMgr &options_manager, AnalysisManager &analysis_manager, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager, Device::DeviceMgr &device_manager, Linear::Builder &builder, Topo::Topology &topology)
Definition: N_ANP_MPDE.C:476
bool registerPkgOptionsMgr(AnalysisManager &analysis_manager, const std::string &netList_file, IO::PkgOptionsMgr &options_manager)
void setBeginningIntegrationFlag(bool bif)
void createTimeIntegratorMethod(const TimeIntg::TIAParams &tia_params, const unsigned int integration_method)
bool extract(const std::map< std::string, double > &inputMap, std::vector< double > &outputVector, std::vector< std::vector< double > > &jacobian)
bool registerACFactory(const std::string &netlist_filename, IO::PkgOptionsMgr &options_manager, AnalysisManager &analysis_manager, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager, Topo::Topology &topology)
Definition: N_ANP_AC.C:1017
double nextTimeStep
Step error control next time step.
virtual int getDoubleDCOPStep() const
void outputHomotopy(const std::vector< std::string > &paramNames, const std::vector< double > &paramVals, Linear::Vector &solnVecPtr)
const AnalysisBase & getAnalysisObject() const
std::vector< AnalysisBase * > currentAnalysisStack_
Util::ListenerAutoSubscribe< StepEvent > StepEventListener
const Util::BreakPointLess & getBreakPointLess() const
Linear::Vector * currStatePtr
virtual const TimeIntg::TIAParams & getTIAParams() const =0
virtual bool isAnalysis(int analysis_type) const
TimeIntg::StepErrorControl & getStepErrorControl()
bool registerHBFactory(const std::string &netlist_filename, IO::PkgOptionsMgr &options_manager, AnalysisManager &analysis_manager, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager, Device::DeviceMgr &device_manager, Linear::Builder &builder, Topo::Topology &topology)
Definition: N_ANP_HB.C:2159
double nextOutputTime_
for .SAVE and/or DCOP restart.
void getTimeIntInfo(const AnalysisManager &analysis_manager, TimeIntg::TimeIntInfo &tiInfo)
AnalysisManager(const IO::CmdParse &command_line, IO::RestartMgr &restart_manager, OutputMgrAdapter &output_manager_adapter, Stats::Stat analysis_stat)
Constructs the analysis manager.
bool testDCOPOutputTime()
Returns true if the DCOP Restart parameters have been set.
TimeIntg::StepErrorControl * stepErrorControl_
Pointer to the TIA step-error control object.
Linear::Vector * daeQVectorPtr
Util::Timer * elapsedTimerPtr_
Xyce timing utility for timing the transient simulation CPU time.
bool registerParallelServices(Parallel::Manager *pds_tmp)
double nextTime
Step error control next time.
Loader::Loader & createLoader(Device::DeviceMgr &device_manager)
Creates the defaults circuit loader.
Linear::Vector * tmpStaDerivPtr
bool restoreRestartData(char *buf, int bsize, int &pos, Parallel::Communicator *comm, bool pack)
Linear::Vector * deviceErrorWeightMask_
TimeIntg::WorkingIntegrationMethod * workingIntgMethod_
Working integration method.
double bpTol
Step error control breakpoint tolerance.
bool initializeSolverSystem(const TimeIntg::TIAParams &tia_params, Loader::Loader &loader, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager, Device::DeviceMgr &device_manager)
Initializes the solver system.
void registerAnalysisFactory(const std::string &netlist_filename, IO::PkgOptionsMgr &options_manager, AnalysisManager &analysis_manager, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager, Device::DeviceMgr &device_manager, Linear::Builder &builder, Topo::Topology &topology)
Registers the analysis factories.
bool restoreRestartData(char *buf, int bsize, int &pos, N_PDS_Comm *comm, bool pack, double &initial_time)
bool getSolnVarData(const int &gid, std::vector< double > &varData) const
Linear::Vector * daeFVectorPtr
Util::Notifier< StepEvent > StepEventNotifier
bool daeStateDerivFlag_
.OPTIONS TIMEINT DAESTATEDERIV=
bool setStoreVarData(const int &gid, const std::vector< double > &varData)
void setPauseTime(double pauseTime, double initial_time)
bool getStateVarData(const int &gid, std::vector< double > &varData)
bool setLoader(Loader::Loader &loader_)
bool getStoreVarData(const int &gid, std::vector< double > &varData) const
int usedOrder
Time integrator used order.
Nonlinear::AnalysisMode nonlinearAnalysisMode(Mode mode)
Returns the nonlinear analysis mode given the analysis mode.
bool setStateVarData(const int &gid, const std::vector< double > &varData)
void setBreakPoint(const Util::BreakPoint &breakpoint, double initial_time)
bool registerStepFactory(const std::string &netlist_filename, IO::PkgOptionsMgr &options_manager, AnalysisManager &analysis_manager, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager)
Definition: N_ANP_Step.C:376
AnalysisBase * analysisObject_
.STEP, Dakota
Linear::Matrix * dFdxMatrixPtr
bool dcopRestartFlag_
Set if .OPTIONS OP_IO.
double getTotalJacobianLoadTime() const
Linear::Matrix * JMatrixPtr
void printParams(std::ostream &os, int analysis) const
virtual bool updateSources()
Definition: N_LOA_Loader.h:243
virtual bool loadDeviceErrorWeightMask(Linear::Vector *deviceMask) const
Definition: N_LOA_Loader.h:150
Linear::Vector * nextStatePtr
Util::Notifier< AnalysisEvent > AnalysisEventNotifier
double currentTime
Step error control current time.
virtual bool printLoopInfo(int start, int finish)
Linear::Vector * dFdxdVpVectorPtr
AnalysisManager & manager_
virtual bool updateState(Linear::Vector *nextSolVectorPtr, Linear::Vector *currSolVectorPtr, Linear::Vector *lastSolVectorPtr, Linear::Vector *nextStaVectorPtr, Linear::Vector *currStaVectorPtr, Linear::Vector *lastStaVectorPtr, Linear::Vector *nextStoVectorPtr, Linear::Vector *currStoVectorPtr, Linear::Vector *lastStoVectorPtr)
Definition: N_LOA_Loader.h:188
virtual bool loadDAEMatrices(Linear::Vector *tmpSolVectorPtr, Linear::Vector *tmpStaVectorPtr, Linear::Vector *tmpStaDerivVectorPtr, Linear::Vector *tmpStoVectorPtr, Linear::Matrix *tmpdQdxMatrixPtr, Linear::Matrix *tmpdFdxMatrixPtr)
Definition: N_LOA_Loader.h:109
bool setSolnVarData(const int &gid, const std::vector< double > &varData)
Loader::CktLoader * cktLoaderPtr_
'real' pointer to the ckt-loader
void homotopyStepSuccess(const std::vector< std::string > &paramNames, const std::vector< double > &paramVals)
double pauseTime
Time step value at which to "pause" the simulation.
const TimeIntg::TIAParams & getTIAParams() const
bool setOPAnalysisParams(const Util::OptionBlock &paramsBlock)
bool getSolnVarData(const int &gid, std::vector< double > &varData)
bool setSolnVarData(const int &gid, const std::vector< double > &varData)
int nscsco
Time integrator ?nscsco?
Linear::Vector * tmpStaDivDiffPtr
Loader::NonlinearEquationLoader * nonlinearEquationLoader_
Pointer to the nonlinear equation loader.
bool updateDerivsBlock(const std::list< IndexPair > &solGIDList, const std::list< IndexPair > &staGIDList)
std::vector< AnalysisBase * > analysisVector_
bool setSensOptions(const Util::OptionBlock &OB)
Linear::Vector * nextSolutionPtr
Linear::Vector * RHSVectorPtr
void createTimeIntegMethod(int type, const TIAParams &tia_params, StepErrorControl &step_error_control, DataStore &data_store)
bool registerDCSweepFactory(const std::string &netlist_filename, IO::PkgOptionsMgr &options_manager, AnalysisManager &analysis_manager, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager, Topo::Topology &topology)
IO::RestartMgr & restartManager_
Restart manager.
double getTotalResidualLoadTime() const
OutputMgrAdapter & outputManagerAdapter_
Output manager adapter.
bool setStateVarData(const int &gid, const std::vector< double > &varData)
Linear::Vector * dQdxdVpVectorPtr
Factory for creating analysis objects.
AnalysisManager & analysisManager_
bool completeHomotopyStep(Loader::NonlinearEquationLoader &loader, const std::vector< std::string > &paramNames, const std::vector< double > &paramVals, Linear::Vector *solnVecPtr)
virtual bool getLimiterFlag()
Definition: N_LOA_Loader.h:248
bool failHomotopyStep(Loader::NonlinearEquationLoader &loader)
TimeIntg::WorkingIntegrationMethod & getWorkingIntegrationMethod()
bool acopFlag
Analysis ACOP flag.
double pdt
Time integrator partial time deriviative.
double solverStartTime_
Xyce timing utility for timing elapsed run time.
bool evalTransientModel(Loader::Loader &loader, double t, Linear::Vector *SolVectorPtr, Linear::Vector *CurrSolVectorPtr, Linear::Vector *LasSolVectorPtr, Linear::Vector *StaVectorPtr, Linear::Vector *CurrStaVectorPtr, Linear::Vector *LasStaVectorPtr, Linear::Vector *StaDerivVectorPtr, Linear::Vector *StoVectorPtr, Linear::Vector *CurrStoVectorPtr, Linear::Vector *LasStoVectorPtr, Linear::Vector *stoLeadCurrQVectorPtr, Linear::Vector *NextLeadFVectorPtr, Linear::Vector *CurrLeadFVectorPtr, Linear::Vector *LastLeadFVectorPtr, Linear::Vector *LeadQVectorPtr, Linear::Vector *NextJunctionVVectorPtr, Linear::Vector *CurrentJunctionVVectorPtr, Linear::Vector *LastJunctionVVectorPtr, Linear::Vector *QVectorPtr, Linear::Vector *FVectorPtr, Linear::Vector *BVectorPtr, Linear::Vector *dFdxdVpVectorPtr, Linear::Vector *dQdxdVpVectorPtr, Linear::Matrix *dQdxMatrixPtr, Linear::Matrix *dFdxMatrixPtr)
bool setNextSolVectorPtr(Linear::Vector *solVecPtr)
Linear::Vector * currSolutionPtr
bool registerMORFactory(const std::string &netlist_filename, IO::PkgOptionsMgr &options_manager, AnalysisManager &analysis_manager, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager, Topo::Topology &topology)
Definition: N_ANP_MOR.C:2260
const Analysis::SweepVector & getStepSweepVector() const
void initializeTransientModel(const TimeIntg::TIAParams &tia_params)
bool getBlockAnalysisFlag() const
Return true if primary analysis is HB or MPDE.
bool setStoreVarData(const int &gid, const std::vector< double > &varData)
double startingTimeStep
Step error control starting time step.
bool evalTransientModelState(TimeIntg::StepErrorControl &step_error_control, Loader::Loader &loader, double t, Linear::Vector *SolVectorPtr, Linear::Vector *StaVectorPtr, Linear::Vector *StoVectorPtr)
Linear::Vector * nextStateDerivPtr
bool getStoreVarData(const int &gid, std::vector< double > &varData)
void writeConductanceFile(const std::vector< std::string > &device_names, Nonlinear::ConductanceExtractor &conductance_extractor, const std::string &filename)
Parallel::Manager * parallelManager_
Pointer to the parallel services manager.
double currTimeStep
Step error control current time step.
Linear::Matrix * dQdxMatrixPtr
AnalysisBase * primaryAnalysisObject_
.TRAN, .AC, .HB, ...
Linear::Vector * flagSolutionPtr
virtual bool getDCOPFlag() const =0
bool setSaveOptions(const Util::OptionBlock &OB)
const char * getName() const
Linear::Vector * daeBVectorPtr
bool printLoopInfo(int start, int finish)
void computeDivDiffsBlock(const std::list< IndexPair > &solGIDList, const std::list< IndexPair > &staGIDList)
int currentOrder
Time integrator order.