[Dune] Problem with GmshReader

Oliver Sander sander at mi.fu-berlin.de
Fri Apr 1 09:12:03 CEST 2011


Yeah, the line

GridType grid(100);

looks like UGGrid-specific code to me (the 100 meaning: preallocate 100MB
to store the grid in).  Even for UGGrid this construction is deprecated now.
Just remove the (100) and try again.

Best,
Oliver

Am 31.03.2011 12:43, schrieb Martin Nolte:
> Looks like you use some special purpose UG code, here. I don't even know why
> ALU's constructor should be taking an integer constant. Maybe you should use
> the following construction
>
> GridType *grid = GmshReader<  GridType>::read( filename );
>
> Best,
>
> Martin
>
> On 03/31/2011 12:26 PM, Jayesh Badwaik wrote:
>    
>> Hi,
>>
>> I am using the GmshReader to read .msh files
>> and have written the following code to read a msh file
>>
>>           static const int dim = 2;
>>
>>           typedef Dune::ALUSimplexGrid<dim,dim>  GridType;
>>           typedef GridType::LeafGridView GV;
>>
>>           typedef GridType::ctype ctype;
>>
>>           GridType grid(100);
>>           std::string gridName = "./grids/2Dfile.msh" ;
>>           Dune::GmshReader<GridType>  gmshreader;
>>           gmshreader.read(grid, gridName);
>>
>>
>> however the code is not working and outputs the error as shown below:
>>
>> finiteelements.cc: In function ‘int main(int, char**)’:
>> finiteelements.cc:258: error: invalid initialization of non-const reference of
>> type ‘main(int, char**)::GridType&’ from a temporary of type ‘int’
>> /users/jayesh/Build-Spot/DUNE/dune-grid-2.0/dune/grid/io/file/gmshreader.hh:
>> In static member function ‘static GridType*
>> Dune::GmshReader<GridType>::read(GridType&, const std::string&, bool, bool)
>> [with GridType = Dune::ALUSimplexGrid<2, 2>]’:
>> finiteelements.cc:261:   instantiated from here
>> /users/jayesh/Build-Spot/DUNE/dune-grid-2.0/dune/grid/io/file/gmshreader.hh:795:
>> error: no matching function for call to
>> ‘Dune::GridFactory<Dune::ALUSimplexGrid<2, 2>
>>      
>>> ::GridFactory(Dune::ALUSimplexGrid<2, 2>*)’
>>>        
>> /users/jayesh/Build-Spot/DUNE/dune-grid-2.0/dune/grid/alugrid/2d/alu2dgridfactory.hh:276:
>> note: candidates are: Dune::GridFactory<Dune::ALUSimplexGrid<2, 2>
>>      
>>> ::GridFactory(const std::string&)
>>>        
>> /users/jayesh/Build-Spot/DUNE/dune-grid-2.0/dune/grid/alugrid/2d/alu2dgridfactory.hh:271:
>> note:                 Dune::GridFactory<Dune::ALUSimplexGrid<2, 2>
>>      
>>> ::GridFactory()
>>>        
>> /users/jayesh/Build-Spot/DUNE/dune-grid-2.0/dune/grid/alugrid/2d/alu2dgridfactory.hh:262:
>> note:                 Dune::GridFactory<Dune::ALUSimplexGrid<2, 2>
>>      
>>> ::GridFactory(const Dune::GridFactory<Dune::ALUSimplexGrid<2, 2>  >&)
>>>        
>> what could be the reason for the error??
>>
>> Cheers and Regards,
>> Jayesh Vinay Badwaik
>> -----------------------------------------------------------------------------------------------------------
>>
>> We are servants rather than masters in mathematics   --- Charles Hermite
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Dune mailing list
>> Dune at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune
>>      
>    





More information about the Dune mailing list