46 #include <Xyce_config.h>
57 #include <N_DEV_ExternDevice.h>
63 #include <N_ERH_ErrorMgr.h>
64 #include <N_ERH_Message.h>
65 #include <N_IO_CmdParse.h>
66 #include <N_IO_MeasureManager.h>
68 #include <N_IO_PkgOptionsMgr.h>
69 #include <N_LAS_Builder.h>
70 #include <N_LAS_Matrix.h>
71 #include <N_LAS_System.h>
73 #include <N_PDS_Comm.h>
74 #include <N_PDS_MPI.h>
75 #include <N_PDS_Manager.h>
76 #include <N_TOP_Topology.h>
77 #include <N_UTL_Algorithm.h>
78 #include <N_UTL_BreakPoint.h>
79 #include <N_UTL_FeatureTest.h>
99 struct OptionsReg :
public IO::PkgOptionsReg
101 OptionsReg(DeviceMgr & device_manager) :
deviceManager_(device_manager)
104 bool operator()(
const Util::OptionBlock & options)
112 struct SensOptionsReg :
public IO::PkgOptionsReg
114 SensOptionsReg(DeviceMgr & device_manager) :
deviceManager_(device_manager)
117 bool operator()(
const Util::OptionBlock & options)
124 struct OPAnalysisReg :
public IO::PkgOptionsReg
126 OPAnalysisReg(DeviceMgr & device_manager) :
deviceManager_(device_manager)
129 bool operator()(
const Util::OptionBlock & options)
136 struct HB_AnalysisReg :
public IO::PkgOptionsReg
138 HB_AnalysisReg(DeviceMgr & device_manager) :
deviceManager_(device_manager)
141 bool operator()(
const Util::OptionBlock & options)
148 struct AC_AnalysisReg :
public IO::PkgOptionsReg
150 AC_AnalysisReg(DeviceMgr &
deviceManager_) : deviceManager_(deviceManager_)
153 bool operator()(
const Util::OptionBlock & options)
160 struct NOISE_AnalysisReg :
public IO::PkgOptionsReg
162 NOISE_AnalysisReg(DeviceMgr &
deviceManager_) : deviceManager_(deviceManager_)
165 bool operator()(
const Util::OptionBlock & options)
182 const std::string setupIOName(
const InstanceName &entity_name)
184 return entity_name.getDeviceName();
192 DeviceEntity *findDeviceEntity(
193 EntityTypeIdDeviceMap::const_iterator begin,
194 EntityTypeIdDeviceMap::const_iterator end,
195 const std::string entity_name)
197 for (EntityTypeIdDeviceMap::const_iterator it = begin; it != end; ++it)
199 DeviceEntity *device_entity = (*it).second->findInstance(InstanceName(entity_name));
201 return device_entity;
203 device_entity = (*it).second->findModel(
ModelName(entity_name));
205 return device_entity;
223 options_manager.submitRegistration(
224 "DEVICE", netlist_filename,
new OptionsReg(device_manager));
226 options_manager.submitRegistration(
227 "SENS", netlist_filename,
new SensOptionsReg(device_manager));
229 options_manager.submitRegistration(
230 "OP", netlist_filename,
new OPAnalysisReg(device_manager));
233 options_manager.submitRegistration(
234 "HB", netlist_filename,
new HB_AnalysisReg(device_manager));
237 options_manager.submitRegistration(
238 "AC", netlist_filename,
new AC_AnalysisReg(device_manager));
241 options_manager.submitRegistration(
242 "NOISE", netlist_filename,
new NOISE_AnalysisReg(device_manager));
257 Parallel::Machine comm,
258 Topo::Topology & topology,
259 const IO::CmdParse & command_line)
260 : commandLine_(command_line),
265 linearSystemFlag_(true),
266 firstDependent_(true),
267 parameterChanged_(false),
268 breakPointInstancesInitialized(false),
269 timeParamsProcessed_(0.0),
273 globals_(solState_.globals_),
275 externalStateFlag_(false),
276 numJacStaVectorPtr_(0),
277 numJacSolVectorPtr_(0),
278 numJacStoVectorPtr_(0),
279 diagonalVectorPtr_(0),
287 modelGroupInstanceVector_(),
288 modelTypeInstanceVector_(),
290 modelGroupModelVector_(),
291 modelTypeModelVector_(),
292 localDeviceCountMap_(),
297 pdeInstancePtrVec_(),
298 nonPdeInstancePtrVec_(),
299 plotFileInstancePtrVec_(),
300 independentSourceVector_(),
301 independentSourceMap_(),
302 indepSourceInstanceBackupPtrVec_(),
303 testJacDevicePtrVec_(),
305 devicesNeedingLeadCurrentLoads_(),
306 passThroughParamsMap_(),
307 parameterDeviceCache_(),
308 numInterfaceNodes_(),
309 calledBeforeCSPI (false),
311 dotOpOutputFlag(false),
312 artificialParameterMap_()
387 for (EntityTypeIdDeviceMap::iterator it =
deviceMap_.begin(), end =
deviceMap_.end(); it != end; ++it)
409 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
411 dout() <<
"DeviceMgr::registerSensParams called!" <<std::endl;
436 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
440 dout() <<
"DeviceMgr::registerLeadCurrentRequests Devices for which lead currents were requested: ";
443 dout() << (*it) <<
" ";
513 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
515 return (*model_type_it).second;
517 return s_emptyVector;
530 Parallel::Machine comm,
531 const std::vector<std::string> & sourceNames)
533 int numFastSrcs = sourceNames.size();
536 std::vector<double> srcPeriods(numFastSrcs);
539 for (
int i = 0; i < numFastSrcs; ++i)
545 srcPeriods[i] = source_instance.
period();
549 #ifndef Xyce_PARALLEL_MPI
550 Report::UserError message;
551 message <<
"Unable to find source: " << sourceNames[i] <<
"\n"
552 <<
"Potential names are: ";
554 message << (*it).first <<
" ";
559 Parallel::AllReduce(comm, MPI_MAX, srcPeriods);
575 Parallel::Machine comm,
576 const std::vector<std::string> & sourceNames)
578 int numFastSrcs = sourceNames.size();
580 std::vector<double> srcPeriods;
584 srcPeriods.resize(numFastSrcs, 0.0);
587 for (
int i = 0; i < numFastSrcs; ++i)
594 srcPeriods[i] = source_instance.
period();
598 #ifndef Xyce_PARALLEL_MPI
599 Report::UserError message;
600 message <<
"Unable to find source: " << sourceNames[i] <<
"\n"
601 <<
"Potential names are: ";
603 message << (*it).first <<
" ";
617 Parallel::AllReduce(comm, MPI_SUM, &myNumFastSrcs, &numFastSrcs, 1);
620 throw std::runtime_error(
"registerFastSources() does not handle parallel");
622 srcPeriods.resize(numFastSrcs, -1.0);
623 for (
int i = 0; i < myNumFastSrcs; ++i)
630 Parallel::AllReduce(comm, MPI_MAX, srcPeriods);
646 int numFastSrcs = sourceNames.size();
651 for (
int i = 0; i < numFastSrcs; ++i)
661 #ifndef Xyce_PARALLEL_MPI
662 Report::DevelFatal message;
663 message.in(
"DeviceMgr::deRegisterFastSources");
664 message <<
"Unable to find source: " << sourceNames[i] << std::endl
665 <<
"Potential names are: ";
667 message << (*it).first <<
" ";
676 for (
int i = 0; i < numFastSrcs; ++i)
706 if ((*it)->getFastSourceFlag())
786 bool bsuccess =
true;
889 int size =
sizeof(*this);
890 dout() <<
"Size of device package after initializeAll = " << size << std::endl;
941 if (model_type_id.defined())
943 EntityTypeIdDeviceMap::const_iterator it =
deviceMap_.find(model_type_id);
953 if (device->isPDEDevice())
959 device = (*it).second;
1005 if (!model_block.
getName().empty())
1009 if (!model_type.defined())
1010 Report::UserError() <<
"There is no device " << model_block.
getType() <<
" of level " << model_block.
getLevel() <<
" to define model " << model_block.
getName();
1013 if (!model_type.defined())
1014 model_type = model_group;
1016 if (!model_type.defined())
1021 DeviceModel *device_model = device.addModel(model_block, factory_block);
1027 if (device_model != 0)
1034 return device_model != 0;
1054 model_group = model_type;
1062 if (!model_type.defined())
1064 Report::UserError message;
1065 message <<
"Unable to determine type of device for instance name " << instance_block.
getInstanceName();
1068 message <<
" with model name " << instance_block.
getModelName();
1086 std::vector<Param>::const_iterator currentParam = instance_block.
params.begin();
1087 std::vector<Param>::const_iterator endParam = instance_block.
params.end();
1088 while(currentParam != endParam)
1090 if ((currentParam->uTag() ==
"R"))
1092 if (currentParam->given())
1094 std::vector<std::string> variables, specials;
1098 const Param * devPar = &(*(currentParam));
1099 const Util::Param * tmpPar = (
dynamic_cast<const Util::Param*
> (devPar));
1101 if (tmpPar->getType() == Util::EXPR)
1103 Util::Expression tmpExp = tmpPar->getValue<Util::Expression>();
1104 tmpExp.get_names(XEXP_VARIABLE, variables);
1105 tmpExp.get_names(XEXP_SPECIAL, specials);
1108 if (specials.empty() && variables.empty())
1123 return std::pair<ModelTypeId, ModelTypeId>(model_type, model_group);
1151 std::pair<ModelTypeId, ModelTypeId> x =
getModelType(instance_block);
1152 model_type = x.first;
1153 model_group = x.second;
1155 if (!model_type.defined())
1157 Report::UserError message;
1158 message <<
"Unable to determine model type of device for instance name " << instance_block.
getInstanceName();
1161 message <<
" with model name" << instance_block.
getModelName();
1197 std::pair<ModelTypeId, ModelTypeId> x =
getModelType(instance_block);
1198 model_type = x.first;
1199 model_group = x.second;
1201 if (!model_type.defined())
1203 Report::UserError message;
1204 message <<
"Unable to determine type of device for instance name " << instance_block.
getInstanceName();
1207 message <<
" with model name " << instance_block.
getModelName();
1226 std::string outputName = (instance->
getName()).getEncodedName();
1232 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
1234 dout() <<
"DeviceMgr::addDeviceInstance Enabling lead current load for device \""
1238 <<
"\"" << std::endl;
1241 else if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
1243 dout() <<
"DeviceMgr::addDeviceInstance Cannot enable lead current load for device \""
1262 if (device.isPDEDevice())
1305 Report::DevelFatal().in(
"DeviceMgr::deleteDeviceInstance")
1306 <<
"Not ready with the new boilerplate-free device package";
1308 bool bsuccess =
true;
1364 char fn_fv[256];
for (
int ich = 0; ich < 256; ++ich) fn_fv[ich] = 0;
1365 sprintf(fn_fv,
"fvector.%03d.txt", outIter);
1373 char fn_jdxp[256];
for (
int ich = 0; ich < 256; ++ich) fn_jdxp[ich] = 0;
1374 sprintf(fn_jdxp,
"Jdxp.%03d.txt", outIter);
1380 char fn_dxvl[256];
for (
int ich = 0; ich < 256; ++ich) fn_dxvl[ich] = 0;
1381 sprintf(fn_dxvl,
"dxVL.%03d.txt", outIter);
1385 char fn_jdx2[256];
for (
int ich = 0; ich < 256; ++ich) fn_jdx2[ich] = 0;
1386 sprintf(fn_jdx2,
"Jdx2.%03d.txt", outIter);
1408 int outputStepNumber = 0;
1412 outputStepNumber = 0;
1426 char fn_dxvl[256];
for (
int ich = 0; ich < 256; ++ich) fn_dxvl[ich] = 0;
1427 sprintf(fn_dxvl,
"dxVL.%03d.%03d.txt", outputStepNumber, newtonIter);
1431 char fn_fdx2[256];
for (
int ich = 0; ich < 256; ++ich) fn_fdx2[ich] = 0;
1432 sprintf(fn_fdx2,
"Fdx2.%03d.%03d.txt", outputStepNumber, newtonIter);
1436 char fn_qdx2[256];
for (
int ich = 0; ich < 256; ++ich) fn_qdx2[ich] = 0;
1437 sprintf(fn_qdx2,
"Qdx2.%03d.%03d.txt", outputStepNumber, newtonIter);
1456 bool bsuccess =
true;
1458 if (solVectorPtr != 0)
1463 InstanceVector::iterator iter;
1464 InstanceVector::iterator begin;
1465 InstanceVector::iterator end;
1468 for (iter=begin; iter!=end;++iter)
1470 bool tmpBool = (*iter)->setInitialGuess ();
1471 bsuccess = bsuccess && tmpBool;
1495 std::string paramName = Util::paramNameFromFullParamName(name);
1499 Parallel::AllReduce(
comm_, MPI_LOR, &available, 1);
1501 return static_cast<bool>(available);
1513 (std::string & name,
1514 std::vector<double> & dfdpVec,
1515 std::vector<double> & dqdpVec,
1516 std::vector<double> & dbdpVec,
1517 std::vector<int> & FindicesVec,
1518 std::vector<int> & QindicesVec,
1519 std::vector<int> & BindicesVec)
1526 std::string paramName = Util::paramNameFromFullParamName(name);
1528 dfdpVec, dqdpVec, dbdpVec,
1529 FindicesVec, QindicesVec, BindicesVec);
1554 bool bsuccess =
true, success =
true;
1556 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
1558 std::string netListFile(
"");
1559 if (
commandLine_.getArgumentValue(std::string(
"netlist")) !=
"")
1561 netListFile =
commandLine_.getArgumentValue(std::string(
"netlist"));
1564 dout() << netListFile <<
"\t\t";
1565 dout() <<
"DeviceMgr::setParam. ";
1567 dout() <<
" " << val;
1568 dout() << std::endl;
1574 (*artificial_param_it).second->setValue(*
this, val);
1581 if ((*global_param_it).second != val)
1583 (*global_param_it).second = val;
1588 (*it)->processParams();
1589 (*it)->processInstanceParams();
1598 Xyce::dout() <<
" in DeviceMgr setParam, with name " << name << std::endl;
1603 int entityFound = (device_entity != 0);
1607 std::string paramName = Util::paramNameFromFullParamName(name);
1608 if (paramName ==
"")
1612 Xyce::dout() <<
" in DeviceMgr setParam, setting default parameter to " << val ;
1613 if (overrideOriginal)
1614 Xyce::dout() <<
" overriding original";
1615 Xyce::dout() << std::endl;
1623 Xyce::dout() <<
" in DeviceMgr setParam, setting parameter "<< paramName <<
" to " << val << std::endl;
1625 found = device_entity->
setParam(paramName, val);
1635 entityFound = found;
1638 Parallel::AllReduce(
comm_, MPI_LOR, &entityFound, 1);
1640 if (entityFound == 0)
1644 Report::DevelWarning() <<
"DeviceMgr::setParam. Unable to find parameter " << name;
1648 Report::UserError() <<
"Unable to find parameter " << name;
1659 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
1662 for (InstanceVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
1664 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
1666 bool bs1 = extern_device.setInternalParam(name, val);
1690 const std::string & name,
1691 double &
value)
const
1694 bool entityFound =
false;
1699 value = (*artificial_param_it).second->getValue(*
this);
1707 value = (*global_param_it).second;
1713 entityFound = device_entity != 0;
1717 std::string paramName = Util::paramNameFromFullParamName(name);
1718 entityFound = device_entity->
getParam(paramName, value);
1719 if (paramName ==
"")
1771 bool found =
getParam(name, value);
1772 int found_count = found ? 1 : 0;
1773 Parallel::AllReduce(
comm_, MPI_SUM, &found_count, 1);
1777 Parallel::AllReduce(
comm_, MPI_SUM, &value, 1);
1778 value /= found_count;
1781 return found_count != 0;
1801 Report::DevelWarning() <<
1802 "DeviceMgr::getParamAndReduce. Unable to find parameter " << name;
1806 Report::UserError() <<
"Unable to find parameter " << name;
1823 Linear::Vector * nextSolVectorPtr,
1824 Linear::Vector * currSolVectorPtr,
1825 Linear::Vector * lastSolVectorPtr,
1826 Linear::Vector * nextStaVectorPtr,
1827 Linear::Vector * currStaVectorPtr,
1828 Linear::Vector * lastStaVectorPtr,
1829 Linear::Vector * nextStoVectorPtr,
1830 Linear::Vector * currStoVectorPtr,
1831 Linear::Vector * lastStoVectorPtr)
1833 bool bsuccess =
true;
1834 bool tmpBool =
true;
1837 bsuccess = bsuccess && tmpBool;
1850 #ifdef Xyce_PARALLEL_MPI
1874 bsuccess = bsuccess && tmpBool;
1887 #ifdef Xyce_PARALLEL_MPI
1892 Report::safeBarrier(
comm_);
1940 (Linear::Vector * tmpSolVectorPtr,
1941 Linear::Vector * tmpStateVectorPtr,
1942 Linear::Vector * tmpStateDerivVectorPtr,
1943 Linear::Vector * tmpStoreVectorPtr,
1944 Linear::Matrix * tmpdQdxMatrixPtr,
1945 Linear::Matrix * tmpdFdxMatrixPtr)
1947 bool bsuccess =
true;
1948 bool tmpBool =
true;
1951 (externData_.nextSolVectorPtr) = tmpSolVectorPtr;
1952 bool resetRawMatrixPointers =
true;
1954 (externData_.dQdxMatrixPtr == tmpdQdxMatrixPtr) &&
1955 (externData_.dFdxMatrixPtr == tmpdFdxMatrixPtr)
1958 resetRawMatrixPointers =
false;
1960 if (resetRawMatrixPointers)
1962 externData_.dQdxMatrixPtr = tmpdQdxMatrixPtr;
1963 externData_.dFdxMatrixPtr = tmpdFdxMatrixPtr;
1966 externData_.nextStaVectorPtr = tmpStateVectorPtr;
1967 externData_.nextStaDerivVectorPtr = tmpStateDerivVectorPtr;
1968 externData_.nextStoVectorPtr = tmpStoreVectorPtr;
1971 externData_.nextSolVectorRawPtr = &((*externData_.nextSolVectorPtr)[0]);
1972 externData_.nextStaVectorRawPtr = &((*externData_.nextStaVectorPtr)[0]);
1973 externData_.nextStaDerivVectorRawPtr = &((*externData_.nextStaDerivVectorPtr)[0]);
1974 externData_.nextStoVectorRawPtr = &((*externData_.nextStoVectorPtr)[0]);
1977 if (resetRawMatrixPointers || solState_.blockAnalysisFlag)
1979 setupRawMatrixPointers_();
1991 for (InstanceVector::iterator iter = nonPdeInstancePtrVec_.begin(), end = nonPdeInstancePtrVec_.end(); iter!=end; ++iter)
1993 (*iter)->loadTrivialDAE_FMatrixStamp ();
1996 for (InstanceVector::iterator iter = pdeInstancePtrVec_.begin(), end = pdeInstancePtrVec_.end(); iter!=end; ++iter)
1998 tmpBool = (*iter)->loadDAEdQdx();bsuccess = bsuccess && tmpBool;
1999 tmpBool = (*iter)->loadDAEdFdx();bsuccess = bsuccess && tmpBool;
2005 for (DeviceVector::iterator it = devicePtrVec_.begin(), end = devicePtrVec_.end(); it != end; ++it)
2007 bsuccess = (*it)->loadDAEMatrices(*externData_.dFdxMatrixPtr , *externData_.dQdxMatrixPtr);
2012 if (devOptions_.testJacobianFlag &&
2013 (solState_.timeStepNumber >= devOptions_.testJacStartStep &&
2014 solState_.timeStepNumber <= devOptions_.testJacStopStep))
2017 if ((devOptions_.testJacDeviceNameGiven))
2019 for (InstanceVector::iterator iter = testJacDevicePtrVec_.begin(), end = testJacDevicePtrVec_.end(); iter != end; ++iter)
2021 (*iter)->testDAEMatrices(
topology_.getSolutionNodeNames());
2026 for (InstanceVector::iterator iter = instancePtrVec_.begin(), end = instancePtrVec_.end(); iter != end; ++iter)
2028 (*iter)->testDAEMatrices(
topology_.getSolutionNodeNames());
2034 externData_.dQdxMatrixPtr->fillComplete();
2035 externData_.dFdxMatrixPtr->fillComplete();
2037 Report::safeBarrier(comm_);
2039 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PRINT_VECTORS) && solState_.debugTimeFlag)
2041 int newtonIter = solState_.newtonIter;
2042 dout() << section_divider << std::endl;
2043 dout() <<
"Q-matrix: nonlinear iteration = " << newtonIter <<
"\n";
2044 externData_.dQdxMatrixPtr->printPetraObject(dout());
2045 dout() << std::endl;
2046 dout() << section_divider << std::endl;
2047 dout() <<
"F-matrix: nonlinear iteration = " << newtonIter <<
"\n";
2048 externData_.dFdxMatrixPtr->printPetraObject(dout());
2049 dout() << std::endl;
2050 dout() << section_divider << std::endl;
2096 (Linear::Vector * tmpSolVectorPtr,
2097 Linear::Vector * tmpCurrSolVectorPtr,
2098 Linear::Vector * tmpLastSolVectorPtr,
2099 Linear::Vector * tmpStaVectorPtr,
2100 Linear::Vector * tmpCurrStaVectorPtr,
2101 Linear::Vector * tmpLastStaVectorPtr,
2102 Linear::Vector * tmpStaDerivVectorPtr,
2103 Linear::Vector * tmpStoVectorPtr,
2104 Linear::Vector * tmpCurrStoVectorPtr,
2105 Linear::Vector * tmpLastStoVectorPtr,
2106 Linear::Vector * tmpStoLeadCurrQCompVectorPtr,
2107 Linear::Vector * tmpLeadFCompVectorPtr,
2108 Linear::Vector * tmpCurLeadFCompVectorPtr,
2109 Linear::Vector * tmpLastLeadFCompVectorPtr,
2110 Linear::Vector * tmpLeadQCompVectorPtr,
2111 Linear::Vector * tmpJunctionVCompVectorPtr,
2112 Linear::Vector * tmpCurrJunctionVCompVectorPtr,
2113 Linear::Vector * tmpLastJunctionCompVectorPtr,
2114 Linear::Vector * tmpQVectorPtr,
2115 Linear::Vector * tmpFVectorPtr,
2116 Linear::Vector * tmpBVectorPtr,
2117 Linear::Vector * tmpdFdxdVpVectorPtr,
2118 Linear::Vector * tmpdQdxdVpVectorPtr)
2120 bool bsuccess =
true;
2121 bool tmpBool =
true;
2124 externData_.nextSolVectorPtr = tmpSolVectorPtr;
2125 externData_.currSolVectorPtr = tmpCurrSolVectorPtr;
2126 externData_.lastSolVectorPtr = tmpLastSolVectorPtr;
2127 externData_.daeQVectorPtr = tmpQVectorPtr;
2128 externData_.daeFVectorPtr = tmpFVectorPtr;
2129 externData_.daeBVectorPtr = tmpBVectorPtr;
2130 externData_.dFdxdVpVectorPtr = tmpdFdxdVpVectorPtr;
2131 externData_.dQdxdVpVectorPtr = tmpdQdxdVpVectorPtr;
2132 externData_.nextStaVectorPtr = tmpStaVectorPtr;
2133 externData_.currStaVectorPtr = tmpCurrStaVectorPtr;
2134 externData_.lastStaVectorPtr = tmpLastStaVectorPtr;
2135 externData_.storeLeadCurrQCompPtr = tmpStoLeadCurrQCompVectorPtr;
2136 externData_.nextStaDerivVectorPtr = tmpStaDerivVectorPtr;
2137 externData_.nextStoVectorPtr = tmpStoVectorPtr;
2138 externData_.currStoVectorPtr = tmpCurrStoVectorPtr;
2139 externData_.lastStoVectorPtr = tmpLastStoVectorPtr;
2140 externData_.nextLeadCurrFCompPtr = tmpLeadFCompVectorPtr;
2141 externData_.currLeadCurrFCompPtr = tmpCurLeadFCompVectorPtr;
2142 externData_.lastLeadCurrFCompPtr= tmpLastLeadFCompVectorPtr;
2143 externData_.nextLeadCurrQCompPtr = tmpLeadQCompVectorPtr;
2144 externData_.nextJunctionVCompPtr = tmpJunctionVCompVectorPtr;
2145 externData_.currJunctionVCompPtr = tmpCurrJunctionVCompVectorPtr;
2146 externData_.lastJunctionVCompPtr = tmpLastJunctionCompVectorPtr;
2150 #ifdef Xyce_PARALLEL_MPI
2151 externData_.nextSolVectorPtr->importOverlap();
2152 externData_.nextStaDerivVectorPtr->importOverlap();
2156 setupRawVectorPointers_ ();
2159 std::vector<Device*>::iterator iter;
2160 std::vector<Device*>::iterator begin;
2161 std::vector<Device*>::iterator end;
2166 begin = pdeDevicePtrVec_.begin ();
2167 end = pdeDevicePtrVec_.end ();
2171 begin = devicePtrVec_.begin ();
2172 end = devicePtrVec_.end ();
2175 #ifndef Xyce_EXCLUDE_SECONDARY_STATE
2176 for (iter=begin; iter!=end;++iter)
2178 tmpBool = (*iter)->updateSecondaryState
2179 (externData_.nextStaDerivVectorRawPtr, externData_.nextStoVectorRawPtr);
2180 bsuccess = bsuccess && tmpBool;
2182 #endif // Xyce_EXCLUDE_SECONDARY_STATE
2184 #ifdef Xyce_PARALLEL_MPI
2185 externData_.nextStaVectorPtr->importOverlap();
2186 externData_.nextStoVectorPtr->importOverlap();
2191 int numDevices = pdeDevicePtrVec_.size();
2192 for(
int i=0; i< numDevices; ++i)
2194 bsuccess=pdeDevicePtrVec_.at(i)->loadDAEVectors(externData_.nextSolVectorRawPtr,
2195 externData_.daeFVectorRawPtr,
2196 externData_.daeQVectorRawPtr,
2197 externData_.daeBVectorRawPtr,
2198 externData_.nextStoVectorRawPtr,
2199 externData_.storeLeadCurrQCompRawPtr,
2200 externData_.nextLeadCurrFCompRawPtr,
2201 externData_.nextLeadCurrQCompRawPtr,
2202 externData_.nextJunctionVCompRawPtr);
2208 int numDevices = devicePtrVec_.size();
2209 for(
int i=0; i< numDevices; ++i)
2211 bsuccess=devicePtrVec_.at(i)->loadDAEVectors(externData_.nextSolVectorRawPtr,
2212 externData_.daeFVectorRawPtr,
2213 externData_.daeQVectorRawPtr,
2214 externData_.daeBVectorRawPtr,
2215 externData_.nextStoVectorRawPtr,
2216 externData_.storeLeadCurrQCompRawPtr,
2217 externData_.nextLeadCurrFCompRawPtr,
2218 externData_.nextLeadCurrQCompRawPtr,
2219 externData_.nextJunctionVCompRawPtr);
2224 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PRINT_VECTORS) && solState_.debugTimeFlag)
2226 int newtonIter = solState_.newtonIter;
2227 dout() <<
"Q-vector: nonlinear iteration = " << newtonIter <<
"\n";
2228 externData_.daeQVectorPtr->printPetraObject(std::cout);
2229 dout() << std::endl;
2230 dout() <<
"F-vector: nonlinear iteration = " << newtonIter <<
"\n";
2231 externData_.daeFVectorPtr->printPetraObject(std::cout);
2232 dout() << std::endl;
2234 if (devOptions_.voltageLimiterFlag)
2236 dout() <<
"\n\n dFdxdVp vector: nonlinear iteration = " << newtonIter <<
"\n";
2237 externData_.dFdxdVpVectorPtr->printPetraObject(std::cout);
2238 dout() << std::endl;
2239 dout() <<
"\n\n dQdxdVp vector: nonlinear iteration = " << newtonIter <<
"\n";
2240 externData_.dQdxdVpVectorPtr->printPetraObject(std::cout);
2241 dout() << std::endl;
2248 externData_.daeQVectorPtr->fillComplete();
2249 externData_.daeFVectorPtr->fillComplete();
2250 externData_.daeBVectorPtr->fillComplete();
2251 externData_.dFdxdVpVectorPtr->fillComplete();
2252 externData_.dQdxdVpVectorPtr->fillComplete();
2254 Report::safeBarrier(comm_);
2277 (*it)->loadErrorWeightMask();
2295 if (par.getType() == Util::EXPR)
2302 std::vector<std::string> variables;
2303 expression.get_names(XEXP_VARIABLE, variables);
2304 std::vector<std::string> specials;
2305 expression.get_names(XEXP_SPECIAL, specials);
2306 if (!specials.empty())
2311 for (std::vector<std::string>::const_iterator it = variables.begin(),
2312 end = variables.end() ; it != end ; ++it)
2318 expression.evaluateFunction(val);
2343 retVal = parLocItr->second;
2347 Report::UserError() <<
"Could not find global parameter \"" << parName <<
"\"";
2364 return &(*it).second;
2380 bool bsuccess =
true;
2382 InstanceVector::iterator iter;
2385 for (iter=begin; iter!=end;++iter)
2387 (*iter)->updateIntermediateVars ();
2404 bool bsuccess =
true;
2406 InstanceVector::iterator iter;
2409 for (iter=begin; iter!=end;++iter)
2411 (*iter)->updatePrimaryState ();
2428 bool bsuccess =
true;
2430 InstanceVector::iterator iter;
2433 for (iter=begin; iter!=end;++iter)
2435 (*iter)->updateSecondaryState ();
2452 bool bsuccess =
true;
2463 for (std::vector<Util::Expression>::iterator g_i = ge.begin(), g_end = ge.end();
2464 g_i != g_end; ++g_i)
2466 bool changed =
false;
2470 std::vector<std::string> variables;
2471 g_i->get_names(XEXP_VARIABLE, variables);
2472 for (std::vector<std::string>::iterator vs_i = variables.begin(), vs_end = variables.end();
2473 vs_i != vs_end; ++vs_i)
2475 if (g_i->set_var(*vs_i, gp[*vs_i]))
2484 g_i->evaluateFunction(val);
2497 ModelVector::iterator iterM;
2500 for (iterM=beginM; iterM!=endM;++iterM)
2502 if (!(*iterM)->getDependentParams().empty())
2505 bool tmpBool = (*iterM)->updateGlobalParameters(gp);
2506 bsuccess = bsuccess && tmpBool;
2507 tmpBool = (*iterM)->updateDependentParameters (*solVectorPtr);
2508 bsuccess = bsuccess && tmpBool;
2509 (*iterM)->processParams();
2510 (*iterM)->processInstanceParams();
2515 InstanceVector::iterator iter;
2518 for (iter=begin; iter!=end;++iter)
2520 if (!(*iter)->getDependentParams().empty())
2523 bool tmpBool = (*iter)->updateGlobalParameters(gp);
2524 bsuccess = bsuccess && tmpBool;
2525 tmpBool = (*iter)->updateDependentParameters (*solVectorPtr);
2526 bsuccess = bsuccess && tmpBool;
2527 (*iter)->processParams();
2533 EntityVector::iterator iter;
2536 for (iter=begin; iter!=end;++iter)
2538 bool changed =
false;
2541 bool tmpBool = (*iter)->updateGlobalParameters(gp);
2542 changed = changed || tmpBool;
2543 bsuccess = bsuccess && tmpBool;
2545 bool tmpBool = (*iter)->updateDependentParameters (*solVectorPtr);
2546 changed = changed || tmpBool;
2547 bsuccess = bsuccess && tmpBool;
2550 (*iter)->processParams();
2551 (*iter)->processInstanceParams();
2572 bool bsuccess =
true;
2578 #ifdef Xyce_PARALLEL_MPI
2611 int numNoiseSources=(*iter)->getNumNoiseSources();
2612 if (numNoiseSources > 0)
2636 int numNoiseSources=(*iter)->getNumNoiseSources();
2637 totalNum+=numNoiseSources;
2653 (std::vector<Xyce::Analysis::NoiseData*> & noiseDataVec)
2656 if (noiseDataVec.empty())
2658 noiseDataVec.resize(instancePtrVec_.size());
2662 if (noiseDataVec.size() != instancePtrVec_.size())
2664 Report::DevelFatal message;
2665 message.in(
"DeviceMgr::deRegisterFastSources");
2666 message <<
"Size of noise vector and device vector don't match.";
2667 message <<
"noiseDataVec.size = " << noiseDataVec.size()
2668 <<
" instancePtrVec_.size = " << instancePtrVec_.size() <<std::endl;
2674 for (InstanceVector::iterator iter = instancePtrVec_.begin();
2675 iter != instancePtrVec_.end(); ++iter)
2677 int numNoiseSources=(*iter)->getNumNoiseSources();
2678 if (numNoiseSources>0)
2682 (*iter)->setupNoiseSources ( nd );
2697 (std::vector<Xyce::Analysis::NoiseData*> & noiseDataVec)
2700 for (InstanceVector::iterator iter = instancePtrVec_.begin();
2701 iter != instancePtrVec_.end(); ++iter)
2703 int numNoiseSources=(*iter)->getNumNoiseSources();
2704 if (numNoiseSources>0)
2708 (*iter)->getNoiseSources( nd );
2724 std::vector<int> & bMatEntriesVec,
2725 std::vector<int> & bMatPosEntriesVec)
2727 bool bsuccess =
true;
2734 int lpos, lneg, lbra;
2736 vsrc->
getLIDs(lpos, lneg, lbra);
2737 bMatEntriesVec.push_back(lbra);
2738 bMatPosEntriesVec.push_back(lpos);
2756 bool bsuccess =
true;
2762 (*it)->updateSource();
2777 Linear::Vector * tmpSolVectorPtr,
2778 Linear::Vector * tmpCurrSolVectorPtr,
2779 Linear::Vector * tmpLastSolVectorPtr,
2780 Linear::Vector * tmpStaVectorPtr,
2781 Linear::Vector * tmpCurrStaVectorPtr,
2782 Linear::Vector * tmpLastStaVectorPtr,
2783 Linear::Vector * tmpStaDerivVectorPtr,
2784 Linear::Vector * tmpStoVectorPtr,
2785 Linear::Vector * tmpCurrStoVectorPtr,
2786 Linear::Vector * tmpLastStoVectorPtr,
2787 Linear::Vector * tmpQVectorPtr,
2788 Linear::Vector * tmpFVectorPtr,
2789 Linear::Vector * tmpBVectorPtr,
2790 Linear::Vector * tmpdFdxdVpVectorPtr,
2791 Linear::Vector * tmpdQdxdVpVectorPtr)
2793 bool bsuccess =
true;
2813 #ifdef Xyce_PARALLEL_MPI
2841 bool bsuccess =
true;
2843 InstanceVector::iterator iter;
2846 for (iter=begin; iter!=end;++iter)
2848 bool tmpBool = (*iter)->outputPlotFiles ();
2849 bsuccess = bsuccess && tmpBool;
2876 bool bsuccess =
true;
2877 bool tmpBool =
true;
2881 bsuccess = bsuccess && tmpBool;
2900 std::map<std::string, Device *> device_map;
2901 for (EntityTypeIdDeviceMap::const_iterator it =
deviceMap_.begin();
2904 device_map[(*it).second->getName()] = (*it).second;
2907 lout() << section_divider <<
"\n"
2908 <<
"Operating point information:";
2910 for (std::map<std::string, Device *>::const_iterator it = device_map.begin();
2911 it != device_map.end(); ++it)
2916 lout() << section_divider << std::endl;
2931 Parallel::AllReduce(
comm_, MPI_LOR, &pde_flag, 1);
2946 InstanceVector::iterator iterI;
2947 ModelVector::iterator iterM;
2948 bool bsuccess =
true;
2949 bool tmpBool =
true;
2952 bsuccess = bsuccess && tmpBool;
2960 if (!(*iterM)->getDependentParams().empty())
2962 tmpBool = (*iterM)->getParamBreakpoints(breakPointTimes);
2963 bsuccess = bsuccess && tmpBool;
2969 if (!(*iterI)->getDependentParams().empty())
2971 tmpBool = (*iterI)->getParamBreakpoints(breakPointTimes);
2972 bsuccess = bsuccess && tmpBool;
2977 std::vector<Util::Expression>::iterator globalExp_i =
2979 std::vector<Util::Expression>::iterator globalExp_end =
2981 for (; globalExp_i != globalExp_end; ++globalExp_i)
2983 double bTime = globalExp_i->get_break_time();
2985 breakPointTimes.push_back(bTime);
2993 for (iterI=beginI;iterI!=endI;++iterI)
2996 bool functionSetup = (*iterI)->getInstanceBreakPoints (breakPointTimes);
3008 for (iterI=beginI;iterI!=endI;++iterI)
3010 bool functionSetup = (*iterI)->getInstanceBreakPoints (breakPointTimes);
3014 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
3017 for (InstanceVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
3019 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
3021 extern_device.getBreakPoints(breakPointTimes);
3181 (*it)->setupPointers();
3200 double step = (*it)->getMaxTimeStepSize ();
3203 maxStep = std::min(step, maxStep);
3228 dout() <<
"DeviceMgr::enablePDEContinuation" << std::endl;
3231 throw std::runtime_error(
"Using untested enablePDEContinuation()");
3233 bool bsuccess =
true;
3238 int max_PDE_continuation_steps = 1;
3243 bool tmpSuccess = (*it)->enablePDEContinuation(max_PDE_continuation_steps);
3244 bsuccess = bsuccess && tmpSuccess;
3250 if (!bsuccess) returnedSteps = -1;
3253 return returnedSteps;
3266 bool bsuccess =
true;
3271 bool tmpSuccess = (*it)->disablePDEContinuation();
3272 bsuccess = bsuccess && tmpSuccess;
3324 int size = numINodes.size ();
3327 if (size < size2) numINodes.resize(size2);
3329 for (
int i=0;i<size2;++i)
3385 bool bsuccess =
true, success =
true;
3393 dout() <<
"In DeviceMgr::updateTemperature. new C temp = " << Ctemp <<
" K temp = " << Ktemp << std::endl;
3405 for (ModelVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
3407 (*it)->clearTemperatureData ();
3417 for (ModelVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
3419 (*it)->clearTemperatureData ();
3429 for (ModelVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
3431 (*it)->clearTemperatureData ();
3441 std::string tname(
"TEMP");
3442 std::string tname2(
"XYCEADMSMODTEMP");
3443 std::string tname3(
"XYCEADMSINSTTEMP");
3446 success = (*it)->setParam (tname, Ctemp);
3447 success = (*it)->setParam (tname2, Ktemp) || success;
3448 success = success && (*it)->processParams ();
3456 success = (*it)->setParam (tname, Ctemp);
3457 success = (*it)->setParam (tname3, Ktemp) || success;
3458 success = success && (*it)->processParams ();
3476 Parallel::Machine comm)
const
3478 int allDevsConv =
true;
3487 bool tmpBool = (*it)->isConverged();
3488 allDevsConv = allDevsConv && tmpBool;
3495 bool tmpBool = (*it)->isConverged();
3496 allDevsConv = allDevsConv && tmpBool;
3500 Parallel::AllReduce(comm, MPI_LAND, &allDevsConv, 1);
3502 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
3506 dout() <<
"All devices converged!" << std::endl;
3510 dout() <<
"At least one device NOT converged!" << std::endl;
3514 return allDevsConv != 0;
3528 Parallel::Communicator & parallel_comm)
3530 if (Parallel::is_parallel_run(parallel_comm.comm()))
3534 int procID = parallel_comm.procID();
3535 int numProc = parallel_comm.numProc();
3537 int numExt = extern_device_vector.size();
3538 int numExtTotal = 0;
3539 parallel_comm.sumAll(&numExt, &numExtTotal, 1);
3545 if (numExtTotal > 0)
3547 extern_device_vector.resize(numExtTotal);
3550 for (
int proc = 0; proc < numProc; ++proc)
3555 parallel_comm.bcast(&cnt, 1, proc);
3557 for (
int i = 0; i < cnt; ++i)
3561 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*extern_device_vector[loc]);
3562 int size = extern_device.getInstanceBlock().packedByteCount();
3563 int bufSize = size + 100;
3564 char *buf =
new char[bufSize];
3565 parallel_comm.bcast(&size, 1, proc);
3567 extern_device.getInstanceBlock().pack(buf, bufSize, pos, ¶llel_comm);
3568 parallel_comm.bcast(buf, size, proc);
3569 extern_device_vector[loc] = orig_extern_device_vector[i];
3575 parallel_comm.bcast(&size, 1, proc);
3576 int bufSize = size + 100;
3577 char *buf =
new char[bufSize];
3578 parallel_comm.bcast(buf, size, proc);
3581 instance_block.
unpack(buf, bufSize, pos, ¶llel_comm);
3585 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*extern_device_vector[loc]);
3586 extern_device.setOwningProc(proc);
3587 extern_device.setComm(¶llel_comm);
3592 assert(loc == numExtTotal);
3597 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
3600 for (InstanceVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
3602 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
3604 extern_device.setComm(¶llel_comm);
3623 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
3626 for (InstanceVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
3628 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
3630 extern_device.runExternalDevice();
3644 ExternDevice::Instance *
3659 if (!model_type.defined())
3661 Report::UserError message;
3662 message <<
"Unable to determine type of device for instance name " << instance_block.
getInstanceName();
3665 message <<
" with model name " << instance_block.
getModelName();
3673 return static_cast<ExternDevice::Instance *
>(instance);
3720 (*iter)->acceptStep();
3750 bool bsuccess =
true;
3752 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
3755 int numExt = (*model_type_it).second.size();
3757 tleVec.resize(numExt);
3759 for (InstanceVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it, ++iext)
3761 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
3763 bool bs1 = extern_device.getInitialQnorm(tleVec[iext]);
3764 bsuccess = bsuccess && bs1;
3780 std::vector<TimeIntg::TwoLevelError> & tleVec)
3782 bool bsuccess =
true;
3784 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
3787 int numExt = (*model_type_it).second.size();
3789 tleVec.resize(numExt);
3791 for (InstanceVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it, ++iext)
3793 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
3795 bool bs1 = extern_device.getInnerLoopErrorSum(tleVec[iext]);
3796 bsuccess = bsuccess && bs1;
3813 bool bsuccess =
true;
3815 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
3818 for (InstanceVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
3820 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
3822 bool bs1 = extern_device.updateStateArrays();
3823 bsuccess = bsuccess && bs1;
3841 bool bsuccess =
true;
3845 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
3848 for (InstanceVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
3850 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
3852 bool bs1 = extern_device.startTimeStep();
3853 bsuccess = bsuccess && bs1;
3889 int count =
sizeof(double) * (numdoubles);
3890 count +=
sizeof(size_t) * numSize_t;
3913 char * buf,
int bsize,
int & pos, N_PDS_Comm * comm,
bool pack)
const
3922 comm->pack(&(size), 1, buf, bsize, pos);
3928 int startIndex = pos;
3929 for(
int i = startIndex; i < (startIndex+count); ++i) buf[i] =
' ';
3932 std::ostringstream ost;
3933 ost.width(24);ost.precision(16);ost.setf(std::ios::scientific);
3942 for (
int i=0;i<size;i++)
3949 std::string data(ost.str());
3950 for(
unsigned int i = 0; i < data.length(); ++i) buf[startIndex+i] = data[i];
3956 buf[startIndex+data.length()] =
'\0';
3957 pos += data.length();
3980 comm->unpack(buf, bsize, pos, &(size), 1);
3986 std::string str1(buf);
3987 int length = str1.size() - pos;
3988 std::string str2(str1,pos,length);
3990 std::istringstream ist(str2);
4001 for (
int i=0;i<size;++i)
4005 dout() <<
"DeviceMgr::restoreRestartData: ltraTimePoints["<<i<<
"] = " <<
solState_.
ltraTimePoints[i] << std::endl;
4024 std::string entity_name = Xyce::Util::entityNameFromFullParamName(full_param_name).getEncodedName();
4031 return device_entity;
4033 else if (!(*it).second)
4036 (*it).second = device_entity;
4037 return device_entity;
4040 return (*it).second;
4054 for (DeviceCountMap::const_iterator it = device_map.begin(), end = device_map.end(); it != end; ++it)
4113 Parallel::Machine comm,
4116 bool external_state_flag,
4122 bool bsuccess =
true;
4209 if (external_state_flag)
4249 if (isActive(Diag::DEVICE_SOLVER_STATE) && solver_state.
debugTimeFlag)
4251 dout() << solver_state;
std::vector< std::string > global_exp_names
const InstanceName & getName() const
bool dcopFlag
Analysis DCOP flag.
virtual void enableLeadCurrentCalc()
double * nextStaDerivVectorRawPtr
bool setupDefaultOptions(const IO::CmdParse &command_line)
Linear::Vector * numJacSolVectorPtr_
double finalTime
Step error control final time.
void setExternalSolverState(const SolverState &ss)
const double * findGlobalPar(const std::string &parName) const
bool setupExternalDevices(N_PDS_Comm ¶llel_comm)
Linear::Vector * lastStaVectorPtr
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)
double * nextLeadCurrQCompRawPtr
double * currStoVectorRawPtr
const ModelName & getName() const
ModelTypeNameModelTypeIdMap modelTypeMap_
Model type name to model.
bool setLeadCurrentRequests(const std::set< std::string > &deviceNames)
bool updateDependentParameters_()
Linear::Vector * numJacStaVectorPtr_
NonLinInfo getNonLinInfo() const
bool getParam(const std::string ¶mName, double &result) const
Linear::Vector * bVecImagPtr
std::ostream & printDotOpOutput(std::ostream &os, const Device &device)
bool sweepSourceResetFlag
Analysis.
bool tranopFlag
Analysis TransientOP flag.
size_t ltraTimeHistorySize
Linear::System * lasSysPtr
double * daeQVectorRawPtr
bool beginIntegrationFlag
int timeStepNumber
Analysis.
void deactivateSlowSources()
DeviceEntity * getDeviceEntity(const std::string &full_param_name) const
Linear::Vector * currSolVectorPtr
double * dFdxdVpVectorRawPtr
Linear::Vector * nextLeadCurrFCompPtr
bool calcPDESubProblemInfo()
Linear::Vector * nextSolVectorPtr
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)
void unpack(char *pB, int bsize, int &pos, N_PDS_Comm *comm)
Analysis::AnalysisManager * analysisManager_
To search for non-device parameters. This needs to be removed.
Linear::Vector * nextLeadCurrQCompPtr
bool loadErrorWeightMask(Linear::Vector *deviceMaskPtr)
double getParamNoReduce(const std::string &name) const
Linear::Vector * daeQVectorPtr
Linear::Vector * nextJunctionVCompPtr
InstanceVector instancePtrVec_
Pure virtual class to augment a linear system.
ModelTypeModelVectorMap modelGroupModelVector_
bool inputOPFlag
Analysis InputOP flag.
bool getInnerLoopErrorSums(std::vector< TimeIntg::TwoLevelError > &tleVec)
std::vector< double > ltraTimePoints
Linear::Vector * Jdx2VectorPtr
const std::string & getEncodedName() const
Return the instance name encoded as: [s:]*xname [s:]*Ytype!name [s:]*Utype!name!count.
double * currStaVectorRawPtr
bool initTranFlag
Analysis.
TimeIntg::TimeIntInfo twoLevelTimeIntgInfo
int continuationStepNumber
bool setupRawMatrixPointers_()
int doubleDCOPStep
Analysis.
void initializeHomotopyBlockSize(int numBlocks)
double * currJunctionVCompRawPtr
Device * createDevice(const FactoryBlock &factory_block) const
Creates the specified device.
Linear::Vector * perturbVectorPtr
int currPDEContinuationStep
void setFastTime(double timeVal)
Topo::Topology & topology_
bool getBMatrixEntriesforMOR(std::vector< int > &bMatEntriesVec, std::vector< int > &bMatPosEntriesVec)
bool registerAnalysisManager(Analysis::AnalysisManager *analysis_manager)
Linear::Vector * dFdxdVpVectorPtr
Linear::Vector * numJacFVectorPtr
ModelTypeInstanceVectorMap modelTypeInstanceVector_
bool disablePDEContinuation()
void activateSlowSources()
void getNumInterfaceNodes(std::vector< int > &numInterfaceNodes)
DeviceCountMap localDeviceCountMap_
Device & getDeviceByModelType(const EntityTypeId model_type)
Linear::Vector * tmpdQdXPtr
bool breakPointInstancesInitialized
ExternDevice::Instance * addExtDeviceInstance_(const InstanceBlock &IB)
bool findParam(const std::string &name) const
double nextTimeStep
Step error control next time step.
std::vector< Util::Expression > global_expressions
bool transientFlag
Analysis.
double * nextJunctionVCompRawPtr
Nonlinear::TwoLevelNewtonMode twoLevelNewtonCouplingMode
Linear::Matrix * FTestMatrixPtr
bool getAnalyticSensitivity(const std::string ¶mName, std::vector< double > &dfdpVec, std::vector< double > &dqdpVec, std::vector< double > &dbdpVec, std::vector< int > &FindicesVec, std::vector< int > &QindicesVec, std::vector< int > &BindicesVec)
Linear::Vector * tmpdIdXPtr
Linear::Vector * currJunctionVCompPtr
bool firstContinuationParam
const T & value(const ParameterBase &entity, const Descriptor &descriptor)
Returns the value of the parameter for the entity.
Linear::Vector * diagonalVectorPtr_
Linear::Vector * lastJunctionVCompPtr
double * storeLeadCurrQCompRawPtr
bool doubleDCOPEnabled
Analysis.
ModelTypeModelVectorMap modelTypeModelVector_
DeviceEntityMap parameterDeviceCache_
Full parameter name to device entity cache.
static const Configuration * findConfiguration(ModelTypeId model_type_id)
Returns the configuration associated with the device name and level or 0 if not found.
Linear::Vector * dQdxdVpVectorPtr
void getTimeIntInfo(const AnalysisManager &analysis_manager, TimeIntg::TimeIntInfo &tiInfo)
Linear::Vector * Fdx2VectorPtr
InstanceVector testJacDevicePtrVec_
Devices under jacobian test.
DeviceInstance * addDeviceInstance(const InstanceBlock &IB)
Linear::Vector * lastSolVectorPtr
Linear::Vector * fVectorPtr
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
Linear::Vector * lastLeadCurrFCompPtr
bool setParam(std::string &name, double val, bool overrideOriginal=false)
double * daeFVectorRawPtr
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)
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
double nextTime
Step error control next time.
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)
static ModelTypeId getModelGroup(const std::string &device_name)
Returns the model group of the device name.
bool beginIntegrationFlag
Analysis.
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
double * nextStoVectorRawPtr
Linear::Vector * JdxpVectorPtr
double bpTol
Step error control breakpoint tolerance.
bool calcCouplingTerms(int iSubProblem, int iElectrode, const Linear::Vector *dxdvPtr)
void addGlobalPar(const Util::Param &)
double * currLeadCurrFCompRawPtr
DeviceSensitivities * devSensPtr_
InstanceVector pdeInstancePtrVec_
Linear::Vector * lastLeadCurrQCompPtr
ModelTypeNameModelTypeIdMap modelGroupMap_
Model type name to model group.
bool setNOISEAnalysisParams(const Util::OptionBlock &option_block)
bool updateIntermediateVars_()
Linear::Vector * lastStoVectorPtr
Linear::Vector * dxVoltlimVectorPtr
Linear::Vector * numJacRHSVectorPtr
void setMPDEFlag(bool flagVal)
int usedOrder
Time integrator used order.
const std::string & getType() const
Linear::Vector * deviceErrorWeightMask_
Linear::Vector * nextStaVectorPtr
Linear::Vector * currLeadCurrFCompPtr
bool setInitialGuess(Linear::Vector *solVectorPtr)
bool setDefaultParam(double val, bool overrideOriginal=false)
const ModelName & getModelName() const
DeviceMgr & deviceManager_
bool firstContinuationParam
IO::Measure::Manager * measureManager_
To search for non-device parameters. This needs to be removed.
const IO::CmdParse & commandLine_
Command line.
const InstanceName & getInstanceName() const
Parallel::Machine comm_
Communicator (should be passed in when needed, not a member)
Linear::Vector * numJacLoadFlagPtr
double timeParamsProcessed_
Time updateDependentParameters was called.
The Device class is an interface for device implementations.
EntityTypeIdDeviceMap deviceMap_
int getHomotopyBlockSize() const
Linear::Vector * daeBVectorPtr
bool calculateAllLeadCurrents
bool allDevicesConverged(Parallel::Machine comm) const
bool initializeAll(Linear::System &linear_system)
const InstanceVector & getExternDevices() const
virtual bool plotfileFlag()
static const ModelTypeId modelType()
Returns the model type identifier.
TwoLevelNewtonMode twoLevelNewtonCouplingMode
EntityVector dependentPtrVec_
bool getBreakPoints(std::vector< Util::BreakPoint > &breakPointTimes)
Linear::Vector * numJacStoVectorPtr_
bool setACAnalysisParams(const Util::OptionBlock &option_block)
bool updatePrimaryState_()
AnalysisManager & analysisManager_
double * dQdxdVpVectorRawPtr
Class Configuration contains device configuration data.
void setupNoiseSources(std::vector< Xyce::Analysis::NoiseData * > &noiseDataVec)
bool getFastSourceFlag() const
double * lastStaVectorRawPtr
Linear::Vector * storeLeadCurrQCompPtr
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 * lastLeadCurrQCompRawPtr
double getMaxTimeStepSize()
double defaultMaxTimeStep
double * lastJunctionVCompRawPtr
bool checkForZeroResistance
bool analyticSensitivityAvailable(const std::string ¶mName)
double getGlobalPar(const std::string &parName) const
int restartDataSize(bool pack) const
void deRegisterFastSources(const std::vector< std::string > &sourceNames)
std::map< std::string, int, LessNoCase > passThroughParamsMap_
DeviceOptions devOptions_
user-defined options:
double * nextLeadCurrFCompRawPtr
bool setupRawVectorPointers_()
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 applyCmdLineOptions(const IO::CmdParse &command_line)
Nonlinear::Manager * nlsMgrPtr_
To get Nonlinear solver information. This needs to be removed.
void setBlockAnalysisFlag(bool flagVal)
SolverState solState_
real time solver data:
Linear::Vector * nextStoVectorPtr
unordered_map< std::string, double, HashNoCase, EqualNoCase > GlobalParameterMap
ArtificialParameterMap artificialParameterMap_
Specially named parameters. This needs to be removed.
InstanceVector plotFileInstancePtrVec_
SolverState solStateExternal_
std::map< std::string, int, LessNoCase > DeviceCountMap
void updateExternalDevices_()
bool sweepSourceResetFlag
Linear::Vector * currStaVectorPtr
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)
double * daeBVectorRawPtr
double * nextStaVectorRawPtr
Linear::Vector * daeFVectorPtr
IndependentSourceVector indepSourceInstanceBackupPtrVec_
bool registerPkgOptionsMgr(DeviceMgr &device_manager, const std::string &netlist_filename, IO::PkgOptionsMgr &options_manager)
Linear::Vector * bVecRealPtr
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
static ModelTypeId getModelType(const std::string &model_name, const int level)
Returns the model type identifier for the specified device, if the model type and level is not found...
bool setParam(const std::string ¶mName, double val, bool overrideOriginal=false)
double * lastLeadCurrFCompRawPtr
bool loadBVectorsforAC(Linear::Vector *bVecRealPtr, Linear::Vector *bVecImagPtr)
bool acopFlag
Analysis ACOP flag.
bool updateTemperature(double val)
void notify(const Analysis::StepEvent &event)
DeviceVector devicePtrVec_
double pdt
Time integrator partial time deriviative.
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 numericalJacobianFlag
bool restoreRestartData(char *buf, int bsize, int &pos, N_PDS_Comm *comm, bool pack)
Globals & globals_
global variables
int maxPDEContinuationSteps
bool linearSystemFlag_
True if all devices in netlist have isLinearDevice() true.
Linear::Vector * currStoVectorPtr
bool verifyDeviceInstance(const InstanceBlock &IB)
double * currSolVectorRawPtr
bool deleteDeviceInstance(const std::string &name)
virtual bool processInstanceParams()=0
Linear::Vector * currLeadCurrQCompPtr
DeviceVector pdeDevicePtrVec_
InstanceVector nonPdeInstancePtrVec_
GlobalParameterMap global_params
ModelBlock represents a .MODEL line from the netlist.
Linear::Matrix * JTestMatrixPtr
MatrixLoadData matrixLoadData_
temporary jacobian load structures:
Linear::Matrix * QTestMatrixPtr
double startingTimeStep
Step error control starting time step.
void setFastSourceFlag(bool value)
int enablePDEContinuation()
std::string testJacDeviceName
void addDevicesToCount(const DeviceCountMap &device_map)
InstanceBlock represent a device instance line from the netlist.
std::vector< DeviceInstance * > InstanceVector
double getParamAndReduce(const std::string &name) const
std::vector< Param > params
const std::string & getDeviceType() const
Decodes the device type.
virtual bool processParams()=0
double * lastSolVectorRawPtr
bool defaultNewExcessPhase
std::vector< double > registerFastSources(Parallel::Machine comm, const std::vector< std::string > &sourceNames)
bool registerSensParams(const Util::OptionBlock &option_block)
ModelTypeInstanceVectorMap modelGroupInstanceVector_
double currTimeStep
Step error control current time step.
double * lastStoVectorRawPtr
bool firstDependent_
True until updateDependentParameters_ is called.
bool dcsweepFlag
Analysis.
Linear::Vector * numJacQVectorPtr
Linear::Vector * Qdx2VectorPtr
bool getInitialQnorm(std::vector< TimeIntg::TwoLevelError > &tleVec)
void getLIDs(int &lpos, int &lneg, int &lbra)
Linear::Vector * flagSolVectorPtr
Linear::Vector * nextStaDerivVectorPtr
double * nextSolVectorRawPtr
bool updateSecondaryState_()
int currentOrder
Time integrator order.
double * currLeadCurrQCompRawPtr