|
127 | 127 | "<div class=\"alert alert-block alert-info\">\n", |
128 | 128 | "<b>Now it's your turn...</b><br>\n", |
129 | 129 | "<b>2.</b> Write a field operator called <tt>diffusion</tt> which performs the same operations as the following lines in <tt>stencil2d.py</tt>:<br>\n", |
130 | | - "<code>laplacian( in_field, tmp_field, num_halo=num_halo, extend=1 )\n", |
| 130 | + "<pre><code>laplacian( in_field, tmp_field, num_halo=num_halo, extend=1 )\n", |
131 | 131 | " laplacian( tmp_field, out_field, num_halo=num_halo, extend=0 )\n", |
132 | 132 | " out_field[:, num_halo:-num_halo, num_halo:-num_halo] = \\\n", |
133 | 133 | " in_field[:, num_halo:-num_halo, num_halo:-num_halo] \\\n", |
134 | | - " - alpha * out_field[:, num_halo:-num_halo, num_halo:-num_halo] </code><br>\n", |
| 134 | + " - alpha * out_field[:, num_halo:-num_halo, num_halo:-num_halo] </code></pre>\n", |
135 | 135 | "The function receives the input field <tt>in_field</tt>, the output field <tt>out_field</tt> and the scalar coefficient <tt>alpha</tt>. Assume grid point values are stored as <tt>float</tt>s. Import and call the <tt>laplacian</tt> subroutine.<br>\n", |
136 | 136 | "<b>3.</b> Instantiate the field operator with the two different backends.\n", |
137 | 137 | "</div>" |
|
0 commit comments