[vtkusers] Function to read a file

David Doria daviddoria+vtk at gmail.com
Mon Jul 6 07:13:44 EDT 2009


On Mon, Jul 6, 2009 at 2:35 AM, ClaudeG <claude.gangolf at gmail.com> wrote:

>
> Hi,
>
> I'm programming in C++ for my VTK-project and i need a function to read a
> file where the data of the vector field a stored but the problem is that i
> have not the right idea how to write this function, can you help me please!
>
> Thx for any help you can give me!
>
> claude
> --


What kind of file is your vector field in? Plain text? What is the format?

http://www.vtk.org/Wiki/Write_a_file_of_triangle_corners

Here is an outline of how to generate data and save it to a vtp file, you
can probably cut the part about saving to a file and replace the part about
generating the data with using standard c++ techniques to read from the
ascii file. If that is the part you are having trouble with let us know.

There are other examples there that deal with Normals, so if you are looking
to store vectors that may be worth looking at. The difference is that you
set the number of components to 3.

vtkDoubleArray* PointNormalsArray = vtkDoubleArray::New();
	PointNormalsArray->SetNumberOfComponents(3);



Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090706/4083edfd/attachment.htm>


More information about the vtkusers mailing list