[Dune-devel] [Dune-Commit] dune-geometry r508 - branches/mn-devel/dune/geometry
Oliver Sander
sander at igpm.rwth-aachen.de
Wed Apr 17 15:32:06 CEST 2013
Hi Martin,
do you see any reason not to merge this (and the corresponding part
in geometrygrid) to the trunk?
Best,
Oliver
Am 17.04.2013 14:50, schrieb mnolte at dune-project.org:
> Author: mnolte
> Date: 2013-04-17 14:50:16 +0200 (Wed, 17 Apr 2013)
> New Revision: 508
>
> Modified:
> branches/mn-devel/dune/geometry/multilineargeometry.hh
> Log:
> remove user data
>
>
> Modified: branches/mn-devel/dune/geometry/multilineargeometry.hh
> ===================================================================
> --- branches/mn-devel/dune/geometry/multilineargeometry.hh 2013-04-17 12:34:02 UTC (rev 507)
> +++ branches/mn-devel/dune/geometry/multilineargeometry.hh 2013-04-17 12:50:16 UTC (rev 508)
> @@ -114,12 +114,6 @@
> static const bool v = false;
> static const unsigned int topologyId = ~0u;
> };
> -
> - /** \brief type of user data
> -
> - This is used by GeometryGrid to implement reference-counted geometries.
> - */
> - struct UserData {};
> };
>
>
> @@ -168,8 +162,6 @@
>
> For example, GeometryGrid uses this to implement reference counting.
> */
> - typedef typename Traits::UserData UserData;
> -
> //! type of local coordinates
> typedef FieldVector< ctype, mydimension> LocalCoordinate;
> //! type of global coordinates
> @@ -199,60 +191,45 @@
> typedef Dune::ReferenceElements< ctype, mydimension> ReferenceElements;
>
> private:
> - struct Storage
> - : public UserData
> - {
> - template< class CornerStorage>
> - Storage ( const ReferenceElement&refEl, const CornerStorage&cornerStorage,
> - const UserData&userData )
> - : UserData( userData ),
> - refElement(&refEl ),
> - corners( cornerStorage )
> - {}
> -
> - const ReferenceElement *refElement;
> - typename Traits::template CornerStorage< mydimension, coorddimension>::Type corners;
> - };
> -
> typedef typename Traits::template CornerStorage< mydimension, coorddimension>::Type::const_iterator CornerIterator;
>
> public:
> /** \brief constructor
> *
> - * \param[in] refElement reference element for the geometry
> - * \param[in] cornerStorage corner storage to store internally
> - * \param[in] userData user data to store (optional, if default constructable)
> + * \param[in] refElement reference element for the geometry
> + * \param[in] corners corners to store internally
> *
> - * \note The type of cornerStorage is actually a template argument.
> + * \note The type of corners is actually a template argument.
> * It is only required that the internal corner storage can be
> * constructed from this object.
> */
> - template< class CornerStorage>
> - MultiLinearGeometry ( const ReferenceElement&refElement, const CornerStorage&cornerStorage,
> - const UserData&userData = UserData() )
> - : storage_( refElement, cornerStorage, userData )
> + template< class Corners>
> + MultiLinearGeometry ( const ReferenceElement&refElement,
> + const Corners&corners )
> + : refElement_(&refElement ),
> + corners_( corners )
> {}
>
> /** \brief constructor
> *
> - * \param[in] gt geometry type
> - * \param[in] cornerStorage corner storage to store internally
> - * \param[in] userData user data to store (optional, if default constructable)
> + * \param[in] gt geometry type
> + * \param[in] corners corners to store internally
> *
> - * \note The type of cornerStorage is actually a template argument.
> + * \note The type of corners is actually a template argument.
> * It is only required that the internal corner storage can be
> * constructed from this object.
> */
> - template< class CornerStorage>
> - MultiLinearGeometry ( Dune::GeometryType gt, const CornerStorage&cornerStorage,
> - const UserData&userData = UserData() )
> - : storage_( ReferenceElements::general( gt ), cornerStorage, userData )
> + template< class Corners>
> + MultiLinearGeometry ( Dune::GeometryType gt,
> + const Corners&corners )
> + : refElement_(&ReferenceElements::general( gt ) ),
> + corners_( corners )
> {}
>
> /** \brief is this mapping affine? */
> bool affine () const
> {
> - CornerIterator cit = storage().corners.begin();
> + CornerIterator cit = corners_.begin();
> return affine( topologyId(), integral_constant< int, mydimension>(), cit, jacobianTransposed_ );
> }
>
> @@ -266,7 +243,7 @@
> GlobalCoordinate corner ( int i ) const
> {
> assert( (i>= 0)&& (i< corners()) );
> - return storage().corners[ i ];
> + return corners_[ i ];
> }
>
> /** \brief obtain the centroid of the mapping's image */
> @@ -280,7 +257,7 @@
> */
> GlobalCoordinate global ( const LocalCoordinate&local ) const
> {
> - CornerIterator cit = storage().corners.begin();
> + CornerIterator cit = corners_.begin();
> GlobalCoordinate y;
> global< false>( topologyId(), integral_constant< int, mydimension>(), cit, ctype( 1 ), local, ctype( 1 ), y );
> return y;
> @@ -356,7 +333,7 @@
> */
> const JacobianTransposed&jacobianTransposed ( const LocalCoordinate&local ) const
> {
> - CornerIterator cit = storage().corners.begin();
> + CornerIterator cit = corners_.begin();
> jacobianTransposed< false>( topologyId(), integral_constant< int, mydimension>(), cit, ctype( 1 ), local, ctype( 1 ), jacobianTransposed_ );
> return jacobianTransposed_;
> }
> @@ -369,17 +346,9 @@
> */
> const JacobianInverseTransposed&jacobianInverseTransposed ( const LocalCoordinate&local ) const;
>
> - /** \brief read-only access to the internal user data */
> - const UserData&userData () const { return storage_; }
> - /** \brief read-write access to the internal user data */
> - UserData&userData () { return storage_; }
> -
> protected:
> - const Storage&storage () const { return storage_; }
> - Storage&storage () { return storage_; }
> + const ReferenceElement&refElement () const { return *refElement_; }
>
> - const ReferenceElement&refElement () const { return *storage().refElement; }
> -
> TopologyId topologyId () const
> {
> return topologyId( integral_constant< bool, hasSingleGeometryType>() );
> @@ -415,7 +384,8 @@
> mutable JacobianInverseTransposed jacobianInverseTransposed_;
>
> private:
> - Storage storage_;
> + const ReferenceElement *refElement_;
> + typename Traits::template CornerStorage< mydimension, coorddimension>::Type corners_;
> };
>
>
> @@ -476,7 +446,6 @@
>
> public:
> typedef typename Base::ReferenceElement ReferenceElement;
> - typedef typename Base::UserData UserData;
>
> typedef typename Base::ctype ctype;
>
> @@ -490,18 +459,16 @@
> typedef typename Base::JacobianInverseTransposed JacobianInverseTransposed;
>
> template< class CornerStorage>
> - CachedMultiLinearGeometry ( const ReferenceElement&refElement, const CornerStorage&cornerStorage,
> - const UserData&userData = UserData() )
> - : Base( refElement, cornerStorage, userData ),
> + CachedMultiLinearGeometry ( const ReferenceElement&refElement, const CornerStorage&cornerStorage )
> + : Base( refElement, cornerStorage ),
> affine_( Base::affine() ),
> jacobianInverseTransposedComputed_( false ),
> integrationElementComputed_( false )
> {}
>
> template< class CornerStorage>
> - CachedMultiLinearGeometry ( Dune::GeometryType gt, const CornerStorage&cornerStorage,
> - const UserData&userData = UserData() )
> - : Base( gt, cornerStorage, userData ),
> + CachedMultiLinearGeometry ( Dune::GeometryType gt, const CornerStorage&cornerStorage )
> + : Base( gt, cornerStorage ),
> affine_( Base::affine() ),
> jacobianInverseTransposedComputed_( false ),
> integrationElementComputed_( false )
>
>
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit
More information about the Dune-devel
mailing list