[Dune] geometryInFather deadlock???

Marco Cisternino marco.cisternino at optimad.it
Tue Nov 6 12:55:41 CET 2012


Hi Duners,
I'm experiencing a problem using geometryInFather method.
I use inside the adapt() method for GeometryGrid in this way:

void adapt() {
   extremes_.reserve();
   typedef typename G::ctype ct;
   const int dim = G::dimension;
   typedef typename G::template Codim<0>::template 
Partition<Dune::All_Partition>::LevelIterator LevelElementIterator;
   typedef typename G::template Codim<0>::EntityPointer EntityPointer;
   typedef typename G::template Codim<0>::Entity Entity;

   int maxlevel = hostGrid_.maxLevel();
   Dune::FieldVector<ct,dim> childCenter,fatherCenter;

   for(int level = 1; level<= maxlevel; ++level){
     LevelElementIterator lbegin = hostGrid_.template 
lbegin<0,Dune::All_Partition>(level);
     LevelElementIterator lend = hostGrid_.template 
lend<0,Dune::All_Partition>(level);
     for(LevelElementIterator it = lbegin; it != lend; ++it){
      Entity& element = *it;
      if( element.isNew() ){
        EntityPointer fatherPtr = it->father();
        Entity& father = *fatherPtr;
        fatherCenter = father.geometry().center();
        childCenter = element.geometryInFather().center();
        extremes_[element].resize( 2 * element.dimension, 0.0 );
        for(int i=0; i<=2; ++i){
          if(childCenter[i]==0.25){
            extremes_[element][2*i] = extremes_[father][2*1];
            extremes_[element][2*i+1] = extremes_[father][2*i] + 
(extremes_[father][2*i+1] - extremes_[father][2*i])/2;
          }
         else{
           extremes_[element][2*i] = extremes_[father][2*i] + 
(extremes_[father][2*i+1] - extremes_[father][2*i])/2;
           extremes_[element][2*i+1] = extremes_[father][2*i+1];
         }
      }}}}}

When I launch the code, for example, with 3 procs and one of them has 
only level 0 element, it suddenly exits the method, while the others 
stop at the geometryInFather call. I looked a little bit in that  method 
and it seems to me that some kind of communication is done for all the 
procs in the global communicator. In this case, I think, not all the 
procs see the communication call and the code runs into a deadlock.
Am I right? if I am, how can I avoid this situation? If not, could you 
explain me what is happening (ask for more if you need)?

Thanks a lot for any help!

Marco

-- 
Marco Cisternino
Optimad Engineering s.r.l.
www.optimad.it
marco.cisternino at optimad.it
+3901119719782





More information about the Dune mailing list