@@ -46,28 +46,46 @@ void Init_Load_DumpTable()
4646// stop the reading
4747 if ( input_line[0 ] == 42 ) // '*' == 42
4848 {
49-
5049// ensure that at least one data dump time is loaded
5150 if ( line == 0 )
5251 Aux_Error ( ERROR_INFO, " please provide at least one data dump time in the dump table !!\n " );
5352
54- DumpTable_NDump = line; // record the number of data dumps
55- DumpTable[line] = __FLT_MAX__; // set the next dump as an extremely large number
53+ DumpTable_NDump = line; // record the number of data dumps
54+ DumpTable[line] = __FLT_MAX__; // set the next dump as an extremely large number
5655
57- if ( DumpTable[line-1 ] < END_T )
56+ // for END_T < 0.0, reset the ending time as the time of the last dump
57+ if ( END_T < 0.0 )
5858 {
59- END_T = DumpTable[line-1 ]; // reset the ending time as the time of the last dump
59+ END_T = DumpTable[line-1 ];
6060
6161 if ( MPI_Rank == 0 )
62- Aux_Message ( stdout, " NOTE : the END_T is reset to the time of the last data dump = %13.7e\n " ,
63- END_T );
62+ Aux_Message ( stdout, " NOTE : END_T is reset to the time of the last data dump in %s: %13.7e\n " ,
63+ FileName, END_T );
6464 }
6565
66+ // for END_T >= 0.0, reset the ending time to the largest data dump time not greater than the input END_T
67+ else
68+ {
69+ for (int t=line-1 ; t>=0 ; t--)
70+ {
71+ if ( END_T >= DumpTable[t] )
72+ {
73+ END_T = DumpTable[t];
74+
75+ if ( MPI_Rank == 0 )
76+ Aux_Message ( stdout, " NOTE : END_T is reset to the largest time in %s not greater "
77+ " than the input END_T: %13.7e\n " ,
78+ FileName, END_T );
79+ break ;
80+ }
81+ }
82+ } // if ( END_T < 0.0 ) ... else ...
83+
6684
6785// verify the loaded dump table
6886 for (int t=1 ; t<=line; t++)
6987 {
70- if ( DumpTable[t] < DumpTable[t-1 ] )
88+ if ( DumpTable[t] <= DumpTable[t-1 ] )
7189 Aux_Error ( ERROR_INFO, " values recorded in \" %s\" must be monotonically increasing !!\n " ,
7290 FileName );
7391 }
@@ -79,14 +97,36 @@ void Init_Load_DumpTable()
7997
8098
8199 if ( line == MaxLine )
82- Aux_Error ( ERROR_INFO, " please prepare a symbol * in the end of the file <%s> !!\n " , FileName );
100+ Aux_Error ( ERROR_INFO, " please prepare a * symbol at the end of the file <%s> !!\n " , FileName );
83101
84102
85103 fclose ( File );
86104
87105 if ( input_line != NULL ) free ( input_line );
88106
89107
108+ // insert initial time Time[0]
109+ for (int t=0 ; t<DumpTable_NDump; t++)
110+ {
111+ // check if the initial time is already in the dump table
112+ if ( ( Time[0 ] != 0.0 && fabs ( (Time[0 ]-DumpTable[t])/Time[0 ] ) < 1.0e-8 ) ||
113+ ( Time[0 ] == 0.0 && fabs ( Time[0 ]-DumpTable[t] ) < 1.0e-12 ) ) break ;
114+
115+ // insert the initial time into the dump table
116+ if ( ( Time[0 ] < DumpTable[t] ) && ( t == 0 || Time[0 ] > DumpTable[t-1 ] ) )
117+ {
118+ for (int s=DumpTable_NDump; s>t; s--) DumpTable[s] = DumpTable[s-1 ];
119+ DumpTable[t] = Time[0 ];
120+ DumpTable_NDump ++;
121+
122+ if ( MPI_Rank == 0 )
123+ Aux_Message ( stdout, " NOTE : initial time %13.7e is inserted into the dump table\n " , Time[0 ] );
124+
125+ break ;
126+ }
127+ }
128+
129+
90130 if ( MPI_Rank == 0 ) Aux_Message ( stdout, " Init_Load_DumpTable ... done\n " );
91131
92132} // FUNCTION : Init_Load_DumpTable
0 commit comments