hp fem error assigning Fourier

23 views
Skip to first unread message

A.Z Ihsan

unread,
Jun 5, 2020, 4:40:29 AM6/5/20
to deal.II User Group

Hi All, 

I am trying to implement hp-fem into my problem according to the step-27. But, i have an error when i am trying to compile, 

error: no matching function for call to 'dealii::FESeries::Fourier<3, 3>::Fourier(std::vector<unsigned int>&, dealii::hp::FECollection<3, 3>&, dealii::hp::QCollection<3>&)'
     { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }

i believe there is a mistake in assigning fourier, but i copied the step-27 exactly. 
Here is the code snippet... could someone help me?

template <int dim, typename VectorType>
class HPSolver
{
public:
    HPSolver(
        const unsigned int max_fe_degree);
    virtual ~HPSolver();

    const hp::FECollection<dim>& get_fe_collection();
    const hp::QCollection<dim-1>& get_face_quadrature_collection();   
 
protected:
    hp::FECollection<dim> fe_collection;
    hp::QCollection<dim> quadrature_collection;
    hp::QCollection<dim-1> face_quadrature_collection;
    hp::QCollection<dim>  fourier_q_collection;
    std::unique_ptr<FESeries::Fourier<dim>> fourier;
    std::vector<double>                     ln_k;
    Table<dim, std::complex<double>>        fourier_coefficients;
};

template <int dim, typename VectorType>
HPSolver<dim, VectorType>::HPSolver(
    const unsigned int max_degree,
    :
    max_fe_degree(max_degree)
{
    for (unsigned int degree=2; degree <= max_fe_degree; ++degree)
      {
        fe_collection.push_back(FE_Q<dim>(degree));
        quadrature_collection.push_back(QGauss<dim>(degree+1));
        face_quadrature_collection.push_back(QGauss<dim-1>(degree+1));
      }
    const unsigned int N = max_fe_degree;
    QGauss<1>      base_quadrature(2);
    QIterated<dim> quadrature(base_quadrature, N);
    for (unsigned int i = 0; i < fe_collection.size(); i++)
      fourier_q_collection.push_back(quadrature);
    std::vector<unsigned int> n_coefficients_per_direction(fe_collection.size(), N);
    fourier = std_cxx14::make_unique<FESeries::Fourier<dim>>(n_coefficients_per_direction, fe_collection, fourier_q_collection);
    resize(fourier_coefficients, N);
}

BR, 
Ihsan

peterrum

unread,
Jun 5, 2020, 4:57:07 AM6/5/20
to deal.II User Group
Dear Ihsan,

I have no problem to compile the following code (your code with minor adjustments):


#include <deal.II/hp/fe_values.h>
#include <deal.II/fe/fe_series.h>
#include <deal.II/fe/fe_q.h>
#include <deal.II/lac/vector.h>

using namespace dealii;

template <int dim, typename VectorType>
class HPSolver
{
public:
   HPSolver(
       const unsigned int max_fe_degree);
   //virtual ~HPSolver();

    const hp::FECollection<dim>& get_fe_collection();
   const hp::QCollection<dim-1>& get_face_quadrature_collection();  
 
protected:
   hp::FECollection<dim> fe_collection;
   hp::QCollection<dim> quadrature_collection;
   hp::QCollection<dim-1> face_quadrature_collection;
   hp::QCollection<dim>  fourier_q_collection;
   std::unique_ptr<FESeries::Fourier<dim>> fourier;
   std::vector<double>                     ln_k;
   Table<dim, std::complex<double>>        fourier_coefficients;
};

template <int dim, typename VectorType>
HPSolver<dim, VectorType>::HPSolver(
   const unsigned int max_degree)
{
   for (unsigned int degree=2; degree <= max_degree; ++degree)
     {
       fe_collection.push_back(FE_Q<dim>(degree));
       quadrature_collection.push_back(QGauss<dim>(degree+1));
       face_quadrature_collection.push_back(QGauss<dim-1>(degree+1));
     }
   const unsigned int N = max_degree;
   QGauss<1>      base_quadrature(2);
   QIterated<dim> quadrature(base_quadrature, N);
   for (unsigned int i = 0; i < fe_collection.size(); i++)
     fourier_q_collection.push_back(quadrature);
   std::vector<unsigned int> n_coefficients_per_direction(fe_collection.size(), N);
   fourier = std::make_unique<FESeries::Fourier<dim>>(n_coefficients_per_direction, fe_collection, fourier_q_collection);
   //resize(fourier_coefficients, N);
}

int main()
{
   HPSolver<3,Vector<double> > solver(3);
}


So my guess is that you have forgotten: `#include <deal.II/fe/fe_series.h>`?

Hope this helps!

Peter

A.Z Ihsan

unread,
Jun 5, 2020, 6:25:47 AM6/5/20
to deal.II User Group
Hi Peter, 
thank you for the answer. Actually i did put the fe_series.h. 
I forgot to mention that the problem arise when i use template specialization by the end the implementation

#include <deal.II/hp/fe_values.h>
#include <deal.II/fe/fe_series.h>
#include <deal.II/fe/fe_q.h>
#include <deal.II/lac/vector.h>

using namespace dealii;

namespace hpfe{
}
}
template class hpfe::HPSolver<3, Vector<double>> ;

can you try once more?

BR, 
ihsan

A.Z Ihsan

unread,
Jun 8, 2020, 3:56:21 AM6/8/20
to deal.II User Group
Oops, i was wrong. I followed the deal.ii 9.2.0 tutorial meanwhile in my local deal.ii version is 9.1.
There is a couple different implementation in terms of FESeries::Fourier.

peterrum

unread,
Jun 8, 2020, 4:10:18 AM6/8/20
to deal.II User Group
Dear Ihsan,

is the issue solved now? I have compiled your code with the current version of deal.II and it works.

Peter 

A.Z Ihsan

unread,
Jun 8, 2020, 6:11:25 AM6/8/20
to deal.II User Group
Hi Peter, 

yes, it is solved now. Thanks Peter. 

In deal.ii 9.2.0 the implementation detail of FESeries::Fourier constructor can take the first argument  of std::vector<unsigned int>, meanwhile in deal.ii 9.1 only unsigned int.

BR, 
Ihsan

Marc Fehling

unread,
Jun 8, 2020, 6:39:29 AM6/8/20
to deal.II User Group
Hi Ishan!

You are correct: We opted for a more versatile approach in transforming solutions into Fourier or Legendre series with deal.II 9.2. Glad you figured it out!

Marc
Reply all
Reply to author
Forward
0 new messages