* List of data elements.
*/
vector<DataEntry> data;
+
+
+ /**
+ * Return the number of faces in the
+ * triangulation which have a boundary
+ * indicator not equal to zero. Only
+ * these faces are explicitely printed
+ * in the #write_*# functions;
+ * all faces with indicator 255 are
+ * interior ones and an indicator with
+ * value zero for faces at the boundary
+ * are considered default.
+ *
+ * This function always returns an empty
+ * list in one dimension.
+ *
+ * The reason for this function is the
+ * same as for #write_ucd_faces#. See
+ * there for more information.
+ */
+ unsigned int n_boundary_faces () const;
+
+ /**
+ * Write the grid information about
+ * faces to #out#. Only those faces
+ * are printed which are on the boundary
+ * and which have a boundary indicator
+ * not equal to zero, since the latter
+ * is the default for boundary faces.
+ *
+ * Since cells and faces are continuously
+ * numbered, the #starting_index# for
+ * the numbering of the faces is passed
+ * also.
+ *
+ * This function unfortunately can not
+ * be included in the regular #write_ucd#
+ * function, since it needs special
+ * treatment for the case #dim==1#, in
+ * which case the face iterators are
+ * #void*#'s and lack the member functions
+ * which are called. We would not actually
+ * call these functions, but the compiler
+ * would complain anyway when compiling
+ * the function for #dim==1#. Bad luck.
+ */
+ void write_ucd_faces (ostream &out,
+ const unsigned int starting_index) const;
};
DoFHandler<dim>::active_cell_iterator cell,
endc = dofs->end();
unsigned int n_vertex_dofs;
-
+
// first loop over all cells to
// find out how many degrees of
// freedom there are located on
// start with ucd data
out << n_vertex_dofs << ' '
- << dofs->get_tria().n_active_cells() << ' '
+ << dofs->get_tria().n_active_cells() + n_boundary_faces() << ' '
<< data.size() << ' '
<< 0 << ' ' // no cell data
<< 0 // no model data
// we do not use cell data)
if (true)
{
- unsigned int c;
- for (cell=dofs->begin_active(), c=0; cell!=endc; ++cell, ++c)
+ unsigned int index;
+ for (cell=dofs->begin_active(), index=0; cell!=endc; ++cell, ++index)
{
- out << c << ' '
- << 1 << " "; // material id (unused)
+ out << 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;
+ case 1: out << "line "; break;
+ case 2: out << "quad "; break;
+ case 3: out << "hex "; break;
+ default:
+ Assert (false, ExcNotImplemented());
};
for (unsigned int vertex=0; vertex<(1<<dim); ++vertex)
out << cell->vertex_dof_index(vertex,0) << ' ';
out << endl;
};
+
+ write_ucd_faces (out, index);
};
// if data given: write data, else
+template <>
+unsigned int DataOut<1>::n_boundary_faces () const {
+ return 0;
+};
+
+
+
+template <int dim>
+unsigned int DataOut<dim>::n_boundary_faces () const {
+ typename DoFHandler<dim>::active_face_iterator face, endf;
+ unsigned long int n_faces = 0;
+
+ for (face=dofs->begin_active_face(), endf=dofs->end_face();
+ face != endf; ++face)
+ if ((face->boundary_indicator() != 0) &&
+ (face->boundary_indicator() != 255))
+ n_faces++;
+
+ return n_faces;
+};
+
+
+
+template <>
+void DataOut<1>::write_ucd_faces (ostream &, const unsigned int) const {
+ return;
+};
+
+
+
+template <int dim>
+void DataOut<dim>::write_ucd_faces (ostream &out,
+ const unsigned int starting_index) const {
+ typename DoFHandler<dim>::active_face_iterator face, endf;
+ unsigned int index=starting_index;
+
+ for (face=dofs->begin_active_face(), endf=dofs->end_face();
+ face != endf; ++face)
+ if ((face->boundary_indicator() != 0) &&
+ (face->boundary_indicator() != 255))
+ {
+ out << index << " "
+ << static_cast<unsigned int>(face->boundary_indicator())
+ << " ";
+ switch (dim)
+ {
+ case 2: out << "line "; break;
+ case 3: out << "quad "; break;
+ default:
+ Assert (false, ExcNotImplemented());
+ };
+ for (unsigned int vertex=0; vertex<(1<<(dim-1)); ++vertex)
+ out << face->vertex_dof_index(vertex,0) << ' ';
+ out << endl;
+
+ ++index;
+ };
+};
+
+
+
+
+
template <int dim>
void DataOut<dim>::write_gnuplot (ostream &out) const {
Assert (dofs != 0, ExcNoDoFHandlerSelected());