690 std::unique_ptr<CouplingMatrix> coupling_matrix;
691 if (build_coupling_matrix)
700 coupling_functor.set_coupling_matrix(coupling_matrix);
726 std::unique_ptr<PointLocatorBase> point_locator =
_mesh->sub_point_locator();
734 subdomain_one_context.get_element_fe(u_var)->get_nothing();
735 subdomain_one_context.get_element_fe(v_var)->get_nothing();
738 subdomain_two_context.get_element_fe(u_var)->get_xyz();
739 subdomain_two_context.get_element_fe(v_var)->get_nothing();
742 for (
const auto & elem :
_mesh->active_local_subdomain_elements_ptr_range(1))
744 subdomain_one_context.pre_fe_reinit(system,elem);
745 subdomain_one_context.elem_fe_reinit();
747 std::vector<dof_id_type> & rows = subdomain_one_context.get_dof_indices();
750 std::fill( subdomain_one_context.get_elem_jacobian().get_values().begin(),
751 subdomain_one_context.get_elem_jacobian().get_values().end(),
755 matrix.
add_matrix( subdomain_one_context.get_elem_jacobian(), rows );
758 for (
const auto & elem :
_mesh->active_local_subdomain_elements_ptr_range(2))
761 CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(elem->subdomain_id()));
763 const std::vector<libMesh::Point> & qpoints = subdomain_two_context.get_element_fe(u_var)->get_xyz();
766 subdomain_two_context.pre_fe_reinit(system,elem);
767 subdomain_two_context.elem_fe_reinit();
771 std::vector<dof_id_type> & rows = subdomain_two_context.get_dof_indices();
773 std::fill( subdomain_two_context.get_elem_jacobian().get_values().begin(),
774 subdomain_two_context.get_elem_jacobian().get_values().end(),
778 matrix.
add_matrix( subdomain_two_context.get_elem_jacobian(), rows );
780 std::set<subdomain_id_type> allowed_subdomains;
781 allowed_subdomains.insert(1);
787 for (
const auto & qp : qpoints )
789 const Elem * overlapping_elem = (*point_locator)( qp, &allowed_subdomains );
790 CPPUNIT_ASSERT(overlapping_elem);
793 subdomain_one_context.pre_fe_reinit(system,overlapping_elem);
794 subdomain_one_context.elem_fe_reinit();
797 std::vector<dof_id_type> & v_indices = subdomain_one_context.get_dof_indices(v_var);
798 std::vector<dof_id_type> columns(rows);
799 columns.insert( columns.end(), v_indices.begin(), v_indices.end() );
802 K21.
resize( rows.size(), columns.size() );
812 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()
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().
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, SolverPackage solver_package=libMesh::default_solver_package(), ParallelType parallel_type=AUTOMATIC)
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
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.