void do_sh_range(double *ystart, double *yend) { double parlo, parhi, dpar, temp; int npar, i, j, ierr; int side, cycle, icol, color; char bob[50]; if (set_up_sh_range() == 0) return; swap_color(&color, 0); parhi = shoot_range.phigh; parlo = shoot_range.plow; npar = shoot_range.steps; dpar = (parhi - parlo) / (double)npar; side = shoot_range.side; cycle = shoot_range.cycle; storind = 0; icol = 0; if (shoot_range.movie == 1) reset_film(); for (i = 0; i <= npar; i++) { temp = parlo + dpar * (double)i; set_val(shoot_range.item, temp); sprintf(bob, "%s=%.16g", shoot_range.item, temp); x11_status_bar_set_text(main_status_bar, bob); if (shoot_range.movie == 1) clr_scrn(); bvshoot(ystart, yend, BVP_TOL, BVP_EPS, BVP_MAXIT, &ierr, NODE, 0, 0, 0, 0, 0.0); if (ierr == ABORT) continue; if (ierr < 0) { bad_shoot(ierr); set_browser_data(storage, storind, NEQ + 1); swap_color(&color, 1); return; } storage[0][storind] = temp; if (side == 0) for (j = 0; j < NODE; j++) storage[j + 1][storind] = ystart[j]; else for (j = 0; j < NODE; j++) storage[j + 1][storind] = yend[j]; storind++; set_cycle(cycle, &icol); get_ic(0, ystart); last_shot(0); if (shoot_range.movie == 1) film_clip(); ping(); } set_browser_data(storage, storind, NEQ + 1); auto_freeze_it(); swap_color(&color, 1); }
void op_sti(t_struck *s, t_pc *proc, t_pc **first) { if (!proc->cycle) set_cycle(s, proc, 25, first); else if (proc->cycle == 1) { ocp_value(s->map[proc->index + 1], TYP); stock_value_ldir(TMP, proc, s, 3); stock_sti(s, proc, 0); proc->index = (proc->index + move_ocp(TYP, 3)) % MEM_SIZE; } --proc->cycle; }
int cycle() { xmachine_memory_keratinocyte * xmemory = current_xmachine->xmachine_keratinocyte; char_array id_temp; char buffer[10]; /* find number of contacts/bonds*/ int contacts = get_num_xy_bonds() + get_num_z_bonds(); /* touching a wall counts as two contacts*/ if (get_x() == 0 || get_x() == substrate_width) { contacts += 2; } if (get_y() == 0 || get_y() == substrate_width) { contacts += 2; } if (contacts <= get_max_num_bonds(calcium_level)) { /* cell comes out of G0*/ set_cycle(get_cycle()+1); set_contact_inhibited_ticks(0); } else { /* cell enters G0*/ set_contact_inhibited_ticks(get_contact_inhibited_ticks()+1); } /* check to see if enough time has elapsed as to whether cell can divide*/ if (divide(get_type(), get_cycle())) { int new_cycle = start_new_cycle_postion(); double new_x = get_new_coord(get_x(), FALSE); double new_y = get_new_coord(get_y(), FALSE); double new_z = get_z(); double new_diff_noise_factor = 0.9 + (rnd()*0.2); double new_dir = rnd() * 2 * PI; double new_motility = (0.5 + (rnd() * 0.5)) * get_new_motility(get_type(), calcium_level); last_agent_id ++; /* generate a new ID*/ if (can_stratify(get_type(), calcium_level) && get_num_xy_bonds() >= MAX_NUM_LATERAL_BONDS) { new_z = get_new_coord(get_z(), TRUE); } xmemory->cycle = start_new_cycle_postion(); init_char_array(&id_temp); copy_char_array(&ID_CHAR, &id_temp); add_char(&id_temp, '.'); sprintf(buffer, "%d", SPLITS); add_char(&id_temp, buffer[0]); printf("new cell: %s\n", id_temp.array); add_keratinocyte_agent( /*get_id()+1,*/ ID, &id_temp, /*last_agent_id, id*/ 0, /* splits*/ get_type(), /* type*/ new_x, /* x*/ new_y, /* y*/ new_z, /* z*/ 0, /* force_x*/ 0, /* force_y*/ 0, /* force_z*/ 0, /* num_xy_bonds*/ 0, /* num_z_bonds*/ 0, /* num_stem_bonds*/ new_cycle, /* cycle*/ new_diff_noise_factor, /* diff_noise_factor*/ 0, /* dead_ticks*/ 0, /* contact_inhibited_ticks*/ new_motility, /* motility*/ new_dir, /* dir*/ get_range() /* range */ ); xmemory->splits++; free_char_array(&id_temp); } return 0; }