outitf.c, add flag 'save none' for shared ngspice. Output data will not be stored, but are available via callback function ng_data.
This commit is contained in:
parent
11bafd70ea
commit
a393c47ec8
|
|
@ -0,0 +1,28 @@
|
||||||
|
Enabling XSPICE data transfer over the shared ngspice api.
|
||||||
|
|
||||||
|
This branch enhances shared ngspice capability to event driven XSPICE data transfer.
|
||||||
|
|
||||||
|
The shared library (dll) exports three new function:
|
||||||
|
ngSpice_Init_Evt() provides addresses for two new callback functions.
|
||||||
|
To be called upon initialization.
|
||||||
|
ngGet_Evt_NodeInfo() provides info for a specific node.
|
||||||
|
ngSpice_AllEvtNodes() provides a list of all event nodes.
|
||||||
|
|
||||||
|
There are two new callback functions
|
||||||
|
|
||||||
|
sendinitevt() sends info upon the event nodes: name, type an dcorresponding index
|
||||||
|
and is calles once per event nodes upon initialization of the circuit.
|
||||||
|
|
||||||
|
sendevt() is called each time, when for a given event node, that is determined
|
||||||
|
by index, a time step has been accepted and its value has changed. This allows
|
||||||
|
to immediately make use of that value in the calling process.
|
||||||
|
|
||||||
|
For details on the definitions you may have a look at sharedspice.h.
|
||||||
|
|
||||||
|
There is an example caller file (currently tested only under Windows,
|
||||||
|
and compiled with Visual Studio) in directory ngspice\visualc\ng_shared_xspice_v.
|
||||||
|
|
||||||
|
There is also a new feature: The 'save' command accepts the flag none of run in
|
||||||
|
shared mode. Then there is no internal storage of analog output data, they are
|
||||||
|
still available with the callback function ng_data. The above mentioned example
|
||||||
|
file now includes a testrun2 to demonstrate this feature.
|
||||||
|
|
@ -90,6 +90,8 @@ static bool shouldstop = FALSE; /* Tell simulator to stop next time it asks. */
|
||||||
static bool interpolated = FALSE;
|
static bool interpolated = FALSE;
|
||||||
static double *valueold, *valuenew;
|
static double *valueold, *valuenew;
|
||||||
|
|
||||||
|
static bool savenone = FALSE;
|
||||||
|
|
||||||
/* The two "begin plot" routines share all their internals... */
|
/* The two "begin plot" routines share all their internals... */
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -207,6 +209,16 @@ beginPlot(JOB *analysisPtr, CKTcircuit *circuitPtr, char *cktName, char *analNam
|
||||||
saves[i].used = 1;
|
saves[i].used = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#ifdef SHARED_MODULE
|
||||||
|
/* this may happen if shared ngspice*/
|
||||||
|
if (cieq(saves[i].name, "none")) {
|
||||||
|
savenone = TRUE;
|
||||||
|
saveall = TRUE;
|
||||||
|
savesused[i] = TRUE;
|
||||||
|
saves[i].used = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1065,6 +1077,11 @@ plotAddRealValue(dataDesc *desc, double value)
|
||||||
{
|
{
|
||||||
struct dvec *v = desc->vec;
|
struct dvec *v = desc->vec;
|
||||||
|
|
||||||
|
#ifdef SHARED_MODULE
|
||||||
|
if(savenone)
|
||||||
|
v->v_length = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (v->v_length >= v->v_alloc_length)
|
if (v->v_length >= v->v_alloc_length)
|
||||||
dvec_extend(v, v->v_length + vlength2delta(v->v_length));
|
dvec_extend(v, v->v_length + vlength2delta(v->v_length));
|
||||||
|
|
||||||
|
|
@ -1086,6 +1103,11 @@ plotAddComplexValue(dataDesc *desc, IFcomplex value)
|
||||||
{
|
{
|
||||||
struct dvec *v = desc->vec;
|
struct dvec *v = desc->vec;
|
||||||
|
|
||||||
|
#ifdef SHARED_MODULE
|
||||||
|
if (savenone)
|
||||||
|
v->v_length = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (v->v_length >= v->v_alloc_length)
|
if (v->v_length >= v->v_alloc_length)
|
||||||
dvec_extend(v, v->v_length + vlength2delta(v->v_length));
|
dvec_extend(v, v->v_length + vlength2delta(v->v_length));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue