32 namespace TriangulationImplementation
37 const unsigned int new_objects_single)
43 reverse_order_next_free_single =
false;
47 unsigned int n_objects = 0;
48 unsigned int n_unused_pairs = 0;
49 unsigned int n_unused_singles = 0;
50 for (
unsigned int i = 0; i < used.size(); ++i)
54 else if (i + 1 < used.size())
59 if (next_free_single == 0)
65 if (next_free_pair == 0)
73 Assert(n_objects + 2 * n_unused_pairs + n_unused_singles == used.size(),
78 const int additional_single_objects =
79 new_objects_single - n_unused_singles;
81 unsigned int new_size =
82 used.size() + new_objects_in_pairs - 2 * n_unused_pairs;
83 if (additional_single_objects > 0)
84 new_size += additional_single_objects;
87 if (new_size > cells.size())
89 cells.reserve(new_size);
90 cells.insert(cells.end(), new_size - cells.size(), G());
92 used.reserve(new_size);
93 used.insert(used.end(), new_size - used.size(),
false);
95 user_flags.reserve(new_size);
96 user_flags.insert(user_flags.end(),
97 new_size - user_flags.size(),
100 const unsigned int factor =
102 children.reserve(factor * new_size);
103 children.insert(children.end(),
104 factor * new_size - children.size(),
107 if (G::dimension > 1)
109 refinement_cases.reserve(new_size);
110 refinement_cases.insert(
111 refinement_cases.end(),
112 new_size - refinement_cases.size(),
118 boundary_or_material_id.reserve(new_size);
119 boundary_or_material_id.resize(new_size);
121 user_data.reserve(new_size);
122 user_data.resize(new_size);
130 if (n_unused_singles == 0)
132 next_free_single = new_size - 1;
133 reverse_order_next_free_single =
true;
139 template <
int dim,
int spacedim>
140 typename ::Triangulation<dim, spacedim>::raw_hex_iterator
142 const ::Triangulation<dim, spacedim> &tria,
143 const unsigned int level)
148 int pos = next_free_pair, last = used.size() - 1;
149 for (; pos < last; ++pos)
158 return tria.end_hex();
160 next_free_pair = pos + 2;
163 typename ::Triangulation<dim, spacedim>::raw_hex_iterator(&tria,
172 const unsigned int new_size =
173 new_hexes + std::count(
used.begin(),
used.end(),
true);
176 if (new_size >
cells.size())
178 cells.reserve(new_size);
181 used.reserve(new_size);
235 const unsigned int new_quads_single)
245 unsigned int n_quads = 0;
246 unsigned int n_unused_pairs = 0;
247 unsigned int n_unused_singles = 0;
248 for (
unsigned int i = 0; i <
used.size(); ++i)
252 else if (i + 1 <
used.size())
271 Assert(n_quads + 2 * n_unused_pairs + n_unused_singles ==
used.size(),
275 const int additional_single_quads = new_quads_single - n_unused_singles;
277 unsigned int new_size =
278 used.size() + new_quads_in_pairs - 2 * n_unused_pairs;
279 if (additional_single_quads > 0)
280 new_size += additional_single_quads;
283 if (new_size >
cells.size())
296 if (n_unused_singles == 0)
308 Assert(cells.size() == used.size(),
309 ExcMemoryInexact(cells.size(), used.size()));
310 Assert(cells.size() == user_flags.size(),
311 ExcMemoryInexact(cells.size(), user_flags.size()));
312 Assert(cells.size() == children.size(),
313 ExcMemoryInexact(cells.size(), children.size()));
314 Assert(cells.size() == boundary_or_material_id.size(),
315 ExcMemoryInexact(cells.size(), boundary_or_material_id.size()));
317 ExcMemoryInexact(cells.size(),
manifold_id.size()));
318 Assert(cells.size() == user_data.size(),
319 ExcMemoryInexact(cells.size(), user_data.size()));
327 Assert(cells.size() == used.size(),
328 ExcMemoryInexact(cells.size(), used.size()));
329 Assert(cells.size() == user_flags.size(),
330 ExcMemoryInexact(cells.size(), user_flags.size()));
331 Assert(2 * cells.size() == children.size(),
332 ExcMemoryInexact(cells.size(), children.size()));
333 Assert(cells.size() == refinement_cases.size(),
334 ExcMemoryInexact(cells.size(), refinement_cases.size()));
335 Assert(cells.size() == boundary_or_material_id.size(),
336 ExcMemoryInexact(cells.size(), boundary_or_material_id.size()));
338 ExcMemoryInexact(cells.size(),
manifold_id.size()));
339 Assert(cells.size() == user_data.size(),
340 ExcMemoryInexact(cells.size(), user_data.size()));
388 template <
typename G>
394 refinement_cases.clear();
397 boundary_or_material_id.clear();
400 user_data_type = data_unknown;
422 template <
typename G>
433 user_data.capacity() *
sizeof(UserData) +
sizeof(user_data));
461 # include "tria_objects.inst"