<p><b>dwj07@fsu.edu</b> 2013-04-02 11:25:38 -0600 (Tue, 02 Apr 2013)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        Adding parsing information for registry to handle Registry.xml<br>
        It now creates src/inc/model_variables.inc which includes definitions and declarations for modelName, coreName, and version.<br>
<br>
        These are now written to all output and restart files as global attributes. In addition, the history attribute is written to be<br>
        mpirun -n ${PROCS} ${CORE}_model.exe;<br>
<br>
        It currently doesn't append the history file to the end of the history from an input file.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/history_attribute/src/framework/mpas_io_output.F
===================================================================
--- branches/history_attribute/src/framework/mpas_io_output.F        2013-04-02 17:02:47 UTC (rev 2702)
+++ branches/history_attribute/src/framework/mpas_io_output.F        2013-04-02 17:25:38 UTC (rev 2703)
@@ -343,6 +343,11 @@
  
       integer :: nferr, ierr
       integer, dimension(10) :: dimlist
+      character (len=StrKIND) :: runCmd
+
+#include &quot;model_variables.inc&quot;
+
+      write(runCmd,'(a,i0,a,a,a)') 'mpirun -n ',domain % dminfo % nProcs, ' ', trim(coreName), '_model.exe;'
  
       call MPAS_createStream(output_obj % io_stream, trim(output_obj % filename), MPAS_IO_PNETCDF, MPAS_IO_WRITE, 1, nferr)
 
@@ -354,6 +359,10 @@
          call MPAS_writeStreamAtt(output_obj % io_stream, 'on_a_sphere', 'NO              ', nferr)
       end if
       call MPAS_writeStreamAtt(output_obj % io_stream, 'sphere_radius', mesh % sphere_radius, nferr)
+      call MPAS_writeStreamAtt(output_obj % io_stream, 'model_name', modelName, nferr)
+      call MPAS_writeStreamAtt(output_obj % io_stream, 'core_name', coreName, nferr)
+      call MPAS_writeStreamAtt(output_obj % io_stream, 'version', version, nferr)
+      call MPAS_writeStreamAtt(output_obj % io_stream, 'History', runCmd, nferr)
 
 #include &quot;add_output_atts.inc&quot;
  

Modified: branches/history_attribute/src/registry/gen_inc.c
===================================================================
--- branches/history_attribute/src/registry/gen_inc.c        2013-04-02 17:02:47 UTC (rev 2702)
+++ branches/history_attribute/src/registry/gen_inc.c        2013-04-02 17:25:38 UTC (rev 2703)
@@ -169,7 +169,19 @@
    fclose(fd);
 }
 
+void gen_history_attributes(char * modelname, char * corename, char * version)
+{
+        FILE *fd;
 
+        fd = fopen(&quot;model_variables.inc&quot;,&quot;w&quot;);
+        fortprintf(fd, &quot;      character (len=StrKIND) :: modelName, coreName, version</font>
<font color="blue">&quot;);
+        fortprintf(fd, &quot;      modelName = '%s'</font>
<font color="blue">&quot;, modelname);
+        fortprintf(fd, &quot;      coreName = '%s'</font>
<font color="blue">&quot;, corename);
+        fortprintf(fd, &quot;      version = '%s'</font>
<font color="gray">&quot;, version);
+        fclose(fd);
+}
+
+
 void gen_field_defs(struct group_list * groups, struct variable * vars, struct dimension * dims)
 {
    struct variable * var_ptr;

Modified: branches/history_attribute/src/registry/gen_inc.h
===================================================================
--- branches/history_attribute/src/registry/gen_inc.h        2013-04-02 17:02:47 UTC (rev 2702)
+++ branches/history_attribute/src/registry/gen_inc.h        2013-04-02 17:25:38 UTC (rev 2703)
@@ -1,4 +1,5 @@
 void gen_namelists(struct namelist *);
+void gen_history_attributes(char * modelname, char * corename, char * version);
 void gen_field_defs(struct group_list * groups, struct variable *, struct dimension *);
 void gen_reads(struct group_list * groups, struct variable *, struct dimension *);
 void gen_writes(struct group_list * groups, struct variable *, struct dimension *, struct namelist *);

Modified: branches/history_attribute/src/registry/parse.c
===================================================================
--- branches/history_attribute/src/registry/parse.c        2013-04-02 17:02:47 UTC (rev 2702)
+++ branches/history_attribute/src/registry/parse.c        2013-04-02 17:25:38 UTC (rev 2703)
@@ -19,6 +19,8 @@
    struct variable * vars;
    struct group_list * groups;
 
+   char modelname[1024], corename[1024], version[1024];
+
    if (argc != 2) {
       fprintf(stderr,&quot;Reading registry file from standard input</font>
<font color="gray">&quot;);
       regfile = stdin;
@@ -32,7 +34,7 @@
    dims = NULL;
    vars = NULL;
   
-   if (parse_reg_xml(regfile, &amp;nls, &amp;dims, &amp;vars, &amp;groups)) {
+   if (parse_reg_xml(regfile, &amp;nls, &amp;dims, &amp;vars, &amp;groups, &amp;modelname, &amp;corename, &amp;version)) {
       return 1;
    }
   
@@ -45,6 +47,7 @@
    sort_vars(vars);
    sort_group_vars(groups);
 
+   gen_history_attributes(modelname, corename, version);
    gen_namelists(nls);
    gen_field_defs(groups, vars, dims);
    gen_reads(groups, vars, dims);
@@ -53,7 +56,7 @@
    return 0;
 }
 
-int parse_reg_xml(FILE * regfile, struct namelist **nls, struct dimension ** dims, struct variable ** vars, struct group_list ** groups)
+int parse_reg_xml(FILE * regfile, struct namelist **nls, struct dimension ** dims, struct variable ** vars, struct group_list ** groups, char * modelname, char * corename, char * version)
 {
         struct namelist * nls_ptr, *nls_ptr2;
         struct namelist * nls_chk_ptr;
@@ -75,6 +78,7 @@
         const char *vararrname, *vararrtype, *vararrdims, *vararrpersistence;
         const char *varname, *varpersistence, *vartype, *vardims, *varunits, *vardesc, *vararrgroup, *varstreams;
         const char *varname_in_code;
+        const char *const_model, *const_core, *const_version;
 
         char dimensions[2048];
         char *dimension_list;
@@ -90,6 +94,26 @@
         *vars = var_ptr;
         *groups = grouplist_ptr;
 
+        // Get model information
+        const_model = ezxml_attr(registry, &quot;model&quot;);
+        const_core = ezxml_attr(registry, &quot;core&quot;);
+        const_version = ezxml_attr(registry, &quot;version&quot;);
+
+        if(const_model == NULL)
+                sprintf(modelname, &quot;MISSING&quot;);
+        else
+                sprintf(modelname, &quot;%s&quot;, const_model);
+
+        if(const_core == NULL)
+                sprintf(corename, &quot;MISSING&quot;);
+        else
+                sprintf(corename, &quot;%s&quot;, const_core);
+
+        if(const_version == NULL)
+                sprintf(version, &quot;MISSING&quot;);
+        else
+                sprintf(version, &quot;%s&quot;, const_version);
+
         // Parse Namelist Records
         for (nmlrecs_xml = ezxml_child(registry, &quot;nml_record&quot;); nmlrecs_xml; nmlrecs_xml = nmlrecs_xml-&gt;next){
                 nmlrecname = ezxml_attr(nmlrecs_xml, &quot;name&quot;);

</font>
</pre>