[dune-pdelab] Reg.: Data Map in parallel

René Heß rene.hk-edv at gmx.de
Tue Sep 1 18:13:22 CEST 2020


Hi,

for me this sounds like a problem where a minimal example to reproduce
the error would be helpful. Maybe you can create a source file where a
mesh is generated and your map is created that leads to a segmentation
fault in parallel. Then we could have a look if we can reproduce the
error.

Best regards,
René


Shubhangi Gupta <sgupta at geomar.de> writes:

> Dear all,
>
> After reading the mesh and getting the grid view, I construct a 'map' 
> where I attach a struct (of one integer id and one neighbour codim 0 
> entity) to each (codim 0) element of the mesh.
>
> The problem is, in parallel this map breaks down and I get segmentation 
> fault.
>
> Can somebody give me hints on what I should do here?
>
> Thanks, and warm wishes, Shubhangi
>
>
>
> PS: Here's some parts of my code for reference:
>
>
> *In driver:*
>      // MESH
>      const int dim =2;
>      using GridType = Dune::UGGrid<dim>;
>      MeshParameters meshparam;
>
>      ImplicitSurfaceMesh2DQuad<GridType,MeshParameters> reactor(meshparam);
>      reactor.grid().globalRefine(0);
>
>      using GV = GridType::LeafGridView;
>      GV gv = reactor.grid().leafGridView();
>      reactor.grid().loadBalance();
>      //GFS
>      .....
>      //    BEGIN MAPPING
>      SomeMap<GFS,GV,PTree> map(gfs, gv, ptree);
>      map.get_map();
>      //   LOP
>      using LOP = LocalOperator< GV, SomeMap<GFS,GV,PTree>, GFS, U >;    
> // spatial part
>      LOP lop( gv, map, gfs, &u_new);
>
> *In map.hh:*
> template<typename GFS,typename GV,typename PTree>
> class SomeMap {
>
> private:
>      GFS gfs;
>      const GV& gv;
>      const PTree& ptree;
>
>
> public:
>
>      typedef Dune::PDELab::LocalFunctionSpace<GFS> LFS;
>      typedef typename GV::IndexSet IndexSet;
>      static const int dim = GV::dimension;
>      typedef typename GV::Grid::template Codim<0>::Entity Element;
>      typedef typename GV::Traits::template Codim<0>::Iterator 
> ElementIterator;
>      typedef typename GV::IntersectionIterator IntersectionIterator;
>
>      SomeMap(GFS gfs_, const GV& gv_, const PTree& ptree_ ): gfs(gfs_), 
> gv(gv_), ptree(ptree_) {
>          const IndexSet &indexSet = gv.indexSet();
>          int NumElements = indexSet.size(0);
>          Map = std::vector<MapEntries> ( NumElements );
>      }
>
>      virtual ~SomeMap(){}
>
>      struct MapEntries{
>          bool is_L;
>          Element L_elem;
>      };
>
>      std::vector<MapEntries> Map;
>
>      void get_map(){
>
>          const IndexSet &indexSet = gv.indexSet();
>          ElementIterator begin = gv.template begin<0>();
>          ElementIterator end = gv.template end<0>();
>          for ( ElementIterator self = begin; self!= end; ++self )
>          {
>              int elementNumber = indexSet.index(*self);
>
>              bool flag = false; //DEFAULT
>              Element elem = (*self); //initialized with self entity
>
>              (interation over edges...)
>
>              if(some condition){
>                  flag = true;
>                  elem = some_neighbour;
>
>              }
>
>              MapEntries newEntry;
>              newEntry.is_L  = flag;
>              newEntry.L_elem = elem;
>
>              Map.at( elementNumber ) = newEntry;
>
>          }//end:: ElementIterator
>
>      }//end: get_map()
>
> };
>
>
>
> _______________________________________________
> dune-pdelab mailing list
> dune-pdelab at lists.dune-project.org
> https://lists.dune-project.org/mailman/listinfo/dune-pdelab
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune-pdelab/attachments/20200901/e6e98bd5/attachment.sig>


More information about the dune-pdelab mailing list