<commit_before>//----------------------------  grid_out.cc  ---------------------------
//    $Id$
//    Version: $Name$
//
//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//----------------------------  grid_out.cc  ---------------------------


#include <base/point.h>
#include <base/quadrature.h>
#include <grid/grid_out.h>
#include <grid/tria.h>
#include <grid/tria_accessor.h>
#include <grid/tria_iterator.h>
#include <fe/mapping.h>

#include <iomanip>
#include <algorithm>
#include <list>
#include <set>
#include <ctime>
#include <cmath>


#if deal_II_dimension == 1


template <int dim>
void GridOut::write_dx (const Triangulation<dim> &,
			std::ostream             &)
{
  Assert (false, ExcNotImplemented());
}

#else


template <int dim>
void GridOut::write_dx (const Triangulation<dim> &tria,
			std::ostream             &out) 
{
//TODO:[GK] allow for boundary faces only  
  Assert(dx_flags.write_all_faces, ExcNotImplemented());
  AssertThrow (out, ExcIO());
				   // Copied and adapted from write_ucd
  const std::vector<Point<dim> > &vertices    = tria.get_vertices();
  const std::vector<bool>        &vertex_used = tria.get_used_vertices();
  
  const unsigned int n_vertices = tria.n_used_vertices();

  typename Triangulation<dim>::active_cell_iterator       cell;
  const typename Triangulation<dim>::active_cell_iterator endc=tria.end();

  
				   // write the vertices
  out << "object \"vertices\" class array type float rank 1 shape " << dim
      << " items " << n_vertices << " data follows"
      << std::endl;
  
  for (unsigned int i=0; i<vertices.size(); ++i)
    if (vertex_used[i])
      {
	out << '\t' << vertices[i] << std::endl;
      };
  
				   // write cells or faces
  const bool write_cells = dx_flags.write_cells;
  const bool write_faces = (dim>1) ? dx_flags.write_faces : false;
  
  const unsigned int n_cells = tria.n_active_cells();
  const unsigned int n_faces = tria.n_active_cells()
			       * GeometryInfo<dim>::faces_per_cell;

  const unsigned int n_vertices_per_cell = GeometryInfo<dim>::vertices_per_cell;
  const unsigned int n_vertices_per_face = GeometryInfo<dim>::vertices_per_face;
  
  if (write_cells)
    {
      out << "object \"cells\" class array type int rank 1 shape "
	  << n_vertices_per_cell
	  << " items " << n_cells << " data follows" << std::endl;
      
      for (cell = tria.begin_active(); cell != endc; ++cell)
	{
	  for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
	    out << '\t' << cell->vertex_index(GeometryInfo<dim>::dx_to_deal[v]);
	  out << std::endl;
	}
      out << "attribute \"element type\" string \"";
      if (dim==1) out << "lines";
      if (dim==2) out << "quads";
      if (dim==3) out << "cubes";
      out << "\"" << std::endl
	  << "attribute \"ref\" string \"positions\"" << std::endl << std::endl;

				       // Additional cell information
      
      out << "object \"material\" class array type int rank 0 items "
	  << n_cells << " data follows" << std::endl;
      for (cell = tria.begin_active(); cell != endc; ++cell)
	out << ' ' << (unsigned int)cell->material_id();
      out  << std::endl
	   << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
      
      out << "object \"level\" class array type int rank 0 items "
	  << n_cells << " data follows" << std::endl;
      for (cell = tria.begin_active(); cell != endc; ++cell)
	out << ' ' << cell->level();
      out  << std::endl
	   << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
      
      if (dx_flags.write_measure)
	{
	  out << "object \"measure\" class array type float rank 0 items "
	      << n_cells << " data follows" << std::endl;
	  for (cell = tria.begin_active(); cell != endc; ++cell)
	    out << '\t' << cell->measure();
	  out  << std::endl
	       << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
	}
      
      if (dx_flags.write_diameter)
	{
	  out << "object \"diameter\" class array type float rank 0 items "
	      << n_cells << " data follows" << std::endl;
	  for (cell = tria.begin_active(); cell != endc; ++cell)
	    out << '\t' << cell->diameter();
	  out  << std::endl
	       << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
	}
    }
  
  if (write_faces)
    {
      out << "object \"faces\" class array type int rank 1 shape "
	  << n_vertices_per_face
	  << " items " << n_faces << " data follows"
	  << std::endl;

      for (cell = tria.begin_active(); cell != endc; ++cell)
	{
	  for (unsigned int f=0;f<GeometryInfo<dim>::faces_per_cell;++f)
	    {
	      typename Triangulation<dim>::face_iterator face = cell->face(f);
	      
	      for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
		out << '\t' << face->vertex_index(GeometryInfo<dim-1>::dx_to_deal[v]);
	      out << std::endl;
	    }
	}
      out << "attribute \"element type\" string \"";
      if (dim==2) out << "lines";
      if (dim==3) out << "quads";
      out << "\"" << std::endl
	  << "attribute \"ref\" string \"positions\"" << std::endl << std::endl;
      

				       // Additional face information
      
      out << "object \"boundary\" class array type int rank 0 items "
	  << n_faces << " data follows" << std::endl;
      for (cell = tria.begin_active(); cell != endc; ++cell)
	{
					   // Little trick to get -1
					   // for the interior
	  for (unsigned int f=0;f<GeometryInfo<dim>::faces_per_cell;++f)
	    out << ' ' << (int)(signed char)cell->face(f)->boundary_indicator();
	  out << std::endl;
	}
      out << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
      
      if (dx_flags.write_measure)
	{
	  out << "object \"face measure\" class array type float rank 0 items "
	      << n_faces << " data follows" << std::endl;
	  for (cell = tria.begin_active(); cell != endc; ++cell)
	    {
	      for (unsigned int f=0;f<GeometryInfo<dim>::faces_per_cell;++f)
		out << ' ' << cell->face(f)->measure();
	      out << std::endl;
	    }
	  out << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
	}

      if (dx_flags.write_diameter)
	{
	  out << "object \"face diameter\" class array type float rank 0 items "
	      << n_faces << " data follows" << std::endl;
	  for (cell = tria.begin_active(); cell != endc; ++cell)
	    {
	      for (unsigned int f=0;f<GeometryInfo<dim>::faces_per_cell;++f)
		out << ' ' << cell->face(f)->diameter();
	      out << std::endl;
	    }
	  out << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
	}

    }
  

				   // Write additional face information
  
  if (write_faces)
    {
      
    }
  else
    {
     }

				   // The wrapper
  out << "object \"deal data\" class field" << std::endl
      << "component \"positions\" value \"vertices\"" << std::endl
      << "component \"connections\" value \"cells\"" << std::endl;

  if (write_cells)
    {
      out << "object \"cell data\" class field" << std::endl
	  << "component \"positions\" value \"vertices\"" << std::endl
	  << "component \"connections\" value \"cells\"" << std::endl;
      out << "component \"material\" value \"material\"" << std::endl;
      out << "component \"level\" value \"level\"" << std::endl;
      if (dx_flags.write_measure)
	out << "component \"measure\" value \"measure\"" << std::endl;
      if (dx_flags.write_diameter)
	out << "component \"diameter\" value \"diameter\"" << std::endl;
    }

  if (write_faces)
    {
      out << "object \"face data\" class field" << std::endl
	  << "component \"positions\" value \"vertices\"" << std::endl
	  << "component \"connections\" value \"faces\"" << std::endl;
      out << "component \"boundary\" value \"boundary\"" << std::endl;
      if (dx_flags.write_measure)
	out << "component \"measure\" value \"face measure\"" << std::endl;
      if (dx_flags.write_diameter)
	out << "component \"diameter\" value \"face diameter\"" << std::endl;
    }
  
  out << std::endl
      << "object \"grid data\" class group" << std::endl;
    if (write_cells)
      out << "member \"cells\" value \"cell data\"" << std::endl;
    if (write_faces)
      out << "member \"faces\" value \"face data\"" << std::endl;
  out << "end" << std::endl;  
}


