<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(&quot;input_field3dreal.inc&quot;, &quot;w&quot;);
+
+   var_ptr = vars;
+   while (var_ptr &amp;&amp; (var_ptr-&gt;ndims != 3 || var_ptr-&gt;vtype != REAL || var_ptr-&gt;timedim)) var_ptr = var_ptr-&gt;next;
+   if (var_ptr) {
+      fprintf(fd, &quot;      if (trim(field %% ioinfo %% fieldName) == \'%s\') then</font>
<font color="blue">&quot;, var_ptr-&gt;name_in_file);
+      fprintf(fd, &quot;         varID = input_obj %% rdVarID%s</font>
<font color="blue">&quot;, var_ptr-&gt;name_in_file);
+      var_ptr = var_ptr-&gt;next;
+      while (var_ptr) {
+         if (var_ptr-&gt;ndims == 3 &amp;&amp; var_ptr-&gt;vtype == REAL &amp;&amp; !var_ptr-&gt;timedim) {
+            fprintf(fd, &quot;      else if (trim(field %% ioinfo %% fieldName) == \'%s\') then</font>
<font color="blue">&quot;, var_ptr-&gt;name_in_file);
+            fprintf(fd, &quot;         varID = input_obj %% rdVarID%s</font>
<font color="blue">&quot;, var_ptr-&gt;name_in_file);
+         }
+         var_ptr = var_ptr-&gt;next;
+      }
+      fprintf(fd, &quot;      end if</font>
<font color="gray">&quot;);
+   }
+
+   fclose(fd);
+   
+   
+   /*
     *  Generate code to read 0d time-varying real fields
     */
    fd = fopen(&quot;input_field0dreal_time.inc&quot;, &quot;w&quot;);
@@ -1155,8 +1179,32 @@
    }
 
    fclose(fd);   
+   
+   
+   /*
+    *  Generate code to write 3d real fields
+    */
+   fd = fopen(&quot;output_field3dreal.inc&quot;, &quot;w&quot;);
 
+   var_ptr = vars;
+   while (var_ptr &amp;&amp; (var_ptr-&gt;ndims != 3 || var_ptr-&gt;vtype != REAL || var_ptr-&gt;timedim)) var_ptr = var_ptr-&gt;next;
+   if (var_ptr) {
+      fprintf(fd, &quot;      if (trim(field %% ioinfo %% fieldName) == \'%s\') then</font>
<font color="blue">&quot;, var_ptr-&gt;name_in_file);
+      fprintf(fd, &quot;         varID = output_obj %% wrVarID%s</font>
<font color="blue">&quot;, var_ptr-&gt;name_in_file);
+      var_ptr = var_ptr-&gt;next;
+      while (var_ptr) {
+         if (var_ptr-&gt;ndims == 3 &amp;&amp; var_ptr-&gt;vtype == REAL &amp;&amp; !var_ptr-&gt;timedim) {
+            fprintf(fd, &quot;      else if (trim(field %% ioinfo %% fieldName) == \'%s\') then</font>
<font color="blue">&quot;, var_ptr-&gt;name_in_file);
+            fprintf(fd, &quot;         varID = output_obj %% wrVarID%s</font>
<font color="blue">&quot;, var_ptr-&gt;name_in_file);
+         }
+         var_ptr = var_ptr-&gt;next;
+      }
+      fprintf(fd, &quot;      end if</font>
<font color="gray">&quot;);
+   }
 
+   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 &quot;input_field3dreal.inc&quot;
+
+#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 &quot;output_field3dreal.inc&quot;
+
+#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>