Toby,

> source/dofs/dof_accessor.cc: In member function 'void
> dealii::DoFCellAccessor<DH>::get_interpolated_dof_values(const
> InputVector&, dealii::Vector<number3>&) const [with InputVector =
> dealii::PETScWrappers::Vector, number = std::complex<double>, DH =
> dealii::DoFHandler<2, 2>]':
> source/dofs/dof_accessor.cc:182: error: no match for 'operator!=' in
> 'tmp2. dealii::Vector<Number>::operator() [with Number =
> std::complex<double>](i) != 0'
> source/dofs/dof_accessor.cc: In member function 'void
> dealii::DoFCellAccessor<DH>::get_interpolated_dof_values(const
> InputVector&, dealii::Vector<number3>&) const [with InputVector =
> dealii::PETScWrappers::Vector, number = std::complex<double>, DH =
> dealii::DoFHandler<2, 3>]':
> [...]
> I figure I need somehow to define the operator!= for
> std::complex<double>, which I feel safe doing...

No, you're on the wrong track. I think this is a design flaw of C++ in that 
the following doesn't work
    std::complex<double> x;
    if (x != 0) ...
C++ doesn't say that you can compare a complex number with a real. I find 
that particularly awkward if the real is zero. The way to write this is 
using the following patch that I've just check in. It uses that number() 
produces a zero of type 'number', whether that's an integer, real, or 
complex number.

If you find other places where you get the same problem, you may want to 
change the code in a similar way.

Best
 Wolfgang

Index: dof_accessor.cc
===================================================================
--- dof_accessor.cc     (revision 19993)
+++ dof_accessor.cc     (working copy)
@@ -179,7 +179,7 @@
             if (restriction_is_additive[i]) 
               interpolated_values(i) += tmp2(i);
             else
-              if (tmp2(i) != 0)
+              if (tmp2(i) != number())
                 interpolated_values(i) = tmp2(i);
        }
     }


-------------------------------------------------------------------------
Wolfgang Bangerth                email:            [email protected]
                                 www: http://www.math.tamu.edu/~bangerth/

_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to