From ce8e5d0d89f6c9f022eaa4c3f1d009a1e2edbd2e Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 10 Apr 2015 07:41:52 -0500 Subject: [PATCH] Introduce arrays to store active_cell_index values for each cell. --- include/deal.II/grid/tria_levels.h | 19 +++++++++++++++---- source/grid/tria_levels.cc | 14 +++++++++++++- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/include/deal.II/grid/tria_levels.h b/include/deal.II/grid/tria_levels.h index 86a7f742f0..a29050e498 100644 --- a/include/deal.II/grid/tria_levels.h +++ b/include/deal.II/grid/tria_levels.h @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 1998 - 2014 by the deal.II authors +// Copyright (C) 1998 - 2015 by the deal.II authors // // This file is part of the deal.II library. // @@ -70,6 +70,14 @@ namespace internal */ std::vector coarsen_flags; + + /** + * An integer that, for every active cell, stores the how + * many-th active cell this is. For non-active cells, this value + * is unused and set to an invalid value. + */ + std::vector active_cell_indices; + /** * Levels and indices of the neighbors of the cells. Convention is, that * the neighbors of the cell with index @p i are stored in the fields @@ -200,9 +208,9 @@ namespace internal //TODO: Replace TriaObjectsHex to avoid this specialization /** - * Specialization of TriaLevels for 3D. Since we need TriaObjectsHex - * instead of TriaObjects. Refer to the documentation of the template for - * details. + * Specialization of TriaLevels for 3D. Since we need + * TriaObjectsHex instead of TriaObjects. Refer to the + * documentation of the general class template for details. */ template<> class TriaLevel<3> @@ -210,6 +218,7 @@ namespace internal public: std::vector refine_flags; std::vector coarsen_flags; + std::vector active_cell_indices; std::vector > neighbors; std::vector subdomain_ids; std::vector level_subdomain_ids; @@ -265,6 +274,7 @@ namespace internal const unsigned int) { ar &refine_flags &coarsen_flags; + ar &active_cell_indices; ar &neighbors; ar &subdomain_ids; ar &level_subdomain_ids; @@ -280,6 +290,7 @@ namespace internal const unsigned int) { ar &refine_flags &coarsen_flags; + ar &active_cell_indices; ar &neighbors; ar &subdomain_ids; ar &level_subdomain_ids; diff --git a/source/grid/tria_levels.cc b/source/grid/tria_levels.cc index 944021dcd2..7f8879a970 100644 --- a/source/grid/tria_levels.cc +++ b/source/grid/tria_levels.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2006 - 2014 by the deal.II authors +// Copyright (C) 2006 - 2015 by the deal.II authors // // This file is part of the deal.II library. // @@ -47,6 +47,11 @@ namespace internal total_cells - coarsen_flags.size(), false); + active_cell_indices.reserve (total_cells); + active_cell_indices.insert (active_cell_indices.end(), + total_cells - active_cell_indices.size(), + numbers::invalid_unsigned_int); + subdomain_ids.reserve (total_cells); subdomain_ids.insert (subdomain_ids.end(), total_cells - subdomain_ids.size(), @@ -97,6 +102,7 @@ namespace internal { return (MemoryConsumption::memory_consumption (refine_flags) + MemoryConsumption::memory_consumption (coarsen_flags) + + MemoryConsumption::memory_consumption (active_cell_indices) + MemoryConsumption::memory_consumption (neighbors) + MemoryConsumption::memory_consumption (subdomain_ids) + MemoryConsumption::memory_consumption (level_subdomain_ids) + @@ -132,6 +138,11 @@ namespace internal total_cells - coarsen_flags.size(), false); + active_cell_indices.reserve (total_cells); + active_cell_indices.insert (active_cell_indices.end(), + total_cells - active_cell_indices.size(), + numbers::invalid_unsigned_int); + subdomain_ids.reserve (total_cells); subdomain_ids.insert (subdomain_ids.end(), total_cells - subdomain_ids.size(), @@ -180,6 +191,7 @@ namespace internal { return (MemoryConsumption::memory_consumption (refine_flags) + MemoryConsumption::memory_consumption (coarsen_flags) + + MemoryConsumption::memory_consumption (active_cell_indices) + MemoryConsumption::memory_consumption (neighbors) + MemoryConsumption::memory_consumption (subdomain_ids) + MemoryConsumption::memory_consumption (parents) + -- 2.39.5