Go to Overview over all GrAL packages.
Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Gral/Geometries/geometry-functors.h

00001 #ifndef GRAL_BASE_GB_GEOMETRY_FUNCTORS_H
00002 #define GRAL_BASE_GB_GEOMETRY_FUNCTORS_H
00003 
00004 
00005 // $LICENSE
00006 
00007 #include "Gral/Base/common-grid-basics.h"
00008 
00009 //----------------------------------------------------------------
00029 //----------------------------------------------------------------
00030 
00031 
00032 //----------------------------------------------------------------
00033 //                 vertex2coord_map
00042 //----------------------------------------------------------------
00043 
00044 template<class Geom>
00045 class vertex2coord_map {
00046 public:
00047   typedef typename Geom::grid_type  grid_type;
00048   typedef grid_types<grid_type>     gt;
00049   typedef typename gt::Vertex       Vertex;
00050   typedef typename Geom::coord_type coord_type;
00051 
00052   typedef Vertex                    argument_type;
00053   typedef coord_type                result_type;
00054 private:
00055   const Geom* geom;
00056 public:
00057   vertex2coord_map(const Geom& geo) : geom(&geo) {}
00058  
00059   const result_type& operator()(const Vertex& v) const { return geom->coord(v);}
00060 };
00061 
00066 template<class Geom>
00067 inline vertex2coord_map<Geom> vertex2coord(const Geom& g)
00068 { return vertex2coord_map<Geom>(g);}
00069 
00070 
00071 //----------------------------------------------------------------
00072 //                 edge2length_map
00081 //----------------------------------------------------------------
00082 template<class Geom>
00083 class edge2length_map {
00084 public:
00085   typedef typename Geom::grid_type grid_type;
00086   typedef grid_types<grid_type>    gt;
00087   typedef typename  gt::Edge       Edge;
00088 
00089   typedef Edge                     argument_type;
00090   typedef double                   result_type;
00091 private:
00092   const Geom* geom;
00093 public:
00094   edge2length_map(const Geom& geo) : geom(&geo) {}
00095  
00096   result_type operator()(const Edge& e) const { return geom->length(e);}
00097 };
00098 
00103 template<class Geom>
00104 inline edge2length_map<Geom> edge2length(const Geom& g) 
00105 { return edge2length_map<Geom>(g);}
00106 
00107 #endif
00108 

Copyright (c) Guntram Berti 1997-2002. See the GrAL Homepage for up-to-date information.

Generated at Tue Feb 26 16:05:45 2002 for GrAL Base by doxygen 1.2.11-20011104 written by Dimitri van Heesch, © 1997-2000