コード例 #1
0
ファイル: SubDomain.cpp プロジェクト: DonnieNewell/hulkdeer
/* returns the linear index for neighbor specified by NeighborTag */
int SubDomain::getNeighborIndex(const NeighborTag3D tag) {
  /* only a valid neighbor will be positive */
  int neighbor = -1;
  if (x3DPole0 > tag)
    neighbor = getNeighborFace(tag);
  else if (x3DFace5 < tag && x3DCorner0 > tag)
    neighbor = getNeighborPole(tag);
  else if (x3DPole11 < tag)
    neighbor = getNeighborCorner(tag);

  return neighbor;
}
コード例 #2
0
ファイル: suffrage.cpp プロジェクト: seato/suffrage
/*
 * Summary:     Swiftly looks to see what IXM's have given an incorrect answer and
 *              updates the tables accordingly.
 * Parameters:  None.
 * Return:      None.
 */
void
strikeCheck()
{
  u32 face;

  for (u32 i = 0; i < NODE_COUNT; ++i)
    {
      if (VOTE_NODE_ARR[i] != MAJORITY_RSLT)
        ++STRIKES_NODE_ARR[i];
      else
        STRIKES_NODE_ARR[i] = 0;

      face = getNeighborFace(ID_NODE_ARR[i]);

      if ((STRIKES_NODE_ARR[i] > 2) && (INVALID != face))
        {
          powerOut(face, 0);
          REBOOT_ARR[face] = 1;

          Alarms.set(Alarms.create(reboot), millis() + reboot_PERIOD); // Set a reboot
          return;
        }
    }
}