[Dune] [Dune-Commit] dune-grid r6666 - trunk/dune/grid/geometrygrid
Martin Nolte
nolte at mathematik.uni-freiburg.de
Fri Apr 30 16:50:00 CEST 2010
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