686 {
689
690 std::unique_ptr<CouplingMatrix> coupling_matrix;
691 if (build_coupling_matrix)
693
695
696
697
698
700 coupling_functor.set_coupling_matrix(coupling_matrix);
701
705
706
708
712
714
715
716
719
720
721
725
726 std::unique_ptr<PointLocatorBase> point_locator =
_mesh->sub_point_locator();
727
730
732
734 subdomain_one_context.get_element_fe(u_var)->get_nothing();
735 subdomain_one_context.get_element_fe(v_var)->get_nothing();
736
738 subdomain_two_context.get_element_fe(u_var)->get_xyz();
739 subdomain_two_context.get_element_fe(v_var)->get_nothing();
740
741
742 for (
const auto & elem :
_mesh->active_local_subdomain_elements_ptr_range(1))
743 {
744 subdomain_one_context.pre_fe_reinit(system,elem);
745 subdomain_one_context.elem_fe_reinit();
746
747 std::vector<dof_id_type> & rows = subdomain_one_context.get_dof_indices();
748
749
750 std::fill( subdomain_one_context.get_elem_jacobian().get_values().begin(),
751 subdomain_one_context.get_elem_jacobian().get_values().end(),
752 1);
753
754
755 matrix.
add_matrix( subdomain_one_context.get_elem_jacobian(), rows );
756 }
757
758 for (
const auto & elem :
_mesh->active_local_subdomain_elements_ptr_range(2))
759 {
760
761 CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(elem->subdomain_id()));
762
763 const std::vector<libMesh::Point> & qpoints = subdomain_two_context.get_element_fe(u_var)->get_xyz();
764
765
766 subdomain_two_context.pre_fe_reinit(system,elem);
767 subdomain_two_context.elem_fe_reinit();
768
769
770
771 std::vector<dof_id_type> & rows = subdomain_two_context.get_dof_indices();
772
773 std::fill( subdomain_two_context.get_elem_jacobian().get_values().begin(),
774 subdomain_two_context.get_elem_jacobian().get_values().end(),
775 1);
776
777
778 matrix.
add_matrix( subdomain_two_context.get_elem_jacobian(), rows );
779
780 std::set<subdomain_id_type> allowed_subdomains;
781 allowed_subdomains.insert(1);
782
783
784
785
786
787 for ( const auto & qp : qpoints )
788 {
789 const Elem * overlapping_elem = (*point_locator)( qp, &allowed_subdomains );
790 CPPUNIT_ASSERT(overlapping_elem);
791
792
793 subdomain_one_context.pre_fe_reinit(system,overlapping_elem);
794 subdomain_one_context.elem_fe_reinit();
795
796
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() );
800
801
802 K21.
resize( rows.size(), columns.size() );
803
805
806
807
808
810
811
812 K12.
resize(v_indices.size(), rows.size());
815 }
816 }
817
818
819
820
822 }
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