How to call project_matrix_free?

20 views
Skip to first unread message

Maxi Miller

unread,
Mar 7, 2018, 7:51:06 AM3/7/18
to deal.II User Group
Based on my question here: https://groups.google.com/d/msg/dealii/4YoJZ8d2-XM/0k3TjZrqAAAJ I would like to implement the suggested solution using project_matrix_free() and project_matrix_free_vector(). I thus try to call them as
VectorTools::project_matrix_free(MappingQGeneric<dim>(1),
                                                 dof_handler
,
                                                 hanging_node_constraints
,
                                                 
QGauss<dim>(fe.degree + 1),
                                                 
InitialValues<dim>(),
                                                 local_solution
,
                                                 
false,
                                                 
(dim > 1 ? QGauss<dim - 1>(2):Quadrature<dim - 1>(0)),
                                                 
false);
but the compiler tells me
error: project_matrix_free is not a member of dealii::VectorTools’.
When including the .h-file where project_matrix_free is defined, I get
~/heat_equation_with_pulse_propagation/heat_equation/source/main.cpp:2390:49: error: no matching function for call to project_matrix_free(dealii::MappingQGeneric<2, 2>, dealii::DoFHandler<2, 2>&, dealii::ConstraintMatrix&, dealii::QGauss<2>, Step15::InitialValues<2>, dealii::LinearAlgebraTrilinos::MPI::Vector&, bool, dealii::Quadrature<1>, bool)’
                 
VectorTools::project_matrix_free(MappingQGeneric<dim>(1),
                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
                                                  dof_handler
,
                                                 
~~~~~~~~~~~~
                                                  hanging_node_constraints
,
                                                 
~~~~~~~~~~~~~~~~~~~~~~~~~
                                                 
QGauss<dim>(fe.degree + 1),
                                                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                 
InitialValues<dim>(),
                                                 
~~~~~~~~~~~~~~~~~~~~~
                                                  local_solution
,
                                                 
~~~~~~~~~~~~~~~
                                                 
false,
                                                 
~~~~~~
                                                 
(dim > 1 ? QGauss<dim - 1>(2):Quadrature<dim - 1>(0)),
                                                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                 
false);
                                                 
~~~~~~
In file included from ~/heat_equation_with_pulse_propagation/heat_equation/source/main.cpp:69:0:
/opt/dealii/include/deal.II/numerics/vector_tools.templates.h:1026:10: note: candidate: template<int components, int fe_degree, int dim, class Number, int spacedim> void dealii::VectorTools::{anonymous}::project_matrix_free(const dealii::Mapping<dim, spacedim>&, const dealii::DoFHandler<dim, spacedim>&, const dealii::ConstraintMatrix&, const dealii::Quadrature<dim>&, const dealii::Function<spacedim, typename dealii::LinearAlgebra::distributed::Vector<Number>::value_type>&, dealii::LinearAlgebra::distributed::Vector<Number>&, bool, const dealii::Quadrature<(dim - 1)>&, bool)
     
void project_matrix_free
         
^~~~~~~~~~~~~~~~~~~
/opt/dealii/include/deal.II/numerics/vector_tools.templates.h:1026:10: note:   template argument deduction/substitution failed:
~/heat_equation_with_pulse_propagation/heat_equation/source/main.cpp:2390:49: note:   dealii::LinearAlgebraTrilinos::MPI::Vector {aka dealii::TrilinosWrappers::MPI::Vector}’ is not derived from dealii::LinearAlgebra::distributed::Vector<Number>’
roland                
VectorTools::project_matrix_free(MappingQGeneric<dim>(1),
                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
                                                  dof_handler
,
                                                 
~~~~~~~~~~~~
                                                  hanging_node_constraints
,
                                                 
~~~~~~~~~~~~~~~~~~~~~~~~~
                                                 
QGauss<dim>(fe.degree + 1),
                                                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                 
InitialValues<dim>(),
                                                 
~~~~~~~~~~~~~~~~~~~~~
                                                  local_solution
,
                                                 
~~~~~~~~~~~~~~~
                                                 
false,
                                                 
~~~~~~
                                                 
(dim > 1 ? QGauss<dim - 1>(2):Quadrature<dim - 1>(0)),
                                                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                 
false);


with local_solution defined as
LinearAlgebraTrilinos::MPI::Vector local_solution
What did I do wrong here?
Thank you!

David Wells

unread,
Mar 7, 2018, 5:14:49 PM3/7/18
to deal.II User Group
Hi Maxi,

To build on what Daniel said in the other thread:  This function was written with the intent that users would just call `project`. `project_matrix_free` is not really part of the public interface (though perhaps we should change this). You will need to `#include <deal.II/numerics/vector_tools.templates.h>` to get the `project_matrix_free` template in your program.

A second issue is that (to avoid instantiating a lot more templates) this function is only defined for `LinearAlgebra::distributed::Vector<Number>` and not for the Trilinos wrapper vectors: you will have to copy to and from such a vector to get things to work.

Thanks,
David Wells
Reply all
Reply to author
Forward
0 new messages