diff options
author | lanfer <lanfer@6a38eb6e-646e-4a02-a296-d141613ad6c4> | 1999-10-19 12:22:54 +0000 |
---|---|---|
committer | lanfer <lanfer@6a38eb6e-646e-4a02-a296-d141613ad6c4> | 1999-10-19 12:22:54 +0000 |
commit | 3e6556a428ec845c815cc9354f90fda4b3330649 (patch) | |
tree | 5167b2fe9f532eafda6bfaf73688b318917749f9 /src/FlatBoundary.c | |
parent | bd0a63c6bb5c134443647d2fecd376c5eea07b2a (diff) |
the new boundary interfaces, Apply*BC will go away
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/Boundary/trunk@43 6a38eb6e-646e-4a02-a296-d141613ad6c4
Diffstat (limited to 'src/FlatBoundary.c')
-rw-r--r-- | src/FlatBoundary.c | 148 |
1 files changed, 5 insertions, 143 deletions
diff --git a/src/FlatBoundary.c b/src/FlatBoundary.c index 2d24829..f288988 100644 --- a/src/FlatBoundary.c +++ b/src/FlatBoundary.c @@ -21,143 +21,8 @@ #include "CactusBase/CartGrid3D/src/Symmetry.h" #include "cctk_FortranString.h" -void ApplyFlat3D(cGH *GH,int *doBC,int *lsh,int *stencil_size,CCTK_REAL *var); +void ApplyFlat3Di(cGH *GH,int *doBC,int *lsh,int *stencil_size, CCTK_REAL *var); - /*@@ - @routine ApplyFlatBC - @date Mon Mar 15 15:19:54 1999 - @author Gerd Lanfermann - @desc - Routine applies the flat (copying) BCs when called from C or - Fortran (via wrapper) with the groupname. The actual GF assignment is - carried out in Fortran by FortranFlatBC. - @enddesc - @calls FortranFlatBC - @history - - @endhistory - -@@*/ - -/* Call with implementation::group notation, eg: ApplyFlatBC(adm::metric) */ - -int ApplyFlatBC(cGH *GH, int *stencil_size, const char *name) { - - DECLARE_CCTK_PARAMETERS - - SymmetryGHex *sGHex; /* the Symmetry GHextension */ - int first,last,index; /* grid function indices */ - int type; /* type 0 for a group, type 1 for a variable */ - int num; /* index number of the group */ - int *doBC; /* flags if lower/upper BCs are - applied (1) or not (0) - indexing is as in bbox: 0 lower 1 upper */ - int retval; /* negative if condition not applied */ - - /* Get the pointer to the SymmetryGHextension */ - sGHex = (SymmetryGHex*)GH->extensions[CCTK_GHExtensionHandle("Symmetry")]; - - /* Allocate memory for doBC */ - doBC = (int *)malloc(2*(GH->cctk_dim)*sizeof(int)); - - /* Decide if we have a group or a variable, and get the index */ - /* type = 1 (group), type = 0 (var), type = -1 (neither) */ - - num = CCTK_GroupIndex(name); - - if (num < 0) - { - num = CCTK_VarIndex(name); - if (num >= 0) - { - type = 1; /* Variable */ - } - else - { - type = -1; - { - char *message; - message = (char *)malloc( 1024*sizeof(char) ); - sprintf(message,"Name (%s) in ApplyFlatBC is not a group or variable", - name); - CCTK_WARN(1,message); - free(message); - retval = -1; - return retval; - } - } - } - else - { - type = 0; /* Group */ - } - - /* Find the first GF index, and the number of GFs */ - - if (type == 0) - { - first = CCTK_FirstVarIndexI(num); - last = first+CCTK_NumVarsInGroupI(num)-1; - if (first == -1 || last == -1) - { - CCTK_WARN(0,"Invalid group number used"); - retval = -1; - return retval; - } - } - else - { - first = num; - last = num; - } - - /* Loop over the all GFs */ - - for (index=first; index<=last; index++) { - - /* ... check that we actually have a grid function (and not a scalar) */ - - if (CCTK_GroupTypeFromVarI(index)==GROUP_GF) { - - /* The rule is: IF we have no symmetries for the lower grid boundary, - (GFSym==ESYM_NOSYM or ==ESYM_UNSET) AND we have a lower(upper) bound - AND we have enough gridpoints THEN apply BC */ - int idim; - - for (idim=0;idim<GH->cctk_dim;idim++) - { - doBC[idim*2]=(((sGHex->GFSym[index][idim*2]==GFSYM_NOSYM)|| - (sGHex->GFSym[index][idim*2]==GFSYM_UNSET)) && - GH->cctk_lsh[idim]>1 && GH->cctk_bbox[idim*2]); - doBC[idim*2+1] = (((sGHex->GFSym[index][idim*2+1]==GFSYM_NOSYM)|| - (sGHex->GFSym[index][idim*2+1]==GFSYM_UNSET)) && - GH->cctk_lsh[idim]>1 && GH->cctk_bbox[idim*2+1]); - } - - - if (GH->cctk_dim == 3) - { - ApplyFlat3D(GH,doBC,GH->cctk_lsh,stencil_size,GH->data[index][0]); - } - else - { - CCTKi_NotYetImplemented("Flat boundaries in other than 3D"); - retval = -1; - return retval; - } - - } - } - - if (doBC) free(doBC); - -} - -void FMODIFIER FORTRAN_NAME(ApplyFlatBC)(int *retval, cGH *GH, int *stencil_size, ONE_FORTSTRING_ARG) { - ONE_FORTSTRING_CREATE(name) - *retval = ApplyFlatBC(GH,stencil_size,name); - free(name); -} @@ -189,7 +54,7 @@ int FlatBCVarI(cGH *GH, int *stencil_size, int vi) { GH->cctk_lsh[idim]>1 && GH->cctk_bbox[idim*2+1]); } if (GH->cctk_dim == 3) { - ApplyFlat3D(GH,doBC,GH->cctk_lsh,stencil_size,GH->data[vi][0]); + ApplyFlat3Di(GH,doBC,GH->cctk_lsh,stencil_size,GH->data[vi][0]); } else { CCTKi_NotYetImplemented("Flat boundaries in other than 3D"); @@ -225,13 +90,13 @@ int FlatBCGroupI(cGH *GH, int *stencil_size, int gi) { return(retval); } - - void FMODIFIER FORTRAN_NAME(FlatBCGroupI)(int *retval, cGH *GH, int *stencil_size, int *gi) { *retval=FlatBCGroupI(GH, stencil_size, *gi); } + + int FlatBCGroup(cGH *GH, int *stencil_size, const char *impgrpname) { int gi; gi = CCTK_GroupIndex(impgrpname); @@ -247,7 +112,6 @@ void FMODIFIER FORTRAN_NAME(FlatBCGroup)(int *retval, cGH *GH, int *stencil_size - int FlatBCVar(cGH *GH, int *stencil_size, const char *impvarname) { int vi; vi = CCTK_VarIndex(impvarname); @@ -263,9 +127,7 @@ void FMODIFIER FORTRAN_NAME(FlatBCVar)(int *retval, cGH *GH, int *stencil_size, - -void ApplyFlat3D(cGH *GH,int *doBC,int *lsh,int *stencil_size, CCTK_REAL *var) -{ +void ApplyFlat3Di(cGH *GH,int *doBC,int *lsh,int *stencil_size, CCTK_REAL *var) { if (doBC[0] == 1) { |