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>
65 template <
int dim,
int spacedim>
70 refine_flags.push_back (std::vector<bool>());
71 coarsen_flags.push_back (std::vector<bool>());
72 this->save_refine_flags (refine_flags.back());
73 this->save_coarsen_flags (coarsen_flags.back());
84 template <
int dim,
int spacedim>
90 for (
unsigned int i=0; i<refine_flags.size()+1; ++i)
96 template <
int dim,
int spacedim>
111 Assert(step<refine_flags.size()+1,
114 this->load_refine_flags (refine_flags[@ref step_1
"step-1"]);
115 this->load_coarsen_flags (coarsen_flags[@ref step_1
"step-1"]);
123 template <
int dim,
int spacedim>
127 return refine_flags.size();
132 template <
int dim,
int spacedim>
137 coarse_grid = &old_grid;
138 refine_flags.
clear ();
139 coarsen_flags.clear ();
144 template <
int dim,
int spacedim>
155 template <
int dim,
int spacedim>
167 template <
int dim,
int spacedim>
171 const unsigned int n_flag_levels=refine_flags.size();
175 out << mn_persistent_tria_flags_begin <<
' ' << n_flag_levels << std::endl;
177 for (
unsigned int i=0; i<n_flag_levels; ++i)
179 this->write_bool_vector (mn_tria_refine_flags_begin, refine_flags[i],
180 mn_tria_refine_flags_end, out);
181 this->write_bool_vector (mn_tria_coarsen_flags_begin, coarsen_flags[i],
182 mn_tria_coarsen_flags_end, out);
185 out << mn_persistent_tria_flags_end << std::endl;
192 template <
int dim,
int spacedim>
196 Assert(refine_flags.size()==0 && coarsen_flags.size()==0,
197 ExcFlagsNotCleared());
200 unsigned int magic_number;
202 AssertThrow(magic_number==mn_persistent_tria_flags_begin,
205 unsigned int n_flag_levels;
207 for (
unsigned int i=0; i<n_flag_levels; ++i)
209 refine_flags.push_back (std::vector<bool>());
210 coarsen_flags.push_back (std::vector<bool>());
211 this->read_bool_vector (mn_tria_refine_flags_begin, refine_flags.back(),
212 mn_tria_refine_flags_end, in);
213 this->read_bool_vector (mn_tria_coarsen_flags_begin, coarsen_flags.back(),
214 mn_tria_coarsen_flags_end, in);
218 AssertThrow(magic_number==mn_persistent_tria_flags_end,
226 template <
int dim,
int spacedim>
230 refine_flags.clear();
231 coarsen_flags.clear();
236 template <
int dim,
int spacedim>
254 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)
virtual ~PersistentTriangulation()
PersistentTriangulation(const Triangulation< dim, spacedim > &coarse_grid)
virtual void write_flags(std::ostream &out) const
std_cxx11::enable_if< std_cxx11::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
static ::ExceptionBase & ExcTriaNotEmpty()
virtual void copy_triangulation(const Triangulation< dim, spacedim > &tria)
virtual void read_flags(std::istream &in)