comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: TRIANGULATE. Finding contiguous cells efficiently?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: TRIANGULATE. Finding contiguous cells efficiently? [message #52782 is a reply to message #52694] Wed, 28 February 2007 01:42 Go to previous message
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
Unique edges: nice thinking there :-). Off course, I would write some
things differently like:

neigh=intarr(3,ntr)
neigh(*,*)=-1
=> neigh=replicate(-1,3,ntr)

edgcount(cellhere)=edgcount(cellhere)+1L
=> edgcount[cellhere]++

To make unique edges, you could use hash functions like CRC32 (with
some adaption to make [a,b] the same as [b,a]), but assuming the
vertices are stored in ulong's (i.e. 32bit), this will do:
c=(a>b)+ishft(long64(a<b),32)

Who am I: http://www.ua.ac.be/wout.denolf

On 27 Feb 2007 11:44:13 -0800, "Libertan" <tbethell@umich.edu> wrote:

> Wox,
>
> Okay, here's an code which surpasses my expectations; it seems to be
> over 10,000% faster. I kid ye not. initially vectorized, ends with
> simple loop over uncostly operations. I thought the invocation of
> SORT would be slow, but imagine it's written in C. would I be right
> in thinking that the overall trick is to use 1) as few operations as
> possible, 2) use vectorized forms, and 3) use IDL instrinsics written
> in C?
>
> I'm sure it's not particularly well written, but what do you think?
> Writing fast codes in IDL is a tricky business. Wox, if you care and
> are prepared to email me your name, I'll acknowledge our discussion
> when/if I publish future results (in Astrophysical Journal).
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Improving a piece of code with arrays and for-loops
Next Topic: oplot in 3d ??

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 00:39:00 PDT 2025

Total time taken to generate the page: 0.80059 seconds