<p><b>duda</b> 2011-10-12 17:39:32 -0600 (Wed, 12 Oct 2011)</p><p>BRANCH COMMIT<br>
<br>
Add calls to create an empty (actually, with one dimension) netCDF file using PIO.<br>
<br>
Need to investigate further why the Fortran 'save' attribute needs to be added<br>
to declarations of any io_output_object types after a member of PIO's file_desc_type<br>
was added to the io_output_object type.<br>
<br>
<br>
M src/core_sw/module_mpas_core.F<br>
M src/driver/module_mpas_subdriver.F<br>
M src/framework/module_io_output.F<br>
</p><hr noshade><pre><font color="gray">Modified: branches/pio/src/core_sw/module_mpas_core.F
===================================================================
--- branches/pio/src/core_sw/module_mpas_core.F        2011-10-12 22:54:20 UTC (rev 1069)
+++ branches/pio/src/core_sw/module_mpas_core.F        2011-10-12 23:39:32 UTC (rev 1070)
@@ -3,7 +3,7 @@
use mpas_framework
use mpas_timekeeping
- type (io_output_object) :: restart_obj
+ type (io_output_object), save :: restart_obj
integer :: restart_frame
integer :: current_outfile_frames
Modified: branches/pio/src/driver/module_mpas_subdriver.F
===================================================================
--- branches/pio/src/driver/module_mpas_subdriver.F        2011-10-12 22:54:20 UTC (rev 1069)
+++ branches/pio/src/driver/module_mpas_subdriver.F        2011-10-12 23:39:32 UTC (rev 1070)
@@ -5,7 +5,7 @@
type (dm_info), pointer :: dminfo
type (domain_type), pointer :: domain
- type (io_output_object) :: output_obj
+ type (io_output_object), save :: output_obj
integer :: output_frame
Modified: branches/pio/src/framework/module_io_output.F
===================================================================
--- branches/pio/src/framework/module_io_output.F        2011-10-12 22:54:20 UTC (rev 1069)
+++ branches/pio/src/framework/module_io_output.F        2011-10-12 23:39:32 UTC (rev 1070)
@@ -4,12 +4,17 @@
use dmpar
use sort
use configure
+ use pio
+ use pio_types
integer, parameter :: OUTPUT = 1
integer, parameter :: RESTART = 2
integer, parameter :: SFC = 3
type io_output_object
+ type (iosystem_desc_t) :: pio_iosystem
+ type (file_desc_t) :: pio_file
+
integer :: wr_ncid
character (len=1024) :: filename
@@ -67,6 +72,10 @@
type (block_type), pointer :: block_ptr
#include "output_dim_actual_decls.inc"
+write(0,*) 'MGD PIO_init'
+ call PIO_init(domain % dminfo % my_proc_id, domain % dminfo % comm, domain % dminfo % nprocs, &
+ 0, 1, PIO_rearr_box, output_obj % pio_iosystem)
+
block_ptr => domain % blocklist
nullify(output_obj % sendCellsList)
nullify(output_obj % recvCellsList)
@@ -378,6 +387,9 @@
integer :: nferr
integer, dimension(10) :: dimlist
+
+write(0,*) 'MGD PIO_createfile'
+ nferr = PIO_createfile(output_obj % pio_iosystem, output_obj % pio_file, PIO_iotype_netcdf, 'pio_output.nc')
if (dminfo % my_proc_id == 0) then
#ifdef OFFSET64BIT
@@ -402,6 +414,12 @@
nferr = nf_enddef(output_obj % wr_ncid)
end if
+
+write(0,*) 'MGD PIO_def_dim'
+ nferr = PIO_def_dim(output_obj % pio_file, 'test', 100, dimlist(1))
+
+write(0,*) 'MGD PIO_enddef'
+ nferr = PIO_enddef(output_obj % pio_file)
end subroutine io_output_init
@@ -855,6 +873,12 @@
type (dm_info), intent(in) :: dminfo
integer :: nferr
+
+write(0,*) 'MGD PIO_closefile'
+ call PIO_closefile(output_obj % pio_file)
+
+write(0,*) 'MGD PIO_finalize'
+ call PIO_finalize(output_obj % pio_iosystem, nferr)
if (dminfo % my_proc_id == 0) then
nferr = nf_close(output_obj % wr_ncid)
</font>
</pre>