diff --git a/src/engine/qss/methods/cqss.c b/src/engine/qss/methods/cqss.c index f2346da4..693dee6f 100644 --- a/src/engine/qss/methods/cqss.c +++ b/src/engine/qss/methods/cqss.c @@ -26,11 +26,7 @@ #include #include -#ifdef QSS_PARALLEL -void CQSS_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#else -void CQSS_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#endif +void QSS_FUNC_DECL(CQSS, init)(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) { int i; int states = simData->states; @@ -48,25 +44,10 @@ void CQSS_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) } quantizer->state->flag2[0] = 0; quantizer->state->simTime = &simTime->time; -#ifdef QSS_PARALLEL - quantizer->state->qMap = simData->lp->qMap; - quantizer->ops->recomputeNextTimes = CQSS_PAR_recomputeNextTimes; - quantizer->ops->recomputeNextTime = CQSS_PAR_recomputeNextTime; - quantizer->ops->nextTime = CQSS_PAR_nextTime; - quantizer->ops->updateQuantizedState = CQSS_PAR_updateQuantizedState; -#else - quantizer->ops->recomputeNextTimes = CQSS_recomputeNextTimes; - quantizer->ops->recomputeNextTime = CQSS_recomputeNextTime; - quantizer->ops->nextTime = CQSS_nextTime; - quantizer->ops->updateQuantizedState = CQSS_updateQuantizedState; -#endif + QSS_ASSIGN_QUANTIZER_OPS(CQSS) } -#ifdef QSS_PARALLEL -void CQSS_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#else -void CQSS_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(CQSS, recomputeNextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) { int cf0 = var * 2, cf1 = cf0 + 1; if (quantizer->state->lt[var] == t) { @@ -85,32 +66,20 @@ void CQSS_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *n } } -#ifdef QSS_PARALLEL -void CQSS_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#else -void CQSS_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(CQSS, recomputeNextTimes)(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, + double *q) { int i; -#ifdef QSS_PARALLEL - int *map = quantizer->state->qMap; -#endif + QSS_PARALLEL_EXP(int *map = quantizer->state->qMap;) for (i = 0; i < vars; i++) { -#ifdef QSS_PARALLEL - if (map[inf[i]] > NOT_ASSIGNED) { -#endif - CQSS_recomputeNextTime(quantizer, inf[i], t, nTime, x, lqu, q); -#ifdef QSS_PARALLEL - } -#endif + QSS_PARALLEL_EXP(if (map[inf[i]] != NOT_ASSIGNED) {) + QSS_FUNC_INVK(CQSS, recomputeNextTime)(quantizer, inf[i], t, nTime, x, lqu, q); + QSS_PARALLEL_EXP( + }) } } -#ifdef QSS_PARALLEL -void CQSS_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#else -void CQSS_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(CQSS, nextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) { int cf0 = var * 2, cf1 = cf0 + 1; if (x[cf1] > 0) { @@ -122,11 +91,7 @@ void CQSS_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, dou } } -#ifdef QSS_PARALLEL -void CQSS_PAR_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) -#else -void CQSS_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(CQSS, updateQuantizedState)(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) { int cf0 = var * 2, cf1 = cf0 + 1; quantizer->state->lt[var] = *(quantizer->state->simTime); diff --git a/src/engine/qss/methods/cqss.h b/src/engine/qss/methods/cqss.h index dc0f425d..9109ac42 100644 --- a/src/engine/qss/methods/cqss.h +++ b/src/engine/qss/methods/cqss.h @@ -17,114 +17,10 @@ ******************************************************************************/ -#ifndef CQSS_H_ -#define CQSS_H_ +#pragma once +#include #include #include -/** - * @brief Recomputes the next time of all the influenced variables of... - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void CQSS_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void CQSS_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void CQSS_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void CQSS_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void CQSS_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void CQSS_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param q - * @param x - * @param lqu - */ -void CQSS_PAR_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param q - * @param x - * @param lqu - */ -void CQSS_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param _simData - * @param _simTime - */ -void CQSS_PAR_init(QA_quantizer quantizer, QSS_data _simData, QSS_time _simTime); -/** - * - * @param quantizer - * @param _simData - * @param _simTime - */ -void CQSS_init(QA_quantizer quantizer, QSS_data _simData, QSS_time _simTime); - -#endif /* CQSS_H_ */ +QSS_DECLARE_QUANTIZER_INTERFACE(CQSS) diff --git a/src/engine/qss/methods/liqss.c b/src/engine/qss/methods/liqss.c index ad4c451d..ad4de5b8 100644 --- a/src/engine/qss/methods/liqss.c +++ b/src/engine/qss/methods/liqss.c @@ -27,11 +27,7 @@ #include #include -#ifdef QSS_PARALLEL -void LIQSS_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#else -void LIQSS_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#endif +void QSS_FUNC_DECL(LIQSS, init)(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) { int i; int states = simData->states; @@ -50,46 +46,23 @@ void LIQSS_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) quantizer->state->lt[i] = simData->it; } quantizer->state->simTime = &simTime->time; -#ifdef QSS_PARALLEL - quantizer->state->qMap = simData->lp->qMap; - quantizer->ops->recomputeNextTimes = LIQSS_PAR_recomputeNextTimes; - quantizer->ops->recomputeNextTime = LIQSS_PAR_recomputeNextTime; - quantizer->ops->nextTime = LIQSS_PAR_nextTime; - quantizer->ops->updateQuantizedState = LIQSS_PAR_updateQuantizedState; -#else - quantizer->ops->recomputeNextTimes = LIQSS_recomputeNextTimes; - quantizer->ops->recomputeNextTime = LIQSS_recomputeNextTime; - quantizer->ops->nextTime = LIQSS_nextTime; - quantizer->ops->updateQuantizedState = LIQSS_updateQuantizedState; -#endif + QSS_ASSIGN_QUANTIZER_OPS(LIQSS) } -#ifdef QSS_PARALLEL -void LIQSS_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#else -void LIQSS_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(LIQSS, recomputeNextTimes)(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, + double *q) { int i; -#ifdef QSS_PARALLEL - int *map = quantizer->state->qMap; -#endif + QSS_PARALLEL_EXP(int *map = quantizer->state->qMap;) for (i = 0; i < vars; i++) { -#ifdef QSS_PARALLEL - if (map[inf[i]] > NOT_ASSIGNED) { -#endif - LIQSS_recomputeNextTime(quantizer, inf[i], t, nTime, x, lqu, q); -#ifdef QSS_PARALLEL - } -#endif + QSS_PARALLEL_EXP(if (map[inf[i]] != NOT_ASSIGNED) {) + QSS_FUNC_INVK(LIQSS, recomputeNextTime)(quantizer, inf[i], t, nTime, x, lqu, q); + QSS_PARALLEL_EXP( + }) } } -#ifdef QSS_PARALLEL -void LIQSS_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#else -void LIQSS_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(LIQSS, recomputeNextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) { int cf0 = var * 2, cf1 = cf0 + 1; double *u = quantizer->state->u0; @@ -124,11 +97,7 @@ void LIQSS_recomputeNextTime(QA_quantizer quantizer, int var, double t, double * } } -#ifdef QSS_PARALLEL -void LIQSS_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#else -void LIQSS_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(LIQSS, nextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) { int cf1 = var * 2 + 1; if (x[cf1] == 0) { @@ -138,11 +107,7 @@ void LIQSS_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, do } } -#ifdef QSS_PARALLEL -void LIQSS_PAR_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) -#else -void LIQSS_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(LIQSS, updateQuantizedState)(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) { int cf0 = var * 2, cf1 = cf0 + 1; double dx; diff --git a/src/engine/qss/methods/liqss.h b/src/engine/qss/methods/liqss.h index ef0f3195..975cb8fd 100644 --- a/src/engine/qss/methods/liqss.h +++ b/src/engine/qss/methods/liqss.h @@ -17,114 +17,10 @@ ******************************************************************************/ -#ifndef LIQSS_H_ -#define LIQSS_H_ +#pragma once +#include #include #include -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void LIQSS_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void LIQSS_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void LIQSS_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param q - * @param x - * @param lqu - */ -void LIQSS_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -void LIQSS_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void LIQSS_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void LIQSS_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void LIQSS_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param q - * @param x - * @param lqu - */ -void LIQSS_PAR_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -void LIQSS_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -#endif /* LIQSS_H_ */ +QSS_DECLARE_QUANTIZER_INTERFACE(LIQSS) diff --git a/src/engine/qss/methods/liqss2.c b/src/engine/qss/methods/liqss2.c index 8016a027..6df740bd 100644 --- a/src/engine/qss/methods/liqss2.c +++ b/src/engine/qss/methods/liqss2.c @@ -25,11 +25,7 @@ #include #include -#ifdef QSS_PARALLEL -void LIQSS2_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#else -void LIQSS2_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#endif +void QSS_FUNC_DECL(LIQSS2, init)(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) { int states = simData->states; int i; @@ -55,29 +51,14 @@ void LIQSS2_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) quantizer->state->u1[i] = 0; quantizer->state->flag2[i] = 0; } -#ifdef QSS_PARALLEL - quantizer->state->qMap = simData->lp->qMap; - quantizer->ops->recomputeNextTimes = LIQSS2_PAR_recomputeNextTimes; - quantizer->ops->recomputeNextTime = LIQSS2_PAR_recomputeNextTime; - quantizer->ops->nextTime = LIQSS2_PAR_nextTime; - quantizer->ops->updateQuantizedState = LIQSS2_PAR_updateQuantizedState; -#else - quantizer->ops->recomputeNextTimes = LIQSS2_recomputeNextTimes; - quantizer->ops->recomputeNextTime = LIQSS2_recomputeNextTime; - quantizer->ops->nextTime = LIQSS2_nextTime; - quantizer->ops->updateQuantizedState = LIQSS2_updateQuantizedState; -#endif + QSS_ASSIGN_QUANTIZER_OPS(LIQSS2) quantizer->state->minStep = simData->params->minStep; quantizer->state->lSimTime = simTime; quantizer->state->nSZ = simData->nSZ; quantizer->state->SZ = simData->SZ; } -#ifdef QSS_PARALLEL -void LIQSS2_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#else -void LIQSS2_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(LIQSS2, recomputeNextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) { int cf0 = var * 3, cf1 = cf0 + 1, cf2 = cf1 + 1; double *a = quantizer->state->a; @@ -141,8 +122,6 @@ void LIQSS2_recomputeNextTime(QA_quantizer quantizer, int var, double t, double if (fabs(err1) > 3 * fabs(lqu[var])) nTime[var] = t + quantizer->state->finTime * quantizer->state->minStep; } } else { - // if (fabs(aold-a[var])>fabs(a[var])/2) nTime[var] = t + quantizer->state->finTime * quantizer->state->minStep*rand()/RAND_MAX;; - // nTime[var] = t + quantizer->state->finTime * quantizer->state->minStep*0; if (self) { flag2[var] = 2; nTime[var] = t; @@ -150,32 +129,20 @@ void LIQSS2_recomputeNextTime(QA_quantizer quantizer, int var, double t, double } } -#ifdef QSS_PARALLEL -void LIQSS2_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#else -void LIQSS2_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(LIQSS2, recomputeNextTimes)(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, + double *q) { int i; -#ifdef QSS_PARALLEL - int *map = quantizer->state->qMap; -#endif + QSS_PARALLEL_EXP(int *map = quantizer->state->qMap;) for (i = 0; i < vars; i++) { -#ifdef QSS_PARALLEL - if (map[inf[i]] != NOT_ASSIGNED) { -#endif - LIQSS2_recomputeNextTime(quantizer, inf[i], t, nTime, x, lqu, q); -#ifdef QSS_PARALLEL - } -#endif + QSS_PARALLEL_EXP(if (map[inf[i]] != NOT_ASSIGNED) {) + QSS_FUNC_INVK(LIQSS2, recomputeNextTime)(quantizer, inf[i], t, nTime, x, lqu, q); + QSS_PARALLEL_EXP( + }) } } -#ifdef QSS_PARALLEL -void LIQSS2_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#else -void LIQSS2_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(LIQSS2, nextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) { int cf2 = var * 3 + 2; if (x[cf2] == 0) @@ -184,11 +151,7 @@ void LIQSS2_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, d nTime[var] = t + sqrt(fabs(lqu[var] / x[cf2])); } -#ifdef QSS_PARALLEL -void LIQSS2_PAR_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) -#else -void LIQSS2_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(LIQSS2, updateQuantizedState)(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) { double t = quantizer->state->lSimTime->time; double *a = quantizer->state->a; diff --git a/src/engine/qss/methods/liqss2.h b/src/engine/qss/methods/liqss2.h index 11475680..07c1ca92 100644 --- a/src/engine/qss/methods/liqss2.h +++ b/src/engine/qss/methods/liqss2.h @@ -17,114 +17,10 @@ ******************************************************************************/ -#ifndef LIQSS2_H_ -#define LIQSS2_H_ +#pragma once +#include #include #include -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void LIQSS2_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void LIQSS2_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void LIQSS2_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param q - * @param x - * @param lqu - */ -void LIQSS2_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -void LIQSS2_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void LIQSS2_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void LIQSS2_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void LIQSS2_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param q - * @param x - * @param lqu - */ -void LIQSS2_PAR_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -void LIQSS2_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -#endif /* LIQSS2_H_ */ +QSS_DECLARE_QUANTIZER_INTERFACE(LIQSS2) diff --git a/src/engine/qss/methods/liqss3.c b/src/engine/qss/methods/liqss3.c index 029b8cae..84340035 100644 --- a/src/engine/qss/methods/liqss3.c +++ b/src/engine/qss/methods/liqss3.c @@ -27,11 +27,7 @@ #include #include -#ifdef QSS_PARALLEL -void LIQSS3_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#else -void LIQSS3_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#endif +void QSS_FUNC_DECL(LIQSS3, init)(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) { int states = simData->states; int i; @@ -72,25 +68,10 @@ void LIQSS3_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) } quantizer->state->minStep = simData->params->minStep; quantizer->state->lSimTime = simTime; -#ifdef QSS_PARALLEL - quantizer->state->qMap = simData->lp->qMap; - quantizer->ops->recomputeNextTimes = LIQSS3_PAR_recomputeNextTimes; - quantizer->ops->recomputeNextTime = LIQSS3_PAR_recomputeNextTime; - quantizer->ops->nextTime = LIQSS3_PAR_nextTime; - quantizer->ops->updateQuantizedState = LIQSS3_PAR_updateQuantizedState; -#else - quantizer->ops->recomputeNextTimes = LIQSS3_recomputeNextTimes; - quantizer->ops->recomputeNextTime = LIQSS3_recomputeNextTime; - quantizer->ops->nextTime = LIQSS3_nextTime; - quantizer->ops->updateQuantizedState = LIQSS3_updateQuantizedState; -#endif + QSS_ASSIGN_QUANTIZER_OPS(LIQSS3) } -#ifdef QSS_PARALLEL -void LIQSS3_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#else -void LIQSS3_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(LIQSS3, recomputeNextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) { int cf0 = var * 4, cf1 = cf0 + 1, cf2 = cf1 + 1, cf3 = cf2 + 1; double *u0 = quantizer->state->u0; @@ -157,24 +138,16 @@ void LIQSS3_recomputeNextTime(QA_quantizer quantizer, int var, double t, double } } -#ifdef QSS_PARALLEL -void LIQSS3_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#else -void LIQSS3_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(LIQSS3, recomputeNextTimes)(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, + double *q) { int i; -#ifdef QSS_PARALLEL - int *map = quantizer->state->qMap; -#endif + QSS_PARALLEL_EXP(int *map = quantizer->state->qMap;) for (i = 0; i < vars; i++) { -#ifdef QSS_PARALLEL - if (map[inf[i]] > NOT_ASSIGNED) { -#endif - LIQSS3_recomputeNextTime(quantizer, inf[i], t, nTime, x, lqu, q); -#ifdef QSS_PARALLEL - } -#endif + QSS_PARALLEL_EXP(if (map[inf[i]] != NOT_ASSIGNED) {) + QSS_FUNC_INVK(LIQSS3, recomputeNextTime)(quantizer, inf[i], t, nTime, x, lqu, q); + QSS_PARALLEL_EXP( + }) } } @@ -192,11 +165,7 @@ void LIQSS3_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, d } } -#ifdef QSS_PARALLEL -void LIQSS3_PAR_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) -#else -void LIQSS3_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(LIQSS3, updateQuantizedState)(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) { int cf0 = var * 4, cf1 = cf0 + 1, cf2 = cf1 + 1, cf3 = cf2 + 1; double dx, elapsed; diff --git a/src/engine/qss/methods/liqss3.h b/src/engine/qss/methods/liqss3.h index 5ef7ddf9..95a2a0b4 100644 --- a/src/engine/qss/methods/liqss3.h +++ b/src/engine/qss/methods/liqss3.h @@ -17,114 +17,10 @@ ******************************************************************************/ -#ifndef LIQSS3_H_ -#define LIQSS3_H_ +#pragma once +#include #include #include -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -extern void LIQSS3_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, - double *q) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -extern void LIQSS3_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -extern void LIQSS3_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param q - * @param x - * @param lqu - */ -extern void LIQSS3_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -extern void LIQSS3_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -extern void LIQSS3_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, - double *q) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -extern void LIQSS3_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -extern void LIQSS3_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param q - * @param x - * @param lqu - */ -extern void LIQSS3_PAR_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -extern void LIQSS3_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -#endif /* LIQSS3_H_ */ +QSS_DECLARE_QUANTIZER_INTERFACE(LIQSS3) diff --git a/src/engine/qss/methods/liqss_bdf.c b/src/engine/qss/methods/liqss_bdf.c index 072f860e..03fa52f4 100644 --- a/src/engine/qss/methods/liqss_bdf.c +++ b/src/engine/qss/methods/liqss_bdf.c @@ -23,11 +23,7 @@ #include #include -#ifdef QSS_PARALLEL -void LIQSS_BDF_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#else -void LIQSS_BDF_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#endif +void QSS_FUNC_DECL(LIQSS_BDF, init)(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) { int i; int states = simData->states; @@ -54,18 +50,7 @@ void LIQSS_BDF_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) quantizer->state->u1[i] = 0; } quantizer->state->BDF = simData->BDF; -#ifdef QSS_PARALLEL - quantizer->state->qMap = simData->lp->qMap; - quantizer->ops->recomputeNextTimes = LIQSS_BDF_PAR_recomputeNextTimes; - quantizer->ops->recomputeNextTime = LIQSS_BDF_PAR_recomputeNextTime; - quantizer->ops->nextTime = LIQSS_BDF_PAR_nextTime; - quantizer->ops->updateQuantizedState = LIQSS_BDF_PAR_updateQuantizedState; -#else - quantizer->ops->recomputeNextTimes = LIQSS_BDF_recomputeNextTimes; - quantizer->ops->recomputeNextTime = LIQSS_BDF_recomputeNextTime; - quantizer->ops->nextTime = LIQSS_BDF_nextTime; - quantizer->ops->updateQuantizedState = LIQSS_BDF_updateQuantizedState; -#endif + QSS_ASSIGN_QUANTIZER_OPS(LIQSS_BDF) quantizer->state->finTime = simData->ft; quantizer->state->minStep = simData->params->minStep; quantizer->state->lSimTime = simTime; @@ -73,11 +58,8 @@ void LIQSS_BDF_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) quantizer->state->SZ = simData->SZ; } -#ifdef QSS_PARALLEL -void LIQSS_BDF_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#else -void LIQSS_BDF_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(LIQSS_BDF, recomputeNextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, + double *q) { int *BDF = quantizer->state->BDF; if (BDF[var] == NOT_ASSIGNED) { @@ -153,33 +135,20 @@ void LIQSS_BDF_recomputeNextTime(QA_quantizer quantizer, int var, double t, doub } } -#ifdef QSS_PARALLEL -void LIQSS_BDF_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, - double *q) -#else -void LIQSS_BDF_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(LIQSS_BDF, recomputeNextTimes)(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, + double *lqu, double *q) { int i; -#ifdef QSS_PARALLEL - int *map = quantizer->state->qMap; -#endif + QSS_PARALLEL_EXP(int *map = quantizer->state->qMap;) for (i = 0; i < vars; i++) { -#ifdef QSS_PARALLEL - if (map[inf[i]] != NOT_ASSIGNED) { -#endif - LIQSS_BDF_recomputeNextTime(quantizer, inf[i], t, nTime, x, lqu, q); -#ifdef QSS_PARALLEL - } -#endif + QSS_PARALLEL_EXP(if (map[inf[i]] != NOT_ASSIGNED) {) + QSS_FUNC_INVK(LIQSS_BDF, recomputeNextTime)(quantizer, inf[i], t, nTime, x, lqu, q); + QSS_PARALLEL_EXP( + }) } } -#ifdef QSS_PARALLEL -void LIQSS_BDF_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#else -void LIQSS_BDF_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(LIQSS_BDF, nextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) { int *BDF = quantizer->state->BDF; if (BDF[var] == NOT_ASSIGNED) { @@ -192,11 +161,7 @@ void LIQSS_BDF_nextTime(QA_quantizer quantizer, int var, double t, double *nTime } } -#ifdef QSS_PARALLEL -void LIQSS_BDF_PAR_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) -#else -void LIQSS_BDF_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(LIQSS_BDF, updateQuantizedState)(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) { double t = quantizer->state->lSimTime->time; double *a = quantizer->state->a; diff --git a/src/engine/qss/methods/liqss_bdf.h b/src/engine/qss/methods/liqss_bdf.h index 187fea86..1e6b1595 100644 --- a/src/engine/qss/methods/liqss_bdf.h +++ b/src/engine/qss/methods/liqss_bdf.h @@ -17,114 +17,10 @@ ******************************************************************************/ -#ifndef LIQSS_BDF_H_ -#define LIQSS_BDF_H_ +#pragma once +#include #include #include -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void LIQSS_BDF_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void LIQSS_BDF_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void LIQSS_BDF_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param q - * @param x - * @param lqu - */ -void LIQSS_BDF_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -void LIQSS_BDF_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void LIQSS_BDF_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, - double *q) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void LIQSS_BDF_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void LIQSS_BDF_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param q - * @param x - * @param lqu - */ -void LIQSS_BDF_PAR_updateQuantizedState(QA_quantizer quantizer, int var, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -void LIQSS_BDF_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -#endif /* LIQSS_BDF_H_ */ \ No newline at end of file +QSS_DECLARE_QUANTIZER_INTERFACE(LIQSS_BDF) diff --git a/src/engine/qss/methods/qss.c b/src/engine/qss/methods/qss.c index 8658feda..2f1c9049 100644 --- a/src/engine/qss/methods/qss.c +++ b/src/engine/qss/methods/qss.c @@ -25,11 +25,7 @@ #include #include -#ifdef QSS_PARALLEL -void QSS_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#else -void QSS_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#endif +void QSS_FUNC_DECL(QSS, init)(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) { int i; int states = simData->states; @@ -37,25 +33,10 @@ void QSS_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) int cf0 = i * 2; simData->q[cf0] = simData->x[cf0]; } -#ifdef QSS_PARALLEL - quantizer->state->qMap = simData->lp->qMap; - quantizer->ops->recomputeNextTimes = QSS_PAR_recomputeNextTimes; - quantizer->ops->recomputeNextTime = QSS_PAR_recomputeNextTime; - quantizer->ops->nextTime = QSS_PAR_nextTime; - quantizer->ops->updateQuantizedState = QSS_PAR_updateQuantizedState; -#else - quantizer->ops->recomputeNextTimes = QSS_recomputeNextTimes; - quantizer->ops->recomputeNextTime = QSS_recomputeNextTime; - quantizer->ops->nextTime = QSS_nextTime; - quantizer->ops->updateQuantizedState = QSS_updateQuantizedState; -#endif + QSS_ASSIGN_QUANTIZER_OPS(QSS) } -#ifdef QSS_PARALLEL -void QSS_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#else -void QSS_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(QSS, recomputeNextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) { int cf0 = var * 2, cf1 = cf0 + 1; double coeff[2]; @@ -69,32 +50,20 @@ void QSS_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nT } } -#ifdef QSS_PARALLEL -void QSS_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#else -void QSS_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(QSS, recomputeNextTimes)(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, + double *q) { int i; -#ifdef QSS_PARALLEL - int *map = quantizer->state->qMap; -#endif + QSS_PARALLEL_EXP(int *map = quantizer->state->qMap;) for (i = 0; i < vars; i++) { -#ifdef QSS_PARALLEL - if (map[inf[i]] > NOT_ASSIGNED) { -#endif - QSS_recomputeNextTime(quantizer, inf[i], t, nTime, x, lqu, q); -#ifdef QSS_PARALLEL - } -#endif + QSS_PARALLEL_EXP(if (map[inf[i]] != NOT_ASSIGNED) {) + QSS_FUNC_INVK(QSS, recomputeNextTime)(quantizer, inf[i], t, nTime, x, lqu, q); + QSS_PARALLEL_EXP( + }) } } -#ifdef QSS_PARALLEL -void QSS_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#else -void QSS_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(QSS, nextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) { int cf1 = var * 2 + 1; if (x[cf1]) { @@ -104,11 +73,7 @@ void QSS_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, doub } } -#ifdef QSS_PARALLEL -void QSS_PAR_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) -#else -void QSS_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(QSS, updateQuantizedState)(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) { int cf0 = i * 2; q[cf0] = x[cf0]; diff --git a/src/engine/qss/methods/qss.h b/src/engine/qss/methods/qss.h index c1967a76..61a6a268 100644 --- a/src/engine/qss/methods/qss.h +++ b/src/engine/qss/methods/qss.h @@ -19,29 +19,8 @@ #pragma once +#include #include #include -void QSS_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); - -void QSS_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); - -void QSS_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); - -void QSS_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) __attribute__((hot)); - -void QSS_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -void QSS_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); - -void QSS_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); - -void QSS_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); - -void QSS_PAR_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) __attribute__((hot)); - -void QSS_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); +QSS_DECLARE_QUANTIZER_INTERFACE(QSS) diff --git a/src/engine/qss/methods/qss2.c b/src/engine/qss/methods/qss2.c index 387814c6..0f9d0c6e 100644 --- a/src/engine/qss/methods/qss2.c +++ b/src/engine/qss/methods/qss2.c @@ -25,11 +25,7 @@ #include #include -#ifdef QSS_PARALLEL -void QSS2_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#else -void QSS2_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#endif +void QSS_FUNC_DECL(QSS2, init)(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) { int i; int states = simData->states; @@ -39,25 +35,10 @@ void QSS2_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) simData->q[cf0] = simData->x[cf0]; simData->q[cf0 + 1] = 0; } -#ifdef QSS_PARALLEL - quantizer->state->qMap = simData->lp->qMap; - quantizer->ops->recomputeNextTimes = QSS2_PAR_recomputeNextTimes; - quantizer->ops->recomputeNextTime = QSS2_PAR_recomputeNextTime; - quantizer->ops->nextTime = QSS2_PAR_nextTime; - quantizer->ops->updateQuantizedState = QSS2_PAR_updateQuantizedState; -#else - quantizer->ops->recomputeNextTimes = QSS2_recomputeNextTimes; - quantizer->ops->recomputeNextTime = QSS2_recomputeNextTime; - quantizer->ops->nextTime = QSS2_nextTime; - quantizer->ops->updateQuantizedState = QSS2_updateQuantizedState; -#endif + QSS_ASSIGN_QUANTIZER_OPS(QSS2) } -#ifdef QSS_PARALLEL -void QSS2_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#else -void QSS2_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(QSS2, nextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) { int cf2 = var * 3 + 2; if (x[cf2]) { @@ -67,11 +48,7 @@ void QSS2_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, dou } } -#ifdef QSS_PARALLEL -void QSS2_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#else -void QSS2_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(QSS2, recomputeNextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) { int cf0 = var * 3, cf1 = cf0 + 1, cf2 = cf1 + 1; double coeff[3]; @@ -90,32 +67,20 @@ void QSS2_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *n } } -#ifdef QSS_PARALLEL -void QSS2_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#else -void QSS2_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(QSS2, recomputeNextTimes)(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, + double *q) { int i; -#ifdef QSS_PARALLEL - int *map = quantizer->state->qMap; -#endif + QSS_PARALLEL_EXP(int *map = quantizer->state->qMap;) for (i = 0; i < vars; i++) { -#ifdef QSS_PARALLEL - if (map[inf[i]] > NOT_ASSIGNED) { -#endif - QSS2_recomputeNextTime(quantizer, inf[i], t, nTime, x, lqu, q); -#ifdef QSS_PARALLEL - } -#endif + QSS_PARALLEL_EXP(if (map[inf[i]] != NOT_ASSIGNED) {) + QSS_FUNC_INVK(QSS2, recomputeNextTime)(quantizer, inf[i], t, nTime, x, lqu, q); + QSS_PARALLEL_EXP( + }) } } -#ifdef QSS_PARALLEL -void QSS2_PAR_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) -#else -void QSS2_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(QSS2, updateQuantizedState)(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) { int cf0 = i * 3, cf1 = cf0 + 1; q[cf0] = x[cf0]; diff --git a/src/engine/qss/methods/qss2.h b/src/engine/qss/methods/qss2.h index dd342f4b..d9de4e01 100644 --- a/src/engine/qss/methods/qss2.h +++ b/src/engine/qss/methods/qss2.h @@ -17,114 +17,10 @@ ******************************************************************************/ -#ifndef QSS2_H_ -#define QSS2_H_ +#pragma once +#include #include #include -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void QSS2_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void QSS2_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void QSS2_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param i - * @param q - * @param x - * @param lqu - */ -void QSS2_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -void QSS2_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void QSS2_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void QSS2_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void QSS2_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param i - * @param q - * @param x - * @param lqu - */ -void QSS2_PAR_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -void QSS2_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -#endif /* QSS2_H_ */ +QSS_DECLARE_QUANTIZER_INTERFACE(QSS2) diff --git a/src/engine/qss/methods/qss3.c b/src/engine/qss/methods/qss3.c index b7b06aea..db1eb414 100644 --- a/src/engine/qss/methods/qss3.c +++ b/src/engine/qss/methods/qss3.c @@ -25,11 +25,7 @@ #include #include -#ifdef QSS_PARALLEL -void QSS3_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#else -void QSS3_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#endif +void QSS_FUNC_DECL(QSS3, init)(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) { int i; int states = simData->states; @@ -41,46 +37,23 @@ void QSS3_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) simData->q[cf0 + 1] = 0; simData->q[cf0 + 2] = 0; } -#ifdef QSS_PARALLEL - quantizer->state->qMap = simData->lp->qMap; - quantizer->ops->recomputeNextTimes = QSS3_PAR_recomputeNextTimes; - quantizer->ops->recomputeNextTime = QSS3_PAR_recomputeNextTime; - quantizer->ops->nextTime = QSS3_PAR_nextTime; - quantizer->ops->updateQuantizedState = QSS3_PAR_updateQuantizedState; -#else - quantizer->ops->recomputeNextTimes = QSS3_recomputeNextTimes; - quantizer->ops->recomputeNextTime = QSS3_recomputeNextTime; - quantizer->ops->nextTime = QSS3_nextTime; - quantizer->ops->updateQuantizedState = QSS3_updateQuantizedState; -#endif + QSS_ASSIGN_QUANTIZER_OPS(QSS3) } -#ifdef QSS_PARALLEL -void QSS3_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#else -void QSS3_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(QSS3, recomputeNextTimes)(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, + double *q) { int i; -#ifdef QSS_PARALLEL - int *map = quantizer->state->qMap; -#endif + QSS_PARALLEL_EXP(int *map = quantizer->state->qMap;) for (i = 0; i < vars; i++) { -#ifdef QSS_PARALLEL - if (map[inf[i]] > NOT_ASSIGNED) { -#endif - QSS3_recomputeNextTime(quantizer, inf[i], t, nTime, x, lqu, q); -#ifdef QSS_PARALLEL - } -#endif + QSS_PARALLEL_EXP(if (map[inf[i]] != NOT_ASSIGNED) {) + QSS_FUNC_INVK(QSS3, recomputeNextTime)(quantizer, inf[i], t, nTime, x, lqu, q); + QSS_PARALLEL_EXP( + }) } } -#ifdef QSS_PARALLEL -void QSS3_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#else -void QSS3_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(QSS3, recomputeNextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) { int cf0 = var * 4, cf1 = cf0 + 1, cf2 = cf1 + 1, cf3 = cf2 + 1; double coeff[4]; @@ -100,11 +73,7 @@ void QSS3_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *n } } -#ifdef QSS_PARALLEL -void QSS3_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#else -void QSS3_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(QSS3, nextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) { int cf3 = var * 4 + 3; if (x[cf3]) { @@ -114,11 +83,7 @@ void QSS3_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, dou } } -#ifdef QSS_PARALLEL -void QSS3_PAR_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) -#else -void QSS3_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(QSS3, updateQuantizedState)(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) { int cf0 = i * 4, cf1 = cf0 + 1, cf2 = cf1 + 1; q[cf0] = x[cf0]; diff --git a/src/engine/qss/methods/qss3.h b/src/engine/qss/methods/qss3.h index 215107fb..72baf170 100644 --- a/src/engine/qss/methods/qss3.h +++ b/src/engine/qss/methods/qss3.h @@ -17,114 +17,10 @@ ******************************************************************************/ -#ifndef QSS3_H_ -#define QSS3_H_ +#pragma once +#include #include #include -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void QSS3_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void QSS3_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void QSS3_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param i - * @param q - * @param x - * @param lqu - */ -void QSS3_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -void QSS3_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void QSS3_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void QSS3_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void QSS3_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param i - * @param q - * @param x - * @param lqu - */ -void QSS3_PAR_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -void QSS3_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -#endif /* QSS3_H_ */ +QSS_DECLARE_QUANTIZER_INTERFACE(QSS3) diff --git a/src/engine/qss/methods/qss4.c b/src/engine/qss/methods/qss4.c index d7b3a140..7a54569f 100644 --- a/src/engine/qss/methods/qss4.c +++ b/src/engine/qss/methods/qss4.c @@ -25,11 +25,7 @@ #include #include -#ifdef QSS_PARALLEL -void QSS4_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#else -void QSS4_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) -#endif +void QSS_FUNC_DECL(QSS4, init)(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) { int i; int states = simData->states; @@ -43,25 +39,10 @@ void QSS4_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime) simData->q[cf0 + 2] = 0; simData->q[cf0 + 3] = 0; } -#ifdef QSS_PARALLEL - quantizer->state->qMap = simData->lp->qMap; - quantizer->ops->recomputeNextTimes = QSS4_PAR_recomputeNextTimes; - quantizer->ops->recomputeNextTime = QSS4_PAR_recomputeNextTime; - quantizer->ops->nextTime = QSS4_PAR_nextTime; - quantizer->ops->updateQuantizedState = QSS4_PAR_updateQuantizedState; -#else - quantizer->ops->recomputeNextTimes = QSS4_recomputeNextTimes; - quantizer->ops->recomputeNextTime = QSS4_recomputeNextTime; - quantizer->ops->nextTime = QSS4_nextTime; - quantizer->ops->updateQuantizedState = QSS4_updateQuantizedState; -#endif + QSS_ASSIGN_QUANTIZER_OPS(QSS4) } -#ifdef QSS_PARALLEL -void QSS4_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#else -void QSS4_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(QSS4, nextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) { int cf4 = var * 5 + 4; if (x[cf4]) { @@ -71,11 +52,7 @@ void QSS4_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, dou } } -#ifdef QSS_PARALLEL -void QSS4_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#else -void QSS4_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(QSS4, recomputeNextTime)(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) { int cf0 = var * 5, cf1 = cf0 + 1, cf2 = cf1 + 1, cf3 = cf2 + 1, cf4 = cf3 + 1; double coeff[5]; @@ -96,32 +73,20 @@ void QSS4_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *n } } -#ifdef QSS_PARALLEL -void QSS4_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#else -void QSS4_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) -#endif +void QSS_FUNC_DECL(QSS4, recomputeNextTimes)(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, + double *q) { int i; -#ifdef QSS_PARALLEL - int *map = quantizer->state->qMap; -#endif + QSS_PARALLEL_EXP(int *map = quantizer->state->qMap;) for (i = 0; i < vars; i++) { -#ifdef QSS_PARALLEL - if (map[inf[i]] > NOT_ASSIGNED) { -#endif - QSS4_recomputeNextTime(quantizer, inf[i], t, nTime, x, lqu, q); -#ifdef QSS_PARALLEL - } -#endif + QSS_PARALLEL_EXP(if (map[inf[i]] != NOT_ASSIGNED) {) + QSS_FUNC_INVK(QSS4, recomputeNextTime)(quantizer, inf[i], t, nTime, x, lqu, q); + QSS_PARALLEL_EXP( + }) } } -#ifdef QSS_PARALLEL -void QSS4_PAR_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) -#else -void QSS4_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) -#endif +void QSS_FUNC_DECL(QSS4, updateQuantizedState)(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) { int cf0 = i * 5, cf1 = cf0 + 1, cf2 = cf1 + 1, cf3 = cf2 + 1; q[cf0] = x[cf0]; diff --git a/src/engine/qss/methods/qss4.h b/src/engine/qss/methods/qss4.h index 1eeffecf..c67ee015 100644 --- a/src/engine/qss/methods/qss4.h +++ b/src/engine/qss/methods/qss4.h @@ -17,115 +17,10 @@ ******************************************************************************/ -#ifndef QSS4_H_ -#define QSS4_H_ +#pragma once +#include #include #include -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -void QSS4_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void QSS4_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void QSS4_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void QSS4_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param i - * @param q - * @param x - * @param lqu - */ -void QSS4_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) __attribute__((hot)); - -/** - * - * @param quantizer - * @param simData - * @param simTime - */ -void QSS4_PAR_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime); - -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - */ -void QSS4_PAR_nextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu) __attribute__((hot)); -/** - * - * @param quantizer - * @param var - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void QSS4_PAR_recomputeNextTime(QA_quantizer quantizer, int var, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param vars - * @param inf - * @param t - * @param nTime - * @param x - * @param lqu - * @param q - */ -void QSS4_PAR_recomputeNextTimes(QA_quantizer quantizer, int vars, int *inf, double t, double *nTime, double *x, double *lqu, double *q) - __attribute__((hot)); -/** - * - * @param quantizer - * @param i - * @param q - * @param x - * @param lqu - */ -void QSS4_PAR_updateQuantizedState(QA_quantizer quantizer, int i, double *q, double *x, double *lqu) __attribute__((hot)); - -#endif /* QSS4_H_ */ +QSS_DECLARE_QUANTIZER_INTERFACE(QSS4)