void TestGarysWntOdeSystemApc2Hit() { #ifdef CHASTE_CVODE double wnt_level = 0.5; boost::shared_ptr<AbstractCellMutationState> p_apc2(new ApcTwoHitCellMutationState); Mirams2010WntOdeSystem wnt_system(wnt_level, p_apc2); // Solve system using CVODE solver // Matlab's strictest bit uses 0.01 below and relaxes it on flatter bits double h_value = 0.01; CvodeAdaptor cvode_solver; OdeSolution solutions; std::vector<double> initial_conditions = wnt_system.GetInitialConditions(); Timer::Reset(); solutions = cvode_solver.Solve(&wnt_system, initial_conditions, 0.0, 100.0, h_value, h_value); Timer::Print("1. Cvode"); // Test solutions are OK for a small time increase int end = solutions.rGetSolutions().size() - 1; // Test the simulation is ending at the right time (going into S phase at 7.8 hours) TS_ASSERT_DELTA(solutions.rGetTimes()[end], 100, 1e-2); // Check results are correct TS_ASSERT_DELTA(solutions.rGetSolutions()[end][0], 433.114, 2e-3); // Tolerances relaxed for TS_ASSERT_DELTA(solutions.rGetSolutions()[end][1], 433.114, 2e-3); // different CVODE versions. TS_ASSERT_DELTA(solutions.rGetSolutions()[end][2], wnt_level, 1e-4); #else std::cout << "CVODE is not enabled. " << std::endl; std::cout << "If required please install and alter your hostconfig settings to switch on chaste support." << std::endl; #endif //CHASTE_CVODE }
void TestMirams2010WntOdeSystemSetup() { #ifdef CHASTE_CVODE double wnt_level = 0.5; boost::shared_ptr<AbstractCellMutationState> p_state(new WildTypeCellMutationState); Mirams2010WntOdeSystem wnt_system(wnt_level, p_state); // Solve system using CVODE solver // Matlab's strictest bit uses 0.01 below and relaxes it on flatter bits. double h_value = 0.1; CvodeAdaptor cvode_solver; OdeSolution solutions; //OdeSolution solutions2; std::vector<double> initial_conditions = wnt_system.GetInitialConditions(); std::cout << "Timings for 100 hours\n"; Timer::Reset(); solutions = cvode_solver.Solve(&wnt_system, initial_conditions, 0.0, 100.0, h_value, h_value); Timer::Print("1. Cvode"); // Test solutions are OK for a small time increase... int end = solutions.rGetSolutions().size() - 1; // Tests the simulation is ending at the right time...(going into S phase at 7.8 hours) TS_ASSERT_DELTA(solutions.rGetTimes()[end], 100, 1e-2); // Decent results TS_ASSERT_DELTA(solutions.rGetSolutions()[end][0], 67.5011, 1e-4); TS_ASSERT_DELTA(solutions.rGetSolutions()[end][1], 67.5011, 1e-4); TS_ASSERT_DELTA(solutions.rGetSolutions()[end][2], wnt_level, 1e-4); #else std::cout << "CVODE is not enabled. " << std::endl; std::cout << "If required please install and alter your hostconfig settings to switch on chaste support." << std::endl; #endif //CHASTE_CVODE }
void TestGarysWntOdeSystemBetaCatenin1Hit() throw(Exception) { #ifdef CHASTE_CVODE double wnt_level = 0.5; boost::shared_ptr<AbstractCellMutationState> p_bcat1(new BetaCateninOneHitCellMutationState); Mirams2010WntOdeSystem wnt_system(wnt_level, p_bcat1); // Solve system using CVODE solver // Matlab's strictest bit uses 0.01 below and relaxes it on flatter bits double h_value = 0.1; CvodeAdaptor cvode_solver; OdeSolution solutions; std::vector<double> initial_conditions = wnt_system.GetInitialConditions(); double start_time, end_time, elapsed_time = 0.0; start_time = (double) std::clock(); solutions = cvode_solver.Solve(&wnt_system, initial_conditions, 0.0, 100.0, h_value, h_value); end_time = (double) std::clock(); elapsed_time = (end_time - start_time)/(CLOCKS_PER_SEC); std::cout << "1. Cvode Elapsed time = " << elapsed_time << " secs for 100 hours\n"; // Test solutions are OK for a small time increase int end = solutions.rGetSolutions().size() - 1; // Tests the simulation is ending at the right time (going into S phase at 7.8 hours) TS_ASSERT_DELTA(solutions.rGetTimes()[end], 100, 1e-2); // Check results are correct TS_ASSERT_DELTA(solutions.rGetSolutions()[end][0], 67.5011, 1e-4); TS_ASSERT_DELTA(solutions.rGetSolutions()[end][1], 824.0259, 1e-4); TS_ASSERT_DELTA(solutions.rGetSolutions()[end][2], wnt_level, 1e-4); #else std::cout << "CVODE is not enabled. " << std::endl; std::cout << "If required please install and alter your hostconfig settings to switch on chaste support." << std::endl; #endif //CHASTE_CVODE }