16 #include <deal.II/base/exceptions.h> 18 #include <deal.II/non_matching/coupling.h> 20 #include <deal.II/lac/sparsity_pattern.h> 21 #include <deal.II/lac/sparse_matrix.h> 22 #include <deal.II/lac/block_sparsity_pattern.h> 23 #include <deal.II/lac/block_sparse_matrix.h> 25 #include <deal.II/lac/trilinos_sparsity_pattern.h> 26 #include <deal.II/lac/trilinos_sparse_matrix.h> 27 #include <deal.II/lac/trilinos_block_sparse_matrix.h> 29 #include <deal.II/lac/petsc_sparse_matrix.h> 30 #include <deal.II/lac/petsc_parallel_sparse_matrix.h> 31 #include <deal.II/lac/petsc_parallel_block_sparse_matrix.h> 33 #include <deal.II/fe/fe_values.h> 35 #include <deal.II/base/point.h> 36 #include <deal.II/base/tensor.h> 38 #include <deal.II/grid/grid_tools.h> 39 #include <deal.II/grid/grid_tools_cache.h> 41 #include <deal.II/distributed/tria.h> 42 #include <deal.II/distributed/shared_tria.h> 44 DEAL_II_NAMESPACE_OPEN
47 template<
int dim0,
int dim1,
int spacedim,
typename Sparsity>
60 quad, sparsity, constraints,
61 space_comps, immersed_comps,
67 template<
int dim0,
int dim1,
int spacedim,
typename Sparsity>
80 static_assert(dim1 <= dim0,
"This function can only work if dim1 <= dim0");
84 const auto &space_fe = space_dh.
get_fe();
85 const auto &immersed_fe = immersed_dh.
get_fe();
90 endc = immersed_dh.
end();
93 std::vector<types::global_dof_index> dofs(immersed_fe.dofs_per_cell);
94 std::vector<types::global_dof_index> odofs(space_fe.dofs_per_cell);
101 = (space_comps.
size() == 0 ?
106 = (immersed_comps.
size() == 0 ?
116 for (
unsigned int i=0, j=0; i<space_gtl.size(); ++i)
120 for (
unsigned int i=0, j=0; i<immersed_gtl.size(); ++i)
122 immersed_gtl[i] = j++;
143 for (; cell != endc; ++cell)
147 cell->get_dof_indices(dofs);
153 const auto &cells = std::get<0>(cpm);
155 for (
unsigned int c=0; c<cells.size(); ++c)
159 ocell(*cells[c], &space_dh);
161 if (ocell->is_locally_owned())
163 ocell->get_dof_indices(odofs);
175 template<
int dim0,
int dim1,
int spacedim,
typename Matrix>
188 quad, matrix, constraints, space_comps, immersed_comps,
194 template<
int dim0,
int dim1,
int spacedim,
typename Matrix>
207 static_assert(dim1 <= dim0,
"This function can only work if dim1 <= dim0");
211 const auto &space_fe = space_dh.
get_fe();
212 const auto &immersed_fe = immersed_dh.
get_fe();
215 std::vector<types::global_dof_index> dofs(immersed_fe.dofs_per_cell);
216 std::vector<types::global_dof_index> odofs(space_fe.dofs_per_cell);
220 = (space_comps.
size() == 0 ?
225 = (immersed_comps.
size() == 0 ?
235 for (
unsigned int i=0, j=0; i<space_gtl.size(); ++i)
239 for (
unsigned int i=0, j=0; i<immersed_gtl.size(); ++i)
241 immersed_gtl[i] = j++;
244 immersed_dh.
get_fe().dofs_per_cell);
254 endc = immersed_dh.
end();
256 for (; cell != endc; ++cell)
260 cell->get_dof_indices(dofs);
262 const std::vector<Point<spacedim> > &Xpoints = fe_v.get_quadrature_points();
266 const auto &cells = std::get<0>(cpm);
267 const auto &qpoints = std::get<1>(cpm);
268 const auto &maps = std::get<2>(cpm);
270 for (
unsigned int c=0; c<cells.size(); ++c)
274 ocell(*cells[c], &space_dh);
276 if (ocell->is_locally_owned())
278 const std::vector< Point<dim0> > &qps = qpoints[c];
279 const std::vector< unsigned int > &ids = maps[c];
284 ocell->get_dof_indices(odofs);
287 cell_matrix =
typename Matrix::value_type();
289 for (
unsigned int i=0; i<space_dh.
get_fe().dofs_per_cell; ++i)
291 const auto comp_i = space_dh.
get_fe().system_to_component_index(i).first;
293 for (
unsigned int j=0; j<immersed_dh.
get_fe().dofs_per_cell; ++j)
295 const auto comp_j = immersed_dh.
get_fe().system_to_component_index(j).first;
296 if (space_gtl[comp_i] == immersed_gtl[comp_j])
297 for (
unsigned int oq=0; oq<o_fe_v.n_quadrature_points; ++oq)
300 const unsigned int q=ids[oq];
302 cell_matrix(i,j) += ( fe_v.shape_value(j,q) *
303 o_fe_v.shape_value(i,oq) *
316 #include "coupling.inst" 320 DEAL_II_NAMESPACE_CLOSE
Transformed quadrature weights.
static const unsigned int invalid_unsigned_int
void create_coupling_mass_matrix(const DoFHandler< dim0, spacedim > &space_dh, const DoFHandler< dim1, spacedim > &immersed_dh, const Quadrature< dim1 > &quad, Matrix &matrix, const ConstraintMatrix &constraints=ConstraintMatrix(), const ComponentMask &space_comps=ComponentMask(), const ComponentMask &immersed_comps=ComponentMask(), const Mapping< dim0, spacedim > &space_mapping=StaticMappingQ1< dim0, spacedim >::mapping, const Mapping< dim1, spacedim > &immersed_mapping=StaticMappingQ1< dim1, spacedim >::mapping)
#define AssertDimension(dim1, dim2)
void create_coupling_sparsity_pattern(const DoFHandler< dim0, spacedim > &space_dh, const DoFHandler< dim1, spacedim > &immersed_dh, const Quadrature< dim1 > &quad, Sparsity &sparsity, const ConstraintMatrix &constraints=ConstraintMatrix(), const ComponentMask &space_comps=ComponentMask(), const ComponentMask &immersed_comps=ComponentMask(), const Mapping< dim0, spacedim > &space_mapping=StaticMappingQ1< dim0, spacedim >::mapping, const Mapping< dim1, spacedim > &immersed_mapping=StaticMappingQ1< dim1, spacedim >::mapping)
cell_iterator end() const
ActiveSelector::active_cell_iterator active_cell_iterator
Transformed quadrature points.
active_cell_iterator begin_active(const unsigned int level=0) const
const std::vector< Point< spacedim > > & get_quadrature_points() const
ActiveSelector::cell_iterator cell_iterator
#define Assert(cond, exc)
Abstract base class for mapping classes.
void distribute_local_to_global(const InVector &local_vector, const std::vector< size_type > &local_dof_indices, OutVector &global_vector) const
const FiniteElement< dim, spacedim > & get_fe(const unsigned int index=0) const
types::global_dof_index n_dofs() const
unsigned int size() const
void add_entries_local_to_global(const std::vector< size_type > &local_dof_indices, SparsityPatternType &sparsity_pattern, const bool keep_constrained_entries=true, const Table< 2, bool > &dof_mask=default_empty_table) const
static ::ExceptionBase & ExcNotImplemented()
const Triangulation< dim, spacedim > & get_triangulation() const
void reinit(const TriaIterator< DoFCellAccessor< DoFHandlerType< dim, spacedim >, level_dof_access > > &cell)