[MOAB-dev] Questions about Tags and Topology
Christopher Mueller
cmueller at asascience.com
Mon Feb 13 15:06:58 CST 2012
Hi Jim,
Thank you very much for the sample code for data types. This is perfect (and powerful) and should allow us to support all of the data types we'll need (including any "custom" ones).
Best,
Chris
From: James Porter <jvporter at wisc.edu<mailto:jvporter at wisc.edu>>
Date: Mon, 13 Feb 2012 15:46:06 -0500
To: Christopher Mueller <cmueller at asascience.com<mailto:cmueller at asascience.com>>
Cc: "moab-dev at mcs.anl.gov<mailto:moab-dev at mcs.anl.gov>" <moab-dev at mcs.anl.gov<mailto:moab-dev at mcs.anl.gov>>, Guy De Wardener <gdewardener at asascience.com<mailto:gdewardener at asascience.com>>, David Stuebe <DStuebe at asascience.com<mailto:DStuebe at asascience.com>>, "don.brittain at instanteffects.com<mailto:don.brittain at instanteffects.com>" <don.brittain at instanteffects.com<mailto:don.brittain at instanteffects.com>>
Subject: Re: [MOAB-dev] Questions about Tags and Topology
On Fri, 2012-02-10 at 17:28 -0500, Christopher Mueller wrote:
Hi Tim,
I've had a good deal of success this week and have been able to
represent a couple of our simpler datasets in what seems to be a
reasonable manner. I have also come up with a few questions.
Tags:
* DataTypes – from what I can see, tags do not support a few of
the numpy datatypes, namely: float32, int16, and int64. Is
this a constraint of the PyTAPS wrapper or the underlying
iMesh/MOAB infrastructure?
iMesh only supports a handful of types, but as mentioned, the bytes type
lets you convert to/from the type you actually want. Here are some
sample functions to do this:
def set_packed(tag, key, value):
tag[key] = numpy.frombuffer(numpy.asarray(value), dtype=numpy.byte)
def get_packed(tag, key, dtype):
return numpy.frombuffer(tag[key], dtype=dtype)
# In use:
set_packed(my_tag, my_entity, numpy.int16(300))
get_packed(my_tag, my_entity, numpy.int16)
- Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/moab-dev/attachments/20120213/c4a79c5d/attachment-0001.htm>
More information about the moab-dev
mailing list