[Dune] [Dune-Commit] dune-grid r7068 - trunk/dune/grid/utility

Oliver Sander sander at mi.fu-berlin.de
Sat Nov 6 12:27:22 CET 2010


Hi Robert!
This appears to be a proposal for an interface addition.
Please document it as such.  And please document it to
begin with.  How can I judge a thing of which I don't know
what it does?

Thanks,
Oliver

Am 05.11.2010 16:24, schrieb robertk at dune-project.org:
> Author: robertk
> Date: 2010-11-05 16:24:07 +0100 (Fri, 05 Nov 2010)
> New Revision: 7068
>
> Added:
>     trunk/dune/grid/utility/persistentcontainer.hh
> Modified:
>     trunk/dune/grid/utility/Makefile.am
> Log:
> test implementation for PersistentContainer concept.
>
>
>
> Modified: trunk/dune/grid/utility/Makefile.am
> ===================================================================
> --- trunk/dune/grid/utility/Makefile.am	2010-11-04 21:52:25 UTC (rev 7067)
> +++ trunk/dune/grid/utility/Makefile.am	2010-11-05 15:24:07 UTC (rev 7068)
> @@ -5,7 +5,7 @@
>   gridutilitydir =  $(includedir)/dune/grid/utility
>   gridutility_HEADERS = hierarchicsearch.hh \
>     grapedataioformattypes.hh gridtype.hh griddim.hh \
> -  hostgridaccess.hh \
> +  hostgridaccess.hh persistentcontainer.hh \
>     structuredgridfactory.hh
>
>   include $(top_srcdir)/am/global-rules
>
> Added: trunk/dune/grid/utility/persistentcontainer.hh
> ===================================================================
> --- trunk/dune/grid/utility/persistentcontainer.hh	                        (rev 0)
> +++ trunk/dune/grid/utility/persistentcontainer.hh	2010-11-05 15:24:07 UTC (rev 7068)
> @@ -0,0 +1,64 @@
> +#ifndef DUNE_PERSISTENTCONTAINER_HH
> +#define DUNE_PERSISTENTCONTAINER_HH
> +
> +#include<vector>
> +
> +namespace Dune {
> +
> +
> +template<class Grid, int codim, class Data>
> +class PersistentContainerVector
> +{
> +protected:
> +  typedef typename Grid :: HierarchicIndexSetType HierarchicIndexSetType;
> +  typedef Grid GridType;
> +  const GridType&  grid_;
> +  const HierarchicIndexSetType&  indexSet_;
> +  std::vector<  Data>  data_;
> +
> +public:
> +  typedef typename GridType :: template Codim<  codim>  :: Entity EntityType;
> +public:
> +  PersistentContainer( const GridType&  grid )
> +    : grid_( grid )
> +    , indexSet_( grid_.hierarchicIndexSet() )
> +    , data_()
> +  {
> +    // resize to current size
> +    adapt();
> +  }
> +
> +  PersistentContainer( const PersistentContainer&  other )
> +    : grid_( other.grid_ )
> +    , indexSet_( other.indexSet_ )
> +    , data_( other.data_ )
> +  {}
> +
> +  Data&  operator () (const EntityType&  entity )
> +  {
> +    return data_[ indexSet_.index( entity ) ];
> +  }
> +
> +  const Data&  operator () (const EntityType&  entity ) const
> +  {
> +    return data_[ indexSet_.index( entity ) ];
> +  }
> +
> +  Data&  operator () (const EntityType&  entity, const int subEntity, const int codim )
> +  {
> +    return data_[ indexSet_.subIndex( entity, subEntity, codim ) ];
> +  }
> +
> +  const Data&  operator () (const EntityType&  entity, const int subEntity, const int codim ) const
> +  {
> +    return data_[ indexSet_.subIndex( entity, subEntity, codim ) ];
> +  }
> +
> +  void adapt() const
> +  {
> +    data_.resize( indexSet_.size( codim ) );
> +  }
> +};
> +
> +} // end namespace Dune
> +#endif // end DUNE_PERSISTENTCONTAINER_HH
>
>
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit
>    


-- 
************************************************************************
* 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