← Back to team overview

dolfin team mailing list archive

Re: [Question #147820]: how to read out data arrayfrom unstructured mesh(advection-diffusion demo)

 

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

Johan Hake proposed the following answer:
Maybe Viper could provide a high level interface to read a vtu file into a 
NumPy array, and a mesh into a coordinate and cell arrays?

Then we eventually can use this to pass data to Viper for plotting in the C++ 
interface. This might fix the parallel ploting issue we have.

It would also be cool to implement a helper function in the Python interface 
of DOLFIN that uses the potential added functionality in Viper to generate a 
Function, with or without a given mesh. A FunctionSpace could be automatically 
generated based on the dimensions of the data (is this true?) If a mesh is not 
given we generate it based on the stored mesh data from the file.

Johan


On Friday March 4 2011 11:30:52 Kent-Andre Mardal wrote:
> Question #147820 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/147820
> 
>     Status: Open => Answered
> 
> Kent-Andre Mardal proposed the following answer:
> You should be able to use GetPointData().GetArray(). Have you looked at the
> name of the variable in the vtu file? It is in ASCII format.
> 
> I attach something I did earlier.
> 
> Kent
> 
> On 4 March 2011 19:34, JJ Jiang
> 
> <question147820@xxxxxxxxxxxxxxxxxxxxx>wrote:
> > New question #147820 on DOLFIN:
> > https://answers.launchpad.net/dolfin/+question/147820
> > 
> > Hi all,
> > 
> >  I am running into a problem. I run the advection-diffusion demo. All the
> > 
> > simulated mass transport quantities u were save to a vtk PVD file with an
> > unstructured mesh.
> > 
> > My question is how to read out the u from the associated individual vtu
> > files. I thought  the u is attached to either PointData or CellData so
> > that I can read out the scalar u using one of the following:
> > grid->GetPointData()->GetArray('name');
> > or
> > grid->GetCellData()->GetArray('name');
> > 
> > But my attempts have failed. Please provide your advice. Thanks so much
> > for your help!
> > 
> > Best regards,
> > --JJ
> > 
> > 
> > --
> > You received this question notification because you are a member of
> > DOLFIN Team, which is an answer contact for DOLFIN.
> > 
> > _______________________________________________
> > Mailing list: https://launchpad.net/~dolfin
> > Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~dolfin
> > More help   : https://help.launchpad.net/ListHelp

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



References