[Dune] [#757] Error using VTKWriter

Dune flyspray at dune-project.org
Fri Mar 12 12:54:37 CET 2010


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

A new Flyspray task has been opened.  Details are below. 

User who did this - Atgeirr Flø Rasmussen (atgeirr) 

Attached to Project - Dune
Summary - Error using VTKWriter
Task Type - Bug Report
Category - Grid
Status - Unconfirmed
Assigned To - 
Operating System - Unspecified / All
Severity - Low
Priority - Normal
Reported Version - SVN (pre2.0)
Due in Version - Undecided
Due Date - Undecided
Details - The class VertexIterator inherits ForwardIteratorFacade<VertexIterator, Entity, Entity&, int> and its method dereference() returns an Entity&.

I think that it should be a const iterator, since the grid is not changed by the VTKWriter. I get compilation failures of the following flavour:

/Users/atgeirr/dune_scratch_with_ALU_debug/dune-common/dune/common/iteratorfacades.hh:189: error: invalid initialization of reference of type 'Dune::cpgrid::Entity<0, Dune::CpGrid>&' from expression of type 'const Dune::cpgrid::Entity<0, Dune::CpGrid>'

I have tried to fix this by changing the above mentioned occurrences of Entity to const Entity, and it seems to work (but if there is a better way, I don't know). Output from svn diff follows:

Index: dune/grid/io/file/vtk/vtkwriter.hh
===================================================================
--- dune/grid/io/file/vtk/vtkwriter.hh	(revision 6406)
+++ dune/grid/io/file/vtk/vtkwriter.hh	(working copy)
@@ -252,7 +252,7 @@
     }
     
     class VertexIterator :
-      public ForwardIteratorFacade<VertexIterator, Entity, Entity&, int>
+      public ForwardIteratorFacade<VertexIterator, const Entity, const Entity&, int>
     {
       GridCellIterator git;
       GridCellIterator gend;
@@ -314,7 +314,7 @@
           return git == cit.git
             && index == cit.index && datamode == cit.datamode;
         }
-      Entity& dereference() const
+      const Entity& dereference() const
         {
           return *git;
         }


More information can be found at the following URL:
http://www.dune-project.org/flyspray/index.php?do=details&task_id=757

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.




More information about the Dune mailing list