[Dune] insert parametrized elements

Marco Cisternino marco.cisternino at optimad.it
Fri Jun 29 16:36:06 CEST 2012


Hi,
I would need some more explanation about the use of
/virtual void insertElement (const GeometryType &type, const 
std::vector< unsigned int > &vertices, const shared_ptr< 
VirtualFunction< FieldVector< ctype, dimension >, FieldVector< ctype, 
dimworld > > > &elementParametrization)
/with ALUCubeGrid.

I call it like this
/factory.insertElement( 
Dune::GeometryType(Dune::GeometryType::cube,dim), 
cubeVertices,Dune::shared_ptr<VirtualFunction<FieldVector<ctype,dim>, 
FieldVector<ctype,dim> > >(new myParametrization<FieldVector<ctype,dim>, 
FieldVector<ctype,dim> >() ) );
/and myParametrization is simply:
/#include <dune/common/function.hh>
template<class DomainType, class RangeType>
class myParametrization : public Dune::VirtualFunction<const 
DomainType&, RangeType&>
{
public:
   myParametrization() {};
   void evaluate(const DomainType& x, RangeType& y) const
   {
     y=x;
   }
};/
but the g++ compiler answer me:
/In file included from ./gridtools.cc:10,
                  from dune_foo.cc:11:
./starcdreader.hh: In static member function 'static GridType* 
Dune::StarCDReader<GridType>::read(const std::string&, const 
Dune::MPIHelper&, bool) [with GridType = Dune::ALUCubeGrid<3, 3>]':
./gridtools.cc:30:   instantiated from 'GridType* readGrid(const 
std::string&, Dune::MPIHelper&) [with GridType = Dune::ALUCubeGrid<3, 3>]'
dune_foo.cc:47:   instantiated from here
./starcdreader.hh:170: error: no matching function for call to 
'Dune::GridFactory<Dune::ALUCubeGrid<3, 3> 
 >::insertElement(Dune::GeometryType, std::vector<unsigned int, 
std::allocator<unsigned int> >&, 
std::shared_ptr<Dune::VirtualFunction<Dune::FieldVector<double, 3>, 
Dune::FieldVector<double, 3> > >)'
/home/marco/workspace/ThalesAlenia/lib/dune/2.1.1/dune-grid-2.1.1/dune/grid/alugrid/3d/alu3dgridfactory.hh:142: 
note: candidates are: void Dune::ALU3dGridFactory< 
<template-parameter-1-1> >::insertElement(const Dune::GeometryType&, 
const std::vector<unsigned int, std::allocator<unsigned int> >&) [with 
ALUGrid = Dune::ALUCubeGrid<3, 3>]
In file included from /usr/include/c++/4.4/memory:83,
                  from 
/home/marco/workspace/ThalesAlenia/lib/dune/2.1.1/dune-common-2.1.1/dune/common/shared_ptr.hh:8,
                  from 
/home/marco/workspace/ThalesAlenia/lib/dune/2.1.1/dune-common-2.1.1/dune/common/mpicollectivecommunication.hh:19,
                  from 
/home/marco/workspace/ThalesAlenia/lib/dune/2.1.1/dune-common-2.1.1/dune/common/mpihelper.hh:9,
                  from dune_foo.cc:7:
/usr/include/c++/4.4/bits/shared_ptr.h: In constructor 
'std::__shared_ptr<_Tp, _Lp>::__shared_ptr(_Tp1*) [with _Tp1 = 
myParametrization<Dune::FieldVector<double, 3>, 
Dune::FieldVector<double, 3> >, _Tp = 
Dune::VirtualFunction<Dune::FieldVector<double, 3>, 
Dune::FieldVector<double, 3> >, __gnu_cxx::_Lock_policy _Lp = 
(__gnu_cxx::_Lock_policy)2u]':
/usr/include/c++/4.4/bits/shared_ptr.h:1244:   instantiated from 
'std::shared_ptr<_Tp>::shared_ptr(_Tp1*) [with _Tp1 = 
myParametrization<Dune::FieldVector<double, 3>, 
Dune::FieldVector<double, 3> >, _Tp = 
Dune::VirtualFunction<Dune::FieldVector<double, 3>, 
Dune::FieldVector<double, 3> >]'
./starcdreader.hh:170:   instantiated from 'static GridType* 
Dune::StarCDReader<GridType>::read(const std::string&, const 
Dune::MPIHelper&, bool) [with GridType = Dune::ALUCubeGrid<3, 3>]'
./gridtools.cc:30:   instantiated from 'GridType* readGrid(const 
std::string&, Dune::MPIHelper&) [with GridType = Dune::ALUCubeGrid<3, 3>]'
dune_foo.cc:47:   instantiated from here
/usr/include/c++/4.4/bits/shared_ptr.h:568: error: cannot convert 
'myParametrization<Dune::FieldVector<double, 3>, 
Dune::FieldVector<double, 3> >*' to 
'Dune::VirtualFunction<Dune::FieldVector<double, 3>, 
Dune::FieldVector<double, 3> >*' in initialization
make[1]: *** [dune_foo-dune_foo.o] Errore 1
make[1]: uscita dalla directory 
"/home/marco/workspace/ThalesAlenia/lib/dune/2.1.1/dune-foo/src"
make: *** [all-recursive] Errore 1
/What am I doing wrongly??
Does ALUCubeGrid supports parametrized elements?? And if not, why? Is 
there the chance to have this kind of support in ALUCubeGrid?
Shall I use something else in order to have curvilinear parametric 
elements in my grid with Dune??
Thanks a lot.

Cheers,
Marco

PS: I will not say anything about yesterday... 'cause I really need your 
help. :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20120629/18a60050/attachment.htm>


More information about the Dune mailing list