#endif


template <int dim>
void GridOut::write_ucd (const Triangulation<dim> &tria,
			 std::ostream             &out) 
{
  AssertThrow (out, ExcIO());

				   // get the positions of the
				   // vertices and whether they are
				   // used.
  const std::vector<Point<dim> > &vertices    = tria.get_vertices();
  const std::vector<bool>        &vertex_used = tria.get_used_vertices();
  
  const unsigned int n_vertices = tria.n_used_vertices();

  typename Triangulation<dim>::active_cell_iterator       cell=tria.begin_active();
  const typename Triangulation<dim>::active_cell_iterator endc=tria.end();

				   // write preamble
  if (ucd_flags.write_preamble)
    {
				       // block this to have local
				       // variables destroyed after
				       // use
      std::time_t  time1= std::time (0);
      std::tm     *time = std::localtime(&time1); 
      out << "# This file was generated by the deal.II library." << std::endl
	  << "# Date =  "
	  << time->tm_year+1900 << "/"
	  << time->tm_mon+1 << "/"
	  << time->tm_mday << std::endl
	  << "# Time =  "
	  << time->tm_hour << ":"
	  << std::setw(2) << time->tm_min << ":"
	  << std::setw(2) << time->tm_sec << std::endl
	  << "#" << std::endl
	  << "# For a description of the UCD format see the AVS Developer's guide."
	  << std::endl
	  << "#" << std::endl;
    };

				   // start with ucd data
  out << n_vertices << ' '
      << tria.n_active_cells() + (ucd_flags.write_faces ?
				  n_boundary_faces(tria) :
				  0)
      << " 0 0 0"                  // no data
      << std::endl;

				   // actually write the vertices.
				   // note that we shall number them
				   // with first index 1 instead of 0
  for (unsigned int i=0; i<vertices.size(); ++i)
    if (vertex_used[i])
      {
	out << i+1                 // vertex index
	    << "  "
	    << vertices[i];
	for (unsigned int d=dim+1; d<=3; ++d)
	  out << " 0";             // fill with zeroes
	out << std::endl;
      };
	
				   // write cells. Enumerate cells
				   // consecutively, starting with 1
  unsigned int cell_index=1;
  for (cell=tria.begin_active();
       cell!=endc; ++cell, ++cell_index)
    {
      out << cell_index << ' '
	  << static_cast<unsigned int>(cell->material_id())
	  << " ";
      switch (dim) 
	{
	  case 1:  out << "line    "; break;
	  case 2:  out << "quad    "; break;
	  case 3:  out << "hex     "; break;
	  default:
		Assert (false, ExcNotImplemented());
	};

				       // it follows a list of the
				       // vertices of each cell. in 1d
				       // this is simply a list of the
				       // two vertices, in 2d its counter
				       // clockwise, as usual in this
				       // library. in 3d, the same applies
				       // (special thanks to AVS for
				       // numbering their vertices in a
				       // way compatible to deal.II!)
				       //
				       // technical reference:
				       // AVS Developer's Guide, Release 4,
				       // May, 1992, p. E6
				       //
				       // note: vertex numbers are 1-base
      for (unsigned int vertex=0; vertex<GeometryInfo<dim>::vertices_per_cell;
	   ++vertex)
	out << cell->vertex_index(vertex)+1 << ' ';
      out << std::endl;
    };

				   // write faces with non-zero boundary
				   // indicator
  if (ucd_flags.write_faces)
    write_ucd_faces (tria, cell_index, out);
    
  AssertThrow (out, ExcIO());
}


