From 77f8e6892d022cc4a0491bb29c2136fdfb4a556f Mon Sep 17 00:00:00 2001 From: hartmann Date: Thu, 15 Jun 2006 07:59:27 +0000 Subject: [PATCH] Changes required for static linking of the library. git-svn-id: https://svn.dealii.org/trunk@13251 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/dofs/dof_accessor.templates.h | 3 +- deal.II/deal.II/include/grid/tria.h | 5 + .../dofs/hp_dof_levels.all_dimensions.cc | 35 +----- deal.II/deal.II/source/dofs/hp_dof_levels.cc | 38 ++++++- deal.II/deal.II/source/grid/tria.cc | 76 +++++++------ deal.II/deal.II/source/grid/tria_accessor.cc | 75 ++++++++++--- .../source/grid/tria_levels.all_dimensions.cc | 103 ++++++++++++++++++ deal.II/deal.II/source/grid/tria_levels.cc | 79 -------------- 8 files changed, 248 insertions(+), 166 deletions(-) create mode 100644 deal.II/deal.II/source/grid/tria_levels.all_dimensions.cc diff --git a/deal.II/deal.II/include/dofs/dof_accessor.templates.h b/deal.II/deal.II/include/dofs/dof_accessor.templates.h index 8cea838d5e..1fa568d72f 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.templates.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.templates.h @@ -569,7 +569,7 @@ DoFCellAccessor >::face (const unsigned int i) const } - +#if deal_II_dimension == 1 template <> inline @@ -608,6 +608,7 @@ get_dof_indices (std::vector &dof_indices) const this->active_fe_index()); } +#endif template <> diff --git a/deal.II/deal.II/include/grid/tria.h b/deal.II/deal.II/include/grid/tria.h index 201f409e7d..6727607fd3 100644 --- a/deal.II/deal.II/include/grid/tria.h +++ b/deal.II/deal.II/include/grid/tria.h @@ -3186,6 +3186,8 @@ template <> Triangulation<1>::raw_face_iterator Triangulation<1>::end_face () co template <> Triangulation<1>::raw_face_iterator Triangulation<1>::last_raw_face () const; template <> Triangulation<1>::face_iterator Triangulation<1>::last_face () const; template <> Triangulation<1>::active_face_iterator Triangulation<1>::last_active_face () const; +template <> Triangulation<1>::raw_line_iterator Triangulation<1>::begin_raw_line (const unsigned int level) const; +template <> Triangulation<1>::raw_line_iterator Triangulation<1>::last_raw_line (const unsigned int level) const; template <> Triangulation<1>::raw_quad_iterator Triangulation<1>::begin_raw_quad (const unsigned int) const; template <> Triangulation<1>::quad_iterator Triangulation<1>::begin_quad (const unsigned int) const; template <> Triangulation<1>::active_quad_iterator Triangulation<1>::begin_active_quad (const unsigned int) const; @@ -3255,9 +3257,12 @@ template <> unsigned int Triangulation<2>::n_active_cells (const unsigned int le template <> unsigned int Triangulation<3>::n_raw_cells (const unsigned int level) const; template <> unsigned int Triangulation<3>::n_cells (const unsigned int level) const; template <> unsigned int Triangulation<3>::n_active_cells (const unsigned int level) const; +template <> unsigned int Triangulation<1>::n_raw_lines (const unsigned int level) const; template <> unsigned int Triangulation<1>::n_quads () const; template <> unsigned int Triangulation<1>::n_quads (const unsigned int) const; template <> unsigned int Triangulation<1>::n_raw_quads (const unsigned int) const; +template <> unsigned int Triangulation<2>::n_raw_quads (const unsigned int) const; +template <> unsigned int Triangulation<1>::n_raw_quads () const; template <> unsigned int Triangulation<1>::n_raw_hexs (const unsigned int) const; template <> unsigned int Triangulation<1>::n_active_quads (const unsigned int) const; template <> unsigned int Triangulation<1>::n_active_quads () const; diff --git a/deal.II/deal.II/source/dofs/hp_dof_levels.all_dimensions.cc b/deal.II/deal.II/source/dofs/hp_dof_levels.all_dimensions.cc index 8f5480aa74..0033a41da5 100644 --- a/deal.II/deal.II/source/dofs/hp_dof_levels.all_dimensions.cc +++ b/deal.II/deal.II/source/dofs/hp_dof_levels.all_dimensions.cc @@ -20,45 +20,12 @@ namespace internal { namespace hp { + unsigned int DoFLevel<0>::memory_consumption () const { return MemoryConsumption::memory_consumption (active_fe_indices); } - -#if deal_II_dimension == 1 - - unsigned int - DoFLevel<1>::memory_consumption () const - { - return (DoFLevel<0>::memory_consumption() + - MemoryConsumption::memory_consumption (lines)); - } -#endif - - -#if deal_II_dimension == 2 - - unsigned int - DoFLevel<2>::memory_consumption () const - { - return (DoFLevel<0>::memory_consumption () + - MemoryConsumption::memory_consumption (quads)); - } - -#endif - - -#if deal_II_dimension == 3 - - unsigned int - DoFLevel<3>::memory_consumption () const - { - return (DoFLevel<0>::memory_consumption () + - MemoryConsumption::memory_consumption (hexes)); - } - -#endif } } diff --git a/deal.II/deal.II/source/dofs/hp_dof_levels.cc b/deal.II/deal.II/source/dofs/hp_dof_levels.cc index a733dc64b2..99e204e78c 100644 --- a/deal.II/deal.II/source/dofs/hp_dof_levels.cc +++ b/deal.II/deal.II/source/dofs/hp_dof_levels.cc @@ -13,12 +13,48 @@ #include -#include +#include + namespace internal { namespace hp { +#if deal_II_dimension == 1 + + unsigned int + DoFLevel<1>::memory_consumption () const + { + return (DoFLevel<0>::memory_consumption() + + MemoryConsumption::memory_consumption (lines)); + } + +#endif + + +#if deal_II_dimension == 2 + + unsigned int + DoFLevel<2>::memory_consumption () const + { + return (DoFLevel<0>::memory_consumption () + + MemoryConsumption::memory_consumption (quads)); + } + +#endif + + +#if deal_II_dimension == 3 + + unsigned int + DoFLevel<3>::memory_consumption () const + { + return (DoFLevel<0>::memory_consumption () + + MemoryConsumption::memory_consumption (hexes)); + } + +#endif + } } diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index b21926db7b..5322ff288e 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -161,6 +161,7 @@ Triangulation::get_boundary_indicators () const --------- explicit specialization, which is not allowed. */ #if deal_II_dimension == 1 + template <> Triangulation<1>::cell_iterator Triangulation<1>::begin (const unsigned int level) const @@ -176,17 +177,6 @@ Triangulation<1>::end () const return end_line (); } -template <> -Triangulation<1>::raw_line_iterator -Triangulation<1>::begin_raw_line (const unsigned int level) const; - -template <> -Triangulation<1>::raw_line_iterator -Triangulation<1>::last_raw_line (const unsigned int level) const; - -template <> -unsigned int -Triangulation<1>::n_raw_lines (const unsigned int level) const; #endif @@ -215,9 +205,6 @@ template <> Triangulation<2>::raw_quad_iterator Triangulation<2>::last_raw_quad (const unsigned int level) const; -template <> -unsigned int -Triangulation<2>::n_raw_quads (const unsigned int level) const; #endif @@ -3424,7 +3411,7 @@ Triangulation::begin_raw_line (const unsigned int level) const 0); } - +#if deal_II_dimension == 1 template <> Triangulation<1>::raw_line_iterator @@ -3440,21 +3427,25 @@ Triangulation<1>::begin_raw_line (const unsigned int level) const 0); } +#endif +#if deal_II_dimension == 3 +// TODO: why does specialization not work?! template typename Triangulation::raw_quad_iterator Triangulation::begin_raw_quad (const unsigned int level) const { - Assert (dim>=2,ExcImpossibleInDim(dim)); - Assert (dim<3 || level == 0, ExcFacesHaveNoLevel()) + Assert (level == 0, ExcFacesHaveNoLevel()) return raw_quad_iterator (const_cast*>(this), 0, 0); } +#endif +#if deal_II_dimension == 2 template <> Triangulation<2>::raw_quad_iterator @@ -3470,6 +3461,7 @@ Triangulation<2>::begin_raw_quad (const unsigned int level) const 0); } +#endif template @@ -3630,6 +3622,8 @@ Triangulation::last_raw_line (const unsigned int level) const } +#if deal_II_dimension == 1 + template <> Triangulation<1>::raw_line_iterator Triangulation<1>::last_raw_line (const unsigned int level) const @@ -3643,6 +3637,8 @@ Triangulation<1>::last_raw_line (const unsigned int level) const levels[level]->lines.cells.size()-1); } +#endif + template typename Triangulation::raw_quad_iterator @@ -3655,6 +3651,8 @@ Triangulation::last_raw_quad (const unsigned int level) const } +#if deal_II_dimension == 2 + template <> Triangulation<2>::raw_quad_iterator Triangulation<2>::last_raw_quad (const unsigned int level) const @@ -3668,6 +3666,8 @@ Triangulation<2>::last_raw_quad (const unsigned int level) const levels[level]->quads.cells.size()-1); } +#endif + template typename Triangulation::raw_hex_iterator @@ -4270,40 +4270,37 @@ unsigned int Triangulation::n_quads () const template unsigned int Triangulation::n_quads (const unsigned int level) const { - Assert (level < number_cache.n_quads_level.size(), - ExcIndexRange (level, 0, number_cache.n_quads_level.size())); Assert (dim == 2, ExcFacesHaveNoLevel()); - + Assert (level < number_cache.n_quads_level.size(), + ExcIndexRange (level, 0, number_cache.n_quads_level.size())); return number_cache.n_quads_level[level]; } +#if deal_II_dimension == 2 -template -unsigned int Triangulation::n_raw_quads (const unsigned int) const -{ - Assert (dim <3, ExcFacesHaveNoLevel()); - Assert (dim >2, ExcImpossibleInDim(dim)); - if (dim>2) - return n_raw_quads(); - else - return 0; -} -#if deal_II_dimension == 2 template <> unsigned int Triangulation<2>::n_raw_quads (const unsigned int level) const { Assert(level < n_levels(), ExcIndexRange(level,0,n_levels())); return levels[level]->quads.cells.size(); } + #endif +#if deal_II_dimension == 3 + template <> -unsigned int Triangulation<3>::n_raw_quads () const +unsigned int Triangulation<3>::n_raw_quads (const unsigned int) const { - return faces->quads.cells.size(); + Assert(false, ExcFacesHaveNoLevel()); + return 0; } +#endif + + + template unsigned int Triangulation::n_raw_quads () const @@ -4313,6 +4310,15 @@ unsigned int Triangulation::n_raw_quads () const } +#if deal_II_dimension == 3 + +template <> +unsigned int Triangulation<3>::n_raw_quads () const +{ + return faces->quads.cells.size(); +} + +#endif template unsigned int Triangulation::n_active_quads () const @@ -8937,7 +8943,7 @@ Triangulation::memory_consumption () const } - +#if deal_II_dimension == 1 template <> void Triangulation<1>::update_number_cache_lines () @@ -8987,6 +8993,8 @@ void Triangulation<1>::update_number_cache_lines () } } +#endif + template void Triangulation::update_number_cache_lines () diff --git a/deal.II/deal.II/source/grid/tria_accessor.cc b/deal.II/deal.II/source/grid/tria_accessor.cc index 301f7d738b..24fa3791e5 100644 --- a/deal.II/deal.II/source/grid/tria_accessor.cc +++ b/deal.II/deal.II/source/grid/tria_accessor.cc @@ -37,6 +37,7 @@ set (const internal::Triangulation::Line &line) const } +#if deal_II_dimension == 1 template <> void @@ -47,25 +48,30 @@ set (const internal::Triangulation::Line &line) const ->lines.cells[this->present_index] = line; } +#endif +#if deal_II_dimension == 1 -template -int TriaObjectAccessor<1, dim>::vertex_index (const unsigned int i) const +template <> +int TriaObjectAccessor<1, 1>::vertex_index (const unsigned int i) const { Assert (i<2, ExcIndexRange(i,0,2)); - return this->tria->faces->lines.cells[this->present_index].vertex (i); + return this->tria->levels[this->present_level]->lines.cells[this->present_index].vertex (i); } +#endif -template <> -int TriaObjectAccessor<1, 1>::vertex_index (const unsigned int i) const +#if deal_II_dimension != 1 + +template +int TriaObjectAccessor<1, dim>::vertex_index (const unsigned int i) const { Assert (i<2, ExcIndexRange(i,0,2)); - return this->tria->levels[this->present_level]->lines.cells[this->present_index].vertex (i); + return this->tria->faces->lines.cells[this->present_index].vertex (i); } - +#endif template Point & @@ -85,6 +91,7 @@ void TriaObjectAccessor<1, dim>::set_used_flag () const } +#if deal_II_dimension == 1 template <> void TriaObjectAccessor<1, 1>::set_used_flag () const @@ -94,7 +101,7 @@ void TriaObjectAccessor<1, 1>::set_used_flag () const this->tria->levels[this->present_level]->lines.used[this->present_index] = true; } - +#endif template void TriaObjectAccessor<1, dim>::clear_used_flag () const @@ -105,6 +112,7 @@ void TriaObjectAccessor<1, dim>::clear_used_flag () const } +#if deal_II_dimension == 1 template <> void TriaObjectAccessor<1, 1>::clear_used_flag () const @@ -115,7 +123,7 @@ void TriaObjectAccessor<1, 1>::clear_used_flag () const this->tria->levels[this->present_level]->lines.used[this->present_index] = false; } - +#endif template void TriaObjectAccessor<1, dim>::recursively_set_user_flag () const @@ -149,6 +157,7 @@ void TriaObjectAccessor<1, dim>::set_user_pointer (void *p) const } +#if deal_II_dimension == 1 template <> void TriaObjectAccessor<1, 1>::set_user_pointer (void *p) const @@ -158,7 +167,7 @@ void TriaObjectAccessor<1, 1>::set_user_pointer (void *p) const this->tria->levels[this->present_level]->lines.user_pointers[this->present_index] = p; } - +#endif template void TriaObjectAccessor<1, dim>::clear_user_pointer () const @@ -168,6 +177,7 @@ void TriaObjectAccessor<1, dim>::clear_user_pointer () const } +#if deal_II_dimension == 1 template <> void TriaObjectAccessor<1, 1>::clear_user_pointer () const @@ -177,6 +187,7 @@ void TriaObjectAccessor<1, 1>::clear_user_pointer () const this->tria->levels[this->present_level]->lines.user_pointers[this->present_index] = 0; } +#endif template @@ -187,6 +198,7 @@ void * TriaObjectAccessor<1, dim>::user_pointer () const } +#if deal_II_dimension == 1 template <> void * TriaObjectAccessor<1, 1>::user_pointer () const @@ -196,6 +208,7 @@ void * TriaObjectAccessor<1, 1>::user_pointer () const return this->tria->levels[this->present_level]->lines.user_pointers[this->present_index]; } +#endif template @@ -236,6 +249,7 @@ void TriaObjectAccessor<1, dim>::set_children (const int index) const } +#if deal_II_dimension == 1 template <> void TriaObjectAccessor<1, 1>::set_children (const int index) const @@ -249,7 +263,7 @@ void TriaObjectAccessor<1, 1>::set_children (const int index) const this->tria->levels[this->present_level]->lines.children[this->present_index] = index; } - +#endif template void TriaObjectAccessor<1, dim>::clear_children () const @@ -269,6 +283,7 @@ unsigned char TriaObjectAccessor<1, dim>::boundary_indicator () const } +#if deal_II_dimension == 1 template <> unsigned char TriaObjectAccessor<1, 1>::boundary_indicator () const @@ -277,6 +292,7 @@ unsigned char TriaObjectAccessor<1, 1>::boundary_indicator () const return 0; } +#endif template @@ -289,6 +305,7 @@ void TriaObjectAccessor<1, dim>::set_boundary_indicator (const unsigned char bou } +#if deal_II_dimension == 1 template <> void TriaObjectAccessor<1, 1>::set_boundary_indicator (const unsigned char) const @@ -296,7 +313,7 @@ void TriaObjectAccessor<1, 1>::set_boundary_indicator (const unsigned char) cons Assert (false, ExcImpossibleInDim(1)); } - +#endif template @@ -368,6 +385,7 @@ set (const internal::Triangulation::Quad &quad) const } +#if deal_II_dimension == 2 template <> void @@ -378,6 +396,7 @@ set (const internal::Triangulation::Quad &quad) const ->quads.cells[this->present_index] = quad; } +#endif template @@ -409,6 +428,7 @@ TriaObjectAccessor<2, dim>::set_used_flag () const } +#if deal_II_dimension == 2 template <> void @@ -420,6 +440,7 @@ TriaObjectAccessor<2, 2>::set_used_flag () const this->tria->levels[this->present_level]->quads.used[this->present_index] = true; } +#endif template @@ -431,6 +452,7 @@ void TriaObjectAccessor<2, dim>::clear_used_flag () const } +#if deal_II_dimension == 2 template <> void TriaObjectAccessor<2, 2>::clear_used_flag () const @@ -441,7 +463,7 @@ void TriaObjectAccessor<2, 2>::clear_used_flag () const this->tria->levels[this->present_level]->quads.used[this->present_index] = false; } - +#endif template void TriaObjectAccessor<2, dim>::recursively_set_user_flag () const @@ -475,6 +497,7 @@ void TriaObjectAccessor<2, dim>::set_user_pointer (void *p) const } +#if deal_II_dimension == 2 template <> void TriaObjectAccessor<2, 2>::set_user_pointer (void *p) const @@ -484,6 +507,7 @@ void TriaObjectAccessor<2, 2>::set_user_pointer (void *p) const this->tria->levels[this->present_level]->quads.user_pointers[this->present_index] = p; } +#endif template @@ -494,6 +518,7 @@ void TriaObjectAccessor<2, dim>::clear_user_pointer () const } +#if deal_II_dimension == 2 template <> void TriaObjectAccessor<2, 2>::clear_user_pointer () const @@ -503,6 +528,7 @@ void TriaObjectAccessor<2, 2>::clear_user_pointer () const this->tria->levels[this->present_level]->quads.user_pointers[this->present_index] = 0; } +#endif template @@ -513,6 +539,7 @@ void * TriaObjectAccessor<2, dim>::user_pointer () const } +#if deal_II_dimension == 2 template <> void * TriaObjectAccessor<2, 2>::user_pointer () const @@ -522,6 +549,7 @@ void * TriaObjectAccessor<2, 2>::user_pointer () const return this->tria->levels[this->present_level]->quads.user_pointers[this->present_index]; } +#endif template @@ -563,6 +591,7 @@ void TriaObjectAccessor<2, dim>::set_children (const int index) const } +#if deal_II_dimension == 2 template <> void TriaObjectAccessor<2, 2>::set_children (const int index) const @@ -577,6 +606,7 @@ void TriaObjectAccessor<2, 2>::set_children (const int index) const this->tria->levels[this->present_level]->quads.children[this->present_index] = index; } +#endif template @@ -595,6 +625,7 @@ unsigned char TriaObjectAccessor<2, dim>::boundary_indicator () const } +#if deal_II_dimension == 3 template <> unsigned char TriaObjectAccessor<2, 3>::boundary_indicator () const @@ -604,6 +635,7 @@ unsigned char TriaObjectAccessor<2, 3>::boundary_indicator () const return this->tria->faces->quads.material_id[this->present_index]; } +#endif template @@ -613,6 +645,7 @@ void TriaObjectAccessor<2, dim>::set_boundary_indicator (const unsigned char) co } +#if deal_II_dimension == 3 template <> void TriaObjectAccessor<2, 3>::set_boundary_indicator (const unsigned char boundary_ind) const @@ -622,6 +655,7 @@ void TriaObjectAccessor<2, 3>::set_boundary_indicator (const unsigned char bound this->tria->faces->quads.material_id[this->present_index] = boundary_ind; } +#endif template @@ -865,6 +899,8 @@ unsigned int TriaObjectAccessor<2, dim>::number_of_children () const /*------------------------ Functions: TriaObjectAccessor ---------------------------*/ +#if deal_II_dimension == 3 + template <> void TriaObjectAccessor<3, 3>:: @@ -874,6 +910,7 @@ set (const internal::Triangulation::Hexahedron &hex) const ->hexes.cells[this->present_index] = hex; } +#endif template @@ -917,6 +954,7 @@ TriaObjectAccessor<3, dim>::vertex (const unsigned int i) const } +#if deal_II_dimension == 3 template <> void TriaObjectAccessor<3, 3>::set_used_flag () const @@ -928,7 +966,6 @@ void TriaObjectAccessor<3, 3>::set_used_flag () const } - template <> void TriaObjectAccessor<3, 3>::clear_used_flag () const { @@ -938,6 +975,7 @@ void TriaObjectAccessor<3, 3>::clear_used_flag () const this->tria->levels[this->present_level]->hexes.used[this->present_index] = false; } +#endif template @@ -963,6 +1001,7 @@ void TriaObjectAccessor<3, dim>::recursively_clear_user_flag () const } +#if deal_II_dimension == 3 template <> void TriaObjectAccessor<3, 3>::set_user_pointer (void *p) const @@ -973,7 +1012,6 @@ void TriaObjectAccessor<3, 3>::set_user_pointer (void *p) const } - template <> void TriaObjectAccessor<3, 3>::clear_user_pointer () const { @@ -983,7 +1021,6 @@ void TriaObjectAccessor<3, 3>::clear_user_pointer () const } - template <> void * TriaObjectAccessor<3, 3>::user_pointer () const { @@ -992,6 +1029,7 @@ void * TriaObjectAccessor<3, 3>::user_pointer () const return this->tria->levels[this->present_level]->hexes.user_pointers[this->present_index]; } +#endif template @@ -1019,6 +1057,7 @@ TriaObjectAccessor<3, dim>::recursively_clear_user_pointer () const } +#if deal_II_dimension == 3 template <> void TriaObjectAccessor<3, 3>::set_children (const int index) const @@ -1032,6 +1071,7 @@ void TriaObjectAccessor<3, 3>::set_children (const int index) const this->tria->levels[this->present_level]->hexes.children[this->present_index] = index; } +#endif template @@ -1799,6 +1839,7 @@ unsigned int TriaObjectAccessor<3, dim>::number_of_children () const } +#if deal_II_dimension == 3 template <> void @@ -1822,7 +1863,7 @@ set_face_orientation (const unsigned int face, face] = orientation; } - +#endif // Remark: The following explicit instantiations needed to be moved to // this place here to work around a problem with gcc3.3 on Apple MacOSX. // The reason is that some of the functions instantiated here are used diff --git a/deal.II/deal.II/source/grid/tria_levels.all_dimensions.cc b/deal.II/deal.II/source/grid/tria_levels.all_dimensions.cc new file mode 100644 index 0000000000..4129127204 --- /dev/null +++ b/deal.II/deal.II/source/grid/tria_levels.all_dimensions.cc @@ -0,0 +1,103 @@ +//--------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2006 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//--------------------------------------------------------------------------- + + +#include +#include + +namespace internal +{ + namespace Triangulation + { + + void + TriaLevel<0>::reserve_space (const unsigned int total_cells, + const unsigned int dimension) + { + // we need space for total_cells + // cells. Maybe we have more already + // with those cells which are unused, + // so only allocate new space if needed. + // + // note that all arrays should have equal + // sizes (checked by @p{monitor_memory} + if (total_cells > refine_flags.size()) + { + refine_flags.reserve (total_cells); + refine_flags.insert (refine_flags.end(), + total_cells - refine_flags.size(), + false); + + coarsen_flags.reserve (total_cells); + coarsen_flags.insert (coarsen_flags.end(), + total_cells - coarsen_flags.size(), + false); + + subdomain_ids.reserve (total_cells); + subdomain_ids.insert (subdomain_ids.end(), + total_cells - subdomain_ids.size(), + 0); + + neighbors.reserve (total_cells*(2*dimension)); + neighbors.insert (neighbors.end(), + total_cells*(2*dimension) - neighbors.size(), + std::make_pair(-1,-1)); + }; + } + + + + void + TriaLevel<0>::monitor_memory (const unsigned int true_dimension) const + { + // check that we have not allocated + // too much memory. note that bool + // vectors allocate their memory in + // chunks of whole integers, so + // they may over-allocate by up to + // as many elements as an integer + // has bits + Assert (refine_flags.size() <= refine_flags.capacity() + sizeof(int)*8 || + refine_flags.size()::memory_consumption () const + { + return (MemoryConsumption::memory_consumption (refine_flags) + + MemoryConsumption::memory_consumption (coarsen_flags) + + MemoryConsumption::memory_consumption (neighbors)); + } + + } +} diff --git a/deal.II/deal.II/source/grid/tria_levels.cc b/deal.II/deal.II/source/grid/tria_levels.cc index 305da34e61..02943daa0d 100644 --- a/deal.II/deal.II/source/grid/tria_levels.cc +++ b/deal.II/deal.II/source/grid/tria_levels.cc @@ -19,85 +19,6 @@ namespace internal { namespace Triangulation { - - void - TriaLevel<0>::reserve_space (const unsigned int total_cells, - const unsigned int dimension) - { - // we need space for total_cells - // cells. Maybe we have more already - // with those cells which are unused, - // so only allocate new space if needed. - // - // note that all arrays should have equal - // sizes (checked by @p{monitor_memory} - if (total_cells > refine_flags.size()) - { - refine_flags.reserve (total_cells); - refine_flags.insert (refine_flags.end(), - total_cells - refine_flags.size(), - false); - - coarsen_flags.reserve (total_cells); - coarsen_flags.insert (coarsen_flags.end(), - total_cells - coarsen_flags.size(), - false); - - subdomain_ids.reserve (total_cells); - subdomain_ids.insert (subdomain_ids.end(), - total_cells - subdomain_ids.size(), - 0); - - neighbors.reserve (total_cells*(2*dimension)); - neighbors.insert (neighbors.end(), - total_cells*(2*dimension) - neighbors.size(), - std::make_pair(-1,-1)); - }; - } - - - - void - TriaLevel<0>::monitor_memory (const unsigned int true_dimension) const - { - // check that we have not allocated - // too much memory. note that bool - // vectors allocate their memory in - // chunks of whole integers, so - // they may over-allocate by up to - // as many elements as an integer - // has bits - Assert (refine_flags.size() <= refine_flags.capacity() + sizeof(int)*8 || - refine_flags.size()::memory_consumption () const - { - return (MemoryConsumption::memory_consumption (refine_flags) + - MemoryConsumption::memory_consumption (coarsen_flags) + - MemoryConsumption::memory_consumption (neighbors)); - } #if deal_II_dimension == 1 -- 2.39.5