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:                 [email protected]
                           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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/16ea2df7-2751-b926-7323-2dc208f3587a%40colostate.edu.

Reply via email to