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>
78 #include <N_UTL_Listener.h>
91 class DeviceMgr :
public Util::Listener<Analysis::StepEvent>
102 typedef unordered_map<std::string, DeviceEntity *, HashNoCase, EqualNoCase>
DeviceEntityMap;
105 typedef unordered_map<std::string, ArtificialParameters::ArtificialParameter *, HashNoCase, EqualNoCase>
ArtificialParameterMap;
110 DeviceMgr(Parallel::Machine comm, Topo::Topology &topology,
const IO::CmdParse &command_line);
146 std::vector<double>
getFastSourcePeriod(Parallel::Machine comm,
const std::vector<std::string> &sourceNames);
147 std::vector<double>
registerFastSources(Parallel::Machine comm,
const std::vector<std::string> &sourceNames);
188 std::vector<double> & dfdpVec,
189 std::vector<double> & dqdpVec,
190 std::vector<double> & dbdpVec,
191 std::vector<int> & FindicesVec,
192 std::vector<int> & QindicesVec,
193 std::vector<int> & BindicesVec);
196 bool setParam(std::string & name,
double val,
bool overrideOriginal=
false);
201 bool findParam(
const std::string & name)
const;
230 bool setICs (Linear::Vector * tmpSolVectorPtr,
231 Linear::Vector * tmpCurrSolVectorPtr,
232 Linear::Vector * tmpLastSolVectorPtr,
233 Linear::Vector * tmpStaVectorPtr,
234 Linear::Vector * tmpCurrStaVectorPtr,
235 Linear::Vector * tmpLasStaVectorPtr,
236 Linear::Vector * tmpStaDerivVectorPtr,
237 Linear::Vector * tmpStoVectorPtr,
238 Linear::Vector * tmpCurrStoVectorPtr,
239 Linear::Vector * tmpLastStoVectorPtr,
240 Linear::Vector * tmpQVectorPtr,
241 Linear::Vector * tmpFVectorPtr,
242 Linear::Vector * tmpBVectorPtr,
243 Linear::Vector * tmpdFdxdVpVectorPtr,
244 Linear::Vector * tmpdQdxdVpVectorPtr);
247 bool getBreakPoints(std::vector<Util::BreakPoint> & breakPointTimes);
254 bool loadCouplingRHS (
int iPDEDevice,
int iElectrode, Linear::Vector * dfdvPtr);
255 bool calcCouplingTerms (
int iSubProblem,
int iElectrode,
const Linear::Vector * dxdvPtr);
261 Linear::Vector * tmpStaVectorPtr,
262 Linear::Vector * tmpStaDerivVectorPtr,
263 Linear::Vector * tmpStoVectorPtr,
264 Linear::Matrix * tmpdQdxMatrixPtr,
265 Linear::Matrix * tmpdFdxMatrixPtr);
268 Linear::Vector * tmpCurrSolVectorPtr,
269 Linear::Vector * tmpLastSolVectorPtr,
270 Linear::Vector * tmpNextStaVectorPtr,
271 Linear::Vector * tmpCurrStaVectorPtr,
272 Linear::Vector * tmpLastStaVectorPtr,
273 Linear::Vector * tmpStaDerivVectorPtr,
274 Linear::Vector * tmpNextStoVectorPtr,
275 Linear::Vector * tmpCurrStoVectorPtr,
276 Linear::Vector * tmpLastStoVectorPtr,
277 Linear::Vector * tmpStoLeadCurrQCompVectorPtr,
278 Linear::Vector * tmpLeadFCompVectorPtr,
279 Linear::Vector * tmpLastLeadFCompVectorPtr,
280 Linear::Vector * tmpNextLeadFCompVectorPtr,
281 Linear::Vector * tmpLeadQCompVectorPtr,
282 Linear::Vector * tmpJunctionVCompVectorPtr,
283 Linear::Vector * tmpLastJunctionVCompVectorPtr,
284 Linear::Vector * tmpNextJunctionCompVectorPtr,
285 Linear::Vector * tmpQVectorPtr,
286 Linear::Vector * tmpFVectorPtr,
287 Linear::Vector * tmpBVectorPtr,
288 Linear::Vector * tmpdFdxdVpVectorPtr,
289 Linear::Vector * tmpdQdxdVpVectorPtr);
292 Linear::Vector * nextSolVectorPtr,
293 Linear::Vector * currSolVectorPtr,
294 Linear::Vector * lastSolVectorPtr,
295 Linear::Vector * nextStaVectorPtr,
296 Linear::Vector * currStaVectorPtr,
297 Linear::Vector * lastStaVectorPtr,
298 Linear::Vector * nextStoVectorPtr,
299 Linear::Vector * currStoVectorPtr,
300 Linear::Vector * lastStoVectorPtr);
303 Linear::Vector * bVecImagPtr);
310 void getNoiseSources(std::vector<Xyce::Analysis::NoiseData*> & noiseDataVec);
318 const double *
findGlobalPar(
const std::string & parName)
const;
319 double getGlobalPar(
const std::string & parName )
const;
372 bool dumpRestartData(
char * buf,
int bsize,
int & pos, N_PDS_Comm * comm,
bool pack )
const;
375 bool restoreRestartData(
char * buf,
int bsize,
int & pos, N_PDS_Comm * comm,
bool pack );
382 EntityTypeIdDeviceMap::iterator it =
deviceMap_.find(model_type_id);
383 return it ==
deviceMap_.end() ? 0 : (*it).second;
539 Parallel::Machine comm,
542 bool external_state_flag,
551 #endif // Xyce_N_DEV_DeviceMgr_h
Linear::Vector * numJacSolVectorPtr_
void setExternalSolverState(const SolverState &ss)
const double * findGlobalPar(const std::string &parName) const
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_
DeviceMgr(Parallel::Machine comm, Topo::Topology &topology, const IO::CmdParse &command_line)
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)
double getParamNoReduce(const std::string &name) const
void unsetVoltageLimiterFlag()
InstanceVector instancePtrVec_
Pure virtual class to augment a linear system.
ModelTypeModelVectorMap modelGroupModelVector_
unordered_map< std::string, DeviceEntity *, HashNoCase, EqualNoCase > DeviceEntityMap
bool getInnerLoopErrorSums(std::vector< TimeIntg::TwoLevelError > &tleVec)
bool setupRawMatrixPointers_()
bool registerOptions(const Util::OptionBlock &option_block)
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 findParam(const std::string &name) const
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_
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)
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 setParam(std::string &name, double val, bool overrideOriginal=false)
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 getParam(const std::string &name, double &value) const
bool calcCouplingTerms(int iSubProblem, int iElectrode, const Linear::Vector *dxdvPtr)
void addGlobalPar(const Util::Param &)
DeviceSensitivities * devSensPtr_
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)
IO::Measure::Manager * measureManager_
To search for non-device parameters. This needs to be removed.
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.
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)
const InstanceVector & getExternDevices() const
EntityVector dependentPtrVec_
const DeviceOptions & getDeviceOptions() const
bool getBreakPoints(std::vector< Util::BreakPoint > &breakPointTimes)
Linear::Vector * numJacStoVectorPtr_
std::map< EntityTypeId, Device * > EntityTypeIdDeviceMap
bool setACAnalysisParams(const Util::OptionBlock &option_block)
bool updatePrimaryState_()
void setupNoiseSources(std::vector< Xyce::Analysis::NoiseData * > &noiseDataVec)
bool registerICLoads(std::vector< std::pair< int, double > > *icLoads)
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()
void addDeviceToCount(const std::string &device_name, int num_devs=1)
unordered_map< std::string, ModelTypeId, HashNoCase, EqualNoCase > ModelTypeNameModelTypeIdMap
double getGlobalPar(const std::string &parName) const
int restartDataSize(bool pack) const
void deRegisterFastSources(const std::vector< std::string > &sourceNames)
unordered_map< std::string, ArtificialParameters::ArtificialParameter *, HashNoCase, EqualNoCase > ArtificialParameterMap
std::map< std::string, int, LessNoCase > passThroughParamsMap_
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)
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
ArtificialParameterMap artificialParameterMap_
Specially named parameters. This needs to be removed.
InstanceVector plotFileInstancePtrVec_
SolverState solStateExternal_
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)
bool registerOptions(const Util::OptionBlock &OB)
IndependentSourceVector indepSourceInstanceBackupPtrVec_
bool registerPkgOptionsMgr(DeviceMgr &device_manager, const std::string &netlist_filename, IO::PkgOptionsMgr &options_manager)
void setVoltageLimiterFlag(bool flagVal)
void addArtificialParameter(const std::string &name, ArtificialParameters::ArtificialParameter *artificial_parameter)
bool registerSensParams(const Util::OptionBlock &option_block)
bool analyticSensitivitiesAvailable(const std::string &name)
InstanceVector bpInstancePtrVec_
instances with breakpoints functions
bool loadBVectorsforAC(Linear::Vector *bVecRealPtr, Linear::Vector *bVecImagPtr)
bool updateTemperature(double val)
void notify(const Analysis::StepEvent &event)
DeviceVector devicePtrVec_
bool setupSolverInfo(Parallel::Machine comm, SolverState &solver_state, const SolverState &external_solver_state, bool external_state_flag, const Analysis::AnalysisManager &analysis_manager, const DeviceMgr &device_manager, const DeviceOptions &device_options, const Nonlinear::NonLinInfo &twoLevelNonlinearInfo)
std::vector< int > numInterfaceNodes_
IndependentSourceVector independentSourceVector_
bool registerMeasureMgr(IO::Measure::Manager *measure_manager)
bool restoreRestartData(char *buf, int bsize, int &pos, N_PDS_Comm *comm, bool pack)
std::vector< DeviceEntity * > EntityVector
Globals & globals_
global variables
bool linearSystemFlag_
True if all devices in netlist have isLinearDevice() true.
bool verifyDeviceInstance(const InstanceBlock &IB)
bool getLinearSystemFlag()
bool deleteDeviceInstance(const std::string &name)
DeviceVector pdeDevicePtrVec_
InstanceVector nonPdeInstancePtrVec_
ModelBlock represents a .MODEL line from the netlist.
MatrixLoadData matrixLoadData_
temporary jacobian load structures:
int enablePDEContinuation()
void addDevicesToCount(const DeviceCountMap &device_map)
InstanceBlock represent a device instance line from the netlist.
double getParamAndReduce(const std::string &name) const
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 updateSecondaryState_()