<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">Hi Elizabeth,<div><br></div><div>Preface: Matt's idea of a covering grid is probably easier than what I'm proposing.  I just saw his email come in.</div>

<div><br></div><div>I think you might be able to use the AMRKDTree for this operation.  At some point I wrote a locate_cell function (that may not be in the repo but I'm happy to find it), that you could then use to search for the 26 neighbors by modifying the current cell position by combinations of it's dx and the smallest dx in the dataset.  Let me know if you want to try something like this, and I can dig around in the next day or so.</div>

<div><br></div><div>Sam</div></span><br><div class="gmail_quote">On Tue, Sep 13, 2011 at 5:10 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Elizabeth,<br>
<br>
If you request ghost zones you can do this.  In particular, requested<br>
unsmoothed ghost zones will ensure no interpolation occurs.  You can<br>
do this either by yourself, grid by grid with<br>
grid_obj.retrieve_ghost_zones(...) or you can use ValidateSpatial in a<br>
field definition.<br>
<br>
It might help if you shared what kind of operation you want to do once<br>
you have the 26.  If you have the index of a cell, you can just<br>
access:<br>
<br>
grid[field][index_i+1, index_j+1, index_k+1]<br>
<br>
and do the +/- and 0/1 modifications.<br>
<br>
-Matt<br>
<div class="im"><br>
On Tue, Sep 13, 2011 at 5:04 PM, Elizabeth Tasker <<a href="mailto:taskere@mcmaster.ca">taskere@mcmaster.ca</a>> wrote:<br>
</div><div><div></div><div class="h5">> Hi Stephen,<br>
><br>
> Honestly, I was just hoping there was some magically pre-programmed way to<br>
> grab the 26 most refined neighbours of a cell, regardless of which grid they<br>
> were on or level that happened to be. Mapping to an extracted region is no<br>
> hassle, I was just checking there wasn't a smart, quick way of doing this<br>
> already.<br>
><br>
> Thanks for the info!<br>
><br>
> Elizabeth<br>
><br>
><br>
><br>
> Stephen Skory wrote:<br>
>><br>
>> Elizabeth,<br>
>><br>
>><br>
>>><br>
>>> So ... how hard are we talking? :)<br>
>>><br>
>><br>
>> The thing is, in all honesty the kdtree we're using in yt (in<br>
>> parallelHF and in a few other places) is not very convenient. It's<br>
>> written in fortran, so the array orderings are backwards from the rest<br>
>> of python (which is C based). It's also confusing to use, it has a<br>
>> weird wrapper to access the functions that isn't very easy to<br>
>> understand. The only reason we're using it is in my tests I found this<br>
>> kdtree implementation to be significantly faster than the alternatives<br>
>> out there.<br>
>><br>
>> Perhaps if I knew a bit more about what you wanted to do I could help<br>
>> you come up with a solution that avoids the kdtree. Are you interested<br>
>> in only the nearest 6 touching cells to a cell? Or do you want to look<br>
>> at the edges and the corners? Farther out? Do you care about<br>
>> periodicity? You mentioned looking at grids of coarser resolution, do<br>
>> you still think you'd like to have neighbor cells returned from a<br>
>> lower resolution grid?<br>
>><br>
>><br>
><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>
_______________________________________________<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>
</div></div></blockquote></div><br>