<p><b>croesch@ucar.edu</b> 2011-11-11 11:35:29 -0700 (Fri, 11 Nov 2011)</p><p>TRUNK COMMIT<br>
<br>
updated the output state initialization and finalization logic in the cores to remove a redundant finalization call<br>
</p><hr noshade><pre><font color="gray">Modified: trunk/mpas/src/core_hyd_atmos/mpas_atmh_mpas_core.F
===================================================================
--- trunk/mpas/src/core_hyd_atmos/mpas_atmh_mpas_core.F        2011-11-11 17:27:43 UTC (rev 1186)
+++ trunk/mpas/src/core_hyd_atmos/mpas_atmh_mpas_core.F        2011-11-11 18:35:29 UTC (rev 1187)
@@ -100,7 +100,11 @@
    
          if (mpas_is_alarm_ringing(clock, outputAlarmID, ierr=ierr)) then
             call mpas_reset_clock_alarm(clock, outputAlarmID, ierr=ierr)
-            if(output_frame == 1) call mpas_output_state_init(output_obj, domain, &quot;OUTPUT&quot;, trim(timeStamp)) ! output_frame will always be &gt; 1 here unless it is reset after the output file is finalized
+            ! output_frame will always be &gt; 1 here unless it was reset after the maximum number of frames per outfile was reached
+            if(output_frame == 1) then
+               call mpas_output_state_finalize(output_obj, domain % dminfo)
+               call mpas_output_state_init(output_obj, domain, &quot;OUTPUT&quot;, trim(timeStamp)) 
+            end if
             call atmh_write_output_frame(output_obj, output_frame, domain)
          end if
 
@@ -245,12 +249,11 @@
       call mpas_output_state_for_domain(output_obj, domain, output_frame)
       output_frame = output_frame + 1
 
-      ! if the maximum number of frames per outfile has been reached, finalize outfile and reset frame
+      ! reset frame if the maximum number of frames per outfile has been reached
       if (config_frames_per_outfile &gt; 0) then
          current_outfile_frames = current_outfile_frames + 1
          if(current_outfile_frames &gt;= config_frames_per_outfile) then
             current_outfile_frames = 0
-            call mpas_output_state_finalize(output_obj, domain % dminfo)
             output_frame = 1
          end if
       end if

Modified: trunk/mpas/src/core_nhyd_atmos/mpas_atm_mpas_core.F
===================================================================
--- trunk/mpas/src/core_nhyd_atmos/mpas_atm_mpas_core.F        2011-11-11 17:27:43 UTC (rev 1186)
+++ trunk/mpas/src/core_nhyd_atmos/mpas_atm_mpas_core.F        2011-11-11 18:35:29 UTC (rev 1187)
@@ -323,8 +323,11 @@
          !TODO: MPAS_getClockRingingAlarms is probably faster than multiple MPAS_isAlarmRinging...
          if (mpas_is_alarm_ringing(clock, outputAlarmID, ierr=ierr)) then
             call mpas_reset_clock_alarm(clock, outputAlarmID, ierr=ierr)
-            !output_frame will always be &gt; 1 here unless it is reset after the output file is finalized
-            if(output_frame == 1) call mpas_output_state_init(output_obj, domain, &quot;OUTPUT&quot;, trim(timeStamp)) 
+            ! output_frame will always be &gt; 1 here unless it was reset after the maximum number of frames per outfile was reached
+            if(output_frame == 1) then
+               call mpas_output_state_finalize(output_obj, domain % dminfo)
+               call mpas_output_state_init(output_obj, domain, &quot;OUTPUT&quot;, trim(timeStamp))
+            end if
             call atm_write_output_frame(output_obj, output_frame, domain)
          end if
 
@@ -372,12 +375,11 @@
       call mpas_output_state_for_domain(output_obj, domain, output_frame)
       output_frame = output_frame + 1
    
-      ! if the maximum number of frames per outfile has been reached, finalize outfile and reset frame   
+      ! reset frame if the maximum number of frames per outfile has been reached
       if (config_frames_per_outfile &gt; 0) then
          current_outfile_frames = current_outfile_frames + 1            
          if(current_outfile_frames &gt;= config_frames_per_outfile) then
             current_outfile_frames = 0
