Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit f03616c

Browse files
author
vruge
committed
loop -> memcpy
1 parent aaeec2c commit f03616c

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

SimulationRuntime/c/simulation/solver/solver_main.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -981,10 +981,7 @@ static int rungekutta_step(DATA* data, threadData_t *threadData, SOLVER_INFO* so
981981

982982
/* We calculate k[0] before returning from this function.
983983
* We only want to calculate f() 4 times per call */
984-
for(i = 0; i < data->modelData->nStates; i++)
985-
{
986-
k[0][i] = stateDerOld[i];
987-
}
984+
memcpy(k[0], stateDerOld, data->modelData->nStates*sizeof(modelica_real));
988985

989986
for (j = 1; j < rk->work_states_ndims; j++)
990987
{
@@ -998,10 +995,8 @@ static int rungekutta_step(DATA* data, threadData_t *threadData, SOLVER_INFO* so
998995
data->callback->input_function(data, threadData);
999996
/* eval ode equations */
1000997
data->callback->functionODE(data, threadData);
1001-
for(i = 0; i < data->modelData->nStates; i++)
1002-
{
1003-
k[j][i] = stateDer[i];
1004-
}
998+
memcpy(k[j], stateDer, data->modelData->nStates*sizeof(modelica_real));
999+
10051000
}
10061001

10071002
for(i = 0; i < data->modelData->nStates; i++)

0 commit comments

Comments
 (0)