コード例 #1
0
ファイル: -extras.c プロジェクト: BackupTheBerlios/vsg-svn
static void recursive_near_func (VsgPRTree2@t@Node *one,
                                 VsgPRTree2@t@NodeInfo *one_info,
                                 VsgPRTree2@t@Node *other,
                                 VsgPRTree2@t@NodeInfo *other_info,
                                 VsgPRTree2@t@InteractionFunc near_func,
                                 gpointer user_data)
{
  vsgloc2 i;

  if (PRTREE2@T@NODE_ISINT (one))
    {
      for (i=0; i<4; i++)
        {
          VsgPRTree2@t@Node *one_child = PRTREE2@T@NODE_CHILD(one, i);
          VsgPRTree2@t@NodeInfo one_child_info;

#ifdef VSG_HAVE_MPI
          if (PRTREE2@T@NODE_IS_REMOTE (one_child)) continue;
#endif

          _vsg_prtree2@t@node_get_info (one_child, &one_child_info, one_info,
                                        i);

          recursive_near_func (one_child, &one_child_info, other, other_info,
                               near_func, user_data);
        }
    }
  else if (PRTREE2@T@NODE_ISINT (other))
    {
      for (i=0; i<4; i++)
        {
          VsgPRTree2@t@Node *other_child = PRTREE2@T@NODE_CHILD(other, i);
          VsgPRTree2@t@NodeInfo other_child_info;

#ifdef VSG_HAVE_MPI
          if (PRTREE2@T@NODE_IS_REMOTE (other_child)) continue;
#endif

          _vsg_prtree2@t@node_get_info (other_child, &other_child_info,
                                        other_info, i);

          recursive_near_func (one, one_info, other_child, &other_child_info,
                               near_func, user_data);
        }
    }
  else
    {
      /* near interaction between one and other */
      if (one->point_count != 0 && other->point_count != 0)
        near_func (one_info, other_info, user_data);
    }


}
コード例 #2
0
ファイル: -extras.c プロジェクト: BackupTheBerlios/vsg-svn
static void
vsg_prtree2@t@node_near_far_traversal (VsgPRTree2@t@ *tree,
                                       VsgNFConfig2@t@ *nfc,
                                       VsgPRTree2@t@Node *node,
                                       VsgPRTree2@t@NodeInfo *father_info,
                                       vsgloc2 child_number,
                                       gboolean parallel_check)
{
  vsgloc2 i,j;
  VsgPRTree2@t@NodeInfo node_info;

#ifdef VSG_HAVE_MPI
  if (PRTREE2@T@NODE_IS_REMOTE (node)) return;
#endif
  if (_NODE_IS_EMPTY (node)) return;

  _vsg_prtree2@t@node_get_info (node, &node_info, father_info, child_number);

#ifdef VSG_HAVE_MPI
  /* check for remote processors to send this node, if needed */
  parallel_check = vsg_prtree2@t@_node_check_parallel_near_far (tree, nfc,
                                                                node,
                                                                &node_info,
                                                                parallel_check);
#endif

  if (PRTREE2@T@NODE_ISLEAF (node))
    {
      if (nfc->near_func)
        {
          /* reflexive near interaction on node */
          nfc->near_func (&node_info, &node_info, nfc->user_data);
        }
    }
  else
    {
      /* interactions between node's children */
      for (i=0; i<4; i++)
        {
          VsgPRTree2@t@Node *one_child = PRTREE2@T@NODE_CHILD(node, i);
          VsgPRTree2@t@NodeInfo one_child_info;

#ifdef VSG_HAVE_MPI
          if (PRTREE2@T@NODE_IS_REMOTE (one_child)) continue;
#endif

          _vsg_prtree2@t@node_get_info (one_child, &one_child_info,
                                        &node_info, i);
          for (j=i+1; j<4; j++)
            {
              VsgPRTree2@t@Node *other_child =
                PRTREE2@T@NODE_CHILD(node, j);
              VsgPRTree2@t@NodeInfo other_child_info;
              gint8 x, y;

#ifdef VSG_HAVE_MPI
              if (PRTREE2@T@NODE_IS_REMOTE (other_child)) continue;
#endif

              x = _AXIS_DIFF (i, j, _X);
              y = _AXIS_DIFF (i, j, _Y);

              _vsg_prtree2@t@node_get_info (other_child,
                                            &other_child_info,
                                            &node_info, j);

              _sub_neighborhood_near_far_traversal (tree, nfc, one_child,
                                                    &one_child_info,
                                                    other_child,
                                                    &other_child_info,
                                                    x, y); 
            }
        }

      /* interactions in node's children descendants */
      for (i=0; i<4; i++)
        vsg_prtree2@t@node_near_far_traversal (tree, nfc,
                                               PRTREE2@T@NODE_CHILD(node, i),
                                               &node_info, i, parallel_check);
    }
}
コード例 #3
0
ファイル: -extras.c プロジェクト: BackupTheBerlios/vsg-svn
static void
_sub_neighborhood_near_far_traversal (VsgPRTree2@t@ *tree,
                                      VsgNFConfig2@t@ *nfc,
                                      VsgPRTree2@t@Node *one,
                                      VsgPRTree2@t@NodeInfo *one_info,
                                      VsgPRTree2@t@Node *other,
                                      VsgPRTree2@t@NodeInfo *other_info,
                                      gint8 x, gint8 y)
{
  vsgloc2 i, j, si, sj;
  vsgloc2 sym[4] = {
    _SYMMETRY (0, x, y),
    _SYMMETRY (1, x, y),
    _SYMMETRY (2, x, y),
    _SYMMETRY (3, x, y),
  };

  if (_NODE_IS_EMPTY(one) || _NODE_IS_EMPTY(other))
    return;

#ifdef VSG_HAVE_MPI
  if (nfc->sz > 1)
    vsg_prtree2@t@_nf_check_receive (tree, nfc, MPI_ANY_TAG, FALSE);
#endif

  if (PRTREE2@T@NODE_ISINT (one) && PRTREE2@T@NODE_ISINT (other))
    {
      /* near/far interaction between one and other children */

      for (i=0; i<4; i++)
        {
          VsgPRTree2@t@Node *one_child = PRTREE2@T@NODE_CHILD(one, i);
          VsgPRTree2@t@NodeInfo one_child_info;

#ifdef VSG_HAVE_MPI
          if (PRTREE2@T@NODE_IS_REMOTE (one_child)) continue;
#endif

          _vsg_prtree2@t@node_get_info (one_child, &one_child_info,
                                        one_info, i);

          si = sym[i];

          for (j=0; j<4; j++)
            {
              gboolean far;
              VsgPRTree2@t@Node *other_child =
                PRTREE2@T@NODE_CHILD(other, j);
              VsgPRTree2@t@NodeInfo other_child_info;
              gboolean far_done = TRUE;

#ifdef VSG_HAVE_MPI
              if (PRTREE2@T@NODE_IS_REMOTE (other_child)) continue;
#endif

              _vsg_prtree2@t@node_get_info (other_child,
                                            &other_child_info,
                                            other_info, j);

              sj = sym[j];

              far = NEAR_FAR (x, y, si, sj);

              if (far)
                {
                  /* far interaction between one and other */
                  if (nfc->far_func &&
                      ! (_NODE_IS_EMPTY (one_child) ||
                         _NODE_IS_EMPTY (other_child)))
                    {
#ifdef VSG_HAVE_MPI
                      /* in parallel, only one of the processors has to do a
                         shared/shared far interaction */
                      if (PRTREE2@T@NODE_IS_SHARED (one_child) &&
                          PRTREE2@T@NODE_IS_SHARED (other_child) &&
                          PRTREE2@T@NODE_PROC (one_child) != nfc->rk)
                        continue;
#endif

                      far_done = nfc->far_func (&one_child_info, &other_child_info,
                                                nfc->user_data);
                      if (!far_done)
                        {
#ifdef VSG_HAVE_MPI
                          if (PRTREE2@T@NODE_IS_SHARED (one_child) ||
                              PRTREE2@T@NODE_IS_SHARED (other_child))
                            {
                              g_critical ("far_func() -> FALSE not handled " \
                                          "for shared nodes in \"%s\"",
                                          __PRETTY_FUNCTION__);

                            }
#endif

                          /* near interaction between one and other */
                          recursive_near_func (one_child, &one_child_info,
                                               other_child, &other_child_info,
                                               nfc->near_func,
                                               nfc->user_data);
                        }
                    }
                }
              else
                {
                  gint8 newx = _SUB_INTERACTION (i, j, x, _X);
                  gint8 newy = _SUB_INTERACTION (i, j, y, _Y);

                  _sub_neighborhood_near_far_traversal (tree, nfc, one_child,
                                                        &one_child_info,
                                                        other_child,
                                                        &other_child_info,
                                                        newx, newy);
                }
            }
        }

    }
  else
    {
      if (nfc->near_func)
        {
          /* near interaction between one and other */
          recursive_near_func (one, one_info, other, other_info, nfc->near_func,
                               nfc->user_data);
        }
    }
}
コード例 #4
0
ファイル: -extras.c プロジェクト: rorypeck/vsg
static void recursive_near_func (VsgPRTree2@t@Node *one,
                                 VsgPRTree2@t@NodeInfo *one_info,
                                 VsgPRTree2@t@Node *other,
                                 VsgPRTree2@t@NodeInfo *other_info,
                                 VsgNFConfig2@t@ *nfc)
{
  vsgloc2 i;

#ifdef VSG_HAVE_MPI
  if (nfc->sz > 1)
    vsg_prtree2@t@_nf_check_receive (nfc, MPI_ANY_TAG, FALSE);
#endif

  /* try to execute semifar function instead of near_func, if possible */
  if (_check_and_execute_semifar_func (nfc, one_info, other_info))
    return;

  if (PRTREE2@T@NODE_ISINT (one))
    {
      for (i=0; i<CN; i++)
        {
          VsgPRTree2@t@Node *one_child = PRTREE2@T@NODE_CHILD(one, i);
          VsgPRTree2@t@NodeInfo one_child_info;

#ifdef VSG_HAVE_MPI
          if (PRTREE2@T@NODE_IS_REMOTE (one_child)) continue;
#endif

          _vsg_prtree2@t@node_get_info (one_child, &one_child_info, one_info,
                                        i);

          recursive_near_func (one_child, &one_child_info, other, other_info,
                               nfc);
        }
    }
  else if (PRTREE2@T@NODE_ISINT (other))
    {
      for (i=0; i<CN; i++)
        {
          VsgPRTree2@t@Node *other_child = PRTREE2@T@NODE_CHILD(other, i);
          VsgPRTree2@t@NodeInfo other_child_info;

#ifdef VSG_HAVE_MPI
          if (PRTREE2@T@NODE_IS_REMOTE (other_child)) continue;
#endif

          _vsg_prtree2@t@node_get_info (other_child, &other_child_info,
                                        other_info, i);

          recursive_near_func (one, one_info, other_child, &other_child_info,
                               nfc);
        }
    }
  else
    {
      /* near interaction between one and other */
      if (one->point_count != 0 && other->point_count != 0)
        nfc->near_func (one_info, other_info, nfc->user_data);
    }


}
コード例 #5
0
ファイル: ui2c.c プロジェクト: Haxe/gtk-gnutella
gnet_node_info_t *
guc_node_get_info(const struct nid *node_id)
{
    return node_get_info(node_id);
}