From 5e009c72d2d9ac3252e396e8a7c0a964fdc820cc Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 22 Sep 2016 22:24:33 +0200 Subject: [PATCH] Eliminate unused ConstraintMatrix objects in MGTransfer --- include/deal.II/multigrid/mg_transfer.h | 24 +++++++++----- include/deal.II/multigrid/mg_transfer_block.h | 29 ++++++++++++----- source/multigrid/mg_transfer_prebuilt.cc | 25 +++++++++++---- source/multigrid/multigrid.cc | 31 ++++++++++++++++--- 4 files changed, 84 insertions(+), 25 deletions(-) diff --git a/include/deal.II/multigrid/mg_transfer.h b/include/deal.II/multigrid/mg_transfer.h index 4712d6fe55..ccf66c5cc6 100644 --- a/include/deal.II/multigrid/mg_transfer.h +++ b/include/deal.II/multigrid/mg_transfer.h @@ -443,8 +443,16 @@ public: * Constructor with constraints. Equivalent to the default constructor * followed by initialize_constraints(). */ + MGTransferPrebuilt (const MGConstrainedDoFs &mg_constrained_dofs); + + /** + * Constructor with constraints. Equivalent to the default constructor + * followed by initialize_constraints(). + * + * @deprecated @p constraints is unused. + */ MGTransferPrebuilt (const ConstraintMatrix &constraints, - const MGConstrainedDoFs &mg_constrained_dofs); + const MGConstrainedDoFs &mg_constrained_dofs) DEAL_II_DEPRECATED; /** * Destructor. @@ -454,8 +462,15 @@ public: /** * Initialize the constraints to be used in build_matrices(). */ + void initialize_constraints (const MGConstrainedDoFs &mg_constrained_dofs); + + /** + * Initialize the constraints to be used in build_matrices(). + * + * @deprecated @p constraints is unused. + */ void initialize_constraints (const ConstraintMatrix &constraints, - const MGConstrainedDoFs &mg_constrained_dofs); + const MGConstrainedDoFs &mg_constrained_dofs) DEAL_II_DEPRECATED; /** * Reset the object to the state it had right after the default constructor. @@ -541,11 +556,6 @@ private: * boundary. */ std::vector > interface_dofs; - - /** - * The constraints of the global system. - */ - SmartPointer > constraints; }; diff --git a/include/deal.II/multigrid/mg_transfer_block.h b/include/deal.II/multigrid/mg_transfer_block.h index b992cf9c86..c75c9db1df 100644 --- a/include/deal.II/multigrid/mg_transfer_block.h +++ b/include/deal.II/multigrid/mg_transfer_block.h @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2001 - 2015 by the deal.II authors +// Copyright (C) 2001 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -65,11 +65,20 @@ public: * discontinuous finite elements or with no local refinement. */ MGTransferBlockBase (); + /** * Constructor with constraint matrices as well as mg_constrained_dofs. */ + MGTransferBlockBase (const MGConstrainedDoFs &mg_constrained_dofs); + + /** + * Constructor with constraint matrices as well as mg_constrained_dofs. + * + * @deprecated @p constraints is unused. + */ MGTransferBlockBase (const ConstraintMatrix &constraints, - const MGConstrainedDoFs &mg_constrained_dofs); + const MGConstrainedDoFs &mg_constrained_dofs) DEAL_II_DEPRECATED; + /** * Memory used by this object. */ @@ -150,10 +159,7 @@ protected: */ std::vector > > > copy_indices; - /** - * The constraints of the global system. - */ - SmartPointer constraints; + /** * The mg_constrained_dofs of the level systems. */ @@ -299,11 +305,20 @@ public: * discontinuous finite elements or with no local refinement. */ MGTransferBlockSelect (); + + /** + * Constructor with constraint matrices as well as mg_constrained_dofs. + */ + MGTransferBlockSelect (const MGConstrainedDoFs &mg_constrained_dofs); + /** * Constructor with constraint matrices as well as mg_constrained_dofs. + * + * @deprecated @p constraints is unused. */ MGTransferBlockSelect (const ConstraintMatrix &constraints, - const MGConstrainedDoFs &mg_constrained_dofs); + const MGConstrainedDoFs &mg_constrained_dofs) DEAL_II_DEPRECATED; + /** * Destructor. */ diff --git a/source/multigrid/mg_transfer_prebuilt.cc b/source/multigrid/mg_transfer_prebuilt.cc index 95c6d32a65..377bfa6b7c 100644 --- a/source/multigrid/mg_transfer_prebuilt.cc +++ b/source/multigrid/mg_transfer_prebuilt.cc @@ -48,9 +48,15 @@ MGTransferPrebuilt::MGTransferPrebuilt () template -MGTransferPrebuilt::MGTransferPrebuilt (const ConstraintMatrix &c, const MGConstrainedDoFs &mg_c) - : - constraints(&c) +MGTransferPrebuilt::MGTransferPrebuilt (const MGConstrainedDoFs &mg_c) +{ + this->mg_constrained_dofs = &mg_c; +} + + + +template +MGTransferPrebuilt::MGTransferPrebuilt (const ConstraintMatrix &/*c*/, const MGConstrainedDoFs &mg_c) { this->mg_constrained_dofs = &mg_c; } @@ -65,14 +71,22 @@ MGTransferPrebuilt::~MGTransferPrebuilt () template void MGTransferPrebuilt::initialize_constraints -(const ConstraintMatrix &c, const MGConstrainedDoFs &mg_c) +(const MGConstrainedDoFs &mg_c) { - constraints = &c; this->mg_constrained_dofs = &mg_c; } +template +void MGTransferPrebuilt::initialize_constraints +(const ConstraintMatrix &/*c*/, const MGConstrainedDoFs &mg_c) +{ + initialize_constraints(mg_c); +} + + + template void MGTransferPrebuilt::clear () { @@ -80,7 +94,6 @@ void MGTransferPrebuilt::clear () prolongation_matrices.resize(0); prolongation_sparsities.resize(0); interface_dofs.resize(0); - constraints = 0; } diff --git a/source/multigrid/multigrid.cc b/source/multigrid/multigrid.cc index dd69a7a25d..85118e18c8 100644 --- a/source/multigrid/multigrid.cc +++ b/source/multigrid/multigrid.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2000 - 2014 by the deal.II authors +// Copyright (C) 2000 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -39,10 +39,18 @@ MGTransferBlockBase::MGTransferBlockBase () {} + +MGTransferBlockBase::MGTransferBlockBase ( + const MGConstrainedDoFs &mg_c) + : + mg_constrained_dofs(&mg_c) +{} + + + MGTransferBlockBase::MGTransferBlockBase ( - const ConstraintMatrix &c, const MGConstrainedDoFs &mg_c) + const ConstraintMatrix &/*c*/, const MGConstrainedDoFs &mg_c) : - constraints(&c), mg_constrained_dofs(&mg_c) {} @@ -218,6 +226,7 @@ void MGTransferSelect::prolongate ( } + template void MGTransferSelect::restrict_and_add ( const unsigned int from_level, @@ -240,17 +249,29 @@ MGTransferBlockSelect::MGTransferBlockSelect () {} + template MGTransferBlockSelect::MGTransferBlockSelect ( - const ConstraintMatrix &c, const MGConstrainedDoFs &mg_c) - : MGTransferBlockBase(c, mg_c) + const MGConstrainedDoFs &mg_c) + : MGTransferBlockBase(mg_c) {} + + +template +MGTransferBlockSelect::MGTransferBlockSelect ( + const ConstraintMatrix &/*c*/, const MGConstrainedDoFs &mg_c) + : MGTransferBlockBase(mg_c) +{} + + + template MGTransferBlockSelect::~MGTransferBlockSelect () {} + template void MGTransferBlockSelect::prolongate ( const unsigned int to_level, -- 2.39.5