Skip to content

Commit 90cd5c0

Browse files
committed
additive DCs
1 parent f5a9774 commit 90cd5c0

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

BioFVM/BioFVM_microenvironment.cpp

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Microenvironment::Microenvironment()
152152
one_third /= 3.0;
153153

154154
dirichlet_value_vectors.assign( mesh.voxels.size(), one );
155-
dirichlet_activation_vector.assign( 1 , true );
155+
dirichlet_activation_vector.assign( 1 , false );
156156

157157
dirichlet_activation_vectors.assign( 1 , dirichlet_activation_vector );
158158

@@ -212,7 +212,7 @@ void Microenvironment::update_dirichlet_node( int voxel_index , int substrate_in
212212
dirichlet_value_vectors[voxel_index][substrate_index] = new_value;
213213

214214
dirichlet_activation_vectors[voxel_index][substrate_index] = true;
215-
215+
216216
return;
217217
}
218218

@@ -250,6 +250,12 @@ bool Microenvironment::get_substrate_dirichlet_activation( int substrate_index )
250250
return dirichlet_activation_vector[substrate_index];
251251
}
252252

253+
// TODO? fix confusing swapped usage of args
254+
double Microenvironment::get_substrate_dirichlet_value( int substrate_index, int index )
255+
{
256+
return dirichlet_value_vectors[index][substrate_index];
257+
}
258+
253259
// new functions for finer-grained control of Dirichlet conditions -- 1.7.0
254260

