<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>&nbsp;BrusierRestrict</div><div><br></div><div>&nbsp;The way this routine should work:</div><div><br></div><div>Pass in the values of the fine level and the course level,&nbsp;</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>&nbsp; &nbsp;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>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; char const * restrict const soln[] = {</div><div>&nbsp; &nbsp; "BruiserConstraints::phi",</div><div>&nbsp; &nbsp; "BruiserConstraints::wx",</div><div>&nbsp; &nbsp; "BruiserConstraints::wy",</div><div>&nbsp; &nbsp; "BruiserConstraints::wz",</div><div>&nbsp; &nbsp; &nbsp;NULL</div><div>&nbsp; };</div><div>&nbsp;&nbsp;</div><div><div>&nbsp; char const * restrict const rhs[] = {</div><div>&nbsp; &nbsp; "BruiserConstraints::rhsphi",</div><div>&nbsp; &nbsp; "BruiserConstraints::rhswx",</div><div>&nbsp; &nbsp; "BruiserConstraints::rhswy",</div><div>&nbsp; &nbsp; "BruiserConstraints::rhswz",</div><div>&nbsp; &nbsp; &nbsp;NULL</div><div>&nbsp; };</div></div><div><br></div><div>&nbsp; char const * restrict const none[] = {</div><div>&nbsp; &nbsp; NULL</div><div>&nbsp; };</div><div>&nbsp;&nbsp;</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>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char const * restrict const * restrict const names,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;vector&lt;int&gt;&amp; gis, vector&lt;int&gt;&amp; vis)</div><div>{</div><div>&nbsp; int nvars = 0;</div><div>&nbsp; while (names[nvars]) ++nvars;</div><div>&nbsp; assert (gis.empty());</div><div>&nbsp; assert (vis.empty());</div><div>&nbsp; gis.reserve(nvars);</div><div>&nbsp; vis.reserve(nvars);</div><div>}</div><div><br></div><div><br></div><div>void BruiserRestrict(CCTK_ARGUMENTS) {</div><div><br></div><div>&nbsp; DECLARE_CCTK_PARAMETERS;</div><div><br></div><div>&nbsp; CCTK_VInfo(CCTK_THORNSTRING,"reflevel = %d, mglevel = %d", reflevel,mglevel);</div><div><br></div><div>&nbsp; CCTK_WARN(0,"BruiserRestrict: No clue what to do here. &nbsp;Aborting.");</div><div>/* &nbsp;Something like...</div><div>*/&nbsp;</div><div>&nbsp; &nbsp; vector&lt;int&gt; gis, vis;</div><div>&nbsp; &nbsp; get_varinds (cctkGH, variables::soln, gis, vis);</div><div>&nbsp; &nbsp; CCTK_INT const nvars = gis.size();</div><div>&nbsp; &nbsp; int const tl = 0;</div><div>&nbsp; &nbsp; CCTK_REAL time = 0.0;</div><div><br></div><div>&nbsp; &nbsp; int const coarse_vi =</div><div>&nbsp; &nbsp; CCTK_VarIndex ("Brusier::phi"); &nbsp;// What about other variables: &nbsp;wx, wy, and wz?</div><div>&nbsp; &nbsp; int const coarse_gi = CCTK_GroupIndexFromVarI (coarse_vi);</div><div>&nbsp; &nbsp; assert (coarse_gi &gt;= 0);</div><div>&nbsp; &nbsp; int const coarse_v0 = CCTK_FirstVarIndexI (coarse_gi);</div><div>&nbsp; &nbsp; assert (coarse_v0 &gt;= 0);</div><div><br></div><div><br></div><div>&nbsp; int const fine_vi =</div><div>&nbsp; &nbsp; CCTK_VarIndex ("Brusier::phi");</div><div><br></div><div>&nbsp; &nbsp; for (comm_state state; not state.done(); state.step()) {</div><div>&nbsp; &nbsp; &nbsp; for (int m=0; m&lt;maps; ++m) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; ggf *const gv =</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrdata.AT(coarse_gi).AT(m).data.</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AT(coarse_vi - coarse_v0); &nbsp; // This subtraction does what?</div><div>&nbsp; &nbsp; &nbsp; &nbsp; gv-&gt;ref_restrict_all (state, tl, reflevel, mglevel, time);</div><div>&nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; } // for state</div><div>}</div><div><br></div></div></body></html>