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

void
nem_meshing_0D (struct TESS Tess, struct MESHPARA MeshPara, struct
		NODES *pNodes, struct MESH *Mesh)
{
  int i;
  struct NODES N;
  struct MESH M;
  char *message = ut_alloc_1d_char (8);

  neut_nodes_set_zero (&N);
  neut_mesh_set_zero (&M);
  Mesh[0].Dimension = 0;
  Mesh[0].EltOrder = 1;
  Mesh[0].EltType = ut_alloc_1d_char (5);
  strcpy (Mesh[0].EltType, "tri");

  ut_print_message (0, 2, "0D meshing... ");

  if (MeshPara.dim >= 0)
  {
    ut_print_progress (stdout, 0, Tess.VerQty, "%3.0f%%", message);

    for (i = 1; i <= Tess.VerQty; i++)
    {
      nem_meshing_0D_ver (Tess, i, MeshPara, &N, &M);
      nem_meshing_0D_addvermesh (N, M, pNodes, Mesh);
      ut_print_progress_nonl (stdout, i, Tess.VerQty, "%3.0f%%", message);
    }
  }

  printf ("\n");

  neut_mesh_init_nodeelts (Mesh + 0, (*pNodes).NodeQty);
  neut_mesh_init_eltelset (Mesh + 0, NULL);

  neut_nodes_free (&N);
  neut_mesh_free (&M);
  ut_free_1d_char (message);

  return;
}
