[Dune] insert parametrized elements

Carsten Gräser graeser at math.fu-berlin.de
Fri Jun 29 17:02:58 CEST 2012


Am 29.06.2012 16:36, schrieb Marco Cisternino:
> 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&>
The template arguments of Dune::VirtualFunction are the
DomainType and RangeType and not references to them.
Hence, your function does not derive from the correct base
class.

BTW:
Could you please use plain text instead of html for your
next post to this list.

Regards,
Carsten

> {
> 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. :)
> 
> 
> 
> 
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
> 


-- 
----------------------------------------------------------------------
Dr. Carsten Gräser       | phone: +49-30 / 838-75349
Freie Universität Berlin | fax  : +49-30 / 838-54977
Institut für Mathematik  | email: graeser at math.fu-berlin.de
Arnimallee 6             |
14195 Berlin, Germany    | URL  : http://page.mi.fu-berlin.de/graeser
----------------------------------------------------------------------






More information about the Dune mailing list