* plot of the (#x-2#)th data set. For example, using #x=4# would mean to
* plot the second data set.
*
+ *
+ * \subsection{POVRAY format}
+ *
+ * POVRAY is a ray tracing tool in the public domain and poduces high quality
+ * images of three dimensional scenes. Since this tool can handle only one
+ * scene at a time, only the first data vector is output, but this may change
+ * in future versions of this library. For a reference of the data format
+ * and the usage of POVRAY see the extensive manual of that program.
+ *
+ * The POVRAY output format is presently only supported for two spatial
+ * dimensions. It displays every quadrilateral as two triangles, which clearly
+ * is not an optimal solution, but necessary since POVRAY presently does not
+ * support bilinear quadrilaterals and using polygons as vastly suboptimal in
+ * term of memory and speed to the triangle mesh supported by POVRAY.
+ *
+ *
* @author Wolfgang Bangerth, 1998
*/
template <int dim>
* Provide a data type specifying the
* presently supported output formats.
*/
- enum OutputFormat { ucd, gnuplot };
+ enum OutputFormat { ucd, gnuplot, povray };
/**
* Constructor
*/
void write_gnuplot (ostream &out) const;
+ /**
+ * Write data of first vector and grid
+ * in POVRAY format.
+ */
+ void write_povray (ostream &out) const;
+
/**
* Write data and grid to #out# according
* to the given data format. This function
* \begin{itemize}
* \item UCD: #.inp#
* \item GNUPLOT: #.gnuplot#
+ * \item POVRAY: #.pov#
* \end{itemize}
*
* Since this function does not need data
<< setw(2) << time->tm_min << ":"
<< setw(2) << time->tm_sec << endl
<< "#" << endl
- << "# For a description of the UCD format see the AVS Developers guide."
+ << "# For a description of the GNUPLOT format see the GNUPLOT manual."
<< endl
<< "#" << endl
<< "# ";
};
};
+
+
+template <>
+void DataOut<2>::write_povray (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 << "/*" << endl
+ << "This file was generated by the deal.II library." << endl
+ << "Date = "
+ << time->tm_year+1900 << "/"
+ << time->tm_mon+1 << "/"
+ << time->tm_mday << endl
+ << "Time = "
+ << time->tm_hour << ":"
+ << setw(2) << time->tm_min << ":"
+ << setw(2) << time->tm_sec << endl
+ << endl
+ << "For a description of the POVRAY format see the POVRAY manual."
+ << endl
+ << endl
+ << "*/"
+ << endl << endl;
+ };
+
+ // write list of include files
+ out << "#include \"colors.inc\"" << endl
+ << endl;
+
+ // declare standard texture
+ out << "#declare default_texture = texture {" << endl
+ << " pigment { color rgb<0.2, 0.2, 0.8> }" << endl
+ << " finish { ambient 0.2 diffuse 0.5 }" << endl
+ << "}" << endl << endl;
+
+ // write camera and light sources
+ out << "camera {" << endl
+ << " location <-1, -3, 2>" << endl
+ << " look_at <1.5, 3.5, -2>" << endl
+ << "}" << endl
+ << endl
+ << "light_source {" << endl
+ << " <-1, 2, 2> White" << endl
+ << "}" << endl
+ << endl;
+
+
+ // write frame object
+ out << "mesh {" << endl;
+
+ DoFHandler<2>::active_cell_iterator cell;
+ DoFHandler<2>::active_cell_iterator endc = dofs->end();
+
+ for (cell=dofs->begin_active(); cell!=endc; ++cell)
+ {
+ // write cell as two triangles
+ out << " triangle { ";
+ out << '<' << cell->vertex(0)(0) << ',' << cell->vertex(0)(1) << ','
+ << (*data[0].data)(cell->vertex_dof_index(0,0)) << '>'
+ << ", "
+ << '<' << cell->vertex(1)(0) << ',' << cell->vertex(1)(1) << ','
+ << (*data[0].data)(cell->vertex_dof_index(1,0)) << '>'
+ << ", "
+ << '<' << cell->vertex(2)(0) << ',' << cell->vertex(2)(1) << ','
+ << (*data[0].data)(cell->vertex_dof_index(2,0)) << '>'
+ << endl
+ << " texture { default_texture }" << endl
+ << " }"
+ << endl;
+ out << " triangle { ";
+ out << '<' << cell->vertex(0)(0) << ',' << cell->vertex(0)(1) << ','
+ << (*data[0].data)(cell->vertex_dof_index(0,0)) << '>'
+ << ", "
+ << '<' << cell->vertex(2)(0) << ',' << cell->vertex(2)(1) << ','
+ << (*data[0].data)(cell->vertex_dof_index(2,0)) << '>'
+ << ", "
+ << '<' << cell->vertex(3)(0) << ',' << cell->vertex(3)(1) << ','
+ << (*data[0].data)(cell->vertex_dof_index(3,0)) << '>'
+ << endl
+ << " texture { default_texture }" << endl
+ << " }"
+ << endl;
+ };
+ out << "}";
+};
+
template <int dim>
case gnuplot:
write_gnuplot (out);
break;
+ case povray:
+ write_povray (out);
+ break;
default:
Assert (false, ExcNotImplemented());
};
return ".inp";
case gnuplot:
return ".gnuplot";
+ case povray:
+ return ".pov";
default:
Assert (false, ExcNotImplemented());
return "";