From: guido Date: Fri, 27 Aug 2004 08:23:36 +0000 (+0000) Subject: new MGTransferBlock::build_matrices X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=828aa64c32ec1b650987ad6c2b8d601f7b42968c;p=dealii-svn.git new MGTransferBlock::build_matrices git-svn-id: https://svn.dealii.org/trunk@9590 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/multigrid/mg_transfer.h b/deal.II/deal.II/include/multigrid/mg_transfer.h index c047b60f7f..ff4f49e383 100644 --- a/deal.II/deal.II/include/multigrid/mg_transfer.h +++ b/deal.II/deal.II/include/multigrid/mg_transfer.h @@ -26,6 +26,8 @@ #include #include +#include + #include @@ -238,23 +240,21 @@ class MGTransferBlockBase * Actually build the prolongation * matrices for each level. * - * If a field selected is given, - * only matrices for these - * components are to be built. By - * default, all matrices are - * built. - * * This function is only called * by derived classes. These can * also set the member variables + * #selected and #mg_selected to + * restrict the transfer matrices + * to certain components. + * Furthermore, they use * #target_component and * #mg_target_component for * re-ordering and grouping of * components. */ template - void build_matrices (const MGDoFHandler& mg_dof, - const std::vector& selected); + void build_matrices (const DoFHandler& dof, + const MGDoFHandler& mg_dof); /** * Flag of selected components. @@ -346,6 +346,9 @@ class MGTransferBlockBase */ std::vector > > prolongation_matrices; #endif + + std::vector > > + copy_to_and_from_indices; }; //TODO:[GK] Update this class @@ -415,7 +418,8 @@ class MGTransferBlock : public MGTransferBase >, * the selected argument */ template - void build_matrices (const MGDoFHandler &mg_dof, + void build_matrices (const DoFHandler &dof, + const MGDoFHandler &mg_dof, std::vector selected = std::vector(), const std::vector& target_component = std::vector(), @@ -610,7 +614,8 @@ class MGTransferSelect : public MGTransferBase >, * the selected argument */ template - void build_matrices (const MGDoFHandler &mg_dof, + void build_matrices (const DoFHandler &dof, + const MGDoFHandler &mg_dof, unsigned int selected, unsigned int mg_selected, const std::vector& target_component diff --git a/deal.II/deal.II/include/multigrid/mg_transfer.templates.h b/deal.II/deal.II/include/multigrid/mg_transfer.templates.h index 15301e7f75..309f822c6c 100644 --- a/deal.II/deal.II/include/multigrid/mg_transfer.templates.h +++ b/deal.II/deal.II/include/multigrid/mg_transfer.templates.h @@ -430,7 +430,7 @@ MGTransferSelect::do_copy_to_mg ( // one level higher if (static_cast(level) < maxlevel) { - ;// restrict_and_add (level+1, dst[level], dst[level+1]); + restrict_and_add (level+1, dst[level], dst[level+1]); } }; } diff --git a/deal.II/deal.II/source/multigrid/mg_transfer_block.cc b/deal.II/deal.II/source/multigrid/mg_transfer_block.cc index 0125fdbfe5..defa69125b 100644 --- a/deal.II/deal.II/source/multigrid/mg_transfer_block.cc +++ b/deal.II/deal.II/source/multigrid/mg_transfer_block.cc @@ -31,8 +31,8 @@ template void MGTransferBlockBase::build_matrices ( - const MGDoFHandler& mg_dof, - const std::vector& select) + const DoFHandler& dof, + const MGDoFHandler& mg_dof) { // Fill target component with // standard values (identity) if it @@ -86,10 +86,6 @@ void MGTransferBlockBase::build_matrices ( const unsigned int dofs_per_cell = fe.dofs_per_cell; const unsigned int n_levels = mg_dof.get_tria().n_levels(); - // Selected refers to the component - // in mg_target_component. - mg_selected = select; - Assert (mg_selected.size() == fe.n_components(), ExcDimensionMismatch(mg_selected.size(), fe.n_components())); @@ -125,7 +121,14 @@ void MGTransferBlockBase::build_matrices ( k += t; } -// Building the matrices starts here! + // Build index vectors for + // copy_to_mg and + // copy_from_mg. These vectors must + // be prebuilt, since the + // get_dof_indices functions are + // too slow + +// Building the prolongation matrices starts here! // reset the size of the array of // matrices. call resize(0) first, @@ -325,24 +328,28 @@ MGTransferBlockBase::memory_consumption () const template template void MGTransferBlock::build_matrices ( + const DoFHandler &dof, const MGDoFHandler &mg_dof, std::vector select, const std::vector& t_component, const std::vector& mg_t_component) { - if (select.size() == 0) - select = std::vector (mg_dof.get_fe().n_components(), true); +//TODO:[GK] What about selected? + mg_selected = select; + if (mg_selected.size() == 0) + mg_selected = std::vector (mg_dof.get_fe().n_components(), true); target_component = t_component; mg_target_component = mg_t_component; - MGTransferBlockBase::build_matrices (mg_dof, select); + MGTransferBlockBase::build_matrices (dof, mg_dof); } template template void MGTransferSelect::build_matrices ( + const DoFHandler &dof, const MGDoFHandler &mg_dof, unsigned int select, unsigned int mg_select, @@ -358,6 +365,8 @@ void MGTransferSelect::build_matrices ( mg_selected_component = mg_select; selected.resize(ncomp, false); selected[select] = true; + mg_selected.resize(ncomp, false); + mg_selected[mg_select] = true; // If components are renumbered, // find the first original // component corresponding to the @@ -371,10 +380,15 @@ void MGTransferSelect::build_matrices ( } } - std::vector s(ncomp, false); - s[mg_select] = true; - - MGTransferBlockBase::build_matrices (mg_dof, s); + for (unsigned int i=0;i::build_matrices ( template void MGTransferBlock::build_matrices -(const MGDoFHandler &mg_dof, +(const DoFHandler &, + const MGDoFHandler &, std::vector, const std::vector&, const std::vector&); template void MGTransferSelect::build_matrices -(const MGDoFHandler &mg_dof, +(const DoFHandler &d, + const MGDoFHandler &, unsigned int, unsigned int, const std::vector&, const std::vector&); template void MGTransferBlock::build_matrices -(const MGDoFHandler &mg_dof, +(const DoFHandler &, + const MGDoFHandler &, std::vector, const std::vector&, const std::vector&); template void MGTransferSelect::build_matrices -(const MGDoFHandler &mg_dof, +(const DoFHandler &, + const MGDoFHandler &, unsigned int, unsigned int, const std::vector&, const std::vector&);