<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi all,<br>
I make grid for my problem using UGGrid with a gmsh file.<br>
I also prescribe the material properties and the boundary conditions
using 'physical groups'. I have written the functions below (M and
BCType).<br>
These worked fine in the sequential version, but I am now getting
segmentation fault for parallel version. <br>
I use the NonOverlappingEntitySet (similar to the
convection-diffusion/nonoverlappingsinglephaseflow example in
pdelab-how-to.)<br>
Here is how I create the grid:<br>
<font size="-1"><br>
typedef Dune::UGGrid<dim> GridType;<br>
GridType grid;<br>
// read gmsh file<br>
Dune::GridFactory<GridType> factory(&grid);<br>
std::vector<int> boundary_index_map;<br>
std::vector<int> element_index_map;<br>
const std::string grid_file = parameters.getGridName() ;<br>
Dune::GmshReader<GridType>::read(factory,grid_file,true,true);<br>
factory.createGrid();<br>
grid.loadBalance();<br>
std::cout << " after load balance /" <<
helper.rank() << "/ " << grid.size(0) <<
std::endl;<br>
//grid.globalRefine(1);<br>
// std::cout << " after refinement /" <<
helper.rank() << "/ " << grid.size(0) <<
std::endl;<br>
// get view<br>
typedef GridType::LeafGridView GV;<br>
const GV& gv=grid.leafGridView();<br>
using ES =
Dune::PDELab::NonOverlappingEntitySet<GV>;<br>
ES es(gv);<br>
</font><font size="-1"><font size="-1"> problem_driver(es);<br>
<br>
</font></font>I am not sure why I am getting the seg-fault.<br>
I will really appreciate if anyone can help me with this issue!<br>
Thanks a lot in advance,<br>
warm regards,<br>
Shubhangi<font size="-1"><font size="-1"><br>
</font></font><br>
PS: Here are the functions M and BCType for reference:<font
size="-1"><font size="-1"><br>
___________________________________________________________________________________________________________________<br>
</font><font color="#cc0000">/** \brief A function for material
properties */</font><br>
template<typename GV, typename RF, typename PGMap><br>
class M : public
Dune::PDELab::GridFunctionBase<Dune::PDELab::GridFunctionTraits<GV,RF,1,Dune::FieldVector<RF,1>
>, M<GV,RF,PGMap> ><br>
{<br>
private:<br>
const GV& gv;<br>
const Dune::MultipleCodimMultipleGeomTypeMapper<GV,
P0Layout> mapper ;<br>
const PGMap& pg ;<br>
public:<br>
typedef
Dune::PDELab::GridFunctionTraits<GV,RF,1,Dune::FieldVector<RF,1>
> Traits;<br>
typedef Dune::PDELab::GridFunctionBase <
Dune::PDELab::GridFunctionTraits< GV, RF, 1 ,
Dune::FieldVector< RF,1 > >, M< GV, RF, PGMap >
> BaseT ;<br>
<br>
//! construct from grid view<br>
M ( const GV& gv_ , const PGMap& pg_ ) : gv( gv_ ) ,
mapper( gv_ ) , pg( pg_ ) {}<br>
<br>
//! evaluate extended function on element<br>
inline void evaluate (const typename Traits::ElementType& e,<br>
const typename
Traits::DomainType& xlocal,<br>
typename
Traits::RangeType& y) const {<br>
<br>
<font color="#3333ff"> // retrieve element index and
corresponding material index on level 0<br>
typename GV::template Codim<0>::EntityPointer
ep(e) ;<br>
while ( ep->level() != 0 ) ep = ep->father() ;<br>
const int ei = mapper.map(ep) ;<br>
const int physgroup_index = pg[ ei ] ;<br>
<br>
// evaluate physical group map and set values accordingly<br>
switch ( physgroup_index ){<br>
case 1 : y = y=1. ; break ;<br>
case 2 : y = y=0. ; break ;<br>
default : y = 1. ; break ; // only
one material here<br>
}</font><br>
return ;<br>
}<br>
<br>
//! get a reference to the grid view<br>
inline const GV& getGridView () {return gv;}<br>
};<br>
___________________________________________________________________________________________________________________</font><br>
<font size="-1"><font color="#cc0000">/** \brief A function for boundary
types */<br>
</font></font><font size="-1">template<typename GV, typename
PGMap ></font><br>
<font size="-1">class BCType : public
Dune::PDELab::BoundaryGridFunctionBase<Dune::PDELab::BoundaryGridFunctionTraits<GV,int,1,Dune::FieldVector<int,1>
>,BCType<GV,PGMap> ></font><br>
<font size="-1">{</font><br>
<font size="-1">public :</font><br>
<font size="-1"> typedef
Dune::PDELab::BoundaryGridFunctionTraits<
GV,int,1,Dune::FieldVector<int,1> > Traits ;</font><br>
<br>
<font size="-1"> // ! construct from gridview</font><br>
<font size="-1"> BCType ( const GV& gv_ , const PGMap&
pgmap_ ) : gv ( gv_ ) , pgmap ( pgmap_ ) {}</font><br>
<font size="-1"> // ! return bctype at point on intersection</font><br>
<font size="-1"> template<typename I></font><br>
<font size="-1"> inline void evaluate ( I& i , const typename
Traits::DomainType& xlocal , typename Traits::RangeType& y
) const {</font><br>
<br>
<font color="#3333ff" size="-1"> // evaluate with maps</font><font
color="#3333ff"><br>
<font size="-1"> int physgroup_index = pgmap[
i.intersection().boundarySegmentIndex() ] ;</font><br>
<font size="-1"> switch ( physgroup_index )</font><br>
<font size="-1"> {</font><br>
<font size="-1"> case 3 : y =
Indices::BCId_neumann; break ;</font><br>
<font size="-1"> case 4 : y =
Indices::BCId_dirichlet; break ;</font><br>
<font size="-1"> default : y = Indices::BCId_neumann ;
break ; // Neumann</font><br>
<font size="-1"> }</font></font><br>
<font size="-1"> return ;</font><br>
<font size="-1"> }</font><br>
<br>
<font size="-1"> // ! get a reference to the gridview</font><br>
<font size="-1"> inline const GV& getGridView () { return gv
; }</font><br>
<br>
<font size="-1">private :</font><br>
<font size="-1"> const GV& gv ;</font><br>
<font size="-1"> const PGMap& pgmap ;</font><br>
<br>
<font size="-1">} ;</font><font size="-1"><br>
_________________________________________________________________________________________________________________</font>
</body>
</html>