void aran_solver3d_distribute_contiguous_leaves (AranSolver3d *solver) { g_return_if_fail (solver != NULL); vsg_prtree3d_distribute_contiguous_leaves (solver->prtree); }
gint main (gint argc, gchar ** argv) { gint ret = 0; VsgPRTree3d *tree; VsgVector3d lb; VsgVector3d ub; MPI_Init (&argc, &argv); MPI_Comm_size (MPI_COMM_WORLD, &sz); MPI_Comm_rank (MPI_COMM_WORLD, &rk); vsg_init_gdouble (); parse_args (argc, argv); points = g_ptr_array_new (); regions = g_ptr_array_new (); lb.x = -1.; lb.y = -1.; lb.z = -1.; ub.x = 1.; ub.y = 1.; ub.z = 1.; /* create the tree */ tree = vsg_prtree3d_new_full (&lb, &ub, (VsgPoint3dLocFunc) vsg_vector3d_vector3d_locfunc, (VsgPoint3dDistFunc) vsg_vector3d_dist, (VsgRegion3dLocFunc) _sphere_loc3, 2); if (_hilbert) { /* configure for hilbert curve order traversal */ vsg_prtree3d_set_children_order_hilbert (tree); } if (_verbose) { MPI_Barrier (MPI_COMM_WORLD); g_printerr ("%d: set_parallel begin\n", rk); } vsg_prtree3d_set_parallel (tree, &pconfig); if (_verbose) { MPI_Barrier (MPI_COMM_WORLD); g_printerr ("%d: set_parallel ok\n", rk); } if (_verbose) { MPI_Barrier (MPI_COMM_WORLD); g_printerr ("%d: fill begin\n", rk); } _fill (tree, _np); _check_local_counts (tree); if (_verbose) { MPI_Barrier (MPI_COMM_WORLD); g_printerr ("%d: fill ok\n", rk); } /* update total points and regions count */ init_total_points_count (); init_total_regions_count (); if (_scatter_before) { if (_verbose) { MPI_Barrier (MPI_COMM_WORLD); g_printerr ("%d: scatter nodes begin\n", rk); } vsg_prtree3d_distribute_scatter_leaves (tree); _check_local_counts (tree); ret += check_points_number (tree); ret += check_regions_number (tree); if (_verbose) { MPI_Barrier (MPI_COMM_WORLD); g_printerr ("%d: scatter nodes ok\n", rk); } _write_regions (tree, "rg-scatter"); _tree_write (tree, "scatter-"); } if (_do_contiguous) { if (_verbose) { MPI_Barrier (MPI_COMM_WORLD); g_printerr ("%d: contiguous distribute begin\n", rk); } vsg_prtree3d_distribute_contiguous_leaves (tree); _check_local_counts (tree); ret += check_points_number (tree); ret += check_regions_number (tree); if (_verbose) { MPI_Barrier (MPI_COMM_WORLD); g_printerr ("%d: contiguous distribute ok\n", rk); } _write_regions (tree, "rg-contiguous"); } _exterior_points (tree); vsg_prtree3d_distribute_contiguous_leaves (tree); _check_local_counts (tree); if (_do_write) { MPI_Barrier (MPI_COMM_WORLD); _tree_write (tree, "prtree3parallel-"); } if (_do_write) { gchar fn[1024]; FILE *f; g_sprintf (fn, "prtree3parallel-%03d.txt", rk); f = fopen (fn, "w"); vsg_prtree3d_write (tree, f); fclose (f); } /* destroy the points */ g_ptr_array_foreach (points, empty_array, NULL); g_ptr_array_free (points, TRUE); /* destroy the spheres */ g_ptr_array_foreach (regions, empty_array, NULL); g_ptr_array_free (regions, TRUE); /* destroy the tree */ vsg_prtree3d_free (tree); MPI_Finalize (); return ret; }