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

void
net_domain_segment (double size, struct TESS *pDomain)
{
  (*pDomain).Dim = 1;
  (*pDomain).Level = 0;
  (*pDomain).TessId = 1;

  (*pDomain).CellQty = 1;

  (*pDomain).SeedCoo = ut_alloc_2d ((*pDomain).CellQty + 1, 3);
  (*pDomain).SeedCoo[1][1] = .5 * size;

  (*pDomain).SeedWeight = ut_alloc_1d ((*pDomain).CellQty + 1);

  (*pDomain).VerQty = 2;

  (*pDomain).VerCoo = ut_alloc_2d ((*pDomain).VerQty + 1, 3);
  (*pDomain).VerCoo[2][0] = size;

  (*pDomain).VerEdgeQty = ut_alloc_1d_int ((*pDomain).VerQty + 1);
  ut_array_1d_int_set ((*pDomain).VerEdgeQty + 1, 2, 1);

  (*pDomain).VerEdgeNb = ut_alloc_2d_int ((*pDomain).VerQty + 1, 1);
  ut_array_2d_int_set ((*pDomain).VerEdgeNb + 1, 2, 1, 1);

  (*pDomain).VerState = ut_alloc_1d_int ((*pDomain).VerQty + 1);

  (*pDomain).EdgeQty = 1;

  (*pDomain).EdgeVerNb = ut_alloc_2d_int ((*pDomain).EdgeQty + 1, 2);
  ut_array_1d_int_set_2 ((*pDomain).EdgeVerNb[1], 1, 2);

  (*pDomain).EdgeFaceQty = ut_alloc_1d_int ((*pDomain).EdgeQty + 1);

  (*pDomain).EdgeLength = ut_alloc_1d ((*pDomain).EdgeQty + 1);
  (*pDomain).EdgeLength[1] = size;

  (*pDomain).EdgeState = ut_alloc_1d_int ((*pDomain).EdgeQty + 1);
  (*pDomain).EdgeDel = ut_alloc_1d_int ((*pDomain).EdgeQty + 1);

  (*pDomain).FaceQty = 0;
  (*pDomain).PolyQty = 0;

  return;
}
