@@ -57,16 +57,16 @@ static const char *dasslJacobianMethodStr[DASSL_JAC_MAX] = {"unknown",
5757 "coloredNumerical" ,
5858 "coloredSymbolical" ,
5959 "internalNumerical" ,
60- "symbolical " ,
61- "numerical "
60+ "numerical " ,
61+ "symbolical "
6262 };
6363
6464static const char * dasslJacobianMethodDescStr [DASSL_JAC_MAX ] = {"unknown" ,
6565 "colored numerical jacobian - default." ,
6666 "colored symbolic jacobian - needs omc compiler flags +generateSymbolicJacobian or +generateSymbolicLinearization." ,
67- "internal numerical jacobian."
68- "symbolic jacobian - needs omc compiler flags +generateSymbolicJacobian or +generateSymbolicLinearization ." ,
69- "numerical jacobian."
67+ "internal numerical jacobian." ,
68+ "numerical jacobian." ,
69+ "symbolic jacobian - needs omc compiler flags +generateSymbolicJacobian or +generateSymbolicLinearization ."
7070 };
7171
7272/* experimental flag for SKF TLM Master Solver Interface
@@ -346,19 +346,17 @@ int dassl_initial(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo,
346346 /* selects the calculation method of the jacobian */
347347 if (dasslData -> dasslJacobian == DASSL_COLOREDNUMJAC ||
348348 dasslData -> dasslJacobian == DASSL_COLOREDSYMJAC ||
349- dasslData -> dasslJacobian == DASSL_NUMJAC ||
350349 dasslData -> dasslJacobian == DASSL_SYMJAC )
351350 {
352351 if (data -> callback -> initialAnalyticJacobianA (data , threadData ))
353352 {
354353 infoStreamPrint (LOG_STDOUT , 0 , "Jacobian or SparsePattern is not generated or failed to initialize! Switch back to normal." );
355354 dasslData -> dasslJacobian = DASSL_INTERNALNUMJAC ;
356355 }
357- else
358- {
359- dasslData -> info [4 ] = 1 ; /* use sub-routine JAC */
360- }
361356 }
357+ /* default use a user sub-routine for JAC */
358+ dasslData -> info [4 ] = 1 ;
359+
362360 /* set up the appropriate function pointer */
363361 switch (dasslData -> dasslJacobian ){
364362 case DASSL_COLOREDNUMJAC :
@@ -377,6 +375,8 @@ int dassl_initial(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo,
377375 break ;
378376 case DASSL_INTERNALNUMJAC :
379377 dasslData -> jacobianFunction = dummy_Jacobian ;
378+ /* no user sub-routine for JAC */
379+ dasslData -> info [4 ] = 0 ;
380380 break ;
381381 default :
382382 throwStreamPrint (threadData ,"unrecognized jacobian calculation method %s" , (const char * )omc_flagValue [FLAG_DASSL_JACOBIAN ]);
@@ -912,15 +912,6 @@ int functionJacAColored(DATA* data, threadData_t *threadData, double* jac)
912912 if (data -> simulationInfo .analyticJacobians [index ].sparsePattern .colorCols [ii ]- 1 == i )
913913 data -> simulationInfo .analyticJacobians [index ].seedVars [ii ] = 1 ;
914914
915- /*
916- // debug output
917- if(ACTIVE_STREAM((LOG_JAC | LOG_ENDJAC))){
918- printf("Caluculate one col:\n");
919- for(l=0; l < data->simulationInfo.analyticJacobians[index].sizeCols;l++)
920- infoStreamPrint((LOG_JAC | LOG_ENDJAC),"seed: data->simulationInfo.analyticJacobians[index].seedVars[%d]= %f",l,data->simulationInfo.analyticJacobians[index].seedVars[l]);
921- }
922- */
923-
924915 data -> callback -> functionJacA_column (data , threadData );
925916
926917 for (j = 0 ; j < data -> simulationInfo .analyticJacobians [index ].sizeCols ; j ++ )
@@ -936,26 +927,13 @@ int functionJacAColored(DATA* data, threadData_t *threadData, double* jac)
936927 l = data -> simulationInfo .analyticJacobians [index ].sparsePattern .index [ii ];
937928 k = j * data -> simulationInfo .analyticJacobians [index ].sizeRows + l ;
938929 jac [k ] = data -> simulationInfo .analyticJacobians [index ].resultVars [l ];
939- /*infoStreamPrint((LOG_JAC | LOG_ENDJAC),"write %d. in jac[%d]-[%d,%d]=%f from col[%d]=%f",ii,k,l,j,jac[k],l,data->simulationInfo.analyticJacobians[index].resultVars[l]);*/
940930 ii ++ ;
941931 };
942932 }
943933 }
944934 for (ii = 0 ; ii < data -> simulationInfo .analyticJacobians [index ].sizeCols ; ii ++ )
945935 if (data -> simulationInfo .analyticJacobians [index ].sparsePattern .colorCols [ii ]- 1 == i ) data -> simulationInfo .analyticJacobians [index ].seedVars [ii ] = 0 ;
946936
947- /*
948- // debug output
949- if(ACTIVE_STREAM((LOG_JAC | LOG_ENDJAC))){
950- infoStreamPrint("Print jac:");
951- for(l=0; l < data->simulationInfo.analyticJacobians[index].sizeCols;l++)
952- {
953- for(k=0; k < data->simulationInfo.analyticJacobians[index].sizeRows;k++)
954- printf("% .5e ",jac[l+k*data->simulationInfo.analyticJacobians[index].sizeRows]);
955- printf("\n");
956- }
957- }
958- */
959937 }
960938
961939 TRACE_POP
@@ -974,37 +952,15 @@ int functionJacASym(DATA* data, threadData_t *threadData, double* jac)
974952 {
975953 data -> simulationInfo .analyticJacobians [index ].seedVars [i ] = 1.0 ;
976954
977- /*
978- // debug output
979- if(ACTIVE_STREAM((LOG_JAC | LOG_ENDJAC)))
980- {
981- printf("Caluculate one col:\n");
982- for(j=0; j < data->simulationInfo.analyticJacobians[index].sizeCols;j++)
983- infoStreamPrint((LOG_JAC | LOG_ENDJAC),"seed: data->simulationInfo.analyticJacobians[index].seedVars[%d]= %f",j,data->simulationInfo.analyticJacobians[index].seedVars[j]);
984- }
985- */
986-
987955 data -> callback -> functionJacA_column (data , threadData );
988956
989957 for (j = 0 ; j < data -> simulationInfo .analyticJacobians [index ].sizeRows ; j ++ )
990958 {
991959 jac [k ++ ] = data -> simulationInfo .analyticJacobians [index ].resultVars [j ];
992- /*infoStreamPrint((LOG_JAC | LOG_ENDJAC),"write in jac[%d]-[%d,%d]=%g from row[%d]=%g",k,i,j,jac[k-1],j,data->simulationInfo.analyticJacobians[index].resultVars[j]);*/
993960 }
994961
995962 data -> simulationInfo .analyticJacobians [index ].seedVars [i ] = 0.0 ;
996963 }
997- // debug output; would be optimized away if the code compiled
998- /* if(DEBUG_STREAM(LOG_DEBUG))
999- {
1000- infoStreamPrint("Print jac:");
1001- for(i=0; i < data->simulationInfo.analyticJacobians[index].sizeRows;i++)
1002- {
1003- for(j=0; j < data->simulationInfo.analyticJacobians[index].sizeCols;j++)
1004- printf("% .5e ",jac[i+j*data->simulationInfo.analyticJacobians[index].sizeCols]);
1005- printf("\n");
1006- }
1007- } */
1008964
1009965 TRACE_POP
1010966 return 0 ;
@@ -1142,20 +1098,6 @@ int jacA_num(DATA* data, double *t, double *y, double *yprime, double *delta, do
11421098 y [i ] = ysave ;
11431099 }
11441100
1145- /*
1146- * Debug output
1147- if(ACTIVE_STREAM(LOG_JAC))
1148- {
1149- infoStreamPrint(LOG_SOLVER, "Print jac:");
1150- for(i=0; i < data->simulationInfo.analyticJacobians[index].sizeRows;i++)
1151- {
1152- for(j=0; j < data->simulationInfo.analyticJacobians[index].sizeCols;j++)
1153- printf("%.20e ",matrixA[i+j*data->simulationInfo.analyticJacobians[index].sizeCols]);
1154- printf("\n");
1155- }
1156- }
1157- */
1158-
11591101 TRACE_POP
11601102 return 0 ;
11611103}
@@ -1246,28 +1188,13 @@ int jacA_numColored(DATA* data, double *t, double *y, double *yprime, double *de
12461188 l = data -> simulationInfo .analyticJacobians [index ].sparsePattern .index [j ];
12471189 k = l + ii * data -> simulationInfo .analyticJacobians [index ].sizeRows ;
12481190 matrixA [k ] = (dasslData -> newdelta [l ] - delta [l ]) * delta_hh [ii ];
1249- /*infoStreamPrint(ACTIVE_STREAM(LOG_JAC),"write %d. in jac[%d]-[%d,%d]=%e",ii,k,j,l,matrixA[k]);*/
12501191 j ++ ;
12511192 };
12521193 y [ii ] = ysave [ii ];
12531194 }
12541195 }
12551196 }
12561197
1257- /*
1258- * Debug output
1259- if(ACTIVE_STREAM(LOG_JAC))
1260- {
1261- infoStreamPrint(LOG_SOLVER, "Print jac:");
1262- for(i=0; i < data->simulationInfo.analyticJacobians[index].sizeRows;i++)
1263- {
1264- for(j=0; j < data->simulationInfo.analyticJacobians[index].sizeCols;j++)
1265- printf("%.20e ",matrixA[i+j*data->simulationInfo.analyticJacobians[index].sizeCols]);
1266- printf("\n");
1267- }
1268- }
1269- */
1270-
12711198 TRACE_POP
12721199 return 0 ;
12731200}
0 commit comments