[Dune] Vector of IntersectionIterators

Oliver Sander sander at mi.fu-berlin.de
Wed Mar 17 09:10:45 CET 2010


Hi Dragan!
It gets less messy if you introduce an 'Intersection-Proxy' class
that collects all your information for one Intersection.  You then
have only one std::vector.

Destroying the iterator object should, well, destroy the iterator.
If it doesn't then it's a memory leak (i.e., a bug), or some hidden
magic that only the ALUgrid maintainers can comment on.

Oliver

Dragan Vidovic schrieb:
> Hi Oliver
>
> Thanks for the suggestion. I had that as a temporary solution, but as
> the project grows it was getting too messy. This is why I started
> storing the iterators. Do you know how can I at least destroy them
> after use? I guess that creating an iterator creates something within
> the ALUgrid space which stays there. Am I right?
>
> Dragan
>
>
> On Wed, Mar 17, 2010 at 8:51 AM, Oliver Sander <sander at mi.fu-berlin.de> wrote:
>   
>> Hi Dragan!
>> Have you considered storing just the information that you need
>> in several vectors?  For example, declare
>>
>> std::vector<FieldVector<double,dimworld> > normals;
>> std::vector<double> areas;
>> [...]
>>
>> Loop over the intersections of your current element once
>> and fill the array.  Later you can access all information by index.
>>
>> Not the most elegant solution, but it should work.
>>
>> --
>> Oliver
>>
>> Dragan Vidovic schrieb:
>>     
>>> Hi all
>>>
>>> I'm developing some very experimental finite volume methods and I
>>> really need to store some kind of references to some faces, like
>>> boundary faces or those where some physical parameters are
>>> discontinuous, and use references these later to get areas, normals,
>>> or to access neighbouring cells, without looping trough all cells
>>> every time. Since mappers can only map from an IntersectionIterator to
>>> an integer index and not the other way around, the only solution that
>>> I found after allot of experimenting was to use a std::vector of
>>> IntersectionIterators. Since an empty constructor for
>>> IntersectionIterator is not allowed, I initialize it as
>>>
>>> std::vector<IntersectionIterator> ismap (nfaces,
>>> gridView.ibegin(*gridView.template begin<0>()));
>>>
>>> and change it's elements later. There are two problems here:
>>>
>>> 1) This takes a hell of a space. I divided the increase in memory that
>>> the process takes by the number of faces, and I found out that each
>>> IntersectionIterator takes about 1k!
>>>
>>> 2) When this vector goes out of scope, this space is not recycled.
>>>
>>> I'm using the newest ALUgrid, and Dune not older than two weeks.
>>>
>>> Does anyone have some idea how to overcome these problems?
>>>
>>> Best regards,
>>>
>>> Dragan
>>>
>>> _______________________________________________
>>> Dune mailing list
>>> Dune at dune-project.org
>>> http://lists.dune-project.org/mailman/listinfo/dune
>>>
>>>       
>> --
>> ************************************************************************
>> * Oliver Sander                ** email: sander at mi.fu-berlin.de        *
>> * Freie Universität Berlin     ** phone: + 49 (30) 838 75348           *
>> * Institut für Mathematik      ** URL  : page.mi.fu-berlin.de/~sander  *
>> * Arnimallee 6                 ** -------------------------------------*
>> * 14195 Berlin, Germany        ** Member of MATHEON (www.matheon.de)   *
>> ************************************************************************
>>
>>
>>     
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
>   


-- 
************************************************************************
* Oliver Sander                ** email: sander at mi.fu-berlin.de        *
* Freie Universität Berlin     ** phone: + 49 (30) 838 75348           *
* Institut für Mathematik      ** URL  : page.mi.fu-berlin.de/~sander  *
* Arnimallee 6                 ** -------------------------------------*
* 14195 Berlin, Germany        ** Member of MATHEON (www.matheon.de)   *
************************************************************************





More information about the Dune mailing list