/* 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_custom_.h"

void
net_seed_custom (char *filename, int dim,
                 struct TESS Dom, struct SEEDSET *pGSet)
{
  int i;
  double coo;
  FILE *file = NULL;

  (*pGSet).Size = ut_alloc_2d (3, 2);
  neut_tess_bbox (Dom, (*pGSet).Size);

  (*pGSet).SeedCoo = ut_alloc_2d ((*pGSet).N + 1, 3);

  file = ut_file_open (filename, "R");
  ut_array_2d_fscanf (file, (*pGSet).SeedCoo + 1, (*pGSet).N, dim);
  ut_file_close (file, filename, "R");

  if (dim == 2)
  {
    coo = .5 * ((*pGSet).Size[2][0] + (*pGSet).Size[2][1]);
    for (i = 1; i <= (*pGSet).N; i++)
      (*pGSet).SeedCoo[i][2] = coo;
  }

  return;
}
