Skip to content

Commit

Permalink
Merge pull request #92 from GollyGang/swizzle
Browse files Browse the repository at this point in the history
More keyword changes: sobelN_a etc.,
  • Loading branch information
timhutton authored Dec 30, 2020
2 parents fd18434 + a9f3a25 commit 462e99c
Show file tree
Hide file tree
Showing 39 changed files with 836 additions and 847 deletions.
43 changes: 22 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ endif()

project( Ready )

set( READY_VERSION 0.10.1 ) # check matches Help/about.html
set( READY_VERSION 0.11.0 ) # check matches Help/about.html
add_definitions( -D READY_VERSION=${READY_VERSION} )

if( APPLE OR WIN32 )
Expand Down Expand Up @@ -191,6 +191,26 @@ set( PATTERN_FILES
Patterns/Experiments/TimHutton/LifeBlur.vti
Patterns/Experiments/TimHutton/mutually-catalytic_spots.vti
Patterns/Experiments/TimHutton/mutually-catalytic_spots_2.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_forwardEuler.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_2stepAdamsBashforth.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_3stepAdamsBashforth.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_modifiedEuler.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_midpointMethod.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_HeunsMethod.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_LaxFriedrichs.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_LaxWendroff.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_RungeKutta4.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_staggeredLeapfrog.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_forwardEuler_double.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_2stepAdamsBashforth_double.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_3stepAdamsBashforth_double.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_modifiedEuler_double.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_midpointMethod_double.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_HeunsMethod_double.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_LaxFriedrichs_double.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_LaxWendroff_double.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_RungeKutta4_double.vti
Patterns/Experiments/TimHutton/NumericalMethods/advection_staggeredLeapfrog_double.vti
Patterns/Experiments/DanWills/cglrd_ramps_example.vti
Patterns/Experiments/DanWills/grayscott-historyWave_fuseWorms.vti
Patterns/Experiments/DanWills/grayscott-historyWave_moreLifelike.vti
Expand Down Expand Up @@ -230,26 +250,6 @@ set( PATTERN_FILES
Patterns/Experiments/TihaVonGhyczy/sobel_waves.vti
Patterns/Agmon2014/cells.vti Patterns/Agmon2014/cells_double.vti
Patterns/Agmon2014/oil-water.vti
Patterns/NumericalMethods/advection_forwardEuler.vti
Patterns/NumericalMethods/advection_2stepAdamsBashforth.vti
Patterns/NumericalMethods/advection_3stepAdamsBashforth.vti
Patterns/NumericalMethods/advection_modifiedEuler.vti
Patterns/NumericalMethods/advection_midpointMethod.vti
Patterns/NumericalMethods/advection_HeunsMethod.vti
Patterns/NumericalMethods/advection_LaxFriedrichs.vti
Patterns/NumericalMethods/advection_LaxWendroff.vti
Patterns/NumericalMethods/advection_RungeKutta4.vti
Patterns/NumericalMethods/advection_staggeredLeapfrog.vti
Patterns/NumericalMethods/advection_forwardEuler_double.vti
Patterns/NumericalMethods/advection_2stepAdamsBashforth_double.vti
Patterns/NumericalMethods/advection_3stepAdamsBashforth_double.vti
Patterns/NumericalMethods/advection_modifiedEuler_double.vti
Patterns/NumericalMethods/advection_midpointMethod_double.vti
Patterns/NumericalMethods/advection_HeunsMethod_double.vti
Patterns/NumericalMethods/advection_LaxFriedrichs_double.vti
Patterns/NumericalMethods/advection_LaxWendroff_double.vti
Patterns/NumericalMethods/advection_RungeKutta4_double.vti
Patterns/NumericalMethods/advection_staggeredLeapfrog_double.vti
Patterns/Guo2014/guo.vti
Patterns/Maginu1975/maginu_parameter_map.vti
Patterns/Kryuchkov2020/Drosophila_corneal_nanocoatings.vti
Expand All @@ -262,6 +262,7 @@ set( PATTERN_FILES
Patterns/Kobayashi1993/laplacian_growth.vti
Patterns/Kobayashi1993/laplacian_growth_3D.vti Patterns/Kobayashi1993/laplacian_growth_3D_corner.vti
Patterns/Morozov2008/Fig2.vti Patterns/Morozov2008/Fig4.vti Patterns/Morozov2008/Fig5678_delta_map.vti
Patterns/KuramotoSivashinsky1978/Kuramoto-Sivashinsky_stabilized.vti
)

set( HELP_FILES
Expand Down
2 changes: 1 addition & 1 deletion Help/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<tr>
<td>
<center>
<font size=+1><br><br><b>Ready, version 0.10.1</b><br> <!-- check matches CMakeLists.txt -->
<font size=+1><br><br><b>Ready, version 0.11.0</b><br> <!-- check matches CMakeLists.txt -->
</font>
<font size=-1>
<br>Copyright 2011-2020 The Ready Bunch:<br>
Expand Down
30 changes: 17 additions & 13 deletions Help/changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,25 @@ <h3>Changes</h3>
<a href="https://gollygang.github.io/ready/Help/changes.html">https://gollygang.github.io/ready/Help/changes.html</a>.)

<p>
<font size=+1><b>Changes in version ??? (released ???)</b></font>
<font size=+1><b>Changes in version 0.11.0 (released ???)</b></font>
<ul>
<li>Formulas now support more stencils: <b>bilaplacian_a</b>, <b>trilaplacian_a</b>, <b>gaussian_a</b>,
<b>sobel_ne_a</b>, <b>x_gradient_a</b>, <b>y_gradient_a</b>, <b>z_gradient_a</b>, <b>gradient_mag_squared_a</b>
(and similarly for the other chemicals). Several patterns have been converted from kernel rules to formula rules
<b>sobelN_a</b>, <b>sobelNE_a</b>, <b>x_gradient_a</b>, <b>gradient_mag_squared_a</b>
(and similarly for the other chemicals and directions). Several patterns have been converted from kernel rules to formula rules
as a result.
<li>Formulas now support <b>x_pos</b>, <b>y_pos</b> and <b>z_pos</b>, giving the cell location in each direction, in
the range [0,1]. This allows a neater and more accurate way of implementing parameter maps.
<li>Formulas now support <b>a_e</b>, <b>a_nw</b> etc. in a more natural way. Instead of accessing the float4 block that is
the neighbor of the current block, these keywords return a float4 that has the four values that are neighbors in the specified way. Now we can do e.g. <tt>a = a_ne;</tt> in a formula to have the whole pattern shift down and left by one pixel.
<li>Parameter <b>dx</b> is now reserved for controlling the grid spacing of the Gaussian, Laplacian, bi-Laplacian and tri-Laplacian
stencils. Formula rules no longer need to write e.g. laplacian_a / (delta_x * delta_x) and can just write laplacian_a since the value of dx is used in the stencil computation.
<li>Moved View Full Kernel... and Show OpenCL Diagnostics... to the View menu.
<li>Mac app requires macOS 10.10 or later.
<li>More smaller brush sizes.
<li>Improved <a href="open:Patterns/wave_equation.vti">wave_equation.vti</a>
<li>New patterns:
<ul>
<li><a href="open:Patterns/KuramotoSivashinsky1978/Kuramoto-Sivashinsky_stabilized.vti">KuramotoSivashinsky1978/Kuramoto-Sivashinsky_stabilized.vti</a>
<li><a href="open:Patterns/Kobayashi1993/crystals.vti">Kobayashi1993/crystals.vti</a>
<li>In Experiments/TihaVonGhyczy: <a href="open:Patterns/Experiments/TihaVonGhyczy/sobel_waves.vti">sobel_waves.vti</a>.
<li>In Experiments/TimHutton: <a href="open:Patterns/Experiments/TimHutton/mutually-catalytic_spots_2.vti">mutually-catalytic_spots_2.vti</a>.
Expand Down Expand Up @@ -126,16 +130,16 @@ <h3>Changes</h3>
<li>And more amazing rules by Cornus Ammonis: <a href="open:Patterns/Experiments/CornusAmmonis/bz-warpsharp.vti">bz-warpsharp.vti</a> applying the warp-sharp algorithm to the Belousov-Zhabotinsky system, <a href="open:Patterns/Experiments/CornusAmmonis/smoke.vti">smoke.vti</a>, <a href="open:Patterns/Experiments/CornusAmmonis/smoke-ising.vti">smoke-ising.vti</a>, and <a href="open:Patterns/Experiments/CornusAmmonis/splats.vti">splats.vti</a>.
<li><a href="open:Patterns/advection.vti">advection.vti</a>: the advection equation, plus some different
methods of integrating it, for comparison:
<a href="open:Patterns/NumericalMethods/advection_forwardEuler.vti">forward Euler</a>,
<a href="open:Patterns/NumericalMethods/advection_2stepAdamsBashforth.vti">two-step Adams-Bashforth</a>,
<a href="open:Patterns/NumericalMethods/advection_3stepAdamsBashforth.vti">three-step Adams-Bashforth</a>,
<a href="open:Patterns/NumericalMethods/advection_modifiedEuler.vti">modified Euler</a>,
<a href="open:Patterns/NumericalMethods/advection_midpointMethod.vti">the midpoint method</a>,
<a href="open:Patterns/NumericalMethods/advection_HeunsMethod.vti">Heun's method</a>,
<a href="open:Patterns/NumericalMethods/advection_staggeredLeapfrog.vti">staggered leapfrog</a>,
<a href="open:Patterns/NumericalMethods/advection_LaxFriedrichs.vti">Lax-Friedrichs</a>,
<a href="open:Patterns/NumericalMethods/advection_LaxWendroff.vti">Lax-Wendroff</a> and
<a href="open:Patterns/NumericalMethods/advection_RungeKutta4.vti">fourth-order Runge-Kutta</a>.
<a href="open:Patterns/Experiments/TimHutton/NumericalMethods/advection_forwardEuler.vti">forward Euler</a>,
<a href="open:Patterns/Experiments/TimHutton/NumericalMethods/advection_2stepAdamsBashforth.vti">two-step Adams-Bashforth</a>,
<a href="open:Patterns/Experiments/TimHutton/NumericalMethods/advection_3stepAdamsBashforth.vti">three-step Adams-Bashforth</a>,
<a href="open:Patterns/Experiments/TimHutton/NumericalMethods/advection_modifiedEuler.vti">modified Euler</a>,
<a href="open:Patterns/Experiments/TimHutton/NumericalMethods/advection_midpointMethod.vti">the midpoint method</a>,
<a href="open:Patterns/Experiments/TimHutton/NumericalMethods/advection_HeunsMethod.vti">Heun's method</a>,
<a href="open:Patterns/Experiments/TimHutton/NumericalMethods/advection_staggeredLeapfrog.vti">staggered leapfrog</a>,
<a href="open:Patterns/Experiments/TimHutton/NumericalMethods/advection_LaxFriedrichs.vti">Lax-Friedrichs</a>,
<a href="open:Patterns/Experiments/TimHutton/NumericalMethods/advection_LaxWendroff.vti">Lax-Wendroff</a> and
<a href="open:Patterns/Experiments/TimHutton/NumericalMethods/advection_RungeKutta4.vti">fourth-order Runge-Kutta</a>.
<li><a href="open:Patterns/Pennybacker2013/phyllotaxis_fibonacci.vti">Pennybacker2013/phyllotaxis_fibonacci.vti</a> and <a href="open:Patterns/Pennybacker2013/phyllotaxis_hexagons.vti">Pennybacker2013/phyllotaxis_hexagons.vti</a>
showing a single-chemical model of phyllotaxis in plants. Also <a href="open:Patterns/Pennybacker2013/spots.vti">Pennybacker2013/spots.vti</a>, <a href="open:Patterns/Pennybacker2013/stripes.vti">Pennybacker2013/stripes.vti</a> and
<a href="open:Patterns/Pennybacker2013/parameter_map.vti">Pennybacker2013/parameter_map.vti</a>, showing a simpler model without the gradient term.
Expand Down
7 changes: 5 additions & 2 deletions Help/writing_new_rules.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,22 @@ <h4>Formulas and kernel rules</h4>
<tr><td>bilaplacian_a</td><td>A <a href="https://en.wikipedia.org/wiki/Biharmonic_equation">bi-Laplacian kernel</a> applied to chemical 'a' (or 'b', etc.). Equivalent to applying the Laplacian kernel twice.</td></tr>
<tr><td>trilaplacian_a</td><td>A tri-Laplacian kernel applied to chemical 'a' (or 'b', etc.). Equivalent to applying the Laplacian kernel three times.</td></tr>
<tr><td>gaussian_a</td><td>A <a href="https://en.wikipedia.org/wiki/Gaussian_filter">Gaussian kernel</a> of sigma=1 applied to chemical 'a' (or 'b', etc.).</td></tr>
<tr><td>sobel_ne_a</td><td>A <a href="https://en.wikipedia.org/wiki/Sobel_operator">Sobel filter</a> applied to chemical 'a' (or 'b', etc.) pointing in the north-east direction.</td></tr>
<tr><td>sobelN_a, sobelE_a, sobelNE_a, etc.</td><td>A <a href="https://en.wikipedia.org/wiki/Sobel_operator">Sobel filter</a> applied to chemical 'a' (or 'b', etc.) pointing in the compass directions.</td></tr>
<tr><td>x_gradient_a</td><td>The <a href="https://en.wikipedia.org/wiki/Image_gradient">gradient</a> of chemical 'a' (or 'b', etc.) in the x-direction.</td></tr>
<tr><td>y_gradient_a</td><td>The gradient of chemical 'a' (or 'b', etc.) in the y-direction.</td></tr>
<tr><td>z_gradient_a</td><td>The gradient of chemical 'a' (or 'b', etc.) in the z-direction.</td></tr>
<tr><td>gradient_mag_squared_a</td><td>The squared magnitude of the gradient of chemical 'a' (or 'b', etc.). For a 2D pattern this is equal to x_gradient_a^2 + y_gradient_a^2.</td></tr>
<tr><td>x_pos</td><td>The location of the cell in the x-direction, in the range 0 to 1.</td></tr>
<tr><td>y_pos</td><td>The location of the cell in the y-direction, in the range 0 to 1.</td></tr>
<tr><td>z_pos</td><td>The location of the cell in the z-direction, in the range 0 to 1.</td></tr>
<tr><td>a_n, a_ne, a_n2, a_une, etc.</td><td>The neighboring cells. Indexed as u=up/d=down Z cells, n=north/s=south Y cells, e=east/w=west X cells: a_[u/d][Z][n/s][Y][e/w][X]. The digit can be omitted if it is one. The digit and the direction can be omitted if the digit is zero.</td></tr>
</table>
<p>
The <i>grid spacing</i> (sometimes denoted by <i>h</i>) of the Laplacian and Gaussian stencils is controlled by parameter <tt>dx</tt>. If there is no parameter called <tt>dx</tt> then the default value of 1 is used.
<p>
To understand how the formula is used, try View > <a href="view.html#View_ViewFullKernel">View Full Kernel</a> to see the OpenCL kernel code that is assembled. You'll see for example how the <tt>timestep</tt> parameter appears, at the end during the forward-Euler step. Any formula rule can be permanently converted to a kernel rule by using Action > <a href="action.html#Action_ConvertToFullKernel">Convert to Full Kernel</a>.
To understand how the formula is used, try View > <a href="view.html#View_ViewFullKernel">View Full Kernel</a> to see the OpenCL kernel code that is assembled. You'll see for example how the <tt>timestep</tt> parameter is used at the end during the forward Euler step. Any formula rule can be permanently converted to a kernel rule by using Action > <a href="action.html#Action_ConvertToFullKernel">Convert to Full Kernel</a>.
<p>
For speed we process the image in blocks of 4x1x1, stored as float4. All of the above keywords are float4 values. While doing it this way makes Ready run faster, it does complicate the way we have to write rules - see the examples and please get in touch for more help.
<p>
Images in Ready can be 1D, 2D or 3D. The keywords in the formulas generate stencils of the appropriate dimensionality.
<p>
Expand Down
Loading

0 comments on commit 462e99c

Please sign in to comment.