[Dune] Problem mit GmshReader

Jö Fahlke jorrit at jorrit.de
Tue May 26 14:20:45 CEST 2015


Am Tue, 26. May 2015, 13:37:14 +0200 schrieb conf86 at web.de:
> Date: Tue, 26 May 2015 13:37:14 +0200
> From: conf86 at web.de
> To: dune at dune-project.org
> Subject: [Dune] Problem mit GmshReader
> 
> Hallo,
> 
> ich versuche gerade ein UG-Gitter aus einer gmsh-Datei zu erzeugen.
> Ich habe es zunächst so versucht, wie es hier geschrieben steht: https://spline.de/static/talks/dune-project.pdf (Seite 25)
> 
>  L. 98 typedef Dune::UGGrid<2> GridType;
>  L. 99 GridType grid;
>  L.100 Dune::GmshReader<GridType>::read(grid, "TEST.geo");   

Yeah, that does not look right.  It should be either

  typedef Dune::UGGrid<2> GridType;
  std::shared_ptr<GridType> gridp(Dune::GmshReader<GridType>::read(grid, "filename"));
  GridType &grid = *gridp;

or

  typedef Dune::UGGrid<2> GridType;
  Dune::GridFactory<GridType> factory;
  Dune::GmshReader<GridType>::read(factory, "filename");
  std::shared_ptr<GridType> gridp(factory.createGrid());
  GridType &grid = *gridp;

The second form is usually used when to want to read physical entity numbers
(but then read() has additional arguments that are not shown here).

Note also that .geo is common as the filename extension for gmsh geometry
description files -- but dune reads mesh files (.msh).  Gmsh can generate .msh
files from .geo files, read the gmsh documentation for the details.

Regards,
Jö.

