[Users] Carpet innards: restriction usage...

Scott Hawley scott.hawley at belmont.edu
Sun Apr 8 18:47:08 CDT 2012


Something like this?






/*===========================================================================
 BrusierRestrict

 The way this routine should work:

Pass in the values of the fine level and the course level,
Pass in the grid hierarchy and a grid function or set of grid functions
Call the half-weighted restriction operator(s) for said grid functions(s)
For any coarse grid points adjacent to inner boundary points,
   replace these points with injected/"straight copy" data from the fine grid


Note: currently calling ref_restric_all, but I don't really want to restrict
"all" grid functions. Just some of them...

Much of this routine was "lifted" from LSUDevelopment/Refluxing/src/correct.cc
===========================================================================*/
namespace variables {

  char const * restrict const soln[] = {
    "BruiserConstraints::phi",
    "BruiserConstraints::wx",
    "BruiserConstraints::wy",
    "BruiserConstraints::wz",
     NULL
  };

  char const * restrict const rhs[] = {
    "BruiserConstraints::rhsphi",
    "BruiserConstraints::rhswx",
    "BruiserConstraints::rhswy",
    "BruiserConstraints::rhswz",
     NULL
  };

  char const * restrict const none[] = {
    NULL
  };

} // namespace variables


static
void
get_varinds (cGH const * restrict const cctkGH,
             char const * restrict const * restrict const names,
             vector<int>& gis, vector<int>& vis)
{
  int nvars = 0;
  while (names[nvars]) ++nvars;
  assert (gis.empty());
  assert (vis.empty());
  gis.reserve(nvars);
  vis.reserve(nvars);
}


void BruiserRestrict(CCTK_ARGUMENTS) {

  DECLARE_CCTK_PARAMETERS;

  CCTK_VInfo(CCTK_THORNSTRING,"reflevel = %d, mglevel = %d", reflevel,mglevel);

  CCTK_WARN(0,"BruiserRestrict: No clue what to do here.  Aborting.");
/*  Something like...
*/
    vector<int> gis, vis;
    get_varinds (cctkGH, variables::soln, gis, vis);
    CCTK_INT const nvars = gis.size();
    int const tl = 0;
    CCTK_REAL time = 0.0;

    int const coarse_vi =
    CCTK_VarIndex ("Brusier::phi");  // What about other variables:  wx, wy, and wz?
    int const coarse_gi = CCTK_GroupIndexFromVarI (coarse_vi);
    assert (coarse_gi >= 0);
    int const coarse_v0 = CCTK_FirstVarIndexI (coarse_gi);
    assert (coarse_v0 >= 0);


  int const fine_vi =
    CCTK_VarIndex ("Brusier::phi");

    for (comm_state state; not state.done(); state.step()) {
      for (int m=0; m<maps; ++m) {
        ggf *const gv =
          arrdata.AT(coarse_gi).AT(m).data.
               AT(coarse_vi - coarse_v0);   // This subtraction does what?
        gv->ref_restrict_all (state, tl, reflevel, mglevel, time);
      }
    } // for state
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.einsteintoolkit.org/pipermail/users/attachments/20120408/6e03c02b/attachment.html 


More information about the Users mailing list