Thanks Jon and Daniel for your help with my previous question on fixing the concentration of a cell.

I was playing around with concatenating meshes, and I noticed that the concatenation code was quite slow for me. All the magic seemed to happen in mesh._getAddedMeshValues, so I messed around with the code a bit:

I flattened a couple of nested loops (at the cost of memory; I don't know if this is an issue) and the performance improved a bit. I also changed the code to iterate only over exterior vertices to check for vertex matching (I imagine that's the only place you want to check for mesh correlation, but I could be wrong). There's probably a few more things that can be done, but I decided I don't need to concatenate meshes (for now, at least) so I shouldn't put anymore time into it. If you're interested, I've included a patch. All tests pass (except some small numpy 1.1 issues which existed previously) on my computer, but it should probably be tested on numpy 1.0.4.

There's a little more noise in the patch than there should be because I ended up moving two blocks of code in mesh._getAddedMeshValues to separate methods (mesh._getVertexCorrelates and mesh._getFaceCorrelates). These blocks were already labeled by comments in the code, and it was easier for me to read the code this way. I can move them back if you prefer.

Unfortunately, some numpy methods I wanted to use weren't available in tools.numerix so I added an import numpy statement to the top of `mesh.py`. I can add a thin numerix wrapper to these functions if that's the prefered style. (NOTE: It's possible these methods don't work the same in an older numpy).

Cheers,
-Tony

Attachment: concatenate_mesh.diff
Description: Binary data


 

Reply via email to