<div class="gmail_quote">On Mon, Jul 6, 2009 at 9:10 AM, ClaudeG <span dir="ltr">&lt;<a href="mailto:claude.gangolf@gmail.com">claude.gangolf@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
The problem is that i have a file which is like this :<br>
<br>
0 2<br>
1.5 1.5 1.5 1.5 1.5 1.5<br>
2.5 2.4 2.6 2.4  2.5 2.7<br>
<br>
where in the first line 0 stands for the time (here the first time step) 2<br>
stand for two vectors and then comes the coordinates from the vectors, the<br>
second line has the coordinates from the first vector an so on, the first<br>
three values are the x,y,z coordinate from the starting point and the last<br>
three values are teh x,y,z values from the ending point.<br>
<br>
And i want now read the file and stor the value in x1, y1, z1, x2, y2, z2,<br>
so that i can use the values later in an other function.<br>
<font color="#888888"></font></blockquote><div><br>I&#39;m still not clear on what the problem is? <br><br>Is a real file like this?<br>0 2<br>
1.5 1.5 1.5 1.5 1.5 1.5<br>
2.5 2.4 2.6 2.4  2.5 2.7<br>1 3<br>

1.5 1.5 1.5 1.5 1.5 1.5<br>

2.5 2.4 2.6 2.4  2.5 2.7<br>

2.5 2.4 2.6 2.4  2.5 2.7<br>
<br>Are you trying to make each time step into a polydata? What do you want in each polydata? a unit vector from the starting point in the direction (end - start)? a vector between start and end? Do you want them to be lines or arrows? Are you trying to display this from c++ or do you want to write it to a file? From what you said you just want to store the values... so you could do something like the below (just an outline, clearly) - but this isn&#39;t a VTK question so it is better posed on a c++ mailing list: <br>
<br>struct Vec<br>{<br><pre class="de1">        <span class="kw4">double</span> x1,y1,z1<span class="sy4">,x2,y2,z2;<br>Vec(const double X1, </span><span class="sy4">const double Y1, </span><span class="sy4">const double Z1, </span><span class="sy4">const double X2, </span><span class="sy4">const double Y2, </span><span class="sy4">const double Z2) : x1(X1), y1(Y1), z1(Z1), x2(X2), y2(Y2), z2(Z2){}</span><br>
</pre>
};<br>//the outer std::vector is the time steps, the inner std::vector is the <br>std::vector&lt;std::vector&lt;Vec&gt; &gt; Vectors;<br><pre class="de1">        <span class="kw1">while</span><span class="br0">(</span>getline<span class="br0">(</span>fin, line<span class="br0">)</span><span class="br0">)</span><br>
        <span class="br0">{<br>//... figure out when a new time step starts ... <br><br></span>std::vector&lt;Vec&gt; CurrentTimeVectors;<br>                <span class="kw4">double</span> x1,y1,z1<span class="sy4">,x2,y2,z2;</span><br>                std<span class="sy4">::</span><span class="me2">stringstream</span> linestream<span class="sy4">;</span><br>
                linestream <span class="sy1">&lt;&lt;</span> line<span class="sy4">;</span><br>                linestream <span class="sy1">&gt;&gt;</span> x1 <span class="sy1">&gt;&gt;</span> y1 <span class="sy1">&gt;&gt;</span> z1 &gt;&gt; x2 &gt;&gt; y2 &gt;&gt; z2<span class="sy4">;</span><br>
 <br><span class="sy4">Vec v(x1,y1,z1,x2,y2,z1);<br>CurrentTimeVectors.push_back(v);<br><br>// ... when the current time step ends...<br>Vectors.push_back(CurrentTimeVectors);<br></span>        <span class="br0">}</span><br></pre>
<br><br clear="all">Thanks,<br><br>David <br></div></div>