|
52 | 52 | plant2 = construct(Plant, (deepcopy(organ3), deepcopy(organ4)), Float64[],
|
53 | 53 | PlantSettings(1.0))
|
54 | 54 | community = construct(Community, (deepcopy(plant1), deepcopy(plant2)))
|
55 |
| -scenario = construct(Scenario, (deepcopy(community),))</code></pre><p>(of course at the cost of mutability).</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/MultiScaleArrays.jl/blob/7c38a1e03279bef5dcb221120a2f0f4e8cfe7058/src/MultiScaleArrays.jl#L13-L169">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="MultiScaleArrays.print_human_readable" href="#MultiScaleArrays.print_human_readable"><code>MultiScaleArrays.print_human_readable</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">print_human_readable(embryo) |
| 55 | +scenario = construct(Scenario, (deepcopy(community),))</code></pre><p>(of course at the cost of mutability).</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/MultiScaleArrays.jl/blob/22e1ba914adbd608dd4b5dd6347b4996d7f50b51/src/MultiScaleArrays.jl#L13-L169">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="MultiScaleArrays.print_human_readable" href="#MultiScaleArrays.print_human_readable"><code>MultiScaleArrays.print_human_readable</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">print_human_readable(embryo) |
56 | 56 | # +|Tissue; |Tissue
|
57 | 57 | # +|Popula; |Popula; |Popula; +|Popula; |Popula; |Popula
|
58 | 58 | # +Cell; Cell; Cell; +Cell; Cell; Cell; +Cell; Cell; Cell; +Cell; Cell; Cell; +Cell; Cell; Cell; +Cell; Cell; Cell
|
|
64 | 64 | # +|Ti; |Ti
|
65 | 65 | # +|Po; |Po; |Po; +|Po; |Po; |Po
|
66 | 66 | # +va: [1.0, 2.0, 3.0]; va: [3.0, 2.0, 5.0]; va: [4.0, 6.0]; +va: [1.0, 2.0, 3.0]; va: [3.0, 2.0, 5.0]; va: [4.0, 6.0]; +va: [1.0, 2.0, 3.0]; va: [3.0, 2.0, 5.0]; va: [4.0, 6.0]; +va: [1.0, 2.0, 3.0]; va: [3.0, 2.0, 5.0]; va: [4.0, 6.0]; +va: [1.0, 2.0, 3.0]; va: [3.0, 2.0, 5.0]; va: [4.0, 6.0]; +va: [1.0, 2.0, 3.0]; va: [3.0, 2.0, 5.0]; va: [4.0, 6.0]</code></pre><p>if your screen is small, then print a sub-part of the AbstractMultiScaleArray:</p><pre><code class="language-julia hljs">print_human_readable(embryo.nodes[1].nodes[1]; fields = [:values])
|
67 |
| -# +values: [1.0, 2.0, 3.0]; values: [3.0, 2.0, 5.0]; values: [4.0, 6.0]</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/MultiScaleArrays.jl/blob/7c38a1e03279bef5dcb221120a2f0f4e8cfe7058/src/print_human_readable.jl#L53-L81">source</a></section></article><h3 id="Extensions"><a class="docs-heading-anchor" href="#Extensions">Extensions</a><a id="Extensions-1"></a><a class="docs-heading-anchor-permalink" href="#Extensions" title="Permalink"></a></h3><p>Note that this only showed the most basic MultiScaleArray. These types can be extended as one pleases. For example, we can change the definition of the cell to have:</p><pre><code class="language-julia hljs">struct Cell{B} <: AbstractMultiScaleArrayLeaf{B} |
| 67 | +# +values: [1.0, 2.0, 3.0]; values: [3.0, 2.0, 5.0]; values: [4.0, 6.0]</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/MultiScaleArrays.jl/blob/22e1ba914adbd608dd4b5dd6347b4996d7f50b51/src/print_human_readable.jl#L53-L81">source</a></section></article><h3 id="Extensions"><a class="docs-heading-anchor" href="#Extensions">Extensions</a><a id="Extensions-1"></a><a class="docs-heading-anchor-permalink" href="#Extensions" title="Permalink"></a></h3><p>Note that this only showed the most basic MultiScaleArray. These types can be extended as one pleases. For example, we can change the definition of the cell to have:</p><pre><code class="language-julia hljs">struct Cell{B} <: AbstractMultiScaleArrayLeaf{B} |
68 | 68 | values::Vector{B}
|
69 | 69 | celltype::Symbol
|
70 | 70 | end</code></pre><p>Note that the ordering of the fields matters here: the extra fields must come after the standard fields (so for a leaf it comes after <code>values</code>, for a standard multiscale array it would come after <code>nodes,values,end_idxs</code>). Then we'd construct cells with <code>cell3 = Cell([3.0; 2.0; 5.0], :BCell)</code>, and can give it a cell type. This information is part of the call, so</p><pre><code class="language-julia hljs">for (cell, y, z) in level_iter_idx(embryo, 2)
|
|
73 | 73 | f(t, tissue, @view embryo[y:z])
|
74 | 74 | end</code></pre><p>and mutate <code>tis.values</code> in <code>f</code>. For example, we could have</p><pre><code class="language-julia hljs">function f(du, tissue::Tissue, p, t)
|
75 | 75 | du .+= randn(3)
|
76 |
| -end</code></pre><p>applies normal random numbers to the three values. We could use this to add to the model the fact that <code>tissue.values[1:3]</code> are the tissue's position, and <code>f</code> would then be adding Brownian motion.</p><p>Of course, you can keep going and kind of do whatever you want. The power is yours!</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« Home</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Friday 1 March 2024 09:11">Friday 1 March 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
| 76 | +end</code></pre><p>applies normal random numbers to the three values. We could use this to add to the model the fact that <code>tissue.values[1:3]</code> are the tissue's position, and <code>f</code> would then be adding Brownian motion.</p><p>Of course, you can keep going and kind of do whatever you want. The power is yours!</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« Home</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Friday 1 March 2024 10:02">Friday 1 March 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
0 commit comments