<div dir="ltr">Hi Mew,<br><div><br></div><div>Coincidentally, getting vertex and face support is a high priority right now, and Andrew Myers, Allyson Julian and I have been working on it (and are working on it today in fact.)  I think that what you're describing should be feasible, and I think what you are describing should work for now.  I am planning to send some design documents and example code to the yt-dev mailing list sometime in the next couple days, if you want to sign up for that list and take a look, or stop by #yt on IRC on freenode.</div><div><br></div><div>-Matt</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 1, 2015 at 10:12 PM, 孫伯符 <span dir="ltr"><<a href="mailto:loveofwitwisthirunwongkul@gmail.com" target="_blank">loveofwitwisthirunwongkul@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello, all,<br><br>I am new to yt Project. I want to create new derived fields.<br>I have two data arrays: one for vertex coordinate, and the other for vertex indexes of face.<br>I also create two datasets of particle type: one for vertex coordinate, and the other for face info.<br>For face dataset, the particle position is the coordinate of face center, which is calculated from data arrays.<br><pre style="background-color:rgb(39,40,34);color:rgb(248,248,242);font-family:"DejaVu Sans Mono";font-size:9pt"><span style="color:rgb(117,113,94)"># Associate data with fields<br></span><span style="background-color:rgb(71,44,71)">data</span> <span style="color:rgb(249,38,114)">= </span><span style="color:rgb(102,217,239)">dict</span>(<span style="color:rgb(253,151,31);font-style:italic">particle_position_x</span><span style="color:rgb(249,38,114)">=</span>face_pos[<span style="color:rgb(174,129,255)">0</span>],<br>            <span style="color:rgb(253,151,31);font-style:italic">particle_position_y</span><span style="color:rgb(249,38,114)">=</span>face_pos[<span style="color:rgb(174,129,255)">1</span>],<br>            <span style="color:rgb(253,151,31);font-style:italic">particle_position_z</span><span style="color:rgb(249,38,114)">=</span>face_pos[<span style="color:rgb(174,129,255)">2</span>])<br><br><span style="color:rgb(117,113,94)"># Create bounding box<br></span>bbox <span style="color:rgb(249,38,114)">= </span>utility.create_bounding_box(face_pos)<br><br><span style="color:rgb(117,113,94)"># Create dataset for face<br></span>ds_face <span style="color:rgb(249,38,114)">= </span>yt.load_particles(<span style="background-color:rgb(60,60,87)">data</span>, <span style="color:rgb(253,151,31);font-style:italic">bbox</span><span style="color:rgb(249,38,114)">=</span>bbox)</pre>(p.s. utility.create_bounding_box() is user-defined function by me)<br><br>I create three derived fields (before loading the data): neighbor vertex index 1-3, for future use.<br>The problem is that I want to feed the value from face data array. How do I access other data array in derived field function.<br><pre style="background-color:rgb(39,40,34);color:rgb(248,248,242);font-family:"DejaVu Sans Mono";font-size:9pt"><span style="color:rgb(117,113,94)"># Define 1st neighbor index<br></span><span style="color:rgb(249,38,114)">@</span><span style="color:rgb(166,226,46)">derived_field</span>(<span style="color:rgb(253,151,31);font-style:italic">name</span><span style="color:rgb(249,38,114)">=</span><span style="color:rgb(230,219,116)">"neighbor_index_1"</span>)<br><span style="color:rgb(102,217,239);font-style:italic">def </span><span style="color:rgb(166,226,46)">_neighbor_index_1</span>(<span style="color:rgb(253,151,31);font-style:italic">field</span>, <span style="color:rgb(253,151,31);font-style:italic">data</span>)<span style="color:rgb(249,38,114)">:</span></pre>If this is not a good way to create the relationship for vertices, please give me suggestions.<br>Besides, after that, I want to render the mesh given the vertex coordinate and face info. Is there a function to do this?<br><br>Thank you very much. <img goomoji="gtalk.328" style="margin:0px 0.2ex;vertical-align:middle"><br><br>Best regards,<br>Mew<br></div>
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>