/* This file is part of the Neper software package. */
/* Copyright (C) 2003-2014, Romain Quey. */
/* See the COPYING file in the top-level directory. */

#include"net_seed_neigh_.h"

void
net_seed_neigh (struct IN In, struct SEEDSET *pSeedSet)
{
  if (!strcmp (In.ttype, "standard"))
  {
    (*pSeedSet).nSize = ut_alloc_2d (3, 2);
    ut_array_2d_memcpy ((*pSeedSet).nSize, 3, 2, (*pSeedSet).Size);
    (*pSeedSet).nVol = 0;
    (*pSeedSet).nN = 0;
    (*pSeedSet).nSeedCoo = NULL;

    (*pSeedSet).nSeedRandId = NULL;
  }
  else if (!strcmp (In.ttype, "periodic"))
  {
    SeedSetSize (pSeedSet);
    SeedSetSeedsPer (pSeedSet);
  }
  else if (!strcmp (In.ttype, "subdomain"))
  {
    if ((*pSeedSet).N != 0)
    {
      SeedSetSize (pSeedSet);
      SeedSetSeedsSD (pSeedSet);
    }
    else
      SeedSet4EmpD (pSeedSet);
  }
  else
    ut_error_reportbug ();

  return;
}

void
net_n1d_morpho_n (int n1d, char *morpho, int *pn)
{
  if (strcmp (morpho, "cube") == 0)
    (*pn) = n1d * n1d * n1d;
  else if (strcmp (morpho, "tocta") == 0)
    (*pn) = (n1d - 1) * (n1d - 1) * (n1d - 1) + n1d * n1d * n1d;

  return;
}
