[MOAB-dev] Range contiguity method

shriwise shriwise at wisc.edu
Thu Aug 10 07:40:39 CDT 2017


Hi Vijay,

> Yes, you can check for psize==1 and do something optimized since the
> sequences are always contiguous. If psize>1, you can use the iterator
> and not worry about traversing the Range object, immaterial of how
> segmented the data may be.
Agreed. GeomTopoTool currently does just that. I was thinking that you could optimize the contiguity check further by never determining the total number of pairs, but rather by determining that there is no more than one pair. The explicit method I added and tested in a branch on my fork was

inline bool contiguous()
{ return (++const_pair_begin() ==const_pair_end()  && !empty() ); }

This way if the Range is constructed of very segmented data, you wouldn't need to visit each pair to determine that. Whether or not the Range should contain something to be considered contiguous is probably up for debate...

It's just a thought. For context, this is related to some performance issues that we've seen after our refactor of some DagMC capabilities into the GeomTopoTool and GeomQueryTool. Paul created an issue explaining in more detail (https://bitbucket.org/fathomteam/moab/issues/73/change-contiguity-of-gtts-obb-cross). I don't think that our final solution to these problems will require this, but perhaps some future developer will find this matter interesting though.


Cheers,

Patrick C. Shriwise
Research Fellow
University of Wisconsin - Madison
Engineering Research Building - Rm. 428
1500 Engineering Drive
Madison, WI 53706
(608) 446-8173

On 08/09/2017 08:35 PM, Vijay S. Mahadevan wrote:
>> Perhaps a quicker way would be to check that there is no more than one pair
>> in the Range rather than iterating over them all,
> Yes, you can check for psize==1 and do something optimized since the
> sequences are always contiguous. If psize>1, you can use the iterator
> and not worry about traversing the Range object, immaterial of how
> segmented the data may be.
>
>> but there probably aren't
>> many pairs in Ranges in practice. Is that right?
> This entirely depends on how you queried your data and populated the
> Range object. The mesh that you load in parallel matters too. In
> general, if the entities are well ordered, in serial you would have
> one sequence only. In parallel, you could have 2 or more, depending on
> the number of ghost entities. However, since Range is a general
> object, if you were to insert just random series of entities, it will
> result in a pretty segmented data underneath. You might as well be
> well off using a std::vector in such a case, since you are not saving
> much on memory.
>
> Vijay
>
> On Wed, Aug 9, 2017 at 7:52 PM, Patrick Shriwise <shriwise at wisc.edu> wrote:
>> Hi Vijay,
>>
>> After some exploring, I saw the psize method. That would do the trick.
>>
>> Perhaps a quicker way would be to check that there is no more than one pair
>> in the Range rather than iterating over them all, but there probably aren't
>> many pairs in Ranges in practice. Is that right?
>>
>> Cheers,
>>
>> Patrick C. Shriwise
>> Research Fellow
>> University of Wisconsin - Madison
>> Engineering Research Building - Rm. 428
>> 1500 Engineering Drive
>> Madison, WI 53706
>> (608) 446-8173
>>
>>
>> On 8/9/17 5:38 PM, Vijay S. Mahadevan wrote:
>>> Patrick, you are looking for something like Range::psize() [1], which
>>> returns the number of non-contiguous sequences in the object. Does
>>> that help ? If this is not what you are asking, them I'm unclear what
>>> you mean by "rapidly check that a Range object contains a set of
>>> contiguous values".
>>>
>>> Vijay
>>>
>>> [1]
>>> ftp://ftp.mcs.anl.gov/pub/fathom/moab-docs/classmoab_1_1Range.html#a04d1b55838117d5ef4ba3c4dfb4d2df0
>>>
>>> On Tue, Aug 8, 2017 at 11:30 PM, Patrick Shriwise <shriwise at wisc.edu>
>>> wrote:
>>>> Hi all,
>>>>
>>>>
>>>> I'm wondering if there is a way to rapidly check that a Range object
>>>> contains a set of contiguous values.
>>>>
>>>>
>>>> Naively, it seems that this can be done by checking that it is made up of
>>>> only one pair_node by looking at the  mNext & mPrev pointers to verify
>>>> this
>>>> is the case.
>>>>
>>>>
>>>> This would allow some MOAB interfaces (such as the GeomTopoTool) to
>>>> rapidly
>>>> determine if they are working only with contiguous EntitySets and take
>>>> advantage of this fact.
>>>>
>>>>
>>>> Cheers,
>>>>
>>>>
>>>>
>>>> Patrick
>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/moab-dev/attachments/20170810/ef58690e/attachment.html>


More information about the moab-dev mailing list