From 123ce843b659d7aaefe06b95e8ab1c70fa13bcb1 Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 10 Sep 2013 20:49:53 +0000 Subject: [PATCH] Remove a lot of code, now that all DoFHandlers have cell dof caches. git-svn-id: https://svn.dealii.org/trunk@30671 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/dofs/dof_accessor.templates.h | 193 +++++------------- 1 file changed, 54 insertions(+), 139 deletions(-) diff --git a/deal.II/include/deal.II/dofs/dof_accessor.templates.h b/deal.II/include/deal.II/dofs/dof_accessor.templates.h index ad15a3d3ae..0e3a32c161 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.templates.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.templates.h @@ -2753,131 +2753,6 @@ namespace internal } - /** - * A function that collects the - * global indices of degrees of - * freedom. - */ - template - static - void - get_dof_indices (const Accessor &accessor, - std::vector &dof_indices) - { - AssertDimension (dof_indices.size(), accessor.get_fe().dofs_per_cell); - - Assert (!accessor.has_children(), - ExcMessage ("Cell must be active.")); - - const types::global_dof_index *cache - = accessor.dof_handler->levels[accessor.level()] - ->get_cell_cache_start (accessor.present_index, accessor.get_fe().dofs_per_cell); - for (unsigned int i=0; i - static - void - get_dof_values (const Accessor &accessor, - const InputVector &values, - ForwardIterator local_values_begin, - ForwardIterator local_values_end) - { - Assert (static_cast(local_values_end-local_values_begin) - == accessor.get_fe().dofs_per_cell, - typename Accessor::ExcVectorDoesNotMatch()); - Assert (values.size() == accessor.get_dof_handler().n_dofs(), - typename Accessor::ExcVectorDoesNotMatch()); - - Assert (!accessor.has_children(), - ExcMessage ("Cell must be active.")); - - const types::global_dof_index *cache - = accessor.dof_handler->levels[accessor.level()] - ->get_cell_cache_start (accessor.present_index, accessor.get_fe().dofs_per_cell); - - values.extract_subvector_to (cache, - cache + accessor.get_fe().dofs_per_cell, - local_values_begin); - } - - - /** - * A function that collects the - * values of degrees of freedom. This - * function works for ::DoFHandler - * and all template arguments and - * uses the data from the cache of - * indices that we hold for each - * cell. - */ - template - static - void - get_dof_values (const Accessor &accessor, - const ConstraintMatrix &constraints, - const InputVector &values, - ForwardIterator local_values_begin, - ForwardIterator local_values_end) - { - Assert (static_cast(local_values_end-local_values_begin) - == accessor.get_fe().dofs_per_cell, - typename Accessor::ExcVectorDoesNotMatch()); - Assert (values.size() == accessor.get_dof_handler().n_dofs(), - typename Accessor::ExcVectorDoesNotMatch()); - - Assert (!accessor.has_children(), - ExcMessage ("Cell must be active.")); - - const types::global_dof_index *cache - = accessor.dof_handler->levels[accessor.level()] - ->get_cell_cache_start (accessor.present_index, accessor.get_fe().dofs_per_cell); - - constraints.get_dof_values(values, *cache, local_values_begin, - local_values_end); - } - - - - /** - * Same set of functions as above - * except that it sets rather than - * gets values - */ - template - static - void - set_dof_values (const Accessor &accessor, - const dealii::Vector &local_values, - OutputVector &values) - { - Assert (local_values.size() == accessor.get_fe().dofs_per_cell, - typename Accessor::ExcVectorDoesNotMatch()); - Assert (values.size() == accessor.get_dof_handler().n_dofs(), - typename Accessor::ExcVectorDoesNotMatch()); - - Assert (!accessor.has_children(), - ExcMessage ("Cell must be active.")); - - const types::global_dof_index *cache - = accessor.dof_handler->levels[accessor.level()] - ->get_cell_cache_start (accessor.present_index, accessor.get_fe().dofs_per_cell); - for (unsigned int i=0; i::get_dof_indices (std::vector & ExcMessage ("Can't ask for DoF indices on artificial cells.")); AssertDimension (dof_indices.size(), this->get_fe().dofs_per_cell); - dealii::internal::DoFCellAccessor::Implementation::get_dof_indices (*this, dof_indices); + const types::global_dof_index *cache + = this->dof_handler->levels[this->present_level] + ->get_cell_cache_start (this->present_index, this->get_fe().dofs_per_cell); + for (unsigned int i=0; iget_fe().dofs_per_cell; ++i, ++cache) + dof_indices[i] = *cache; } @@ -3453,12 +3332,7 @@ void DoFCellAccessor::get_dof_values (const InputVector &values, Vector &local_values) const { - Assert (this->is_artificial() == false, - ExcMessage ("Can't ask for DoF indices on artificial cells.")); - AssertDimension (local_values.size(), this->get_fe().dofs_per_cell); - - dealii::internal::DoFCellAccessor::Implementation - ::get_dof_values (*this, values, local_values.begin(), local_values.end()); + get_dof_values (values, local_values.begin(), local_values.end()); } @@ -3473,8 +3347,22 @@ DoFCellAccessor::get_dof_values (const InputVector &values, { Assert (this->is_artificial() == false, ExcMessage ("Can't ask for DoF indices on artificial cells.")); - dealii::internal::DoFCellAccessor::Implementation - ::get_dof_values (*this, values, local_values_begin, local_values_end); + Assert (!this->has_children(), + ExcMessage ("Cell must be active.")); + + Assert (static_cast(local_values_end-local_values_begin) + == this->get_fe().dofs_per_cell, + typename DoFCellAccessor::ExcVectorDoesNotMatch()); + Assert (values.size() == this->get_dof_handler().n_dofs(), + typename DoFCellAccessor::ExcVectorDoesNotMatch()); + + const types::global_dof_index *cache + = this->dof_handler->levels[this->present_level] + ->get_cell_cache_start (this->present_index, this->get_fe().dofs_per_cell); + + values.extract_subvector_to (cache, + cache + this->get_fe().dofs_per_cell, + local_values_begin); } @@ -3490,9 +3378,22 @@ DoFCellAccessor::get_dof_values (const ConstraintMatrix &constraints, { Assert (this->is_artificial() == false, ExcMessage ("Can't ask for DoF indices on artificial cells.")); - dealii::internal::DoFCellAccessor::Implementation - ::get_dof_values (*this, constraints, values, - local_values_begin, local_values_end); + Assert (!this->has_children(), + ExcMessage ("Cell must be active.")); + + Assert (static_cast(local_values_end-local_values_begin) + == this->get_fe().dofs_per_cell, + typename DoFCellAccessor::ExcVectorDoesNotMatch()); + Assert (values.size() == this->get_dof_handler().n_dofs(), + typename DoFCellAccessor::ExcVectorDoesNotMatch()); + + + const types::global_dof_index *cache + = this->dof_handler->levels[this->present_level] + ->get_cell_cache_start (this->present_index, this->get_fe().dofs_per_cell); + + constraints.get_dof_values(values, *cache, local_values_begin, + local_values_end); } @@ -3506,8 +3407,22 @@ DoFCellAccessor::set_dof_values (const Vector &local_values, { Assert (this->is_artificial() == false, ExcMessage ("Can't ask for DoF indices on artificial cells.")); - dealii::internal::DoFCellAccessor::Implementation - ::set_dof_values (*this, local_values, values); + Assert (!this->has_children(), + ExcMessage ("Cell must be active.")); + + Assert (static_cast(local_values.size()) + == this->get_fe().dofs_per_cell, + typename DoFCellAccessor::ExcVectorDoesNotMatch()); + Assert (values.size() == this->get_dof_handler().n_dofs(), + typename DoFCellAccessor::ExcVectorDoesNotMatch()); + + + const types::global_dof_index *cache + = this->dof_handler->levels[this->present_level] + ->get_cell_cache_start (this->present_index, this->get_fe().dofs_per_cell); + + for (unsigned int i=0; iget_fe().dofs_per_cell; ++i, ++cache) + values(*cache) = local_values(i); } -- 2.39.5