<html>#2487: *_evolution_method = "LeanBSSNMoL" in Lean does nothing
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td>Gabriele Bozzola</td></tr>
<tr><td style='text-align:right'>   Status:</td><td>open</td></tr>
<tr><td style='text-align:right'>Milestone:</td><td></td></tr>
<tr><td style='text-align:right'>  Version:</td><td>development version</td></tr>
<tr><td style='text-align:right'>     Type:</td><td>bug</td></tr>
<tr><td style='text-align:right'> Priority:</td><td>major</td></tr>
<tr><td style='text-align:right'>Component:</td><td>EinsteinToolkit thorn</td></tr>
</table>

<p>Comment (by Roland Haas):</p>
<p>Looking at your code in particular the bits that have string comparisons:</p>
<div class="codehilite"><pre><span></span><span class="k">if</span> <span class="p">(</span><span class="n">CCTK_EQUALS</span><span class="p">(</span><span class="n">lapse_evolution_method</span><span class="p">,</span> <span class="s2">&quot;LeanBSSNMoL&quot;</span><span class="p">))</span> <span class="k">then</span>
</pre></div>

<p>in 3D loops, then yes, these will be quite slow since the compiler will not cache the result of the comparison and really due the comparison each and every loop iteration.</p>
<p>Instead I would have a logical variable that is initialized outside of the loop with the result of the comparison, ie:</p>
<div class="codehilite"><pre><span></span><span class="kt">logical</span> <span class="kd">::</span> <span class="n">want_lapse</span>

<span class="n">want_lapse</span> <span class="o">=</span>  <span class="n">CCTK_EQUALS</span><span class="p">(</span><span class="n">lapse_evolution_method</span><span class="p">,</span> <span class="s2">&quot;LeanBSSNMoL&quot;</span><span class="p">)</span>

<span class="k">do </span><span class="n">i</span> <span class="o">=</span><span class="mi">1</span><span class="p">,</span><span class="n">cctk_lsh</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">want_lapse</span><span class="p">)</span> <span class="k">then</span>
<span class="k">    </span><span class="n">do_something</span>
  <span class="n">endif</span>
<span class="k">end do</span>
</pre></div>

<p>‌</p>
<p>--<br/>
Ticket URL: <a href='https://bitbucket.org/einsteintoolkit/tickets/issues/2487/_evolution_method-leanbssnmol-in-lean-does'>https://bitbucket.org/einsteintoolkit/tickets/issues/2487/_evolution_method-leanbssnmol-in-lean-does</a></p>
</html>