diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2001-06-17 17:48:39 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2001-06-17 17:48:39 +0000 |
commit | 91168260fb68e6b6bf0ed5b9d2aa51858bf2d972 (patch) | |
tree | a27f92322103dcc637cc761c90f5cb7aff99c57f | |
parent | d83b0b5327b721e92bd1ea90747e7b6f297e3cbe (diff) |
grid.cc
tweak wording of verbose print flag msg
test_fd_grid.cc
add upper limit on grid size if we have very high resolution
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@59 f88db872-0e4f-0410-b76b-b9085cfa78c5
-rw-r--r-- | src/patch/grid.cc | 2 | ||||
-rw-r--r-- | src/patch/test_fd_grid.cc | 42 |
2 files changed, 27 insertions, 17 deletions
diff --git a/src/patch/grid.cc b/src/patch/grid.cc index 2c5dd45..d196e7a 100644 --- a/src/patch/grid.cc +++ b/src/patch/grid.cc @@ -109,6 +109,6 @@ grid::grid(const grid_arrays::array_pars &grid_array_pars_in, { if (verbose_flag) - then printf("grid::grid(): creating %d*%d grid (%d gridfn(s))\n", + then printf("grid::grid(): created %d*%d grid (%d gridfn(s))\n", N_irho(), N_isigma(), N_gridfns()); } diff --git a/src/patch/test_fd_grid.cc b/src/patch/test_fd_grid.cc index a80d6df..9e5f2ac 100644 --- a/src/patch/test_fd_grid.cc +++ b/src/patch/test_fd_grid.cc @@ -35,14 +35,13 @@ using jtutil::error_exit; const char *usage = "\ Usage:\n\ - test_fd_grid delta_drho delta_dsigma \n\ + test_fd_grid delta_drho delta_dsigma [ N_rhosigma ]\n\ [ fn | drho | dsigma | drhorho | drhosigma | dsigmasigma ] \n\ where\n\ delta_drho and delta_dsigma are the (rho,sigma) grid spacings\n\ - These should evenly divide the grid min/max bounds, which are fixed\n\ - at\n\ - [ -70 degrees ... +110 degrees] in rho\n\ - [-100 degrees ... +120 degrees] in sigma\n\ + N_rhosigma , if specified, shrinks the max_{rho,sigma} grid bounds so\n\ + the grid has about that many points in each of the rho and sigma\n\ + directions\n\ \n\ This program tests the fd_grid:: finite differencing code by setting\n\ up a test function, finite differencing it, computing the analytical\n\ @@ -51,7 +50,7 @@ difference and analytical derivatives. It also tests various grid::\n\ member functions by comparing their results against correct results.\n\ \n\ By default, the finite differencing test uses a combination of all\n\ -the partial derivatives. If the 3rd argument is specified, then this\n\ +the partial derivatives. If the 4th argument is specified, then this\n\ restricts the test to only that derivative (this is useful for debugging\n\ problems with class fd_grid::).\n\ \n\ @@ -85,9 +84,9 @@ static const fp weight_fn = 3.1, // fixed parameters for the grid const fp min_drho = - 70.0; -const fp max_drho = +110.0; + fp max_drho = +110.0; // may be shrunk (via N_rhosigma) const fp min_dsigma = -100.0; -const fp max_dsigma = +120.0; + fp max_dsigma = +120.0; // may be shruna (via N_rhosigma) const int min_rho_N_ghost_zones = 3; const int max_rho_N_ghost_zones = 4; @@ -125,21 +124,32 @@ int main(int argc, const char *argv[]) // fp delta_drho, delta_dsigma; -if (! ( ((argc == 3) || (argc == 4)) +if (! ( ((argc == 3) || (argc == 4) || (argc == 5)) && (sscanf(argv[1], FP_SCANF_FORMAT, &delta_drho) == 1) && (sscanf(argv[2], FP_SCANF_FORMAT, &delta_dsigma) == 1) ) ) then error_exit(ERROR_EXIT, "%s", usage); /*NOTREACHED*/ +if (argc >= 4) + then { + int N_rhosigma; + if (! (sscanf(argv[3], "%d", &N_rhosigma) == 1) ) + then error_exit(ERROR_EXIT, "%s", usage); /*NOTREACHED*/ + + // size specified ==> shrink the grid to that size + max_drho = min_drho + fp(N_rhosigma)*delta_drho; + max_dsigma = min_dsigma + fp(N_rhosigma)*delta_dsigma; + } + int flags = flag_all; -if (argc == 4) +if (argc >= 5) then { - if (STRING_EQUAL(argv[3], "fn")) then flags = flag_fn; - else if (STRING_EQUAL(argv[3], "drho")) then flags = flag_drho; - else if (STRING_EQUAL(argv[3], "dsigma")) then flags = flag_dsigma; - else if (STRING_EQUAL(argv[3], "drhorho")) then flags = flag_drhorho; - else if (STRING_EQUAL(argv[3], "drhosigma")) + if (STRING_EQUAL(argv[4], "fn")) then flags = flag_fn; + else if (STRING_EQUAL(argv[4], "drho")) then flags = flag_drho; + else if (STRING_EQUAL(argv[4], "dsigma")) then flags = flag_dsigma; + else if (STRING_EQUAL(argv[4], "drhorho")) then flags = flag_drhorho; + else if (STRING_EQUAL(argv[4], "drhosigma")) then flags = flag_drhosigma; - else if (STRING_EQUAL(argv[3], "dsigmasigma")) + else if (STRING_EQUAL(argv[4], "dsigmasigma")) then flags = flag_dsigmasigma; else error_exit(ERROR_EXIT, "%s", usage); /*NOTREACHED*/ } |