* into this file. Additional cell-based data can be saved using
* register_data_attach().
*/
- virtual void
- save(const std::string &filename) const = 0;
+ using Triangulation<dim, spacedim>::save;
+
/**
* Load the triangulation saved with save() back in. Cell-based data that
* was saved with register_data_attach() can be read in with
* notify_ready_to_unpack() after calling load().
*/
- virtual void
- load(const std::string &filename) = 0;
+ using Triangulation<dim, spacedim>::load;
+
/**
* @copydoc load()
load(Archive &ar, const unsigned int version);
+ /**
+ * Save the triangulation into the given file. Internally, this
+ * function calls the save funtion which uses BOOST archives. This
+ * is a placeholder implementation that, in the near future, will also
+ * attach the data associated with the triangulation
+ */
+ virtual void
+ save(const std::string &filename) const;
+
+ /**
+ * Load the triangulation saved with save() back in.
+ */
+ virtual void
+ load(const std::string &filename);
+
+
/**
* Declare the (coarse) face pairs given in the argument of this function as
* periodic. This way it is possible to obtain neighbors across periodic
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/tria_levels.h>
+#include <boost/archive/text_iarchive.hpp>
+#include <boost/archive/text_oarchive.hpp>
+
#include <algorithm>
#include <array>
#include <cmath>
+#include <fstream>
#include <functional>
#include <list>
#include <map>
Assert(false, ExcNotImplemented());
}
+template <int dim, int spacedim>
+DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
+void Triangulation<dim, spacedim>::save(const std::string &filename) const
+{
+ // Create boost archive then call alternative version of the save function
+ std::ofstream ofs(filename);
+ boost::archive::text_oarchive oa(ofs, boost::archive::no_header);
+ save(oa, 0);
+}
+template <int dim, int spacedim>
+DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
+void Triangulation<dim, spacedim>::load(const std::string &filename)
+{
+ // Create boost archive then call alternative version of the load function
+ std::ifstream ifs(filename);
+ boost::archive::text_iarchive ia(ifs, boost::archive::no_header);
+ load(ia, 0);
+}
namespace
{