Skip to content

Commit 20bc231

Browse files
committed
mech grid size in xml
1 parent 1cb79ae commit 20bc231

4 files changed

Lines changed: 64 additions & 0 deletions

File tree

core/PhysiCell_cell.cpp

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,67 @@ bool is_neighbor_voxel(Cell* pCell, std::vector<double> my_voxel_center, std::ve
13301330
return true;
13311331
}
13321332

1333+
// bool is_neighbor_voxel_original(Cell* pCell, std::vector<double> my_voxel_center, std::vector<double> other_voxel_center, int other_voxel_index)
1334+
// bool is_neighbor_voxel_Claude(Cell* pCell, const std::vector<double>& my_voxel_center,
1335+
// const std::vector<double>& other_voxel_center, int other_voxel_index)
1336+
// {
1337+
// // Cache frequently used values
1338+
// const double max_interactive_distance = pCell->phenotype.mechanics.relative_maximum_adhesion_distance *
1339+
// pCell->phenotype.geometry.radius +
1340+
// pCell->get_container()->max_cell_interactive_distance_in_voxel[other_voxel_index];
1341+
// const double max_distance_squared = max_interactive_distance * max_interactive_distance;
1342+
// const auto& pos = pCell->position;
1343+
1344+
// // Helper lambda to compute squared distance
1345+
// auto squared_distance = [](double dx, double dy, double dz = 0.0) {
1346+
// return dx * dx + dy * dy + dz * dz;
1347+
// };
1348+
1349+
// // Count matching dimensions to determine neighbor type
1350+
// int matching_dims = 0;
1351+
// int differing_dim = -1;
1352+
1353+
// for (int i = 0; i < 3; ++i) {
1354+
// if (my_voxel_center[i] == other_voxel_center[i]) {
1355+
// matching_dims++;
1356+
// } else {
1357+
// differing_dim = i;
1358+
// }
1359+
// }
1360+
1361+
// // Case 1: Face neighbor (2 matching dimensions)
1362+
// if (matching_dims == 2) {
1363+
// const double surface_coord = 0.5 * (my_voxel_center[differing_dim] + other_voxel_center[differing_dim]);
1364+
// return std::fabs(pos[differing_dim] - surface_coord) <= max_interactive_distance;
1365+
// }
1366+
1367+
// // Case 2: Edge neighbor (1 matching dimension)
1368+
// if (matching_dims == 1) {
1369+
// int dim1 = -1, dim2 = -1;
1370+
// for (int i = 0, count = 0; i < 3; ++i) {
1371+
// if (my_voxel_center[i] != other_voxel_center[i]) {
1372+
// if (count == 0) dim1 = i;
1373+
// else dim2 = i;
1374+
// count++;
1375+
// }
1376+
// }
1377+
1378+
// const double line_coord1 = 0.5 * (my_voxel_center[dim1] + other_voxel_center[dim1]);
1379+
// const double line_coord2 = 0.5 * (my_voxel_center[dim2] + other_voxel_center[dim2]);
1380+
// const double dist_sq = squared_distance(pos[dim1] - line_coord1, pos[dim2] - line_coord2);
1381+
1382+
// return dist_sq <= max_distance_squared;
1383+
// }
1384+
1385+
// // Case 3: Corner neighbor (0 matching dimensions)
1386+
// const double corner_x = 0.5 * (my_voxel_center[0] + other_voxel_center[0]);
1387+
// const double corner_y = 0.5 * (my_voxel_center[1] + other_voxel_center[1]);
1388+
// const double corner_z = 0.5 * (my_voxel_center[2] + other_voxel_center[2]);
1389+
// const double dist_sq = squared_distance(pos[0] - corner_x, pos[1] - corner_y, pos[2] - corner_z);
1390+
1391+
// return dist_sq <= max_distance_squared;
1392+
// }
1393+
13331394
std::vector<Cell*>& Cell::cells_in_my_container( void )
13341395
{
13351396
return get_container()->agent_grid[get_current_mechanics_voxel_index()];

core/PhysiCell_cell.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ void save_all_cells_to_matlab( std::string filename );
262262

263263
//function to check if a neighbor voxel contains any cell that can interact with me
264264
bool is_neighbor_voxel(Cell* pCell, std::vector<double> myVoxelCenter, std::vector<double> otherVoxelCenter, int otherVoxelIndex);
265+
// bool is_neighbor_voxel(Cell* pCell, const std::vector<double>& myVoxelCenter, const std::vector<double>& otherVoxelCenter, int otherVoxelIndex); // Claude
265266

266267

267268
extern std::unordered_map<std::string,Cell_Definition*> cell_definitions_by_name;

core/PhysiCell_constants.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ double mechanics_dt = 0.1;
7676
double phenotype_dt = 6.0;
7777
double intracellular_dt = 0.01;
7878

79+
double mechanics_voxel_size = 30.0;
7980

8081
// currently recognized cell cycle models
8182
const int PhysiCell_constants::advanced_Ki67_cycle_model= 0;

core/PhysiCell_constants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ extern double diffusion_dt;
157157
extern double mechanics_dt;
158158
extern double phenotype_dt;
159159
extern double intracellular_dt;
160+
extern double mechanics_voxel_size;
160161

161162

162163
extern std::unordered_map<std::string,int> cycle_model_codes;

0 commit comments

Comments
 (0)