← Back to team overview

dolfin team mailing list archive

Re: [Question #112556]: Linear solver in C++

 

Question #112556 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/112556

Nguyen Van Dang posted a new comment:
Thanks Mr. Johan Hake. That solved my problem.

On Tue, May 31, 2011 at 7:31 PM, Johan Hake <
question112556@xxxxxxxxxxxxxxxxxxxxx> wrote:

> Question #112556 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/112556
>
> Johan Hake posted a new comment:
> Array is included in the dolfin namespace. Exchange Array with
> dolfin::Array,
> or remove all dolfin:: from your code by including
>
>  using namespace dolfin;
>
> Have a look in any of the included C++ demos and you get a hint.
>
> Johan
>
> On Tuesday May 31 2011 10:15:57 Nguyen Van Dang wrote:
> > Question #112556 on DOLFIN changed:
> > https://answers.launchpad.net/dolfin/+question/112556
> >
> > Nguyen Van Dang posted a new comment:
> > I tried a simple program as following:
> > #include <iostream>
> > #include <dolfin.h>
> > int main()
> > {
> >  //declare and initialise
> >  int degree = 4;
> >  Array<double> x(degree + 1);
> >  Array<double> y(degree + 1);
> >  dolfin::Vector Y(degree + 1);
> >  //generate test points
> >  x[0] = 0;
> >  y[0] = 0;
> >  x[1] = 1;
> >  y[1] = -2;
> >  x[2] = 2;
> >  y[2] = -1;
> >  x[3] = 3;
> >  y[3] = -2;
> >  x[4] = 4;
> >  y[4] = 0;
> >  //set vector
> >  Y.set_local(y);
> > }
> > I got the error: 'Array' was not declared in this scope. Can you help me
> > again?
> > Thanks a lot.
> > Nguyen Van Dang
> >
> > On Tue, May 31, 2011 at 6:55 PM, Johan Hake <
> >
> > question112556@xxxxxxxxxxxxxxxxxxxxx> wrote:
> > > Question #112556 on DOLFIN changed:
> > > https://answers.launchpad.net/dolfin/+question/112556
> > >
> > > Johan Hake posted a new comment:
> > >
> > > On Tuesday May 31 2011 09:31:05 Nguyen Van Dang wrote:
> > > > Question #112556 on DOLFIN changed:
> > > > https://answers.launchpad.net/dolfin/+question/112556
> > > >
> > > > Nguyen Van Dang posted a new comment:
> > > > Hello,
> > > > When running this program on Windows, I got the following error:
> > > > no matching function for call to 'dolfin:Vector::set_local(double*&)'
> > > > candidate is: virtual void dolfin::Vector::set_local(const
> > > > dolfin::Array<double>&) Can you help me to solve this problem?
> > > > Thanks in advance.
> > > > Nguyen Van Dang
> > >
> > > You need to let x and y to be of type Array<double> instead of
> C-arrays.
> > > Exchange these lines
> > >
> > >  double *x = new double[degree + 1];
> > >  double *y = new double[degree + 1];
> > >
> > > with
> > >
> > >  Array<double> x(degree + 1);
> > >  Array<double> y(degree + 1);
> > >
> > > and you can remove the cleaning of the arrays as well.
> > >
> > > Johan
> > >
> > > --
> > > You received this question notification because you are a direct
> > > subscriber of the question.
>
> --
> You received this question notification because you are a direct
> subscriber of the question.
>


-- 
Nguyen Van Dang

Home Tel: +84 7 92 21 36 28
Another email: dang.1032170@xxxxxxxxxxxx

You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.


References