Hi!
I've recently swapped from another FEM package to deal.ii and love it so 
far. I recently managed so far to get a correct solution out for my 
complex-valued, nonlinear PDE. So that's good! What I am a bit confused 
about is the following: How do I use the VectorTools::project() type of 
function for a general, complex-valued function?

I've tried something like
/*****************/
typedef std::complex<double> dcomp;
template <int dim>
class Delta_of_x : public Function<dim, dcomp>
{
    public:
        virtual dcomp value(const Point<dim> &p,
        const unsigned int component = 0) const override;
};

template <int dim>
dcomp Delta_of_x<dim>::value(const Point<dim> &p,
const unsigned int component) const
{     dcomp returner;
       if (component == 0){
          returner= p[0]*p[0]; // dummy value, this can be more complicated
       }
     return returner;
}
/*********************************/
The above function works fine and as it should when used e.g. in the weak 
form.

After solving I want to output my solution, and my function Delta as well. 
So I tried to use:

/******************************/
AffineConstraints<dcomp> constraints;
constraints.close();
VectorTools::project(dof_handler, constraints, QGauss<dim>(degree + 2), 
Delta_of_x<dim>(), Delta_profile);
/*****************************************************/

This compiles just fine, but during linking I get the error message:
############################################
/path/to/myProject/dg_real.cc:690: error: undefined reference to 'void 
dealii::VectorTools::project<1, dealii::Vector<std::complex<double> > 
const, 1>(dealii::DoFHandler<1, 1> const&, 
dealii::AffineConstraints<dealii::Vector<std::complex<double> > 
const::value_type> const&, dealii::Quadrature<1> const&, 
dealii::Function<1, dealii::Vector<std::complex<double> > 
const::value_type> const&, dealii::Vector<std::complex<double> > const&, 
bool, dealii::Quadrature<(1)-(1)> const&, bool)'
/path/to/myProject/dg_real.cc:690: error: undefined reference to 'void 
dealii::VectorTools::project<2, dealii::Vector<std::complex<double> > 
const, 2>(dealii::DoFHandler<2, 2> const&, 
dealii::AffineConstraints<dealii::Vector<std::complex<double> > 
const::value_type> const&, dealii::Quadrature<2> const&, 
dealii::Function<2, dealii::Vector<std::complex<double> > 
const::value_type> const&, dealii::Vector<std::complex<double> > const&, 
bool, dealii::Quadrature<(2)-(1)> const&, bool)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/dg_real.dir/build.make:127: dg_real] Error 1
make[1]: *** [CMakeFiles/Makefile2:90: CMakeFiles/dg_real.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

############################################

What is going wrong here? I took the code for projecting from an example, 
and tried to adapt it to complex, but it seems like something is missing, 
or there is a mistake I cannot understand. Thank you for any input

-- 
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/85471a57-1d27-4a6d-b4d4-5350dc794d8en%40googlegroups.com.

Reply via email to