255261
void Microenvironment::set_substrate_dirichlet_activation( int substrate_index , int index, bool new_value )
@@ -261,6 +267,7 @@ void Microenvironment::set_substrate_dirichlet_activation( int substrate_index ,
261267
bool Microenvironment::get_substrate_dirichlet_activation( int substrate_index, int index )
262268
{ return dirichlet_activation_vectors[index][substrate_index]; }
263269

270+
264271
void Microenvironment::apply_dirichlet_conditions( void )
265272
{
266273
/*
@@ -436,12 +443,12 @@ void Microenvironment::resize_densities( int new_size )
436443
one_third /= 3.0;
437444

438445
dirichlet_value_vectors.assign( mesh.voxels.size(), one );
439-
dirichlet_activation_vector.assign( new_size, true );
446+
dirichlet_activation_vector.assign( new_size, false );
440447

441448
dirichlet_activation_vectors.assign( mesh.voxels.size(), dirichlet_activation_vector );
442449

443450
default_microenvironment_options.Dirichlet_condition_vector.assign( new_size , 1.0 );
444-
default_microenvironment_options.Dirichlet_activation_vector.assign( new_size, true );
451+
default_microenvironment_options.Dirichlet_activation_vector.assign( new_size, false );
445452

446453
default_microenvironment_options.initial_condition_vector.assign( new_size , 1.0 );
447454

@@ -512,7 +519,7 @@ void Microenvironment::add_density( void )
512519

513520
// Fixes in PhysiCell preview November 2017
514521
default_microenvironment_options.Dirichlet_condition_vector.push_back( 1.0 ); // = one;
515-
default_microenvironment_options.Dirichlet_activation_vector.push_back( true ); // assign( number_of_densities(), true );
522+
default_microenvironment_options.Dirichlet_activation_vector.push_back( false );
516523

517524
default_microenvironment_options.initial_condition_vector.push_back( 1.0 );
518525

@@ -577,15 +584,14 @@ void Microenvironment::add_density( std::string name , std::string units )
577584
one_third /= 3.0;
578585

579586
dirichlet_value_vectors.assign( mesh.voxels.size(), one );
580-
dirichlet_activation_vector.push_back( true );
587+
dirichlet_activation_vector.push_back( false );
581588
dirichlet_activation_vectors.assign( mesh.voxels.size(), dirichlet_activation_vector );
582589

583590
// fix in PhysiCell preview November 2017
584591
default_microenvironment_options.Dirichlet_condition_vector.push_back( 1.0 ); // = one;
585-
default_microenvironment_options.Dirichlet_activation_vector.push_back( true ); // assign( number_of_densities(), true );
592+
default_microenvironment_options.Dirichlet_activation_vector.push_back( false ); // assign( number_of_densities(), false );
586593

587-
default_microenvironment_options.Dirichlet_all.push_back( true );
588-
// default_microenvironment_options.Dirichlet_interior.push_back( true );
594+
default_microenvironment_options.Dirichlet_all.push_back( false );
589595
default_microenvironment_options.Dirichlet_xmin.push_back( false );
590596
default_microenvironment_options.Dirichlet_xmax.push_back( false );
591597
default_microenvironment_options.Dirichlet_ymin.push_back( false );
@@ -647,12 +653,12 @@ void Microenvironment::add_density( std::string name , std::string units, double
647653
one_third /= 3.0;
648654

649655
dirichlet_value_vectors.assign( mesh.voxels.size(), one );
650-
dirichlet_activation_vector.push_back( true );
656+
dirichlet_activation_vector.push_back( false );
651657
dirichlet_activation_vectors.assign( mesh.voxels.size(), dirichlet_activation_vector );
652658

653659
// fix in PhysiCell preview November 2017
654660
default_microenvironment_options.Dirichlet_condition_vector.push_back( 1.0 ); // = one;
655-
default_microenvironment_options.Dirichlet_activation_vector.push_back( true ); // assign( number_of_densities(), true );
661+
default_microenvironment_options.Dirichlet_activation_vector.push_back( false ); // assign( number_of_densities(), false );
656662

657663
default_microenvironment_options.initial_condition_vector.push_back( 1.0 );
658664

@@ -1219,7 +1225,7 @@ Microenvironment_Options::Microenvironment_Options()
12191225

12201226
outer_Dirichlet_conditions = false;
12211227
Dirichlet_condition_vector.assign( pMicroenvironment->number_of_densities() , 1.0 );
1222-
Dirichlet_activation_vector.assign( pMicroenvironment->number_of_densities() , true );
1228+
Dirichlet_activation_vector.assign( pMicroenvironment->number_of_densities() , false );
12231229

12241230
initial_condition_vector.resize(0); // = Dirichlet_condition_vector;
12251231

@@ -1523,11 +1529,13 @@ void initialize_microenvironment( void )
15231529
}
15241530
*/
15251531

1526-
// set the Dirichlet condition activation vector to match the microenvironment options
1527-
for( int i=0 ; i < default_microenvironment_options.Dirichlet_activation_vector.size(); i++ )
1528-
{
1529-
microenvironment.set_substrate_dirichlet_activation( i , default_microenvironment_options.Dirichlet_activation_vector[i] );
1530-
}
1532+
// April 2023: no longer necessary after flipping our approach and doing an "additive" instead of "subtractive" DCs handling. I.e., we assume DC activation is false by default; make true on-demand.
1533+
1534+
// // set the Dirichlet condition activation vector to match the microenvironment options
1535+
// for( int i=0 ; i < default_microenvironment_options.Dirichlet_activation_vector.size(); i++ )
1536+
// {
1537+
// microenvironment.set_substrate_dirichlet_activation( i , default_microenvironment_options.Dirichlet_activation_vector[i] );
1538+
// }
15311539

15321540
microenvironment.display_information( std::cout );
15331541
return;

BioFVM/BioFVM_microenvironment.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ class Microenvironment
252252
void set_substrate_dirichlet_activation( int substrate_index , int index, bool new_value );
253253
void set_substrate_dirichlet_activation( int index, std::vector<bool>& new_value );
254254
bool get_substrate_dirichlet_activation( int substrate_index, int index );
255+
256+
double get_substrate_dirichlet_value( int substrate_index, int index );
255257

256258
bool& is_dirichlet_node( int voxel_index );
257259

0 commit comments

Comments
 (0)