34template<> ReactorBaseCabinet* ReactorBaseCabinet::s_storage = 0;
37template<> ReactorSurfaceCabinet* ReactorSurfaceCabinet::s_storage;
40template<> SolutionCabinet* SolutionCabinet::s_storage;
46 int32_t
reactor_new(
const char* model, int32_t phase, int32_t clone,
const char* name)
50 bool clone_ = (clone != 0);
51 return ReactorBaseCabinet::add(
newReactorBase(model, SolutionCabinet::at(phase), clone_, name));
57 int32_t
reactor_newSurface(int32_t phase, int32_t reactorsLen,
const int32_t* reactors, int32_t clone,
const char* name)
61 vector<shared_ptr<ReactorBase>> reactors_;
62 for (
int i = 0; i < reactorsLen; i++) {
63 reactors_.push_back(ReactorBaseCabinet::at(reactors[i]));
65 bool clone_ = (clone != 0);
66 return ReactorBaseCabinet::add(
newReactorSurface(SolutionCabinet::at(phase), reactors_, clone_, name));
72 int32_t
reactor_newSurfaceOfType(
const char* model, int32_t phase, int32_t reactorsLen,
const int32_t* reactors, int32_t clone,
const char* name)
76 vector<shared_ptr<ReactorBase>> reactors_;
77 for (
int i = 0; i < reactorsLen; i++) {
78 reactors_.push_back(ReactorBaseCabinet::at(reactors[i]));
80 bool clone_ = (clone != 0);
81 return ReactorBaseCabinet::add(
newReactorSurface(model, SolutionCabinet::at(phase), reactors_, clone_, name));
91 string out = ReactorBaseCabinet::at(handle)->type();
93 return int(out.size()) + 1;
103 string out = ReactorBaseCabinet::at(handle)->name();
105 return int(out.size()) + 1;
115 ReactorBaseCabinet::at(handle)->setName(name);
126 return SolutionCabinet::add(ReactorBaseCabinet::at(handle)->phase());
136 ReactorBaseCabinet::at(handle)->setInitialVolume(vol);
147 return ReactorBaseCabinet::at(handle)->area();
157 ReactorBaseCabinet::at(handle)->setArea(a);
168 bool out = ReactorBaseCabinet::at(handle)->chemistryEnabled();
179 bool cflag_ = (cflag != 0);
180 ReactorBaseCabinet::at(handle)->setChemistryEnabled(cflag_);
191 bool out = ReactorBaseCabinet::at(handle)->energyEnabled();
202 bool eflag_ = (eflag != 0);
203 ReactorBaseCabinet::at(handle)->setEnergyEnabled(eflag_);
214 return ReactorBaseCabinet::at(handle)->mass();
224 return ReactorBaseCabinet::at(handle)->volume();
234 return ReactorBaseCabinet::at(handle)->density();
244 return ReactorBaseCabinet::at(handle)->temperature();
254 return ReactorBaseCabinet::at(handle)->enthalpy_mass();
264 return ReactorBaseCabinet::at(handle)->pressure();
274 return ReactorBaseCabinet::at(handle)->massFraction(k);
284 auto out = ReactorBaseCabinet::at(handle)->massFractions();
285 std::copy(out, out + bufLen, buf);
296 return static_cast<int32_t
>(ReactorBaseCabinet::at(handle)->nSensParams());
306 ReactorBaseCabinet::at(handle)->addSensitivityReaction(rxn);
317 return ReactorBaseCabinet::as<FlowReactor>(handle)->massFlowRate();
327 ReactorBaseCabinet::as<FlowReactor>(handle)->setMassFlowRate(mdot);
338 ReactorBaseCabinet::del(handle);
350 return ReactorBaseCabinet::size();
Header file for class ReactorSurface.
Template for classes to hold pointers to objects.
CTREACTOR - Generated CLib Cantera interface library.
int32_t reactor_nSensParams(int32_t handle)
Number of sensitivity parameters associated with this reactor.
int32_t reactor_phase(int32_t handle)
Access the Solution object used to represent the contents of this reactor.
double reactor_volume(int32_t handle)
Returns the current volume (m^3) of the reactor.
int32_t reactor_setName(int32_t handle, const char *name)
Set the name of this reactor.
int32_t reactor_del(int32_t handle)
Delete ReactorBase object.
double reactor_massFlowRate(int32_t handle)
Mass flow rate through the reactor [kg/s].
double reactor_enthalpy_mass(int32_t handle)
Returns the current enthalpy (J/kg) of the reactor's contents.
int32_t reactor_energyEnabled(int32_t handle)
Returns true if solution of the energy equation is enabled.
int32_t reactor_setArea(int32_t handle, double a)
Set an area associated with a reactor [m²].
double reactor_pressure(int32_t handle)
Returns the current pressure (Pa) of the reactor.
double reactor_mass(int32_t handle)
Returns the mass (kg) of the reactor's contents.
int32_t reactor_new(const char *model, int32_t phase, int32_t clone, const char *name)
Create a ReactorBase object of the specified type and contents.
int32_t reactor_massFractions(int32_t handle, int32_t bufLen, double *buf)
Return the vector of species mass fractions.
int32_t reactor_newSurfaceOfType(const char *model, int32_t phase, int32_t reactorsLen, const int32_t *reactors, int32_t clone, const char *name)
Create a ReactorSurface object with the specified contents and adjacent reactors participating in sur...
int32_t reactor_setMassFlowRate(int32_t handle, double mdot)
Set the mass flow rate through the reactor [kg/s].
int32_t reactor_setEnergyEnabled(int32_t handle, int32_t eflag)
Set the energy equation on or off.
int32_t reactor_chemistryEnabled(int32_t handle)
Returns true if changes in the reactor composition due to chemical reactions are enabled.
double reactor_area(int32_t handle)
Returns an area associated with a reactor [m²].
int32_t reactor_setInitialVolume(int32_t handle, double vol)
Set the initial reactor volume.
double reactor_temperature(int32_t handle)
Returns the current temperature (K) of the reactor's contents.
double reactor_massFraction(int32_t handle, int32_t k)
Return the mass fraction of the k-th species.
int32_t reactor_newSurface(int32_t phase, int32_t reactorsLen, const int32_t *reactors, int32_t clone, const char *name)
Create a ReactorSurface object with the specified contents and adjacent reactors participating in sur...
int32_t reactor_addSensitivityReaction(int32_t handle, int32_t rxn)
Add a sensitivity parameter associated with the reaction number rxn
double reactor_density(int32_t handle)
Returns the current density (kg/m^3) of the reactor's contents.
int32_t reactor_type(int32_t handle, int32_t bufLen, char *buf)
String indicating the reactor model implemented.
int32_t reactor_name(int32_t handle, int32_t bufLen, char *buf)
Return the name of this reactor.
int32_t reactor_setChemistryEnabled(int32_t handle, int32_t cflag)
Enable or disable changes in reactor composition due to chemical reactions.
int32_t reactor_cabinetSize()
Return size of ReactorBase storage.
size_t copyString(const string &source, char *dest, size_t length)
Copy the contents of a string into a char array of a given length.
shared_ptr< ReactorBase > newReactorBase(const string &model, shared_ptr< Solution > phase, bool clone, const string &name)
Create a ReactorBase object of the specified type and contents.
shared_ptr< ReactorSurface > newReactorSurface(shared_ptr< Solution > phase, const vector< shared_ptr< ReactorBase > > &reactors, bool clone, const string &name)
Create a ReactorSurface object with the specified contents and adjacent reactors participating in sur...
Namespace for the Cantera kernel.
T handleAllExceptions(T ctErrorCode, T otherErrorCode)
Exception handler used at language interface boundaries.
Contains declarations for string manipulation functions within Cantera.