<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; "><div><br></div><div>Something like this?</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><div><br></div><div>/*===========================================================================</div><div> BrusierRestrict</div><div><br></div><div> The way this routine should work:</div><div><br></div><div>Pass in the values of the fine level and the course level, </div><div>Pass in the grid hierarchy and a grid function or set of grid functions</div><div>Call the half-weighted restriction operator(s) for said grid functions(s)</div><div>For any coarse grid points adjacent to inner boundary points,</div><div> replace these points with injected/"straight copy" data from the fine grid</div><div><br></div><div><br></div><div>Note: currently calling ref_restric_all, but I don't really want to restrict</div><div>"all" grid functions. Just some of them...</div><div><br></div><div>Much of this routine was "lifted" from LSUDevelopment/Refluxing/src/correct.cc</div><div>===========================================================================*/</div><div>namespace variables {</div><div> </div><div> char const * restrict const soln[] = {</div><div> "BruiserConstraints::phi",</div><div> "BruiserConstraints::wx",</div><div> "BruiserConstraints::wy",</div><div> "BruiserConstraints::wz",</div><div> NULL</div><div> };</div><div> </div><div><div> char const * restrict const rhs[] = {</div><div> "BruiserConstraints::rhsphi",</div><div> "BruiserConstraints::rhswx",</div><div> "BruiserConstraints::rhswy",</div><div> "BruiserConstraints::rhswz",</div><div> NULL</div><div> };</div></div><div><br></div><div> char const * restrict const none[] = {</div><div> NULL</div><div> };</div><div> </div><div>} // namespace variables</div><div><br></div><div><br></div><div>static</div><div>void</div><div>get_varinds (cGH const * restrict const cctkGH,</div><div> char const * restrict const * restrict const names,</div><div> vector<int>& gis, vector<int>& vis)</div><div>{</div><div> int nvars = 0;</div><div> while (names[nvars]) ++nvars;</div><div> assert (gis.empty());</div><div> assert (vis.empty());</div><div> gis.reserve(nvars);</div><div> vis.reserve(nvars);</div><div>}</div><div><br></div><div><br></div><div>void BruiserRestrict(CCTK_ARGUMENTS) {</div><div><br></div><div> DECLARE_CCTK_PARAMETERS;</div><div><br></div><div> CCTK_VInfo(CCTK_THORNSTRING,"reflevel = %d, mglevel = %d", reflevel,mglevel);</div><div><br></div><div> CCTK_WARN(0,"BruiserRestrict: No clue what to do here. Aborting.");</div><div>/* Something like...</div><div>*/ </div><div> vector<int> gis, vis;</div><div> get_varinds (cctkGH, variables::soln, gis, vis);</div><div> CCTK_INT const nvars = gis.size();</div><div> int const tl = 0;</div><div> CCTK_REAL time = 0.0;</div><div><br></div><div> int const coarse_vi =</div><div> CCTK_VarIndex ("Brusier::phi"); // What about other variables: wx, wy, and wz?</div><div> int const coarse_gi = CCTK_GroupIndexFromVarI (coarse_vi);</div><div> assert (coarse_gi >= 0);</div><div> int const coarse_v0 = CCTK_FirstVarIndexI (coarse_gi);</div><div> assert (coarse_v0 >= 0);</div><div><br></div><div><br></div><div> int const fine_vi =</div><div> CCTK_VarIndex ("Brusier::phi");</div><div><br></div><div> for (comm_state state; not state.done(); state.step()) {</div><div> for (int m=0; m<maps; ++m) {</div><div> ggf *const gv =</div><div> arrdata.AT(coarse_gi).AT(m).data.</div><div> AT(coarse_vi - coarse_v0); // This subtraction does what?</div><div> gv->ref_restrict_all (state, tl, reflevel, mglevel, time);</div><div> }</div><div> } // for state</div><div>}</div><div><br></div></div></body></html>