testing/icgen/random_verschillende_resoluties_N-GenIC/gadget3_64/subfind_so.c
int subfind_overdensity_evaluate(int target, int mode, int *nexport, int *nsend_local)
{
  int startnode, listindex = 0;
  double h, mass, massret;
  MyDouble *pos;


  if(mode == 0)
    {
      pos = Group[target].Pos;
      h = R200[target];
    }
  else
    {
      pos = SOdensGet[target].Pos;
      h = SOdensGet[target].R200;
    }

  if(mode == 0)
    {
      startnode = All.MaxPart;	/* root node */
    }
  else
    {
      startnode = SOdensGet[target].NodeList[0];
      startnode = Nodes[startnode].u.d.nextnode;	/* open it */
    }

  mass = 0;

  while(startnode >= 0)
    {
      while(startnode >= 0)
	{
	  massret = subfind_ovderdens_treefind(pos, h, target, &startnode, mode, nexport, nsend_local);

	  if(massret < 0)
	    return -1;

	  mass += massret;
	}

      if(mode == 1)
	{
	  listindex++;
	  if(listindex < NODELISTLENGTH)
	    {
	      startnode = SOdensGet[target].NodeList[listindex];
	      if(startnode >= 0)
		startnode = Nodes[startnode].u.d.nextnode;	/* open it */
	    }
	}
    }

  if(mode == 0)
    M200[target] = mass;
  else
    SOdensResult[target].Mass = mass;

  return 0;
}
/*! This function represents the core of the SPH density computation. The
 *  target particle may either be local, or reside in the communication
 *  buffer.
 */
This function represents the core of the SPH density computation. The
target particle may either be local, or reside in the communication
buffer.
This function represents the core of the SPH density computation . The target particle may either be local or reside in the communication buffer .
int subfind_overdensity_evaluate(int target, int mode, int *nexport, int *nsend_local)
{
  int startnode, listindex = 0;
  double h, mass, massret;
  MyDouble *pos;
  if(mode == 0)
    {
      pos = Group[target].Pos;
      h = R200[target];
    }
  else
    {
      pos = SOdensGet[target].Pos;
      h = SOdensGet[target].R200;
    }
  if(mode == 0)
    {
      startnode = All.MaxPart;	
    }
  else
    {
      startnode = SOdensGet[target].NodeList[0];
      startnode = Nodes[startnode].u.d.nextnode;	
    }
  mass = 0;
  while(startnode >= 0)
    {
      while(startnode >= 0)
	{
	  massret = subfind_ovderdens_treefind(pos, h, target, &startnode, mode, nexport, nsend_local);
	  if(massret < 0)
	    return -1;
	  mass += massret;
	}
      if(mode == 1)
	{
	  listindex++;
	  if(listindex < NODELISTLENGTH)
	    {
	      startnode = SOdensGet[target].NodeList[listindex];
	      if(startnode >= 0)
		startnode = Nodes[startnode].u.d.nextnode;	
	    }
	}
    }
  if(mode == 0)
    M200[target] = mass;
  else
    SOdensResult[target].Mass = mass;
  return 0;
}
int subfind_overdensity_evaluate ( int target , int mode , int * nexport , int * nsend_local ) { int startnode , listindex = 0 ; double h , mass , massret ; MyDouble * pos ; if ( mode == 0 ) { pos = Group [ target ] . Pos ; h = R200 [ target ] ; } else { pos = SOdensGet [ target ] . Pos ; h = SOdensGet [ target ] . R200 ; } if ( mode == 0 ) { startnode = All . MaxPart ; } else { startnode = SOdensGet [ target ] . NodeList [ 0 ] ; startnode = Nodes [ startnode ] . u . d . nextnode ; } mass = 0 ; while ( startnode >= 0 ) { while ( startnode >= 0 ) { massret = subfind_ovderdens_treefind ( pos , h , target , & startnode , mode , nexport , nsend_local ) ; if ( massret < 0 ) return -1 ; mass += massret ; } if ( mode == 1 ) { listindex ++ ; if ( listindex < NODELISTLENGTH ) { startnode = SOdensGet [ target ] . NodeList [ listindex ] ; if ( startnode >= 0 ) startnode = Nodes [ startnode ] . u . d . nextnode ; } } } if ( mode == 0 ) M200 [ target ] = mass ; else SOdensResult [ target ] . Mass = mass ; return 0 ; }
This function represents the core of the SPH density computation.
This function represents the core of the SPH density computation .
/* root node */ /* open it */ /* open it */