[Dune] FS#848 - add index method to GeometryType

Jö Fahlke jorrit at jorrit.de
Fri Mar 11 17:02:16 CET 2011


[ Using the instead of flyspray since I can't log in ]

I like Andreas' proposal.  I modified it a little to provide two utility
classes:

  class LocalGeometryTypeIndex;
  class GlobalGeometryTypeIndex;

Each class provides two methods

  static std::size_t index(const GeometryType &gt);
  static std::size_t size(std::size_t dim);

In the implementation of GlobalGeometryTypeIndex I also use a method

  static std::size_t base(std::size_t dim);

which returns the first index for a given dimension.  This may be useful to
export in case someone stores stuff for all geometry types up to a certain
dimension in a vector and want to iterate over the subset of a particular
dimension in that vector only.

I left out TMP versions of size() (and base()) for now, they are always easy
to provide should someone need them.

The patch with the implementation is attached, please comment.

-- 
Sie können die Unversität jetzt ausschalten.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-GeometryTypeIndex-Two-utility-classes-to-compute-per.patch
Type: text/x-diff
Size: 5187 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20110311/584d7f9d/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20110311/584d7f9d/attachment.sig>


More information about the Dune mailing list