[Dune] Dune::BlockVector and complex fieldtype

Christian Engwer christi at uni-hd.de
Wed Jul 9 14:23:24 CEST 2008


Hi Daniel,

> I also tried the latest release 1.1. The problem is the same. 
> Of course, I could initialize immediately, i.e.
> Dune::BlockVector<Dune::FieldVector<std::complex<double>,1> > v(0.0);
> That works fine, but usually I want to use the resize function in between 
> and, morover, initializations of the type
> v=0;
> are used by the istl preconditioner and solver classes. 
> Do you know a way to circumvent the problem?

One ofthe problems is rather obvious. Yo uare using filef_type
complex<double>, but trying to assign from double. This will not work,
well it could be, if we would have added some extra tricks for
complex, but we didn't.

What should work is:

v = std::complex<double>(0.0);

> > causes "ambiguous overload error":
> > 
> > Fehler: ambiguous overload für »operator=« in »v = 0.0«
> > /usr/local/include/dune/istl/bvector.hh:424: Anmerkung: Kandidaten sind: Dune::BlockVector<B, A>& Dune::BlockVector<B, A>::operator=(const Dune::BlockVector<B, A>&) [with B = Dune::FieldVector<std::complex<double>, 1>, A = Dune::ISTLAllocator]
> > /usr/local/include/dune/istl/bvector.hh:457: Anmerkung:                  Dune::BlockVector<B, A>& Dune::BlockVector<B, A>::operator=(const typename B::field_type&) [with B = Dune::FieldVector<std::complex<double>, 1>, A = Dune::ISTLAllocator]
> > 
> > The problem arises also when I call "apply" for some iterative solver object from the istl-module in case of a complex valued matrix.
> > 
> > What is the right way to use complex fieldtype?

I'm not sure what kind of constructs are used in the iterative
solvers, and whether problems like yours are present there too. If
something does not work, please fsubmit a bug in the bug tracking
system.

I think you are one of the first persons using complex in productive
code.

In case you find problems, please try to provide test cases.

Hope I could help
  Christian

PS: Please send replies to the mailinglist, so that people with the
    similar problems can find the answer on the list.




More information about the Dune mailing list