16 #include <deal.II/base/memory_consumption.h> 17 #include <deal.II/grid/persistent_tria.h> 18 #include <deal.II/grid/magic_numbers.h> 21 DEAL_II_NAMESPACE_OPEN
24 template <
int dim,
int spacedim>
28 template <
int dim,
int spacedim>
33 template <
int dim,
int spacedim>
37 coarse_grid (&coarse_grid, typeid(*this).name())
42 template <
int dim,
int spacedim>
50 coarse_grid (old_tria.coarse_grid),
51 refine_flags (old_tria.refine_flags),
52 coarsen_flags (old_tria.coarsen_flags)
59 template <
int dim,
int spacedim>
64 refine_flags.emplace_back ();
65 coarsen_flags.emplace_back ();
66 this->save_refine_flags (refine_flags.back());
67 this->save_coarsen_flags (coarsen_flags.back());
78 template <
int dim,
int spacedim>
84 for (
unsigned int i=0; i<refine_flags.size()+1; ++i)
90 template <
int dim,
int spacedim>
105 Assert(step<refine_flags.size()+1,
108 this->load_refine_flags (refine_flags[@ref step_1
"step-1"]);
109 this->load_coarsen_flags (coarsen_flags[@ref step_1
"step-1"]);
117 template <
int dim,
int spacedim>
121 return refine_flags.size();
126 template <
int dim,
int spacedim>
131 coarse_grid = &old_grid;
132 refine_flags.
clear ();
133 coarsen_flags.clear ();
138 template <
int dim,
int spacedim>
149 template <
int dim,
int spacedim>
161 template <
int dim,
int spacedim>
165 const unsigned int n_flag_levels=refine_flags.size();
169 out << mn_persistent_tria_flags_begin <<
' ' << n_flag_levels << std::endl;
171 for (
unsigned int i=0; i<n_flag_levels; ++i)
173 this->write_bool_vector (mn_tria_refine_flags_begin, refine_flags[i],
174 mn_tria_refine_flags_end, out);
175 this->write_bool_vector (mn_tria_coarsen_flags_begin, coarsen_flags[i],
176 mn_tria_coarsen_flags_end, out);
179 out << mn_persistent_tria_flags_end << std::endl;
186 template <
int dim,
int spacedim>
190 Assert(refine_flags.size()==0 && coarsen_flags.size()==0,
191 ExcFlagsNotCleared());
194 unsigned int magic_number;
196 AssertThrow(magic_number==mn_persistent_tria_flags_begin,
199 unsigned int n_flag_levels;
201 for (
unsigned int i=0; i<n_flag_levels; ++i)
203 refine_flags.emplace_back ();
204 coarsen_flags.emplace_back ();
205 this->read_bool_vector (mn_tria_refine_flags_begin, refine_flags.back(),
206 mn_tria_refine_flags_end, in);
207 this->read_bool_vector (mn_tria_coarsen_flags_begin, coarsen_flags.back(),
208 mn_tria_coarsen_flags_end, in);
212 AssertThrow(magic_number==mn_persistent_tria_flags_end,
220 template <
int dim,
int spacedim>
224 refine_flags.clear();
225 coarsen_flags.clear();
230 template <
int dim,
int spacedim>
248 DEAL_II_NAMESPACE_CLOSE
virtual void copy_triangulation(const Triangulation< dim, spacedim > &other_tria)
virtual void create_triangulation_compatibility(const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata)
static ::ExceptionBase & ExcIO()
unsigned int n_refinement_steps() const
virtual void execute_coarsening_and_refinement()
virtual std::size_t memory_consumption() const
virtual void clear_flags()
#define AssertThrow(cond, exc)
unsigned int n_levels() const
virtual void execute_coarsening_and_refinement()
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
virtual void create_triangulation(const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
PersistentTriangulation(const Triangulation< dim, spacedim > &coarse_grid)
virtual void write_flags(std::ostream &out) const
static ::ExceptionBase & ExcTriaNotEmpty()
virtual void copy_triangulation(const Triangulation< dim, spacedim > &tria)
virtual void read_flags(std::istream &in)
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)