17 #include <deal.II/base/logstream.h> 18 #include <deal.II/base/function.h> 20 #include <deal.II/lac/vector.h> 21 #include <deal.II/lac/block_vector.h> 22 #include <deal.II/lac/parallel_vector.h> 23 #include <deal.II/lac/parallel_block_vector.h> 24 #include <deal.II/lac/petsc_vector.h> 25 #include <deal.II/lac/petsc_block_vector.h> 26 #include <deal.II/lac/trilinos_vector.h> 27 #include <deal.II/lac/trilinos_block_vector.h> 28 #include <deal.II/lac/sparse_matrix.h> 29 #include <deal.II/lac/block_sparse_matrix.h> 30 #include <deal.II/lac/dynamic_sparsity_pattern.h> 31 #include <deal.II/grid/tria.h> 32 #include <deal.II/grid/tria_iterator.h> 33 #include <deal.II/dofs/dof_tools.h> 34 #include <deal.II/fe/fe.h> 35 #include <deal.II/dofs/dof_accessor.h> 36 #include <deal.II/multigrid/mg_tools.h> 37 #include <deal.II/multigrid/mg_transfer.h> 41 DEAL_II_NAMESPACE_OPEN
44 template<
typename VectorType>
50 template<
typename VectorType>
60 template <
typename VectorType>
66 template <
typename VectorType>
76 template <
typename VectorType>
88 template <
typename VectorType>
91 const VectorType &src)
const 101 template <
typename VectorType>
104 const VectorType &src)
const 115 template <
typename VectorType>
116 template <
int dim,
int spacedim>
121 const unsigned int dofs_per_cell = mg_dof.
get_fe().dofs_per_cell;
123 this->
sizes.resize(n_levels);
124 for (
unsigned int l=0; l<n_levels; ++l)
140 for (
unsigned int i=0; i<n_levels-1; ++i)
151 std::vector<types::global_dof_index> dof_indices_parent (dofs_per_cell);
152 std::vector<types::global_dof_index> dof_indices_child (dofs_per_cell);
153 std::vector<types::global_dof_index> entries (dofs_per_cell);
160 for (
unsigned int level=0; level<n_levels-1; ++level)
171 level_p1_relevant_dofs);
174 level_p1_relevant_dofs);
176 cell != mg_dof.
end(level); ++cell)
177 if (cell->has_children() &&
179 || cell->level_subdomain_id()==mg_dof.
get_triangulation().locally_owned_subdomain()
182 cell->get_mg_dof_indices (dof_indices_parent);
185 ExcNotImplemented());
186 for (
unsigned int child=0; child<cell->n_children(); ++child)
190 = mg_dof.
get_fe().get_prolongation_matrix (child,
191 cell->refinement_case());
193 Assert (prolongation.
n() != 0, ExcNoProlongation());
195 cell->child(child)->get_mg_dof_indices (dof_indices_child);
200 for (
unsigned int i=0; i<dofs_per_cell; ++i)
203 for (
unsigned int j=0; j<dofs_per_cell; ++j)
204 if (prolongation(i,j) != 0)
205 entries.push_back (dof_indices_parent[j]);
207 entries.begin(), entries.end());
223 cell != mg_dof.
end(level); ++cell)
224 if (cell->has_children() &&
226 || cell->level_subdomain_id()==mg_dof.
get_triangulation().locally_owned_subdomain())
229 cell->get_mg_dof_indices (dof_indices_parent);
232 ExcNotImplemented());
233 for (
unsigned int child=0; child<cell->n_children(); ++child)
237 = mg_dof.
get_fe().get_prolongation_matrix (child,
238 cell->refinement_case());
242 for (
unsigned int j=0; j<dofs_per_cell; ++j)
244 for (
unsigned int i=0; i<dofs_per_cell; ++i)
245 prolongation(i,j) = 0.;
247 cell->child(child)->get_mg_dof_indices (dof_indices_child);
250 for (
unsigned int i=0; i<dofs_per_cell; ++i)
253 &dof_indices_parent[0],
266 template <
typename VectorType>
272 os <<
"Level " << level << std::endl;
280 template <
typename VectorType>
294 #include "mg_transfer_prebuilt.inst" 297 DEAL_II_NAMESPACE_CLOSE
void add_entries(const size_type row, ForwardIterator begin, ForwardIterator end, const bool indices_are_unique_and_sorted=false)
const types::subdomain_id invalid_subdomain_id
std::size_t memory_consumption() const
cell_iterator begin(const unsigned int level=0) const
void build_matrices(const DoFHandler< dim, spacedim > &mg_dof)
bool is_boundary_index(const unsigned int level, const types::global_dof_index index) const
cell_iterator end() const
SmartPointer< const ConstraintMatrix, MGTransferPrebuilt< VectorType > > constraints
std::vector< std_cxx11::shared_ptr< typename internal::MatrixSelector< VectorType >::Matrix > > prolongation_matrices
const FiniteElement< dim, spacedim > & get_fe() const
void initialize_constraints(const ConstraintMatrix &constraints, const MGConstrainedDoFs &mg_constrained_dofs)
virtual ~MGTransferPrebuilt()
std::vector< std_cxx11::shared_ptr< typename internal::MatrixSelector< VectorType >::Sparsity > > prolongation_sparsities
void print_matrices(std::ostream &os) const
std::size_t memory_consumption() const
ActiveSelector::cell_iterator cell_iterator
void fill_and_communicate_copy_indices(const DoFHandler< dim, spacedim > &mg_dof)
#define Assert(cond, exc)
void reinit(const size_type m, const size_type n, const IndexSet &rowset=IndexSet())
types::global_dof_index n_dofs() const
SmartPointer< const MGConstrainedDoFs, MGLevelGlobalTransfer< VectorType > > mg_constrained_dofs
std::vector< types::global_dof_index > sizes
virtual void prolongate(const unsigned int to_level, VectorType &dst, const VectorType &src) const
const Triangulation< dim, spacedim > & get_triangulation() const
std::vector< std::vector< bool > > interface_dofs
bool have_boundary_indices() const
virtual void restrict_and_add(const unsigned int from_level, VectorType &dst, const VectorType &src) const