Skip to content

Commit

Permalink
Add qss test method to quantizer.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinffernandez committed Apr 20, 2023
1 parent 3323d73 commit 1b50762
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 142 deletions.
18 changes: 18 additions & 0 deletions src/engine/qss/qss_quantizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <qss/methods/qss2.h>
#include <qss/methods/qss3.h>
#include <qss/methods/qss4.h>
#include <qss/methods/qss_test.h>

QA_quantizerOps QA_QuantizerOps()
{
Expand Down Expand Up @@ -72,6 +73,16 @@ QA_quantizerState QA_QuantizerState()
p->finTime = 0;
p->lSimTime = NULL;
p->qMap = NULL;
p->nSD = NULL;
p->SD = NULL;
p->change = NULL;
p->next = NULL;
p->nTime = NULL;
p->A = NULL;
p->U0 = NULL;
p->U1 = NULL;
p->cont = NULL;

return p;
}

Expand Down Expand Up @@ -144,6 +155,13 @@ QA_quantizer QA_Quantizer(QSS_data simData, QSS_time simTime)
QSS4_init(p, simData, simTime);
}
break;
case SD_QSS_TEST:
if (simData->params->lps > 0) {
QSS_TEST_PAR_init(p, simData, simTime);
} else {
QSS_TEST_init(p, simData, simTime);
}
break;
default:
return NULL;
}
Expand Down
192 changes: 50 additions & 142 deletions src/engine/qss/qss_quantizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,176 +23,84 @@
#include <qss/qss_data.h>
#include <qss/qss_bdf.h>

/**
*
*/
typedef struct QA_quantizerOps_ *QA_quantizerOps;
/**
*
*/
typedef struct QA_quantizerState_ *QA_quantizerState;
/**
*
*/
typedef struct QA_quantizer_ *QA_quantizer;
/**
*
* @param
* @param
* @param
* @param
* @param
* @param
* @param
*/
typedef void (*QA_recomputeNextTimesFn)(QA_quantizer, int, int *, double, double *, double *, double *, double *);
/**
*
* @param
* @param
* @param
* @param
* @param
* @param
*/
typedef void (*QA_recomputeNextTimeFn)(QA_quantizer, int, double, double *, double *, double *, double *);
/**
*
* @param
* @param
* @param
* @param
* @param
*/
typedef void (*QA_nextTimeFn)(QA_quantizer, int, double, double *, double *, double *);
/**
*
* @param
* @param
* @param
* @param
*/
typedef void (*QA_updateQuantizedStateFn)(QA_quantizer, int, double *, double *, double *);
/**
*
*/

struct QA_quantizerState_ {
int order;
int xOrder;
int *flag2; //!<
int *flag3; //!<
int *flag4; //!<
int *flag2;
int *flag3;
int *flag4;
int *BDF;
int *nSZ;
int **SZ;
double *dq; //!<
double *a; //!<
double *oldDx; //!<
double *qAux; //!<
double *u0; //!<
double *u1; //!<
double *u2; //!<
double *dq;
double *a;
double *oldDx;
double *qAux;
double *u0;
double *u1;
double *u2;
double *tx;
double *lt; //!<
double *ltq; //!<
double *lquOld; //!<
double *qinf; //!<
double *qsup; //!<
double *simTime; //!<
double minStep; //!<
double finTime; //!<
QSS_time lSimTime; //!<
QSS_idxMap qMap; //!<
double *lt;
double *ltq;
double *lquOld;
double *qinf;
double *qsup;
double *simTime;
double minStep;
double finTime;
QSS_time lSimTime;
QSS_idxMap qMap;

// QSS TEST method added state.
int *nSD;
int **SD;
bool *change;
double *next;
double *nTime;
double **A;
double **U0;
double **U1;
double *cont;
};
/**
*
*/

struct QA_quantizerOps_ {
QA_recomputeNextTimesFn recomputeNextTimes; //!<
QA_recomputeNextTimeFn recomputeNextTime; //!<
QA_nextTimeFn nextTime; //!<
QA_updateQuantizedStateFn updateQuantizedState; //!<
QA_recomputeNextTimesFn recomputeNextTimes;
QA_recomputeNextTimeFn recomputeNextTime;
QA_nextTimeFn nextTime;
QA_updateQuantizedStateFn updateQuantizedState;
};
/**
*
*/

struct QA_quantizer_ {
QA_quantizerState state; //!<
QA_quantizerOps ops; //!<
QA_quantizerState state;
QA_quantizerOps ops;
};
/**
*
* @return
*/

QA_quantizerOps QA_QuantizerOps();
/**
*
* @return
*/

QA_quantizerState QA_QuantizerState();
/**
*
* @param simData
* @param simTime
* @return
*/

QA_quantizer QA_Quantizer(QSS_data simData, QSS_time simTime);
/**
*
* @param state
*/

void QA_freeQuantizerState(QA_quantizerState state);
/**
*
* @param ops
*/

void QA_freeQuantizerOps(QA_quantizerOps ops);
/**
*
* @param q
*/

void QA_freeQuantizer(QA_quantizer quantizer);
/**
*
* @param quantizer
* @param vars
* @param inf
* @param t
* @param nTime
* @param x
* @param lqu
* @param q
*/

void QA_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q);
/**
*
* @param quantizer
* @param var
* @param t
* @param nTime
* @param x
* @param lqu
* @param q
*/

void QA_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q);
/**
*
* @param quantizer
* @param var
* @param t
* @param nTime
* @param x
* @param lqu
*/

void QA_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu);
/**
*
* @param quantizer
* @param x
* @param q
* @param x
* @param lqu
*/

void QA_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu);

#endif /* QSS_QUANTIZER_H_ */

0 comments on commit 1b50762

Please sign in to comment.