/* UV sphere fill */
static void _uvsphere_fill (AranSolver3d *solver)
{
  gint i;
  PointAccum *point;
  VsgVector3d lb, ub;
  GRand *rand = g_rand_new_with_seed (_random_seed);
  gdouble r;

  aran_solver3d_get_bounds (solver, &lb, &ub);
  r = MIN (lb.x, ub.x);

  point = point_accum_alloc (TRUE, NULL);

  for (i=0; i< np; i++)
    {
      gdouble theta, phi;

      theta = g_rand_double_range (rand, 0.01 * G_PI, 0.99 * G_PI);
      phi = g_rand_double_range (rand, 0., 2.*G_PI);

      vsg_vector3d_from_spherical (&point->vector, r, theta, phi);
      point->density = 1.;
      point->field = VSG_V3D_ZERO;
      point->id = i;

      if (check) memcpy (&check_points[i], point, sizeof (PointAccum));

      if (aran_solver3d_insert_point_local (solver, point))
        {
          if (i % 10000 == 0 && _verbose)
            g_printerr ("%d: insert %dth point\n", rk, i);

          point = point_accum_alloc (TRUE, NULL);
        }

#ifdef VSG_HAVE_MPI
      if (i%(_flush_interval*10) == 0)
        {
          if (_verbose && rk == 0)
            g_printerr ("%d: contiguous dist before %dth point\n", rk, i);
          aran_solver3d_distribute_contiguous_leaves (solver);

          _flush_interval *=2;
        }
#endif /* VSG_HAVE_MPI */
    }

  point_accum_destroy (point, TRUE, NULL);

#ifdef VSG_HAVE_MPI
  aran_solver3d_distribute_contiguous_leaves (solver);
#endif /* VSG_HAVE_MPI */

  g_rand_free (rand);
}
void check_parallel_points (AranSolver3d *solver)
{
  VsgVector3d lbound;
  VsgVector3d ubound;
  VsgPRTree3d *prtree;
  AranSolver3d *solver2;
  int i;

  aran_solver3d_get_bounds (solver, &lbound, &ubound);

  prtree =
    vsg_prtree3d_new_full (&lbound, &ubound,
                            (VsgPoint3dLocFunc) vsg_vector3d_vector3d_locfunc,
                            (VsgPoint3dDistFunc) vsg_vector3d_dist,
                            (VsgRegion3dLocFunc) NULL, maxbox);

  solver2 = aran_solver3d_new (prtree, ARAN_TYPE_DEVELOPMENT3D,
                              aran_development3d_new (0, order),
                              (AranZeroFunc) aran_development3d_set_zero);

  aran_solver3d_set_functions (solver2,
                               (AranParticle2ParticleFunc3d) p2p,
                               (AranParticle2MultipoleFunc3d) p2m,
                               m2m,
                               m2l,
                               l2l,
                               (AranLocal2ParticleFunc3d) l2p);

  if (_hilbert)
    {
      /* configure for hilbert curve order traversal */
      aran_solver3d_set_children_order_hilbert (solver2);
    }

  for (i=0; i<np; i++)
    {
      aran_solver3d_insert_point (solver2, &check_points[i]);
    }

  aran_solver3d_solve (solver2);

  aran_solver3d_free (solver2);
}
Пример #3
0
static void aran_solver3d_write_fma (AranSolver3d *solver, FILE *file)
{
  guint64 np;
  VsgVector3d center, lb, ub;
  gdouble box_size;

  aran_solver3d_get_bounds (solver, &lb, &ub);

  vsg_vector3d_lerp (&lb, &ub, 0.5, &center);

  box_size = ub.x - center.x;
  box_size = MAX (box_size, ub.y - center.y);
  box_size = MAX (box_size, ub.z - center.z);

  np = aran_solver3d_point_count (solver);

  fprintf (file, "%lu %g %g %g %g\n", np, box_size, center.x, center.y, center.z);

  aran_solver3d_foreach_point (solver, (GFunc) _fma_save_point, file);

}
Пример #4
0
void check_parallel_points (AranSolver3d *solver)
{
  VsgVector3d lbound;
  VsgVector3d ubound;
  VsgPRTree3d *prtree;
  AranSolver3d *solver2;
  guint64 i;

  aran_solver3d_get_bounds (solver, &lbound, &ubound);

  prtree =
    vsg_prtree3d_new_full (&lbound, &ubound,
                            (VsgPoint3dLocFunc) vsg_vector3d_vector3d_locfunc,
                            (VsgPoint3dDistFunc) vsg_vector3d_dist,
                            (VsgRegion3dLocFunc) NULL, maxbox);

  solver2 = aran_solver3d_new (prtree, ARAN_TYPE_DEVELOPMENT3D,
                              aran_development3d_new (0, order),
                              (AranZeroFunc) aran_development3d_set_zero);

  aran_solver3d_set_functions (solver2,
                               (AranParticle2ParticleFunc3d) p2p,
                               (AranParticle2MultipoleFunc3d) p2m,
                               m2m,
                               m2l,
                               l2l,
                               (AranLocal2ParticleFunc3d) l2p);


  if (semifar_threshold < G_MAXUINT)
    {
      /* if optimal threshold was requested, we need to compare with the same value */
      if (semifar_threshold == 0)
        aran_solver3d_get_functions_full (solver, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                          &semifar_threshold);

      aran_solver3d_set_functions_full (solver2,
                                        (AranParticle2ParticleFunc3d) p2p,
                                        (AranParticle2MultipoleFunc3d) p2m,
                                        m2m,
                                        m2l,
                                        l2l,
                                        (AranLocal2ParticleFunc3d) l2p,
                                        (AranParticle2LocalFunc3d) p2l,
                                        (AranMultipole2ParticleFunc3d) m2p,
                                        semifar_threshold);
    }

  if (_hilbert)
    {
      /* configure for hilbert curve order traversal */
      aran_solver3d_set_children_order_hilbert (solver2);
    }

  for (i=0; i<np; i++)
    {
      aran_solver3d_insert_point (solver2, &check_points[i]);
    }

  aran_solver3d_solve (solver2);

  aran_solver3d_free (solver2);
}