19 #ifndef LIMPET_ION_TYPE_H 20 #define LIMPET_ION_TYPE_H 31 constexpr
inline T
max(T a, T b ){
return a > b ? a : b; }
33 constexpr
inline T
min(T a, T b ){
return a < b ? a : b; }
43 #include "ION_IF_datatypes.h" 70 IonType(std::string name,
bool plugin) : _name(
std::move(name)), _plugin(plugin) {}
106 virtual uint32_t
reqdat()
const = 0;
113 virtual uint32_t
moddat()
const = 0;
136 virtual void destroy(IonIfBase& imp)
const = 0;
188 virtual void trace(IonIfBase& imp,
int node, FILE* file,
GlobalData_t** data)
const = 0;
196 virtual void tune(IonIfBase& imp,
const char* im_par)
const = 0;
205 virtual int read_svs(IonIfBase& imp, FILE* file)
const = 0;
214 virtual int write_svs(IonIfBase& imp, FILE* file,
int node)
const = 0;
251 virtual int get_sv_type(
const char* svname,
int* type,
char** type_name)
const = 0;
271 const std::vector<std::reference_wrapper<IonType>>& plugins)
const = 0;
297 #endif // LIMPET_ION_TYPE_H constexpr T min(T a, T b)
GlobalData_t(* SVgetfcn)(IonIfBase &, int, int)
void state_type
type of this model's state variable structure
const std::string & get_name() const
Gets the model name.
bool operator!=(const IonType &other) const
virtual void print_params() const =0
Prints the parameters of this model.
virtual void initialize_sv(IonIfBase &imp, GlobalData_t **data) const =0
Initializes the state variables of the given IMP.
std::vector< std::reference_wrapper< IonType > > IonTypeList
constexpr T max(T a, T b)
virtual void trace(IonIfBase &imp, int node, FILE *file, GlobalData_t **data) const =0
Write the values of traced variables to file.
virtual size_t params_size() const =0
Gets the size in bytes needed to represent the parameters of this model.
void(* SVputfcn)(IonIfBase &, int, int, GlobalData_t)
virtual int get_sv_type(const char *svname, int *type, char **type_name) const =0
Determines the type of a SV.
virtual void initialize_params(IonIfBase &imp) const =0
Initializes the parameters in the given IMP.
virtual int write_svs(IonIfBase &imp, FILE *file, int node) const =0
Write state variable values for one cell to a file/.
virtual int read_svs(IonIfBase &imp, FILE *file) const =0
Reads state variable values for one cell from a file.
virtual void destroy_ion_if(IonIfBase *imp) const =0
Destroy an IonIf object.
virtual void destroy(IonIfBase &imp) const =0
Destroys the given IMP.
virtual uint32_t moddat() const =0
Gets data flags for this IMP's modified data.
virtual Target select_target(Target target) const =0
Gets a supported target from the given target.
void params_type
type of this model's parameter structure
bool operator==(const IonType &other) const
Represents the ionic model and plug-in (IMP) data structure.
IonType * get_ion_type(const std::string &name)
virtual IonIfBase * make_ion_if(Target target, int num_node, const std::vector< std::reference_wrapper< IonType >> &plugins) const =0
Generate an IonIf object from this type.
virtual void tune(IonIfBase &imp, const char *im_par) const =0
Handles setting of this model's parameters.
virtual int get_sv_list(char ***list) const =0
Returns a list of SVs.
virtual size_t dlo_vector_size() const =0
Gets the vector size when using data layout optimization (DLO).
virtual uint32_t reqdat() const =0
Gets data flags for this IMP's required data.
virtual void print_metadata() const =0
Prints the metadata of this model.
virtual void construct_tables(IonIfBase &imp) const =0
Contructs lookup tables.
void private_type
type of this model's private structure
Defines valid targets for an ionic model to run on and an allocator for allocating memory on a specif...
Target
enum that represents different targets to run ionic models on.
IonType(std::string name, bool plugin)
virtual bool has_trace() const =0
Returns whether the trace method is available or not.
virtual void compute(Target target, int start, int end, IonIfBase &imp, GlobalData_t **data) const =0
Performs computation for 1 time step.
Abstract class representing an ionic model type.
bool is_plugin() const
Returns whether this model is a plugin or not.
virtual SVgetfcn get_sv_offset(const char *svname, int *off, int *sz) const =0
Get the offset and size of a state variable of the model, as well as an access function.