46 #ifndef Xyce_N_DEV_Pars_h
47 #define Xyce_N_DEV_Pars_h
154 virtual void operator()(
156 const std::string ¶m,
157 std::vector<double> & dfdp,
158 std::vector<double> & dqdp,
159 std::vector<double> & dbdp,
160 std::vector<int> & Findices,
161 std::vector<int> & Qindices,
162 std::vector<int> & Bindices
173 : originalValueMap_(),
187 return originalValueMap_[serial_number];
192 originalValueMap_[serial_number] =
value;
197 return givenValueSet_.find(serial_number) != givenValueSet_.end();
203 givenValueSet_.insert(serial_number);
205 givenValueSet_.erase(serial_number);
223 inline std::ostream &
printEntry(std::ostream &os,
const Entry<std::vector<T> > &entry);
233 void typeMismatch(
const std::type_info &from_type,
const std::type_info &to_type);
278 virtual const std::type_info &type()
const = 0;
289 std::ostream &
print(std::ostream &os)
const
306 virtual std::ostream &doPrint(std::ostream &os)
const = 0;
317 class Entry :
public Entry<void>
334 : defaultValue_(default_value),
335 memberValuePtr_(member_value_ptr)
357 virtual const std::type_info &
type()
const
373 virtual std::ostream &
doPrint(std::ostream &os)
const
390 return memberValuePtr_;
405 return entity.*memberValuePtr_;
420 return entity.*memberValuePtr_;
434 entity.*memberValuePtr_ =
value;
453 return defaultValue_;
472 defaultValue_ =
value;
497 if (entry.
type() !=
typeid(T))
500 return static_cast<const Entry<T> &
>(entry);
519 if (entry.
type() !=
typeid(T))
522 return static_cast<Entry<T> &
>(entry);
559 originalValueFlag_(false),
566 compositeParametricData_(0),
568 sensitivityAvailable_(false),
600 return entry_->type() ==
typeid(T);
602 return typeid(T) ==
typeid(
int);
607 return compositeParametricData_ != 0;
620 originalValueFlag_ = original_value_flag;
634 return originalValueFlag_;
647 expressionAccess_ = expression_access;
661 return expressionAccess_;
700 category_ = category;
727 description_ = description;
756 compositeParametricData_ = composite_parametric_data;
842 serialNumber_ = serial_number;
856 return serialNumber_;
875 return entry.getValue(entity);
893 return entry.getValue(entity);
909 return entry.getMemberPtr();
956 if (hasGivenMember())
958 return entity.*given_;
978 if (hasGivenMember())
980 entity.*given_ =
value;
995 sensitivityAvailable_ =
value;
1016 return sensitivityAvailable_;
1030 const std::string & name,
1031 std::vector<double> & dfdp, std::vector<double> & dqdp, std::vector<double> & dbdp,
1032 std::vector<int> & Findices, std::vector<int> & Qindices, std::vector<int> & Bindices)
const
1036 sensPtr_->operator()(entity1, name, dfdp, dqdp, dbdp, Findices, Qindices, Bindices);
1075 os << entry.getDefaultValue();
1094 for (
typename std::vector<T>::const_iterator it = entry.getDefaultValue().begin(); it != entry.getDefaultValue().end(); ++it)
1095 os << (*it) << std::endl;
1112 inline std::ostream &
printEntry(std::ostream &os,
const Entry<std::map<std::string, T> > &entry)
1114 for (
typename std::map<std::string, T>::const_iterator it = entry.getDefaultValue().begin(); it != entry.getDefaultValue().end(); ++it)
1115 os << (*it).first << std::endl;
1134 os <<
"'" << entry.getDefaultValue() <<
"'";
1153 os << (entry.getDefaultValue() ?
"true" :
"false");
1171 for (CompositeMap::const_iterator it = entry.getDefaultValue().begin(); it != entry.getDefaultValue().end(); ++it)
1172 os << (*it).first <<
": " << (*it).second << std::endl;
1192 return entry.getDefaultValue();
1209 entry.setDefaultValue(t);
1228 return entry.getValue(entity);
1247 return entry.getValue(entity);
1262 template <
class T,
class U>
1267 return entry.getValue(entity);
1280 template <
class T,
class U>
1285 entry.setValue(entity, value);
1324 for (ParameterMap::iterator it = map_.begin(); it != map_.end(); ++it)
1325 delete (*it).second;
1370 void addDescriptor(
const std::string &name,
Descriptor *descriptor,
const std::type_info ¶meter_data_class);
1428 template<
class T,
class U>
1433 addDescriptor(parName, descriptor,
typeid(C));
1458 addDescriptor(parName, descriptor,
typeid(C));
1484 template<
class T,
class U>
1498 addDescriptor(parName, descriptor,
typeid(C));
1537 addDescriptor(parName, descriptor,
typeid(C));
1552 template<
class U,
class V>
1561 addDescriptor(comp_name, descriptor,
typeid(C));
1576 template<
class U,
class V>
1584 addDescriptor(comp_name, descriptor,
typeid(C));
1599 for (
int i = 1; i <= len; ++i)
1601 std::ostringstream oss;
1603 std::string param = oss.str();
1605 ParameterMap::iterator it = map_.find(param);
1606 if (it == map_.end())
1629 void setDefaultParameters(ParameterBase ¶meter_base, ParameterMap::const_iterator begin, ParameterMap::const_iterator end,
const DeviceOptions &device_options);
1707 return equal_nocase(name,
"TNOM") || equal_nocase(name,
"TEMP");
1713 #endif // Xyce_N_DEV_Pars_h
const Entry< void > & getEntry() const
Gets the entry object of the parameter.
bool ParameterBase::* given_
Pointer to given bool, usually 0.
int getVec() const
Gets the vector length of a vectorized parameter.
virtual const std::type_info & type() const
Returns type_info of this entry.
Descriptor & setSensitivityFunctor(const baseSensitivity *sensPtr)
virtual ~Entry()
Destroys the entry.
Descriptor & setVec(int index)
sets the vector length of an vectorized parameter
void setOriginalValue(ParameterBase ¶meter_base, int serial_number, double value)
Set a parameter's original value.
Descriptor & addPar(const char *parName, T default_value, T U::*varPtr)
Adds the parameter description to the parameter map.
Descriptor & setCompositeParametricData(const ParametricData< void > *composite_parametric_data)
Sets the composite parametric.
void nonexistentParameter(const std::string &name, const std::type_info &entity_type)
Report casting error when attempting to cast from from_type to to_type.
int vec_
If > 0 specifies a vector of params.(eg: if = 3 then IC becomes IC1, IC2, IC3)
double getOriginalValue(int serial_number)
Descriptor & setExpressionAccess(ExprAccess expression_access)
Sets the expression access which describe the usage of the parameter.
Pure virtual class to augment a linear system.
void typeMismatch(const std::type_info &from_type, const std::type_info &to_type)
Report casting error when attempting to cast from from_type to to_type.
OriginalValueMap originalValueMap_
Map from device entity and original value index to original value.
Parameter may be specified as time dependent expression from netlist.
void setDefaultValue(const T &value)
Sets the parameter's default value.
ParameterUnit unit_
Unit designator for documentation.
bool originalValueFlag_
Flag indicating original value was stored.
std::map< int, double > OriginalValueMap
virtual ~ParametricData()
Destroys the parameter data map.
unordered_map< std::string, Descriptor *, HashNoCase, EqualNoCase > ParameterMap
void makeVector(const std::string &cname, int len)
Allows the parameter to be specified as a vector.
Base class for all parameters.
Descriptor & setAnalyticSensitivityAvailable(bool value)
Sets a boolean to indicate if analytic sensitivities are available w.r.t. this parameter.
Parameter can only be set to a constant from netlist.
Parameter is subject to being set to minimum junction capacitance.
bool wasValueGiven(int serial_number) const
ParametricData()
Constructs a ParametricData object.
std::string description_
Description of parameter for documentation.
bool getAnalyticSensitivityAvailable() const
returns a boolean to indicate if analytic sensitivities are available w.r.t. this parameter...
Parameter is subject to being set to minimum lead resistance.
Descriptor & setSerialNumber(int serial_number)
Sets the serial number used to store and retrieve given boolean from the GivenValueMap.
void setValue(ParameterBase &entity, const Descriptor &descriptor, const T &value)
Sets the value of the parameter.
bool getGiven(ParameterBase &entity) const
Tests if the parameter has been given by the netlist.
int serialNumber_
Unique identifier of descriptor.
T & value(ParameterBase &entity, const Descriptor &descriptor)
Returns the value of the parameter for the entity.
bool isTempParam(const std::string &name)
Returns true if the name is TNOM or TEMP.
const ParametricData< void > * compositeParametricData_
If a composite, then this points to the ParameterData of the composite.
virtual ~ParametricData()
Destroys a ParametricData object.
std::ostream & printEntry(std::ostream &os, const Entry< std::map< std::string, T > > &entry)
Prints the entry default values of a map parameter.
const std::string & getDescription() const
Gets the description of the parameter, only used to document the parameter.
double getOriginalValue(ParameterBase ¶meter_base, int serial_number)
Retrieve a parameter's original value.
std::ostream & print(std::ostream &os) const
Prints the value of the entry to the output stream.
bool hasGivenMember() const
Tests if parameter has a given data member.
ExprAccess expressionAccess_
Flags for parameter attributes, such as whether can be input by user, may depend on time...
void addComposite(const char *comp_name, const ParametricData< U > &composite_pars, std::map< std::string, U * > V::*composite_map)
Adds a composite parameter to the parameter map.
Parameter is not to be documented.
const T & getDefaultValue(const Descriptor &descriptor)
Gets the default value of the parameter.
Entry< T > & entry_cast(Entry< void > &entry)
Casts the entry to type T.
const T & getValue(const ParameterBase &entity) const
Return the value of the entity's parameter.
const T & value(const ParameterBase &entity) const
Returns the value of the parameter for the entity.
const baseSensitivity * sensPtr_
pointer to the sensitivity functor
const T & getDefaultValue() const
Return the default value of the parameter.
std::set< int > GivenValueSet
Class ParametricData manages the configuration information and the parameter binding map...
Entry< void > *const entry_
Pointer to entry which contains the value.
ExprAccess getExpressionAccess() const
Gets the expression access which describes the usage of the paramter.
Entry()
Constructs the Entry base class.
Descriptor & setOriginalValueStored(bool original_value_flag)
Sets a boolean marking an original value having been stored.
Parameter uses temperature interpolation based on log of value.
Descriptor(Entry< void > *const entry)
Constructs Descriptor.
void setValueGiven(ParameterBase ¶meter_base, int serial_number, bool value)
Set the given value state of a parameter.
const ParametricData< U > * getCompositeParametricData() const
Return the composite parameter.
Descriptor & setCategory(ParameterCategory category)
Sets the category of the parameter, only used to document the parameter.
Class Descriptor describes the parameters stored in the ParametricData parameter map.
void setDefaultParameters(ParameterBase ¶meter_base, ParameterMap::const_iterator begin, ParameterMap::const_iterator end, const DeviceOptions &device_options)
Set the default values for the parameter.
GivenValueSet givenValueSet_
Map from device entity and serial number to value given flag.
bool wasValueGiven(const ParameterBase ¶meter_base, int serial_number)
Return true if a value was provided for the device.
const ParameterMap & getMap() const
Returns the parameter binding map.
bool hasCompositeData() const
virtual ~Entry()
Destroys Entry.
T ParameterBase::* getMemberPtr() const
Return the member pointer to the data member variable that holds the value associated with this param...
bool getAnalyticSensitivity(const ParameterBase &entity1, const std::string &name, std::vector< double > &dfdp, std::vector< double > &dqdp, std::vector< double > &dbdp, std::vector< int > &Findices, std::vector< int > &Qindices, std::vector< int > &Bindices) const
returns analytic sensitivity, evaluated at the most recent solve point.
bool hasOriginalValueStored() const
Returns whether an original value has been stored.
T ParameterBase::* memberValuePtr_
Member pointer containing value.
int getSerialNumber() const
Gets the serial number used to store and retireve given boolean fromt he GivenValueMap.
bool sensitivityAvailable_
Flag indicating that analytic sensitivity is available for this param.
ParameterCategory category_
Category designator for documentation.
void setGiven(ParameterBase &entity, bool value) const
Sets the given state of the parameter to value.
Descriptor & setDescription(const std::string &description)
Sets the description of the parameter, only used to document the parameter.
Descriptor & setGivenMember(bool U::*given)
Sets the boolean member variable to set if the netlist provides the value.
ParameterUnit getUnit() const
Gets the units of the parameter, only used to document the parameter.
T & getValue(ParameterBase &entity) const
Return the value of the entity's parameter.
ParametricData()
Constructs the parameter data map.
virtual ~Descriptor()
Destroy Descriptor.
void setValue(ParameterBase &entity, const T &value) const
Sets the value of the entity's parameter.
ParameterMap map_
Mapping from parameter name to descriptor.
void addPar(const char *parName, const char *def, bool orig, ParameterType::ExprAccess depend, std::string U::*varPtr, bool U::*givenPtr, ParameterUnit unit, ParameterCategory category, const char *description)
Adds the parameter description to the parameter map.
T & value(ParameterBase &entity) const
Returns the value of the parameter for the entity.
Descriptor & addPar(const char *parName, const char *default_value, std::string U::*varPtr)
Adds the parameter description to the parameter map.
bool isType() const
Tests entry data type.
T defaultValue_
Default value of parameter.
virtual ~baseSensitivity()
void addPar(const char *parName, T def, bool orig, ParameterType::ExprAccess depend, T U::*varPtr, bool U::*givenPtr, ParameterUnit unit, ParameterCategory category, const char *description)
Adds the parameter description to the parameter map.
Base sensitivity functor.
virtual std::ostream & doPrint(std::ostream &os) const
Prints the value of the entry to the output stream.
Descriptor & setUnit(ParameterUnit unit)
Sets the units of the parameter, only used to document the parameter.
ParameterType::ExprAccess is enumeration of parameter usage types and masks.
void setOriginalValue(int serial_number, double value)
Parameter may be specified as a solution dependent expression from netlist.
Manages parameter binding for class C.
Class Entry defines the parameter binding value entry interface.
void checkExprAccess(const std::string &name, ParameterType::ExprAccess &expr_access, const std::type_info ¶meter_data_class)
Report error if both MIN_CAP and MIN_RES have been specified.
Class Entry defines the parameter member variable access for parameter member variable of type T...
ParameterCategory getCategory() const
Gets the category of the parameter, only used to document the parameter.
ParameterMap & getMap()
Gets the parameter binding map map.
virtual const std::type_info & type() const =0
Returns the type_info of the data type being stored in the entry.
void addComposite(const char *comp_name, const ParametricData< U > &composite_pars, std::vector< U * > V::*composite_vector)
Adds a composite vector parameter to the parameter map.
T ParameterBase::* getMemberPtr() const
Returns the parameter member variable pointer of the enrtry.
Entry< void > & getEntry()
Gets the entry object of the parameter.
const T & getValue(const ParameterBase &entity, const Descriptor &descriptor)
Gets the value of the parameter for the entity.
void setValueGiven(int serial_number, bool value)
void setDefaultValue(Descriptor &descriptor, const T &t)
Sets the default value of the parameter.
Entry(T ParameterBase::*member_value_ptr, const T &default_value=T())
Constructs an Entry.