#if deal_II_dimension != 2

template <int dim>
void GridOut::write_xfig (const Triangulation<dim>&,
			  std::ostream&,
			  const Mapping<dim>*)
{
  Assert (false, ExcNotImplemented());
}

#else

//TODO:[GK] Write boundary faces
//TODO:[GK] Obey parameters
//TODO:[GK] Flip y-axis?
template <int dim>
void GridOut::write_xfig (const Triangulation<dim>& tria,
			  std::ostream&             out,
			  const Mapping<dim>*       mapping)
{
  const unsigned int nv = GeometryInfo<dim>::vertices_per_cell;
<commit_msg>Remove one more unused variable.<commit_after>//----------------------------  grid_out.cc  ---------------------------
//    $Id$
//    Version: $Name$
//
//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//----------------------------  grid_out.cc  ---------------------------


#include <base/point.h>
#include <base/quadrature.h>
#include <grid/grid_out.h>
#include <grid/tria.h>
#include <grid/tria_accessor.h>
#include <grid/tria_iterator.h>
#include <fe/mapping.h>

#include <iomanip>
#include <algorithm>
#include <list>
#include <set>
#include <ctime>
#include <cmath>


#if deal_II_dimension == 1


template <int dim>
void GridOut::write_dx (const Triangulation<dim> &,
			std::ostream             &)
{
  Assert (false, ExcNotImplemented());
}

#else


template <int dim>
void GridOut::write_dx (const Triangulation<dim> &tria,
			std::ostream             &out) 
{
//TODO:[GK] allow for boundary faces only  
  Assert(dx_flags.write_all_faces, ExcNotImplemented());
  AssertThrow (out, ExcIO());
				   // Copied and adapted from write_ucd
  const std::vector<Point<dim> > &vertices    = tria.get_vertices();
  const std::vector<bool>        &vertex_used = tria.get_used_vertices();
  
  const unsigned int n_vertices = tria.n_used_vertices();

  typename Triangulation<dim>::active_cell_iterator       cell;
  const typename Triangulation<dim>::active_cell_iterator endc=tria.end();

  
				   // write the vertices
  out << "object \"vertices\" class array type float rank 1 shape " << dim
      << " items " << n_vertices << " data follows"
      << std::endl;
  
  for (unsigned int i=0; i<vertices.size(); ++i)
    if (vertex_used[i])
      {
	out << '\t' << vertices[i] << std::endl;
      };
  
				   // write cells or faces
  const bool write_cells = dx_flags.write_cells;
  const bool write_faces = (dim>1) ? dx_flags.write_faces : false;
  
  const unsigned int n_cells = tria.n_active_cells();
  const unsigned int n_faces = tria.n_active_cells()
			       * GeometryInfo<dim>::faces_per_cell;

  const unsigned int n_vertices_per_cell = GeometryInfo<dim>::vertices_per_cell;
  const unsigned int n_vertices_per_face = GeometryInfo<dim>::vertices_per_face;
  
  if (write_cells)
    {
      out << "object \"cells\" class array type int rank 1 shape "
	  << n_vertices_per_cell
	  << " items " << n_cells << " data follows" << std::endl;
      
      for (cell = tria.begin_active(); cell != endc; ++cell)
	{
	  for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
	    out << '\t' << cell->vertex_index(GeometryInfo<dim>::dx_to_deal[v]);
	  out << std::endl;
	}
      out << "attribute \"element type\" string \"";
      if (dim==1) out << "lines";
      if (dim==2) out << "quads";
      if (dim==3) out << "cubes";
      out << "\"" << std::endl
	  << "attribute \"ref\" string \"positions\"" << std::endl << std::endl;

				       // Additional cell information
      
      out << "object \"material\" class array type int rank 0 items "
	  << n_cells << " data follows" << std::endl;
      for (cell = tria.begin_active(); cell != endc; ++cell)
	out << ' ' << (unsigned int)cell->material_id();
      out  << std::endl
	   << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
      
      out << "object \"level\" class array type int rank 0 items "
	  << n_cells << " data follows" << std::endl;
      for (cell = tria.begin_active(); cell != endc; ++cell)
	out << ' ' << cell->level();
      out  << std::endl
	   << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
      
      if (dx_flags.write_measure)
	{
	  out << "object \"measure\" class array type float rank 0 items "
	      << n_cells << " data follows" << std::endl;
	  for (cell = tria.begin_active(); cell != endc; ++cell)
	    out << '\t' << cell->measure();
	  out  << std::endl
	       << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
	}
      
      if (dx_flags.write_diameter)
	{
	  out << "object \"diameter\" class array type float rank 0 items "
	      << n_cells << " data follows" << std::endl;
	  for (cell = tria.begin_active(); cell != endc; ++cell)
	    out << '\t' << cell->diameter();
	  out  << std::endl
	       << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
	}
    }
  
  if (write_faces)
    {
      out << "object \"faces\" class array type int rank 1 shape "
	  << n_vertices_per_face
	  << " items " << n_faces << " data follows"
	  << std::endl;

      for (cell = tria.begin_active(); cell != endc; ++cell)
	{
	  for (unsigned int f=0;f<GeometryInfo<dim>::faces_per_cell;++f)
	    {
	      typename Triangulation<dim>::face_iterator face = cell->face(f);
	      
	      for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
		out << '\t' << face->vertex_index(GeometryInfo<dim-1>::dx_to_deal[v]);
	      out << std::endl;
	    }
	}
      out << "attribute \"element type\" string \"";
      if (dim==2) out << "lines";
      if (dim==3) out << "quads";
      out << "\"" << std::endl
	  << "attribute \"ref\" string \"positions\"" << std::endl << std::endl;
      

				       // Additional face information
      
      out << "object \"boundary\" class array type int rank 0 items "
	  << n_faces << " data follows" << std::endl;
      for (cell = tria.begin_active(); cell != endc; ++cell)
	{
					   // Little trick to get -1
					   // for the interior
	  for (unsigned int f=0;f<GeometryInfo<dim>::faces_per_cell;++f)
	    out << ' ' << (int)(signed char)cell->face(f)->boundary_indicator();
	  out << std::endl;
	}
      out << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
      
      if (dx_flags.write_measure)
	{
	  out << "object \"face measure\" class array type float rank 0 items "
	      << n_faces << " data follows" << std::endl;
	  for (cell = tria.begin_active(); cell != endc; ++cell)
	    {
	      for (unsigned int f=0;f<GeometryInfo<dim>::faces_per_cell;++f)
		out << ' ' << cell->face(f)->measure();
	      out << std::endl;
	    }
	  out << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
	}

      if (dx_flags.write_diameter)
	{
	  out << "object \"face diameter\" class array type float rank 0 items "
	      << n_faces << " data follows" << std::endl;
	  for (cell = tria.begin_active(); cell != endc; ++cell)
	    {
	      for (unsigned int f=0;f<GeometryInfo<dim>::faces_per_cell;++f)
		out << ' ' << cell->face(f)->diameter();
	      out << std::endl;
	    }
	  out << "attribute \"dep\" string \"connections\"" << std::endl << std::endl;
	}

    }
  

				   // Write additional face information
  
  if (write_faces)
    {
      
    }
  else
    {
     }

				   // The wrapper
  out << "object \"deal data\" class field" << std::endl
      << "component \"positions\" value \"vertices\"" << std::endl
      << "component \"connections\" value \"cells\"" << std::endl;

  if (write_cells)
    {
      out << "object \"cell data\" class field" << std::endl
	  << "component \"positions\" value \"vertices\"" << std::endl
	  << "component \"connections\" value \"cells\"" << std::endl;
      out << "component \"material\" value \"material\"" << std::endl;
      out << "component \"level\" value \"level\"" << std::endl;
      if (dx_flags.write_measure)
	out << "component \"measure\" value \"measure\"" << std::endl;
      if (dx_flags.write_diameter)
	out << "component \"diameter\" value \"diameter\"" << std::endl;
    }

  if (write_faces)
    {
      out << "object \"face data\" class field" << std::endl
	  << "component \"positions\" value \"vertices\"" << std::endl
	  << "component \"connections\" value \"faces\"" << std::endl;
      out << "component \"boundary\" value \"boundary\"" << std::endl;
      if (dx_flags.write_measure)
	out << "component \"measure\" value \"face measure\"" << std::endl;
      if (dx_flags.write_diameter)
	out << "component \"diameter\" value \"face diameter\"" << std::endl;
    }
  
  out << std::endl
      << "object \"grid data\" class group" << std::endl;
    if (write_cells)
      out << "member \"cells\" value \"cell data\"" << std::endl;
    if (write_faces)
      out << "member \"faces\" value \"face data\"" << std::endl;
  out << "end" << std::endl;  
}


#endif


template <int dim>
void GridOut::write_ucd (const Triangulation<dim> &tria,
			 std::ostream             &out) 
{
  AssertThrow (out, ExcIO());

				   // get the positions of the
				   // vertices and whether they are
				   // used.
  const std::vector<Point<dim> > &vertices    = tria.get_vertices();
  const std::vector<bool>        &vertex_used = tria.get_used_vertices();
  
  const unsigned int n_vertices = tria.n_used_vertices();

  typename Triangulation<dim>::active_cell_iterator       cell=tria.begin_active();
  const typename Triangulation<dim>::active_cell_iterator endc=tria.end();

				   // write preamble
  if (ucd_flags.write_preamble)
    {
				       // block this to have local
				       // variables destroyed after
				       // use
      std::time_t  time1= std::time (0);
      std::tm     *time = std::localtime(&time1); 
      out << "# This file was generated by the deal.II library." << std::endl
	  << "# Date =  "
	  << time->tm_year+1900 << "/"
	  << time->tm_mon+1 << "/"
	  << time->tm_mday << std::endl
	  << "# Time =  "
	  << time->tm_hour << ":"
	  << std::setw(2) << time->tm_min << ":"
	  << std::setw(2) << time->tm_sec << std::endl
	  << "#" << std::endl
	  << "# For a description of the UCD format see the AVS Developer's guide."
	  << std::endl
	  << "#" << std::endl;
    };

				   // start with ucd data
  out << n_vertices << ' '
      << tria.n_active_cells() + (ucd_flags.write_faces ?
				  n_boundary_faces(tria) :
				  0)
      << " 0 0 0"                  // no data
      << std::endl;

				   // actually write the vertices.
				   // note that we shall number them
				   // with first index 1 instead of 0
  for (unsigned int i=0; i<vertices.size(); ++i)
    if (vertex_used[i])
      {
	out << i+1                 // vertex index
	    << "  "
	    << vertices[i];
	for (unsigned int d=dim+1; d<=3; ++d)
	  out << " 0";             // fill with zeroes
	out << std::endl;
      };
	
				   // write cells. Enumerate cells
				   // consecutively, starting with 1
  unsigned int cell_index=1;
  for (cell=tria.begin_active();
       cell!=endc; ++cell, ++cell_index)
    {
      out << cell_index << ' '
	  << static_cast<unsigned int>(cell->material_id())
	  << " ";
      switch (dim) 
	{
	  case 1:  out << "line    "; break;
	  case 2:  out << "quad    "; break;
	  case 3:  out << "hex     "; break;
	  default:
		Assert (false, ExcNotImplemented());
	};

				       // it follows a list of the
				       // vertices of each cell. in 1d
				       // this is simply a list of the
				       // two vertices, in 2d its counter
				       // clockwise, as usual in this
				       // library. in 3d, the same applies
				       // (special thanks to AVS for
				       // numbering their vertices in a
				       // way compatible to deal.II!)
				       //
				       // technical reference:
				       // AVS Developer's Guide, Release 4,
				       // May, 1992, p. E6
				       //
				       // note: vertex numbers are 1-base
      for (unsigned int vertex=0; vertex<GeometryInfo<dim>::vertices_per_cell;
	   ++vertex)
	out << cell->vertex_index(vertex)+1 << ' ';
      out << std::endl;
    };

				   // write faces with non-zero boundary
				   // indicator
  if (ucd_flags.write_faces)
    write_ucd_faces (tria, cell_index, out);
    
  AssertThrow (out, ExcIO());
}


#if deal_II_dimension != 2

template <int dim>
void GridOut::write_xfig (const Triangulation<dim>&,
			  std::ostream&,
			  const Mapping<dim>*)
{
  Assert (false, ExcNotImplemented());
}

#else

//TODO:[GK] Write boundary faces
//TODO:[GK] Obey parameters
//TODO:[GK] Flip y-axis?
template <int dim>
void GridOut::write_xfig (const Triangulation<dim>& tria,
			  std::ostream&             out,
			  const Mapping<dim>*       /*mapping*/)
{
  const unsigned int nv = GeometryInfo<dim>::vertices_per_cell;

{'fraction_non_alphanumeric': 0.17800898749038502, 'fraction_numerical': 0.0072061859843731025, 'mean_word_length': 2.4762172811708414, 'pattern_counts': {'":': 4, '<': 919, '<?xml version=': 0, '>': 147, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '511848', 'n_tokens_mistral': 8821, 'n_tokens_neox': 7958, 'n_words': 2128}