Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_ANP_InnerLevelSolve.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_InnerLevelSolve.C,v $
27 // Purpose : This file contains functions from control-algorithm that are
28 // used by the inner solve of a 2-level xyce-to-xyce solve.
29 // Special Notes :
30 // Creator : Eric Keiter
31 // Creation Date : 1/23/08
32 //
33 // Revision Information:
34 // ---------------------
35 // Revision Number: $Revision: 1.49 $
36 // Revision Date : $Date: 2014/02/24 23:49:12 $
37 // Current Owner : $Author: tvrusso $
38 //-----------------------------------------------------------------------------
39 
40 #include <Xyce_config.h>
41 
42 
43 // ---------- Standard Includes ----------
44 #define Xyce_MPDE_IC
45 #include <N_UTL_Misc.h>
46 
47 #include <iostream>
48 #include <ctime>
49 
50 #ifdef HAVE_CSTDIO
51 #include <cstdio>
52 #else
53 #include <stdio.h>
54 #endif
55 
56 #ifdef HAVE_CMATH
57 #include <cmath>
58 #else
59 #include <math.h>
60 #endif
61 
62 // ---------- Xyce Includes ----------
63 
64 #include <N_ANP_AnalysisManager.h>
65 #include <N_ANP_Transient.h>
66 #include <N_ANP_DCSweep.h>
67 
69 #include <N_TIA_StepErrorControl.h>
70 #include <N_TIA_DataStore.h>
71 #include <N_TIA_TIAParams.h>
72 #include <N_TIA_TimeIntInfo.h>
73 #include <N_TIA_TwoLevelError.h>
74 
75 #include <N_ERH_ErrorMgr.h>
76 
77 #include <N_NLS_Manager.h>
78 #include <N_LOA_Loader.h>
79 
80 #include <N_PDS_Manager.h>
81 #include <N_PDS_Comm.h>
82 
83 #include <N_UTL_OptionBlock.h>
84 #include <N_UTL_Timer.h>
85 #include <N_UTL_BreakPoint.h>
86 
87 #include <N_IO_CmdParse.h>
88 
89 namespace Xyce {
90 namespace Analysis {
91 
92 //-----------------------------------------------------------------------------
93 // Function : AnalysisManager::provisionalStep
94 // Purpose : Used by mixed-signal.
95 // Special Notes :
96 // Scope : public
97 // Creator : Eric Keiter, SNL
98 // Creation Date : 03/04/2009
99 //-----------------------------------------------------------------------------
100 bool AnalysisManager::provisionalStep (double maxTimeStep, double &timeStep)
101 {
102  bool bsuccess = true;
103  bool b1 = true;
104  std::string msg;
105  bool dcopFlag = true;
106 
108  {
110  {
111  mixedSignalAnalysisObject_ = Teuchos::rcp(new N_ANP_Transient(this));
112  mixedSignalAnalysisObject_->setAnalysisParams(tranParamsBlock);
113  secPtr_->resetAll();
114  }
115  else if (analysis == ANP_MODE_DC_SWEEP)
116  {
117  mixedSignalAnalysisObject_ = Teuchos::rcp(new N_ANP_DCSweep(this));
118  for (int i=0;i<dcParamsBlockVec.size();++i)
119  {
120  mixedSignalAnalysisObject_->setAnalysisParams(dcParamsBlockVec[i]);
121  }
122  }
123  else
124  {
125  msg = "AnalysisManager::provisionalStep - "
126  "unknown type of analysis\n";
127  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
128  }
130 
131  // This checks to make sure that all quantities in the .print are
132  // valid before we continue. This only needs to be done once.
133  outputMgrAdapterRCPtr_->check_output( analysis ); //, *getDataStore()->currSolutionPtr, *getDataStore()->currStatePtr, *getDataStore()->currStorePtr );
134 
135  // Start the solvers timer.
136  xyceTranTimerPtr_ = rcp(new N_UTL_Timer( *(pdsMgrPtr->getPDSComm()) ));
137 
139  }
140 
142 
143  RefCountPtr<N_ANP_Transient> mixedSignalTransientAnalysisObject =
144  Teuchos::rcp_dynamic_cast<N_ANP_Transient>(mixedSignalAnalysisObject_);
145 
146  if (!Teuchos::is_null(mixedSignalTransientAnalysisObject))
147  {
148  dcopFlag = mixedSignalTransientAnalysisObject->getDCOPFlag();
149  }
150 
151  // Now save time step info, in case this step gets rejected.
152 
153  if (!(secPtr_->finished()))
154  {
155  bool stepSuccess = false;
156 
157  if (dcopFlag) // if dcop step, make one attempt.
158  {
159  mixedSignalAnalysisObject_->preStepDetails (maxTimeStep);
160  b1 = mixedSignalAnalysisObject_->mixedSignalStep();
161 
162  // only call finalize step here if we have failed.
163  if (!secPtr_->stepAttemptStatus)
164  {
165  mixedSignalAnalysisObject_->finalizeStep();
166  }
167  stepSuccess = secPtr_->stepAttemptStatus;
168  }
169  else // else, if transient step, keep re-taking the step
170  // until it succeeds, or gets an unrecoverable failure,
171  // such as time-step-too-small.
172  {
173  bool recoverableFailureFlag=true;
174  while (!stepSuccess && recoverableFailureFlag)
175  {
176  mixedSignalAnalysisObject_->preStepDetails (maxTimeStep);
177  b1 = mixedSignalAnalysisObject_->mixedSignalStep();
178 
179  // Only call finalize step here if step has failed.
180  // If we succeed, we want to give Habanero the opportunity
181  // to reject the step, after this function (provisionalStep)
182  // exits.
183  if (!secPtr_->stepAttemptStatus)
184  {
185  recoverableFailureFlag = mixedSignalAnalysisObject_->finalizeStep ();
186  }
187  else
188  {
189  stepSuccess = true;
190  }
191  }
192  }
193  bsuccess = stepSuccess;
194  }
195 
196  // get the step information.
197  //
198 
199  if (dcopFlag)
200  {
201  timeStep = 0.0;
202  }
203  else
204  {
205  N_TIA_TimeIntInfo tiInfo;
206  getTimeIntInfo(tiInfo);
207  timeStep = tiInfo.nextTimeStep;
208  }
209 
210  return bsuccess;
211 }
212 
213 //-----------------------------------------------------------------------------
214 // Function : AnalysisManager::acceptProvisionalStep
215 // Purpose : Used by mixed-signal.
216 // Special Notes :
217 // Scope : public
218 // Creator : Eric Keiter, SNL
219 // Creation Date : 04/10/2009
220 //-----------------------------------------------------------------------------
222 {
223  mixedSignalAnalysisObject_->finalizeStep ();
224 }
225 
226 //-----------------------------------------------------------------------------
227 // Function : AnalysisManager::rejectProvisionalStep
228 // Purpose : Used by mixed-signal.
229 // Special Notes :
230 // Scope : public
231 // Creator : Eric Keiter, SNL
232 // Creation Date : 04/10/2009
233 //-----------------------------------------------------------------------------
235 {
236  secPtr_->stepAttemptStatus = false;
237  secPtr_->updateBreakPoints();
238 
239  bool dcopFlag = false;
240  RefCountPtr<N_ANP_Transient> mixedSignalTransientAnalysisObject =
241  Teuchos::rcp_dynamic_cast<N_ANP_Transient>(mixedSignalAnalysisObject_);
242 
243  if (!Teuchos::is_null(mixedSignalTransientAnalysisObject))
244  {
245  dcopFlag = mixedSignalTransientAnalysisObject->getDCOPFlag();
246  }
247 
248  if (dcopFlag)
249  {
250  mixedSignalAnalysisObject_->finalizeStep ();
251  }
252  // Transient
253  else
254  {
255  // bool b1 = processFailedStep();
256  loaderPtr->stepFailure (currentMode_);
257  wimPtr->rejectStepForHabanero();
258 
259  mixedSignalTransientAnalysisObject->totalNumberFailedStepsAttempted_ += 1;
260  secPtr_->numberSuccessiveFailures += 1;
261 
262  } // transient
263 
264 #if 0
265  if (secPtr_->isPauseTime())
266  {
267  // Failure at this point only indicates that the simulation
268  // is paused and may be resumed.
269  secPtr_->simulationPaused();
270  isPaused = true;
271  }
272 #endif
273 }
274 
275 //-----------------------------------------------------------------------------
276 // Function : AnalysisManager::runStep
277 //
278 // Purpose : This function is similar to "run" except that only a single
279 // integration (or DC sweep) step will be executed.
280 //
281 // Special Notes : Used for multi-level Newton solves, for levels other
282 // than the top level.
283 //
284 // Scope : public
285 // Creator : Eric Keiter, SNL
286 // Creation Date : 03/06/2006
287 //-----------------------------------------------------------------------------
289  (const N_TIA_TimeIntInfo & tiInfo, N_TIA_TwoLevelError & tlError)
290 {
291  std::string msg;
292 
293  if (initializeAllFlag_ == false)
294  {
295  msg = "AnalysisManager::runStep - "
296  "you need to call the initializeAll function first\n";
297  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
298  }
299 
300  if (analysisParamsRegistered == false)
301  {
302  msg = "AnalysisManager::runStep: "
303  "no analysis statement in the netlist\n";
304  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
305  }
306 
307  bool integration_status = false;
308 
309 #ifdef Xyce_VERBOSE_TIME
310  tiaParams.printParams(Xyce::lout(), anpAnalysisModeToNLS(analysis));
311 #endif
312 
313  solverStartTime_ = elapsedTimerPtr_->elapsedTime();
314 
315  if (stepLoopFlag_)
316  {
317  msg = "AnalysisManager::runStep - "
318  "Not valid to use .STEP statements in an inner solve.\n";
319  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
320  }
321  else
322  {
323  if (analysis == ANP_MODE_TRANSIENT)
324  {
325 #ifdef Xyce_VERBOSE_TIME
326  Xyce::dout() << "AnalysisManager::runStep:" << std::endl;
327  Xyce::dout() << "nextTime = " << tiInfo.nextTime << std::endl;
328  Xyce::dout() << "stepSize = " << tiInfo.nextTimeStep << std::endl;
329 #endif
330  }
331  else if (analysis == ANP_MODE_DC_SWEEP)
332  {
333  // do nothing
334  }
335  else
336  {
337  msg = "AnalysisManager::runStep - "
338  "unknown type of analysis\n";
339  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
340  }
341  integration_status = twoLevelAnalysisObject_->twoLevelStep();
342  wimPtr->setupTwoLevelError(tlError);
343  }
344 
345  return integration_status;
346 }
347 
348 
349 //-----------------------------------------------------------------------------
350 // Function : AnalysisManager::startTimeStep_
351 // Purpose : used by 2-level solves.
352 // Special Notes : One of the primary purposes for this function is to impose
353 // a lot of upper level information from the top level time
354 // integrator on the inner level time integrator. This
355 // information is contained in the N_TIA_TimeIntInfo
356 // class (tiInfo here). This includes things like the
357 // time step size, the time integration order, etc.
358 //
359 // In general, in a 2-level solve, an inner solver doesn't
360 // have enough information to correctly determine the
361 // step size, order, etc. This is in part because the
362 // inner solver, while it knows about the top level solver,
363 // it cannot know about any OTHER inner solvers.
364 //
365 // The top level solver, however, does have enough information.
366 // It gathers break point, error analysis, and other info
367 // from all the inner solves. So, the top level solver
368 // makes all the decisions and imposes them on the inner
369 // solves. This function is where it does that impose.
370 //
371 // Scope : public
372 // Creator : Eric Keiter, SNL
373 // Creation Date : 03/06/2006
374 //-----------------------------------------------------------------------------
376 {
377  // Beginning Integration flag is the only piece of data in tiInfo that is
378  // currently owned by the control algorithm class. Everything else
379  // is owned by the step error control, or the integration method.
380  twoLevelAnalysisObject_->setBeginningIntegrationFlag(tiInfo.beginIntegrationFlag);
381 
382 #ifdef Xyce_DEBUG_ANALYSIS
383  if (tiaParams.debugLevel > 0)
384  {
385  Xyce::dout() << "AnalysisManager::startTimeStep:" << std::endl;
386  }
387 #endif
388 
389 #ifdef Xyce_VERBOSE_TIME
390  if( !is_null(twoLevelAnalysisObject_) )
391  {
392  // an MPDE run also traverses this area so catch case where this is null
393  twoLevelAnalysisObject_->printStepHeader(Xyce::lout());
394  }
395 #endif
396  if (switchIntegrator_) wimPtr->createTimeIntegMethod( twoLevelAnalysisObject_->getIntegrationMethod() );
397 
398  // ------------------------------------------------------------------------
399  // Set the step size, current time and next time.
400 #ifndef Xyce_CHARON
401  if ( twoLevelAnalysisObject_->getIntegrationMethod() != TIAMethod_NONE)
402 #endif
403  {
404  secPtr_->updateTwoLevelTimeInfo(tiInfo);
405  }
406 
407 
408  if (twoLevelAnalysisObject_->getBeginningIntegrationFlag() && secPtr_->stepAttemptStatus)
409  {
410  wimPtr->setTwoLevelTimeInfo(tiInfo); // new-dae only
411  }
412 
413  // ------------------------------------------------------------------------
414  // If we've switched the integration method, we need to obtain the
415  // corrector derivative only after we've updated the TimeInfo.
416  if (switchIntegrator_)
417  {
418  switchIntegrator_ = false;
419  wimPtr->obtainCorrectorDeriv();
420  }
421 
422  bool dcopFlag = true;
423  RefCountPtr<N_ANP_Transient> twoLevelTransientAnalysisObject = Teuchos::rcp_dynamic_cast<N_ANP_Transient>(twoLevelAnalysisObject_);
424  if (!Teuchos::is_null(twoLevelTransientAnalysisObject)) {
425  dcopFlag = twoLevelTransientAnalysisObject->getDCOPFlag();
426  }
427 #ifdef Xyce_VERBOSE_TIME
428  if (!dcopFlag) secPtr_->outputTimeInfo(lout());
429 #endif
430 
431  // ------------------------------------------------------------------------
432  // Set the nonlinear solver parameters to those appropriate for the
433  // transient solution, if neccessary.
434  if (!dcopFlag)
435  {
437  }
438 
439  // Ask the method to update its coefficients
440  wimPtr->updateCoeffs();
441  twoLevelAnalysisObject_->handlePredictor();
442 
443  return true;
444 }
445 
446 //-----------------------------------------------------------------------------
447 // Function : AnalysisManager::conductanceTest
448 // Purpose :
449 // Special Notes :
450 // Scope : public
451 // Creator : Eric Keiter, SNL
452 // Creation Date : 03/06/2006
453 //-----------------------------------------------------------------------------
455 {
456  std::map<std::string,double> inputMap;
457  std::vector<double> outputVector;
458  std::vector< std::vector<double> > jacobian;
459 
460  // load inputMap from tiaParam.condTestDeviceNames option
461  std::list< std::string >::iterator currentDeviceName = tiaParams.condTestDeviceNames.begin();
462  std::list< std::string >::iterator endDeviceName = tiaParams.condTestDeviceNames.end();
463  while( currentDeviceName != endDeviceName )
464  {
465  inputMap[ *currentDeviceName ] = 0.0;
466  ++currentDeviceName;
467  }
468 
469 #ifdef Xyce_DEBUG_ANALYSIS
470  if (tiaParams.debugLevel > 0)
471  {
472  Xyce::dout() << "AnalysisManager::conductanceTest()" << std::endl;
473  currentDeviceName = tiaParams.condTestDeviceNames.begin();
474  while( currentDeviceName != endDeviceName )
475  {
476  Xyce::dout() << "currentDeviceName = \"" << *currentDeviceName << "\" added to inputMap[ "
477  << *currentDeviceName << " ] = " << inputMap[ *currentDeviceName ] << std::endl;
478  ++currentDeviceName;
479  }
480  }
481 #endif
482 
483  int isize=inputMap.size();
484  outputVector.resize(isize,0.0);
485  jacobian.resize(isize);
486  for (int i=0;i<isize;++i)
487  {
488  jacobian[i].resize(isize,0.0);
489  }
490 
491  bool b1 = nlsMgrPtr->obtainConductances(
492  inputMap,
493  outputVector,
494  jacobian
495  );
496 
497  int iE1, iE2;
498  int numElectrodes = isize;
499 
500  FILE *fp1;
501  fp1 = fopen("conductance.txt","w");
502 
503  fprintf(fp1, "%s", "Conductance array: \n");
504  fprintf(fp1,"%s", " ");
505  if (b1)
506  {
507  std::map<std::string,double>::iterator iterM = inputMap.begin();
508  std::map<std::string,double>::iterator endM = inputMap.end ();
509  for (iE2 = 0; iE2 < numElectrodes; ++iE2,++iterM)
510  {
511  std::string srcname = iterM->first;
512  fprintf(fp1,"\t%14s",srcname.c_str());
513  }
514  fprintf(fp1,"%s", "\n");
515 
516  iterM = inputMap.begin();
517  for (iE1 = 0; iE1 < numElectrodes; ++iE1, ++iterM)
518  {
519  std::string srcname = iterM->first;
520  fprintf(fp1,"%14s",srcname.c_str());
521  for (iE2 = 0; iE2 < numElectrodes; ++iE2)
522  {
523  fprintf(fp1,"\t%14.4e",jacobian[iE1][iE2]);
524  }
525  fprintf(fp1,"%s", "\n");
526  }
527  fprintf(fp1,"%s", "\n");
528  }
529  else
530  {
531  fprintf(fp1,"%s", "\nConductance calculation failed!\n");
532  }
533 
534  fclose(fp1);
535 
536 }
537 
538 //-----------------------------------------------------------------------------
539 // Function : AnalysisManager::startupSolvers
540 // Purpose :
541 // Special Notes : Used only for 2-level solves.
542 // Scope : public
543 // Creator : Eric R. Keiter
544 // Creation Date : 3/10/2006
545 //-----------------------------------------------------------------------------
547 {
548  bool bsuccess = true;
549  std::string msg;
550 
552  {
553  nlsMgrPtr->resetAll(DC_OP);
554  twoLevelAnalysisObject_ = Teuchos::rcp(new N_ANP_Transient(this));
555  twoLevelAnalysisObject_->setAnalysisParams(tranParamsBlock);
556  secPtr_->resetAll();
557  }
558  else if (analysis == ANP_MODE_DC_SWEEP)
559  {
560  secPtr_->setTIAParams();
561  twoLevelAnalysisObject_ = Teuchos::rcp(new N_ANP_DCSweep(this));
562  for (int i=0;i<dcParamsBlockVec.size();++i)
563  {
564  twoLevelAnalysisObject_->setAnalysisParams(dcParamsBlockVec[i]);
565  }
566  }
567  else
568  {
569  msg = "AnalysisManager::startupSolvers: Multi-Level Newton solves only supports DC and Transient analysis\n";
570  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
571  }
573  twoLevelAnalysisObject_->init();
574 
575  // This checks to make sure that all quantities in the .print are
576  // valid before we continue. This only needs to be done once.
577  outputMgrAdapterRCPtr_->check_output( analysis ); //, *getDataStore()->currSolutionPtr, *getDataStore()->currStatePtr, *getDataStore()->currStorePtr );
578 
579 
580  // Start the solvers timer.
581  xyceTranTimerPtr_ = rcp(new N_UTL_Timer( *(pdsMgrPtr->getPDSComm()) ));
582 
583  // Hardwire the erroption parameter to 1, which will force the inner
584  // solve (initiated by this function) to only use the Newton success/failure
585  // as step criteria. Predictor-corrector information is handled in the
586  // upper level solver.
588  // tscoffe 03/07/08 With the new errorAnalysisOption = 1 features of nlmin
589  // and nlmax, we should enforce the original mode where nlmin=nlmax=maxNLSteps.
590  //int maxNLSteps = ???;
591  //tiaParams.NLmax = maxNLSteps;
592  //tiaParams.NLmin = maxNLSteps;
593 
594  return bsuccess;
595 }
596 
597 //-----------------------------------------------------------------------------
598 // Function : AnalysisManager::finishSolvers
599 // Purpose :
600 // Special Notes : Used only for 2-level solves.
601 // Scope : public
602 // Creator : Eric Keiter
603 // Creation Date : 3/10/2006
604 //-----------------------------------------------------------------------------
606 {
607  bool bsuccess = true;
608  std::string msg;
609 
610  twoLevelAnalysisObject_->finish();
611 
612  return bsuccess;
613 }
614 
615 //-----------------------------------------------------------------------------
616 // Function : AnalysisManager::homotopyStepSuccess
617 // Purpose : Lower-level processing of a successful homotopy step,
618 // which was controlled from the upper level of a 2-level solve.
619 // Special Notes :
620 // Scope : public
621 // Creator : Eric R. Keiter, SNL
622 // Creation Date : 03/20/06
623 //-----------------------------------------------------------------------------
625  ( const std::vector<std::string> & paramNames,
626  const std::vector<double> & paramVals)
627 {
628 #ifdef Xyce_DEBUG_ANALYSIS
629  std::string netListFile = commandLine_.getArgumentValue("netlist");
630  Xyce::dout() << "\n " << netListFile;
631  Xyce::dout() << " AnalysisManager::homotopyStepSuccess " << std::endl;
632 #endif
633  // output:
634  outputMgrAdapterRCPtr_->outputHomotopy( paramNames, paramVals, *getTIADataStore()->nextSolutionPtr );
635 
636  // update the data arrays:
637  getTIADataStore()->updateSolDataArrays();
638 
639  // pass info to the next level down, if it exists.
640  loaderPtr->homotopyStepSuccess (paramNames,paramVals);
641 
642  return;
643 }
644 
645 //-----------------------------------------------------------------------------
646 // Function : AnalysisManager::homotopyStepFailure
647 //
648 // Purpose : Lower-level processing of a failed homotopy step,
649 // which was controlled from the upper level of a
650 // 2-level solve.
651 // Special Notes :
652 // Scope : public
653 // Creator : Eric R. Keiter, SNL
654 // Creation Date : 03/30/06
655 //-----------------------------------------------------------------------------
657 {
658 #ifdef Xyce_DEBUG_ANALYSIS
659  std::string netListFile = commandLine_.getArgumentValue("netlist");
660  Xyce::dout() << "\n " << netListFile;
661  Xyce::dout() << " AnalysisManager::homotopyStepFailure " << std::endl;
662 #endif
663 
664  // The solutions currently in place represent failure. Get rid of them.
665  getTIADataStore()->usePreviousSolAsPredictor ();
666 
667  // pass info to the next level down, if it exists.
668  loaderPtr->homotopyStepFailure ();
669 
670  return;
671 }
672 
673 //-----------------------------------------------------------------------------
674 // Function : AnalysisManager::stepSuccess
675 // Purpose :
676 // Special Notes :
677 // Scope : public
678 // Creator : Eric R. Keiter, SNL
679 // Creation Date : 03/12/06
680 //-----------------------------------------------------------------------------
681 void AnalysisManager::stepSuccess (int analysisUpper)
682 {
683 
684 #ifdef Xyce_DEBUG_ANALYSIS
685  std::string netListFile = commandLine_.getArgumentValue("netlist");
686  Xyce::dout() << "\n " << netListFile;
687  Xyce::dout() << " AnalysisManager::stepSuccess " << std::endl;
688 #endif
689 
690  currentMode_ = analysisUpper;
691  secPtr_->stepAttemptStatus = true;
692  switch( analysisUpper )
693  {
694  case 0:
695  {
696  N_ANP_Transient * twoLevelTransientAnalysisObject = dynamic_cast<N_ANP_Transient*>(&*twoLevelAnalysisObject_);
697  if (twoLevelTransientAnalysisObject)
698  {
699  twoLevelTransientAnalysisObject->processSuccessfulDCOP();
700  }
701  else
702  {
703  std::string msg = "AnalysisManager::stepSuccess - "
704  "Failed dynamic_cast of twoLevelAnalysisObject to N_ANP_Transient.\n";
705  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
706  }
707  }
708  break;
709  case 1:
710  twoLevelAnalysisObject_->processSuccessfulStep();
711  break;
712  case 2:
713  twoLevelAnalysisObject_->processSuccessfulStep();
714  break;
715  default:
716  std::string msg = "AnalysisManager::stepSuccess - "
717  "unknown type of analysis\n";
718  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
719  }
720 }
721 
722 //-----------------------------------------------------------------------------
723 // Function : AnalysisManager::stepFailure
724 // Purpose :
725 // Special Notes :
726 // Scope : public
727 // Creator : Eric R. Keiter, SNL
728 // Creation Date : 03/12/06
729 //-----------------------------------------------------------------------------
730 void AnalysisManager::stepFailure (int analysisUpper)
731 {
732  currentMode_ = analysisUpper;
733  secPtr_->stepAttemptStatus = false;
734  switch( analysisUpper )
735  {
736  case 0:
737  {
738  N_ANP_Transient * twoLevelTransientAnalysisObject = dynamic_cast<N_ANP_Transient*>(&*twoLevelAnalysisObject_);
739  if (twoLevelTransientAnalysisObject)
740  {
741  twoLevelTransientAnalysisObject->processFailedDCOP();
742  }
743  else
744  {
745  std::string msg = "AnalysisManager::stepSuccess - "
746  "Failed dynamic_cast of twoLevelAnalysisObject to N_ANP_Transient.\n";
747  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
748  }
749  }
750  break;
751  case 1:
752  twoLevelAnalysisObject_->processFailedStep();
753  break;
754  case 2:
755  twoLevelAnalysisObject_->processFailedStep();
756  break;
757  default:
758  std::string msg = "AnalysisManager::stepFailure - "
759  "unknown type of analysis\n";
760  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
761  }
762 }
763 
764 //-----------------------------------------------------------------------------
765 // Function : AnalysisManager::getInitialQnorm
766 // Purpose : Used for 2-level solves.
767 // Special Notes :
768 // Scope : public
769 // Creator : Eric R. Keiter, SNL
770 // Creation Date : 03/12/06
771 //-----------------------------------------------------------------------------
773 {
774  bool bsuccess = true;
775  wimPtr->getInitialQnorm (tle);
776  return bsuccess;
777 }
778 
779 //-----------------------------------------------------------------------------
780 // Function : AnalysisManager::getBreakPoints
781 // Purpose : Used for 2-level solves.
782 // Special Notes :
783 // Scope : public
784 // Creator : Eric R. Keiter, SNL
785 // Creation Date : 03/12/06
786 //-----------------------------------------------------------------------------
787 bool AnalysisManager::getBreakPoints(std::vector<N_UTL_BreakPoint> &breakPointTimes)
788 {
789  bool bsuccess = true;
790  loaderPtr->getBreakPoints(breakPointTimes);
791  return bsuccess;
792 }
793 
794 } // namespace Analysis
795 } // namespace Xyce