From 6cb7641f8374cb9ff4c7bfca3f0ad3143f5edec2 Mon Sep 17 00:00:00 2001 From: Baerbel Jannsen Date: Mon, 22 Mar 2010 15:00:12 +0000 Subject: [PATCH] use constraint matrix for distribute_local_to_global git-svn-id: https://svn.dealii.org/trunk@20877 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/numerics/mesh_worker_assembler.h | 71 ++++++++++++++----- 1 file changed, 54 insertions(+), 17 deletions(-) diff --git a/deal.II/deal.II/include/numerics/mesh_worker_assembler.h b/deal.II/deal.II/include/numerics/mesh_worker_assembler.h index e1af235b0b..cfbe78e1a6 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_assembler.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_assembler.h @@ -679,6 +679,11 @@ namespace MeshWorker */ void initialize(const BlockInfo* block_info, MatrixBlockVector& matrices); + + /** + * Initialize the constraints. + */ + void initialize(const ConstraintMatrix& constraints); /** * Initialize the local data * in the @@ -741,6 +746,11 @@ namespace MeshWorker * A pointer to the object containing the block structure. */ SmartPointer block_info; + /** + * A pointer to the object containing constraints. + */ + SmartPointer > constraints; /** * The smallest positive @@ -1405,6 +1415,16 @@ namespace MeshWorker block_info = b; matrices = &m; } + + + + template + inline void + MatrixLocalBlocksToGlobalBlocks::initialize( + const ConstraintMatrix& c) + { + constraints = &c; + } @@ -1430,23 +1450,40 @@ namespace MeshWorker const std::vector& dof1, const std::vector& dof2) { - for (unsigned int j=0;j= threshold) - { - // The coordinates of - // the current entry in - // DoFHandler - // numbering, which - // differs from the - // block-wise local - // numbering we use in - // our local matrices - const unsigned int jcell = this->block_info->local().local_to_global(block_row, j); - const unsigned int kcell = this->block_info->local().local_to_global(block_col, k); - - global.add(dof1[jcell], dof2[kcell], local(j,k)); - } + if(constraints == 0) + { + for (unsigned int j=0;j= threshold) + { + // The coordinates of + // the current entry in + // DoFHandler + // numbering, which + // differs from the + // block-wise local + // numbering we use in + // our local matrices + const unsigned int jcell = this->block_info->local().local_to_global(block_row, j); + const unsigned int kcell = this->block_info->local().local_to_global(block_col, k); + + global.add(dof1[jcell], dof2[kcell], local(j,k)); + } + } + else + { + const BlockIndices &bi = this->block_info->local(); + std::vector sliced_row_indices (bi.block_size(block_row)); + for(unsigned int i=0; i sliced_col_indices (bi.block_size(block_col)); + for(unsigned int i=0; idistribute_local_to_global(local, + sliced_row_indices, sliced_col_indices, global); + } } -- 2.39.5