From ec93cf628d1c0d132c6e46c43202f234acd0c067 Mon Sep 17 00:00:00 2001 From: schnetter Date: Sun, 14 Feb 2010 18:28:16 +0000 Subject: Determine the symmetry boundary width from the registered boundary width in CoordBase, not from the number of ghost zones. Abort if there are more than one components per MPI process; TAT/Slab cannot handle this. Begin to add support for CarpetSlab instead of TAT/Slab. Remove cvs $Header$ comments. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/RotatingSymmetry180/trunk@48 20f44201-0f4f-0410-9130-e5fc2714a787 --- configuration.ccl | 1 - doc/documentation.tex | 6 +- interface.ccl | 173 +++++++++++++++++++++++++++++++--------------- param.ccl | 13 +++- schedule.ccl | 1 - src/interpolate.c | 2 - src/make.code.defn | 1 - src/registersymmetry.c | 17 ++++- src/rotatingsymmetry180.c | 79 +++++++++++++++++---- src/rotatingsymmetry180.h | 2 - 10 files changed, 208 insertions(+), 87 deletions(-) diff --git a/configuration.ccl b/configuration.ccl index 66ffa4b..f0a8a7a 100644 --- a/configuration.ccl +++ b/configuration.ccl @@ -1,4 +1,3 @@ # Configuration definition for thorn RotatingSymmetry180 -# $Header$ REQUIRES THORNS: Slab diff --git a/doc/documentation.tex b/doc/documentation.tex index 23b2c81..4fc4fc3 100644 --- a/doc/documentation.tex +++ b/doc/documentation.tex @@ -2,7 +2,6 @@ % Cactus Thorn template for ThornGuide documentation % Author: Ian Kelley % Date: Sun Jun 02, 2002 -% $Header$ % % Thorn documentation in the latex file doc/documentation.tex % will be included in ThornGuides built with the Cactus make system. @@ -66,7 +65,6 @@ % *======================================================================* % If you are using CVS use this line to give version information -% $Header$ \documentclass{article} @@ -79,14 +77,14 @@ \begin{document} % The author of the documentation -\author{Erik Schnetter \textless schnetter@aei.mpg.de\textgreater} +\author{Erik Schnetter \textless schnetter@cct.lsu.edu\textgreater} % The title of the document (not necessarily the name of the Thorn) \title{RotatingSymmetry180} % the date your document was last changed, if your document is in CVS, % please use: -\date{$ $Date$ $} +\date{2004-04-08} \maketitle diff --git a/interface.ccl b/interface.ccl index a252cfb..f196ba2 100644 --- a/interface.ccl +++ b/interface.ccl @@ -1,5 +1,4 @@ # Interface definition for thorn RotatingSymmetry180 -# $Header$ IMPLEMENTS: RotatingSymmetry180 @@ -12,75 +11,135 @@ REQUIRES FUNCTION SymmetryRegister # which_faces : array [N_FACES] # symmetry_zone_width: array [N_FACES] -CCTK_INT FUNCTION \ - SymmetryRegisterGrid \ - (CCTK_POINTER IN cctkGH, \ - CCTK_INT IN sym_handle, \ - CCTK_INT IN ARRAY which_faces, \ - CCTK_INT IN ARRAY symmetry_zone_width) +CCTK_INT FUNCTION \ + SymmetryRegisterGrid \ + (CCTK_POINTER IN cctkGH, \ + CCTK_INT IN sym_handle, \ + CCTK_INT ARRAY IN which_faces, \ + CCTK_INT ARRAY IN symmetry_zone_width) REQUIRES FUNCTION SymmetryRegisterGrid -CCTK_INT FUNCTION \ - SymmetryRegisterGridInterpolator \ - (CCTK_POINTER IN cctkGH, \ - CCTK_INT IN sym_handle, \ - CCTK_INT CCTK_FPOINTER IN symmetry_interpolate \ - (CCTK_POINTER_TO_CONST IN cctkGH, \ - CCTK_INT IN N_dims, \ - CCTK_INT IN local_interp_handle, \ - CCTK_INT IN param_table_handle, \ - CCTK_INT IN coord_system_handle, \ - CCTK_INT IN N_interp_points, \ - CCTK_INT IN interp_coords_type, \ - CCTK_POINTER_TO_CONST ARRAY IN interp_coords, \ - CCTK_INT IN N_input_arrays, \ - CCTK_INT ARRAY IN input_array_indices, \ - CCTK_INT IN N_output_arrays, \ - CCTK_INT ARRAY IN output_array_types, \ - CCTK_POINTER ARRAY IN output_arrays, \ +CCTK_INT FUNCTION \ + SymmetryRegisterGridInterpolator \ + (CCTK_POINTER IN cctkGH, \ + CCTK_INT IN sym_handle, \ + CCTK_INT CCTK_FPOINTER IN symmetry_interpolate \ + (CCTK_POINTER_TO_CONST IN cctkGH, \ + CCTK_INT IN N_dims, \ + CCTK_INT IN local_interp_handle, \ + CCTK_INT IN param_table_handle, \ + CCTK_INT IN coord_system_handle, \ + CCTK_INT IN N_interp_points, \ + CCTK_INT IN interp_coords_type, \ + CCTK_POINTER_TO_CONST ARRAY IN interp_coords, \ + CCTK_INT IN N_input_arrays, \ + CCTK_INT ARRAY IN input_array_indices, \ + CCTK_INT IN N_output_arrays, \ + CCTK_INT ARRAY IN output_array_types, \ + CCTK_POINTER ARRAY IN output_arrays, \ CCTK_INT IN faces)) REQUIRES FUNCTION SymmetryRegisterGridInterpolator -CCTK_INT FUNCTION \ - SymmetryInterpolateFaces \ - (CCTK_POINTER_TO_CONST IN cctkGH, \ - CCTK_INT IN N_dims, \ - CCTK_INT IN local_interp_handle, \ - CCTK_INT IN param_table_handle, \ - CCTK_INT IN coord_system_handle, \ - CCTK_INT IN N_interp_points, \ - CCTK_INT IN interp_coords_type, \ - CCTK_POINTER_TO_CONST ARRAY IN interp_coords, \ - CCTK_INT IN N_input_arrays, \ - CCTK_INT ARRAY IN input_array_indices, \ - CCTK_INT IN N_output_arrays, \ - CCTK_INT ARRAY IN output_array_types, \ - CCTK_POINTER ARRAY IN output_arrays, \ +CCTK_INT FUNCTION \ + SymmetryInterpolateFaces \ + (CCTK_POINTER_TO_CONST IN cctkGH, \ + CCTK_INT IN N_dims, \ + CCTK_INT IN local_interp_handle, \ + CCTK_INT IN param_table_handle, \ + CCTK_INT IN coord_system_handle, \ + CCTK_INT IN N_interp_points, \ + CCTK_INT IN interp_coords_type, \ + CCTK_POINTER_TO_CONST ARRAY IN interp_coords, \ + CCTK_INT IN N_input_arrays, \ + CCTK_INT ARRAY IN input_array_indices, \ + CCTK_INT IN N_output_arrays, \ + CCTK_INT ARRAY IN output_array_types, \ + CCTK_POINTER ARRAY IN output_arrays, \ CCTK_INT IN faces) REQUIRES FUNCTION SymmetryInterpolateFaces -CCTK_INT FUNCTION \ - Boundary_SelectedGVs \ - (CCTK_POINTER_TO_CONST IN cctkGH, \ - CCTK_INT IN array_size, \ - CCTK_INT ARRAY OUT var_indicies, \ - CCTK_INT ARRAY OUT faces, \ - CCTK_INT ARRAY OUT boundary_widths, \ - CCTK_INT ARRAY OUT table_handles, \ +CCTK_INT FUNCTION \ + Boundary_SelectedGVs \ + (CCTK_POINTER_TO_CONST IN cctkGH, \ + CCTK_INT IN array_size, \ + CCTK_INT ARRAY OUT var_indicies, \ + CCTK_INT ARRAY OUT faces, \ + CCTK_INT ARRAY OUT boundary_widths, \ + CCTK_INT ARRAY OUT table_handles, \ CCTK_STRING IN bc_name) REQUIRES FUNCTION Boundary_SelectedGVs -CCTK_INT FUNCTION GetDomainSpecification \ - (CCTK_INT IN size, \ - CCTK_REAL OUT ARRAY physical_min, \ - CCTK_REAL OUT ARRAY physical_max, \ - CCTK_REAL OUT ARRAY interior_min, \ - CCTK_REAL OUT ARRAY interior_max, \ - CCTK_REAL OUT ARRAY exterior_min, \ - CCTK_REAL OUT ARRAY exterior_max, \ - CCTK_REAL OUT ARRAY spacing) +CCTK_INT FUNCTION \ + GetDomainSpecification \ + (CCTK_INT IN size, \ + CCTK_REAL ARRAY OUT physical_min, \ + CCTK_REAL ARRAY OUT physical_max, \ + CCTK_REAL ARRAY OUT interior_min, \ + CCTK_REAL ARRAY OUT interior_max, \ + CCTK_REAL ARRAY OUT exterior_min, \ + CCTK_REAL ARRAY OUT exterior_max, \ + CCTK_REAL ARRAY OUT spacing) USES FUNCTION GetDomainSpecification + + + +CCTK_INT FUNCTION \ + GetLocalComponents \ + (CCTK_POINTER_TO_CONST IN cctkGH) +USES FUNCTION GetLocalComponents + + + +CCTK_INT FUNCTION \ + Hyperslab_GlobalMappingByIndex \ + (CCTK_POINTER_TO_CONST IN cctkGH, \ + CCTK_INT IN vindex, \ + CCTK_INT IN hdim, \ + CCTK_INT ARRAY IN direction, \ + CCTK_INT ARRAY IN origin, \ + CCTK_INT ARRAY IN extent, \ + CCTK_INT ARRAY IN downsample, \ + CCTK_INT IN table_handle, \ + CCTK_INT CCTK_FPOINTER IN \ + conversion_fn \ + (CCTK_INT IN nelems, \ + CCTK_INT IN src_stride, \ + CCTK_INT IN dst_stride, \ + CCTK_INT IN src_type, \ + CCTK_INT IN dst_type, \ + CCTK_POINTER_TO_CONST IN from, \ + CCTK_POINTER IN to), \ + CCTK_INT ARRAY OUT hsize) +USES FUNCTION Hyperslab_GlobalMappingByIndex + +CCTK_INT FUNCTION \ + Hyperslab_GetList \ + (CCTK_POINTER_TO_CONST IN cctkGH, \ + CCTK_INT IN mapping_handle, \ + CCTK_INT IN num_arrays, \ + CCTK_INT ARRAY IN procs, \ + CCTK_INT ARRAY IN vindices, \ + CCTK_INT ARRAY IN timelevels, \ + CCTK_INT ARRAY IN hdatatypes, \ + CCTK_POINTER ARRAY IN hdata, \ + CCTK_INT ARRAY OUT retvals) +USES FUNCTION Hyperslab_GetList + +CCTK_INT FUNCTION \ + Hyperslab_FreeMapping \ + (CCTK_INT IN mapping_handle) +USES FUNCTION Hyperslab_FreeMapping + + + +CCTK_INT FUNCTION GetBoundarySpecification \ + (CCTK_INT IN size, \ + CCTK_INT OUT ARRAY nboundaryzones, \ + CCTK_INT OUT ARRAY is_internal, \ + CCTK_INT OUT ARRAY is_staggered, \ + CCTK_INT OUT ARRAY shiftout) +REQUIRES FUNCTION GetBoundarySpecification diff --git a/param.ccl b/param.ccl index 0ef8f84..6ed9ec8 100644 --- a/param.ccl +++ b/param.ccl @@ -1,12 +1,19 @@ # Parameter definitions for thorn RotatingSymmetry180 -# $Header$ -BOOLEAN verbose "Produce screen output while applying boundary conditions" +BOOLEAN verbose "Produce screen output while applying boundary conditions" STEERABLE=always { } "no" +KEYWORD hyperslabber "Hyperslabbing mechanism" STEERABLE=always +{ + "TAT/Slab" :: "" + "GetHyperslab" :: "" +} "TAT/Slab" + + + BOOLEAN use_coordbase "Get symmetry boundary location from CoordBase (and ignore symmetry_boundary_* parameters)" { } "no" @@ -23,7 +30,7 @@ CCTK_REAL symmetry_boundary_y "y-coordinate of symmetry boundary (ignored if use -BOOLEAN poison_boundaries "Fill the symmetry boundary with a poison value before the symmetry is applied, and check afterwards whether it has been overwritten" +BOOLEAN poison_boundaries "Fill the symmetry boundary with a poison value before the symmetry is applied, and check afterwards whether it has been overwritten" STEERABLE=always { } "no" diff --git a/schedule.ccl b/schedule.ccl index ff1f77a..f73addd 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -1,5 +1,4 @@ # Schedule definitions for thorn RotatingSymmetry180 -# $Header$ SCHEDULE Rot180_CheckTensorTypes AT paramcheck { diff --git a/src/interpolate.c b/src/interpolate.c index 717d352..ecf7477 100644 --- a/src/interpolate.c +++ b/src/interpolate.c @@ -1,5 +1,3 @@ -/* $Header$ */ - #include #include #include diff --git a/src/make.code.defn b/src/make.code.defn index 03f55f4..bdd2ba6 100644 --- a/src/make.code.defn +++ b/src/make.code.defn @@ -1,5 +1,4 @@ # Main make.code.defn file for thorn RotatingSymmetry180 -# $Header$ # Source files in this directory SRCS = interpolate.c rotatingsymmetry180.c registersymmetry.c diff --git a/src/registersymmetry.c b/src/registersymmetry.c index b326181..6ce17dc 100644 --- a/src/registersymmetry.c +++ b/src/registersymmetry.c @@ -1,5 +1,3 @@ -/* $Header$ */ - #include "cctk.h" #include "cctk_Arguments.h" #include "cctk_Parameters.h" @@ -13,19 +11,32 @@ void Rot180_RegisterSymmetry (CCTK_ARGUMENTS) DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; + CCTK_INT nboundaryzones[6]; + CCTK_INT is_internal[6]; + CCTK_INT is_staggered[6]; + CCTK_INT shiftout[6]; + int f; CCTK_INT handle; CCTK_INT faces[6]; CCTK_INT width[6]; CCTK_INT ierr; + /* Get the boundary specification */ + ierr = GetBoundarySpecification + (6, nboundaryzones, is_internal, is_staggered, shiftout); + if (ierr < 0) + { + CCTK_WARN (0, "Could not get the boundary specification"); + } + for (f=0; f<6; ++f) { faces[f] = 0; width[f] = 0; } faces[0] = 1; - width[0] = cctk_nghostzones[0]; + width[0] = nboundaryzones[0]; handle = SymmetryRegister ("rotating_symmetry_180"); if (handle < 0) { diff --git a/src/rotatingsymmetry180.c b/src/rotatingsymmetry180.c index 62b859d..ccafa3c 100644 --- a/src/rotatingsymmetry180.c +++ b/src/rotatingsymmetry180.c @@ -1,5 +1,3 @@ -/* $Header$ */ - #include #include #include @@ -45,7 +43,6 @@ int BndRot180VI (cGH const * restrict const cctkGH, int offset[3]; /* offset 0..1 due to avoid_origin */ struct xferinfo * restrict xferinfo; - int options; int var; @@ -54,6 +51,7 @@ int BndRot180VI (cGH const * restrict const cctkGH, int otherdir; /* the other direction of the rotation */ int q; int d; + int icnt; int ierr; /* Check arguments */ @@ -451,16 +449,71 @@ int BndRot180VI (cGH const * restrict const cctkGH, xferinfo[ dir].flip = 1; xferinfo[otherdir].flip = 1; - options = Util_TableCreateFromString ("useghosts=1"); - assert (options>=0); - - ierr = Slab_MultiTransfer - (cctkGH, group.dim, xferinfo, options, - nvars, vartypes, varptrs, vartypes, varptrs); - assert (!ierr); - - ierr = Util_TableDestroy (options); - assert (!ierr); + if (CCTK_EQUALS (hyperslabber, "TAT/Slab")) { + + if (CCTK_IsFunctionAliased("GetLocalComponents")) { + int const num_local_components = GetLocalComponents(cctkGH); + if (num_local_components > 1) { + CCTK_WARN (CCTK_WARN_ABORT, + "TAT/Slab can only be used if there is a single local component per MPI process"); + } + } + + int options; + options = Util_TableCreateFromString ("useghosts=1"); + assert (options>=0); + + ierr = Slab_MultiTransfer + (cctkGH, group.dim, xferinfo, options, + nvars, vartypes, varptrs, vartypes, varptrs); + assert (!ierr); + + ierr = Util_TableDestroy (options); + assert (!ierr); + + } else if (CCTK_EQUALS (hyperslabber, "GetHyperslab")) { + + CCTK_INT const direction[3*3] = {1, 0, 0, 0, 1, 0, 0, 0, 1}; + CCTK_INT const origin[3] = + {xferinfo[0].src.off, xferinfo[1].src.off, xferinfo[2].src.off}; + CCTK_INT const extent[3] = + {xferinfo[0].src.len, xferinfo[1].src.len, xferinfo[2].src.len}; + CCTK_INT const downsample[3] = + {xferinfo[0].src.str, xferinfo[1].src.str, xferinfo[2].src.str}; + int mapping; + CCTK_INT hsize[3], total_hsize; + CCTK_POINTER hdata[nvars]; + + assert (nvars > 0); + mapping = Hyperslab_GlobalMappingByIndex + (cctkGH, vis[0], 3, direction, origin, extent, downsample, + -1, NULL, &hsize); + assert (mapping>=0); + + total_hsize = hsize[0] * hsize[1] * hsize[2]; + assert (total_hsize >= 0); + for (var=0; var