Box(position_type const& position = position_type()) : position_(position), units_(array_gen( create_vector<position_type>(1., 0., 0.), create_vector<position_type>(0., 1., 0.), create_vector<position_type>(0., 0., 1.))), half_extent_(array_gen<length_type>(0.5, 0.5, 0.5)) {}
Plane(position_type const& position, position_type const& vx, position_type const& vy, length_type const& half_lx, length_type const& half_ly) : position_(position), units_(array_gen(vx, vy, cross_product(vx, vy))), half_extent_(array_gen<length_type>(half_lx, half_ly)) {}
Box(position_type const& position, position_type const& vx, position_type const& vy, position_type const& vz, length_type const& half_lx, length_type const& half_ly, length_type const& half_lz) : position_(position), units_(array_gen(vx, vy, vz)), half_extent_(array_gen<length_type>(half_lx, half_ly, half_lz)) {}
Plane(position_type const& position, position_type const& vx, position_type const& vy, Tarray_ const& half_extent = array_gen<length_type>(0.5, 0.5)) : position_(position), units_(array_gen(vx, vy, cross_product(vx, vy))) { std::copy(boost::begin(half_extent), boost::end(half_extent), boost::begin(half_extent_)); }
Box(position_type const& position, position_type const& vx, position_type const& vy, position_type const& vz, Tarray_ const& half_extent = array_gen<length_type>(0.5, 0.5, 0.5)) : position_(position), units_(array_gen(vx, vy, vz)) { std::copy(boost::begin(half_extent), boost::end(half_extent), boost::begin(half_extent_)); }
Box(position_type const& position, Tarray_ const& half_extent) : position_(position), units_(array_gen( create_vector<position_type>(1., 0., 0.), create_vector<position_type>(0., 1., 0.), create_vector<position_type>(0., 0., 1.))) { std::copy(boost::begin(half_extent), boost::end(half_extent), boost::begin(half_extent_)); }
void do_benchmark(Real volume, std::size_t n, Traits::time_type t, Real dt_factor) { typedef Traits::world_type::species_id_type species_id; typedef Traits::world_type::particle_id_type particle_id; typedef Traits::world_type::species_type species; typedef Traits::world_type::length_type length_type; typedef Traits::world_type::particle_id_pair_generator particle_id_pair_generator; typedef Traits::network_rules_type::reaction_rule_type reaction_rule_type; typedef Traits::world_type::position_type position_type; SerialIDGenerator<species_id> sidgen; Traits::world_type::traits_type::rng_type rng; BasicNetworkRulesImpl nr; Traits::network_rules_type nrw(nr); length_type const world_size(std::pow(volume, 1. / 3.)); std::size_t const matrix_size( std::max(static_cast<std::size_t>(3u), static_cast<std::size_t>(std::pow(3. * n, 1. / 3.)))); Traits::world_type w(world_size, matrix_size); species A(sidgen(), 1e-12, 2.5e-9, "default"); w.add_species(A); boost::shared_ptr<Traits::world_type::structure_type> default_surface( new Traits::cuboidal_region_type("default", Traits::box_type( position_type(world_size / 2, world_size / 2, world_size / 2), array_gen(world_size / 2, world_size / 2, world_size / 2)))); w.add_structure(default_surface); std::vector<particle_id> A_particles; inject_particles(w, rng, A_particles, A.id(), n); std::cout << "T: " << t << std::endl; std::cout << "V: " << volume << std::endl; std::cout << "N: " << n << std::endl; std::cout << "world size: " << world_size << std::endl; std::cout << "matrix size: " << matrix_size << std::endl; { std::cout << "stir" << std::endl; BDSimulator<Traits> s(w, nrw, rng, dt_factor); std::cout << "dt: " << s.dt() << std::endl; Traits::time_type const stir_time(t * .1); while (s.step(stir_time)); } { std::cout << "run" << std::endl; BDSimulator<Traits> s(w, nrw, rng, dt_factor); boost::timer timer; while (s.step(t)); std::cout << "t: " << s.t() << "=" << t << std::endl; std::cout << "dt: " << s.dt() << std::endl; std::cout << "steps (total): " << s.num_steps() << std::endl; std::cout << "elapsed: " << timer.elapsed() << std::endl; std::cout << "steps per second: " << (static_cast<double>(s.num_steps()) / timer.elapsed()) << std::endl; std::cout << "steps/N: " << (static_cast<double>(s.num_steps()) / n) << std::endl; } }
virtual particle_id_pair_and_distance_list* check_overlap(particle_shape_type const& s, particle_id_type const& ignore1, particle_id_type const& ignore2) const { return check_overlap(s, array_gen(ignore1, ignore2)); }