667 std::unique_ptr<CouplingMatrix> coupling_matrix;
668 if (build_coupling_matrix)
677 coupling_functor.set_coupling_matrix(coupling_matrix);
703 std::unique_ptr<PointLocatorBase> point_locator =
_mesh->sub_point_locator();
711 subdomain_one_context.get_element_fe(u_var)->get_nothing();
712 subdomain_one_context.get_element_fe(v_var)->get_nothing();
715 subdomain_two_context.get_element_fe(u_var)->get_xyz();
716 subdomain_two_context.get_element_fe(v_var)->get_nothing();
719 for (
const auto & elem :
_mesh->active_local_subdomain_elements_ptr_range(1))
721 subdomain_one_context.pre_fe_reinit(system,elem);
722 subdomain_one_context.elem_fe_reinit();
724 std::vector<dof_id_type> & rows = subdomain_one_context.get_dof_indices();
727 std::fill( subdomain_one_context.get_elem_jacobian().get_values().begin(),
728 subdomain_one_context.get_elem_jacobian().get_values().end(),
732 matrix.
add_matrix( subdomain_one_context.get_elem_jacobian(), rows );
735 for (
const auto & elem :
_mesh->active_local_subdomain_elements_ptr_range(2))
738 CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(elem->subdomain_id()));
740 const std::vector<libMesh::Point> & qpoints = subdomain_two_context.get_element_fe(u_var)->get_xyz();
743 subdomain_two_context.pre_fe_reinit(system,elem);
744 subdomain_two_context.elem_fe_reinit();
748 std::vector<dof_id_type> & rows = subdomain_two_context.get_dof_indices();
750 std::fill( subdomain_two_context.get_elem_jacobian().get_values().begin(),
751 subdomain_two_context.get_elem_jacobian().get_values().end(),
755 matrix.
add_matrix( subdomain_two_context.get_elem_jacobian(), rows );
757 std::set<subdomain_id_type> allowed_subdomains;
758 allowed_subdomains.insert(1);
764 for (
const auto & qp : qpoints )
766 const Elem * overlapping_elem = (*point_locator)( qp, &allowed_subdomains );
767 CPPUNIT_ASSERT(overlapping_elem);
770 subdomain_one_context.pre_fe_reinit(system,overlapping_elem);
771 subdomain_one_context.elem_fe_reinit();
774 std::vector<dof_id_type> & v_indices = subdomain_one_context.get_dof_indices(v_var);
775 std::vector<dof_id_type> columns(rows);
776 columns.insert( columns.end(), v_indices.begin(), v_indices.end() );
779 K21.
resize( rows.size(), columns.size() );
789 K12.
resize(v_indices.size(), rows.size());
void setup_coupling_matrix(std::unique_ptr< CouplingMatrix > &coupling)
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
bool is_attached(SparseMatrix< Number > &matrix)
Matrices should not be attached more than once.
This is the base class from which all geometric element types are derived.
const Parallel::Communicator & comm() const
dof_id_type n_local_dofs() const
const MeshBase & get_mesh() const
void add_coupling_functor(GhostingFunctor &coupling_functor, bool to_mesh=true)
Adds a functor which can specify coupling requirements for creation of sparse matrices.
dof_id_type n_dofs() const
unsigned int variable_number(std::string_view var) const
std::unique_ptr< MeshBase > _mesh
std::unique_ptr< EquationSystems > _es
This class handles the numbering of degrees of freedom on a mesh.
void build_quad_mesh(unsigned int n_refinements=0)
void reinit_send_list(MeshBase &mesh)
Clears the _send_list vector and then rebuilds it.
virtual void add_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols)=0
Add the full matrix dm to the SparseMatrix.
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
This class provides all data required for a physics package (e.g.
std::vector< T > & get_values()
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
virtual void close()=0
Calls the SparseMatrix's internal assembly routines, ensuring that the values are consistent across p...
void resize(const unsigned int new_m, const unsigned int new_n)
Resizes the matrix to the specified size and calls zero().
void clear_sparsity()
Clears the sparsity pattern.
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
void compute_sparsity(const MeshBase &)
Computes the sparsity pattern for the matrices corresponding to proc_id and sends that data to Linear...
const DofMap & get_dof_map() const
const SparseMatrix< Number > & get_system_matrix() const
const std::vector< dof_id_type > & get_send_list() const
virtual void init(const numeric_index_type m, const numeric_index_type n, const numeric_index_type m_l, const numeric_index_type n_l, const numeric_index_type nnz=30, const numeric_index_type noz=10, const numeric_index_type blocksize=1)=0
Initialize SparseMatrix with the specified sizes.