From 63b4fc6a3767604d17c234d3ab470398dcde70c8 Mon Sep 17 00:00:00 2001 From: rideout Date: Thu, 28 Nov 2002 12:24:12 +0000 Subject: Add comment about how BndCartoon2DVI is able to execute boundary condition on an entire group. Clean up of BndCartoon2DGN: * checks for valid group name, and gives appropriate error message * properly handles verbose messages git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Cartoon2D/trunk@54 eec4d7dc-71c2-46d6-addf-10296150bf52 --- src/Cartoon2DBC.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Cartoon2DBC.c b/src/Cartoon2DBC.c index 2695ff4..8eb0453 100644 --- a/src/Cartoon2DBC.c +++ b/src/Cartoon2DBC.c @@ -26,7 +26,7 @@ static const char *rcsid = "$Id$"; -CCTK_FILEVERSION(BetaThorns_Cartoon2D_Cartoon2DBC_c) +CCTK_FILEVERSION(BetaThorns_Cartoon2D_Cartoon2DBC_c); int BndCartoon2DGN(const cGH *GH, int tensortype, const char *group); int BndCartoon2DVN(const cGH *GH, int tensortype, const char *var); @@ -58,6 +58,11 @@ void CCTK_FCALL CCTK_FNAME(BndCartoon2DGN) cos(phi) etc with messy signs */ +/* BndCartoon2DVI is called only on the first variable of a group. It + then is automatically applied to the remaining variables in the + group, using the tensortype argument to determine how many there + are and how to treat them. */ + int BndCartoon2DVI(const cGH *GH, int tensortype, int vi) { @@ -242,14 +247,14 @@ void CCTK_FCALL CCTK_FNAME(BndCartoon2DVI) *retval = BndCartoon2DVI(GH, *tensortype, *vi); } -int BndCartoon2DVN(const cGH *GH, int tensortype, const char *impvarname) +int BndCartoon2DVN(const cGH *GH, int tensortype, const char *inpvarname) { DECLARE_CCTK_PARAMETERS int vi; - if (verbose) printf("cartoon2D called for %s\n", impvarname); - vi = CCTK_VarIndex(impvarname); + if (verbose) printf("Cartoon2D called for %s\n", inpvarname); + vi = CCTK_VarIndex(inpvarname); return(BndCartoon2DVI(GH, tensortype, vi)); } @@ -265,9 +270,9 @@ void CCTK_FCALL CCTK_FNAME(BndCartoon2DVN) int BndCartoon2DGN(const cGH *GH, int tensortype, const char *group) { DECLARE_CCTK_PARAMETERS - int n_tensortype; + int n_tensortype, n_group; - if (verbose) printf("cartoon2D called for %s\n", group); + if (verbose && GH->cctk_iteration==1) CCTK_VInfo(CCTK_THORNSTRING,"Cartoon2D called for %s (message appears only once)", group); switch (tensortype) { case TENSORTYPE_SCALAR: @@ -284,8 +289,12 @@ int BndCartoon2DGN(const cGH *GH, int tensortype, const char *group) n_tensortype = 0; } - if(CCTK_NumVarsInGroup(group) != n_tensortype) + n_group = CCTK_NumVarsInGroup(group); + if (n_group <0) CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "%s is an invalid group.",group); + if(n_group != n_tensortype) { + /*printf("group has %d components\n",CCTK_NumVarsInGroup(group));*/ CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, "%s should have only %d component(s).", group, n_tensortype); } -- cgit v1.2.3