46 #include <Xyce_config.h>
58 #include <N_DEV_ExternDevice.h>
65 #include <N_ERH_ErrorMgr.h>
66 #include <N_ERH_Message.h>
67 #include <N_IO_CmdParse.h>
68 #include <N_IO_MeasureManager.h>
70 #include <N_IO_CircuitBlock.h>
71 #include <N_IO_OptionBlock.h>
72 #include <N_IO_PkgOptionsMgr.h>
73 #include <N_IO_SpiceSeparatedFieldTool.h>
74 #include <N_LAS_Builder.h>
75 #include <N_LAS_Matrix.h>
76 #include <N_LAS_System.h>
78 #include <N_PDS_Comm.h>
79 #include <N_PDS_MPI.h>
80 #include <N_PDS_Manager.h>
82 #include <N_TOP_Topology.h>
83 #include <N_UTL_Algorithm.h>
84 #include <N_UTL_BreakPoint.h>
85 #include <N_UTL_ExtendedString.h>
86 #include <N_UTL_FeatureTest.h>
116 Parallel::Machine comm,
120 DeviceMgr & device_manager,
123 const std::string & name,
125 bool override_original);
138 Parallel::Machine comm,
139 Topo::Topology & topology,
140 Util::Op::BuilderManager & op_builder_manager,
141 const IO::CmdParse & command_line)
142 : commandLine_(command_line),
144 opBuilderManager_(op_builder_manager),
148 isLinearSystem_(true),
149 firstDependent_(true),
150 parameterChanged_(false),
151 breakPointInstancesInitialized(false),
152 timeParamsProcessed_(0.0),
156 globals_(solState_.globals_),
157 numJacStaVectorPtr_(0),
158 numJacSolVectorPtr_(0),
159 numJacStoVectorPtr_(0),
160 diagonalVectorPtr_(0),
168 modelGroupInstanceVector_(),
169 modelTypeInstanceVector_(),
171 modelGroupModelVector_(),
172 modelTypeModelVector_(),
173 localDeviceCountMap_(),
178 pdeInstancePtrVec_(),
179 nonPdeInstancePtrVec_(),
180 plotFileInstancePtrVec_(),
181 independentSourceVector_(),
182 independentSourceMap_(),
183 indepSourceInstanceBackupPtrVec_(),
184 testJacDevicePtrVec_(),
186 devicesNeedingLeadCurrentLoads_(),
187 passthroughParameterSet_(),
188 parameterDeviceCache_(),
189 numInterfaceNodes_(),
190 calledBeforeCSPI (false),
192 dotOpOutputRequested_(false),
193 dotOpOutputFlag_(false),
196 artificialParameterMap_()
226 IO::setSensitivityDebugLevel(command_line, 0);
227 IO::setDeviceDebugLevel(command_line, 1);
230 if (command_line.argExists(
"-jacobian_test"))
275 for (EntityTypeIdDeviceMap::iterator it =
deviceMap_.begin(), end =
deviceMap_.end(); it != end; ++it)
278 for (OpMap::iterator it =
opMap_.begin(), end =
opMap_.end(); it != end; ++it)
300 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
302 dout() <<
"DeviceMgr::registerSensParams called!" <<std::endl;
327 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
331 dout() <<
"DeviceMgr::registerLeadCurrentRequests Devices for which lead currents were requested: ";
335 dout() << (*it) <<
" ";
413 return (*model_type_it).second;
415 return s_emptyVector;
454 Parallel::Machine comm,
455 const std::vector<std::string> & sourceNames)
457 int numFastSrcs = sourceNames.size();
460 std::vector<double> srcPeriods(numFastSrcs);
463 for (
int i = 0; i < numFastSrcs; ++i)
469 srcPeriods[i] = source_instance.
period();
473 #ifndef Xyce_PARALLEL_MPI
474 Report::UserError message;
475 message <<
"Unable to find source: " << sourceNames[i] <<
"\n"
476 <<
"Potential names are: ";
480 message << (*it).first <<
" ";
486 Parallel::AllReduce(comm, MPI_MAX, srcPeriods);
501 Parallel::Machine comm,
502 const std::vector<std::string> & sourceNames)
504 int numFastSrcs = sourceNames.size();
506 std::vector<double> srcPeriods;
510 srcPeriods.resize(numFastSrcs, 0.0);
513 for (
int i = 0; i < numFastSrcs; ++i)
520 srcPeriods[i] = source_instance.
period();
524 #ifndef Xyce_PARALLEL_MPI
525 Report::UserError message;
526 message <<
"Unable to find source: " << sourceNames[i] <<
"\n"
527 <<
"Potential names are: ";
531 message << (*it).first <<
" ";
546 Parallel::AllReduce(comm, MPI_SUM, &myNumFastSrcs, &numFastSrcs, 1);
549 throw std::runtime_error(
"registerFastSources() does not handle parallel");
551 srcPeriods.resize(numFastSrcs, -1.0);
552 for (
int i = 0; i < myNumFastSrcs; ++i)
559 Parallel::AllReduce(comm, MPI_MAX, srcPeriods);
575 int numFastSrcs = sourceNames.size();
580 for (
int i = 0; i < numFastSrcs; ++i)
590 #ifndef Xyce_PARALLEL_MPI
591 Report::DevelFatal message;
592 message.in(
"DeviceMgr::deRegisterFastSources");
593 message <<
"Unable to find source: " << sourceNames[i] << std::endl
594 <<
"Potential names are: ";
598 message << (*it).first <<
" ";
608 for (
int i = 0; i < numFastSrcs; ++i)
637 if ((*it)->getFastSourceFlag())
714 bool bsuccess =
true;
817 int size =
sizeof(*this);
818 dout() <<
"Size of device package after initializeAll = " << size << std::endl;
881 if (model_type_id.defined())
883 EntityTypeIdDeviceMap::const_iterator it =
deviceMap_.find(model_type_id);
893 if (device->isPDEDevice())
899 device = (*it).second;
945 if (!model_block.
getName().empty())
949 if (!model_type.defined())
951 Report::UserError() <<
"There is no device " << model_block.
getType()
952 <<
" of level " << model_block.
getLevel() <<
" to define model " << model_block.
getName();
956 if (!model_type.defined())
957 model_type = model_group;
959 if (!model_type.defined())
964 DeviceModel *device_model = device.addModel(model_block, factory_block);
970 if (device_model != 0)
977 return device_model != 0;
997 model_group = model_type;
1005 if (!model_type.defined())
1007 Report::UserError message;
1008 message <<
"Unable to determine type of device for instance name " << instance_block.
getInstanceName();
1011 message <<
" with model name " << instance_block.
getModelName();
1029 std::vector<Param>::const_iterator currentParam = instance_block.
params.begin();
1030 std::vector<Param>::const_iterator endParam = instance_block.
params.end();
1031 while(currentParam != endParam)
1033 if ((currentParam->uTag() ==
"R"))
1035 if (currentParam->given())
1037 std::vector<std::string> variables, specials;
1041 const Param * devPar = &(*(currentParam));
1042 const Util::Param * tmpPar = (
dynamic_cast<const Util::Param*
> (devPar));
1044 if (tmpPar->getType() == Util::EXPR)
1046 Util::Expression tmpExp = tmpPar->getValue<Util::Expression>();
1047 tmpExp.get_names(XEXP_VARIABLE, variables);
1048 tmpExp.get_names(XEXP_SPECIAL, specials);
1051 if (specials.empty() && variables.empty())
1066 return std::pair<ModelTypeId, ModelTypeId>(model_type, model_group);
1094 std::pair<ModelTypeId, ModelTypeId> x =
getModelType(instance_block);
1095 model_type = x.first;
1096 model_group = x.second;
1098 if (!model_type.defined())
1100 Report::UserError message;
1101 message <<
"Unable to determine model type of device for instance name " << instance_block.
getInstanceName();
1104 message <<
" with model name" << instance_block.
getModelName();
1139 std::pair<ModelTypeId, ModelTypeId> x =
getModelType(instance_block);
1140 model_type = x.first;
1141 model_group = x.second;
1143 if (!model_type.defined())
1145 Report::UserError message;
1146 message <<
"Unable to determine type of device for instance name " << instance_block.
getInstanceName();
1149 message <<
" with model name " << instance_block.
getModelName();
1168 std::string outputName = (instance->
getName()).getEncodedName();
1174 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
1176 dout() <<
"DeviceMgr::addDeviceInstance Enabling lead current load for device \""
1180 <<
"\"" << std::endl;
1183 else if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
1185 dout() <<
"DeviceMgr::addDeviceInstance Cannot enable lead current load for device \""
1204 if (device.isPDEDevice())
1247 Report::DevelFatal().in(
"DeviceMgr::deleteDeviceInstance")
1248 <<
"Not ready with the new boilerplate-free device package";
1250 bool bsuccess =
true;
1309 std::ostringstream oss;
1310 oss <<
"fvector." << std::setw(3) << std::setfill(
'0') << newton_iteration_count <<
".txt";
1322 std::ostringstream oss;
1323 oss <<
"Jdxp." << std::setw(3) << std::setfill(
'0') << newton_iteration_count <<
".txt";
1333 std::ostringstream oss;
1334 oss <<
"dxVL." << std::setw(3) << std::setfill(
'0') << newton_iteration_count <<
".txt";
1342 std::ostringstream oss;
1343 oss <<
"Jdx2." << std::setw(3) << std::setfill(
'0') << newton_iteration_count <<
".txt";
1367 int outputStepNumber = 0;
1371 outputStepNumber = 0;
1388 std::ostringstream oss;
1389 oss <<
"dxVL." << std::setw(3) << std::setfill(
'0') << outputStepNumber
1390 <<
"." << std::setw(3) << std::setfill(
'0') << newton_iteration_count <<
".txt";
1398 std::ostringstream oss;
1399 oss <<
"Fdx2." << std::setw(3) << std::setfill(
'0') << outputStepNumber
1400 <<
"." << std::setw(3) << std::setfill(
'0') << newton_iteration_count <<
".txt";
1408 std::ostringstream oss;
1409 oss <<
"Qdx2." << std::setw(3) << std::setfill(
'0') << outputStepNumber
1410 <<
"." << std::setw(3) << std::setfill(
'0') << newton_iteration_count <<
".txt";
1430 bool bsuccess =
true;
1432 if (solVectorPtr != 0)
1440 bool tmpBool = (*it)->setInitialGuess();
1441 bsuccess = bsuccess && tmpBool;
1465 std::string paramName = Util::paramNameFromFullParamName(name);
1467 if (paramName ==
"")
1477 Parallel::AllReduce(
comm_, MPI_LOR, &available, 1);
1479 return available != 0;
1491 (std::string & name,
1492 std::vector<double> & dfdpVec,
1493 std::vector<double> & dqdpVec,
1494 std::vector<double> & dbdpVec,
1495 std::vector<int> & FindicesVec,
1496 std::vector<int> & QindicesVec,
1497 std::vector<int> & BindicesVec)
1505 std::string paramName = Util::paramNameFromFullParamName(name);
1506 if (paramName ==
"")
1509 dfdpVec, dqdpVec, dbdpVec,
1510 FindicesVec, QindicesVec, BindicesVec);
1515 dfdpVec, dqdpVec, dbdpVec,
1516 FindicesVec, QindicesVec, BindicesVec);
1543 const std::string & name,
1545 bool overrideOriginal)
1604 Parallel::Machine comm,
1605 const std::string & name)
const
1607 Util::ParamList param_list;
1608 param_list.push_back(
Param(name,
""));
1609 Util::ParamList::const_iterator it = param_list.begin();
1615 int found = op ? 1 : 0;
1617 Parallel::AllReduce(comm, MPI_SUM, &found, 1);
1636 Linear::Vector * nextSolVectorPtr,
1637 Linear::Vector * currSolVectorPtr,
1638 Linear::Vector * lastSolVectorPtr,
1639 Linear::Vector * nextStaVectorPtr,
1640 Linear::Vector * currStaVectorPtr,
1641 Linear::Vector * lastStaVectorPtr,
1642 Linear::Vector * nextStoVectorPtr,
1643 Linear::Vector * currStoVectorPtr,
1644 Linear::Vector * lastStoVectorPtr)
1646 bool bsuccess =
true;
1647 bool tmpBool =
true;
1652 bsuccess = bsuccess && tmpBool;
1665 #ifdef Xyce_PARALLEL_MPI
1689 bsuccess = bsuccess && tmpBool;
1702 #ifdef Xyce_PARALLEL_MPI
1707 Report::safeBarrier(
comm_);
1755 Linear::Vector * tmpSolVectorPtr,
1756 Linear::Vector * tmpStateVectorPtr,
1757 Linear::Vector * tmpStateDerivVectorPtr,
1758 Linear::Vector * tmpStoreVectorPtr,
1759 Linear::Matrix * tmpdQdxMatrixPtr,
1760 Linear::Matrix * tmpdFdxMatrixPtr)
1762 bool bsuccess =
true;
1763 bool tmpBool =
true;
1767 bool resetRawMatrixPointers =
true;
1770 resetRawMatrixPointers =
false;
1772 if (resetRawMatrixPointers)
1805 for ( ; iter!=end; ++iter)
1807 (*iter)->loadTrivialDAE_FMatrixStamp ();
1812 for ( ; iter!=end; ++iter)
1814 tmpBool = (*iter)->loadDAEdQdx();bsuccess = bsuccess && tmpBool;
1815 tmpBool = (*iter)->loadDAEdFdx();bsuccess = bsuccess && tmpBool;
1836 for ( ; iter != end; ++iter)
1838 (*iter)->testDAEMatrices(
topology_.getSolutionNodeNames());
1844 for ( ; iter != end; ++iter)
1846 (*iter)->testDAEMatrices(
topology_.getSolutionNodeNames());
1855 Report::safeBarrier(
comm_);
1860 dout() << section_divider << std::endl;
1861 dout() <<
"Q-matrix: nonlinear iteration = " << newtonIter <<
"\n";
1863 dout() << std::endl;
1864 dout() << section_divider << std::endl;
1865 dout() <<
"F-matrix: nonlinear iteration = " << newtonIter <<
"\n";
1867 dout() << std::endl;
1868 dout() << section_divider << std::endl;
1914 Linear::Vector * tmpSolVectorPtr,
1915 Linear::Vector * tmpCurrSolVectorPtr,
1916 Linear::Vector * tmpLastSolVectorPtr,
1917 Linear::Vector * tmpStaVectorPtr,
1918 Linear::Vector * tmpCurrStaVectorPtr,
1919 Linear::Vector * tmpLastStaVectorPtr,
1920 Linear::Vector * tmpStaDerivVectorPtr,
1921 Linear::Vector * tmpStoVectorPtr,
1922 Linear::Vector * tmpCurrStoVectorPtr,
1923 Linear::Vector * tmpLastStoVectorPtr,
1924 Linear::Vector * tmpStoLeadCurrQCompVectorPtr,
1925 Linear::Vector * tmpLeadFCompVectorPtr,
1926 Linear::Vector * tmpCurLeadFCompVectorPtr,
1927 Linear::Vector * tmpLastLeadFCompVectorPtr,
1928 Linear::Vector * tmpLeadQCompVectorPtr,
1929 Linear::Vector * tmpJunctionVCompVectorPtr,
1930 Linear::Vector * tmpCurrJunctionVCompVectorPtr,
1931 Linear::Vector * tmpLastJunctionCompVectorPtr,
1932 Linear::Vector * tmpQVectorPtr,
1933 Linear::Vector * tmpFVectorPtr,
1934 Linear::Vector * tmpBVectorPtr,
1935 Linear::Vector * tmpdFdxdVpVectorPtr,
1936 Linear::Vector * tmpdQdxdVpVectorPtr)
1938 bool bsuccess =
true;
1939 bool tmpBool =
true;
1967 #ifdef Xyce_PARALLEL_MPI
1976 std::vector<Device*>::iterator iter;
1977 std::vector<Device*>::iterator begin;
1978 std::vector<Device*>::iterator end;
1992 #ifndef Xyce_EXCLUDE_SECONDARY_STATE
1993 for (iter=begin; iter!=end;++iter)
1995 tmpBool = (*iter)->updateSecondaryState
1997 bsuccess = bsuccess && tmpBool;
1999 #endif // Xyce_EXCLUDE_SECONDARY_STATE
2001 #ifdef Xyce_PARALLEL_MPI
2009 for(
int i=0; i< numDevices; ++i)
2026 for(
int i=0; i< numDevices; ++i)
2044 dout() <<
"Q-vector: nonlinear iteration = " << newtonIter <<
"\n";
2046 dout() << std::endl;
2047 dout() <<
"F-vector: nonlinear iteration = " << newtonIter <<
"\n";
2049 dout() << std::endl;
2053 dout() <<
"\n\n dFdxdVp vector: nonlinear iteration = " << newtonIter <<
"\n";
2055 dout() << std::endl;
2056 dout() <<
"\n\n dQdxdVp vector: nonlinear iteration = " << newtonIter <<
"\n";
2058 dout() << std::endl;
2071 Report::safeBarrier(
comm_);
2093 for ( ; it != end; ++it)
2095 (*it)->loadErrorWeightMask();
2125 const std::string & parName)
const
2141 bool bsuccess =
true;
2143 InstanceVector::iterator iter;
2146 for (iter=begin; iter!=end;++iter)
2148 (*iter)->updateIntermediateVars ();
2165 bool bsuccess =
true;
2167 InstanceVector::iterator iter;
2170 for (iter=begin; iter!=end;++iter)
2172 (*iter)->updatePrimaryState ();
2189 bool bsuccess =
true;
2191 InstanceVector::iterator iter;
2194 for (iter=begin; iter!=end;++iter)
2196 (*iter)->updateSecondaryState ();
2213 bool bsuccess =
true;
2224 for (std::vector<Util::Expression>::iterator g_i = ge.begin(), g_end = ge.end();
2225 g_i != g_end; ++g_i)
2227 bool changed =
false;
2231 std::vector<std::string> variables;
2232 g_i->get_names(XEXP_VARIABLE, variables);
2233 for (std::vector<std::string>::iterator vs_i = variables.begin(), vs_end = variables.end();
2234 vs_i != vs_end; ++vs_i)
2236 if (g_i->set_var(*vs_i, gp[*vs_i]))
2245 g_i->evaluateFunction(val);
2258 ModelVector::iterator iterM;
2261 for (iterM=beginM; iterM!=endM;++iterM)
2263 if (!(*iterM)->getDependentParams().empty())
2266 bool tmpBool = (*iterM)->updateGlobalParameters(gp);
2267 bsuccess = bsuccess && tmpBool;
2268 tmpBool = (*iterM)->updateDependentParameters (*solVectorPtr);
2269 bsuccess = bsuccess && tmpBool;
2270 (*iterM)->processParams();
2271 (*iterM)->processInstanceParams();
2276 InstanceVector::iterator iter;
2279 for (iter=begin; iter!=end;++iter)
2281 if (!(*iter)->getDependentParams().empty())
2284 bool tmpBool = (*iter)->updateGlobalParameters(gp);
2285 bsuccess = bsuccess && tmpBool;
2286 tmpBool = (*iter)->updateDependentParameters (*solVectorPtr);
2287 bsuccess = bsuccess && tmpBool;
2288 (*iter)->processParams();
2294 EntityVector::iterator iter;
2297 for (iter=begin; iter!=end;++iter)
2299 bool changed =
false;
2302 bool tmpBool = (*iter)->updateGlobalParameters(gp);
2303 changed = changed || tmpBool;
2304 bsuccess = bsuccess && tmpBool;
2306 bool tmpBool = (*iter)->updateDependentParameters (*solVectorPtr);
2307 changed = changed || tmpBool;
2308 bsuccess = bsuccess && tmpBool;
2311 (*iter)->processParams();
2312 (*iter)->processInstanceParams();
2333 bool bsuccess =
true;
2339 #ifdef Xyce_PARALLEL_MPI
2349 for ( ; it != end; ++it)
2374 int numNoiseSources=(*iter)->getNumNoiseSources();
2375 if (numNoiseSources > 0)
2399 int numNoiseSources=(*iter)->getNumNoiseSources();
2400 totalNum+=numNoiseSources;
2416 (std::vector<Xyce::Analysis::NoiseData*> & noiseDataVec)
2419 if (noiseDataVec.empty())
2421 noiseDataVec.resize(instancePtrVec_.size());
2425 if (noiseDataVec.size() != instancePtrVec_.size())
2427 Report::DevelFatal message;
2428 message.in(
"DeviceMgr::deRegisterFastSources");
2429 message <<
"Size of noise vector and device vector don't match.";
2430 message <<
"noiseDataVec.size = " << noiseDataVec.size()
2431 <<
" instancePtrVec_.size = " << instancePtrVec_.size() <<std::endl;
2437 for (InstanceVector::iterator iter = instancePtrVec_.begin();
2438 iter != instancePtrVec_.end(); ++iter)
2440 int numNoiseSources=(*iter)->getNumNoiseSources();
2441 if (numNoiseSources>0)
2445 (*iter)->setupNoiseSources ( nd );
2460 (std::vector<Xyce::Analysis::NoiseData*> & noiseDataVec)
2463 for (InstanceVector::iterator iter = instancePtrVec_.begin();
2464 iter != instancePtrVec_.end(); ++iter)
2466 int numNoiseSources=(*iter)->getNumNoiseSources();
2467 if (numNoiseSources>0)
2471 (*iter)->getNoiseSources( nd );
2486 std::vector<int> & bMatEntriesVec,
2487 std::vector<int> & bMatPosEntriesVec)
2489 bool bsuccess =
true;
2493 for ( ; it != end; ++it)
2498 int lpos, lneg, lbra;
2500 vsrc->
getLIDs(lpos, lneg, lbra);
2501 bMatEntriesVec.push_back(lbra);
2502 bMatPosEntriesVec.push_back(lpos);
2520 bool bsuccess =
true;
2528 for ( ; it != end; ++it)
2530 (*it)->updateSource();
2545 Linear::Vector * tmpSolVectorPtr,
2546 Linear::Vector * tmpCurrSolVectorPtr,
2547 Linear::Vector * tmpLastSolVectorPtr,
2548 Linear::Vector * tmpStaVectorPtr,
2549 Linear::Vector * tmpCurrStaVectorPtr,
2550 Linear::Vector * tmpLastStaVectorPtr,
2551 Linear::Vector * tmpStaDerivVectorPtr,
2552 Linear::Vector * tmpStoVectorPtr,
2553 Linear::Vector * tmpCurrStoVectorPtr,
2554 Linear::Vector * tmpLastStoVectorPtr,
2555 Linear::Vector * tmpQVectorPtr,
2556 Linear::Vector * tmpFVectorPtr,
2557 Linear::Vector * tmpBVectorPtr,
2558 Linear::Vector * tmpdFdxdVpVectorPtr,
2559 Linear::Vector * tmpdQdxdVpVectorPtr)
2561 bool bsuccess =
true;
2581 #ifdef Xyce_PARALLEL_MPI
2609 bool bsuccess =
true;
2613 for ( ; it != end; ++it)
2615 bool tmpBool = (*it)->outputPlotFiles(force_final_output);
2616 bsuccess = bsuccess && tmpBool;
2639 bool bsuccess =
true;
2640 bool tmpBool =
true;
2643 bsuccess = bsuccess && tmpBool;
2664 std::map<std::string, Device *> device_map;
2665 for (EntityTypeIdDeviceMap::const_iterator it =
deviceMap_.begin();
2668 device_map[(*it).second->getName()] = (*it).second;
2671 lout() << section_divider <<
"\n"
2672 <<
"Operating point information:";
2674 for (std::map<std::string, Device *>::const_iterator it = device_map.begin();
2675 it != device_map.end(); ++it)
2680 lout() << section_divider << std::endl;
2696 Parallel::AllReduce(
comm_, MPI_LOR, &pde_flag, 1);
2711 InstanceVector::iterator iterI;
2712 ModelVector::iterator iterM;
2713 bool bsuccess =
true;
2714 bool tmpBool =
true;
2719 bsuccess = bsuccess && tmpBool;
2727 if (!(*iterM)->getDependentParams().empty())
2729 tmpBool = (*iterM)->getParamBreakpoints(breakPointTimes);
2730 bsuccess = bsuccess && tmpBool;
2736 if (!(*iterI)->getDependentParams().empty())
2738 tmpBool = (*iterI)->getParamBreakpoints(breakPointTimes);
2739 bsuccess = bsuccess && tmpBool;
2746 for (; globalExp_i != globalExp_end; ++globalExp_i)
2748 double bTime = globalExp_i->get_break_time();
2750 breakPointTimes.push_back(bTime);
2758 for (iterI=beginI;iterI!=endI;++iterI)
2761 bool functionSetup = (*iterI)->getInstanceBreakPoints (breakPointTimes);
2773 for (iterI=beginI;iterI!=endI;++iterI)
2775 bool functionSetup = (*iterI)->getInstanceBreakPoints (breakPointTimes);
2779 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
2782 for (InstanceVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
2784 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
2786 extern_device.getBreakPoints(breakPointTimes);
2944 for ( ; it != end; ++it)
2946 (*it)->setupPointers();
2966 for ( ; it != end; ++it)
2968 double step = (*it)->getMaxTimeStepSize ();
2971 maxStep = std::min(step, maxStep);
2995 dout() <<
"DeviceMgr::enablePDEContinuation" << std::endl;
2998 bool bsuccess =
true;
3000 int target_max_PDE_continuation_steps = 0;
3002 int max_PDE_continuation_steps = 1;
3003 while (max_PDE_continuation_steps != target_max_PDE_continuation_steps) {
3004 target_max_PDE_continuation_steps = max_PDE_continuation_steps;
3007 bool tmpSuccess = (*it)->enablePDEContinuation(max_PDE_continuation_steps);
3008 bsuccess = bsuccess && tmpSuccess;
3012 return bsuccess ? target_max_PDE_continuation_steps : -1;
3025 bool bsuccess =
true;
3030 for ( ; it != end; ++it)
3032 bool tmpSuccess = (*it)->disablePDEContinuation();
3033 bsuccess = bsuccess && tmpSuccess;
3062 for ( ; it != end; ++it)
3087 int size = numINodes.size ();
3090 if (size < size2) numINodes.resize(size2);
3092 for (
int i=0;i<size2;++i)
3154 dout() <<
"In DeviceMgr::updateTemperature. new C temp = " << Ctemp <<
" K temp = " << Ktemp << std::endl;
3166 for (ModelVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
3168 (*it)->clearTemperatureData ();
3178 for (ModelVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
3180 (*it)->clearTemperatureData ();
3190 for (ModelVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
3192 (*it)->clearTemperatureData ();
3202 std::string tname(
"TEMP");
3203 std::string tname2(
"XYCEADMSMODTEMP");
3204 std::string tname3(
"XYCEADMSINSTTEMP");
3207 bool success = (*it)->setParam(tname, Ctemp);
3208 success = (*it)->setParam(tname2, Ktemp) || success;
3209 success = success && (*it)->processParams();
3217 bool success = (*it)->setParam(tname, Ctemp);
3218 success = (*it)->setParam(tname3, Ktemp) || success;
3219 success = success && (*it)->processParams();
3236 Parallel::Machine comm)
const
3238 int allDevsConv =
true;
3247 bool tmpBool = (*it)->isConverged();
3248 allDevsConv = allDevsConv && tmpBool;
3255 bool tmpBool = (*iter)->isConverged();
3256 allDevsConv = allDevsConv && tmpBool;
3260 Parallel::AllReduce(comm, MPI_LAND, &allDevsConv, 1);
3262 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
3266 dout() <<
"All devices converged!" << std::endl;
3270 dout() <<
"At least one device NOT converged!" << std::endl;
3274 return allDevsConv != 0;
3287 Parallel::Communicator & parallel_comm)
3289 if (Parallel::is_parallel_run(parallel_comm.comm()))
3293 int procID = parallel_comm.procID();
3294 int numProc = parallel_comm.numProc();
3296 int numExt = extern_device_vector.size();
3297 int numExtTotal = 0;
3298 parallel_comm.sumAll(&numExt, &numExtTotal, 1);
3304 if (numExtTotal > 0)
3306 extern_device_vector.resize(numExtTotal);
3309 for (
int proc = 0; proc < numProc; ++proc)
3314 parallel_comm.bcast(&cnt, 1, proc);
3316 for (
int i = 0; i < cnt; ++i)
3320 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*extern_device_vector[loc]);
3321 int size = Xyce::packedByteCount(extern_device.getInstanceBlock());
3322 int bufSize = size + 100;
3323 char *buf =
new char[bufSize];
3324 parallel_comm.bcast(&size, 1, proc);
3326 Xyce::pack(extern_device.getInstanceBlock(), buf, bufSize, pos, ¶llel_comm);
3327 parallel_comm.bcast(buf, size, proc);
3328 extern_device_vector[loc] = orig_extern_device_vector[i];
3334 parallel_comm.bcast(&size, 1, proc);
3335 int bufSize = size + 100;
3336 char *buf =
new char[bufSize];
3337 parallel_comm.bcast(buf, size, proc);
3340 Xyce::unpack(instance_block, buf, bufSize, pos, ¶llel_comm);
3344 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*extern_device_vector[loc]);
3345 extern_device.setOwningProc(proc);
3346 extern_device.setComm(¶llel_comm);
3351 assert(loc == numExtTotal);
3356 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
3359 for (InstanceVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
3361 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
3363 extern_device.setComm(¶llel_comm);
3381 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
3384 for (InstanceVector::const_iterator it = (*model_type_it).second.begin(); it != (*model_type_it).second.end(); ++it)
3386 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
3388 extern_device.runExternalDevice();
3402 ExternDevice::Instance *
3417 if (!model_type.defined())
3419 Report::UserError message;
3420 message <<
"Unable to determine type of device for instance name " << instance_block.
getInstanceName();
3423 message <<
" with model name " << instance_block.
getModelName();
3431 return static_cast<ExternDevice::Instance *
>(instance);
3481 (*iter)->acceptStep();
3510 bool bsuccess =
true;
3512 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
3515 int numExt = (*model_type_it).second.size();
3517 tleVec.resize(numExt);
3519 InstanceVector::const_iterator it = (*model_type_it).second.begin();
3520 for ( ; it != (*model_type_it).second.end(); ++it, ++iext)
3522 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
3524 bool bs1 = extern_device.getInitialQnorm(tleVec[iext]);
3525 bsuccess = bsuccess && bs1;
3541 std::vector<TimeIntg::TwoLevelError> & tleVec)
const
3543 bool bsuccess =
true;
3545 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
3548 int numExt = (*model_type_it).second.size();
3550 tleVec.resize(numExt);
3552 InstanceVector::const_iterator it = (*model_type_it).second.begin();
3553 for ( ; it != (*model_type_it).second.end(); ++it, ++iext)
3555 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
3557 bool bs1 = extern_device.getInnerLoopErrorSum(tleVec[iext]);
3558 bsuccess = bsuccess && bs1;
3575 bool bsuccess =
true;
3577 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
3580 InstanceVector::const_iterator it = (*model_type_it).second.begin();
3581 for ( ; it != (*model_type_it).second.end(); ++it)
3583 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
3585 bool bs1 = extern_device.updateStateArrays();
3586 bsuccess = bsuccess && bs1;
3602 bool beginIntegrationFlag,
3603 double nextTimeStep,
3607 bool bsuccess =
true;
3609 ModelTypeInstanceVectorMap::const_iterator model_type_it =
modelTypeInstanceVector_.find(ExternDevice::Traits::modelType());
3612 InstanceVector::const_iterator it = (*model_type_it).second.begin();
3613 for ( ; it != (*model_type_it).second.end(); ++it)
3615 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
3617 bool bs1 = extern_device.startTimeStep(
3618 beginIntegrationFlag,
3623 bsuccess = bsuccess && bs1;
3639 bool external_initJctFlag)
3657 int count =
sizeof(double) * (numdoubles);
3658 count +=
sizeof(size_t) * numSize_t;
3681 char * buf,
int bsize,
int & pos, N_PDS_Comm * comm,
bool pack)
const
3690 comm->pack(&(size), 1, buf, bsize, pos);
3696 int startIndex = pos;
3697 for(
int i = startIndex; i < (startIndex+count); ++i) buf[i] =
' ';
3700 std::ostringstream ost;
3701 ost.width(24);ost.precision(16);ost.setf(std::ios::scientific);
3707 dout() <<
"DeviceMgr::getRestartData: ltraTimeIndex = "
3709 <<
"DeviceMgr::getRestartData: ltraTimeHistorySize = "
3714 for (
int i=0;i<size;i++)
3719 dout() <<
"DeviceMgr::dumpRestartData: ltraTimePoints["<<i<<
"] ="
3724 std::string data(ost.str());
3725 for(
unsigned int i = 0; i < data.length(); ++i) buf[startIndex+i] = data[i];
3731 buf[startIndex+data.length()] =
'\0';
3732 pos += data.length();
3755 comm->unpack(buf, bsize, pos, &(size), 1);
3761 std::string str1(buf);
3762 int length = str1.size() - pos;
3763 std::string str2(str1,pos,length);
3765 std::istringstream ist(str2);
3771 dout() <<
"DeviceMgr::restoreRestartData: ltraTimeIndex = "
3773 <<
"DeviceMgr::restoreRestartData: ltraTimeHistorySize = "
3780 for (
int i=0;i<size;++i)
3785 dout() <<
"DeviceMgr::restoreRestartData: ltraTimePoints["<<i<<
"] = "
3802 EntityTypeIdDeviceMap::const_iterator begin,
3803 EntityTypeIdDeviceMap::const_iterator end,
3804 const std::string entity_name)
3806 for (EntityTypeIdDeviceMap::const_iterator it = begin; it != end; ++it)
3810 return device_entity;
3812 device_entity = (*it).second->findModel(
ModelName(entity_name));
3814 return device_entity;
3829 const std::string & full_param_name)
const
3831 std::string entity_name = Xyce::Util::entityNameFromFullParamName(full_param_name).getEncodedName();
3838 return device_entity;
3840 else if (!(*it).second)
3843 (*it).second = device_entity;
3844 return device_entity;
3847 return (*it).second;
3861 for (DeviceCountMap::const_iterator it = device_map.begin(), end = device_map.end(); it != end; ++it)
3887 const std::string setupIOName(
const InstanceName &entity_name)
3901 bool extractGlobalParamData(
3902 IO::PkgOptionsMgr & options_manager,
3903 IO::CircuitBlock & circuit_block,
3904 const std::string & netlist_filename,
3905 const IO::TokenVector & parsed_line)
3907 int numFields = parsed_line.size();
3910 if ( numFields < 4 )
3912 Report::UserError0().at(netlist_filename, parsed_line[0].lineNumber_)
3913 <<
".param line has an unexpected number of fields";
3917 if (circuit_block.isSubcircuit())
3919 Report::UserError().at(netlist_filename, parsed_line[0].lineNumber_)
3920 <<
"Attempt to assign global_param inside of subcircuit";
3924 Util::OptionBlock option_block(
"GLOBAL_PARAM", Util::OptionBlock::ALLOW_EXPRESSIONS,
3925 netlist_filename, parsed_line[0].lineNumber_);
3927 int linePosition = 1;
3929 Util::Param parameter(
"",
"");
3930 while ( linePosition < numFields )
3932 parameter.setTag( parsed_line[linePosition].string_ );
3934 if ( (parameter.uTag() ==
"TEMP") || (parameter.uTag() ==
"VT") ||
3935 (parameter.uTag() ==
"GMIN") || (parameter.uTag() ==
"TIME") )
3937 Report::UserError0().at(netlist_filename, parsed_line[linePosition].lineNumber_)
3938 <<
"Parameter name " << parameter.uTag() <<
" is not permitted";
3941 if ( linePosition + 2 >= numFields )
3943 Report::UserError0().at(netlist_filename, parsed_line[linePosition].lineNumber_)
3944 <<
"Unexpectedly reached end of line while looking for parameters in .PARAM statement";
3948 if ( parsed_line[ linePosition+1].string_ !=
"=" )
3950 Report::UserError0().at(netlist_filename, parsed_line[linePosition + 1].lineNumber_)
3951 <<
"Equal sign (=) required between parameter and value in .PARAM statement";
3956 if (parsed_line[linePosition].string_[0] ==
'{')
3958 Util::Expression expPtr(parsed_line[linePosition].string_);
3960 std::vector<std::string> junk;
3962 expPtr.get_names(XEXP_NODE, junk);
3963 if (junk.size() > 0)
3964 msg =
"Node Voltage";
3965 expPtr.get_names(XEXP_INSTANCE, junk);
3966 if (junk.size() > 0)
3967 msg =
"Device Current";
3968 expPtr.get_names(XEXP_LEAD, junk);
3969 if (junk.size() > 0)
3970 msg =
"Lead Current";
3973 Report::UserError0().at(netlist_filename, parsed_line[0].lineNumber_)
3974 << msg <<
" may not be used in parameter expression (" << parameter.tag() <<
")";
3976 parameter.setVal(parsed_line[linePosition].string_);
3982 ExtendedString tmp ( parsed_line[linePosition].string_ );
3983 if (tmp.possibleParam())
3984 parameter.setVal(std::string(
"{" + parsed_line[linePosition].string_ +
"}"));
3988 parameter.setVal(parsed_line[linePosition].string_);
3991 option_block.addParam( parameter );
3995 if ( linePosition < numFields && parsed_line[linePosition].string_ ==
"," )
4002 Util::ParamList::const_iterator paramIter = option_block.begin(), paramEnd = option_block.end();
4003 for ( ; paramIter != paramEnd; ++paramIter)
4005 ExtendedString P ( (*paramIter).tag() );
4007 if (!P.possibleParam())
4009 Report::UserError().at(netlist_filename, parsed_line[0].lineNumber_)
4010 <<
"Illegal parameter name: " << P;
4019 circuit_block.addGlobalParams(option_block);
4033 bool extractParamData(
4034 IO::PkgOptionsMgr & options_manager,
4035 IO::CircuitBlock & circuit_block,
4036 const std::string & netlist_filename,
4037 const IO::TokenVector & parsed_line)
4039 int numFields = parsed_line.size();
4042 if ( numFields < 4 )
4044 Report::UserError0().at(netlist_filename, parsed_line[0].lineNumber_)
4045 <<
".param line has an unexpected number of fields";
4049 Util::OptionBlock option_block(
"PARAM", Util::OptionBlock::ALLOW_EXPRESSIONS, netlist_filename, parsed_line[0].lineNumber_);
4051 int linePosition = 1;
4053 Util::Param parameter(
"",
"");
4054 while ( linePosition < numFields )
4056 parameter.setTag( parsed_line[linePosition].string_ );
4058 if ( (parameter.uTag() ==
"TEMP") || (parameter.uTag() ==
"VT") ||
4059 (parameter.uTag() ==
"GMIN") || (parameter.uTag() ==
"TIME") )
4061 Report::UserError0().at(netlist_filename, parsed_line[linePosition].lineNumber_)
4062 <<
"Parameter name " << parameter.uTag() <<
" is not permitted";
4065 if ( linePosition + 2 >= numFields )
4067 Report::UserError0().at(netlist_filename, parsed_line[linePosition].lineNumber_)
4068 <<
"Unexpectedly reached end of line while looking for parameters in .PARAM statement";
4072 if ( parsed_line[ linePosition+1].string_ !=
"=" )
4074 Report::UserError0().at(netlist_filename, parsed_line[linePosition + 1].lineNumber_)
4075 <<
"Equal sign (=) required between parameter and value in .PARAM statement";
4080 if (parsed_line[linePosition].string_[0] ==
'{')
4082 Util::Expression expPtr(parsed_line[linePosition].string_);
4084 std::vector<std::string> junk;
4086 expPtr.get_names(XEXP_NODE, junk);
4087 if (junk.size() > 0)
4088 msg =
"Node Voltage";
4089 expPtr.get_names(XEXP_INSTANCE, junk);
4090 if (junk.size() > 0)
4091 msg =
"Device Current";
4092 expPtr.get_names(XEXP_LEAD, junk);
4093 if (junk.size() > 0)
4094 msg =
"Lead Current";
4097 Report::UserError0().at(netlist_filename, parsed_line[0].lineNumber_)
4098 << msg <<
" may not be used in parameter expression (" << parameter.tag() <<
")";
4100 parameter.setVal(parsed_line[linePosition].string_);
4106 ExtendedString tmp ( parsed_line[linePosition].string_ );
4107 if (tmp.possibleParam())
4108 parameter.setVal(std::string(
"{" + parsed_line[linePosition].string_ +
"}"));
4112 parameter.setVal(parsed_line[linePosition].string_);
4115 option_block.addParam( parameter );
4119 if ( linePosition < numFields && parsed_line[linePosition].string_ ==
"," )
4126 for (Util::ParamList::const_iterator paramIter = option_block.begin(), paramEnd = option_block.end(); paramIter != paramEnd; ++paramIter)
4128 ExtendedString P ( (*paramIter).tag() );
4130 if (!P.possibleParam())
4132 Report::UserError().at(netlist_filename, parsed_line[0].lineNumber_)
4133 <<
"Illegal parameter name: " << P;
4142 circuit_block.addParams(option_block);
4162 options_manager.addCommandParser(
".PARAM", extractParamData);
4163 options_manager.addCommandParser(
".GLOBAL_PARAM", extractGlobalParamData);
4185 Parallel::Machine comm,
4186 const std::string & name)
const
4188 OpMap::const_iterator it =
opMap_.find(name);
4190 return (*it).second;
4192 Util::ParamList param_list;
4193 param_list.push_back(
Param(name,
""));
4194 Util::ParamList::const_iterator it = param_list.begin();
4211 Parallel::Machine comm,
4213 const std::string & name,
4216 Util::Op::Operator *op = device_manager.
getOp(comm, name);
4217 value = op ? (*op)(comm, Util::Op::OpData()).real() : 0.0;
4250 Parallel::Machine comm,
4252 const std::string & name)
4261 Report::DevelWarning() <<
4262 "DeviceMgr::getParamAndReduce. Unable to find parameter " << name;
4266 Report::UserError() <<
"Unable to find parameter " << name;
4352 Parallel::Machine comm,
4356 DeviceMgr & device_manager,
4359 const std::string & name,
4361 bool override_original)
4363 bool bsuccess =
true, success =
true;
4365 ArtificialParameterMap::iterator artificial_param_it = artificial_parameter_map.find(name);
4366 if (artificial_param_it != artificial_parameter_map.end())
4368 (*artificial_param_it).second->setValue(device_manager, value);
4372 GlobalParameterMap::iterator global_param_it = global_parameter_map.find(name);
4373 if (global_param_it != global_parameter_map.end())
4375 if ((*global_param_it).second != value)
4377 (*global_param_it).second =
value;
4378 EntityVector::iterator it = dependent_entity_vector.begin();
4379 EntityVector::iterator end = dependent_entity_vector.end();
4380 for ( ; it != end; ++it)
4382 if ((*it)->updateGlobalParameters(global_parameter_map))
4384 (*it)->processParams();
4385 (*it)->processInstanceParams();
4393 DeviceEntity * device_entity = device_manager.getDeviceEntity(name);
4395 int entity_found = (device_entity != 0);
4399 std::string paramName = Util::paramNameFromFullParamName(name);
4400 if (paramName ==
"")
4404 Xyce::dout() <<
" in DeviceMgr setParam, setting default parameter to " <<
value ;
4405 if (override_original)
4407 Xyce::dout() <<
" overriding original";
4409 Xyce::dout() << std::endl;
4411 found = device_entity->setDefaultParam(value, override_original);
4417 Xyce::dout() <<
" in DeviceMgr setParam, setting parameter "<< paramName
4418 <<
" to " << value << std::endl;
4420 found = device_entity->setParam(paramName, value);
4425 device_entity->processParams ();
4427 device_entity->processInstanceParams();
4430 entity_found = found;
4433 Parallel::AllReduce(comm, MPI_LOR, &entity_found, 1);
4435 if (entity_found == 0)
4439 Report::DevelWarning() <<
"DeviceMgr::setParam. Unable to find parameter " << name;
4443 Report::UserError() <<
"Unable to find parameter " << name;
4452 if (passthrough_parameter_map.find(name) != passthrough_parameter_map.end())
4454 InstanceVector::const_iterator it = extern_device_vector.begin();
4455 InstanceVector::const_iterator end = extern_device_vector.end();
4456 for ( ; it != end; ++it)
4458 ExternDevice::Instance &extern_device =
static_cast<ExternDevice::Instance &
>(*(*it));
4460 bool bs1 = extern_device.setInternalParam(name, value);
4480 const Util::Param & param)
4482 if (param.getType() == Util::EXPR)
4489 std::vector<std::string> variables;
4490 expression.get_names(XEXP_VARIABLE, variables);
4491 std::vector<std::string> specials;
4492 expression.get_names(XEXP_SPECIAL, specials);
4493 if (!specials.empty())
4495 expression.set_sim_time(solver_state.
currTime_);
4498 std::vector<std::string>::const_iterator it = variables.begin();
4499 std::vector<std::string>::const_iterator end = variables.end();
4500 for ( ; it != end ; ++it)
4506 expression.evaluateFunction(val);
4511 globals.
global_params[param.uTag()] = param.getImmutableValue<
double>();
4525 const std::string & name)
4527 GlobalParameterMap::const_iterator it = global_map.find(name);
4528 if (it != global_map.end())
4529 return &(*it).second;
std::vector< std::string > global_exp_names
const InstanceName & getName() const
bool setParam(const std::string &name, double val, bool overrideOriginal=false)
virtual void enableLeadCurrentCalc()
double * nextStaDerivVectorRawPtr
Linear::Vector * numJacSolVectorPtr_
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
Linear::Vector * bVecImagPtr
std::ostream & printDotOpOutput(std::ostream &os, const Device &device)
Linear::System * lasSysPtr
double * daeQVectorRawPtr
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_
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.
Linear::Vector * nextLeadCurrQCompPtr
bool loadErrorWeightMask(Linear::Vector *deviceMaskPtr)
bool initTranFlag_
RxnSet, TRA, LTRA, ACC, MOSFET, BJT, true only on very first(t=0) time step.
Linear::Vector * daeQVectorPtr
Linear::Vector * nextJunctionVCompPtr
InstanceVector instancePtrVec_
Pure virtual class to augment a linear system.
Devices and models are each named.
const InstanceVector & getDevices(ModelTypeId model_type_id) const
ModelTypeModelVectorMap modelGroupModelVector_
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 setupRawMatrixPointers_()
void initializeHomotopyBlockSize(int numBlocks)
double * currJunctionVCompRawPtr
DeviceMgr(Parallel::Machine comm, Topo::Topology &topology, Util::Op::BuilderManager &op_builder_manager, const IO::CmdParse &command_line)
Device * createDevice(const FactoryBlock &factory_block) const
Creates the specified device.
DeviceEntity * findDeviceEntity(EntityTypeIdDeviceMap::const_iterator begin, EntityTypeIdDeviceMap::const_iterator end, const std::string entity_name)
Linear::Vector * perturbVectorPtr
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
std::vector< DeviceEntity * > EntityVector
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 isLinearSystem_
True if all devices in netlist have isLinearDevice() true.
size_t ltraTimeIndex_
LTRA, DeviceMgr::acceptStep()
std::vector< Util::Expression > global_expressions
Topo::Topology & topology_
Topology.
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
const T & value(const ParameterBase &entity, const Descriptor &descriptor)
Returns the value of the parameter for the entity.
bool PDEcontinuationFlag_
PDE enable/disablePDSContinuation(), VsrcScaleParam, PDEBetaParam, PDEAlphaParam, Diode PDE Device...
Linear::Vector * diagonalVectorPtr_
Linear::Vector * lastJunctionVCompPtr
double * storeLeadCurrQCompRawPtr
bool parameterExists(Parallel::Machine comm, const std::string &name) const
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.
bool blockAnalysisFlag_
Source devices, BJTDW, This indicates an MPDE/HB run. This is true during both IC and MPDE/HB phase...
Linear::Vector * dQdxdVpVectorPtr
Linear::Vector * Fdx2VectorPtr
bool dotOpOutputRequested_
InstanceVector testJacDevicePtrVec_
Devices under jacobian test.
const double * findGlobalParameter(const GlobalParameterMap &global_map, const std::string &name)
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 registerPkgOptionsMgr(DeviceMgr &device_manager, IO::PkgOptionsMgr &options_manager)
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...
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 loadDAEMatrices(Linear::Vector *tmpSolVectorPtr, Linear::Vector *tmpStaVectorPtr, Linear::Vector *tmpStaDerivVectorPtr, Linear::Vector *tmpStoVectorPtr, Linear::Matrix *tmpdQdxMatrixPtr, Linear::Matrix *tmpdFdxMatrixPtr)
double * nextStoVectorRawPtr
Linear::Vector * JdxpVectorPtr
bool calcCouplingTerms(int iSubProblem, int iElectrode, const Linear::Vector *dxdvPtr)
double * currLeadCurrFCompRawPtr
DeviceSensitivities * devSensPtr_
bool setupSolverInfo(SolverState &solver_state, const Analysis::AnalysisManager &analysis_manager, bool all_devices_converged, const DeviceOptions &device_options, const Nonlinear::NonLinInfo &nonlinear_info)
unordered_set< std::string, HashNoCase, EqualNoCase > PassthroughParameterSet
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)
const std::string & getType() const
Linear::Vector * deviceErrorWeightMask_
Linear::Vector * nextStaVectorPtr
Linear::Vector * currLeadCurrFCompPtr
bool setInitialGuess(Linear::Vector *solVectorPtr)
Linear::Matrix * dFdxMatrixPtr
const ModelName & getModelName() const
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
configure all devices to load lead currents
int timeStepNumber_
Memristor, LTRA, TRA, testing if debug or jacobian for testing.
bool allDevicesConverged(Parallel::Machine comm) const
bool initializeAll(Linear::System &linear_system)
void setExternalSolverState(bool external_initJctFlag)
virtual bool plotfileFlag()
bool mpdeOnFlag_
MPDE phase of MPDE problem (ie not initial condition)
static const ModelTypeId modelType()
Returns the model type identifier.
EntityVector dependentPtrVec_
bool getBreakPoints(std::vector< Util::BreakPoint > &breakPointTimes)
Linear::Vector * numJacStoVectorPtr_
bool setACAnalysisParams(const Util::OptionBlock &option_block)
bool updatePrimaryState_()
AnalysisManager & analysisManager_
void addGlobalParameter(SolverState &solver_state, Globals &global, const Util::Param ¶m)
double * dQdxdVpVectorRawPtr
Class Configuration contains device configuration data.
size_t ltraTimeHistorySize_
LTRA, this looks like c code array sizing.
void setupNoiseSources(std::vector< Xyce::Analysis::NoiseData * > &noiseDataVec)
bool getFastSourceFlag() const
double * lastStaVectorRawPtr
void setVoltageLimiterStatus(bool voltageLimterStatus)
Linear::Vector * storeLeadCurrQCompPtr
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 * lastLeadCurrQCompRawPtr
double getMaxTimeStepSize()
bool getVoltageLimiterStatus()
bool setDeviceOptions(const Util::OptionBlock &option_block)
double defaultMaxTimeStep
mosfet homotopy:
double * lastJunctionVCompRawPtr
bool checkForZeroResistance
void addGlobalPar(const Util::Param ¶m)
bool analyticSensitivityAvailable(const std::string ¶mName)
bool externalInitJctFlag_
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:
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)
static void populateMetadata(IO::PkgOptionsMgr &options_manager)
const double * findGlobalPar(const std::string &name) const
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_
std::map< std::string, int, LessNoCase > DeviceCountMap
void updateExternalDevices_()
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_
std::vector< double > ltraTimePoints_
LTRA.
Linear::Vector * bVecRealPtr
bool getInnerLoopErrorSums(std::vector< TimeIntg::TwoLevelError > &tleVec) const
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
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 isPDESystem_
true if circuit includes a PDE device
double * lastLeadCurrFCompRawPtr
bool loadBVectorsforAC(Linear::Vector *bVecRealPtr, Linear::Vector *bVecImagPtr)
bool getAnalyticSensitivityDefaultParam(std::vector< double > &dfdpVec, std::vector< double > &dqdpVec, std::vector< double > &dbdpVec, std::vector< int > &FindicesVec, std::vector< int > &QindicesVec, std::vector< int > &BindicesVec)
bool updateTemperature(double val)
void notify(const Analysis::StepEvent &event)
double acceptedTime_
DeviceMgr::acceptStep(), DAC (for habanero)
DeviceVector devicePtrVec_
const std::string & getDeviceName() const
Decodes the device name.
bool analyticSensitivityAvailableDefaultParam()
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
Linear::Vector * currStoVectorPtr
bool verifyDeviceInstance(const InstanceBlock &IB)
double * currSolVectorRawPtr
PassthroughParameterSet passthroughParameterSet_
Parameters to pass through to external devices when set.
bool deleteDeviceInstance(const std::string &name)
Util::Op::BuilderManager & opBuilderManager_
Linear::Vector * currLeadCurrQCompPtr
unordered_map< std::string, ArtificialParameters::ArtificialParameter *, HashNoCase, EqualNoCase > ArtificialParameterMap
DeviceVector pdeDevicePtrVec_
InstanceVector nonPdeInstancePtrVec_
GlobalParameterMap global_params
ModelBlock represents a .MODEL line from the netlist.
Linear::Matrix * JTestMatrixPtr
bool testJacDeviceNameGiven
MatrixLoadData matrixLoadData_
temporary jacobian load structures:
Linear::Matrix * QTestMatrixPtr
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 currTime_
DeviceEntity for expression time, breakpoints DeviceMgr for dependent parameters, breakpoints...
Util::Param temp
operating temperature of ckt.
std::vector< Param > params
const std::string & getDeviceType() const
Decodes the device type.
Linear::Matrix * dQdxMatrixPtr
double * lastSolVectorRawPtr
bool defaultNewExcessPhase
default is true for MPDE, false for non-MPDE.
std::vector< double > registerFastSources(Parallel::Machine comm, const std::vector< std::string > &sourceNames)
bool registerSensParams(const Util::OptionBlock &option_block)
ModelTypeInstanceVectorMap modelGroupInstanceVector_
double * lastStoVectorRawPtr
bool firstDependent_
True until updateDependentParameters_ is called.
Linear::Vector * numJacQVectorPtr
Linear::Vector * Qdx2VectorPtr
bool getInitialQnorm(std::vector< TimeIntg::TwoLevelError > &tleVec)
void getLIDs(int &lpos, int &lneg, int &lbra)
Linear::Vector * flagSolVectorPtr
double currFastTime_
Source devices,.
Linear::Vector * nextStaDerivVectorPtr
double * nextSolVectorRawPtr
bool updateSecondaryState_()
bool outputPlotFiles(bool force_final_output)
double * currLeadCurrQCompRawPtr