<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Dear all,</p>
<p>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.</p>
<p>The problem is, in parallel this map breaks down and I get
segmentation fault.</p>
<p>Can somebody give me hints on what I should do here?<br>
</p>
<p>Thanks, and warm wishes, Shubhangi</p>
<p><br>
</p>
<p><br>
</p>
<p>PS: Here's some parts of my code for reference:</p>
<p><br>
</p>
<font color="#072cff"><b>In driver:</b></font><br>
// MESH<br>
const int dim =2;<br>
using GridType = Dune::UGGrid<dim>;<br>
MeshParameters meshparam;<br>
<br>
ImplicitSurfaceMesh2DQuad<GridType,MeshParameters>
reactor(meshparam);<br>
reactor.grid().globalRefine(0);<br>
<br>
using GV = GridType::LeafGridView;<br>
GV gv = reactor.grid().leafGridView();<br>
reactor.grid().loadBalance();<br>
//GFS<br>
.....<br>
// BEGIN MAPPING<br>
SomeMap<GFS,GV,PTree> map(gfs, gv, ptree);<br>
map.get_map();<br>
// LOP<br>
using LOP = LocalOperator< GV, SomeMap<GFS,GV,PTree>,
GFS, U >; // spatial part<br>
LOP lop( gv, map, gfs, &u_new);<br>
<br>
<font color="#072cff"><b>In map.hh:</b></font><br>
template<typename GFS,typename GV,typename PTree> <br>
class SomeMap {<br>
<br>
private:<br>
GFS gfs;<br>
const GV& gv;<br>
const PTree& ptree;<br>
<br>
<br>
public:<br>
<br>
typedef Dune::PDELab::LocalFunctionSpace<GFS> LFS;<br>
typedef typename GV::IndexSet IndexSet;<br>
static const int dim = GV::dimension;<br>
typedef typename GV::Grid::template Codim<0>::Entity
Element;<br>
typedef typename GV::Traits::template Codim<0>::Iterator
ElementIterator;<br>
typedef typename GV::IntersectionIterator IntersectionIterator;<br>
<br>
SomeMap(GFS gfs_, const GV& gv_, const PTree& ptree_ ):
gfs(gfs_), gv(gv_), ptree(ptree_) {<br>
const IndexSet &indexSet = gv.indexSet();<br>
int NumElements = indexSet.size(0);<br>
Map = std::vector<MapEntries> ( NumElements );<br>
}<br>
<br>
virtual ~SomeMap(){}<br>
<br>
struct MapEntries{<br>
bool is_L; <br>
Element L_elem; <br>
};<br>
<br>
std::vector<MapEntries> Map;<br>
<br>
void get_map(){<br>
<br>
const IndexSet &indexSet = gv.indexSet();<br>
ElementIterator begin = gv.template begin<0>();<br>
ElementIterator end = gv.template end<0>();<br>
for ( ElementIterator self = begin; self!= end; ++self )<br>
{<br>
int elementNumber = indexSet.index(*self);<br>
<br>
bool flag = false; //DEFAULT<br>
Element elem = (*self); //initialized with self entity<br>
<p> (interation over edges...)</p>
if(some condition){<br>
flag = true;<br>
elem = some_neighbour;<br>
<p> }</p>
MapEntries newEntry;<br>
newEntry.is_L = flag;<br>
newEntry.L_elem = elem;<br>
<br>
Map.at( elementNumber ) = newEntry;<br>
<br>
}//end:: ElementIterator<br>
<br>
}//end: get_map()<br>
<br>
};<br>
<p><br>
</p>
<p><br>
</p>
</body>
</html>