<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi,<br>
<br>
Markus, thanks for your comments. Following your suggestions, I made
a vector of BSplineGirdEntity as a member in the BSplineLeafGridView
class and sovled the problem. Finally the code is able to compile
and is available online now. With the iterator, entity and girdView
class, a range-based for as below is possible.<br>
<br>
<span id="LC123" class="line" style="box-sizing: border-box; white-space: pre-wrap;"><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); white-space: pre-wrap;">IGA</span><span class="o" style="box-sizing: border-box; font-weight: bold; white-space: pre-wrap;">::</span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); white-space: pre-wrap;">BSplineGrid</span><span class="o" style="box-sizing: border-box; font-weight: bold; white-space: pre-wrap;"><</span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); white-space: pre-wrap;">dim</span><span class="p" style="box-sizing: border-box; white-space: pre-wrap;">,</span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); white-space: pre-wrap;">dimworld</span><span class="o" style="box-sizing: border-box; font-weight: bold; white-space: pre-wrap;">></span> <span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); white-space: pr!
e-wrap;">
g
rid</span><span class="p" style="box-sizing: border-box; white-space: pre-wrap;">(</span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); white-space: pre-wrap;">knotSpans</span><span class="p" style="box-sizing: border-box; white-space: pre-wrap;">,</span> <span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); white-space: pre-wrap;">controlNet</span><span class="p" style="box-sizing: border-box; white-space: pre-wrap;">,</span> <span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); white-space: pre-wrap;">order</span><span class="p" style="box-sizing: border-box; white-space: pre-wrap;">);
</span></span><span id="LC124" class="line" style="box-sizing: border-box; white-space: pre-wrap;"><span class="k" style="box-sizing: border-box; font-weight: bold; white-space: pre-wrap;">auto</span> <span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); white-space: pre-wrap;">gridView</span> <span class="o" style="box-sizing: border-box; font-weight: bold; white-space: pre-wrap;">=</span> <span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); white-space: pre-wrap;">grid</span><span class="p" style="box-sizing: border-box; white-space: pre-wrap;">.</span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); white-space: pre-wrap;">leafGridView</span><span class="p" style="box-sizing: border-box; white-space: pre-wrap;">();
</span></span><span id="LC132" class="line" style="box-sizing: border-box; white-space: pre-wrap;"><span class="k" style="box-sizing: border-box; font-weight: bold; white-space: pre-wrap;">for</span> <span class="p" style="box-sizing: border-box; white-space: pre-wrap;">(</span><span class="k" style="box-sizing: border-box; font-weight: bold; white-space: pre-wrap;">auto</span> <span class="k" style="box-sizing: border-box; font-weight: bold; white-space: pre-wrap;">const</span> <span class="o" style="box-sizing: border-box; font-weight: bold; white-space: pre-wrap;">&</span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); white-space: pre-wrap;">element</span><span class="o" style="box-sizing: border-box; font-weight: bold; white-space: pre-wrap;">:</span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); white-space: pre-wrap;">gridView</span><span class="p" style="box-sizing: border-box; white-space: pre-wrap;">)
{
auto geometry = element.geometry();
//blabla
</span></span><span id="LC132" class="line" style="box-sizing: border-box; white-space: pre-wrap;"><span class="p" style="box-sizing: border-box; white-space: pre-wrap;"><span class="p" style="box-sizing: border-box; white-space: pre-wrap; color: rgb(51, 51, 51); font-family: Menlo, 'Liberation Mono', Consolas, 'DejaVu Sans Mono', 'Ubuntu Mono', 'Courier New', 'andale mono', 'lucida console', monospace; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.5px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 253, 240);"></span>}</span></span><br>
<br>
I'm not sure if this is what you expect from the iterator. Please
check if I need to add or modify anything to keep consistent with
DUNE grid interface. I'm now trying to make a
BSplineGridLeafIndexSet class. I tried to imitate the
OneDGridLeafIndexSet class and here are my elementary thoughts:<br>
<br>
template<class GridImp><br>
class BSplineGridLeafIndexSet :<br>
public IndexSet<GridImp,BSplineGridLeafIndexSet<GridImp>
><br>
<br>
contains an index function which returns the index of a
BSplineGridLeafEntity.<br>
<br>
Is it OK? And should I also implement an Intersection class? Would
be helpful if you can provide me some detailed steps.<br>
<br>
Cheers,<br>
Xinyun<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 07/15/2016 01:47 PM, Markus Blatt
wrote:<br>
</div>
<blockquote cite="mid:20160715114706.GB10510@boromir.dr-blatt.de"
type="cite">
<pre wrap="">Hi,
On Thu, Jul 14, 2016 at 10:07:18AM +0200, Oliver Sander wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi Xinyun,
[please keep the discussions on the list.]
I think your BSplineLeafIterator class needs to hold a (shared) pointer so the entity it points to,
in addition to the directIndex. Then what 'dereference' returns is
not a temporary anymore.
</pre>
</blockquote>
<pre wrap="">
I do not agree with this fix as it might cause dangling
references. I am sure that at some point this pointer will be reset
(e.g. by operator++ being called). In this case we might have a reference to
a non-existent object or the value pointed to might be different. Both
are really hard to detect/debug. Just imagine this:
Iter iter = bla.begin();
auto& ref = *iter; // everything ok.
++iter; // Most probably resets the shared_ptr or overwrites the value
// pointed to.
Either we have a really hard to debug dangling reference or it does
not point to the spline that the user expects (second spline instead
of first).
May I ask why the BSplineGridEntity is created on demand?
If it is for a really good cause, then the iterator should not return a
reference, but a proxy object that contains a shared_ptr to it. But
the reason must be really, really, really good. std::vector<bool> does
this but it is really frowned upon.
Otherwise the question should read:
Why can't we create a container of BSplineGridEntities and thus get
rid of the problem?
Markus
</pre>
<blockquote type="cite">
<pre wrap="">
On 14.07.2016 00:28, Xinyun wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hey Oliver,
In the past few days I tried to make the BSplineLeafIterator work
using the Barton-Nackman trick. You can check here
<a class="moz-txt-link-rfc2396E" href="http://gsoc2016xinyun.blogspot.de/2016/07/make-b-spline-grid-iterators-work.html"><http://gsoc2016xinyun.blogspot.de/2016/07/make-b-spline-grid-iterators-work.html></a>
for more details about what I intended to do. But I encountered a
specific programming problem which even hindered me to compile the
code. I have spent some time to play around but still couldn't
make it through. So I think it's better to ask for your help. As
the code still contains errors, I didn't upload it to gitlab.
</pre>
</blockquote>
</blockquote>
<pre wrap="">
But that might make commenting on code a bit easier.
Markus
</pre>
</blockquote>
<br>
</body>
</html>