1+ /*
2+ ###############################################################################
3+ # If you use PhysiCell in your project, please cite PhysiCell and the version #
4+ # number, such as below: #
5+ # #
6+ # We implemented and solved the model using PhysiCell (Version x.y.z) [1]. #
7+ # #
8+ # [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, #
9+ # PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- #
10+ # lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 #
11+ # DOI: 10.1371/journal.pcbi.1005991 #
12+ # #
13+ # See VERSION.txt or call get_PhysiCell_version() to get the current version #
14+ # x.y.z. Call display_citations() to get detailed information on all cite-#
15+ # able software used in your PhysiCell application. #
16+ # #
17+ # Because PhysiCell extensively uses BioFVM, we suggest you also cite BioFVM #
18+ # as below: #
19+ # #
20+ # We implemented and solved the model using PhysiCell (Version x.y.z) [1], #
21+ # with BioFVM [2] to solve the transport equations. #
22+ # #
23+ # [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, #
24+ # PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- #
25+ # lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 #
26+ # DOI: 10.1371/journal.pcbi.1005991 #
27+ # #
28+ # [2] A Ghaffarizadeh, SH Friedman, and P Macklin, BioFVM: an efficient para- #
29+ # llelized diffusive transport solver for 3-D biological simulations, #
30+ # Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 #
31+ # #
32+ ###############################################################################
33+ # #
34+ # BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) #
35+ # #
36+ # Copyright (c) 2015-2021, Paul Macklin and the PhysiCell Project #
37+ # All rights reserved. #
38+ # #
39+ # Redistribution and use in source and binary forms, with or without #
40+ # modification, are permitted provided that the following conditions are met: #
41+ # #
42+ # 1. Redistributions of source code must retain the above copyright notice, #
43+ # this list of conditions and the following disclaimer. #
44+ # #
45+ # 2. Redistributions in binary form must reproduce the above copyright #
46+ # notice, this list of conditions and the following disclaimer in the #
47+ # documentation and/or other materials provided with the distribution. #
48+ # #
49+ # 3. Neither the name of the copyright holder nor the names of its #
50+ # contributors may be used to endorse or promote products derived from this #
51+ # software without specific prior written permission. #
52+ # #
53+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" #
54+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE #
55+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE #
56+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE #
57+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR #
58+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF #
59+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS #
60+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN #
61+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) #
62+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE #
63+ # POSSIBILITY OF SUCH DAMAGE. #
64+ # #
65+ ###############################################################################
66+ */
67+
68+ #include " ./custom.h"
69+
70+ void create_cell_types ( void )
71+ {
72+ // set the random seed
73+ if (parameters.ints .find_index (" random_seed" ) != -1 )
74+ {
75+ SeedRandom (parameters.ints (" random_seed" ));
76+ }
77+
78+ /*
79+ Put any modifications to default cell definition here if you
80+ want to have "inherited" by other cell types.
81+
82+ This is a good place to set default functions.
83+ */
84+
85+ initialize_default_cell_definition ();
86+ cell_defaults.phenotype .secretion .sync_to_microenvironment ( µenvironment );
87+
88+ cell_defaults.functions .volume_update_function = standard_volume_update_function;
89+ cell_defaults.functions .update_velocity = standard_update_cell_velocity;
90+
91+ cell_defaults.functions .update_migration_bias = NULL ;
92+ cell_defaults.functions .update_phenotype = NULL ; // update_cell_and_death_parameters_O2_based;
93+ cell_defaults.functions .custom_cell_rule = NULL ;
94+ cell_defaults.functions .contact_function = NULL ;
95+
96+ cell_defaults.functions .add_cell_basement_membrane_interactions = NULL ;
97+ cell_defaults.functions .calculate_distance_to_membrane = NULL ;
98+
99+ /*
100+ This parses the cell definitions in the XML config file.
101+ */
102+
103+ initialize_cell_definitions_from_pugixml ();
104+
105+ /*
106+ This builds the map of cell definitions and summarizes the setup.
107+ */
108+
109+ build_cell_definitions_maps ();
110+
111+ /*
112+ This intializes cell signal and response dictionaries
113+ */
114+
115+ setup_signal_behavior_dictionaries ();
116+
117+ /*
118+ Cell rule definitions
119+ */
120+
121+ setup_cell_rules ();
122+
123+ /*
124+ Put any modifications to individual cell definitions here.
125+
126+ This is a good place to set custom functions.
127+ */
128+
129+ cell_defaults.functions .update_phenotype = phenotype_function;
130+ cell_defaults.functions .custom_cell_rule = custom_function;
131+ cell_defaults.functions .contact_function = contact_function;
132+
133+ /*
134+ This builds the map of cell definitions and summarizes the setup.
135+ */
136+
137+ display_cell_definitions ( std::cout );
138+
139+ return ;
140+ }
141+
142+ void setup_microenvironment ( void )
143+ {
144+ // set domain parameters
145+
146+ // put any custom code to set non-homogeneous initial conditions or
147+ // extra Dirichlet nodes here.
148+
149+ // initialize BioFVM
150+
151+ initialize_microenvironment ();
152+
153+ return ;
154+ }
155+
156+ void setup_tissue ( void )
157+ {
158+ double Xmin = microenvironment.mesh .bounding_box [0 ];
159+ double Ymin = microenvironment.mesh .bounding_box [1 ];
160+ double Zmin = microenvironment.mesh .bounding_box [2 ];
161+
162+ double Xmax = microenvironment.mesh .bounding_box [3 ];
163+ double Ymax = microenvironment.mesh .bounding_box [4 ];
164+ double Zmax = microenvironment.mesh .bounding_box [5 ];
165+
166+ if ( default_microenvironment_options.simulate_2D == true )
167+ {
168+ Zmin = 0.0 ;
169+ Zmax = 0.0 ;
170+ }
171+
172+ double Xrange = Xmax - Xmin;
173+ double Yrange = Ymax - Ymin;
174+ double Zrange = Zmax - Zmin;
175+
176+ // create some of each type of cell
177+
178+ Cell* pC;
179+
180+ for ( int k=0 ; k < cell_definitions_by_index.size () ; k++ )
181+ {
182+ Cell_Definition* pCD = cell_definitions_by_index[k];
183+ std::cout << " Placing cells of type " << pCD->name << " ... " << std::endl;
184+ for ( int n = 0 ; n < parameters.ints (" number_of_cells" ) ; n++ )
185+ {
186+ std::vector<double > position = {0 ,0 ,0 };
187+ position[0 ] = Xmin + UniformRandom ()*Xrange;
188+ position[1 ] = Ymin + UniformRandom ()*Yrange;
189+ position[2 ] = Zmin + UniformRandom ()*Zrange;
190+
191+ pC = create_cell ( *pCD );
192+ pC->assign_position ( position );
193+ }
194+ }
195+ std::cout << std::endl;
196+
197+ // load cells from your CSV file (if enabled)
198+ load_cells_from_pugixml ();
199+ set_parameters_from_distributions ();
200+
201+ return ;
202+ }
203+
204+ std::vector<std::string> my_coloring_function ( Cell* pCell )
205+ { return paint_by_number_cell_coloring (pCell); }
206+
207+ void phenotype_function ( Cell* pCell, Phenotype& phenotype, double dt )
208+ { return ; }
209+
210+ void custom_function ( Cell* pCell, Phenotype& phenotype , double dt )
211+ { return ; }
212+
213+ void contact_function ( Cell* pMe, Phenotype& phenoMe , Cell* pOther, Phenotype& phenoOther , double dt )
214+ { return ; }
0 commit comments