30#include "componant/componant.h"
49 Componant *processBrackets(std::string& str,
size_t& bracketCounter,
size_t paramSweepCount,
bool defaultToRange);
50 Componant *processBracket(std::string& str,
size_t paramSweepCount,
bool defaultToRange);
51 std::string getParamStr(
const std::string& str,
size_t index);
52 static size_t paramSkipIndex(
const std::string& str,
size_t index);
53 static void addComponantToFlat(
Componant* componant, std::vector<Componant*>* flatComponants);
55 static void sweepThreadFn(std::vector<std::vector<DataPoint>>* data,
Model* model,
size_t start,
size_t stop,
const std::vector<fvalue>& omega);
57 size_t getActiveParameterCount();
61 std::vector<Componant*> _bracketComponants;
62 std::string _modelStr;
63 std::vector<Componant*> _flatComponants;
64 std::string _modelUuid;
65 CompiledObject* _compiledModel =
nullptr;
77 Model(
const std::string& str,
size_t paramSweepCount = 100,
bool defaultToRange =
true);
119 std::vector<DataPoint>
executeSweep(
const std::vector<fvalue>& omega,
size_t index = 0);
129 std::vector<std::vector<DataPoint>>
executeSweeps(
const Range& omega,
const std::vector<size_t>& indecies,
bool parallel =
false);
139 std::vector<std::vector<DataPoint>>
executeSweeps(
const std::vector<fvalue>& omega,
const std::vector<size_t>& indecies,
bool parallel =
false);
Definition componant.h:33
Basic singular EIS data point.
Definition eistype.h:47
The main class of eisgenerator representing an equivalent circuit model.
Definition model.h:47
std::vector< Componant * > getFlatComponants(Componant *model=nullptr)
Returns a vector of pointers to the circuit elements in this model.
std::vector< DataPoint > executeSweep(const Range &omega, size_t index=0)
Executes a frequency sweep along the given range.
std::string getCompiledFunctionName() const
Gets the function name in the code for this model.
std::vector< fvalue > getFlatParameters()
Gets the values of the parameters of the circuit elements at the current parameter sweep step.
std::vector< std::vector< DataPoint > > executeSweeps(const std::vector< fvalue > &omega, const std::vector< size_t > &indecies, bool parallel=false)
Executes a frequency and parameter sweep at the given parameter indecies.
Model(const std::string &str, size_t paramSweepCount=100, bool defaultToRange=true)
Constructor.
std::vector< std::vector< DataPoint > > executeSweeps(const Range &omega, const std::vector< size_t > &indecies, bool parallel=false)
Executes a frequency and parameter sweep at the given parameter indecies.
std::vector< Range > getDefaultParameters()
Gets the default ranges of the parameters of each type of circuit element used in the model.
std::string getModelStr() const
Returns the model string corresponding to this model object, without embedded parameters.
bool isReady()
This member determines if the model is in a state ready to execute.
std::string getTorchScript()
Compiles this model into TorchScript.
std::string getModelStrWithParam(size_t index)
Returns the model string corresponding to this model object, with embedded parameters.
std::vector< Range > getFlatParameterRanges()
Gets the ranges of the parameters of the circuit elements.
std::vector< size_t > getRecommendedParamIndices(eis::Range omegaRange, double distance, bool threaded=false)
Gets a set of indecies that together create a iso-difference set of spectra.
size_t getRequiredStepsForSweeps()
Gets the total number of parameter sweep steps for the applied sweep.
std::string getModelStrWithParam() const
Returns the model string corresponding to this model object, with embedded parameters.
DataPoint execute(fvalue omaga, size_t index=0)
Gets the impedance at the given frequency.
size_t getUuid() const
Returns a unique id.
std::string getCode()
Compiles this model into efficient c++ code corresponding to the circuit of this model.
size_t getParameterCount()
Gets the total number of parameters used by all the circuit elements in this model.
std::vector< DataPoint > executeSweep(const std::vector< fvalue > &omega, size_t index=0)
Executes a frequency sweep with the given omega values.
void resolveSteps(int64_t index)
This member resolves the parameters of all circuit elements at the given parameter sweep step.
size_t setParamSweepCountClosestTotal(size_t totalCount)
Adjusts the sweep count so that the total of spectra that need to be generated in the parameter sweep...
bool compile()
This function compiles the model into native vectorized code for faster execution.
bool isParamSweep()
Checks if the model is a sweep (i.e.
std::vector< std::vector< DataPoint > > executeAllSweeps(const Range &omega)
Executes a frequency sweep with the given omega values for each parameter combination in the applied ...
A range.
Definition eistype.h:110
eisgenerator Copyright (C) 2021 Carl Klemm
Definition basicmath.h:26