diff options
author | tradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a> | 2001-11-28 16:50:56 +0000 |
---|---|---|
committer | tradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a> | 2001-11-28 16:50:56 +0000 |
commit | 5a992bdbdd8853043952c944a7b1df7482a5a587 (patch) | |
tree | b9bf105c30fcb20969236c608e6a0128305a412d | |
parent | ecc925d2e5bc7f33289f6f40ca5f911050e8971c (diff) |
Give warnings with some more information why a slice center couldn't be set up.
This closes PR CactusBase/785.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOUtil/trunk@136 b32723a9-ab3a-4a60-88e2-2e5d99d7c17a
-rw-r--r-- | src/Utils.c | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/src/Utils.c b/src/Utils.c index e27594e..e9f11f9 100644 --- a/src/Utils.c +++ b/src/Utils.c @@ -70,7 +70,8 @@ CCTK_FILEVERSION(CactusBase_IOUtil_Utils_c) @returntype int @returndesc - 0 for success + 0 for success + -1 no coordinate system of given dimensions found @endreturndesc @@*/ int IOUtil_1DLines (const cGH *GH, @@ -80,7 +81,7 @@ int IOUtil_1DLines (const cGH *GH, int *const *slice_center) { int dim, dir; - char system_name[20]; + char coord_system_name[20]; CCTK_REAL *lower_range, *upper_range; @@ -89,27 +90,37 @@ int IOUtil_1DLines (const cGH *GH, upper_range = lower_range + num_dims; /* get the appropriate coordinate system name */ - sprintf (system_name, "cart%dd", num_dims); - if (CCTK_CoordSystemHandle (system_name) >= 0) + sprintf (coord_system_name, "cart%dd", num_dims); + if (CCTK_CoordSystemHandle (coord_system_name) >= 0) { /* get the ranges in every direction */ for (dir = 0; dir < num_dims; dir++) { if (CCTK_CoordRange (GH, &lower_range[dir], &upper_range[dir], - dir + 1, NULL, system_name) < 0) + dir + 1, NULL, coord_system_name) < 0) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "IOUtil_1DLines: Could not get ranges for %c-direction " "of coordinate system '%s'", - 'x' + dir, system_name); + 'x' + dir, coord_system_name); } } } else { CCTK_VWarn (4, __LINE__, __FILE__, CCTK_THORNSTRING, - "IOUtil_1DLines: Cartesian coordinate system '%s' not found", - system_name); + "IOUtil_1DLines: Cartesian coordinate system '%s' not found" + " - no slice center set up for output of 1D lines from %dD " + "variables", coord_system_name, num_dims); + for (dir = 0; dir < num_dims; dir++) + { + for (dim = 0; dim < num_dims; dim++) + { + slice_center[dir][dim] = -1; + } + } + + return (-1); } /* now set the slice center for each line @@ -216,18 +227,19 @@ int IOUtil_2DPlanes (const cGH *GH, int *slice_center) { int dir; - char system_name[20]; + char coord_system_name[20]; CCTK_REAL *lower_range, *upper_range; /* get the appropriate coordinate system name */ - sprintf (system_name, "cart%dd", num_dims); + sprintf (coord_system_name, "cart%dd", num_dims); - if (CCTK_CoordSystemHandle (system_name) < 0) + if (CCTK_CoordSystemHandle (coord_system_name) < 0) { CCTK_VWarn (4, __LINE__, __FILE__, CCTK_THORNSTRING, - "IOUtil_2DPlanes: Cartesian coordinate system '%s' not found", - system_name); + "IOUtil_2DPlanes: Cartesian coordinate system '%s' not found" + " - no slice center set up for output of 2D planes from %dD " + "variables", coord_system_name, num_dims); return (-1); } @@ -239,12 +251,12 @@ int IOUtil_2DPlanes (const cGH *GH, for (dir = 0; dir < num_dims; dir++) { if (CCTK_CoordRange (GH, &lower_range[dir], &upper_range[dir], - dir + 1, NULL, system_name) < 0) + dir + 1, NULL, coord_system_name) < 0) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "IOUtil_2DPlanes: Could not get ranges for %c-direction " "of coordinate system '%s'", - 'x' + dir, system_name); + 'x' + dir, coord_system_name); } } @@ -259,11 +271,15 @@ int IOUtil_2DPlanes (const cGH *GH, else if (lower_range[dir] > origin_phys[dir] || upper_range[dir] < origin_phys[dir]) { - CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, - "IOUtil_2DPlanes: Coordinate in %c-direction (%f, %f) " - "doesn't contain %f", - 'x' + dir, (double) lower_range[dir], - (double) upper_range[dir], (double) origin_phys[dir]); + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "IOUtil_2DPlanes: %c-coordinate for slice center of 2D " + "planes (%f) is out of grid coordinates range (%f, %f)", + 'x' + dir, (double) origin_phys[dir], + (double) lower_range[dir], (double) upper_range[dir]); + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "IOUtil_2DPlanes: no 2D planes in %c-direction will be " + "written for %dD variables with this slice center default", + 'x' + dir, num_dims); slice_center[dir] = 0; } else |