> und bekomme diese Fehlermeldungen:
> 
>  TEST.cc: In function 'int main(int, char**)':
>  TEST.cc:100:58: error: no matching function for call to 'Dune::GmshReader<Dune::UGGrid<2> >::read(GridType&, const char [11])'
>        Dune::GmshReader<GridType>::read(grid, "TEST.geo");   
>                                                           ^
>  TEST.cc:100:58: note: candidates are:
>  In file included from TEST.cc:18:0:
>  /lib/include/dune/grid/io/file/gmshreader.hh:667:18: note: static Dune::GmshReader<GridType>::Grid* Dune::GmshReader<GridType>::read(const string&, bool, bool) [with GridType =  Dune::UGGrid<2>; Dune::GmshReader<GridType>::Grid = Dune::UGGrid<2>; std::string = std::basic_string<char>]
>       static Grid* read (const std::string& fileName, bool verbose = true, bool insert_boundary_segments=true)
>                   ^
>  /lib/include/dune/grid/io/file/gmshreader.hh:667:18: note:   no known conversion for argument 1 from 'GridType {aka Dune::UGGrid<2>}' to 'const string& {aka const std::basic_string<char>&}'
>  /lib/include/dune/grid/io/file/gmshreader.hh:680:18: note: static Dune::GmshReader<GridType>::Grid* Dune::GmshReader<GridType>::read(const string&, std::vector<int>&, std::vector<int>&, bool, bool) [with GridType = Dune::UGGrid<2>; Dune::GmshReader<GridType>::Grid = Dune::UGGrid<2>; std::string = std::basic_string<char>]
>       static Grid* read (const std::string& fileName,
>                   ^
>  /lib/include/dune/grid/io/file/gmshreader.hh:680:18: note:   candidate expects 5 arguments, 2 provided
>  /lib/include/dune/grid/io/file/gmshreader.hh:699:17: note: static void Dune::GmshReader<GridType>::read(Dune::GridFactory<GridType>&, const string&, bool, bool) [with GridType = Dune::UGGrid<2>; std::string = std::basic_string<char>]
>       static void read (Dune::GridFactory<Grid>& factory, const std::string& fileName,
>                  ^
>  /lib/include/dune/grid/io/file/gmshreader.hh:699:17: note:   no known conversion for argument 1 from 'GridType {aka Dune::UGGrid<2>}' to 'Dune::GridFactory<Dune::UGGrid<2> >&'
>  /lib/include/dune/grid/io/file/gmshreader.hh:708:17: note: static void Dune::GmshReader<GridType>::read(Dune::GridFactory<GridType>&, const string&, std::vector<int>&, std::vector<int>&, bool, bool) [with GridType = Dune::UGGrid<2>; std::string = std::basic_string<char>]
>      static void read (Dune::GridFactory<Grid>& factory,
>                  ^
>  /lib/include/dune/grid/io/file/gmshreader.hh:708:17: note:   candidate expects 6 arguments, 2 provided
> 
> 
> Ich habe es dann wie es oben in "candidates are" der Fehlermeldung stand auch so versucht:
> 
>  L. 98 typedef Dune::UGGrid<2> GridType;
>  L. 99 GridType grid;
>  L.100 Dune::GmshReader<GridType>::read("TEST.geo",true,true);   
> 
> da bekomme ich dann allerdings diese Fehlermeldungen:
> 
>  TEST-TEST.o: In function `main':
>  /home/myname/TEST/src/TEST.cc:99: undefined reference to `Dune::UGGrid<2>::UGGrid()'
>  TEST-TEST.o: In function `Dune::GmshReader<Dune::UGGrid<2> >::read(std::string const&, bool, bool)':
>  /lib/include/dune/grid/io/file/gmshreader.hh:670: undefined reference to `Dune::GridFactory<Dune::UGGrid<2> >::GridFactory()'
>  /lib/include/dune/grid/io/file/gmshreader.hh:676: undefined reference to `Dune::GridFactory<Dune::UGGrid<2> >::createGrid()'
>  /lib/include/dune/grid/io/file/gmshreader.hh:676: undefined reference to `Dune::GridFactory<Dune::UGGrid<2> >::~GridFactory()'
>  TEST-TEST.o: In function `main':
>  /home/myname/TEST/src/TEST.cc:100: undefined reference to `Dune::UGGrid<2>::~UGGrid()'
>  TEST-TEST.o: In function `Dune::GmshReader<Dune::UGGrid<2> >::read(std::string const&, bool, bool)':
>  /lib/include/dune/grid/io/file/gmshreader.hh:676: undefined reference to `Dune::GridFactory<Dune::UGGrid<2> >::~GridFactory()'
>  TEST-TEST.o: In function `main':
>  /home/myname/TEST/src/TEST.cc:100: undefined reference to `Dune::UGGrid<2>::~UGGrid()'
> 
> 
> bzw. so wie hier: http://www.uni-graz.at/~haasegu/Lectures/HPC-II/SS12/Talks/kucher_presentation_june_14.pdf (Seite 9)
> 
>  typedef Dune::UGGrid<2> GridType;
>  GridType* grid = Dune::GmshReader<GridType>::read(std::string("TEST.geo"),true,true);
> 
> und die Fehlermeldungen:
> 
>  TEST-TEST.o: In function `Dune::GmshReader<Dune::UGGrid<2> >::read(std::string const&, bool, bool)':
>  /lib/include/dune/grid/io/file/gmshreader.hh:670: undefined reference to `Dune::GridFactory<Dune::UGGrid<2> >::GridFactory()'
>  /lib/include/dune/grid/io/file/gmshreader.hh:676: undefined reference to `Dune::GridFactory<Dune::UGGrid<2> >::createGrid()'
>  /lib/include/dune/grid/io/file/gmshreader.hh:676: undefined reference to `Dune::GridFactory<Dune::UGGrid<2> >::~GridFactory()'
> 
> 
> Wo könnte hier das Problem liegen? Oder stimmt der Code so nicht? 
> Welche weiteren Angaben wären denn notwendig, dass man den eigentlichen Fehler finden könnte?
>  
> Vielen Dank im Voraus.
> 
> 
> Viele Grüße
> 
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune

-- 
Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics,
University of Münster, Orleans-Ring 10, D-48149 Münster
Tel: +49 251 83 35146 Fax: +49 251 83 32729

Der Horizont vieler Menschen ist ein Kreis mit Radius Null - und das
nennen sie ihren Standpunkt.
-- A. Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20150526/c9c3bfeb/attachment.sig>


More information about the Dune mailing list