<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 12pt; color: #000000'>Hello,<br>Please see below. For some of those, Jim or Tim would know the right answer.<br>Do you need to use PyTaps, or do you prefer it because it is simpler?<br><hr id="zwchr"><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;">
<div>Hi Iulian,</div><div><br></div><div>Thank you for the rapid response and great information. I have a couple of follow-up questions (inline).</div><div><br></div><div id="DWT5203"><br></div><div><br></div><span id="OLK_SRC_BODY_SECTION"><div style="font-family: Calibri; font-size: 11pt; text-align: left; color: black; border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; padding: 3pt 0in 0in;"><strong>From: </strong> Iulian Grindeanu <<a href="mailto:iulian@mcs.anl.gov" target="_blank">iulian@mcs.anl.gov</a>><br><span style="font-weight: bold;">Date: </span> Sat, 11 Feb 2012 01:02:03 -0500<br><span style="font-weight: bold;">To: </span> Christopher Mueller <<a href="mailto:cmueller@asascience.com" target="_blank">cmueller@asascience.com</a>><br><span style="font-weight: bold;">Cc: </span> Guy De Wardener <<a href="mailto:gdewardener@asascience.com" target="_blank">gdewardener@asascience.com</a>>, David Stuebe <<a href="mailto:DStuebe@asascience.com" target="_blank">DStuebe@asascience.com</a>>, don brittain <<a href="mailto:don.brittain@instanteffects.com" target="_blank">don.brittain@instanteffects.com</a>>, "<a href="mailto:moab-dev@mcs.anl.gov" target="_blank">moab-dev@mcs.anl.gov</a>" <<a href="mailto:moab-dev@mcs.anl.gov" target="_blank">moab-dev@mcs.anl.gov</a>><br><span style="font-weight: bold;">Subject: </span> Re: [MOAB-dev] Questions about Tags and Topology<br></div><div><br></div><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="padding: 0pt 0pt 0pt 5px; margin: 0pt 0pt 0pt 5px;"><div><style>p { margin: 0; }</style><div><div style="font-family: Times New Roman; font-size: 12pt; color: rgb(0, 0, 0);">Hello,<br>I will try to answer to some of those questions;<br><br><hr id="zwchr"><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div>Hi Tim,</div><div><br></div><div>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. </div><div><br></div><div>Tags:</div><ul><li id="DWT3878">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?</li></ul></blockquote>itaps has a limited data type set; see MOAB/itaps/iBase.h<br>pytaps is closely related to itaps;<br><br>some types can be "manufactured" out of byte type, but it is the user responsibility to interpret / convert correctly (so interpret an int16 as a 2-byte value, etc). I am not sure if something like that is possible in python/pytaps. It is for sure possible in c/c++</div></div></div></blockquote></span><span id="OLK_SRC_BODY_SECTION"><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="padding: 0pt 0pt 0pt 5px; margin: 0pt 0pt 0pt 5px;"><div><div><div style="font-family: Times New Roman; font-size: 12pt; color: rgb(0, 0, 0);"><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><ul><li></li><li id="DWT3879">Tags-of-tags – Is this possible? I've tried a couple of ways but can't seem to get it to go.</li></ul></blockquote>tags can be set/get on anything that is an "EntityHandle" in moab. So anything that is an entity handle (node, element, mesh set) can set and get tag values, using a tag handle. <br>I am not sure I understand the question. Would you need to set a tag value on a tag handle? That is not possible. </div></div></div></blockquote></span><div><br></div><div>Unfortunately, it is the latter case that I was hoping for – the ability to set a tag value on a tag handle. For example:</div><blockquote style="margin: 0pt 0pt 0pt 40px; border: medium none; padding: 0px;"><div>tag1=mesh.createTag("tag1",1,bytes)</div><div>tag2=mesh.createTag("tag2,1,bytes)</div><div>tag2[tag1]=value</div></blockquote><div id="DWT5204"><br></div></blockquote>Yes, we cannot do that. Sorry :(<br><blockquote id="DWT5207" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div></div><span id="OLK_SRC_BODY_SECTION"><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="padding: 0pt 0pt 0pt 5px; margin: 0pt 0pt 0pt 5px;"><div><div><div style="font-family: Times New Roman; font-size: 12pt; color: rgb(0, 0, 0);"><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><ul><li></li></ul><div>Topology:</div><ul><li id="DWT3880">Is it possible to apply topology over entity sets? One way I've found for dealing with time is to have a "temporal" EntitySet that has child EntitySets for each timestep. This seems to work well, but I can't find a way of relating the various timesteps aside from the inherent indexing of the "temporal" EntitySet. I hoped that it would be possible to do something like make a line_segment that related the timestep EntitySets, but that didn't seem to work.</li></ul></blockquote>maybe you can set a tag with the time value for each of the child EntitySets. I am not sure I understand what do you mean by "line_segment".<br>Also, if set1 is a child of set2, it does not mean that the set2 is a parent of set1 (and viceversa) see the difference between <br>add_parent_child and add_child_meshset, for example<br><br>Another thing that can help:<br> you add child1 to set1, then add child2 to set1<br>When you ask for children of set1, you will always get them in order child1, child2. So maybe you can use that for a natural ordering of your children ( EntitySets ).</div></div></div></blockquote></span><div><br></div><div>This is the method I'm currently using and it works well as long as the relationship is a linear one (unfortunately, this may not always be the case for us).</div><div>Do you know if it is possible to "insert" a child into an existing list of children? For example:</div><blockquote style="margin: 0pt 0pt 0pt 40px; border: medium none; padding: 0px;"><div>set1_children=[c1,c2,c3,c4]</div><div>set.add(c2a,index=2)</div><div>set1_children=[c1,c2,c2a,c3,c4]</div><div id="DWT5206"><br></div></blockquote><br></blockquote>We do not have a method exposed to insert at an index (even in MOAB)<br>The lists of parents or children is stored inside as an array (except if 1 or 2 parents/children, but that is not that important)<br><br>Inserting at an index could be accomplished right now with the interface only be removing c3, c4, then add c2a, c3, c4. I know it is not optimal; if performance is a concern, we would need to add a method to the interface to insert at an index; even with that change, the performance gain will not be that important (we would still need to reallocate the array inside, but only once)<br><br><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><blockquote style="margin: 0pt 0pt 0pt 40px; border: medium none; padding: 0px;"><div><br></div></blockquote><span id="OLK_SRC_BODY_SECTION"><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="padding: 0pt 0pt 0pt 5px; margin: 0pt 0pt 0pt 5px;"><div><div><div style="font-family: Times New Roman; font-size: 12pt; color: rgb(0, 0, 0);"><br>Another question: Is the mesh changing in time? That is one reason you may want EntitySets changing in time. Or maybe some solution uses different mesh elements at a given time</div></div></div></blockquote></span><div><br></div><div>This is certainly a possibility, so having an entityset/time is valuable to us.</div><div><br></div><span id="OLK_SRC_BODY_SECTION"><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="padding: 0pt 0pt 0pt 5px; margin: 0pt 0pt 0pt 5px;"><div><div><div style="font-family: Times New Roman; font-size: 12pt; color: rgb(0, 0, 0);"><br><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><ul><li></li><li>Edges from quadrilaterals: After building a set of quadrilateral entities from an array of vertices, I was surprised that there were not edge entities generated as well. Is there a method for doing this? I realize I could generate the edges from the vertex array (perhaps after some reworking), but it seems to me that it might also be possible to get them from the quadrilaterals themselves.</li></ul><div id="DWT3881"><br></div></blockquote>this is the easiest question:)<br>you have to use the flag create_if_missing=true in a call like:<br>ErrorCode get_adjacencies(const EntityHandle *from_entities,<br> const int num_entities,<br> const int to_dimension,<br> const bool create_if_missing,<br> std::vector<EntityHandle>& adj_entities,<br> const int operation_type = Interface::INTERSECT) = 0;<br><br>from_entities are your quads, to_dimension is 1 (edges), and you will get the edges in adj_entities vector.</div></div></div></blockquote></span><div><br></div><div>This is great news! I tried applying the argument "create_if_missing" as a kwarg in a handful of the iMesh functions exposed in PyTAPS (mesh.createEntArr, mesh.getEntArr, mesh.getEntAdj), but I kept getting a TypeError stating that "'create_if_missing' is an invalid keyword argument for this function". Do you know if this functionality is available from PyTAPS?</div><div><br></div><span id="OLK_SRC_BODY_SECTION"><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="padding: 0pt 0pt 0pt 5px; margin: 0pt 0pt 0pt 5px;"><div><div><div id="DWT5208" style="font-family: Times New Roman; font-size: 12pt; color: rgb(0, 0, 0);"><br></div></div></div></blockquote><br></span></blockquote>So, do you use PyTaps here? there is no "create_if_missing" argument in imesh functions. This works directly with MOAB only.<br><br>With iMesh, you may be able to use "AdjTable" methods. Again, I am not sure about pytaps.<br><br>With AdjTable, you would need to set the AdjTable [5] to 1; then, when loading a mesh, the edge entities will be created if missing<br>(so use iMesh_setAdjTable , and pass an AdjTable that has 1 at index 5, corresponding to adjacency cost edge/edge of 1)<br>So with iMesh, after setting adjTable, a subsequent iMesh_load will generate the edges too, if they are missing.<br><br>It seems that adjTable is exposed in pytaps, but I can't change it :(<br>Maybe Jim knows a way to set it in pytaps too.<br><br>Iulian<br><br><br><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><span><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="padding: 0pt 0pt 0pt 5px; margin: 0pt 0pt 0pt 5px;"><div><div><div style="font-family: Times New Roman; font-size: 12pt; color: rgb(0, 0, 0);"><br>Another question: Is the mesh changing in time? That is one reason you may want EntitySets changing in time. Or maybe some solution uses different mesh elements at a given time</div></div></div></blockquote></span><div><br></div><div>This is certainly a possibility, so having an entityset/time is valuable to us.</div><div><br></div><span id="OLK_SRC_BODY_SECTION"><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="padding: 0pt 0pt 0pt 5px; margin: 0pt 0pt 0pt 5px;"><div><div><div style="font-family: Times New Roman; font-size: 12pt; color: rgb(0, 0, 0);"><br><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><ul><li></li><li>Edges from quadrilaterals: After building a set of quadrilateral entities from an array of vertices, I was surprised that there were not edge entities generated as well. Is there a method for doing this? I realize I could generate the edges from the vertex array (perhaps after some reworking), but it seems to me that it might also be possible to get them from the quadrilaterals themselves.</li></ul><div id="DWT3881"><br></div></blockquote>this is the easiest question:)<br>you have to use the flag create_if_missing=true in a call like:<br>ErrorCode get_adjacencies(const EntityHandle *from_entities,<br> const int num_entities,<br> const int to_dimension,<br> const bool create_if_missing,<br> std::vector<EntityHandle>& adj_entities,<br> const int operation_type = Interface::INTERSECT) = 0;<br><br>from_entities are your quads, to_dimension is 1 (edges), and you will get the edges in adj_entities vector.</div></div></div></blockquote></span><div><br></div><div>This is great news! I tried applying the argument "create_if_missing" as a kwarg in a handful of the iMesh functions exposed in PyTAPS (mesh.createEntArr, mesh.getEntArr, mesh.getEntAdj), but I kept getting a TypeError stating that "'create_if_missing' is an invalid keyword argument for this function". Do you know if this functionality is available from PyTAPS?</div><div><br></div><span id="OLK_SRC_BODY_SECTION"><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="padding: 0pt 0pt 0pt 5px; margin: 0pt 0pt 0pt 5px;"><div><div><div id="DWT5208" style="font-family: Times New Roman; font-size: 12pt; color: rgb(0, 0, 0);"><br></div></div></div></blockquote><br><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="padding: 0pt 0pt 0pt 5px; margin: 0pt 0pt 0pt 5px;"><div><div><div style="font-family: Times New Roman; font-size: 12pt; color: rgb(0, 0, 0);"><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div></div><div><br></div><div>Thanks in advance,</div><div>Chris</div></blockquote>Hope this helps,<br>Iulian</div></div></div></blockquote></span><div><br></div><div>Thanks,</div><div>Chris</div>
</blockquote><br></div></body></html>