Changeset 16227
- Timestamp:
- 10/10/18 12:00:19 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2925_AutoDiffForDynamicalModels/AutoDiffForDynamicalModelsTest/TestCvodes.cs
r16226 r16227 30 30 31 31 32 // simple temperature annealing33 int numberOfEquations = 1;32 // linear oscillator 33 int numberOfEquations = 2; 34 34 var y = Problem.N_VNew_Serial(numberOfEquations); 35 35 // y must be initialized before calling CVodeInit 36 36 // Problem.N_VConst_Serial(100.0, y); 37 Problem.NV_Set_Ith_S(y, 0, 100.0); 37 Problem.NV_Set_Ith_S(y, 0, 0.5); // x 38 Problem.NV_Set_Ith_S(y, 1, 1); // v 38 39 39 40 var cvode_mem = Problem.CVodeCreate(Problem.MultistepMethod.CV_ADAMS, Problem.NonlinearSolverIteration.CV_FUNCTIONAL); … … 65 66 flag = Problem.CVode(cvode_mem, tout, y, ref t, Problem.CV_NORMAL); 66 67 Assert.AreEqual(Problem.CV_SUCCESS, flag); 67 Console.WriteLine(" t={0} y={1}", t, Problem.N_VL1Norm_Serial(y));68 Console.WriteLine("{0} {1} {2}", t, Problem.NV_Get_Ith_S(y, 0), Problem.NV_Get_Ith_S(y, 1)); 68 69 // Problem.N_VPrint_Serial(y); 69 70 tout += 0.1; … … 87 88 IntPtr user_data) { 88 89 89 Problem.NV_Set_Ith_S(ydot, 0, -0.1 * Problem.NV_Get_Ith_S(y, 0)); 90 Problem.NV_Set_Ith_S(ydot, 0, Problem.NV_Get_Ith_S(y, 1)); 91 Problem.NV_Set_Ith_S(ydot, 1, -0.3 * Problem.NV_Get_Ith_S(y, 0)); 90 92 return 0; 91 93 ;
Note: See TracChangeset
for help on using the changeset viewer.