From 4f32f5cac1c13c5ba03faa04c2fa506168a1ed05 Mon Sep 17 00:00:00 2001 From: kanschat Date: Sun, 2 Feb 2014 22:41:20 +0000 Subject: [PATCH] add functions for clearing and initializing an MGTransferPrebuilt object git-svn-id: https://svn.dealii.org/trunk@32380 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/multigrid/mg_transfer.h | 15 ++++++++++- .../source/multigrid/mg_transfer_prebuilt.cc | 26 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/deal.II/include/deal.II/multigrid/mg_transfer.h b/deal.II/include/deal.II/multigrid/mg_transfer.h index 6d869a3720..5edbbb6a39 100644 --- a/deal.II/include/deal.II/multigrid/mg_transfer.h +++ b/deal.II/include/deal.II/multigrid/mg_transfer.h @@ -121,7 +121,8 @@ public: */ MGTransferPrebuilt (); /** - * Constructor with constraint matrices as well as mg_constrained_dofs. + * Constructor with constraints. Equivalent to the default + * constructor followed by initialize_constraints(). */ MGTransferPrebuilt (const ConstraintMatrix &constraints, const MGConstrainedDoFs &mg_constrained_dofs); @@ -129,6 +130,18 @@ public: * Destructor. */ virtual ~MGTransferPrebuilt (); + + /** + * Initialize the constraints to be used in build_matrices(). + */ + void initialize_constraints (const ConstraintMatrix &constraints, + const MGConstrainedDoFs &mg_constrained_dofs); + + /** + * Reset the object to the state it had right after the default constructor. + */ + void clear (); + /** * Actually build the prolongation * matrices for each level. diff --git a/deal.II/source/multigrid/mg_transfer_prebuilt.cc b/deal.II/source/multigrid/mg_transfer_prebuilt.cc index 00d449ad91..f19388ce34 100644 --- a/deal.II/source/multigrid/mg_transfer_prebuilt.cc +++ b/deal.II/source/multigrid/mg_transfer_prebuilt.cc @@ -56,11 +56,37 @@ MGTransferPrebuilt::MGTransferPrebuilt (const ConstraintMatrix &c, const mg_constrained_dofs(&mg_c) {} + template MGTransferPrebuilt::~MGTransferPrebuilt () {} +template +void MGTransferPrebuilt::initialize_constraints ( + const ConstraintMatrix &c, const MGConstrainedDoFs &mg_c) +{ + constraints = &c; + mg_constrained_dofs = &mg_c; +} + + +template +void MGTransferPrebuilt::clear () +{ + sizes.resize(0); + prolongation_matrices.resize(0); + prolongation_sparsities.resize(0); + copy_indices.resize(0); + copy_indices_to_me.resize(0); + copy_indices_from_me.resize(0); + component_to_block_map.resize(0); + interface_dofs.resize(0); + constraints = 0; + mg_constrained_dofs = 0; +} + + template void MGTransferPrebuilt::prolongate ( const unsigned int to_level, -- 2.39.5