[cig-commits] r19185 - in seismo/2D/SPECFEM2D/trunk: setup src/specfem2D
dkomati1 at geodynamics.org
dkomati1 at geodynamics.org
Thu Nov 10 19:12:41 PST 2011
Author: dkomati1
Date: 2011-11-10 19:12:40 -0800 (Thu, 10 Nov 2011)
New Revision: 19185
Modified:
seismo/2D/SPECFEM2D/trunk/setup/constants.h.in
seismo/2D/SPECFEM2D/trunk/src/specfem2D/create_color_image.f90
seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90
seismo/2D/SPECFEM2D/trunk/src/specfem2D/write_jpeg_image.c
Log:
added flag USE_SNAPSHOT_NUMBER_IN_FILENAME to use the snapshot number in its file name instead of the time step;
also fixed a bug with gcc: extra characters at the end of the snapshot file name.
Modified: seismo/2D/SPECFEM2D/trunk/setup/constants.h.in
===================================================================
--- seismo/2D/SPECFEM2D/trunk/setup/constants.h.in 2011-11-11 01:04:52 UTC (rev 19184)
+++ seismo/2D/SPECFEM2D/trunk/setup/constants.h.in 2011-11-11 03:12:40 UTC (rev 19185)
@@ -58,6 +58,9 @@
! factor to subsample color images output by the code (useful for very large models)
integer, parameter :: factor_subsample_image = 1
+! use snapshot number in the file name of JPG color snapshots instead of the time step
+ logical, parameter :: USE_SNAPSHOT_NUMBER_IN_FILENAME = .false.
+
! display acoustic layers as constant blue, because they likely correspond to water in the case of ocean acoustics
! or in the case of offshore oil industry experiments.
! (if off, display them as greyscale, as for elastic or poroelastic elements)
Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/create_color_image.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/create_color_image.f90 2011-11-11 01:04:52 UTC (rev 19184)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/create_color_image.f90 2011-11-11 03:12:40 UTC (rev 19185)
@@ -43,7 +43,7 @@
!========================================================================
subroutine create_color_image(color_image_2D_data,iglob_image_color_2D, &
- NX,NY,it,cutsnaps,image_color_vp_display)
+ NX,NY,it,isnapshot_number,cutsnaps,image_color_vp_display)
! display a given field as a red and blue color JPEG image
@@ -53,7 +53,7 @@
include "constants.h"
- integer :: NX,NY,it
+ integer :: NX,NY,it,isnapshot_number
double precision :: cutsnaps
@@ -72,7 +72,12 @@
character(len=100) :: filename
! open the image file
- write(filename,"('OUTPUT_FILES/image',i7.7,'.jpg')") it
+ if(USE_SNAPSHOT_NUMBER_IN_FILENAME) then
+ isnapshot_number = isnapshot_number + 1
+ write(filename,"('OUTPUT_FILES/image',i7.7,'.jpg')") isnapshot_number
+ else
+ write(filename,"('OUTPUT_FILES/image',i7.7,'.jpg')") it
+ endif
! compute maximum amplitude
amplitude_max = maxval(abs(color_image_2D_data))
Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90 2011-11-11 01:04:52 UTC (rev 19184)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90 2011-11-11 03:12:40 UTC (rev 19185)
@@ -792,6 +792,7 @@
integer :: idummy1, idummy2, idummy3, idummy4, idummy5, idummy6, idummy7, idummy8
integer :: ispecperio, ispecperio2, ispec2, i2, j2
integer :: iglob_target_to_replace, ispec3, i3, j3
+ integer :: isnapshot_number = 0
!<SU_FORMAT
integer(kind=4) :: r4head(60)
@@ -6851,7 +6852,7 @@
if (myrank == 0) then
call create_color_image(image_color_data,iglob_image_color, &
- NX_IMAGE_color,NZ_IMAGE_color,it,cutsnaps,image_color_vp_display)
+ NX_IMAGE_color,NZ_IMAGE_color,it,isnapshot_number,cutsnaps,image_color_vp_display)
write(IOUT,*) 'Color image created'
endif
Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/write_jpeg_image.c
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/write_jpeg_image.c 2011-11-11 01:04:52 UTC (rev 19184)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/write_jpeg_image.c 2011-11-11 03:12:40 UTC (rev 19185)
@@ -39,13 +39,20 @@
// Trim leading space
while(isspace(*filename)) filename++;
- // Trim trailing space
- end = filename + strlen(filename) - 1;
- while(end > filename && isspace(*end)) end--;
+// DK DK // Trim trailing space
+// DK DK end = filename + strlen(filename) - 1;
+// DK DK while(end > filename && isspace(*end)) end--;
- // Write new null terminator
- *(end+1) = 0;
+// DK DK // Write new null terminator
+// DK DK *(end+1) = 0;
+ // find first white space after the end of the file name
+ end = filename;
+ while(!isspace(*end)) end++;
+
+ // write null terminator to keep the useful part of the file name only
+ *end = 0;
+
FILE *outfile = fopen( filename, "wb" );
if ( !outfile )
More information about the CIG-COMMITS
mailing list