<p><b>duda</b> 2011-05-11 13:25:16 -0600 (Wed, 11 May 2011)</p><p>BRANCH COMMIT<br>
<br>
Changes to allow registry-defined fields to have a non-decomposed<br>
dimension as their outer-most dimension, i.e., to have a dimension<br>
other than nCells, nEdges, nVertices, or nVertLevels outer-most.<br>
<br>
For example, it is now possible to define the following in the registry:<br>
<br>
namelist integer physics noznlev 59<br>
dim nOznLevels namelist:noznlev<br>
var persistent real pin ( nOznLevels ) 0 ro pin mesh - -<br>
<br>
<br>
*** These changes should probably be merged back into the trunk.<br>
<br>
<br>
M src/registry/gen_inc.c<br>
M src/framework/module_io_input.F<br>
M src/framework/module_io_output.F<br>
</p><hr noshade><pre><font color="gray">Modified: branches/atmos_physics/src/framework/module_io_input.F
===================================================================
--- branches/atmos_physics/src/framework/module_io_input.F        2011-05-11 19:01:54 UTC (rev 827)
+++ branches/atmos_physics/src/framework/module_io_input.F        2011-05-11 19:25:16 UTC (rev 828)
@@ -1047,8 +1047,10 @@
real (kind=RKIND), dimension(:,:), pointer :: super_real2d
real (kind=RKIND), dimension(:,:,:), pointer :: super_real3d
- integer :: k
+ integer :: i, k
+#include "nondecomp_dims.inc"
+
allocate(int1d % ioinfo)
allocate(int2d % ioinfo)
allocate(real0d % ioinfo)
@@ -1059,6 +1061,8 @@
#include "io_input_fields.inc"
+#include "nondecomp_dims_dealloc.inc"
+
end subroutine read_and_distribute_fields
Modified: branches/atmos_physics/src/framework/module_io_output.F
===================================================================
--- branches/atmos_physics/src/framework/module_io_output.F        2011-05-11 19:01:54 UTC (rev 827)
+++ branches/atmos_physics/src/framework/module_io_output.F        2011-05-11 19:25:16 UTC (rev 828)
@@ -137,6 +137,8 @@
real (kind=RKIND), dimension(:,:), pointer :: super_real2d
real (kind=RKIND), dimension(:,:,:), pointer :: super_real3d
+#include "nondecomp_outputs.inc"
+
output_obj % time = itime
allocate(int1d % ioinfo)
@@ -311,6 +313,8 @@
deallocate(cellsOnVertex)
deallocate(edgesOnVertex)
+#include "nondecomp_outputs_dealloc.inc"
+
end subroutine output_state_for_domain
Modified: branches/atmos_physics/src/registry/gen_inc.c
===================================================================
--- branches/atmos_physics/src/registry/gen_inc.c        2011-05-11 19:01:54 UTC (rev 827)
+++ branches/atmos_physics/src/registry/gen_inc.c        2011-05-11 19:25:16 UTC (rev 828)
@@ -803,6 +803,396 @@
}
fclose(fd);
+
+ /*
+ * Definitions of read bounds and exchange lists for non-decomposed fields
+ */
+ fd = fopen("nondecomp_dims.inc", "w");
+
+ dim_ptr = dims;
+ while (dim_ptr) {
+
+ if (strncmp(dim_ptr->name_in_file,"nCells",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nEdges",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nVertices",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nVertLevels",11) != 0
+ ) {
+
+ if (is_derived_dim(dim_ptr->name_in_code)) {
+ fortprintf(fd, " integer :: read%sStart</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " integer :: read%sCount</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " type (exchange_list), pointer :: send%sList</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " type (exchange_list), pointer :: recv%sList</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ }
+ else if (dim_ptr->constant_value > 0) {
+ fortprintf(fd, " integer :: read%sStart</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " integer :: read%sCount</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " type (exchange_list), pointer :: send%sList</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " type (exchange_list), pointer :: recv%sList</font>
<font color="blue">", dim_ptr->name_in_file);
+ }
+ else if (dim_ptr->namelist_defined) {
+ fortprintf(fd, " integer :: read%sStart</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " integer :: read%sCount</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " type (exchange_list), pointer :: send%sList</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " type (exchange_list), pointer :: recv%sList</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ }
+ else {
+ fortprintf(fd, " integer :: read%sStart</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " integer :: read%sCount</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " type (exchange_list), pointer :: send%sList</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " type (exchange_list), pointer :: recv%sList</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ }
+ }
+
+ dim_ptr = dim_ptr->next;
+ }
+
+ fortprintf(fd, "</font>
<font color="blue">");
+
+ dim_ptr = dims;
+ while (dim_ptr) {
+
+ if (strncmp(dim_ptr->name_in_file,"nCells",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nEdges",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nVertices",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nVertLevels",11) != 0
+ ) {
+
+ if (is_derived_dim(dim_ptr->name_in_code)) {
+ fortprintf(fd, " read%sStart = 1</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " read%sCount = block %% mesh %% %s</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_code);
+ fortprintf(fd, " allocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " allocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " nullify(send%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " nullify(recv%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " recv%sList %% procID = dminfo %% my_proc_id</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " send%sList %% procID = dminfo %% my_proc_id</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " recv%sList %% nlist = read%sCount</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file+1);
+ fortprintf(fd, " send%sList %% nlist = read%sCount</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file+1);
+ fortprintf(fd, " allocate(recv%sList %% list(read%sCount))</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file+1);
+ fortprintf(fd, " allocate(send%sList %% list(read%sCount))</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file+1);
+ fortprintf(fd, " do i=1,read%sCount</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " recv%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " send%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " end do</font>
<font color="blue">");
+ fortprintf(fd, "</font>
<font color="blue">");
+ }
+ else if (dim_ptr->constant_value > 0) {
+ fortprintf(fd, " read%sStart = 1</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " read%sCount = %s</font>
<font color="blue">", dim_ptr->name_in_file, dim_ptr->name_in_code);
+ fortprintf(fd, " allocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " allocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " nullify(send%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " nullify(recv%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " recv%sList %% procID = dminfo %% my_proc_id</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " send%sList %% procID = dminfo %% my_proc_id</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " recv%sList %% nlist = read%sCount</font>
<font color="blue">", dim_ptr->name_in_file, dim_ptr->name_in_file);
+ fortprintf(fd, " send%sList %% nlist = read%sCount</font>
<font color="blue">", dim_ptr->name_in_file, dim_ptr->name_in_file);
+ fortprintf(fd, " allocate(recv%sList %% list(read%sCount))</font>
<font color="blue">", dim_ptr->name_in_file, dim_ptr->name_in_file);
+ fortprintf(fd, " allocate(send%sList %% list(read%sCount))</font>
<font color="blue">", dim_ptr->name_in_file, dim_ptr->name_in_file);
+ fortprintf(fd, " do i=1,read%sCount</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " recv%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " send%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " end do</font>
<font color="blue">");
+ fortprintf(fd, "</font>
<font color="blue">");
+ }
+ else if (dim_ptr->namelist_defined) {
+ fortprintf(fd, " read%sStart = 1</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " read%sCount = block %% mesh %% %s</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file);
+ fortprintf(fd, " allocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " allocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " nullify(send%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " nullify(recv%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " recv%sList %% procID = dminfo %% my_proc_id</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " send%sList %% procID = dminfo %% my_proc_id</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " recv%sList %% nlist = read%sCount</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file+1);
+ fortprintf(fd, " send%sList %% nlist = read%sCount</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file+1);
+ fortprintf(fd, " allocate(recv%sList %% list(read%sCount))</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file+1);
+ fortprintf(fd, " allocate(send%sList %% list(read%sCount))</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file+1);
+ fortprintf(fd, " do i=1,read%sCount</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " recv%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " send%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " end do</font>
<font color="blue">");
+ fortprintf(fd, "</font>
<font color="blue">");
+ }
+ else {
+ fortprintf(fd, " read%sStart = 1</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " read%sCount = block %% mesh %% %s</font>
<font color="blue">", dim_ptr->name_in_code+1, dim_ptr->name_in_code);
+ fortprintf(fd, " allocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " allocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " nullify(send%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " nullify(recv%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " recv%sList %% procID = dminfo %% my_proc_id</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " send%sList %% procID = dminfo %% my_proc_id</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " recv%sList %% nlist = read%sCount</font>
<font color="blue">", dim_ptr->name_in_code+1, dim_ptr->name_in_code+1);
+ fortprintf(fd, " send%sList %% nlist = read%sCount</font>
<font color="blue">", dim_ptr->name_in_code+1, dim_ptr->name_in_code+1);
+ fortprintf(fd, " allocate(recv%sList %% list(read%sCount))</font>
<font color="blue">", dim_ptr->name_in_code+1, dim_ptr->name_in_code+1);
+ fortprintf(fd, " allocate(send%sList %% list(read%sCount))</font>
<font color="blue">", dim_ptr->name_in_code+1, dim_ptr->name_in_code+1);
+ fortprintf(fd, " do i=1,read%sCount</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " recv%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " send%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " end do</font>
<font color="blue">");
+ fortprintf(fd, "</font>
<font color="blue">");
+ }
+
+ }
+
+ dim_ptr = dim_ptr->next;
+ }
+
+ fclose(fd);
+
+
+ /*
+ * Deallocation of exchange lists for non-decomposed fields
+ */
+ fd = fopen("nondecomp_dims_dealloc.inc", "w");
+
+ dim_ptr = dims;
+ while (dim_ptr) {
+
+ if (strncmp(dim_ptr->name_in_file,"nCells",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nEdges",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nVertices",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nVertLevels",11) != 0
+ ) {
+
+ if (is_derived_dim(dim_ptr->name_in_code)) {
+ fortprintf(fd, " deallocate(recv%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " deallocate(send%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " deallocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " deallocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ }
+ else if (dim_ptr->constant_value > 0) {
+ fortprintf(fd, " deallocate(recv%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " deallocate(send%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " deallocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " deallocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file);
+ }
+ else if (dim_ptr->namelist_defined) {
+ fortprintf(fd, " deallocate(recv%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " deallocate(send%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " deallocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " deallocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ }
+ else {
+ fortprintf(fd, " deallocate(recv%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " deallocate(send%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " deallocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " deallocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ }
+
+ }
+
+ dim_ptr = dim_ptr->next;
+ }
+
+ fclose(fd);
+
+
+ /*
+ * Definitions of read bounds and exchange lists for non-decomposed fields
+ */
+ fd = fopen("nondecomp_outputs.inc", "w");
+
+ dim_ptr = dims;
+ while (dim_ptr) {
+
+ if (strncmp(dim_ptr->name_in_file,"nCells",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nEdges",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nVertices",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nVertLevels",11) != 0
+ ) {
+
+ if (is_derived_dim(dim_ptr->name_in_code)) {
+ fortprintf(fd, " integer :: %sGlobal</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " type (exchange_list), pointer :: send%sList</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " type (exchange_list), pointer :: recv%sList</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ }
+ else if (dim_ptr->constant_value > 0) {
+ fortprintf(fd, " type (exchange_list), pointer :: send%sList</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " type (exchange_list), pointer :: recv%sList</font>
<font color="blue">", dim_ptr->name_in_file);
+ }
+ else if (dim_ptr->namelist_defined) {
+ fortprintf(fd, " integer :: %sGlobal</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " type (exchange_list), pointer :: send%sList</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " type (exchange_list), pointer :: recv%sList</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ }
+ else {
+ fortprintf(fd, " integer :: %sGlobal</font>
<font color="blue">", dim_ptr->name_in_code);
+ fortprintf(fd, " type (exchange_list), pointer :: send%sList</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " type (exchange_list), pointer :: recv%sList</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ }
+
+ }
+
+ dim_ptr = dim_ptr->next;
+ }
+
+ fortprintf(fd, "</font>
<font color="blue">");
+
+ dim_ptr = dims;
+ while (dim_ptr) {
+
+ if (strncmp(dim_ptr->name_in_file,"nCells",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nEdges",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nVertices",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nVertLevels",11) != 0
+ ) {
+
+ if (is_derived_dim(dim_ptr->name_in_code)) {
+ fortprintf(fd, " %sGlobal = domain %% blocklist %% mesh %% %s</font>
<font color="blue">", dim_ptr->name_in_file, dim_ptr->name_in_code);
+ fortprintf(fd, " if (domain %% dminfo %% my_proc_id == 0) then</font>
<font color="blue">");
+ fortprintf(fd, " allocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " allocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " nullify(send%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " nullify(recv%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " recv%sList %% procID = 0</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " send%sList %% procID = 0</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " recv%sList %% nlist = %sGlobal</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file);
+ fortprintf(fd, " send%sList %% nlist = %sGlobal</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file);
+ fortprintf(fd, " allocate(recv%sList %% list(%sGlobal))</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file);
+ fortprintf(fd, " allocate(send%sList %% list(%sGlobal))</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file);
+ fortprintf(fd, " do i=1,%sGlobal</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " recv%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " send%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " end do</font>
<font color="blue">");
+ fortprintf(fd, " else</font>
<font color="blue">");
+ fortprintf(fd, " nullify(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " nullify(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " end if</font>
<font color="blue">");
+ fortprintf(fd, "</font>
<font color="blue">");
+ }
+ else if (dim_ptr->constant_value > 0) {
+ fortprintf(fd, " if (domain %% dminfo %% my_proc_id == 0) then</font>
<font color="blue">");
+ fortprintf(fd, " allocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " allocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " nullify(send%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " nullify(recv%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " recv%sList %% procID = 0</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " send%sList %% procID = 0</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " recv%sList %% nlist = %s</font>
<font color="blue">", dim_ptr->name_in_file, dim_ptr->name_in_code);
+ fortprintf(fd, " send%sList %% nlist = %s</font>
<font color="blue">", dim_ptr->name_in_file, dim_ptr->name_in_code);
+ fortprintf(fd, " allocate(recv%sList %% list(%s))</font>
<font color="blue">", dim_ptr->name_in_file, dim_ptr->name_in_code);
+ fortprintf(fd, " allocate(send%sList %% list(%s))</font>
<font color="blue">", dim_ptr->name_in_file, dim_ptr->name_in_code);
+ fortprintf(fd, " do i=1,%s</font>
<font color="blue">", dim_ptr->name_in_code);
+ fortprintf(fd, " recv%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " send%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " end do</font>
<font color="blue">");
+ fortprintf(fd, " else</font>
<font color="blue">");
+ fortprintf(fd, " nullify(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " nullify(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " end if</font>
<font color="blue">");
+ fortprintf(fd, "</font>
<font color="blue">");
+ }
+ else if (dim_ptr->namelist_defined) {
+ fortprintf(fd, " %sGlobal = domain %% blocklist %% mesh %% %s</font>
<font color="blue">", dim_ptr->name_in_file, dim_ptr->name_in_file);
+ fortprintf(fd, " if (domain %% dminfo %% my_proc_id == 0) then</font>
<font color="blue">");
+ fortprintf(fd, " allocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " allocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " nullify(send%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " nullify(recv%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " recv%sList %% procID = 0</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " send%sList %% procID = 0</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " recv%sList %% nlist = %sGlobal</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file);
+ fortprintf(fd, " send%sList %% nlist = %sGlobal</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file);
+ fortprintf(fd, " allocate(recv%sList %% list(%sGlobal))</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file);
+ fortprintf(fd, " allocate(send%sList %% list(%sGlobal))</font>
<font color="blue">", dim_ptr->name_in_file+1, dim_ptr->name_in_file);
+ fortprintf(fd, " do i=1,%sGlobal</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " recv%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " send%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " end do</font>
<font color="blue">");
+ fortprintf(fd, " else</font>
<font color="blue">");
+ fortprintf(fd, " nullify(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " nullify(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " end if</font>
<font color="blue">");
+ fortprintf(fd, "</font>
<font color="blue">");
+ }
+ else {
+ fortprintf(fd, " %sGlobal = domain %% blocklist %% mesh %% %s</font>
<font color="blue">", dim_ptr->name_in_code, dim_ptr->name_in_code);
+ fortprintf(fd, " if (domain %% dminfo %% my_proc_id == 0) then</font>
<font color="blue">");
+ fortprintf(fd, " allocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " allocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " nullify(send%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " nullify(recv%sList %% next)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " recv%sList %% procID = 0</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " send%sList %% procID = 0</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " recv%sList %% nlist = %sGlobal</font>
<font color="blue">", dim_ptr->name_in_code+1, dim_ptr->name_in_code);
+ fortprintf(fd, " send%sList %% nlist = %sGlobal</font>
<font color="blue">", dim_ptr->name_in_code+1, dim_ptr->name_in_code);
+ fortprintf(fd, " allocate(recv%sList %% list(%sGlobal))</font>
<font color="blue">", dim_ptr->name_in_code+1, dim_ptr->name_in_code);
+ fortprintf(fd, " allocate(send%sList %% list(%sGlobal))</font>
<font color="blue">", dim_ptr->name_in_code+1, dim_ptr->name_in_code);
+ fortprintf(fd, " do i=1,%sGlobal</font>
<font color="blue">", dim_ptr->name_in_code);
+ fortprintf(fd, " recv%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " send%sList %% list(i) = i</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " end do</font>
<font color="blue">");
+ fortprintf(fd, " else</font>
<font color="blue">");
+ fortprintf(fd, " nullify(send%sList)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " nullify(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " end if</font>
<font color="blue">");
+ fortprintf(fd, "</font>
<font color="blue">");
+ }
+
+ }
+
+ dim_ptr = dim_ptr->next;
+ }
+
+ fclose(fd);
+
+
+ /*
+ * Deallocation of exchange lists for non-decomposed fields
+ */
+ fd = fopen("nondecomp_outputs_dealloc.inc", "w");
+
+ dim_ptr = dims;
+ while (dim_ptr) {
+
+ if (strncmp(dim_ptr->name_in_file,"nCells",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nEdges",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nVertices",1024) != 0 &&
+ strncmp(dim_ptr->name_in_file,"nVertLevels",11) != 0
+ ) {
+
+ if (is_derived_dim(dim_ptr->name_in_code)) {
+ fortprintf(fd, " if (domain %% dminfo %% my_proc_id == 0) then</font>
<font color="blue">");
+ fortprintf(fd, " deallocate(recv%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " deallocate(send%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " deallocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " deallocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " end if</font>
<font color="blue">");
+ }
+ else if (dim_ptr->constant_value > 0) {
+ fortprintf(fd, " if (domain %% dminfo %% my_proc_id == 0) then</font>
<font color="blue">");
+ fortprintf(fd, " deallocate(recv%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " deallocate(send%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " deallocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " deallocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file);
+ fortprintf(fd, " end if</font>
<font color="blue">");
+ }
+ else if (dim_ptr->namelist_defined) {
+ fortprintf(fd, " if (domain %% dminfo %% my_proc_id == 0) then</font>
<font color="blue">");
+ fortprintf(fd, " deallocate(recv%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " deallocate(send%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " deallocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " deallocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_file+1);
+ fortprintf(fd, " end if</font>
<font color="blue">");
+ }
+ else {
+ fortprintf(fd, " if (domain %% dminfo %% my_proc_id == 0) then</font>
<font color="blue">");
+ fortprintf(fd, " deallocate(recv%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " deallocate(send%sList %% list)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " deallocate(send%sList)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " deallocate(recv%sList)</font>
<font color="blue">", dim_ptr->name_in_code+1);
+ fortprintf(fd, " end if</font>
<font color="gray">");
+ }
+
+ }
+
+ dim_ptr = dim_ptr->next;
+ }
+
+ fclose(fd);
/*
@@ -845,12 +1235,13 @@
}
else {
if (is_derived_dim(dimlist_ptr->dim->name_in_code)) {
- split_derived_dim_string(dimlist_ptr->dim->name_in_code, &cp1, &cp2);
- fortprintf(fd, " %s%id %% ioinfo %% start(%i) = read%sStart</font>
<font color="red">", vtype, var_ptr->ndims, i, cp1);
- fortprintf(fd, " %s%id %% ioinfo %% count(%i) = read%sCount%s</font>
<font color="red">", vtype, var_ptr->ndims, i, cp1, cp2);
- free(cp1);
- free(cp2);
+ fortprintf(fd, " %s%id %% ioinfo %% start(%i) = read%sStart</font>
<font color="blue">", vtype, var_ptr->ndims, i, dimlist_ptr->dim->name_in_file+1);
+ fortprintf(fd, " %s%id %% ioinfo %% count(%i) = read%sCount</font>
<font color="blue">", vtype, var_ptr->ndims, i, dimlist_ptr->dim->name_in_file+1);
}
+ else if (dimlist_ptr->dim->constant_value > 0) {
+ fortprintf(fd, " %s%id %% ioinfo %% start(%i) = read%sStart</font>
<font color="blue">", vtype, var_ptr->ndims, i, dimlist_ptr->dim->name_in_file);
+ fortprintf(fd, " %s%id %% ioinfo %% count(%i) = read%sCount</font>
<font color="blue">", vtype, var_ptr->ndims, i, dimlist_ptr->dim->name_in_file);
+ }
else {
if (dimlist_ptr->dim->namelist_defined) {
fortprintf(fd, " %s%id %% ioinfo %% start(%i) = read%sStart</font>
<font color="gray">", vtype, var_ptr->ndims, i, dimlist_ptr->dim->name_in_file+1);
@@ -879,12 +1270,10 @@
fortprintf(fd, "%s", dimlist_ptr->dim->name_in_code);
}
else {
- if (is_derived_dim(dimlist_ptr->dim->name_in_code)) {
- split_derived_dim_string(dimlist_ptr->dim->name_in_code, &cp1, &cp2);
- fortprintf(fd, "read%sCount%s", cp1, cp2);
- free(cp1);
- free(cp2);
- }
+ if (is_derived_dim(dimlist_ptr->dim->name_in_code))
+ fortprintf(fd, "read%sCount", dimlist_ptr->dim->name_in_file+1);
+ else if (dimlist_ptr->dim->constant_value > 0)
+ fortprintf(fd, "read%sCount", dimlist_ptr->dim->name_in_file);
else
if (dimlist_ptr->dim->namelist_defined) fortprintf(fd, "read%sCount", dimlist_ptr->dim->name_in_file+1);
else fortprintf(fd, "read%sCount", dimlist_ptr->dim->name_in_code+1);
@@ -901,12 +1290,10 @@
fortprintf(fd, ", %s", dimlist_ptr->dim->name_in_code);
}
else {
- if (is_derived_dim(dimlist_ptr->dim->name_in_code)) {
- split_derived_dim_string(dimlist_ptr->dim->name_in_code, &cp1, &cp2);
- fortprintf(fd, ", read%sCount%s", cp1, cp2);
- free(cp1);
- free(cp2);
- }
+ if (is_derived_dim(dimlist_ptr->dim->name_in_code))
+ fortprintf(fd, ", read%sCount", dimlist_ptr->dim->name_in_file+1);
+ else if (dimlist_ptr->dim->constant_value > 0)
+ fortprintf(fd, ", read%sCount", dimlist_ptr->dim->name_in_file);
else
if (!dimlist_ptr->dim->namelist_defined) fortprintf(fd, ", read%sCount", dimlist_ptr->dim->name_in_code+1);
else fortprintf(fd, ", read%sCount", dimlist_ptr->dim->name_in_file+1);
@@ -971,11 +1358,11 @@
else {
lastdim = dimlist_ptr;
if (is_derived_dim(dimlist_ptr->dim->name_in_code)) {
- split_derived_dim_string(dimlist_ptr->dim->name_in_code, &cp1, &cp2);
- fortprintf(fd, " read%sCount%s", cp1, cp2);
- free(cp1);
- free(cp2);
+ fortprintf(fd, " read%sCount", dimlist_ptr->dim->name_in_file+1);
}
+ else if (dimlist_ptr->dim->constant_value > 0) {
+ fortprintf(fd, " read%sCount", dimlist_ptr->dim->name_in_file);
+ }
else
if (!dimlist_ptr->dim->namelist_defined) fortprintf(fd, " read%sCount", dimlist_ptr->dim->name_in_code+1);
else fortprintf(fd, " read%sCount", dimlist_ptr->dim->name_in_file+1);
@@ -993,11 +1380,11 @@
else {
lastdim = dimlist_ptr;
if (is_derived_dim(dimlist_ptr->dim->name_in_code)) {
- split_derived_dim_string(dimlist_ptr->dim->name_in_code, &cp1, &cp2);
- fortprintf(fd, ", read%sCount%s", cp1, cp2);
- free(cp1);
- free(cp2);
+ fortprintf(fd, ", read%sCount", dimlist_ptr->dim->name_in_file+1);
}
+ else if (dimlist_ptr->dim->constant_value > 0) {
+ fortprintf(fd, ", read%sCount", dimlist_ptr->dim->name_in_file);
+ }
else
if (!dimlist_ptr->dim->namelist_defined) fortprintf(fd, ", read%sCount", dimlist_ptr->dim->name_in_code+1);
else fortprintf(fd, ", read%sCount", dimlist_ptr->dim->name_in_file+1);
@@ -1005,11 +1392,14 @@
dimlist_ptr = dimlist_ptr->next;
i++;
}
- if (!lastdim->dim->namelist_defined) fortprintf(fd, ", block %% mesh %% %s, &</font>
<font color="red">", lastdim->dim->name_in_code);
- else fortprintf(fd, ", block %% mesh %% %s, &</font>
<font color="blue">", lastdim->dim->name_in_file);
+ if (lastdim->dim->namelist_defined) fortprintf(fd, ", block %% mesh %% %s, &</font>
<font color="blue">", lastdim->dim->name_in_file);
+ else if (lastdim->dim->constant_value > 0) fortprintf(fd, ", %s, &</font>
<font color="blue">", lastdim->dim->name_in_code);
+ else fortprintf(fd, ", block %% mesh %% %s, &</font>
<font color="black">", lastdim->dim->name_in_code);
if (is_derived_dim(lastdim->dim->name_in_code))
fortprintf(fd, " send%sList, recv%sList)</font>
<font color="blue">", lastdim->dim->name_in_file+1, lastdim->dim->name_in_file+1);
+ else if (lastdim->dim->constant_value > 0)
+ fortprintf(fd, " send%sList, recv%sList)</font>
<font color="black">", lastdim->dim->name_in_file, lastdim->dim->name_in_file);
else
if (lastdim->dim->namelist_defined)
fortprintf(fd, " send%sList, recv%sList)</font>
<font color="gray">", lastdim->dim->name_in_file+1, lastdim->dim->name_in_file+1);
@@ -1406,6 +1796,9 @@
free(cp1);
free(cp2);
}
+ else if (dimlist_ptr->dim->constant_value > 0) {
+ fortprintf(fd, " %s%id %% ioinfo %% count(%i) = %s</font>
<font color="blue">", vtype, var_ptr->ndims, i, dimlist_ptr->dim->name_in_code);
+ }
else
if (!dimlist_ptr->dim->namelist_defined) fortprintf(fd, " %s%id %% ioinfo %% count(%i) = %sGlobal</font>
<font color="black">", vtype, var_ptr->ndims, i, dimlist_ptr->dim->name_in_code);
else fortprintf(fd, " %s%id %% ioinfo %% count(%i) = %sGlobal</font>
<font color="gray">", vtype, var_ptr->ndims, i, dimlist_ptr->dim->name_in_file);
@@ -1431,6 +1824,9 @@
free(cp1);
free(cp2);
}
+ else if (dimlist_ptr->dim->constant_value > 0) {
+ fortprintf(fd, "%s", dimlist_ptr->dim->name_in_code);
+ }
else
if (!dimlist_ptr->dim->namelist_defined) fortprintf(fd, "%sGlobal", dimlist_ptr->dim->name_in_code);
else fortprintf(fd, "%sGlobal", dimlist_ptr->dim->name_in_file);
@@ -1452,6 +1848,9 @@
free(cp1);
free(cp2);
}
+ else if (dimlist_ptr->dim->constant_value > 0) {
+ fortprintf(fd, ", %s", dimlist_ptr->dim->name_in_code);
+ }
else
if (!dimlist_ptr->dim->namelist_defined) fortprintf(fd, ", %sGlobal", dimlist_ptr->dim->name_in_code);
else fortprintf(fd, ", %sGlobal", dimlist_ptr->dim->name_in_file);
@@ -1544,21 +1943,54 @@
i++;
}
- if (is_derived_dim(lastdim->dim->name_in_code)) {
- split_derived_dim_string(lastdim->dim->name_in_code, &cp1, &cp2);
- fortprintf(fd, ", n%sGlobal%s, &</font>
<font color="red">", cp1, cp2);
- fortprintf(fd, " output_obj %% send%sList, output_obj %% recv%sList)</font>
<font color="red">", lastdim->dim->name_in_file+1, lastdim->dim->name_in_file+1);
- free(cp1);
- free(cp2);
+ /*
+ * Need to avoid output_obj in case this is a non-decomposed dimension, in which case
+ * the send/recv lists are local variables
+ */
+ if (strncmp(lastdim->dim->name_in_file,"nCells",1024) != 0 &&
+ strncmp(lastdim->dim->name_in_file,"nEdges",1024) != 0 &&
+ strncmp(lastdim->dim->name_in_file,"nVertices",1024) != 0 &&
+ strncmp(lastdim->dim->name_in_file,"nVertLevels",11) != 0
+ ) {
+ if (is_derived_dim(lastdim->dim->name_in_code)) {
+ split_derived_dim_string(lastdim->dim->name_in_code, &cp1, &cp2);
+ fortprintf(fd, ", n%sGlobal%s, &</font>
<font color="blue">", cp1, cp2);
+ fortprintf(fd, " send%sList, recv%sList)</font>
<font color="blue">", lastdim->dim->name_in_file+1, lastdim->dim->name_in_file+1);
+ free(cp1);
+ free(cp2);
+ }
+ else if (lastdim->dim->constant_value > 0) {
+ fortprintf(fd, ", %s, &</font>
<font color="blue">", lastdim->dim->name_in_code);
+ fortprintf(fd, " send%sList, recv%sList)</font>
<font color="blue">", lastdim->dim->name_in_file, lastdim->dim->name_in_file);
+ }
+ else {
+ if (!lastdim->dim->namelist_defined) {
+ fortprintf(fd, ", %sGlobal, &</font>
<font color="blue">", lastdim->dim->name_in_code);
+ fortprintf(fd, " send%sList, recv%sList)</font>
<font color="blue">", lastdim->dim->name_in_code+1, lastdim->dim->name_in_code+1);
+ }
+ else {
+ fortprintf(fd, ", %sGlobal, &</font>
<font color="blue">", lastdim->dim->name_in_file);
+ fortprintf(fd, " send%sList, recv%sList)</font>
<font color="red">", lastdim->dim->name_in_file+1, lastdim->dim->name_in_file+1);
+ }
+ }
}
else {
- if (!lastdim->dim->namelist_defined) {
- fortprintf(fd, ", %sGlobal, &</font>
<font color="red">", lastdim->dim->name_in_code);
- fortprintf(fd, " output_obj %% send%sList, output_obj %% recv%sList)</font>
<font color="blue">", lastdim->dim->name_in_code+1, lastdim->dim->name_in_code+1);
+ if (is_derived_dim(lastdim->dim->name_in_code)) {
+ split_derived_dim_string(lastdim->dim->name_in_code, &cp1, &cp2);
+ fortprintf(fd, ", n%sGlobal%s, &</font>
<font color="blue">", cp1, cp2);
+ fortprintf(fd, " output_obj %% send%sList, output_obj %% recv%sList)</font>
<font color="red">", lastdim->dim->name_in_file+1, lastdim->dim->name_in_file+1);
+ free(cp1);
+ free(cp2);
}
else {
- fortprintf(fd, ", %sGlobal, &</font>
<font color="red">", lastdim->dim->name_in_file);
- fortprintf(fd, " output_obj %% send%sList, output_obj %% recv%sList)</font>
<font color="blue">", lastdim->dim->name_in_file+1, lastdim->dim->name_in_file+1);
+ if (!lastdim->dim->namelist_defined) {
+ fortprintf(fd, ", %sGlobal, &</font>
<font color="blue">", lastdim->dim->name_in_code);
+ fortprintf(fd, " output_obj %% send%sList, output_obj %% recv%sList)</font>
<font color="blue">", lastdim->dim->name_in_code+1, lastdim->dim->name_in_code+1);
+ }
+ else {
+ fortprintf(fd, ", %sGlobal, &</font>
<font color="blue">", lastdim->dim->name_in_file);
+ fortprintf(fd, " output_obj %% send%sList, output_obj %% recv%sList)</font>
<font color="blue">", lastdim->dim->name_in_file+1, lastdim->dim->name_in_file+1);
+ }
}
}
}
</font>
</pre>