\hypertarget{interfacegtool__historyauto__internal_1_1hstvarsoutputcheck}{}\section{gtool\+\_\+historyauto\+\_\+internal\+:\+:hstvarsoutputcheck Interface Reference}
\label{interfacegtool__historyauto__internal_1_1hstvarsoutputcheck}\index{gtool\+\_\+historyauto\+\_\+internal\+::hstvarsoutputcheck@{gtool\+\_\+historyauto\+\_\+internal\+::hstvarsoutputcheck}}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{interfacegtool__historyauto__internal_1_1hstvarsoutputcheck_a882bd2dcf18fc0518f57a25c5c4a0403}{hstvarsoutputcheck} (time, stime\+\_\+index)
\end{DoxyCompactItemize}


\subsection{Detailed Description}


Definition at line 341 of file gtool\+\_\+historyauto\+\_\+internal.\+f90.



\subsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{interfacegtool__historyauto__internal_1_1hstvarsoutputcheck_a882bd2dcf18fc0518f57a25c5c4a0403}\label{interfacegtool__historyauto__internal_1_1hstvarsoutputcheck_a882bd2dcf18fc0518f57a25c5c4a0403}} 
\index{gtool\+\_\+historyauto\+\_\+internal\+::hstvarsoutputcheck@{gtool\+\_\+historyauto\+\_\+internal\+::hstvarsoutputcheck}!hstvarsoutputcheck@{hstvarsoutputcheck}}
\index{hstvarsoutputcheck@{hstvarsoutputcheck}!gtool\+\_\+historyauto\+\_\+internal\+::hstvarsoutputcheck@{gtool\+\_\+historyauto\+\_\+internal\+::hstvarsoutputcheck}}
\subsubsection{\texorpdfstring{hstvarsoutputcheck()}{hstvarsoutputcheck()}}
{\footnotesize\ttfamily subroutine gtool\+\_\+historyauto\+\_\+internal\+::hstvarsoutputcheck\+::hstvarsoutputcheck (\begin{DoxyParamCaption}\item[{real(dp), intent(in)}]{time,  }\item[{integer, intent(out)}]{stime\+\_\+index }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Definition at line 424 of file gtool\+\_\+historyauto\+\_\+internal.\+f90.


\begin{DoxyCode}
424     \textcolor{comment}{!}
425     \textcolor{comment}{! 与えられた時刻 *time* が各変数にとって出力のタイミングかどうかを}
426     \textcolor{comment}{! 調査して output\_timing\_vars, output\_timing\_avr\_vars,}
427     \textcolor{comment}{! create\_timing\_vars, close\_timing\_vars, renew\_timing\_vars,}
428     \textcolor{comment}{! へ反映し, *time* に対応する}
429     \textcolor{comment}{! saved\_time の配列添字を stime\_index へ返します.}
430     \textcolor{comment}{!}
431     \textcolor{comment}{! また, ファイルのオープンクローズのタイミングであれば,}
432     \textcolor{comment}{! それらもこのサブルーチン内で行います.}
433     \textcolor{comment}{!}
434     \textcolor{comment}{! It is investigated whether "time" is output timing for}
435     \textcolor{comment}{! each variable, and the information is reflected to}
436     \textcolor{comment}{! "output\_timing\_vars", "output\_timing\_avr\_vars",}
437     \textcolor{comment}{! "create\_timing\_vars", "close\_timing\_vars", "renew\_timing\_vars".}
438     \textcolor{comment}{! And index of array "saved\_time" is returned to "stime\_index".}
439     \textcolor{comment}{!}
440     \textcolor{comment}{! And if current time is timing of open/close of files,}
441     \textcolor{comment}{! they are done in this subroutine.}
442     \textcolor{comment}{!}
443     \textcolor{keywordtype}{use }\hyperlink{namespacedc__trace}{dc\_trace}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}, \hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}, \hyperlink{namespacedc__trace_a2a38fceb4cf9baf298d63456238c3fea}{dbgmessage}
444     \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}, \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}
445     \textcolor{keywordtype}{use }\hyperlink{namespacegtool__history}{gtool\_history}\textcolor{keywordtype}{, only}: \hyperlink{interfacegtool__history__generic_1_1historyinitialized}{historyinitialized}, 
      \hyperlink{historyclose_8f90_a05bd27232ee951cef8bb19bd8a6f1a05}{historyclose}
