* is not useful in the context of this
* class.
*/
- virtual void block_write (ostream &out) const;
+ virtual void create_triangulation (const vector<Point<dim> > &vertices,
+ const vector<CellData<dim> > &cells,
+ const SubCellData &subcelldata);
/**
- * Throw an error, since this function
- * is not useful in the context of this
- * class.
+ * Writes all refine flag to the ostream
+ * #out#.
*/
- virtual void block_read (istream &in);
+ virtual void write_flags(ostream &out) const;
/**
- * Throw an error, since this function
- * is not useful in the context of this
- * class.
+ * Loads all refine flags that previously
+ * were written by #save_refine_flags(...)#.
*/
- virtual void create_triangulation (const vector<Point<dim> > &vertices,
- const vector<CellData<dim> > &cells,
- const SubCellData &subcelldata);
+ virtual void read_flags(istream &in);
/**
* Exception.
/* $Id$ */
#include <grid/persistent_tria.h>
+#include <basic/magic_numbers.h>
+#include <iostream>
template <int dim>
};
-
template <int dim>
void
-PersistentTriangulation<dim>::block_write (ostream &) const
+PersistentTriangulation<dim>::create_triangulation (const vector<Point<dim> > &,
+ const vector<CellData<dim> > &,
+ const SubCellData &)
{
Assert (false, ExcFunctionNotUseful());
};
template <int dim>
void
-PersistentTriangulation<dim>::block_read (istream &)
+PersistentTriangulation<dim>::write_flags(ostream &out) const
{
- Assert (false, ExcFunctionNotUseful());
-};
+ const unsigned int n_flag_levels=refine_flags.size();
+
+ AssertThrow (out, ExcIO());
+
+ out << mn_persistent_tria_flags_begin << ' ' << n_flag_levels << endl;
+
+ for (unsigned int i=0; i<n_flag_levels; ++i)
+ {
+ write_bool_vector (mn_tria_refine_flags_begin, refine_flags[i],
+ mn_tria_refine_flags_end, out);
+ write_bool_vector (mn_tria_coarsen_flags_begin, coarsen_flags[i],
+ mn_tria_coarsen_flags_end, out);
+ }
+
+ out << mn_persistent_tria_flags_end << endl;
+
+ AssertThrow (out, ExcIO());
+}
template <int dim>
void
-PersistentTriangulation<dim>::create_triangulation (const vector<Point<dim> > &,
- const vector<CellData<dim> > &,
- const SubCellData &)
+PersistentTriangulation<dim>::read_flags(istream &in)
{
- Assert (false, ExcFunctionNotUseful());
-};
+ Assert(refine_flags.size()==0 && coarsen_flags.size()==0, ExcTriaNotEmpty());
+ AssertThrow (in, ExcIO());
+ unsigned int magic_number;
+ in >> magic_number;
+ AssertThrow(magic_number==mn_persistent_tria_flags_begin, ExcGridReadError());
+
+ unsigned int n_flag_levels;
+ in >> n_flag_levels;
+ for (unsigned int i=0; i<n_flag_levels; ++i)
+ {
+ refine_flags.push_back (vector<bool>());
+ coarsen_flags.push_back (vector<bool>());
+ read_bool_vector (mn_tria_refine_flags_begin, refine_flags.back(),
+ mn_tria_refine_flags_end, in);
+ read_bool_vector (mn_tria_coarsen_flags_begin, coarsen_flags.back(),
+ mn_tria_coarsen_flags_end, in);
+ }
+
+ in >> magic_number;
+ AssertThrow(magic_number==mn_persistent_tria_flags_end, ExcGridReadError());
+
+ AssertThrow (in, ExcIO());
+}
// explicit instantiations