static void _random_distribution (GPtrArray *points, AranSolver2d *solver) { guint i; PointAccum *point; GRand *rand = g_rand_new_with_seed (_random_seed); for (i=0; i<np; i++) { PointAccum tmp; #ifdef VSG_HAVE_MPI if (i%_flush_interval == 0) { aran_solver2d_migrate_flush (solver); if (i%(_flush_interval*10) == 0) { if (_verbose && rk == 0) g_printerr ("%d: contiguous dist before %dth point\n", rk, i); aran_solver2d_distribute_contiguous_leaves (solver); } } #endif /* VSG_HAVE_MPI */ tmp.vector.x = g_rand_double_range (rand, -R, R);; tmp.vector.y = g_rand_double_range (rand, -R, R);; tmp.density = 1.; tmp.accum = 0.; tmp.id = i; if (check) memcpy (&check_points[i], &tmp, sizeof (PointAccum)); if (i%sz != rk) continue; if (i % 10000 == 0 && _verbose) g_printerr ("%d: insert %dth point\n", rk, i); point = point_accum_alloc (TRUE, NULL); memcpy (point, &tmp, sizeof (PointAccum)); aran_solver2d_insert_point (solver, point); } #ifdef VSG_HAVE_MPI aran_solver2d_migrate_flush (solver); aran_solver2d_distribute_contiguous_leaves (solver); #endif /* VSG_HAVE_MPI */ g_rand_free (rand); }
static void _one_circle_distribution (GPtrArray *points, AranSolver2d *solver) { gint i; PointAccum *point; gdouble dtheta = 2. * G_PI / (np); gdouble theta0 = 0.; for (i=0; i<np; i++) { PointAccum tmp; #ifdef VSG_HAVE_MPI if (i%_flush_interval == 0) { aran_solver2d_migrate_flush (solver); if (i%(_flush_interval*10) == 0) { if (_verbose && rk == 0) g_printerr ("%d: contiguous dist before %dth point\n", rk, i); aran_solver2d_distribute_contiguous_leaves (solver); } } #endif /* VSG_HAVE_MPI */ tmp.vector.x = R * cos (theta0 + i * dtheta); tmp.vector.y = R * sin (theta0 + i * dtheta); tmp.density = 1.; tmp.accum = 0.; tmp.id = i; if (check) memcpy (&check_points[i], &tmp, sizeof (PointAccum)); if (i%sz != rk) continue; if (i % 10000 == 0 && _verbose) g_printerr ("%d: insert %dth point\n", rk, i); point = point_accum_alloc (TRUE, NULL); memcpy (point, &tmp, sizeof (PointAccum)); aran_solver2d_insert_point (solver, point); } #ifdef VSG_HAVE_MPI aran_solver2d_migrate_flush (solver); aran_solver2d_distribute_contiguous_leaves (solver); #endif /* VSG_HAVE_MPI */ }
static void _one_circle_distribution (PointAccum **points, AranSolver2d *solver) { guint i; for (i=0; i<np; i++) { PointAccum *point = g_malloc0 (sizeof (PointAccum)); point->vector.x = R * cos(2.*G_PI*i/N); point->vector.y = R * sin(2.*G_PI*i/N); point->density = 1.; point->accum = 0.; point->id = i; points[i] = point; aran_solver2d_insert_point (solver, point); } }
static void _random_distribution (PointAccum **points, AranSolver2d *solver) { guint i; for (i=0; i<np; i++) { PointAccum *point = g_malloc0 (sizeof (PointAccum)); point->vector.x = g_random_double_range (-R,R); point->vector.y = g_random_double_range (-R,R); point->density = 1.; point->accum = 0.; point->id = i; points[i] = point; aran_solver2d_insert_point (solver, point); } }
void check_parallel_points (AranSolver2d *tocheck) { VsgVector2d lbound = {-1., -1.}; VsgVector2d ubound = {1., 1.}; VsgPRTree2d *prtree; AranSolver2d *solver; int i; prtree = vsg_prtree2d_new_full (&lbound, &ubound, (VsgPoint2dLocFunc) vsg_vector2d_vector2d_locfunc, (VsgPoint2dDistFunc) vsg_vector2d_dist, (VsgRegion2dLocFunc) NULL, maxbox); aran_binomial_require (2*order); solver = aran_solver2d_new (prtree, ARAN_TYPE_DEVELOPMENT2D, aran_development2d_new (0, order), (AranZeroFunc) aran_development2d_set_zero); aran_solver2d_set_functions (solver, (AranParticle2ParticleFunc2d) p2p, (AranParticle2MultipoleFunc2d) p2m, (AranMultipole2MultipoleFunc2d) aran_development2d_m2m, (AranMultipole2LocalFunc2d) aran_development2d_m2l, (AranLocal2LocalFunc2d) aran_development2d_l2l, (AranLocal2ParticleFunc2d)l2p); if (semifar_threshold < G_MAXUINT) { /* if optimal threshold was requested, we need to compare with the same value */ if (semifar_threshold == 0) aran_solver2d_get_functions_full (tocheck, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &semifar_threshold); aran_solver2d_set_functions_full (solver, (AranParticle2ParticleFunc2d) p2p, (AranParticle2MultipoleFunc2d) p2m, (AranMultipole2MultipoleFunc2d) aran_development2d_m2m, (AranMultipole2LocalFunc2d) aran_development2d_m2l, (AranLocal2LocalFunc2d) aran_development2d_l2l, (AranLocal2ParticleFunc2d) l2p, (AranParticle2LocalFunc2d) p2l, (AranMultipole2ParticleFunc2d) m2p, semifar_threshold); } if (_hilbert) { /* configure for hilbert curve order traversal */ aran_solver2d_set_children_order_hilbert (solver); } for (i=0; i<np; i++) { aran_solver2d_insert_point (solver, &check_points[i]); } aran_solver2d_solve (solver); aran_solver2d_free (solver); }