446     \textcolor{keywordtype}{use }\hyperlink{namespacedc__date__types}{dc\_date\_types}\textcolor{keywordtype}{, only}: \hyperlink{structdc__date__types_1_1dc__difftime}{dc\_difftime}
447     \textcolor{keywordtype}{use }\hyperlink{namespacedc__date}{dc\_date}\textcolor{keywordtype}{, only}: \textcolor{keyword}{operator}(==), \textcolor{keyword}{operator}(>), \textcolor{keyword}{operator}(<), &
448       & \textcolor{keyword}{operator}(>=), \textcolor{keyword}{operator}(<=), \textcolor{keyword}{operator}(-), \hyperlink{interfacedc__date__generic_1_1dcdifftimeputline}{dcdifftimeputline}, &
449       & \hyperlink{interfacedc__date__generic_1_1evalsec}{evalsec}
450     \textcolor{keywordtype}{implicit none}
451     \textcolor{keywordtype}{real(DP)}, \textcolor{keywordtype}{intent(in)}:: time
452                               \textcolor{comment}{! 現在時刻. Current time}
453     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(out)}:: stime\_index
454 
455     \textcolor{keywordtype}{integer}:: tstep
456     \textcolor{keywordtype}{integer}:: stat, \hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}, startnum, endnum
457     \textcolor{keywordtype}{character(STRING)}:: cause\_c
458     \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{parameter}:: subname = \textcolor{stringliteral}{"HstVarsOutputCheck"}
459   \textcolor{keywordflow}{continue}
460     \textcolor{keyword}{call }\hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}(subname)
461     stat = \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}
462     cause\_c = \textcolor{stringliteral}{""}
463 
464     \textcolor{comment}{! 与えられた時刻がチェック済みかどうかを調べる}
465     \textcolor{comment}{! Examine whether given time is already checked or not}
466     \textcolor{comment}{!}
467     timestepsearch: \textcolor{keywordflow}{do}
468       \textcolor{keywordflow}{do} \hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i} = saved\_tstep, checked\_tstepnum
469         \textcolor{keywordflow}{if} ( saved\_time(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) == time ) \textcolor{keywordflow}{then}
470           tstep = \hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}
471           \textcolor{keywordflow}{exit} timestepsearch
472 \textcolor{keywordflow}{        end if}
473 \textcolor{keywordflow}{      end do}
474       \textcolor{keywordflow}{do} \hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i} = 1, saved\_tstep - 1
475         \textcolor{keywordflow}{if} ( saved\_time(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) == time ) \textcolor{keywordflow}{then}
476           tstep = \hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}
477           \textcolor{keywordflow}{exit} timestepsearch
478 \textcolor{keywordflow}{        end if}
479 \textcolor{keywordflow}{      end do}
480 
481       tstep = 0
482       \textcolor{keywordflow}{exit} timestepsearch
483 \textcolor{keywordflow}{    end do} timestepsearch
484 
485     saved\_tstep = tstep
486 
487     \textcolor{keywordflow}{if} ( saved\_tstep /= 0 .and. checked\_tstep\_varnum == numvars ) \textcolor{keywordflow}{then}
488       \textcolor{comment}{! * output\_timing\_vars(:,saved\_tstep) を使う.}
489       \textcolor{comment}{! * saved\_tstep を stime\_index として返す.}
490 
491       stime\_index = saved\_tstep
492       \textcolor{keyword}{call }\hyperlink{namespacedc__trace_a2a38fceb4cf9baf298d63456238c3fea}{dbgmessage}( \textcolor{stringliteral}{'saved\_tstep=<%d> is already checked.'}, &
493         & \hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i} =(/ saved\_tstep /) )
494       \textcolor{keywordflow}{goto} 999
495 \textcolor{keywordflow}{    end if}
496 
497     \textcolor{comment}{! チェックする時間ステップと, 変数 ID の設定}
498     \textcolor{comment}{! Configure checked time step, and variable ID}
499     \textcolor{comment}{!}
500     \textcolor{keywordflow}{if} ( saved\_tstep /= 0 ) \textcolor{keywordflow}{then}
501       startnum = checked\_tstep\_varnum + 1
502 \textcolor{keyword}{      end}num   = numvars
503 
504       stime\_index = saved\_tstep
505     \textcolor{keywordflow}{else}
506       startnum = 1
507 \textcolor{keyword}{      end}num   = numvars
508 
509       \textcolor{keywordflow}{if} ( save\_tstepnum < 2 ) \textcolor{keywordflow}{then}
510         checked\_tstepnum = 1
511         saved\_time(checked\_tstepnum) = time
512 
513         saved\_tstep = checked\_tstepnum
514         stime\_index = saved\_tstep
515 
516       \textcolor{keywordflow}{elseif} ( .not. checked\_tstepnum < save\_tstepnum ) \textcolor{keywordflow}{then}
517         create\_timing\_vars(:,1:checked\_tstepnum-1) = create\_timing\_vars(:,2:checked\_tstepnum)
518         close\_timing\_vars(:,1:checked\_tstepnum-1) = close\_timing\_vars(:,2:checked\_tstepnum)
519         renew\_timing\_vars(:,1:checked\_tstepnum-1) = renew\_timing\_vars(:,2:checked\_tstepnum)
520         output\_timing\_vars(:,1:checked\_tstepnum-1) = output\_timing\_vars(:,2:checked\_tstepnum)
521         output\_timing\_avr\_vars(:,1:checked\_tstepnum-1) = output\_timing\_avr\_vars(:,2:checked\_tstepnum)
522 
523         saved\_time(1:checked\_tstepnum-1) = saved\_time(2:checked\_tstepnum)
524         saved\_time(checked\_tstepnum) = time
525 
526         saved\_tstep = checked\_tstepnum
527         stime\_index = saved\_tstep
528 
529       \textcolor{keywordflow}{else}
530         checked\_tstepnum = checked\_tstepnum + 1
531         saved\_time(checked\_tstepnum) = time
532 
533         saved\_tstep = checked\_tstepnum
534         stime\_index = saved\_tstep
535 \textcolor{keywordflow}{      end if}
536 \textcolor{keywordflow}{    end if}
537 
538     \textcolor{keyword}{call }\hyperlink{namespacedc__trace_a2a38fceb4cf9baf298d63456238c3fea}{dbgmessage}( \textcolor{stringliteral}{'numvar=<%d:%d> in saved\_tstep=<%d> will be checked from now.'}, &
539       & \hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i} =(/ startnum, endnum, saved\_tstep /) )
540 
541 
542     \textcolor{comment}{! それぞれのタイミングをチェックして各変数に格納}
543     \textcolor{comment}{!}
544     \textcolor{comment}{! * ファイルオープン:      create\_timing\_vars}
545     \textcolor{comment}{! * ファイルクローズ:      close\_timing\_vars}
546     \textcolor{comment}{! * ファイルクローズ/作成: renew\_timing\_vars}
547     \textcolor{comment}{! * データ出力:            output\_timing\_vars}
548     \textcolor{comment}{! * データ平均化:          output\_avr\_timing\_vars}
549 
550     create\_timing\_vars(startnum:endnum, checked\_tstepnum:checked\_tstepnum) = .false.
551     close\_timing\_vars(startnum:endnum, checked\_tstepnum:checked\_tstepnum) = .false.
552     renew\_timing\_vars(startnum:endnum, checked\_tstepnum:checked\_tstepnum) = .false.
553     output\_timing\_vars(startnum:endnum, checked\_tstepnum:checked\_tstepnum) = .false.
554     output\_timing\_avr\_vars(startnum:endnum, checked\_tstepnum:checked\_tstepnum) = .false.
555 
556     \textcolor{keywordflow}{do} \hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i} = startnum, endnum
557 
558       \textcolor{keywordflow}{if} ( .not. output\_valid\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) ) cycle
559 
560       \textcolor{keywordflow}{if} ( origin\_time\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) > time ) cycle
561 
562       \textcolor{keywordflow}{if} (             origin\_time\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) <= time &
563         &  .and.       (      terminus\_time\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) < zero\_time &
564         &                .or. terminus\_time\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) >= time      ) &
565         &  .and. .not. histaddvar\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i})            ) \textcolor{keywordflow}{then}
566 
567         create\_timing\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i},checked\_tstepnum) = .true.
568 
569         \textcolor{keywordflow}{if} ( newfile\_inttime\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) > zero\_time ) \textcolor{keywordflow}{then}
570           newfile\_createtime\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) = time
571 \textcolor{keywordflow}{        end if}
572 
573         output\_timing\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i},checked\_tstepnum) = .true.
574         output\_timing\_avr\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i},checked\_tstepnum) = tavr\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i})
575         cycle
576 \textcolor{keywordflow}{      end if}
577 
578       \textcolor{keywordflow}{if} ( terminus\_time\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) > zero\_time .and. terminus\_time\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) < time ) \textcolor{keywordflow}{then}
579         close\_timing\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i},checked\_tstepnum) = .true.
580         output\_timing\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i},checked\_tstepnum) = .false.
581         output\_timing\_avr\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i},checked\_tstepnum) = .false.
582         cycle
583 \textcolor{keywordflow}{      end if}
584 
585       \textcolor{comment}{! * newfile\_inttime\_vars だけでは, ぴったり一致しないとうまく行かない.}
586       \textcolor{comment}{!   * そこで...}
587       \textcolor{comment}{!     * 前回に出力した時刻を記憶しておく.}
588       \textcolor{comment}{!     * 前回の時刻と今回の時刻の差が newfile\_inttime\_vars}
589       \textcolor{comment}{!       よりも大きい場合には現ファイルを閉じ, 新ファイルを作成する.}
590 
591       \textcolor{keywordflow}{if} ( newfile\_inttime\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) > zero\_time ) \textcolor{keywordflow}{then}
592         \textcolor{keywordflow}{if} ( time - newfile\_createtime\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) >= newfile\_inttime\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) ) \textcolor{keywordflow}{then}
593           renew\_timing\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i},checked\_tstepnum) = .true.
594 
595           output\_timing\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i},checked\_tstepnum) = .true.
596           output\_timing\_avr\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i},checked\_tstepnum) = tavr\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i})
597 
598           cycle
599 \textcolor{keywordflow}{        end if}
600 \textcolor{keywordflow}{      end if}
601 
602       \textcolor{keywordflow}{if} ( time - prev\_outtime\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) >= interval\_time\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i}) ) \textcolor{keywordflow}{then}
603         output\_timing\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i},checked\_tstepnum) = .true.
604         output\_timing\_avr\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i},checked\_tstepnum) = tavr\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i})
605         cycle
606 \textcolor{keywordflow}{      end if}
607 
608       output\_timing\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i},checked\_tstepnum) = .false.
609       output\_timing\_avr\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i},checked\_tstepnum) = tavr\_vars(\hyperlink{namespacedcunits__com_a5742752149f55f07bd09fc85d59f7319}{i})
610 
611 \textcolor{keywordflow}{    end do}
612 
613     checked\_tstep\_varnum = numvars
614 
615 999 \textcolor{keywordflow}{continue}
616     \textcolor{keyword}{call }\hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}(stat, subname, cause\_c = cause\_c)
617     \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(subname)
\end{DoxyCode}


The documentation for this interface was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
gtool/gtool\+\_\+historyauto/\hyperlink{gtool__historyauto__internal_8f90}{gtool\+\_\+historyauto\+\_\+internal.\+f90}\end{DoxyCompactItemize}
