46 #ifndef Xyce_N_DEV_DeviceMgr_h
47 #define Xyce_N_DEV_DeviceMgr_h
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;
56 #error neither unordered_map or tr1/unordered_map found
66 #include <N_LAS_fwd.h>
68 #include <N_PDS_fwd.h>
70 #include <N_TOP_fwd.h>
71 #include <N_UTL_fwd.h>
79 #include <N_UTL_Listener.h>
87 Parallel::Machine comm,
88 const DeviceMgr & device_manager,
89 const std::string & name,
99 class DeviceMgr :
public Util::Listener<Analysis::StepEvent>
111 typedef unordered_map<std::string, DeviceEntity *, HashNoCase, EqualNoCase>
DeviceEntityMap;
117 typedef unordered_map<std::string, Util::Op::Operator *>
OpMap;
119 DeviceMgr(Parallel::Machine comm, Topo::Topology &topology, Util::Op::BuilderManager &op_builder_manager,
const IO::CmdParse &command_line);
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);
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);
206 bool setParam(
const std::string & name,
double val,
bool overrideOriginal =
false);
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);
262 bool getBreakPoints(std::vector<Util::BreakPoint> & breakPointTimes);
269 bool loadCouplingRHS (
int iPDEDevice,
int iElectrode, Linear::Vector * dfdvPtr);
270 bool calcCouplingTerms (
int iSubProblem,
int iElectrode,
const Linear::Vector * dxdvPtr);
276 Linear::Vector * tmpStaVectorPtr,
277 Linear::Vector * tmpStaDerivVectorPtr,
278 Linear::Vector * tmpStoVectorPtr,
279 Linear::Matrix * tmpdQdxMatrixPtr,
280 Linear::Matrix * tmpdFdxMatrixPtr);
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);
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);
318 Linear::Vector * bVecImagPtr);
325 void getNoiseSources(std::vector<Xyce::Analysis::NoiseData*> & noiseDataVec);
392 bool beginIntegrationFlag,
401 bool dumpRestartData(
char * buf,
int bsize,
int & pos, N_PDS_Comm * comm,
bool pack )
const;
404 bool restoreRestartData(
char * buf,
int bsize,
int & pos, N_PDS_Comm * comm,
bool pack );
411 EntityTypeIdDeviceMap::iterator it =
deviceMap_.find(model_type_id);
412 return it ==
deviceMap_.end() ? 0 : (*it).second;
430 Util::Op::Operator *
getOp(Parallel::Machine comm,
const std::string &name)
const;
432 bool parameterExists(Parallel::Machine comm,
const std::string & name)
const;
586 Parallel::Machine comm,
588 const std::string & name);
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 ¶llel_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)
bool updateDependentParameters_()
Linear::Vector * numJacStaVectorPtr_
bool resetRHSLoadFlags(int index)
void deactivateSlowSources()
DeviceEntity * getDeviceEntity(const std::string &full_param_name) const
bool calcPDESubProblemInfo()
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)
void unsetVoltageLimiterFlag()
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
bool setupRawMatrixPointers_()
DeviceMgr(Parallel::Machine comm, Topo::Topology &topology, Util::Op::BuilderManager &op_builder_manager, const IO::CmdParse &command_line)
bool getVoltageLimiterFlag()
void setFastTime(double timeVal)
bool getBMatrixEntriesforMOR(std::vector< int > &bMatEntriesVec, std::vector< int > &bMatPosEntriesVec)
bool registerAnalysisManager(Analysis::AnalysisManager *analysis_manager)
ModelTypeInstanceVectorMap modelTypeInstanceVector_
bool disablePDEContinuation()
void activateSlowSources()
void getNumInterfaceNodes(std::vector< int > &numInterfaceNodes)
DeviceCountMap localDeviceCountMap_
Device & getDeviceByModelType(const EntityTypeId model_type)
bool breakPointInstancesInitialized
ExternDevice::Instance * addExtDeviceInstance_(const InstanceBlock &IB)
bool isLinearSystem_
True if all devices in netlist have isLinearDevice() true.
Topo::Topology & topology_
Topology.
const T & value(const ParameterBase &entity, const Descriptor &descriptor)
Returns the value of the parameter for the entity.
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
bool dotOpOutputRequested_
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
InstanceVector pdeInstancePtrVec_
std::vector< Device * > DeviceVector
ModelTypeNameModelTypeIdMap modelGroupMap_
Model type name to model group.
bool setNOISEAnalysisParams(const Util::OptionBlock &option_block)
bool updateIntermediateVars_()
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.
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)
EntityVector dependentPtrVec_
const DeviceOptions & getDeviceOptions() const
bool getBreakPoints(std::vector< Util::BreakPoint > &breakPointTimes)
bool getHBSpecified() const
Linear::Vector * numJacStoVectorPtr_
std::map< EntityTypeId, Device * > EntityTypeIdDeviceMap
bool setACAnalysisParams(const Util::OptionBlock &option_block)
bool updatePrimaryState_()
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 ¶m)
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)
double getMaxTimeStepSize()
bool getVoltageLimiterStatus()
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 ¶m)
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
bool setupRawVectorPointers_()
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
ArtificialParameterMap artificialParameterMap_
Specially named parameters. This needs to be removed.
InstanceVector plotFileInstancePtrVec_
std::map< std::string, int, LessNoCase > DeviceCountMap
void updateExternalDevices_()
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)
DeviceVector devicePtrVec_
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
DeviceVector pdeDevicePtrVec_
InstanceVector nonPdeInstancePtrVec_
ModelBlock represents a .MODEL line from the netlist.
MatrixLoadData matrixLoadData_
temporary jacobian load structures:
unordered_map< std::string, Util::Op::Operator * > OpMap
int enablePDEContinuation()
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.
bool externalInitJctFlag_
std::vector< SourceInstance * > IndependentSourceVector
bool getInitialQnorm(std::vector< TimeIntg::TwoLevelError > &tleVec)
DeviceMgr & operator=(const DeviceMgr &)
No assignment.
bool updateSecondaryState_()
bool outputPlotFiles(bool force_final_output)