[Dune] [Dune-Commit] dune-grid r6666 - trunk/dune/grid/geometrygrid

Martin Nolte nolte at mathematik.uni-freiburg.de
Fri Apr 30 19:07:05 CEST 2010


Hi Oli,

while one might consider another meta grid, I did not do it for the following
reasons:
(a) a permutation of the vertices leads to a change in the geometry
(b) the overhead for meta grids is currently quite high; double wrapping seems
nearly impossible
(c) writing a complete (meta) grid means a lot of code, even if it is only a lot
of code duplication
(d) I don't want to waste too much time with it
(e) there does not seem to be any overhead for an identical numbering, so that
it does not slow down the GeometryGrid unless this feature is actually used
(f) We should not add too many grids to dune-grid, but try to make the ones we
provide as powerful as possible

Yours,

Martin


On 04/30/2010 04:52 PM, Oliver Sander wrote:
> Hi Martin!
> That's sounds like a very nice thing to have!  But wouldn't it be more
> elegant
> to have a separate meta grid for this?  It doesn't really have anything
> to do
> with changing the geometry.
> 
> best,
> Oliver
> 
> Am 30.04.2010 16:50, schrieb Martin Nolte:
>> Hi Oli,
>>
>> I want to be able to change the order of the vertices in an element
>> from the ordering in the host grid (with negligible cost if you don't
>> use it). This could be used to orient grids, make simplex grids
>> twistfree or order vertices such that they are ordered by their
>> x-coordinate (feel free to think of other applications).
>>
>> This is work in progress (maybe I should have created an experimental
>> branch for it, though).
>>
>> Martin
>>
>> On 04/30/2010 04:38 PM, Oliver Sander wrote:
>>> Hi Martin!
>>> I am curious. What is this numbering thing about?
>>>
>>> best,
>>> Oliver
>>>
>>> Am 30.04.2010 15:44, schrieb mnolte at dune-project.org:
>>>> Author: mnolte
>>>> Date: 2010-04-30 15:44:09 +0200 (Fri, 30 Apr 2010)
>>>> New Revision: 6666
>>>>
>>>> Modified:
>>>> trunk/dune/grid/geometrygrid/grid.hh
>>>> trunk/dune/grid/geometrygrid/intersection.hh
>>>> trunk/dune/grid/geometrygrid/numbering.hh
>>>> Log:
>>>> add a renumbering for intersections, too
>>>> (this way, we don't need the outside entity for identical mapping)
>>>>
>>>>
>>>> Modified: trunk/dune/grid/geometrygrid/grid.hh
>>>> ===================================================================
>>>> --- trunk/dune/grid/geometrygrid/grid.hh 2010-04-30 13:24:05 UTC (rev
>>>> 6665)
>>>> +++ trunk/dune/grid/geometrygrid/grid.hh 2010-04-30 13:44:09 UTC (rev
>>>> 6666)
>>>> @@ -145,6 +145,8 @@
>>>> typedef Dune::Intersection< const Grid, GeoGrid::LeafIntersection>
>>>> LeafIntersection;
>>>> typedef Dune::Intersection< const Grid, GeoGrid::LevelIntersection>
>>>> LevelIntersection;
>>>>
>>>> + typedef typename Numbering::IntersectionNumbering
>>>> IntersectionNumbering;
>>>> +
>>>> typedef Dune::IntersectionIterator
>>>> < const Grid, GeoGrid::LeafIntersectionIterator,
>>>> GeoGrid::LeafIntersection>
>>>> LeafIntersectionIterator;
>>>>
>>>> Modified: trunk/dune/grid/geometrygrid/intersection.hh
>>>> ===================================================================
>>>> --- trunk/dune/grid/geometrygrid/intersection.hh 2010-04-30 13:24:05
>>>> UTC (rev 6665)
>>>> +++ trunk/dune/grid/geometrygrid/intersection.hh 2010-04-30 13:44:09
>>>> UTC (rev 6666)
>>>> @@ -62,17 +62,21 @@
>>>>
>>>> typedef MakeableInterfaceObject< Geometry> MakeableGeometry;
>>>> typedef typename MakeableGeometry::ImplementationType GeometryImpl;
>>>> -
>>>> +
>>>> + typedef typename Grid::Traits::IntersectionNumbering
>>>> IntersectionNumbering;
>>>> +
>>>> public:
>>>> Intersection ( const EntityPointer&inside, const
>>>> HostIntersection&hostIntersection )
>>>> : inside_(&inside ),
>>>> hostIntersection_(&hostIntersection ),
>>>> + numbering_( grid().numbering()[ hostIntersection ] ),
>>>> geo_( GeometryImpl( grid().allocator() ) )
>>>> {}
>>>>
>>>> Intersection ( const Intersection&other )
>>>> : inside_( other.inside_ ),
>>>> hostIntersection_( other.hostIntersection_ ),
>>>> + numbering_( other.numbering_ ),
>>>> geo_( GeometryImpl( grid().allocator() ) )
>>>> {}
>>>>
>>>> @@ -210,6 +214,7 @@
>>>> private:
>>>> const EntityPointer *inside_;
>>>> const HostIntersection *hostIntersection_;
>>>> + IntersectionNumbering numbering_;
>>>> mutable MakeableGeometry geo_;
>>>> };
>>>>
>>>>
>>>> Modified: trunk/dune/grid/geometrygrid/numbering.hh
>>>> ===================================================================
>>>> --- trunk/dune/grid/geometrygrid/numbering.hh 2010-04-30 13:24:05 UTC
>>>> (rev 6665)
>>>> +++ trunk/dune/grid/geometrygrid/numbering.hh 2010-04-30 13:44:09 UTC
>>>> (rev 6666)
>>>> @@ -12,18 +12,19 @@
>>>> template< int codim>
>>>> struct EntityNumbering;
>>>>
>>>> - template< class Entity>
>>>> - EntityNumbering< Entity::codimension>
>>>> - operator[] ( const Entity&entity ) const
>>>> - {
>>>> - return EntityNumbering< Entity::codimension>();
>>>> - }
>>>> + struct IntersectionNumbering;
>>>> +
>>>> + template< int codim, int dim, class G, template< int, int, class>
>>>> class I>
>>>> + EntityNumbering< codim> operator[] ( const Entity< codim, dim, G, I>
>>>> &entity ) const;
>>>> +
>>>> + template< class G, template< class> class I>
>>>> + IntersectionNumbering operator[] ( const Intersection< G, I>
>>>> &intersection ) const;
>>>> };
>>>>
>>>>
>>>>
>>>> - // IdenticalNumbering
>>>> - // ------------------
>>>> + // IdenticalNumbering::EntityNumbering
>>>> + // -----------------------------------
>>>>
>>>> template< int codim>
>>>> struct IdenticalNumbering::EntityNumbering
>>>> @@ -37,6 +38,42 @@
>>>> }
>>>> };
>>>>
>>>> +
>>>> +
>>>> + // IdenticalNumbering::EntityNumbering
>>>> + // -----------------------------------
>>>> +
>>>> + struct IdenticalNumbering::IntersectionNumbering
>>>> + {
>>>> + enum Side { Inside, Outside };
>>>> +
>>>> + template< Side side>
>>>> + unsigned int map ( const unsigned int face ) const
>>>> + {
>>>> + return face;
>>>> + }
>>>> + };
>>>> +
>>>> +
>>>> +
>>>> + // Implementation of IdenticalNumbering
>>>> + // ------------------------------------
>>>> +
>>>> + template< int codim, int dim, class G, template< int, int, class>
>>>> class I>
>>>> + IdenticalNumbering::EntityNumbering< codim>
>>>> + IdenticalNumbering::operator[] ( const Entity< codim, dim, G, I>
>>>> &entity ) const
>>>> + {
>>>> + return EntityNumbering< codim>();
>>>> + }
>>>> +
>>>> +
>>>> + template< class G, template< class> class I>
>>>> + IdenticalNumbering::IntersectionNumbering
>>>> + IdenticalNumbering::operator[] ( const Intersection< G, I>
>>>> &intersection ) const
>>>> + {
>>>> + return IntersectionNumbering();
>>>> + }
>>>> +
>>>> }
>>>>
>>>> #endif // #ifndef DUNE_GEOGRID_NUMBERING_HH
>>>>
>>>>
>>>> _______________________________________________
>>>> Dune-Commit mailing list
>>>> Dune-Commit at dune-project.org
>>>> http://lists.dune-project.org/mailman/listinfo/dune-commit
>>>
>>>
>>
> 
> 

-- 
Martin Nolte <nolte at mathematik.uni-freiburg.de>

Universität Freiburg                                   phone: +49-761-203-5642
Abteilung für angewandte Mathematik                    fax:   +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany




More information about the Dune mailing list