-            call mpas_output_state_finalize(output_obj, domain % dminfo)
             output_frame = 1
          end if
       end if

Modified: trunk/mpas/src/core_ocean/mpas_ocn_mpas_core.F
===================================================================
--- trunk/mpas/src/core_ocean/mpas_ocn_mpas_core.F        2011-11-11 17:27:43 UTC (rev 1186)
+++ trunk/mpas/src/core_ocean/mpas_ocn_mpas_core.F        2011-11-11 18:35:29 UTC (rev 1187)
@@ -321,7 +321,11 @@
       
          if (mpas_is_alarm_ringing(clock, outputAlarmID, ierr=ierr)) then
             call mpas_reset_clock_alarm(clock, outputAlarmID, ierr=ierr)
-            if(output_frame == 1) call mpas_output_state_init(output_obj, domain, &quot;OUTPUT&quot;, trim(timeStamp)) ! output_frame will always be &gt; 1 here unless it is reset after the output file is finalized
+            ! output_frame will always be &gt; 1 here unless it was reset after the maximum number of frames per outfile was reached
+            if(output_frame == 1) then
+               call mpas_output_state_finalize(output_obj, domain % dminfo)
+               call mpas_output_state_init(output_obj, domain, &quot;OUTPUT&quot;, trim(timeStamp))
+            end if
             call write_output_frame(output_obj, output_frame, domain)
          end if
 
@@ -368,12 +372,11 @@
       call mpas_output_state_for_domain(output_obj, domain, output_frame)
       output_frame = output_frame + 1
 
-      ! if the maximum number of frames per outfile has been reached, finalize outfile and reset frame
+      ! reset frame if the maximum number of frames per outfile has been reached
       if (config_frames_per_outfile &gt; 0) then
          current_outfile_frames = current_outfile_frames + 1            
          if(current_outfile_frames &gt;= config_frames_per_outfile) then
             current_outfile_frames = 0
-            call mpas_output_state_finalize(output_obj, domain % dminfo)
             output_frame = 1
          end if
       end if

Modified: trunk/mpas/src/core_sw/mpas_sw_mpas_core.F
===================================================================
--- trunk/mpas/src/core_sw/mpas_sw_mpas_core.F        2011-11-11 17:27:43 UTC (rev 1186)
+++ trunk/mpas/src/core_sw/mpas_sw_mpas_core.F        2011-11-11 18:35:29 UTC (rev 1187)
@@ -192,7 +192,11 @@
 
          if (mpas_is_alarm_ringing(clock, outputAlarmID, ierr=ierr)) then
             call mpas_reset_clock_alarm(clock, outputAlarmID, ierr=ierr)
-            if(output_frame == 1) call mpas_output_state_init(output_obj, domain, &quot;OUTPUT&quot;, trim(timeStamp)) ! output_frame will always be &gt; 1 here unless it is reset after the output file is finalized
+            ! output_frame will always be &gt; 1 here unless it was reset after the maximum number of frames per outfile was reached
+            if(output_frame == 1) then
+               call mpas_output_state_finalize(output_obj, domain % dminfo)
+               call mpas_output_state_init(output_obj, domain, &quot;OUTPUT&quot;, trim(timeStamp))
+            end if
             call write_output_frame(output_obj, output_frame, domain)
          end if
 
@@ -240,12 +244,11 @@
       call mpas_output_state_for_domain(output_obj, domain, output_frame)
       output_frame = output_frame + 1
 
-      ! if the maximum number of frames per outfile has been reached, finalize outfile and reset frame   
+      ! reset frame if the maximum number of frames per outfile has been reached
       if (config_frames_per_outfile &gt; 0) then
          current_outfile_frames = current_outfile_frames + 1            
          if(current_outfile_frames &gt;= config_frames_per_outfile) then
             current_outfile_frames = 0
-            call mpas_output_state_finalize(output_obj, domain % dminfo)
             output_frame = 1
          end if
       end if

</font>
</pre>