+#include <basic/grid_io.h>
#include <grid/dof.h>
#include <grid/tria.h>
#include <fe/fe_lib.lagrange.h>
cout << " Writing grid..." << endl;
ofstream out((file_prefix + prm.get("Grid file")).c_str());
- tria->print_gnuplot (out);
+ GridOut::write_gnuplot (tria, out);
#include <grid/grid_generator.h>
#include <base/function.h>
#include <basic/data_io.h>
+#include <basic/grid_io.h>
#include <base/parameter_handler.h>
#include <fe/fe_lib.lagrange.h>
#include <base/quadrature_lib.h>
filename += "finest_mesh.gnuplot";
cout << " Writing finest grid to <" << filename << ">... " << endl;
ofstream finest_mesh (filename.c_str());
- tria->print_gnuplot (finest_mesh);
+ GridOut::write_gnuplot (tria, finest_mesh);
finest_mesh.close();
print_history (prm, refine_mode);
#include <grid/tria_iterator.h>
#include <grid/tria.h>
#include <grid/grid_generator.h>
+#include <basic/grid_io.h>
#include <fstream>
#include <string>
#include <cmath>
Ball<dim> ball;
CurvedLine<dim> curved_line;
if (test_case==2)
- tria.set_boundary (&ball);
- else
- tria.set_boundary (&curved_line);
+ {
+ tria.set_boundary (0, ball);
+ tria.set_boundary (1, ball);
+ } else {
+ tria.set_boundary (0, curved_line);
+ tria.set_boundary (1, curved_line);
+ };
// refine once
tria.begin_active()->set_refine_flag();
};
tria.set_boundary (0);
+ tria.set_boundary (1);
+
break;
}
filename += ('0'+test_case);
ofstream out(filename.c_str());
- tria.print_gnuplot (out);
+ GridOut::write_gnuplot (tria, out);
cout << " Total number of cells = " << tria.n_cells() << endl
<< " Total number of active cells = " << tria.n_active_cells() << endl;
--- /dev/null
+/*---------------------------- grid_io.h ---------------------------*/
+/* $Id$ */
+#ifndef __grid_io_H
+#define __grid_io_H
+/*---------------------------- grid_io.h ---------------------------*/
+
+#include <basic/forward-declarations.h>
+#include <base/exceptions.h>
+#include <string>
+
+
+
+/**
+ * This class provides a means to output a triangulation to a file in different
+ * formats. Presently provided are functions to write it in GNUPLOT and
+ * encapsulated postscript format. There are also function to dispatch to
+ * the different output functions based on a parameter given, e.g., through
+ * a parameter file, thus making user programs invariant of the number and
+ * names of the file formats implemented in this class.
+ *
+ *
+ * \subsection{GNUPLOT format}
+ * In GNUPLOT format, each cell is written as a sequence of lines. There is not
+ * much more to be said here since the actual representation as well as the
+ * viewing angle (for 3d plots) is done by GNUPLOT itself.
+ *
+ * One additional feature, however, is worth being mentioned: after each point
+ * denoting one of the end points of a line, the level of the respective cell
+ * is written. Therefore, if you let GNUPLOT draw a 2d grid as a 3d plot, you
+ * will see more refined cells being raised against cells with less refinement.
+ * Also, if you draw a cut through a 3d grid, you can extrude the refinement
+ * level in the direction orthogonal to the cut plane.
+ *
+ *
+ * \subsection{Encapsulated postscript format}
+ * In this format, each line of the triangulation is written separately. We
+ * scale the picture such that x-values range between zero and 300 and the y-range
+ * is scaled with the same factor. The bounding box is close to the triangulation
+ * on all four sides, without an extra frame. The line width is chosen to be 0.5,
+ * which is a thin line relative to the extension of the picture of 300.
+ *
+ *
+ * @author Wolfgang Bangerth, 1999; postscript format based on an implementation by Stefan Nauber, 1999
+ */
+class GridOut
+{
+ public:
+ /**
+ * Declaration of a name for each of the
+ * different output formats.
+ */
+ enum OutputFormat { gnuplot, eps };
+
+ /**
+ * Write the triangulation in the
+ * gnuplot format. See the general
+ * documentation for a description
+ * of what happens here.
+ */
+ template <int dim>
+ static void write_gnuplot (const Triangulation<dim> &tria,
+ ostream &out);
+
+ /**
+ * Write the triangulation in the
+ * encapsulated postscript format. See the
+ * general documentation for a description
+ * of what happens here.
+ */
+ template <int dim>
+ static void write_eps (const Triangulation<dim> &tria,
+ ostream &out);
+
+ /**
+ * Write data and grid to #out# according
+ * to the given data format. This function
+ * simply calls the appropriate
+ * #write_*# function.
+ */
+ template <int dim>
+ static void write (const Triangulation<dim> &tria,
+ ostream &out,
+ const OutputFormat output_format);
+
+ /**
+ * Provide a function which tells us which
+ * suffix with a given output format
+ * usually has. At present the following
+ * formats are defined:
+ * \begin{itemize}
+ * \item #gnuplot#: #.gnuplot#
+ * \item #eps#: #.eps#.
+ * \end{itemize}
+ *
+ * Since this function does not need data
+ * from this object, it is static and can
+ * thus be called without creating an
+ * object of this class.
+ */
+ static string default_suffix (const OutputFormat output_format);
+
+ /**
+ * Return the #OutputFormat# value
+ * corresponding to the given string. If
+ * the string does not match any known
+ * format, an exception is thrown.
+ *
+ * Since this function does not need data
+ * from this object, it is static and can
+ * thus be called without creating an
+ * object of this class. Its main purpose
+ * is to allow a program to use any
+ * implemented output format without the
+ * need to extend the program's parser
+ * each time a new format is implemented.
+ *
+ * To get a list of presently available
+ * format names, e.g. to give it to the
+ * #ParameterHandler# class, use the
+ * function #get_output_format_names ()#.
+ */
+ static OutputFormat parse_output_format (const string &format_name);
+
+ /**
+ * Return a list of implemented output
+ * formats. The different names are
+ * separated by vertical bar signs (#`|'#)
+ * as used by the #ParameterHandler#
+ * classes.
+ */
+ static string get_output_format_names ();
+
+
+ /**
+ * Exception
+ */
+ DeclException0 (ExcInvalidState);
+ /**
+ * Exception
+ */
+ DeclException0 (ExcIO);
+};
+
+
+
+/*---------------------------- grid_io.h ---------------------------*/
+/* end of #ifndef __grid_io_H */
+#endif
+/*---------------------------- grid_io.h ---------------------------*/
* };
* // output the grid
* ofstream out("grid.1");
- * tria.print_gnuplot (out);
+ * GridOut::write_gnuplot (tria, out);
* };
* \end{verbatim}
*
/*@}*/
/*---------------------------------------*/
-
- /**
- * @name Input/Output functions
- */
- /*@{*/
- /**
- * Print the triangulation in GNUPLOT
- * format to #out#.
- */
- void print_gnuplot (ostream &) const;
-
- /**
- * Print level #level# in GNUPLOT
- * format to #out#.
- */
- void print_gnuplot (ostream &, const unsigned int level) const;
-
- /**
- * Print cell #cell# in GNUPLOT format
- * to #out#.
- */
- void print_gnuplot (ostream &, const active_cell_iterator &cell) const;
- /*@}
- */
-
/**
* @name Information about the triangulation
unsigned int n_lines (const unsigned int level) const;
/**
- * Return total number of active lines,
- * active or not.
+ * Return total number of active lines.
*
* Regarding the computational effort of
* this function, the same applies as
/**
* Return total number of active lines,
- * active or not on level #level#.
+ * on level #level#.
*
* Regarding the computational effort of
* this function, the same applies as
*
* \subsection{Encapsulated Postscript format}
*
- * There are two functions for generating encapsulated Postscript
- * (EPS) without the need for another graphics tool.
- * #write_epsgrid# writes just the 2d grid - This is obsolete and
- * should be removed. The functionality is provided through #write_eps#
- * and #EpsOutputData# now.
+ * There is a function for generating encapsulated Postscript
+ * (EPS) without the need for another graphics tool. This functionality
+ * is provided through #write_eps# and #EpsOutputData#.
* #write_eps# can use one data vector for height information and one
* cell vector for shading information. Control is done through an
* object of class #EpsOutputData# as follows or by default.
* Provide a data type specifying the
* presently supported output formats.
*/
- enum OutputFormat { ucd, gnuplot, gnuplot_draft, povray_mesh, eps, epsgrid, gmv };
+ enum OutputFormat { ucd, gnuplot, gnuplot_draft, povray_mesh, eps, gmv };
/**
* Constructor
void write_eps (ostream &out,
const EpsOutputData &eod = EpsOutputData()) const;
- /**
- * Write grid in Encapsulated
- * postscript format.
- */
- void write_epsgrid (ostream &out) const;
-
/**
* Write data and grid in GMV format.
*/
*
* In case of gnuplot output, the
* standard accuracy of 1 is
- * chosen. */
+ * chosen.
+ */
void write (ostream &out, const OutputFormat output_format) const;
/**
* \item #gnuplot# and #gnuplot_draft#:
* #.gnuplot#
* \item #povray_mesh#: #.pov#
- * \item #eps# and #epsgrid#: #.eps#
+ * \item #eps#: #.eps#
* \item #gmv#: #.gmv#.
* \end{itemize}
*
* #ParameterHandler# class, use the
* function #get_output_format_names ()#.
*/
- static OutputFormat parse_output_format (const string format_name);
+ static OutputFormat parse_output_format (const string &format_name);
/**
* Return a list of implemented output
--- /dev/null
+/* $Id$ */
+
+
+#include <base/point.h>
+#include <basic/grid_io.h>
+#include <grid/tria.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+
+#include <iomanip>
+#include <algorithm>
+#include <list>
+#include <ctime>
+#include <cmath>
+
+
+
+template <int dim>
+void GridOut::write_gnuplot (const Triangulation<dim> &tria,
+ ostream &out)
+{
+ AssertThrow (out, ExcIO());
+
+ typename Triangulation<dim>::active_cell_iterator cell=tria.begin_active();
+ const typename Triangulation<dim>::active_cell_iterator endc=tria.end();
+ for (; cell!=endc; ++cell)
+ {
+ out << "# cell " << cell << endl;
+
+ switch (dim)
+ {
+ case 1:
+ out << cell->vertex(0) << ' ' << cell->level() << endl
+ << cell->vertex(1) << ' ' << cell->level() << endl
+ << endl;
+ break;
+
+ case 2:
+ out << cell->vertex(0) << ' ' << cell->level() << endl
+ << cell->vertex(1) << ' ' << cell->level() << endl
+ << cell->vertex(2) << ' ' << cell->level() << endl
+ << cell->vertex(3) << ' ' << cell->level() << endl
+ << cell->vertex(0) << ' ' << cell->level() << endl
+ << endl // double new line for gnuplot 3d plots
+ << endl;
+ break;
+
+ case 3:
+ // front face
+ out << cell->vertex(0) << ' ' << cell->level() << endl
+ << cell->vertex(1) << ' ' << cell->level() << endl
+ << cell->vertex(2) << ' ' << cell->level() << endl
+ << cell->vertex(3) << ' ' << cell->level() << endl
+ << cell->vertex(0) << ' ' << cell->level() << endl
+ << endl;
+ // back face
+ out << cell->vertex(4) << ' ' << cell->level() << endl
+ << cell->vertex(5) << ' ' << cell->level() << endl
+ << cell->vertex(6) << ' ' << cell->level() << endl
+ << cell->vertex(7) << ' ' << cell->level() << endl
+ << cell->vertex(4) << ' ' << cell->level() << endl
+ << endl;
+
+ // now for the four connecting lines
+ out << cell->vertex(0) << ' ' << cell->level() << endl
+ << cell->vertex(4) << ' ' << cell->level() << endl
+ << endl;
+ out << cell->vertex(1) << ' ' << cell->level() << endl
+ << cell->vertex(5) << ' ' << cell->level() << endl
+ << endl;
+ out << cell->vertex(2) << ' ' << cell->level() << endl
+ << cell->vertex(6) << ' ' << cell->level() << endl
+ << endl;
+ out << cell->vertex(3) << ' ' << cell->level() << endl
+ << cell->vertex(7) << ' ' << cell->level() << endl
+ << endl;
+ break;
+ };
+ };
+
+ AssertThrow (out, ExcIO());
+};
+
+
+
+template <int dim>
+void GridOut::write_eps (const Triangulation<dim> &tria,
+ ostream &out)
+{
+ Assert (false, ExcNotImplemented());
+};
+
+
+
+#if deal_II_dimension == 2
+
+template <>
+void GridOut::write_eps (const Triangulation<2> &tria,
+ ostream &out)
+{
+ typedef list<pair<Point<2>,Point<2> > > LineList;
+
+
+ AssertThrow (out, ExcIO());
+
+ // make up a list of lines by which
+ // we will construct the triangulation
+ LineList line_list;
+ Triangulation<2>::active_line_iterator line =tria.begin_active_line ();
+ Triangulation<2>::active_line_iterator endline=tria.end_line ();
+
+ for (; line!=endline; ++line)
+ line_list.push_back (make_pair(line->vertex(0),
+ line->vertex(1)));
+
+ // find out minimum and maximum x and
+ // y coordinates to compute offsets
+ // and scaling factors
+ double x_min = tria.begin_active_line()->vertex(0)(0);
+ double x_max = x_min;
+ double y_min = tria.begin_active_line()->vertex(0)(1);
+ double y_max = y_min;
+
+ for (LineList::const_iterator line=line_list.begin();
+ line!=line_list.end(); ++line)
+ {
+ x_min = min (x_min, line->first(0));
+ x_min = min (x_min, line->second(0));
+
+ x_max = max (x_max, line->first(0));
+ x_max = max (x_max, line->second(0));
+
+ y_min = min (y_min, line->first(1));
+ y_min = min (y_min, line->second(1));
+
+ y_max = max (y_max, line->first(1));
+ y_max = max (y_max, line->second(1));
+ };
+
+ // scale in x-direction such that
+ // in the output 0 <= x <= 300.
+ // don't scale in y-direction to
+ // preserve the shape of the
+ // triangulation
+ const double scale = 300. / (x_max - x_min);
+
+
+ // now write preamble
+ if (true)
+ {
+ // block this to have local
+ // variables destroyed after
+ // use
+ time_t time1= time (0);
+ tm *time = localtime(&time1);
+ out << "%!PS-Adobe-2.0 EPSF-1.2" << endl
+ << "%%Title: deal.II Output" << endl
+ << "%%Creator: the deal.II library" << endl
+ << "%%Creation Date: "
+ << time->tm_year+1900 << "/"
+ << time->tm_mon+1 << "/"
+ << time->tm_mday << " - "
+ << time->tm_hour << ":"
+ << setw(2) << time->tm_min << ":"
+ << setw(2) << time->tm_sec << endl
+ << "%%BoundingBox: "
+ // lower left corner
+ << "0 0 "
+ // upper right corner
+ << "300 " << static_cast<unsigned int>( (y_max-y_min) * scale )
+ << endl;
+
+ // define some abbreviations to keep
+ // the output small:
+ // m=move turtle to
+ // x=execute line stroke
+ out << "/m {moveto} bind def" << endl
+ << "/x {lineto stroke} bind def" << endl;
+
+ out << "%%EndProlog" << endl
+ << endl;
+
+ // set fine lines
+ out << "0.5 setlinewidth" << endl;
+ };
+
+ // now write the lines
+ const Point<2> offset(x_min, y_min);
+
+ for (LineList::const_iterator line=line_list.begin();
+ line!=line_list.end(); ++line)
+ out << (line->first - offset) * scale << " m "
+ << (line->second - offset) * scale << " x\n";
+
+ out << "showpage" << endl;
+
+ AssertThrow (out, ExcIO());
+};
+
+#endif
+
+
+
+
+template <int dim>
+void GridOut::write (const Triangulation<dim> &tria,
+ ostream &out,
+ OutputFormat output_format)
+{
+ switch (output_format)
+ {
+ case gnuplot:
+ write_gnuplot (tria, out);
+ return;
+
+ case eps:
+ write_eps (tria, out);
+ return;
+ };
+
+ Assert (false, ExcInternalError());
+};
+
+
+
+string GridOut::default_suffix (const OutputFormat output_format)
+{
+ switch (output_format)
+ {
+ case gnuplot:
+ return ".gnuplot";
+
+ case eps:
+ return ".eps";
+
+ default:
+ Assert (false, ExcNotImplemented());
+ return "";
+ };
+};
+
+
+
+
+GridOut::OutputFormat
+GridOut::parse_output_format (const string &format_name) {
+ if (format_name == "gnuplot")
+ return gnuplot;
+
+ if (format_name == "eps")
+ return eps;
+
+ AssertThrow (false, ExcInvalidState ());
+ // return something weird
+ return OutputFormat(-1);
+};
+
+
+
+string GridOut::get_output_format_names () {
+ return "gnuplot|eps";
+};
+
+
+
+// explicit instantiations
+template void GridOut::write_gnuplot (const Triangulation<deal_II_dimension> &, ostream &);
+//template void GridOut::write_eps (const Triangulation<deal_II_dimension> &, ostream &);
+template void GridOut::write (const Triangulation<deal_II_dimension> &, ostream &, OutputFormat);
-template <int dim>
-void Triangulation<dim>::print_gnuplot (ostream &out) const {
- for (unsigned int i=0; i<levels.size(); ++i)
- print_gnuplot (out, i);
-};
-
-
-
-template <int dim>
-void Triangulation<dim>::print_gnuplot (ostream &out, const unsigned int level) const {
- active_cell_iterator cell = begin_active (level),
- endc = (level == levels.size()-1 ?
- active_cell_iterator(end()) :
- begin_active (level+1));
-
- AssertThrow (out, ExcIO());
-
- out << "#Active cells on level " << level
- << ": " << n_active_cells (level) << endl;
- for (; cell != endc; ++cell)
- print_gnuplot (out, cell);
-
- AssertThrow (out, ExcIO());
-};
-
-
-
-#if deal_II_dimension == 1
-
-template <>
-void Triangulation<1>::print_gnuplot (ostream &out,
- const active_cell_iterator & cell) const {
- AssertThrow (out, ExcIO());
-
- out << cell->vertex(0) << ' ' << cell->level() << endl
- << cell->vertex(1) << ' ' << cell->level() << endl
- << endl;
-
- AssertThrow (out, ExcIO());
-};
-
-#endif
-
-
-#if deal_II_dimension == 2
-
-template <>
-void Triangulation<2>::print_gnuplot (ostream &out,
- const active_cell_iterator & cell) const {
- AssertThrow (out, ExcIO());
-
- out << cell->vertex(0) << ' ' << cell->level() << endl
- << cell->vertex(1) << ' ' << cell->level() << endl
- << cell->vertex(2) << ' ' << cell->level() << endl
- << cell->vertex(3) << ' ' << cell->level() << endl
- << cell->vertex(0) << ' ' << cell->level() << endl
- << endl // double new line for gnuplot 3d plots
- << endl;
-
- AssertThrow (out, ExcIO());
-};
-
-#endif
-
-
-#if deal_II_dimension == 3
-
-template <>
-void Triangulation<3>::print_gnuplot (ostream &out,
- const active_cell_iterator & cell) const {
- AssertThrow (out, ExcIO());
-
- // front face
- out << cell->vertex(0) << ' ' << cell->level() << endl
- << cell->vertex(1) << ' ' << cell->level() << endl
- << cell->vertex(2) << ' ' << cell->level() << endl
- << cell->vertex(3) << ' ' << cell->level() << endl
- << cell->vertex(0) << ' ' << cell->level() << endl
- << endl;
- // back face
- out << cell->vertex(4) << ' ' << cell->level() << endl
- << cell->vertex(5) << ' ' << cell->level() << endl
- << cell->vertex(6) << ' ' << cell->level() << endl
- << cell->vertex(7) << ' ' << cell->level() << endl
- << cell->vertex(4) << ' ' << cell->level() << endl
- << endl;
-
- // now for the four connecting lines
- out << cell->vertex(0) << ' ' << cell->level() << endl
- << cell->vertex(4) << ' ' << cell->level() << endl
- << endl;
- out << cell->vertex(1) << ' ' << cell->level() << endl
- << cell->vertex(5) << ' ' << cell->level() << endl
- << endl;
- out << cell->vertex(2) << ' ' << cell->level() << endl
- << cell->vertex(6) << ' ' << cell->level() << endl
- << endl;
- out << cell->vertex(3) << ' ' << cell->level() << endl
- << cell->vertex(7) << ' ' << cell->level() << endl
- << endl;
-
- AssertThrow (out, ExcIO());
-};
-
-#endif
-
-
-
-
template <int dim>
template <typename number>
void Triangulation<dim>::refine (const Vector<number> &criteria,
#if deal_II_dimension == 2
-template <>
-void DataOut<2>::write_epsgrid (ostream &out) const {
- Assert (dofs != 0, ExcNoDoFHandlerSelected());
-
- // write preamble
- if (true)
- {
- // block this to have local
- // variables destroyed after
- // use
- time_t time1= time (0);
- tm *time = localtime(&time1);
- out << "%!PS-Adobe-2.0 EPSF-1.2" << endl
- << "%%Title: deal.II Output" << endl
- << "%%Creator: the deal.II library" << endl
- << "%%Creation Date: "
- << time->tm_year+1900 << "/"
- << time->tm_mon+1 << "/"
- << time->tm_mday << " - "
- << time->tm_hour << ":"
- << setw(2) << time->tm_min << ":"
- << setw(2) << time->tm_sec << endl
- << "%%BoundingBox: 0 0 310 310" << endl;
- };
-
- // Get scaling factors for Bounding Box 310 x 310
-
- DoFHandler<2>::active_cell_iterator cell;
- DoFHandler<2>::active_cell_iterator endc = dofs->end();
- double x, y, xmin=0, xmax=0, ymin=0, ymax=0, scale, xofs, yofs;
- int i;
-
- for (cell=dofs->begin_active(); cell!=endc; ++cell)
- {
- for (i=0; i<4; i++)
- {
- x=cell->vertex(i)(0);
- y=cell->vertex(i)(1);
- xmin = ( x < xmin ? x : xmin );
- xmax = ( x > xmax ? x : xmax );
- ymin = ( y < ymin ? y : ymin );
- ymax = ( y > ymax ? y : ymax );
- }
- }
- x = xmax - xmin;
- y = ymax - ymin;
- scale = 300 / (x > y ? x : y);
- xofs = -(xmin*scale)+5;
- yofs = -(ymin*scale)+5;
-
- for (cell=dofs->begin_active(); cell!=endc; ++cell)
- {
- out << (cell->vertex(0)(0))*scale+xofs << " "
- << (cell->vertex(0)(1))*scale+yofs << " moveto "
- << (cell->vertex(1)(0))*scale+xofs << " "
- << (cell->vertex(1)(1))*scale+yofs << " lineto "
- << (cell->vertex(2)(0))*scale+xofs << " "
- << (cell->vertex(2)(1))*scale+yofs << " lineto "
- << (cell->vertex(3)(0))*scale+xofs << " "
- << (cell->vertex(3)(1))*scale+yofs << " lineto "
- << (cell->vertex(0)(0))*scale+xofs << " "
- << (cell->vertex(0)(1))*scale+yofs << " lineto "
- << " closepath stroke" << endl;
- };
- out << "showpage" << endl;
-
- AssertThrow (out, ExcIO());
-};
-
-
-
template <>
void DataOut<2>::write_eps (ostream &out, const EpsOutputData &eod) const {
Assert (dofs != 0, ExcNoDoFHandlerSelected());
-template <int dim>
-void DataOut<dim>::write_epsgrid (ostream &/*out*/) const {
- // this is for all other dimensions that
- // are not explicitely specialized
- Assert (false, ExcNotImplemented());
-};
-
-
template <int dim>
void DataOut<dim>::write_eps (ostream &,
const EpsOutputData &) const{
write_eps(out);
break;
- case epsgrid:
- write_epsgrid(out);
- break;
-
case gmv:
write_gmv (out);
break;
return ".pov";
case eps:
- case epsgrid:
return ".eps";
case gmv:
template <int dim>
DataOut<dim>::OutputFormat
-DataOut<dim>::parse_output_format (const string format_name) {
+DataOut<dim>::parse_output_format (const string &format_name) {
if (format_name == "ucd")
return ucd;
if (format_name == "eps")
return eps;
- if (format_name == "epsgrid")
- return epsgrid;
-
if (format_name == "gmv")
return gmv;
AssertThrow (false, ExcInvalidState ());
+
+ // return something invalid
+ return OutputFormat(-1);
};
template <int dim>
string DataOut<dim>::get_output_format_names () {
- return "ucd|gnuplot|gnuplot draft|povray mesh|eps|epsgrid|gmv";
+ return "ucd|gnuplot|gnuplot draft|povray mesh|eps|gmv";
};
+#include <basic/grid_io.h>
#include <grid/dof.h>
#include <grid/tria.h>
#include <fe/fe_lib.lagrange.h>
cout << " Writing grid..." << endl;
ofstream out((file_prefix + prm.get("Grid file")).c_str());
- tria->print_gnuplot (out);
+ GridOut::write_gnuplot (tria, out);
#include <grid/grid_generator.h>
#include <base/function.h>
#include <basic/data_io.h>
+#include <basic/grid_io.h>
#include <base/parameter_handler.h>
#include <fe/fe_lib.lagrange.h>
#include <base/quadrature_lib.h>
filename += "finest_mesh.gnuplot";
cout << " Writing finest grid to <" << filename << ">... " << endl;
ofstream finest_mesh (filename.c_str());
- tria->print_gnuplot (finest_mesh);
+ GridOut::write_gnuplot (tria, finest_mesh);
finest_mesh.close();
print_history (prm, refine_mode);
#include <grid/tria_iterator.h>
#include <grid/tria.h>
#include <grid/grid_generator.h>
+#include <basic/grid_io.h>
#include <fstream>
#include <string>
#include <cmath>
Ball<dim> ball;
CurvedLine<dim> curved_line;
if (test_case==2)
- tria.set_boundary (&ball);
- else
- tria.set_boundary (&curved_line);
+ {
+ tria.set_boundary (0, ball);
+ tria.set_boundary (1, ball);
+ } else {
+ tria.set_boundary (0, curved_line);
+ tria.set_boundary (1, curved_line);
+ };
// refine once
tria.begin_active()->set_refine_flag();
};
tria.set_boundary (0);
+ tria.set_boundary (1);
+
break;
}
filename += ('0'+test_case);
ofstream out(filename.c_str());
- tria.print_gnuplot (out);
+ GridOut::write_gnuplot (tria, out);
cout << " Total number of cells = " << tria.n_cells() << endl
<< " Total number of active cells = " << tria.n_active_cells() << endl;