diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc index 933ae44a0b1fe7b8d42e57a6865bfec6ef501d9d..76b6671eafd73236c60f58a08f4c9acf3bc096c1 100644 --- a/src/DynamicModel.cc +++ b/src/DynamicModel.cc @@ -632,9 +632,9 @@ DynamicModel::writeDynamicPerBlockCFiles(const string &basename) const if (simulation_type == BlockSimulationType::evaluateBackward || simulation_type == BlockSimulationType::evaluateForward) - output << "void dynamic_" << blk+1 << "(double *y, const double *x, int nb_row_x, const double *params, const double *steady_state, double *T, int it_, bool stochastic_mode, double *g1_i, double *g1_j, double *g1_v, double *g1_x_i, double *g1_x_j, double *g1_x_v, double *g1_xd_i, double *g1_xd_j, double *g1_xd_v, double *g1_o_i, double *g1_o_j, double *g1_o_v)" << endl; + output << "void dynamic_" << blk+1 << "(double *restrict y, const double *restrict x, int nb_row_x, const double *restrict params, const double *restrict steady_state, double *restrict T, int it_, bool stochastic_mode, double *restrict g1_i, double *restrict g1_j, double *restrict g1_v, double *restrict g1_x_i, double *restrict g1_x_j, double *restrict g1_x_v, double *restrict g1_xd_i, double *restrict g1_xd_j, double *restrict g1_xd_v, double *restrict g1_o_i, double *restrict g1_o_j, double *restrict g1_o_v)" << endl; else - output << "void dynamic_" << blk+1 << "(const double *y, const double *x, int nb_row_x, const double *params, const double *steady_state, double *T, int it_, bool stochastic_mode, double *residual, double *g1_i, double *g1_j, double *g1_v, double *g1_x_i, double *g1_x_j, double *g1_x_v, double *g1_xd_i, double *g1_xd_j, double *g1_xd_v, double *g1_o_i, double *g1_o_j, double *g1_o_v)" << endl; + output << "void dynamic_" << blk+1 << "(const double *restrict y, const double *restrict x, int nb_row_x, const double *restrict params, const double *restrict steady_state, double *restrict T, int it_, bool stochastic_mode, double *restrict residual, double *restrict g1_i, double *restrict g1_j, double *restrict g1_v, double *restrict g1_x_i, double *restrict g1_x_j, double *restrict g1_x_v, double *restrict g1_xd_i, double *restrict g1_xd_j, double *restrict g1_xd_v, double *restrict g1_o_i, double *restrict g1_o_j, double *restrict g1_o_v)" << endl; output << '{' << endl; writeDynamicPerBlockHelper(blk, output, ExprNodeOutputType::CDynamicModel, temporary_terms, @@ -2114,18 +2114,18 @@ DynamicModel::writeDynamicModel(const string &basename, ostream &DynamicOutput, for (size_t i = 0; i < d_output.size(); i++) { string funcname = i == 0 ? "resid" : "g" + to_string(i); - DynamicOutput << "void dynamic_" << funcname << "_tt(const double *y, const double *x, int nb_row_x, const double *params, const double *steady_state, int it_, double *T)" << endl + DynamicOutput << "void dynamic_" << funcname << "_tt(const double *restrict y, const double *restrict x, int nb_row_x, const double *restrict params, const double *restrict steady_state, int it_, double *restrict T)" << endl << "{" << endl << tt_output[i].str() << "}" << endl << endl - << "void dynamic_" << funcname << "(const double *y, const double *x, int nb_row_x, const double *params, const double *steady_state, int it_, const double *T, "; + << "void dynamic_" << funcname << "(const double *restrict y, const double *restrict x, int nb_row_x, const double *restrict params, const double *restrict steady_state, int it_, const double *restrict T, "; if (i == 0) - DynamicOutput << "double *residual"; + DynamicOutput << "double *restrict residual"; else if (i == 1) - DynamicOutput << "double *g1"; + DynamicOutput << "double *restrict g1"; else - DynamicOutput << "double *" << funcname << "_i, double *" << funcname << "_j, double *" << funcname << "_v"; + DynamicOutput << "double *restrict " << funcname << "_i, double *restrict " << funcname << "_j, double *restrict " << funcname << "_v"; DynamicOutput << ")" << endl << "{" << endl; if (i == 0) diff --git a/src/StaticModel.cc b/src/StaticModel.cc index 1cbd21b673ed5c0820893e257db61533e0e25ccf..69a93ec9b27a0952dac284a0d3b8ae5bccd87565 100644 --- a/src/StaticModel.cc +++ b/src/StaticModel.cc @@ -316,9 +316,9 @@ StaticModel::writeStaticPerBlockCFiles(const string &basename) const if (simulation_type == BlockSimulationType::evaluateBackward || simulation_type == BlockSimulationType::evaluateForward) - output << "void static_" << blk+1 << "(double *y, const double *x, const double *params, double *T)" << endl; + output << "void static_" << blk+1 << "(double *restrict y, const double *restrict x, const double *restrict params, double *restrict T)" << endl; else - output << "void static_" << blk+1 << "(const double *y, const double *x, const double *params, double *T, double *residual, double *g1_i, double *g1_j, double *g1_v)" << endl; + output << "void static_" << blk+1 << "(const double *restrict y, const double *restrict x, const double *restrict params, double *restrict T, double *restrict residual, double *restrict g1_i, double *restrict g1_j, double *restrict g1_v)" << endl; output << '{' << endl; writeStaticPerBlockHelper(blk, output, ExprNodeOutputType::CStaticModel, temporary_terms); @@ -1446,18 +1446,18 @@ StaticModel::writeStaticModel(const string &basename, for (size_t i = 0; i < d_output.size(); i++) { string funcname = i == 0 ? "resid" : "g" + to_string(i); - StaticOutput << "void static_" << funcname << "_tt(const double *y, const double *x, const double *params, double *T)" << endl + StaticOutput << "void static_" << funcname << "_tt(const double *restrict y, const double *restrict x, const double *restrict params, double *restrict T)" << endl << "{" << endl << tt_output[i].str() << "}" << endl << endl - << "void static_" << funcname << "(const double *y, const double *x, const double *params, const double *T, "; + << "void static_" << funcname << "(const double *restrict y, const double *restrict x, const double *restrict params, const double *restrict T, "; if (i == 0) - StaticOutput << "double *residual"; + StaticOutput << "double *restrict residual"; else if (i == 1) - StaticOutput << "double *g1"; + StaticOutput << "double *restrict g1"; else - StaticOutput << "double *" << funcname << "_i, double *" << funcname << "_j, double *" << funcname << "_v"; + StaticOutput << "double *restrict " << funcname << "_i, double *restrict " << funcname << "_j, double *restrict " << funcname << "_v"; StaticOutput << ")" << endl << "{" << endl; if (i == 0)