[dune-fem] Segmentation fault when creating a new space for several times

Andreas Dedner a.s.dedner at warwick.ac.uk
Thu Jun 18 14:28:00 CEST 2015


Hi.
I can confirm this - the problem seems to be related to something in the 
tuple dfs because when using
      typedef DiscreteFunctionSpaceType2 DiscreteFunctionSpaceType;
everything is fine. The exception is thrown by the dofmanager when 
trying to remove an indexset
during  the assignment of the space.
Andreas


On 18/06/15 13:09, Agnese, Marco wrote:
> #include <config.h>
> #include <iostream>
> #include <memory>
>
> #include <dune/fem/space/discontinuousgalerkin.hh>
> #include <dune/fem/space/lagrange.hh>
> #include <dune/fem/space/combinedspace.hh>
> #include <dune/fem/gridpart/leafgridpart.hh>
>
> int main(int argc,char** argv)
> {
>    // init mpi
>    Dune::Fem::MPIManager::initialize(argc,argv);
>    try
>    {
>      // create grid
>      typedef Dune::GridSelector::GridType GridType;
>      typedef Dune::Fem::LeafGridPart<GridType> GridPartType;
>      Dune::GridPtr<GridType> grid("3dgrid.dgf");
>
>      // define spaces
>      typedef Dune::Fem::FunctionSpace<double,double,GridType::dimensionworld,GridType::dimensionworld> FuncSpace1;
>      typedef Dune::Fem::FunctionSpace<double,double,GridType::dimensionworld,1> FuncSpace2;
>      typedef Dune::Fem::LagrangeDiscreteFunctionSpace<FuncSpace1,GridPartType,2> DiscreteFunctionSpaceType1;
>      typedef Dune::Fem::LagrangeDiscontinuousGalerkinSpace<FuncSpace2,GridPartType,0> DiscreteFunctionSpaceType2;
>      typedef Dune::Fem::TupleDiscreteFunctionSpace<DiscreteFunctionSpaceType1,DiscreteFunctionSpaceType2> DiscreteFunctionSpaceType;
>
>      // create function space n times
>      const int n(10);
>      std::unique_ptr<GridPartType> gridPart;
>      std::unique_ptr<DiscreteFunctionSpaceType> space;
>      for(int i=0;i!=n;++i)
>      {
>        std::cout<<"iteration : "<<i<<std::endl;
>        gridPart=std::unique_ptr<GridPartType>(new GridPartType(*grid));
>        space=std::unique_ptr<DiscreteFunctionSpaceType>(new DiscreteFunctionSpaceType(*gridPart));
>      }
>
>      return 0;
>    }
>    catch(const Dune::Exception& exception)
>    {
>      std::cerr<<exception<<std::endl;
>      return 1;
>    }
> }





More information about the dune-fem mailing list