<p><b>duda</b> 2009-09-02 11:00:21 -0600 (Wed, 02 Sep 2009)</p><p>Add code to input/output real 3d time-invariant fields.<br>
<br>
M    src/module_io_input.F<br>
M    src/module_io_output.F<br>
M    Registry/gen_inc.c<br>
</p><hr noshade><pre><font color="gray">Modified: trunk/swmodel/Registry/gen_inc.c
===================================================================
--- trunk/swmodel/Registry/gen_inc.c        2009-08-26 05:34:56 UTC (rev 38)
+++ trunk/swmodel/Registry/gen_inc.c        2009-09-02 17:00:21 UTC (rev 39)
@@ -701,6 +701,30 @@
    
    
    /*
+    *  Generate code to read 3d real fields
+    */
+   fd = fopen("input_field3dreal.inc", "w");
+
+   var_ptr = vars;
+   while (var_ptr && (var_ptr->ndims != 3 || var_ptr->vtype != REAL || var_ptr->timedim)) var_ptr = var_ptr->next;
+   if (var_ptr) {
+      fprintf(fd, "      if (trim(field %% ioinfo %% fieldName) == \'%s\') then</font>
<font color="blue">", var_ptr->name_in_file);
+      fprintf(fd, "         varID = input_obj %% rdVarID%s</font>
<font color="blue">", var_ptr->name_in_file);
+      var_ptr = var_ptr->next;
+      while (var_ptr) {
+         if (var_ptr->ndims == 3 && var_ptr->vtype == REAL && !var_ptr->timedim) {
+            fprintf(fd, "      else if (trim(field %% ioinfo %% fieldName) == \'%s\') then</font>
<font color="blue">", var_ptr->name_in_file);
+            fprintf(fd, "         varID = input_obj %% rdVarID%s</font>
<font color="blue">", var_ptr->name_in_file);
+         }
+         var_ptr = var_ptr->next;
+      }
+      fprintf(fd, "      end if</font>
<font color="gray">");
+   }
+
+   fclose(fd);
+   
+   
+   /*
     *  Generate code to read 0d time-varying real fields
     */
    fd = fopen("input_field0dreal_time.inc", "w");
@@ -1155,8 +1179,32 @@
    }
 
    fclose(fd);   
+   
+   
+   /*
+    *  Generate code to write 3d real fields
+    */
+   fd = fopen("output_field3dreal.inc", "w");
 
+   var_ptr = vars;
+   while (var_ptr && (var_ptr->ndims != 3 || var_ptr->vtype != REAL || var_ptr->timedim)) var_ptr = var_ptr->next;
+   if (var_ptr) {
+      fprintf(fd, "      if (trim(field %% ioinfo %% fieldName) == \'%s\') then</font>
<font color="blue">", var_ptr->name_in_file);
+      fprintf(fd, "         varID = output_obj %% wrVarID%s</font>
<font color="blue">", var_ptr->name_in_file);
+      var_ptr = var_ptr->next;
+      while (var_ptr) {
+         if (var_ptr->ndims == 3 && var_ptr->vtype == REAL && !var_ptr->timedim) {
+            fprintf(fd, "      else if (trim(field %% ioinfo %% fieldName) == \'%s\') then</font>
<font color="blue">", var_ptr->name_in_file);
+            fprintf(fd, "         varID = output_obj %% wrVarID%s</font>
<font color="blue">", var_ptr->name_in_file);
+         }
+         var_ptr = var_ptr->next;
+      }
+      fprintf(fd, "      end if</font>
<font color="gray">");
+   }
 
+   fclose(fd);   
+
+
    
    /*
     *  Generate code to write 1d real fields
Modified: trunk/swmodel/src/module_io_input.F
===================================================================
--- trunk/swmodel/src/module_io_input.F        2009-08-26 05:34:56 UTC (rev 38)
+++ trunk/swmodel/src/module_io_input.F        2009-09-02 17:00:21 UTC (rev 39)
@@ -19,6 +19,7 @@
    interface io_input_field
       module procedure io_input_field1dReal
       module procedure io_input_field2dReal
+      module procedure io_input_field3dReal
       module procedure io_input_field1dInteger
       module procedure io_input_field2dInteger
    end interface io_input_field
@@ -758,6 +759,37 @@
    end subroutine io_input_field2dReal
 
 
+   subroutine io_input_field3dReal(input_obj, field)
+ 
+      implicit none
+
+      type (io_input_object), intent(in) :: input_obj      
+      type (field3dReal), intent(inout) :: field
+ 
+      include 'netcdf.inc'
+ 
+      integer :: nferr
+      integer :: varID
+      integer, dimension(3) :: start3, count3
+ 
+      start3(1) = field % ioinfo % start(1)
+      start3(2) = field % ioinfo % start(2)
+      start3(3) = field % ioinfo % start(3)
+      count3(1) = field % ioinfo % count(1)
+      count3(2) = field % ioinfo % count(2)
+      count3(3) = field % ioinfo % count(3)
+ 
+#include "input_field3dreal.inc"
+
+#if (RKIND == 8)
+      nferr = nf_get_vara_double(input_obj % rd_ncid, varID, start3, count3, field % array)
+#else
+      nferr = nf_get_vara_real(input_obj % rd_ncid, varID, start3, count3, field % array)
+#endif
+
+   end subroutine io_input_field3dReal
+
+
    subroutine io_input_field0dReal_time(input_obj, field)
  
       implicit none
Modified: trunk/swmodel/src/module_io_output.F
===================================================================
--- trunk/swmodel/src/module_io_output.F        2009-08-26 05:34:56 UTC (rev 38)
+++ trunk/swmodel/src/module_io_output.F        2009-09-02 17:00:21 UTC (rev 39)
@@ -27,6 +27,7 @@
    interface io_output_field
       module procedure io_output_field1dReal
       module procedure io_output_field2dReal
+      module procedure io_output_field3dReal
       module procedure io_output_field1dInteger
       module procedure io_output_field2dInteger
    end interface io_output_field
@@ -354,8 +355,41 @@
       nferr = nf_sync(output_obj % wr_ncid)
 
    end subroutine io_output_field2dReal
+ 
+ 
+   subroutine io_output_field3dReal(output_obj, field)
 
+      implicit none
 
+      type (io_output_object), intent(in) :: output_obj
+      type (field3dReal), intent(inout) :: field
+
+      include 'netcdf.inc'
+
+      integer :: nferr
+      integer :: varID
+      integer, dimension(3) :: start3, count3
+
+      start3(1) = field % ioinfo % start(1)
+      start3(2) = field % ioinfo % start(2)
+      start3(3) = field % ioinfo % start(3)
+      count3(1) = field % ioinfo % count(1)
+      count3(2) = field % ioinfo % count(2)
+      count3(3) = field % ioinfo % count(3)
+
+#include "output_field3dreal.inc"
+
+#if (RKIND == 8)
+      nferr = nf_put_vara_double(output_obj % wr_ncid, varID, start3, count3, field % array)
+#else
+      nferr = nf_put_vara_real(output_obj % wr_ncid, varID, start3, count3, field % array)
+#endif
+ 
+      nferr = nf_sync(output_obj % wr_ncid)
+
+   end subroutine io_output_field3dReal
+
+
    subroutine io_output_field0dReal_time(output_obj, field)
 
       implicit none
</font>
</pre>