[Dune] GridType in GmshReader

Jö Fahlke jorrit at jorrit.de
Wed Jul 20 10:47:43 CEST 2011


Am Wed, 20. Jul 2011, 13:51:13 +0530 schrieb Jayesh Badwaik:
> I needed to extract the gridtype from the GmshReader and hence, for the same
> purpose,
> I have made the GridType public in my gmshreader.hh file in the defintion of
> GmshReader class definition by adding the following line
> 
> typedef GridType GridImp;
> 
> I think it is a good idea for me, what do you think?
> Has anybody ever felt this need?
> I am creating a framework over dune, and there is a class named as
> DeviceFactory which creates a grid and then collects the grid data
> from the file and then converts the data into a form which i am using and
> then after that sends all the information to a class Device.
> I was already passing the GmshReader<GridImp> as a template Parameter to the
> DeviceFactory
> and I found the extra GridImp Parameter that I had to pass to create the
> grid redundant. and so the change.

Why don't you use GridImp as the template parameter for the Device class?
E.g.

  template<class GridImp>
  class Device {
    typedef GmshReader<GridImp> Reader;
    ...
  };

Or you can use partial specialization:

  template<class Reader>
  class Device;

  template<class GridImp>
  class Device<GmshReader<GridImp> > {
    typedef GmshReader<GridImp> Reader;
    ...
  };

That said, I'm slightly in favour of the GmshReader exporting the grid type,
since that allows to substitude the GmshReader by a modified class (which
wouldn't work with the above constructs).  I'm against exporting it under the
name "GridType" however, I would much prefer the shorter name "Grid".

Jö.

-- 
Cernlib: turns your plain old PC into a quantum computer.
-------------- 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/20110720/48cd83d2/attachment.sig>


More information about the Dune mailing list