Xyce  6.1
N_DEV_DeviceMgr.h
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_DEV_DeviceMgr.h,v $
27 //
28 // Purpose :
29 //
30 // Special Notes :
31 //
32 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
33 //
34 // Creation Date : 02/28/00
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.420 $
40 //
41 // Revision Date : $Date: 2015/10/14 19:31:37 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-----------------------------------------------------------------------------
45 
46 #ifndef Xyce_N_DEV_DeviceMgr_h
47 #define Xyce_N_DEV_DeviceMgr_h
48 
49 #if defined(HAVE_UNORDERED_MAP)
50 #include <unordered_map>
51 using std::unordered_map;
52 #elif defined(HAVE_TR1_UNORDERED_MAP)
53 #include <tr1/unordered_map>
54 using std::tr1::unordered_map;
55 #else
56 #error neither unordered_map or tr1/unordered_map found
57 #endif
58 #include <map>
59 #include <set>
60 #include <string>
61 #include <vector>
62 
63 #include <N_ANP_fwd.h>
64 #include <N_DEV_fwd.h>
65 #include <N_IO_fwd.h>
66 #include <N_LAS_fwd.h>
67 #include <N_NLS_fwd.h>
68 #include <N_PDS_fwd.h>
69 #include <N_TIA_fwd.h>
70 #include <N_TOP_fwd.h>
71 #include <N_UTL_fwd.h>
72 
73 #include <N_ANP_StepEvent.h>
75 #include <N_DEV_DeviceOptions.h>
76 #include <N_DEV_ExternData.h>
77 #include <N_DEV_MatrixLoadData.h>
78 #include <N_DEV_SolverState.h>
79 #include <N_UTL_Listener.h>
80 #include <N_UTL_Op.h>
81 
82 namespace Xyce {
83 namespace Device {
84 
85 bool
87  Parallel::Machine comm,
88  const DeviceMgr & device_manager,
89  const std::string & name,
90  double & val);
91 
92 //-----------------------------------------------------------------------------
93 // Class : DeviceMgr
94 // Purpose :
95 // Special Notes :
96 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
97 // Creation Date : 3/16/00
98 //-----------------------------------------------------------------------------
99 class DeviceMgr : public Util::Listener<Analysis::StepEvent>
100 {
102  friend bool getParamAndReduce(Parallel::Machine comm, const DeviceMgr &device_manager, const std::string &name, double &value);
103 
104 public:
105  typedef std::vector<Device *> DeviceVector;
106  typedef std::vector<DeviceEntity *> EntityVector;
107  typedef std::vector<DeviceInstance *> InstanceVector;
108  typedef std::vector<DeviceModel *> ModelVector;
109  typedef std::map<ModelTypeId, ModelVector> ModelTypeModelVectorMap;
110  typedef std::map<ModelTypeId, InstanceVector> ModelTypeInstanceVectorMap;
111  typedef unordered_map<std::string, DeviceEntity *, HashNoCase, EqualNoCase> DeviceEntityMap;
112  typedef unordered_map<std::string, ModelTypeId, HashNoCase, EqualNoCase> ModelTypeNameModelTypeIdMap;
113 
114  typedef unordered_map<std::string, SourceInstance *, HashNoCase, EqualNoCase> IndependentSourceMap;
115  typedef std::vector<SourceInstance *> IndependentSourceVector;
116 
117  typedef unordered_map<std::string, Util::Op::Operator *> OpMap;
118 
119  DeviceMgr(Parallel::Machine comm, Topo::Topology &topology, Util::Op::BuilderManager &op_builder_manager, const IO::CmdParse &command_line);
120  ~DeviceMgr();
121 
122 private:
123  DeviceMgr(const DeviceMgr &); ///< No copying
124  DeviceMgr &operator=(const DeviceMgr &); ///< No assignment
125 
126 public:
127  void notify(const Analysis::StepEvent &event);
128 
129  bool registerAnalysisManager(Analysis::AnalysisManager *analysis_manager);
130 
131  // bool registerMeasureMgr(IO::Measure::Manager * measure_manager)
132  // {
133  // measureManager_ = measure_manager;
134 
135  // return measureManager_ != 0;
136  // }
137 
139  {
140  nlsMgrPtr_ = tmp_nlsMgrPtr;
141 
142  return nlsMgrPtr_ != 0;
143  }
144 
145  bool registerICLoads( std::vector<std::pair<int,double> > * icLoads );
146 
147  // this function is called from the output manager (through the
148  // device interface) to inform the device package of the devices for
149  // which lead currents have been requested. The device manager will
150  // take care of doing isolated F and Q loads for these devices so
151  // the lead currents can be calculated
152  bool setLeadCurrentRequests(const std::set<std::string> & deviceNames );
153 
154  // MPDE related registrations:
155  std::vector<double> getFastSourcePeriod(Parallel::Machine comm, const std::vector<std::string> &sourceNames);
156  std::vector<double> registerFastSources(Parallel::Machine comm, const std::vector<std::string> &sourceNames);
157  void deRegisterFastSources(const std::vector<std::string> &sourceNames);
158  void deactivateSlowSources();
159  void activateSlowSources();
160 
161  void setMPDEFlag( bool flagVal );
162  void setBlockAnalysisFlag( bool flagVal );
163  void setFastTime( double timeVal );
164 
165  // Initialization function, to be called after all registrations are
166  // finished, and the linear system class is completely set up.
167  bool initializeAll(Linear::System &linear_system);
168 
169  // Device accessor functions:
170 
171  bool addDeviceModel(const ModelBlock & MB);
172 
173  std::pair<ModelTypeId, ModelTypeId> getModelType(const InstanceBlock &instance_block);
174 
175  bool verifyDeviceInstance(const InstanceBlock & IB);
176 
178 
179  bool deleteDeviceInstance (const std::string & name);
180 
181  int getHomotopyBlockSize() const;
182 
183  bool outputPlotFiles(bool force_final_output);
184  bool finishOutput ();
185 
186  void dotOpOutput ();
187 
188  // Load functions:
189  bool setInitialGuess (Linear::Vector * solVectorPtr);
190  bool loadErrorWeightMask(Linear::Vector * deviceMaskPtr);
191 
192  void debugOutput1();
193  void debugOutput2();
194 
196  std::string & name,
197  std::vector<double> & dfdpVec,
198  std::vector<double> & dqdpVec,
199  std::vector<double> & dbdpVec,
200  std::vector<int> & FindicesVec,
201  std::vector<int> & QindicesVec,
202  std::vector<int> & BindicesVec);
203 
204  bool analyticSensitivitiesAvailable(const std::string & name);
205 
206  bool setParam(const std::string & name, double val, bool overrideOriginal = false);
207 
208  bool updateTemperature(double val);
209 
210  bool updateSources();
211 
212  bool resetRHSLoadFlags (int index);
213 
215  {
216  return isLinearSystem_;
217  }
218 
219  bool isPDESystem()
220  {
221  return solState_.isPDESystem_;
222  }
223 
225  {
226  return devOptions_;
227  }
228 
230  {
232  }
233 
235  {
237  }
238 
240  {
242  }
243 
244  // setup initial conditions on devices
245  bool setICs (Linear::Vector * tmpSolVectorPtr,
246  Linear::Vector * tmpCurrSolVectorPtr,
247  Linear::Vector * tmpLastSolVectorPtr,
248  Linear::Vector * tmpStaVectorPtr,
249  Linear::Vector * tmpCurrStaVectorPtr,
250  Linear::Vector * tmpLasStaVectorPtr,
251  Linear::Vector * tmpStaDerivVectorPtr,
252  Linear::Vector * tmpStoVectorPtr,
253  Linear::Vector * tmpCurrStoVectorPtr,
254  Linear::Vector * tmpLastStoVectorPtr,
255  Linear::Vector * tmpQVectorPtr,
256  Linear::Vector * tmpFVectorPtr,
257  Linear::Vector * tmpBVectorPtr,
258  Linear::Vector * tmpdFdxdVpVectorPtr,
259  Linear::Vector * tmpdQdxdVpVectorPtr);
260 
261  // time integration stuff:
262  bool getBreakPoints(std::vector<Util::BreakPoint> & breakPointTimes);
263  double getMaxTimeStepSize ();
264 
265  // two-level newton and pde-continuation
266  int enablePDEContinuation();
267  bool disablePDEContinuation ();
268  void getNumInterfaceNodes (std::vector<int> & numInterfaceNodes);
269  bool loadCouplingRHS (int iPDEDevice, int iElectrode, Linear::Vector * dfdvPtr);
270  bool calcCouplingTerms (int iSubProblem, int iElectrode, const Linear::Vector * dxdvPtr);
271 
272  bool calcPDESubProblemInfo ();
273 
274  // load functions:
275  bool loadDAEMatrices (Linear::Vector * tmpSolVectorPtr,
276  Linear::Vector * tmpStaVectorPtr,
277  Linear::Vector * tmpStaDerivVectorPtr,
278  Linear::Vector * tmpStoVectorPtr,
279  Linear::Matrix * tmpdQdxMatrixPtr,
280  Linear::Matrix * tmpdFdxMatrixPtr);
281 
282  bool loadDAEVectors (Linear::Vector * tmpNextSolVectorPtr,
283  Linear::Vector * tmpCurrSolVectorPtr,
284  Linear::Vector * tmpLastSolVectorPtr,
285  Linear::Vector * tmpNextStaVectorPtr,
286  Linear::Vector * tmpCurrStaVectorPtr,
287  Linear::Vector * tmpLastStaVectorPtr,
288  Linear::Vector * tmpStaDerivVectorPtr,
289  Linear::Vector * tmpNextStoVectorPtr,
290  Linear::Vector * tmpCurrStoVectorPtr,
291  Linear::Vector * tmpLastStoVectorPtr,
292  Linear::Vector * tmpStoLeadCurrQCompVectorPtr,
293  Linear::Vector * tmpLeadFCompVectorPtr,
294  Linear::Vector * tmpLastLeadFCompVectorPtr,
295  Linear::Vector * tmpNextLeadFCompVectorPtr,
296  Linear::Vector * tmpLeadQCompVectorPtr,
297  Linear::Vector * tmpJunctionVCompVectorPtr,
298  Linear::Vector * tmpLastJunctionVCompVectorPtr,
299  Linear::Vector * tmpNextJunctionCompVectorPtr,
300  Linear::Vector * tmpQVectorPtr,
301  Linear::Vector * tmpFVectorPtr,
302  Linear::Vector * tmpBVectorPtr,
303  Linear::Vector * tmpdFdxdVpVectorPtr,
304  Linear::Vector * tmpdQdxdVpVectorPtr);
305 
306  bool updateState(
307  Linear::Vector * nextSolVectorPtr,
308  Linear::Vector * currSolVectorPtr,
309  Linear::Vector * lastSolVectorPtr,
310  Linear::Vector * nextStaVectorPtr,
311  Linear::Vector * currStaVectorPtr,
312  Linear::Vector * lastStaVectorPtr,
313  Linear::Vector * nextStoVectorPtr,
314  Linear::Vector * currStoVectorPtr,
315  Linear::Vector * lastStoVectorPtr);
316 
317  bool loadBVectorsforAC (Linear::Vector * bVecRealPtr,
318  Linear::Vector * bVecImagPtr);
319 
320  bool getBMatrixEntriesforMOR(std::vector<int>& bMatEntriesVec, std::vector<int>& bMatPosEntriesVec);
321 
322  int getNumNoiseDevices ();
323  int getNumNoiseSources ();
324  void setupNoiseSources(std::vector<Xyce::Analysis::NoiseData*> & noiseDataVec);
325  void getNoiseSources(std::vector<Xyce::Analysis::NoiseData*> & noiseDataVec);
326 
327  // voltlim doesn't work for all analysis types, so neccessary to
328  // be able to turn it off/on.
329  void unsetVoltageLimiterFlag ();
330  void setVoltageLimiterFlag ( bool flagVal );
331 
332  void addGlobalPar(const Util::Param &param);
333  const double *findGlobalPar(const std::string &name) const;
334 
335  // functions related to options registration
336  bool setDeviceOptions(const Util::OptionBlock & option_block)
337  {
338  return devOptions_.setOptions(option_block);
339  }
340 
341  bool registerSensParams(const Util::OptionBlock & option_block);
342 
343  bool setOPAnalysisParams(const Util::OptionBlock & option_block);
344  bool setHBAnalysisParams(const Util::OptionBlock & option_block);
345  bool setACAnalysisParams(const Util::OptionBlock & option_block);
346  bool setNOISEAnalysisParams(const Util::OptionBlock & option_block);
347 
348  bool getHBSpecified() const
349  {
350  return HBSpecified_;
351  }
352 
353  bool getACSpecified() const
354  {
355  return ACSpecified_;
356  }
357 
358  // convergence: allow devices to signal back to the solvers that
359  // they've played some game that invalidates normal convergence tests,
360  // and so the solution should be considered unconverged no matter how
361  // small the various norms are.
362  bool allDevicesConverged(Parallel::Machine comm) const;
363 
364  // Functions needed for power node (2-level) algorithm):
365 
366  // for the parallel case, we need to give all the processors a copy
367  // of the device so all the parallel synchronized calls such are
368  // called by all processors together.
369  bool setupExternalDevices(N_PDS_Comm &parallel_comm);
370 
372  {
373  return localDeviceCountMap_;
374  }
375 
376  void addDeviceToCount(const std::string & device_name, int num_devs = 1)
377  {
378  localDeviceCountMap_[device_name] += num_devs;
379  }
380 
381  void addDevicesToCount(const DeviceCountMap &device_map);
382 
383  DeviceEntity *getDeviceEntity(const std::string &full_param_name) const;
384 
385  void acceptStep();
386 
387  bool getInitialQnorm (std::vector<TimeIntg::TwoLevelError> & tleVec );
388  bool getInnerLoopErrorSums (std::vector<TimeIntg::TwoLevelError> & tleVec) const;
389 
390  bool updateStateArrays();
391  bool startTimeStep(
392  bool beginIntegrationFlag,
393  double nextTimeStep,
394  double nextTime,
395  int currentOrder);
396  void setExternalSolverState(bool external_initJctFlag);
397 
398  int restartDataSize(bool pack) const;
399 
400  // Output restart data.
401  bool dumpRestartData(char * buf, int bsize, int & pos, N_PDS_Comm * comm, bool pack ) const;
402 
403  // Load restart data.
404  bool restoreRestartData(char * buf, int bsize, int & pos, N_PDS_Comm * comm, bool pack );
405 
406  // needed for parallel only:
407  void setGlobalFlags();
408 
409  Device *getDevice(EntityTypeId model_type_id)
410  {
411  EntityTypeIdDeviceMap::iterator it = deviceMap_.find(model_type_id);
412  return it == deviceMap_.end() ? 0 : (*it).second;
413  }
414 
415  EntityTypeId getModelGroup(const std::string &model_or_device_type_name);
416 
417  void addArtificialParameter(const std::string &name, ArtificialParameters::ArtificialParameter *artificial_parameter)
418  {
419  artificialParameterMap_[name] = artificial_parameter;
420  passthroughParameterSet_.insert(name);
421  }
422 
423  const InstanceVector &getDevices(ModelTypeId model_type_id) const;
424 
425 
426  // voltage limiter toggle functions
428  void setVoltageLimiterStatus(bool voltageLimterStatus);
429 
430  Util::Op::Operator *getOp(Parallel::Machine comm, const std::string &name) const;
431 
432  bool parameterExists(Parallel::Machine comm, const std::string & name) const;
433 
434 // private:
435 // bool getParamNoReduce(const std::string &name, double &value) const;
436 
437 private:
438  Device &getDeviceByModelType(const EntityTypeId model_type);
439 
440  bool setupRawVectorPointers_ ();
441  bool setupRawMatrixPointers_ ();
442 
444  bool updatePrimaryState_();
445  bool updateSecondaryState_();
446 
448 
449  // Do the actual solve/calculation for the external devices
450  void updateExternalDevices_();
451 
452  // add external devices for processors that don't own it
453  ExternDevice::Instance * addExtDeviceInstance_(const InstanceBlock & IB);
454 
455 private:
456  const IO::CmdParse & commandLine_; ///< Command line
457  Topo::Topology & topology_; ///< Topology
458  DeviceOptions devOptions_; ///< user-defined options:
460 
461  bool sensFlag_; ///< .SENS present in netlist
462  bool isLinearSystem_; ///< True if all devices in netlist have isLinearDevice() true
463  bool firstDependent_; ///< True until updateDependentParameters_ is called.
464  bool parameterChanged_; ///< Only used locally in updateDependentParameters_, don't know if stateful of just a member for fun
466  double timeParamsProcessed_; ///< Time updateDependentParameters was called
467 
469  MatrixLoadData matrixLoadData_; ///< temporary jacobian load structures:
470  SolverState solState_; ///< real time solver data:
471  Globals & globals_; ///< global variables
474 
475  Linear::Vector * numJacSolVectorPtr_;
476  Linear::Vector * numJacStaVectorPtr_;
477  Linear::Vector * numJacStoVectorPtr_;
478  Linear::Vector * diagonalVectorPtr_;
479 
480  Analysis::AnalysisManager * analysisManager_; ///< To search for non-device parameters. This needs to be removed
481  // IO::Measure::Manager * measureManager_; ///< To search for non-device parameters. This needs to be removed
482  ArtificialParameterMap artificialParameterMap_; ///< Specially named parameters. This needs to be removed
483  PassthroughParameterSet passthroughParameterSet_; ///< Parameters to pass through to external devices when set
484 
485  Parallel::Machine comm_; ///< Communicator (should be passed in when needed, not a member)
486  Nonlinear::Manager * nlsMgrPtr_; ///< To get Nonlinear solver information. This needs to be removed
487  std::vector<std::pair<int, double> > * icLoads_;
488 
489  ModelTypeNameModelTypeIdMap modelTypeMap_; ///< Model type name to model
490  ModelTypeNameModelTypeIdMap modelGroupMap_; ///< Model type name to model group
491  ModelTypeInstanceVectorMap modelGroupInstanceVector_;
492  ModelTypeInstanceVectorMap modelTypeInstanceVector_;
493 
494  ModelVector modelVector_;
495  ModelTypeModelVectorMap modelGroupModelVector_;
496  ModelTypeModelVectorMap modelTypeModelVector_;
497 
499 
500  DeviceVector devicePtrVec_;
501  DeviceVector pdeDevicePtrVec_;
502 
503  InstanceVector instancePtrVec_;
504  InstanceVector bpInstancePtrVec_; ///< instances with breakpoints functions
505  InstanceVector pdeInstancePtrVec_;
506  InstanceVector nonPdeInstancePtrVec_;
507  InstanceVector plotFileInstancePtrVec_;
508 
509  IndependentSourceVector independentSourceVector_;
510  IndependentSourceMap independentSourceMap_;
511 
512  // this is used to store the contents of the independentSourceVector_
513  // during an mpde initialization where we'll remove slow sources from
514  // the that vector so that they don't get updated
515  IndependentSourceVector indepSourceInstanceBackupPtrVec_;
516 
517  InstanceVector testJacDevicePtrVec_; ///< Devices under jacobian test
518  EntityVector dependentPtrVec_;
519 
520  std::set<std::string> devicesNeedingLeadCurrentLoads_;
521 
522  Util::Op::BuilderManager & opBuilderManager_;
523  mutable OpMap opMap_;
524 
525  mutable DeviceEntityMap parameterDeviceCache_; ///< Full parameter name to device entity cache
526 
527  std::vector<int> numInterfaceNodes_;
529 
530  // sensitivities:
532 
533  // .OP output flags.
536 
537  // analysis options (for now bools that say what type of "." line was present in netlist)
540 };
541 
542 //-----------------------------------------------------------------------------
543 // Function : DeviceMgr::unsetVoltageLimiterFlag ()
544 // Purpose :
545 // Special Notes :
546 // Scope : public
547 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
548 // Creation Date : 04/09/04
549 //-----------------------------------------------------------------------------
551 {
553 }
554 
555 //-----------------------------------------------------------------------------
556 // Function : DeviceMgr::setVoltageLimiterFlag ()
557 // Purpose :
558 // Special Notes :
559 // Scope : public
560 // Creator : Ting Mei, SNL
561 // Creation Date : 02/18/14
562 //-----------------------------------------------------------------------------
563 inline void DeviceMgr::setVoltageLimiterFlag ( bool flagVal )
564 {
566 }
567 
568 //-----------------------------------------------------------------------------
569 // Function : DeviceMgr::registerICLoads
570 // Purpose :
571 // Special Notes :
572 // Scope : public
573 // Creator : Robert Hoekstra, SNL, Computational Sciences
574 // Creation Date : 04/03/01
575 //-----------------------------------------------------------------------------
576 inline bool DeviceMgr::registerICLoads( std::vector< std::pair<int,double> > * icLoads )
577 {
578  return (icLoads_ = icLoads) != 0;
579 }
580 
581 bool registerPkgOptionsMgr(DeviceMgr &device_manager, IO::PkgOptionsMgr &options_manager);
582 void registerOpBuilders(Util::Op::BuilderManager &builder_manager, Parallel::Machine comm, DeviceMgr &device_manager);
583 
584 double
586  Parallel::Machine comm,
587  const DeviceMgr & device_manager,
588  const std::string & name);
589 
590 void addGlobalParameter(SolverState &solver_state, Globals &global, const Util::Param &param);
591 const double *findGlobalParameter(const GlobalParameterMap &global_map, const std::string &name);
592 
593 } // namespace Device
594 } // namespace Xyce
595 
596 #endif // Xyce_N_DEV_DeviceMgr_h
bool setParam(const std::string &name, double val, bool overrideOriginal=false)
Linear::Vector * numJacSolVectorPtr_
bool setupExternalDevices(N_PDS_Comm &parallel_comm)
void getAnalyticSensitivities(std::string &name, std::vector< double > &dfdpVec, std::vector< double > &dqdpVec, std::vector< double > &dbdpVec, std::vector< int > &FindicesVec, std::vector< int > &QindicesVec, std::vector< int > &BindicesVec)
ModelTypeNameModelTypeIdMap modelTypeMap_
Model type name to model.
bool setLeadCurrentRequests(const std::set< std::string > &deviceNames)
Linear::Vector * numJacStaVectorPtr_
bool resetRHSLoadFlags(int index)
DeviceEntity * getDeviceEntity(const std::string &full_param_name) const
IndependentSourceMap independentSourceMap_
std::vector< double > getFastSourcePeriod(Parallel::Machine comm, const std::vector< std::string > &sourceNames)
Analysis::AnalysisManager * analysisManager_
To search for non-device parameters. This needs to be removed.
bool loadErrorWeightMask(Linear::Vector *deviceMaskPtr)
InstanceVector instancePtrVec_
Pure virtual class to augment a linear system.
const InstanceVector & getDevices(ModelTypeId model_type_id) const
ModelTypeModelVectorMap modelGroupModelVector_
unordered_map< std::string, DeviceEntity *, HashNoCase, EqualNoCase > DeviceEntityMap
DeviceMgr(Parallel::Machine comm, Topo::Topology &topology, Util::Op::BuilderManager &op_builder_manager, const IO::CmdParse &command_line)
void setFastTime(double timeVal)
bool getBMatrixEntriesforMOR(std::vector< int > &bMatEntriesVec, std::vector< int > &bMatPosEntriesVec)
bool registerAnalysisManager(Analysis::AnalysisManager *analysis_manager)
ModelTypeInstanceVectorMap modelTypeInstanceVector_
void getNumInterfaceNodes(std::vector< int > &numInterfaceNodes)
DeviceCountMap localDeviceCountMap_
Device & getDeviceByModelType(const EntityTypeId model_type)
ExternDevice::Instance * addExtDeviceInstance_(const InstanceBlock &IB)
bool isLinearSystem_
True if all devices in netlist have isLinearDevice() true.
type_index EntityTypeId
Definition: N_DEV_fwd.h:161
Topo::Topology & topology_
Topology.
const T & value(const ParameterBase &entity, const Descriptor &descriptor)
Returns the value of the parameter for the entity.
Definition: N_DEV_Pars.h:1224
Linear::Vector * diagonalVectorPtr_
const ArtificialParameterMap & getArtificialParameterMap() const
bool parameterExists(Parallel::Machine comm, const std::string &name) const
ModelTypeModelVectorMap modelTypeModelVector_
DeviceEntityMap parameterDeviceCache_
Full parameter name to device entity cache.
std::map< ModelTypeId, InstanceVector > ModelTypeInstanceVectorMap
InstanceVector testJacDevicePtrVec_
Devices under jacobian test.
void registerOpBuilders(Util::Op::BuilderManager &builder_manager, Parallel::Machine comm, DeviceMgr &device_manager)
const double * findGlobalParameter(const GlobalParameterMap &global_map, const std::string &name)
DeviceInstance * addDeviceInstance(const InstanceBlock &IB)
void getNoiseSources(std::vector< Xyce::Analysis::NoiseData * > &noiseDataVec)
bool dumpRestartData(char *buf, int bsize, int &pos, N_PDS_Comm *comm, bool pack) const
std::vector< DeviceInstance * > InstanceVector
bool registerPkgOptionsMgr(DeviceMgr &device_manager, IO::PkgOptionsMgr &options_manager)
bool setICs(Linear::Vector *tmpSolVectorPtr, Linear::Vector *tmpCurrSolVectorPtr, Linear::Vector *tmpLastSolVectorPtr, Linear::Vector *tmpStaVectorPtr, Linear::Vector *tmpCurrStaVectorPtr, Linear::Vector *tmpLasStaVectorPtr, Linear::Vector *tmpStaDerivVectorPtr, Linear::Vector *tmpStoVectorPtr, Linear::Vector *tmpCurrStoVectorPtr, Linear::Vector *tmpLastStoVectorPtr, Linear::Vector *tmpQVectorPtr, Linear::Vector *tmpFVectorPtr, Linear::Vector *tmpBVectorPtr, Linear::Vector *tmpdFdxdVpVectorPtr, Linear::Vector *tmpdQdxdVpVectorPtr)
bool loadCouplingRHS(int iPDEDevice, int iElectrode, Linear::Vector *dfdvPtr)
std::pair< ModelTypeId, ModelTypeId > getModelType(const InstanceBlock &instance_block)
bool parameterChanged_
Only used locally in updateDependentParameters_, don't know if stateful of just a member for fun...
bool setHBAnalysisParams(const Util::OptionBlock &option_block)
const DeviceCountMap & getDeviceCountMap()
bool loadDAEMatrices(Linear::Vector *tmpSolVectorPtr, Linear::Vector *tmpStaVectorPtr, Linear::Vector *tmpStaDerivVectorPtr, Linear::Vector *tmpStoVectorPtr, Linear::Matrix *tmpdQdxMatrixPtr, Linear::Matrix *tmpdFdxMatrixPtr)
bool calcCouplingTerms(int iSubProblem, int iElectrode, const Linear::Vector *dxdvPtr)
DeviceSensitivities * devSensPtr_
unordered_set< std::string, HashNoCase, EqualNoCase > PassthroughParameterSet
Definition: N_DEV_fwd.h:171
InstanceVector pdeInstancePtrVec_
std::vector< Device * > DeviceVector
ModelTypeNameModelTypeIdMap modelGroupMap_
Model type name to model group.
bool setNOISEAnalysisParams(const Util::OptionBlock &option_block)
void setMPDEFlag(bool flagVal)
Device * getDevice(EntityTypeId model_type_id)
bool setInitialGuess(Linear::Vector *solVectorPtr)
const IO::CmdParse & commandLine_
Command line.
Parallel::Machine comm_
Communicator (should be passed in when needed, not a member)
double timeParamsProcessed_
Time updateDependentParameters was called.
bool getACSpecified() const
The Device class is an interface for device implementations.
Definition: N_DEV_Device.h:101
EntityTypeIdDeviceMap deviceMap_
int getHomotopyBlockSize() const
bool allDevicesConverged(Parallel::Machine comm) const
bool initializeAll(Linear::System &linear_system)
void setExternalSolverState(bool external_initJctFlag)
bool setOptions(const Util::OptionBlock &option_block)
const DeviceOptions & getDeviceOptions() const
type_index ModelTypeId
Definition: N_DEV_fwd.h:162
bool getBreakPoints(std::vector< Util::BreakPoint > &breakPointTimes)
bool getHBSpecified() const
Linear::Vector * numJacStoVectorPtr_
std::map< EntityTypeId, Device * > EntityTypeIdDeviceMap
Definition: N_DEV_fwd.h:178
bool setACAnalysisParams(const Util::OptionBlock &option_block)
friend bool getParamAndReduce(Parallel::Machine comm, const DeviceMgr &device_manager, const std::string &name, double &value)
void addGlobalParameter(SolverState &solver_state, Globals &global, const Util::Param &param)
void setupNoiseSources(std::vector< Xyce::Analysis::NoiseData * > &noiseDataVec)
void setVoltageLimiterStatus(bool voltageLimterStatus)
bool registerICLoads(std::vector< std::pair< int, double > > *icLoads)
Util::Op::Operator * getOp(Parallel::Machine comm, const std::string &name) const
std::vector< std::pair< int, double > > * icLoads_
std::set< std::string > devicesNeedingLeadCurrentLoads_
EntityTypeId getModelGroup(const std::string &model_or_device_type_name)
Return the ModelGroup of the device associated with the model type name or device type name...
bool addDeviceModel(const ModelBlock &MB)
bool sensFlag_
.SENS present in netlist
bool setOPAnalysisParams(const Util::OptionBlock &option_block)
bool setDeviceOptions(const Util::OptionBlock &option_block)
void addDeviceToCount(const std::string &device_name, int num_devs=1)
unordered_map< std::string, ModelTypeId, HashNoCase, EqualNoCase > ModelTypeNameModelTypeIdMap
void addGlobalPar(const Util::Param &param)
int restartDataSize(bool pack) const
bool startTimeStep(bool beginIntegrationFlag, double nextTimeStep, double nextTime, int currentOrder)
void deRegisterFastSources(const std::vector< std::string > &sourceNames)
DeviceOptions devOptions_
user-defined options:
std::map< ModelTypeId, ModelVector > ModelTypeModelVectorMap
unordered_map< std::string, SourceInstance *, HashNoCase, EqualNoCase > IndependentSourceMap
bool loadDAEVectors(Linear::Vector *tmpNextSolVectorPtr, Linear::Vector *tmpCurrSolVectorPtr, Linear::Vector *tmpLastSolVectorPtr, Linear::Vector *tmpNextStaVectorPtr, Linear::Vector *tmpCurrStaVectorPtr, Linear::Vector *tmpLastStaVectorPtr, Linear::Vector *tmpStaDerivVectorPtr, Linear::Vector *tmpNextStoVectorPtr, Linear::Vector *tmpCurrStoVectorPtr, Linear::Vector *tmpLastStoVectorPtr, Linear::Vector *tmpStoLeadCurrQCompVectorPtr, Linear::Vector *tmpLeadFCompVectorPtr, Linear::Vector *tmpLastLeadFCompVectorPtr, Linear::Vector *tmpNextLeadFCompVectorPtr, Linear::Vector *tmpLeadQCompVectorPtr, Linear::Vector *tmpJunctionVCompVectorPtr, Linear::Vector *tmpLastJunctionVCompVectorPtr, Linear::Vector *tmpNextJunctionCompVectorPtr, Linear::Vector *tmpQVectorPtr, Linear::Vector *tmpFVectorPtr, Linear::Vector *tmpBVectorPtr, Linear::Vector *tmpdFdxdVpVectorPtr, Linear::Vector *tmpdQdxdVpVectorPtr)
bool registerNonlinearSolver(Nonlinear::Manager *tmp_nlsMgrPtr)
const double * findGlobalPar(const std::string &name) const
void setBlockAnalysisFlag(bool flagVal)
Nonlinear::Manager * nlsMgrPtr_
To get Nonlinear solver information. This needs to be removed.
SolverState solState_
real time solver data:
std::vector< DeviceModel * > ModelVector
const PassthroughParameterSet & getPassthroughParameterSet() const
unordered_map< std::string, double, HashNoCase, EqualNoCase > GlobalParameterMap
Definition: N_DEV_fwd.h:169
ArtificialParameterMap artificialParameterMap_
Specially named parameters. This needs to be removed.
InstanceVector plotFileInstancePtrVec_
std::map< std::string, int, LessNoCase > DeviceCountMap
Definition: N_DEV_fwd.h:174
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)
IndependentSourceVector indepSourceInstanceBackupPtrVec_
bool getInnerLoopErrorSums(std::vector< TimeIntg::TwoLevelError > &tleVec) const
void setVoltageLimiterFlag(bool flagVal)
void addArtificialParameter(const std::string &name, ArtificialParameters::ArtificialParameter *artificial_parameter)
bool registerSensParams(const Util::OptionBlock &option_block)
bool getParamAndReduce(Parallel::Machine comm, const DeviceMgr &device_manager, const std::string &name, double &val)
bool analyticSensitivitiesAvailable(const std::string &name)
InstanceVector bpInstancePtrVec_
instances with breakpoints functions
bool isPDESystem_
true if circuit includes a PDE device
bool loadBVectorsforAC(Linear::Vector *bVecRealPtr, Linear::Vector *bVecImagPtr)
bool updateTemperature(double val)
void notify(const Analysis::StepEvent &event)
std::vector< int > numInterfaceNodes_
IndependentSourceVector independentSourceVector_
bool restoreRestartData(char *buf, int bsize, int &pos, N_PDS_Comm *comm, bool pack)
std::vector< DeviceEntity * > EntityVector
Globals & globals_
global variables
bool verifyDeviceInstance(const InstanceBlock &IB)
PassthroughParameterSet passthroughParameterSet_
Parameters to pass through to external devices when set.
bool deleteDeviceInstance(const std::string &name)
Util::Op::BuilderManager & opBuilderManager_
unordered_map< std::string, ArtificialParameters::ArtificialParameter *, HashNoCase, EqualNoCase > ArtificialParameterMap
Definition: N_DEV_fwd.h:170
InstanceVector nonPdeInstancePtrVec_
ModelBlock represents a .MODEL line from the netlist.
MatrixLoadData matrixLoadData_
temporary jacobian load structures:
unordered_map< std::string, Util::Op::Operator * > OpMap
void addDevicesToCount(const DeviceCountMap &device_map)
InstanceBlock represent a device instance line from the netlist.
std::vector< double > registerFastSources(Parallel::Machine comm, const std::vector< std::string > &sourceNames)
ModelTypeInstanceVectorMap modelGroupInstanceVector_
bool firstDependent_
True until updateDependentParameters_ is called.
std::vector< SourceInstance * > IndependentSourceVector
bool getInitialQnorm(std::vector< TimeIntg::TwoLevelError > &tleVec)
DeviceMgr & operator=(const DeviceMgr &)
No assignment.
bool outputPlotFiles(bool force_final_output)