void interpolator::create(std::string const& datafilename, std::string const& symbolic_name_base, std::size_t num_instances) { // Get the component type of the partition backend. hpx::components::component_type type = hpx::components::get_component_type<server::partition3d>(); typedef hpx::components::distributing_factory distributing_factory; // Create distributing factory and let it create num_instances // objects. distributing_factory factory = distributing_factory::create(hpx::find_here()); // Asynchronously create the components. They will be distributed // fairly across all available localities. distributing_factory::async_create_result_type result = factory.create_components_async(type, num_instances); // Initialize the partitions and store the mappings. partitions_.reserve(num_instances); fill_partitions(datafilename, symbolic_name_base, std::move(result)); was_created_ = true; }
// create one partition on each of the localities, initialize the partitions interpolate1d::interpolate1d(std::string datafilename, std::size_t num_instances) : num_elements_(0), minval_(0), delta_(0) { // we want to create 'partition' instances hpx::future<std::vector<partition> > result = hpx::new_<partition[]>( hpx::default_layout(hpx::find_all_localities()), num_instances); // initialize the partitions and store the mappings fill_partitions(datafilename, std::move(result)); }
// create one partition on each of the localities, initialize the partitions interpolate1d::interpolate1d(std::string datafilename, std::size_t num_instances) : num_elements_(0), minval_(0), delta_(0) { // we want to create 'partition' instances hpx::components::component_type type = hpx::components::get_component_type<server::partition>(); // create distributing factory and let it create the required amount // of 'partition' objects typedef hpx::components::distributing_factory distributing_factory; distributing_factory factory( distributing_factory::create_sync(hpx::find_here())); distributing_factory::async_create_result_type result = factory.create_components_async(type, num_instances); // initialize the partitions and store the mappings partitions_.reserve(num_instances); fill_partitions(datafilename, result); }