46 #ifndef Xyce_N_DEV_Configuration_h
47 #define Xyce_N_DEV_Configuration_h
49 #if defined(HAVE_UNORDERED_MAP)
50 #include <unordered_map>
51 using std::unordered_map;
52 #elif defined(HAVE_TR1_UNORDERED_MAP)
53 #include <tr1/unordered_map>
54 using std::tr1::unordered_map;
56 #error neither unordered_map or tr1/unordered_map found
71 template<
class M,
class G>
164 template <
class M,
class I,
class G>
318 const IO::CmdParse & command_line)
468 const char * device_type_name,
469 const char * instance_default_parameter_name,
471 int num_optional_nodes,
476 const char * primary_parameter)
725 void addDevice(
const char *model_name,
const int model_level,
ModelTypeId model_type_id,
ModelTypeId model_group_id,
int model_type_nodes,
int model_group_nodes);
764 template<
class T,
class G>
817 ModelTraits::numNodes(), ModelTraits::numOptionalNodes(), ModelTraits::numFillNodes(), ModelTraits::modelRequired(),
818 ModelTraits::isLinearDevice(), ModelTraits::isPDEDevice(), ModelTraits::primaryParameter()),
862 addDevice(device_name, level, ModelTraits::modelType(), ModelTraits::modelGroup(), ModelTraits::numNodes(), ModelGroupTraits::numNodes());
886 addModel(model_name, level, ModelTraits::modelType(), ModelTraits::modelGroup());
909 return ModelTraits::instanceType();
930 return ModelTraits::modelType();
948 return ModelTraits::modelGroup();
971 return ModelTraits::factory(*
this, factory_block);
982 #endif // Xyce_N_DEV_Configuration_h
ModelGroupType_< M, G >::GroupType_ ModelGroupType
Make model group template parameter available.
bool getModelRequired() const
Returns true of the model must be specified when defining an instance of this device.
ParametricData< void > & getModelParameters() const
Returns the model parameter descriptions.
int getNumFillNodes() const
Returns the number of fill nodes of this device.
virtual ModelTypeId modelType() const
Returns the model type identifier.
virtual InstanceTypeId instanceType() const
Returns the instance type identifier.
int numNodes_
Number of nodes of this device.
Device * factory(const FactoryBlock &factory_block) const
Calls the device creation function.
const DeviceOptions & deviceOptions_
Config template derives from the Configuration class and provides the instance and model parameter de...
FactoryBlock(const DeviceMgr &device_manager, const DeviceOptions &device_options, const SolverState &solver_state, MatrixLoadData &matrix_load_data, const ExternData &extern_data, const IO::CmdParse &command_line)
The FactoryBlock constructs serves to pass data to the device factory functions.
bool linearDevice_
True if model is a linear device.
static bool modelRequired()
By default, model is not required.
bool getPDEDevice() const
Returns true of the model is a PDE device.
Config< T > & registerDevice(const char *device_name, const int level)
Adds the device into the device registry giving it the specified device name and level.
void addDevice(const char *model_name, const int model_level, ModelTypeId model_type_id, ModelTypeId model_group_id, int model_type_nodes, int model_group_nodes)
Adds the device to the configuration.
const ExternData & externData_
void G(const ScalarT &V1, const ScalarT &V2, const ScalarT &Ap, const ScalarT &An, ScalarT &Vp, ScalarT &Vn, ScalarT &fval)
Pure virtual class to augment a linear system.
static const InstanceTypeId instanceType()
Returns the instance type identifier.
const std::string & getPrimaryParameter() const
Returns the default primary parameter of this device or the empty string if there is no primary param...
ParametricData< typename ModelTraits::InstanceType > instanceParameters__
Instance parameter description.
Device * createDevice(const FactoryBlock &factory_block) const
Creates the specified device.
static const char * primaryParameter()
By default, there is no primary parameter.
static bool isLinearDevice()
Linear device flag must be provided in the deriving class.
type_index InstanceTypeId
int getNumOptionalNodes() const
Returns the number of optional nodes of this device.
const std::string & getDeviceTypeName() const
Returns the device type name.
G ModelGroupTraits
Make model group traits template parameter available.
Config()
Creates the configuration object, populating the instance and model parameter definitions from the Tr...
static const Configuration * findConfiguration(ModelTypeId model_type_id)
Returns the configuration associated with the device name and level or 0 if not found.
Config & operator=(const Config< T > &)
No assignment.
virtual ~Config()
Destroys the Config.
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
int numFillNodes_
Number of fill nodes of this device.
const DeviceMgr & deviceManager_
M ModelType
Make model template parameter available.
virtual Device * factory(const FactoryBlock &factory_block) const =0
Overriding function creates an instance this device.
static ModelTypeId getModelGroup(const std::string &device_name)
Returns the model group of the device name.
ParametricData< void > & modelParameters_
Reference to the Model specific parameter map.
ParametricData< void > & getInstanceParameters() const
Returns the instance parameter descriptions.
const IO::CmdParse & commandLine_
const std::string deviceTypeName_
Type name of the device.
Class ParametricData manages the configuration information and the parameter binding map...
static Config< T > & addConfiguration()
Adds the device to the Xyce device configuration.
ParametricData< typename ModelTraits::ModelType > modelParameters__
Model parameter description.
The Device class is an interface for device implementations.
static int numNodes()
Number of nodes must be provided in the deriving class.
std::string primaryParameter_
Primary parameter name or the empty string if none.
std::vector< std::string > modelTypeNames_
Vector of defined model type of this device's model.
static const ModelTypeId modelType()
Returns the model type identifier.
bool pdeDevice_
True if model is a PDE device.
const SolverState & solverState_
virtual InstanceTypeId instanceType() const =0
Returns the instance type identifier.
Class Configuration contains device configuration data.
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
Creates a device via the device template.
ParametricData< void > & instanceParameters_
Reference to the Instance specific parameter map.
const std::string instanceDefaultParameterName_
Default parameter name for the device instance.
Config< T > & registerModelType(const char *model_name, const int level)
Adds a model type name and level to the device model type list.
int numOptionalNodes_
Number of optional nodes of this device.
const std::string name_
Name of the devive.
static const ModelTypeId modelGroup()
Returns the model group identifier.
Configuration & operator=(const Configuration &)
No assignment allowed.
int getNumNodes() const
Returns the number of nodes of this device.
bool modelRequired_
True if model is required.
static const ConfigurationMap & getConfigurationMap()
Returns the configuration map of the system.
ModelGroupTraits_< T, typename T::ModelGroupTraits >::GroupTraits_ ModelGroupTraits
unordered_map< NameLevelKey, Configuration * > ConfigurationMap
virtual ModelTypeId modelType() const =0
Returns the model type identifier.
MatrixLoadData & matrixLoadData_
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...
static int numFillNodes()
Default number of fill nodes.
I InstanceType
Make instance template parameter available.
Configuration(ParametricData< void > &instance_parameters, ParametricData< void > &model_parameters, const char *name, const char *device_type_name, const char *instance_default_parameter_name, int num_nodes, int num_optional_nodes, int num_fill_nodes, bool model_required, bool linear_device, bool pde_device, const char *primary_parameter)
Populates the device configuration object.
static bool isPDEDevice()
By default, device is not a PDE device.
static const char * instanceDefaultParameter()
By default, there is no instance default parameter.
virtual ModelTypeId modelGroup() const
Returns the model group identifier.
const std::string & getName() const
Returns the device name.
The DeviceTraits template describes the configuration of a device.
virtual ModelTypeId modelGroup() const =0
Returns the model group identifier.
const std::string & getInstanceDefaultParameterName() const
Returns the instance default parameter name.
const std::vector< std::string > & getModelTypeNames() const
Returns a vector of strings that name all the model types defined of this model.
static int numOptionalNodes()
Default number of optional nodes.
void addModel(const char *model_name, const int level, ModelTypeId model_type_id, ModelTypeId model_group_id)
Adds a model name for the device to the configuration.
bool getLinearDevice() const
Returns true of the model is a linear device.