16 #include <deal.II/base/memory_consumption.h> 18 #include <deal.II/grid/magic_numbers.h> 19 #include <deal.II/grid/persistent_tria.h> 23 DEAL_II_NAMESPACE_OPEN
26 template <
int dim,
int spacedim>
29 template <
int dim,
int spacedim>
33 template <
int dim,
int spacedim>
36 : coarse_grid(&coarse_grid, typeid(*this).name())
41 template <
int dim,
int spacedim>
48 , coarse_grid(old_tria.coarse_grid)
49 , refine_flags(old_tria.refine_flags)
50 , coarsen_flags(old_tria.coarsen_flags)
57 template <
int dim,
int spacedim>
62 refine_flags.emplace_back();
63 coarsen_flags.emplace_back();
64 this->save_refine_flags(refine_flags.back());
65 this->save_coarsen_flags(coarsen_flags.back());
76 template <
int dim,
int spacedim>
82 for (
unsigned int i = 0; i < refine_flags.size() + 1; ++i)
88 template <
int dim,
int spacedim>
102 Assert(step < refine_flags.size() + 1,
105 this->load_refine_flags(refine_flags[step - 1]);
106 this->load_coarsen_flags(coarsen_flags[step - 1]);
114 template <
int dim,
int spacedim>
118 return refine_flags.size();
123 template <
int dim,
int spacedim>
129 coarse_grid = &old_grid;
130 refine_flags.
clear();
131 coarsen_flags.clear();
136 template <
int dim,
int spacedim>
148 template <
int dim,
int spacedim>
160 template <
int dim,
int spacedim>
164 const unsigned int n_flag_levels = refine_flags.size();
168 out << mn_persistent_tria_flags_begin <<
' ' << n_flag_levels << std::endl;
170 for (
unsigned int i = 0; i < n_flag_levels; ++i)
172 this->write_bool_vector(mn_tria_refine_flags_begin,
174 mn_tria_refine_flags_end,
176 this->write_bool_vector(mn_tria_coarsen_flags_begin,
178 mn_tria_coarsen_flags_end,
182 out << mn_persistent_tria_flags_end << std::endl;
189 template <
int dim,
int spacedim>
193 Assert(refine_flags.size() == 0 && coarsen_flags.size() == 0,
194 ExcFlagsNotCleared());
197 unsigned int magic_number;
199 AssertThrow(magic_number == mn_persistent_tria_flags_begin,
202 unsigned int n_flag_levels;
204 for (
unsigned int i = 0; i < n_flag_levels; ++i)
206 refine_flags.emplace_back();
207 coarsen_flags.emplace_back();
208 this->read_bool_vector(mn_tria_refine_flags_begin,
210 mn_tria_refine_flags_end,
212 this->read_bool_vector(mn_tria_coarsen_flags_begin,
213 coarsen_flags.back(),
214 mn_tria_coarsen_flags_end,
219 AssertThrow(magic_number == mn_persistent_tria_flags_end,
227 template <
int dim,
int spacedim>
231 refine_flags.clear();
232 coarsen_flags.clear();
237 template <
int dim,
int spacedim>
255 DEAL_II_NAMESPACE_CLOSE
virtual void copy_triangulation(const Triangulation< dim, spacedim > &other_tria)
static ::ExceptionBase & ExcIO()
unsigned int n_refinement_steps() const
virtual void clear_flags()
virtual void create_triangulation(const std::vector< Point< spacedim >> &vertices, const std::vector< CellData< dim >> &cells, const SubCellData &subcelldata) override
#define AssertThrow(cond, exc)
virtual void execute_coarsening_and_refinement() override
unsigned int n_levels() const
virtual std::size_t memory_consumption() const override
virtual void execute_coarsening_and_refinement()
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
virtual void copy_triangulation(const Triangulation< dim, spacedim > &tria) override
virtual void create_triangulation_compatibility(const std::vector< Point< spacedim >> &vertices, const std::vector< CellData< dim >> &cells, const SubCellData &subcelldata) override
PersistentTriangulation(const Triangulation< dim, spacedim > &coarse_grid)
virtual void write_flags(std::ostream &out) const
static ::ExceptionBase & ExcTriaNotEmpty()
virtual void read_flags(std::istream &in)
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)