Ok thank you that has resolved most of the adding issue. I am still 
receiving the following error. It reads to me that there's still an error 
on the 'FullMatrix::add()' function. I have verified that they are all gone 
however. What else should I be looking for?




An error occurred in line <1335> of file 
</home/u7/nholtzer/dealii-9.1.1/include/deal.II/lac/full_matrix.h> in 
function

    void dealii::FullMatrix< <template-parameter-1-1> 
>::add(dealii::FullMatrix< <template-parameter-1-1> >::size_type, 
dealii::FullMatrix< <template-parameter-1-1> >::size_type, const 
index_type*, const number2*, bool, bool) [with number2 = double; index_type 
= unsigned int; number = double; dealii::FullMatrix< 
<template-parameter-1-1> >::size_type = long unsigned int]

The violated condition was:

    static_cast<typename ::dealii::internal::argument_type<void( typename 
std::common_type<decltype(row), decltype(this->m())>::type)>:: type>(row) < 
static_cast<typename ::dealii::internal::argument_type<void( typename 
std::common_type<decltype(row), decltype(this->m())>::type)>:: 
type>(this->m())

Additional information:

    Index 0 is not in the half-open range [0,0). In the current case, this 
half-open range is in fact empty, suggesting that you are accessing an 
element of an empty collection such as a vector that has not been set to 
the correct size.


Stacktrace:

-----------

#0  /home/u7/nholtzer/dealii-9.1.1/lib/libdeal_II.g.so.9.1.1: void 
dealii::FullMatrix<double>::add<double, unsigned int>(unsigned long, 
unsigned long, unsigned int const*, double const*, bool, bool)

#1  /home/u7/nholtzer/dealii-9.1.1/lib/libdeal_II.g.so.9.1.1: void 
dealii::AffineConstraints<double>::distribute_local_to_global<dealii::FullMatrix<double>,
 
dealii::Vector<double> >(dealii::FullMatrix<double> const&, 
dealii::Vector<double> const&, std::vector<unsigned int, 
std::allocator<unsigned int> > const&, dealii::FullMatrix<double>&, 
dealii::Vector<double>&, bool, std::integral_constant<bool, false>) const

#2  ./gravwave: void 
dealii::AffineConstraints<double>::distribute_local_to_global<dealii::FullMatrix<double>
 
>(dealii::FullMatrix<double> const&, std::vector<unsigned int, 
std::allocator<unsigned int> > const&, dealii::FullMatrix<double>&) const

#3  ./gravwave: OfflineData<1>::assemble()

#4  ./gravwave: OfflineData<1>::prepare()

#5  ./gravwave: main


On Tuesday, October 13, 2020 at 3:37:03 PM UTC-4 Wolfgang Bangerth wrote:

> On 10/13/20 10:28 AM, Nikki Holtzer wrote:
> > The issue that I have when  all matrices are FullMatrix matrices is I 
> can't 
> > seem to get the .add function to result in anything other than error. If 
> I 
> > keep ONLY both nonlinear_part and linear_part as FullMatrix
> > I receive:
> > 
> > error: no matching function for call to 
> > ‘dealii::FullMatrix<double>::add(double, const 
> dealii::SparseMatrix<double>&)’
> > 
> >    linear_part.add((1. - theta) * kappa, S_c);
> > 
> > 
> > Which leads me to believe that I cannot add a SparseMatrix (S_c) to a 
> > FullMatrix (linear_part).
>
> Correct -- there is no such function.
>
>
> > I tried to back track and change S_c to be a 
> > FullMatrix instead of a SparseMatrix
> > 
> > For instance:
> > 
> > 
> > FullMatrix<double> mass_matrix_unconstrainted;
> > mass_matrix_unconstrained = 0;
> > FullMatrix<double> cell_mass_matrix(dofs_per_cell, dofs_per_cell);
> > cell_mass_matrix = 0;
> > 
> > 
> > Then I fill cell_mass_matrix.
> > 
> > mass_matrix_unconstrained.add(local_dof_indices, cell_mass_matrix);
> > 
> > error: no matching function for call to 
> > ‘dealii::FullMatrix<double>::add(std::vector<unsigned int>&, 
> > dealii::FullMatrix<double>&)’
> > 
> >      mass_matrix_unconstrained.add(local_dof_indices, cell_mass_matrix);
>
> Right, that function also doesn't exist, but you could do
> for (unsigned int i=0; i<dofs_per_cell; ++i)
> for (unsigned int j=0; j<dofs_per_cell; ++j)
> mass_matrix_unconstrainted(local_dof_indices[i], local_dof_indices[j])
> += cell_mass_matrix(i,j);
>
>
> > Alternatively if I try:
> > 
> > mass_matrix_unconstrained = mass_matrix_unconstrained  + 
> > local_dof_indices*cell_mass_matrix;
> > 
> > 
> > I receive.
> > 
> > error: no match for ‘operator*’ (operand types are ‘std::vector<unsigned 
> int>’ 
> > and ‘dealii::FullMatrix<double>’)
>
> Right. There is also no operator* for vector<unsigned int> and 
> FullMatrix<double>. It's also unclear to me what exactly that would 
> actually 
> supposed to do.
>
> Writing the double-loop above is the way to go.
>
> Best
> W.
>
>
> -- 
> ------------------------------------------------------------------------
> Wolfgang Bangerth email: bang...@colostate.edu
> www: http://www.math.colostate.edu/~bangerth/
>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/54a09c9d-cfe6-4cd9-9899-f3138b1221c2n%40googlegroups.com.

Reply via email to