[Dune] gmsh mesh loading using dune-uggrid

Simon Praetorius Simon.Praetorius at tu-dresden.de
Tue Apr 25 12:36:21 CEST 2017


OK, my answer was a bit too fast.

You have a linker problem. It seems you are not linking correctly  
agains dune-uggrid. This is what the error tells you.

Since I don't know how you have setup your project, I can only guess:

- add `target_link_dune_default_libraries(your_target)` in your cmake file
- set all ug flags correctly, i.e. `add_dune_ug_flags(your_target)`
- make sure the module dune-uggrid is found and activated correctly  
(e.g. put it into your required section of dune-module)

Simon

Zitat von "Stary, Tomas" <T.Stary at exeter.ac.uk>:

> Thanks, Simon, unfortunatelly the issue with the code remains the
> same:
>
> CMakeFiles/dune-poroelastic.dir/dune-poroelastic.cc.o: In function `main':
> /home/tom/Work/dune/dune-poroelastic/src/dune-poroelastic.cc:43:  
> undefined reference to `Dune::GridFactory<Dune::UGGrid<3>  
> >::GridFactory()'
> /home/tom/Work/dune/dune-poroelastic/src/dune-poroelastic.cc:45:  
> undefined reference to `Dune::GridFactory<Dune::UGGrid<3>  
> >::createGrid()'
> /home/tom/Work/dune/dune-poroelastic/src/dune-poroelastic.cc:43:  
> undefined reference to `Dune::GridFactory<Dune::UGGrid<3>  
> >::~GridFactory()'
> /home/tom/Work/dune/dune-poroelastic/src/dune-poroelastic.cc:43:  
> undefined reference to `Dune::GridFactory<Dune::UGGrid<3>  
> >::~GridFactory()'
> CMakeFiles/dune-poroelastic.dir/dune-poroelastic.cc.o: In function  
> `std::default_delete<Dune::UGGrid<3> >::operator()(Dune::UGGrid<3>*)  
> const':
> /usr/include/c++/6.3.1/bits/unique_ptr.h:76: undefined reference to  
> `Dune::UGGrid<3>::~UGGrid()'
> collect2: error: ld returned 1 exit status
>
>> On Tue, Apr 25, 2017 at 11:50:57AM , Simon Praetorius wrote:
>>
>> You could use a GridFactory to actually create your grid from a
>> corresponding reader:
>>
>> ```
>> using Grid = Dune::UGGrid<dim>;
>>
>> Dune::GridFactory<Grid> gridFactory;
>> Dune::GmshReader<Grid>::read(gridFactory, filename);
>> std::unique_ptr<Grid> grid( gridFactory.createGrid() );
>> ```
>>
>> Simon
>>
>>
>> On Tue, Apr 25, 2017 at 10:22:08AM +0100, Stary, Tomas wrote:
>> > Hi,
>> >
>> > Thanks, the updating of the dune-grit repository has been helpful.  I
>> > have been able to compile the code including the required header
>> > files.
>> >
>> > I am now trying to initialise the uggrid with the following code:
>> >
>> >       typedef Dune::UGGrid<dim> GRID;
>> >       GRID grid;
>> >
>> > During the compilation I get a linking error:
>> >
>> > CMakeFiles/dune-poroelastic.dir/dune-poroelastic.cc.o: In function `main':
>> > /home/tom/Work/dune/dune-poroelastic/src/dune-poroelastic.cc:34:  
>> undefined reference to `Dune::UGGrid<3>::UGGrid()'
>> > /home/tom/Work/dune/dune-poroelastic/src/dune-poroelastic.cc:34:  
>> undefined reference to `Dune::UGGrid<3>::~UGGrid()'
>> > collect2: error: ld returned 1 exit status
>> >
>> > Is there any other way of initialising the UGGrid?
>> >
>> > Thank you,
>> >
>> > Tomas
>> >
>> > On Mon, Apr 24, 2017 at 11:09:48AM +0100, Stary, Tomas wrote:
>> > > Hi,
>> > >
>> > > I would like to load a mesh created in gmsh program into dune using
>> > > dune-uggrid module. For that I have created a new project dependent on
>> > > dune-uggrid and included required header files to the project:
>> > >
>> > > #include <dune/grid/uggrid.hh>
>> > > #include <dune/grid/common/gridfactory.hh>
>> > > #include <dune/grid/common/gridinfo.hh>
>> > >
>> > > When I try to compile the code I get the following error:
>> > >
>> > > /home/tom/Work/dune/dune-grid/dune/grid/uggrid/ugwrapper.hh: In  
>> static member function 'static UG::DOUBLE  
>> Dune::UG_NS<2>::SurfaceElement(int, const DOUBLE (*)[2], const  
>> DOUBLE*)':
>> > >  
>> /home/tom/Work/dune/dune-grid/dune/grid/uggrid/ugwrapper.hh:876:11:  
>> error: 'SurfaceElement' is not a member of 'UG::D2'
>> > >        if (UG_NAMESPACE ::SurfaceElement(UG_DIM, nc, co_global,  
>> ip_local, &result))
>> > >
>> > > I am using a Linux machine, the same configuration works fine with a
>> > > different version of uggrid on Mac.
>> > >
>> > > Do you have any suggestions on how to get over this issue, please?
>> > >
>> > > Many thanks,
>> > >
>> > > Tomas
>>
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune



-- 
Dr. Simon Praetorius
Institut für Wissenschaftliches Rechnen
Fachrichtung Mathematik
Technische Universität Dresden
Tel.: TUD-42377
Mail: simon.praetorius at tu-dresden.de
Web: www.math.tu-dresden.de/~spraetor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5733 bytes
Desc: S/MIME-Signatur
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20170425/3e76c6ca/attachment.bin>


More information about the Dune mailing list