688 {
691
692 std::unique_ptr<CouplingMatrix> coupling_matrix;
693 if (build_coupling_matrix)
695
697
698
699
700
702 coupling_functor.set_coupling_matrix(coupling_matrix);
703
707
708
710
714
716
717
718
721
722
723
727
728 std::unique_ptr<PointLocatorBase> point_locator =
_mesh->sub_point_locator();
729
732
734
736 subdomain_one_context.get_element_fe(u_var)->get_nothing();
737 subdomain_one_context.get_element_fe(v_var)->get_nothing();
738
740 subdomain_two_context.get_element_fe(u_var)->get_xyz();
741 subdomain_two_context.get_element_fe(v_var)->get_nothing();
742
743
744 for (
const auto & elem :
_mesh->active_local_subdomain_elements_ptr_range(1))
745 {
746 subdomain_one_context.pre_fe_reinit(system,elem);
747 subdomain_one_context.elem_fe_reinit();
748
749 std::vector<dof_id_type> & rows = subdomain_one_context.get_dof_indices();
750
751
752 std::fill( subdomain_one_context.get_elem_jacobian().get_values().begin(),
753 subdomain_one_context.get_elem_jacobian().get_values().end(),
754 1);
755
756
757 matrix.
add_matrix( subdomain_one_context.get_elem_jacobian(), rows );
758 }
759
760 for (
const auto & elem :
_mesh->active_local_subdomain_elements_ptr_range(2))
761 {
762
763 CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(elem->subdomain_id()));
764
765 const std::vector<libMesh::Point> & qpoints = subdomain_two_context.get_element_fe(u_var)->get_xyz();
766
767
768 subdomain_two_context.pre_fe_reinit(system,elem);
769 subdomain_two_context.elem_fe_reinit();
770
771
772
773 std::vector<dof_id_type> & rows = subdomain_two_context.get_dof_indices();
774
775 std::fill( subdomain_two_context.get_elem_jacobian().get_values().begin(),
776 subdomain_two_context.get_elem_jacobian().get_values().end(),
777 1);
778
779
780 matrix.
add_matrix( subdomain_two_context.get_elem_jacobian(), rows );
781
782 std::set<subdomain_id_type> allowed_subdomains;
783 allowed_subdomains.insert(1);
784
785
786
787
788
789 for ( const auto & qp : qpoints )
790 {
791 const Elem * overlapping_elem = (*point_locator)( qp, &allowed_subdomains );
792 CPPUNIT_ASSERT(overlapping_elem);
793
794
795 subdomain_one_context.pre_fe_reinit(system,overlapping_elem);
796 subdomain_one_context.elem_fe_reinit();
797
798
799 std::vector<dof_id_type> & v_indices = subdomain_one_context.get_dof_indices(v_var);
800 std::vector<dof_id_type> columns(rows);
801 columns.insert( columns.end(), v_indices.begin(), v_indices.end() );
802
803
804 K21.
resize( rows.size(), columns.size() );
805
807
808
809
810
812
813
814 K12.
resize(v_indices.size(), rows.size());
817 }
818 }
819
820
821
822
824 }
void setup_coupling_matrix(std::unique_ptr< CouplingMatrix > &coupling)
void build_quad_mesh(unsigned int n_refinements=0)
Defines a dense matrix for use in Finite Element-type computations.
std::vector< T > & get_values()
void resize(const unsigned int new_m, const unsigned int new_n)
Resizes the matrix to the specified size and calls zero().
This class handles the numbering of degrees of freedom on a mesh.
void reinit_send_list(MeshBase &mesh)
Clears the _send_list vector and then rebuilds it.
const std::vector< dof_id_type > & get_send_list() const
bool is_attached(SparseMatrix< Number > &matrix)
Matrices should not be attached more than once.
void compute_sparsity(const MeshBase &)
Computes the sparsity pattern for the matrices corresponding to proc_id and sends that data to Linear...
void clear_sparsity()
Clears the sparsity pattern.
void add_coupling_functor(GhostingFunctor &coupling_functor, bool to_mesh=true)
Adds a functor which can specify coupling requirements for creation of sparse matrices.
This class provides all data required for a physics package (e.g.
const SparseMatrix< Number > & get_system_matrix() const
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...
const Parallel::Communicator & comm() 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.
virtual void close()=0
Calls the SparseMatrix's internal assembly routines, ensuring that the values are consistent across p...
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 > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
dof_id_type n_dofs() const
dof_id_type n_local_dofs() const
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
unsigned int variable_number(std::string_view var) const
const DofMap & get_dof_map() const
const MeshBase & get_mesh() const