[yt-users] About creating derived fields

孫伯符 loveofwitwisthirunwongkul at gmail.com
Wed Jun 3 19:20:26 PDT 2015


Hello, Matthew,

Thank you for reply. I have noticed that yt can export 3D surface
(isocontour) to an obj file.
It means that there is a tool which can connect the vertices to a face.
But I cannot find the API to do this job.
Is there some ways to connect the vertices to a face if I have face info
(such as face center coordinate and vertex index) in my dataset object?

Thanks. :)

Best regards,
Mew

2015-06-02 21:04 GMT+08:00 Matthew Turk <matthewturk at gmail.com>:

> Hi Mew,
>
> 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.
>
> -Matt
>
> On Mon, Jun 1, 2015 at 10:12 PM, 孫伯符 <loveofwitwisthirunwongkul at gmail.com>
> wrote:
>
>> Hello, all,
>>
>> I am new to yt Project. I want to create new derived fields.
>> I have two data arrays: one for vertex coordinate, and the other for
>> vertex indexes of face.
>> I also create two datasets of particle type: one for vertex coordinate,
>> and the other for face info.
>> For face dataset, the particle position is the coordinate of face center,
>> which is calculated from data arrays.
>>
>> # Associate data with fields
>> data = dict(particle_position_x=face_pos[0],
>>             particle_position_y=face_pos[1],
>>             particle_position_z=face_pos[2])
>>
>> # Create bounding box
>> bbox = utility.create_bounding_box(face_pos)
>>
>> # Create dataset for face
>> ds_face = yt.load_particles(data, bbox=bbox)
>>
>> (p.s. utility.create_bounding_box() is user-defined function by me)
>>
>> I create three derived fields (before loading the data): neighbor vertex
>> index 1-3, for future use.
>> 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.
>>
>> # Define 1st neighbor index
>> @derived_field(name="neighbor_index_1")
>> def _neighbor_index_1(field, data):
>>
>> If this is not a good way to create the relationship for vertices, please
>> give me suggestions.
>> Besides, after that, I want to render the mesh given the vertex
>> coordinate and face info. Is there a function to do this?
>>
>> Thank you very much. [?]
>>
>> Best regards,
>> Mew
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150604/92e05562/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 569 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150604/92e05562/attachment.png>


More information about the yt-users mailing list