← Back to team overview

dolfin team mailing list archive

Re: [Question #129296]: defining a discrete function

 

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

Johan Hake proposed the following answer:
On Thursday October 14 2010 09:20:00 Jack wrote:
> Question #129296 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/129296
> 
> Jack requested for more information:
> Johan
> 
> This works brilliantly. Thanks. 

:)

> 'But', how do you get it to work with
> MPI. With MPI, you get:

Then you need to reduce the size of values to the local size of the vector, 
and associate the correct local range to some global values youhave. 

Something like:

  Array<double> values(v.local_size());
  for (int i=0, j=v.local_range.first; 
       i<v.local_size(), j<v.local_range.second; i++, j++)
     values[i] = somedata[j];

  v.set_local(values);

Johan
 
> roam146-22:JJ$ mpirun -n 2 ./test
> Process 0: Number of global vertices: 10000
> Process 0: Number of global cells: 19602
> Process 0: Partitioned mesh, edge cut is 102.
> Process 1: Partitioned mesh, edge cut is 102.
> Assertion failed: (values.size() == local_size), function set_local, file
> /Users/JJ/FEniCS/src/dolfin-0.9.9/dolfin/la/PETScVector.cpp, line 146.
> [roam146-22:05747] *** Process received signal ***
> [roam146-22:05747] Signal: Abort trap (6)
> [roam146-22:05747] Signal code:  (0)
> Assertion failed: (values.size() == local_size), function set_local, file
> /Users/JJ/FEniCS/src/dolfin-0.9.9/dolfin/la/PETScVector.cpp, line 146.
> 
> 
> Jack

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