[mpas-developers] registry bugfix

Michael Duda duda at ucar.edu
Tue May 11 17:42:39 MDT 2010


Hi, Developers.

I have one more bug fix for the registry that I'd like to commit.
When a time-varying field with a constant dimension is specified
in the registry, the registry program will generate incorrect
Fortran code to allocate that field. For example, specifying the
following in the registry file would reveal the bug:

dim nCells nCells
dim R3 3

var real foo ( R3 nCells Time ) - foo - - 

A difference between the current gen_inc.c and the proposed
version is attached. If there are no objections, I'll commit the
attached changes.

Cheers,
Michael
-------------- next part --------------
579,586c579
<             if (!strncmp(dimlist_ptr->dim->name_in_file, "nCells", 1024) ||
<                 !strncmp(dimlist_ptr->dim->name_in_file, "nEdges", 1024) ||
<                 !strncmp(dimlist_ptr->dim->name_in_file, "nVertices", 1024))
<                fortprintf(fd, "b %% mesh %% %s + 1", dimlist_ptr->dim->name_in_code);
<             else
<                fortprintf(fd, "b %% mesh %% %s", dimlist_ptr->dim->name_in_code);
<             dimlist_ptr = dimlist_ptr->next;
<             while (dimlist_ptr) {
---
>             if (dimlist_ptr->dim->constant_value < 0) {
590c583
<                   fortprintf(fd, ", b %% mesh %% %s + 1", dimlist_ptr->dim->name_in_code);
---
>                   fortprintf(fd, "b %% mesh %% %s + 1", dimlist_ptr->dim->name_in_code);
592c585,602
<                   fortprintf(fd, ", b %% mesh %% %s", dimlist_ptr->dim->name_in_code);
---
>                   fortprintf(fd, "b %% mesh %% %s", dimlist_ptr->dim->name_in_code);
>             }
>             else {
>                fortprintf(fd, "%i", dimlist_ptr->dim->constant_value);
>             }
>             dimlist_ptr = dimlist_ptr->next;
>             while (dimlist_ptr) {
>                if (dimlist_ptr->dim->constant_value < 0) {
>                   if (!strncmp(dimlist_ptr->dim->name_in_file, "nCells", 1024) ||
>                       !strncmp(dimlist_ptr->dim->name_in_file, "nEdges", 1024) ||
>                       !strncmp(dimlist_ptr->dim->name_in_file, "nVertices", 1024))
>                      fortprintf(fd, ", b %% mesh %% %s + 1", dimlist_ptr->dim->name_in_code);
>                   else
>                      fortprintf(fd, ", b %% mesh %% %s", dimlist_ptr->dim->name_in_code);
>                }
>                else {
>                   fortprintf(fd, ", %i", dimlist_ptr->dim->constant_value);
>                }


More information about the mpas-developers mailing list