From f30e3a650b7073a0c945e85b216d1506b3bde1bd Mon Sep 17 00:00:00 2001 From: schnetter Date: Fri, 26 Aug 2005 11:25:01 +0000 Subject: Support tensor type uu_sym. Support 4-tensor types 4scalar, 4u, 4d, 4uu_sym, and 4dd_sym. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/RotatingSymmetry90/trunk@27 c3c03602-0f4f-0410-b3fa-d2c81c8a7dc5 --- src/interpolate.c | 85 +++++++++++++++++++++++++++++++++++++++++++++--- src/rotatingsymmetry90.c | 73 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 151 insertions(+), 7 deletions(-) diff --git a/src/interpolate.c b/src/interpolate.c index 9c6a392..844aaf6 100644 --- a/src/interpolate.c +++ b/src/interpolate.c @@ -293,14 +293,34 @@ Rot90_CheckTensorTypes (CCTK_ARGUMENTS) groupname); free (groupname); } + } else if (CCTK_EQUALS (tensortypealias, "4scalar")) { + /* 4-scalar */ + if (numvars != 1) { + char * groupname = CCTK_GroupName(gi); + assert (groupname); + CCTK_VWarn (3, __LINE__, __FILE__, CCTK_THORNSTRING, + "Group \"%s\" has the tensor type alias \"4scalar\", but contains more than 1 element", + groupname); + free (groupname); + } } else if (CCTK_EQUALS (tensortypealias, "u") || CCTK_EQUALS (tensortypealias, "d")) { /* vector */ assert (numvars == 3); - } else if (CCTK_EQUALS (tensortypealias, "dd_sym")) { + } else if (CCTK_EQUALS (tensortypealias, "4u") + || CCTK_EQUALS (tensortypealias, "4d")) + { + /* 4-vector */ + assert (numvars == 4); + } else if (CCTK_EQUALS (tensortypealias, "uu_sym") + || CCTK_EQUALS (tensortypealias, "dd_sym")) { /* symmetric tensor */ assert (numvars == 6); + } else if (CCTK_EQUALS (tensortypealias, "4uu_sym") + || CCTK_EQUALS (tensortypealias, "4dd_sym")) { + /* symmetric 4-tensor */ + assert (numvars == 10); } else { char * groupname = CCTK_GroupName(gi); assert (groupname); @@ -582,6 +602,19 @@ Rot90_SymmetryInterpolate (CCTK_POINTER_TO_CONST const cctkGH_, tensortype = &scalar; basevar = vi; var = 0; + } else if (CCTK_EQUALS (tensortypealias, "4scalar")) { + /* 4-scalar */ + if (numvars != 1) { + char * groupname = CCTK_GroupName(gi); + assert (groupname); + CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, + "Group \"%s\" has the tensor type alias \"4-scalar\", but contains more than 1 element", + groupname); + free (groupname); + } + tensortype = &scalar; + basevar = vi; + var = 0; } else if (CCTK_EQUALS (tensortypealias, "u") || CCTK_EQUALS (tensortypealias, "d")) { @@ -589,13 +622,55 @@ Rot90_SymmetryInterpolate (CCTK_POINTER_TO_CONST const cctkGH_, assert (numvars == 3); tensortype = &vector; basevar = firstvar; - var = vi - firstvar; - } else if (CCTK_EQUALS (tensortypealias, "dd_sym")) { + var = vi - basevar; + } else if (CCTK_EQUALS (tensortypealias, "4u") + || CCTK_EQUALS (tensortypealias, "4d")) + { + /* 4-vector */ + assert (numvars == 4); + if (vi == firstvar) { + /* temporal component */ + int const off = 0; + tensortype = &scalar; + basevar = firstvar + off; + var = vi - basevar; + } else { + /* spatial components */ + int const off = 1; + tensortype = &vector; + basevar = firstvar + off; + var = vi - basevar; + } + } else if (CCTK_EQUALS (tensortypealias, "uu_sym") + || CCTK_EQUALS (tensortypealias, "dd_sym")) { /* symmetric tensor */ assert (numvars == 6); tensortype = &symmtensor; basevar = firstvar; - var = vi - firstvar; + var = vi - basevar; + } else if (CCTK_EQUALS (tensortypealias, "4uu_sym") + || CCTK_EQUALS (tensortypealias, "4dd_sym")) { + /* symmetric 4-tensor */ + assert (numvars == 10); + if (vi == firstvar) { + /* temporal-temporal component */ + int const off = 0; + tensortype = &scalar; + basevar = firstvar + off; + var = vi - basevar; + } else if (vi < firstvar+4) { + /* temporal-spatial components */ + int const off = 1; + tensortype = &vector; + basevar = firstvar + off; + var = vi - basevar; + } else { + /* spatial-spatial components */ + int const off = 4; + tensortype = &symmtensor; + basevar = firstvar + off; + var = vi - basevar; + } } else { char * groupname = CCTK_GroupName(gi); assert (groupname); @@ -621,7 +696,7 @@ Rot90_SymmetryInterpolate (CCTK_POINTER_TO_CONST const cctkGH_, oldrank = tensortype->rank; } - /* Take operation code (i.e. derivatives) into account */ + /* Take operation code (i.e., derivatives) into account */ { int code = operation_codes[m]; num_derivs diff --git a/src/rotatingsymmetry90.c b/src/rotatingsymmetry90.c index 5ba6fff..a5abe48 100644 --- a/src/rotatingsymmetry90.c +++ b/src/rotatingsymmetry90.c @@ -295,14 +295,26 @@ int BndRot90VI (cGH const * restrict const cctkGH, if (CCTK_EQUALS (tensortypealias, "scalar")) { /* scalar */ + } else if (CCTK_EQUALS (tensortypealias, "4scalar")) { + /* 4-scalar */ } else if (CCTK_EQUALS (tensortypealias, "u") || CCTK_EQUALS (tensortypealias, "d")) { /* vector */ assert (numvars == 3); - } else if (CCTK_EQUALS (tensortypealias, "dd_sym")) { + } else if (CCTK_EQUALS (tensortypealias, "4u") + || CCTK_EQUALS (tensortypealias, "4d")) + { + /* 4-vector */ + assert (numvars == 4); + } else if (CCTK_EQUALS (tensortypealias, "uu_sym") + || CCTK_EQUALS (tensortypealias, "dd_sym")) { /* symmetric tensor */ assert (numvars == 6); + } else if (CCTK_EQUALS (tensortypealias, "4uu_sym") + || CCTK_EQUALS (tensortypealias, "4dd_sym")) { + /* symmetric 4-tensor */ + assert (numvars == 10); } else { char * groupname = CCTK_GroupName(gis[var]); assert (groupname); @@ -318,18 +330,41 @@ int BndRot90VI (cGH const * restrict const cctkGH, /* scalar */ srcvi = vis[var]; /* do nothing */ + } else if (CCTK_EQUALS (tensortypealias, "4scalar")) { + /* 4-scalar */ + srcvi = vis[var]; + /* do nothing */ } else if (CCTK_EQUALS (tensortypealias, "u") || CCTK_EQUALS (tensortypealias, "d")) { /* vector */ int srcindex; + assert (index>=0 && index<3); srcindex = convert_index (step, index, alldirs, &parities[var]); srcvi = firstvar + srcindex; - } else if (CCTK_EQUALS (tensortypealias, "dd_sym")) { + } else if (CCTK_EQUALS (tensortypealias, "4u") + || CCTK_EQUALS (tensortypealias, "4d")) + { + /* 4-vector */ + assert (index>=0 && index<4); + if (index==0) { + /* temporal component */ + srcvi = firstvar; + } else { + /* spatial components */ + int srcindex; + int const off = 1; + srcindex + = off + convert_index (step, index-off, alldirs, &parities[var]); + srcvi = firstvar + srcindex; + } + } else if (CCTK_EQUALS (tensortypealias, "uu_sym") + || CCTK_EQUALS (tensortypealias, "dd_sym")) { /* symmetric tensor */ int index1, index2; int srcindex1, srcindex2; int srcindex; + assert (index>=0 && index<6); { int const expand1[6] = { 0,0,0,1,1,2 }; int const expand2[6] = { 0,1,2,1,2,2 }; @@ -343,6 +378,40 @@ int BndRot90VI (cGH const * restrict const cctkGH, srcindex = compact[srcindex1][srcindex2]; } srcvi = firstvar + srcindex; + } else if (CCTK_EQUALS (tensortypealias, "4uu_sym") + || CCTK_EQUALS (tensortypealias, "4dd_sym")) { + /* symmetric 4-tensor */ + assert (index>=0 && index<10); + if (index==0) { + /* temporal-temporal component */ + srcvi = firstvar; + } else if (index<4) { + /* temporal-spatial components */ + int srcindex; + int const off = 1; + srcindex + = off + convert_index (step, index-off, alldirs, &parities[var]); + srcvi = firstvar + srcindex; + } else { + /* spatial-spatial components */ + int index1, index2; + int srcindex1, srcindex2; + int srcindex; + int const off = 4; + { + int const expand1[6] = { 0,0,0,1,1,2 }; + int const expand2[6] = { 0,1,2,1,2,2 }; + index1 = expand1[index-off]; + index2 = expand2[index-off]; + } + srcindex1 = convert_index (step, index1, alldirs, &parities[var]); + srcindex2 = convert_index (step, index2, alldirs, &parities[var]); + { + int const compact[3][3] = { { 0,1,2 }, { 1,3,4 }, { 2,4,5 } }; + srcindex = off + compact[srcindex1][srcindex2]; + } + srcvi = firstvar + srcindex; + } } else { assert (0); } -- cgit v1.2.3