{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Cell Division\n", "
\n", "\n", "\n", "This model creates a grid of 4x4x4 cells. Each cell grows untill a specific\n", "volume, after which it proliferates (i.e. divides)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%jsroot on\n", "gROOT->LoadMacro(\"${BDMSYS}/etc/binder_rootlogon.C\");" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create a new simulation" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Simulation simulation(\"cell_division\");" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's define the number of cells we wish to create along each dimension,\n", " the spacing between the cells, and each cell's diameter." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "size_t cells_per_dim = 4;\n", "size_t spacing = 20;\n", "size_t diameter = 10;" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To define how are cells will look like we will create a construct in the\n", " form of a C++ lambda as follows." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "auto construct = [&](const Double3& position) {\n", " Cell* cell = new Cell(position);\n", " cell->SetDiameter(diameter);\n", " // Add the \"grow and divide\" behavior to each cell\n", " cell->AddBiologyModule(new GrowDivide());\n", " return cell;\n", "};\n", "ModelInitializer::Grid3D(cells_per_dim, spacing, construct);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Run simulation for one timestep" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "simulation.Simulate(1);\n", "\n", "std::cout << \"Simulation completed successfully!\" << std::endl;" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Let's visualize the output!" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "VisualizeInNotebook();" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "ROOT C++", "language": "c++", "name": "root" }, "language_info": { "codemirror_mode": "text/x-c++src", "file_extension": ".C", "mimetype": " text/x-c++src", "name": "c++" } }, "nbformat": 4, "nbformat_minor": 4 }