From: Maximilian Bergbauer Date: Thu, 21 Sep 2023 09:32:45 +0000 (+0200) Subject: Shrink compressed vectors X-Git-Tag: relicensing~479^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16025%2Fhead;p=dealii.git Shrink compressed vectors --- diff --git a/include/deal.II/non_matching/mapping_info.h b/include/deal.II/non_matching/mapping_info.h index 9e674a4f71..c445c9959b 100644 --- a/include/deal.II/non_matching/mapping_info.h +++ b/include/deal.II/non_matching/mapping_info.h @@ -505,6 +505,12 @@ namespace NonMatching typename Triangulation::cell_iterator get_cell_iterator(const unsigned int cell_index) const; + /** + * Return the memory consumption of this class in bytes. + */ + std::size_t + memory_consumption() const; + private: using MappingData = dealii::internal::FEValuesImplementation::MappingRelatedDataactive_cell_index()] = cell_index; @@ -1096,7 +1113,16 @@ namespace NonMatching ++cell_index; } - // TODO: release allocated memory from compressed data vectors + if (update_flags_mapping & UpdateFlags::update_jacobians) + { + jacobians.resize(size_compressed_data); + jacobians.shrink_to_fit(); + } + if (update_flags_mapping & UpdateFlags::update_inverse_jacobians) + { + inverse_jacobians.resize(size_compressed_data); + inverse_jacobians.shrink_to_fit(); + } state = State::cell_vector; is_reinitialized(); @@ -1739,6 +1765,34 @@ namespace NonMatching { return is_reinitialized.connect(set_is_reinitialized); } + + + + template + std::size_t + MappingInfo::memory_consumption() const + { + std::size_t memory = MemoryConsumption::memory_consumption(unit_points); + memory += MemoryConsumption::memory_consumption(unit_points_faces); + memory += MemoryConsumption::memory_consumption(unit_points_index); + memory += cell_type.capacity() * + sizeof(dealii::internal::MatrixFreeFunctions::GeometryType); + memory += MemoryConsumption::memory_consumption(data_index_offsets); + memory += + MemoryConsumption::memory_consumption(compressed_data_index_offsets); + memory += MemoryConsumption::memory_consumption(JxW_values); + memory += MemoryConsumption::memory_consumption(normal_vectors); + memory += MemoryConsumption::memory_consumption(jacobians); + memory += MemoryConsumption::memory_consumption(inverse_jacobians); + memory += MemoryConsumption::memory_consumption(real_points); + memory += MemoryConsumption::memory_consumption(n_q_points_unvectorized); + memory += MemoryConsumption::memory_consumption(cell_index_offset); + memory += MemoryConsumption::memory_consumption( + cell_index_to_compressed_cell_index); + memory += MemoryConsumption::memory_consumption(cell_level_and_indices); + memory += sizeof(*this); + return memory; + } } // namespace NonMatching DEAL_II_NAMESPACE_CLOSE