mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
[clib] Add new Connector functions
This commit is contained in:
parent
27f4ff261a
commit
bd5b2e29e8
@ -19,6 +19,7 @@ extern "C" {
|
||||
|
||||
CANTERA_CAPI int reactor_new(const char* type, int n, const char* name);
|
||||
CANTERA_CAPI int reactor_del(int i);
|
||||
CANTERA_CAPI int reactor_type(int i, int len, char* nbuf);
|
||||
CANTERA_CAPI int reactor_name(int i, int len, char* nbuf);
|
||||
CANTERA_CAPI int reactor_setName(int i, const char* name);
|
||||
CANTERA_CAPI int reactor_setInitialVolume(int i, double v);
|
||||
@ -51,6 +52,12 @@ extern "C" {
|
||||
CANTERA_CAPI double reactornet_atol(int i);
|
||||
CANTERA_CAPI double reactornet_sensitivity(int i, const char* v, int p, int r);
|
||||
|
||||
CANTERA_CAPI int connector_new(const char* type, int r0, int r1, const char* name);
|
||||
CANTERA_CAPI int connector_del(int i);
|
||||
CANTERA_CAPI int connector_type(int i, int len, char* nbuf);
|
||||
CANTERA_CAPI int connector_name(int i, int len, char* nbuf);
|
||||
CANTERA_CAPI int connector_setName(int i, const char* name);
|
||||
|
||||
CANTERA_CAPI int flowdev_new(const char* type, const char* name);
|
||||
CANTERA_CAPI int flowdev_del(int i);
|
||||
CANTERA_CAPI int flowdev_name(int i, int len, char* nbuf);
|
||||
|
@ -58,6 +58,16 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
int reactor_type(int i, int len, char* nbuf)
|
||||
{
|
||||
try {
|
||||
return static_cast<int>(
|
||||
copyString(ReactorCabinet::at(i)->type(), nbuf, len));
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int reactor_name(int i, int len, char* nbuf)
|
||||
{
|
||||
try {
|
||||
@ -346,6 +356,59 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
// connectors
|
||||
|
||||
int connector_new(const char* type, int n, int m, const char* name)
|
||||
{
|
||||
try {
|
||||
|
||||
return ConnectorCabinet::add(
|
||||
newConnector(type, ReactorCabinet::at(n), ReactorCabinet::at(m), name));
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int connector_del(int i)
|
||||
{
|
||||
try {
|
||||
ConnectorCabinet::del(i);
|
||||
return 0;
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int connector_type(int i, int len, char* nbuf)
|
||||
{
|
||||
try {
|
||||
return static_cast<int>(
|
||||
copyString(ConnectorCabinet::at(i)->type(), nbuf, len));
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int connector_name(int i, int len, char* nbuf)
|
||||
{
|
||||
try {
|
||||
return static_cast<int>(
|
||||
copyString(ConnectorCabinet::at(i)->name(), nbuf, len));
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int connector_setName(int i, const char* name)
|
||||
{
|
||||
try {
|
||||
ConnectorCabinet::at(i)->setName(name);
|
||||
return 0;
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// flow devices
|
||||
|
||||
int flowdev_new(const char* type, const char* name)
|
||||
|
Loading…
Reference in New Issue
Block a user