]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
20011: [CEA 279] MEDMEM_Utilities.hxx
authoreap <eap@opencascade.com>
Fri, 24 Oct 2008 05:55:19 +0000 (05:55 +0000)
committereap <eap@opencascade.com>
Fri, 24 Oct 2008 05:55:19 +0000 (05:55 +0000)
   roll back changes of BEGIN_OF and END_OF macros

src/ParaMEDMEM/DEC.cxx
src/ParaMEDMEM/InterpolationMatrix.cxx
src/ParaMEDMEM/IntersectionDEC.cxx
src/ParaMEDMEM/MxN_Mapping.cxx
src/ParaMEDMEM/ParaGRID.cxx
src/ParaMEDMEM/ParaMESH.cxx

index 315a971d21b9afadf1704296177da7bb93f0eb6e..bade938b6d784b85a596317a83321f0e3b5027a0 100644 (file)
@@ -147,26 +147,26 @@ Reversely, if the processor is on the sending end, the field will be read, possi
         */
        void DEC::renormalizeTargetField()
        {
-               if (_source_group->containsMyRank())
-                       for (int icomp=0; icomp<_local_field->getField()->getNumberOfComponents(); icomp++)
-                               {
-                                       double total_norm = _local_field->getVolumeIntegral(icomp+1);
-                                       double source_norm = total_norm;
-                                       _comm_interface->broadcast(&source_norm, 1, MPI_DOUBLE, 0,* dynamic_cast<MPIProcessorGroup*>(_union_group)->getComm());
-                                       
-                               }
-               if (_target_group->containsMyRank())
-                       {
-                               for (int icomp=0; icomp<_local_field->getField()->getNumberOfComponents(); icomp++)
-                                       {
-                                               double total_norm = _local_field->getVolumeIntegral(icomp+1);
-                                               double source_norm=total_norm;
-                                               _comm_interface->broadcast(&source_norm, 1, MPI_DOUBLE, 0,* dynamic_cast<MPIProcessorGroup*>(_union_group)->getComm());
-                                               
-                                               if (abs(total_norm)>1e-100)
-                                                       _local_field->getField()->applyLin(source_norm/total_norm,0.0,icomp+1);
-                                       }
-                       }
-       }
+          if (_source_group->containsMyRank())
+            for (int icomp=0; icomp<_local_field->getField()->getNumberOfComponents(); icomp++)
+            {
+              double total_norm = _local_field->getVolumeIntegral(icomp+1);
+              double source_norm = total_norm;
+              _comm_interface->broadcast(&source_norm, 1, MPI_DOUBLE, 0,* dynamic_cast<MPIProcessorGroup*>(_union_group)->getComm());
+
+            }
+          if (_target_group->containsMyRank())
+          {
+            for (int icomp=0; icomp<_local_field->getField()->getNumberOfComponents(); icomp++)
+            {
+              double total_norm = _local_field->getVolumeIntegral(icomp+1);
+              double source_norm=total_norm;
+              _comm_interface->broadcast(&source_norm, 1, MPI_DOUBLE, 0,* dynamic_cast<MPIProcessorGroup*>(_union_group)->getComm());
+
+              if (abs(total_norm)>1e-100)
+                _local_field->getField()->applyLin(source_norm/total_norm,0.0,icomp+1);
+            }
+          }
+        }
        /*! @} */
 }
index 693ac59f6f017f83bb9d15b2764b5e7e04045765..9aac842de21fdda3a5137ecd83a5cc627f9d40ae 100644 (file)
@@ -70,106 +70,106 @@ The number of elements per row is stored in the row_offsets array.
  */
 void InterpolationMatrix::addContribution(MEDMEM::MESH& distant_support, int iproc_distant, int* distant_elems)
 {
-       if (distant_support.getMeshDimension() != _source_support.getMeshDimension() ||
-                       distant_support.getMeshDimension() != _source_support.getMeshDimension() )
-               throw MEDMEM::MEDEXCEPTION("local and distant meshes do not have the same space and mesh dimensions");
-       
-       //creating the interpolator structure
-       vector<map<int,double> > surfaces;
-       //computation of the intersection volumes between source and target elements
-       int source_size=  _source_support.getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS);  
-        
+  if (distant_support.getMeshDimension() != _source_support.getMeshDimension() ||
+      distant_support.getMeshDimension() != _source_support.getMeshDimension() )
+    throw MEDMEM::MEDEXCEPTION("local and distant meshes do not have the same space and mesh dimensions");
 
-       
-       if (distant_support.getMeshDimension()==2 && distant_support.getSpaceDimension()==3)
-       {
-       MEDNormalizedUnstructuredMesh<3,2>target_wrapper(&distant_support);
-       MEDNormalizedUnstructuredMesh<3,2> source_wrapper(&_source_support);
-               INTERP_KERNEL::Interpolation3DSurf interpolator;
-               interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces);
-       }
-       else if (distant_support.getMeshDimension()==2 && distant_support.getSpaceDimension()==2)
-       {
-       MEDNormalizedUnstructuredMesh<2,2>target_wrapper(&distant_support);
-       MEDNormalizedUnstructuredMesh<2,2> source_wrapper(&_source_support);
+  //creating the interpolator structure
+  vector<map<int,double> > surfaces;
+  //computation of the intersection volumes between source and target elements
+  int source_size=  _source_support.getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS);  
 
-               INTERP_KERNEL::Interpolation2D interpolator;
-               interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces);
-       }
-       else if (distant_support.getMeshDimension()==3 && distant_support.getSpaceDimension()==3)
-       {
-       MEDNormalizedUnstructuredMesh<3,3>target_wrapper(&distant_support);
-       MEDNormalizedUnstructuredMesh<3,3> source_wrapper(&_source_support);
 
-               INTERP_KERNEL::Interpolation3D interpolator;
-               interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces);
-       }
-       else
-       {
-               throw MEDMEM::MEDEXCEPTION("no interpolator exists for these mesh and space dimensions ");
-       }
-  
-       if (surfaces.size() != source_size)
-       {
-               cout<<"surfaces.size()="<<surfaces.size()<<" source_size="<<source_size<<endl;  
-               throw MEDEXCEPTION("uncoherent number of rows in interpolation matrix");
-       }
-  
-       //computing the vectors containing the source and target element volumes
-       MEDMEM::SUPPORT target_support(&distant_support,"all cells", MED_EN::MED_CELL);
-       MEDMEM::FIELD<double>* target_triangle_surf = getSupportVolumes(target_support);
-       MEDMEM::SUPPORT source_support (const_cast<MEDMEM::MESH*>(&_source_support),"all cells", MED_EN::MED_CELL);
-       MEDMEM::FIELD<double>* source_triangle_surf = getSupportVolumes(source_support);
-
-       //storing the source volumes
-       _source_volume.resize(source_size);
-       for (int i=0; i<source_size;i++)
-               _source_volume[i]=source_triangle_surf->getValueIJ(i+1,1);
-       
-       //loop over the elements to build the interpolation
-       //matrix structures
+
+  if (distant_support.getMeshDimension()==2 && distant_support.getSpaceDimension()==3)
+  {
+    MEDNormalizedUnstructuredMesh<3,2>target_wrapper(&distant_support);
+    MEDNormalizedUnstructuredMesh<3,2> source_wrapper(&_source_support);
+    INTERP_KERNEL::Interpolation3DSurf interpolator;
+    interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces);
+  }
+  else if (distant_support.getMeshDimension()==2 && distant_support.getSpaceDimension()==2)
+  {
+    MEDNormalizedUnstructuredMesh<2,2>target_wrapper(&distant_support);
+    MEDNormalizedUnstructuredMesh<2,2> source_wrapper(&_source_support);
+
+    INTERP_KERNEL::Interpolation2D interpolator;
+    interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces);
+  }
+  else if (distant_support.getMeshDimension()==3 && distant_support.getSpaceDimension()==3)
+  {
+    MEDNormalizedUnstructuredMesh<3,3>target_wrapper(&distant_support);
+    MEDNormalizedUnstructuredMesh<3,3> source_wrapper(&_source_support);
+
+    INTERP_KERNEL::Interpolation3D interpolator;
+    interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces);
+  }
+  else
+  {
+    throw MEDMEM::MEDEXCEPTION("no interpolator exists for these mesh and space dimensions ");
+  }
+
+  if (surfaces.size() != source_size)
+  {
+    cout<<"surfaces.size()="<<surfaces.size()<<" source_size="<<source_size<<endl;  
+    throw MEDEXCEPTION("uncoherent number of rows in interpolation matrix");
+  }
+
+  //computing the vectors containing the source and target element volumes
+  MEDMEM::SUPPORT target_support(&distant_support,"all cells", MED_EN::MED_CELL);
+  MEDMEM::FIELD<double>* target_triangle_surf = getSupportVolumes(target_support);
+  MEDMEM::SUPPORT source_support (const_cast<MEDMEM::MESH*>(&_source_support),"all cells", MED_EN::MED_CELL);
+  MEDMEM::FIELD<double>* source_triangle_surf = getSupportVolumes(source_support);
+
+  //storing the source volumes
+  _source_volume.resize(source_size);
+  for (int i=0; i<source_size;i++)
+    _source_volume[i]=source_triangle_surf->getValueIJ(i+1,1);
+
+  //loop over the elements to build the interpolation
+  //matrix structures
   for (int ielem=0; ielem < surfaces.size(); ielem++) 
+  {
+    _row_offsets[ielem+1]+=surfaces[ielem].size();
+    //    _source_indices.push_back(make_pair(iproc_distant, ielem));
+    for (map<int,double>::const_iterator iter=surfaces[ielem].begin();
+         iter!=surfaces[ielem].end();
+         iter++)
     {
-      _row_offsets[ielem+1]+=surfaces[ielem].size();
-      //    _source_indices.push_back(make_pair(iproc_distant, ielem));
-      for (map<int,double>::const_iterator iter=surfaces[ielem].begin();
-                                        iter!=surfaces[ielem].end();
-                                        iter++)
-                               {
-                                       //surface of the target triangle
-                                       double surf = target_triangle_surf->getValueIJ(iter->first,1);
-
-                                       //locating the (iproc, itriangle) pair in the list of columns
-                                       vector<pair<int,int> >::iterator iter2 = find (_col_offsets.begin(), _col_offsets.end(),make_pair(iproc_distant,iter->first));
-                                       int col_id;
-                                       
-                                       
-                                       if (iter2==_col_offsets.end())
-                                               {
-                                                       //(iproc, itriangle) is not registered in the list
-                                                       //of distant elements
-
-                                                       _col_offsets.push_back(make_pair(iproc_distant,iter->first));
-                                                       col_id =_col_offsets.size();
-                                                       _mapping.addElementFromSource(iproc_distant,distant_elems[iter->first-1]);
-                                                       _target_volume.push_back(surf);
-                                               } 
-                                       else 
-                                               {
-                                                       col_id=iter2-_col_offsets.begin()+1;
-                                               }
-
-                                       //the non zero coefficient is stored 
-                                       //ielem is the row,
-                                       //col_id is the number of the column
-                                       //iter->second is the value of the coefficient
-
-                                       _coeffs[ielem].push_back(make_pair(col_id,iter->second));
-
-                               }
+      //surface of the target triangle
+      double surf = target_triangle_surf->getValueIJ(iter->first,1);
+
+      //locating the (iproc, itriangle) pair in the list of columns
+      vector<pair<int,int> >::iterator iter2 = find (_col_offsets.begin(), _col_offsets.end(),make_pair(iproc_distant,iter->first));
+      int col_id;
+
+
+      if (iter2==_col_offsets.end())
+      {
+        //(iproc, itriangle) is not registered in the list
+        //of distant elements
+
+        _col_offsets.push_back(make_pair(iproc_distant,iter->first));
+        col_id =_col_offsets.size();
+        _mapping.addElementFromSource(iproc_distant,distant_elems[iter->first-1]);
+        _target_volume.push_back(surf);
+      } 
+      else 
+      {
+        col_id=iter2-_col_offsets.begin()+1;
+      }
+
+      //the non zero coefficient is stored 
+      //ielem is the row,
+      //col_id is the number of the column
+      //iter->second is the value of the coefficient
+
+      _coeffs[ielem].push_back(make_pair(col_id,iter->second));
+
     }
-       delete source_triangle_surf;
-       delete target_triangle_surf;
+  }
+  delete source_triangle_surf;
+  delete target_triangle_surf;
 }      
        
 /*! The call to this method updates the arrays on the target side
@@ -203,99 +203,99 @@ void InterpolationMatrix::multiply(MEDMEM::FIELD<double>& field) const
 {
   vector<double> target_value(_col_offsets.size()* field.getNumberOfComponents(),0.0);
 
-       //computing the matrix multiply on source side
-       if (_source_group.containsMyRank())
-               {
-                       int nbcomp = field.getNumberOfComponents();
-                       int nbrows=  _source_support.getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS);
-                       
-                       // performing W.S
-                       // W is the intersection matrix
-                       // S is the source vector
-
-                       for (int irow=0; irow<nbrows; irow++)
-                               for (int icomp=0; icomp< nbcomp; icomp++)
-                                       {
-                                               double coeff_row = field.getValueIJ(irow+1,icomp+1);
-                                               for (int icol=_row_offsets[irow]; icol< _row_offsets[irow+1];icol++)
-                                                       {
-                                                               int colid= _coeffs[irow][icol-_row_offsets[irow]].first;
-                                                               double value = _coeffs[irow][icol-_row_offsets[irow]].second;
-                                                               target_value[(colid-1)*nbcomp+icomp]+=value*coeff_row;
-                                                       }
-                                       }
-
-                       // performing VT^(-1).(W.S)
-                       // where VT^(-1) is the inverse of the diagonal matrix  containing 
-                       // the volumes of target cells
-
-                       for (int i=0; i<_col_offsets.size();i++)
-                               for (int icomp=0; icomp<nbcomp; icomp++)
-                                       target_value[i*nbcomp+icomp] /= _target_volume[i];
-               }
-
-       if (_target_group.containsMyRank())
-       {
-         int nbelems=field.getSupport()->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS);
-               int nbcomp = field.getNumberOfComponents();
-         double* value = const_cast<double*> (field.getValue());
-         for (int i=0; i<nbelems*nbcomp;i++)
-                 value[i]=0.0;
+  //computing the matrix multiply on source side
+  if (_source_group.containsMyRank())
+  {
+    int nbcomp = field.getNumberOfComponents();
+    int nbrows=  _source_support.getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS);
+
+    // performing W.S
+    // W is the intersection matrix
+    // S is the source vector
+
+    for (int irow=0; irow<nbrows; irow++)
+      for (int icomp=0; icomp< nbcomp; icomp++)
+      {
+        double coeff_row = field.getValueIJ(irow+1,icomp+1);
+        for (int icol=_row_offsets[irow]; icol< _row_offsets[irow+1];icol++)
+        {
+          int colid= _coeffs[irow][icol-_row_offsets[irow]].first;
+          double value = _coeffs[irow][icol-_row_offsets[irow]].second;
+          target_value[(colid-1)*nbcomp+icomp]+=value*coeff_row;
+        }
+      }
+
+    // performing VT^(-1).(W.S)
+    // where VT^(-1) is the inverse of the diagonal matrix  containing 
+    // the volumes of target cells
+
+    for (int i=0; i<_col_offsets.size();i++)
+      for (int icomp=0; icomp<nbcomp; icomp++)
+        target_value[i*nbcomp+icomp] /= _target_volume[i];
   }
-       //on source side : sending  T=VT^(-1).(W.S)
-       //on target side :: receiving T and storing it in field
+
+  if (_target_group.containsMyRank())
+  {
+    int nbelems=field.getSupport()->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS);
+    int nbcomp = field.getNumberOfComponents();
+    double* value = const_cast<double*> (field.getValue());
+    for (int i=0; i<nbelems*nbcomp;i++)
+      value[i]=0.0;
+  }
+  //on source side : sending  T=VT^(-1).(W.S)
+  //on target side :: receiving T and storing it in field
   _mapping.sendRecv(&target_value[0],field);
-  
+
 }
 /*!
   \brief performs s=WTt, where t is the target field, s is the source field, WT is the transpose matrix from W
 
        The call to this method must be called both on the working side 
 and on the idle side. On the working side, the target vector T is received and the
- vector  S=VS^(-1).(WT.T) is computed to update the field. 
+vector  S=VS^(-1).(WT.T) is computed to update the field. 
 On the idle side, no computation is done, but the field is sent.
 
   \param field source field on processors involved on the source side, target field on processors on the target side
- */ 
+*/ 
 void InterpolationMatrix::transposeMultiply(MEDMEM::FIELD<double>& field) const
 {
   vector<double> source_value(_col_offsets.size()* field.getNumberOfComponents(),0.0);
   _mapping.reverseSendRecv(&source_value[0],field);
 
-       //treatment of the transpose matrix multiply on the source side
-       if (_source_group.containsMyRank())
-               {
-                       int nbcomp = field.getNumberOfComponents();
-                       int nbrows = _source_support.getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS);
-                       
-                       vector<double> target_value(nbrows,0.0);
-
-                       //performing WT.T
-                       //WT is W transpose
-                       //T is the target vector
-                       for (int irow=0; irow<nbrows; irow++)
-                               for (int icol=_row_offsets[irow]; icol< _row_offsets[irow+1];icol++)
-                                       for (int icomp=0; icomp<nbcomp; icomp++)
-                                               {
-                                                       int colid= _coeffs[irow][icol-_row_offsets[irow]].first;
-                                                       double value = _coeffs[irow][icol-_row_offsets[irow]].second;
-
-                                                       double coeff_row = source_value[colid-1];
-                                                       target_value[irow*nbcomp+icomp]+=value*coeff_row;
-                                               }
-                               
-                       //performing VS^(-1).(WT.T)
-                       //VS^(-1) is the inverse of the diagonal matrix storing
-                       //volumes of the source cells
-                       for (int i=0; i<nbrows; i++)
-                               for (int icomp=0;  icomp<nbcomp; icomp++)
-                                       target_value[i*nbcomp+icomp]/=_source_volume[i];
-                               
-                       //storing S= VS^(-1).(WT.T)
-                       for (int irow=0; irow<nbrows; irow++)
-                               for (int icomp=0; icomp<nbcomp; icomp++)
-                                       field.setValueIJ(irow+1,icomp+1,target_value[irow*nbcomp+icomp]);
-               }
+  //treatment of the transpose matrix multiply on the source side
+  if (_source_group.containsMyRank())
+  {
+    int nbcomp = field.getNumberOfComponents();
+    int nbrows = _source_support.getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS);
+
+    vector<double> target_value(nbrows,0.0);
+
+    //performing WT.T
+    //WT is W transpose
+    //T is the target vector
+    for (int irow=0; irow<nbrows; irow++)
+      for (int icol=_row_offsets[irow]; icol< _row_offsets[irow+1];icol++)
+        for (int icomp=0; icomp<nbcomp; icomp++)
+        {
+          int colid= _coeffs[irow][icol-_row_offsets[irow]].first;
+          double value = _coeffs[irow][icol-_row_offsets[irow]].second;
+
+          double coeff_row = source_value[colid-1];
+          target_value[irow*nbcomp+icomp]+=value*coeff_row;
+        }
+
+    //performing VS^(-1).(WT.T)
+    //VS^(-1) is the inverse of the diagonal matrix storing
+    //volumes of the source cells
+    for (int i=0; i<nbrows; i++)
+      for (int icomp=0;  icomp<nbcomp; icomp++)
+        target_value[i*nbcomp+icomp]/=_source_volume[i];
+
+    //storing S= VS^(-1).(WT.T)
+    for (int irow=0; irow<nbrows; irow++)
+      for (int icomp=0; icomp<nbcomp; icomp++)
+        field.setValueIJ(irow+1,icomp+1,target_value[irow*nbcomp+icomp]);
+  }
 
 }
 
index 82b03dfb6271213893e51a619cce79cd9297d691..8df2e2a8fa9a652e05058a666e567c8adac52bd8 100644 (file)
@@ -122,87 +122,87 @@ It works in four steps :
 -# The lazy side is updated so that it knows the structure of the data that will be sent by
 the working side during a \a sendData() call.
 
- */
+*/
 void IntersectionDEC::synchronize()
 {
-       const ParaMEDMEM::ParaMESH* para_mesh = _local_field->getSupport()->getMesh();
-       cout <<"size of Interpolation Matrix"<<sizeof(InterpolationMatrix)<<endl;
-       _interpolation_matrix = new InterpolationMatrix (*para_mesh, *_source_group,*_target_group,"P0"); 
+  const ParaMEDMEM::ParaMESH* para_mesh = _local_field->getSupport()->getMesh();
+  cout <<"size of Interpolation Matrix"<<sizeof(InterpolationMatrix)<<endl;
+  _interpolation_matrix = new InterpolationMatrix (*para_mesh, *_source_group,*_target_group,"P0"); 
   _interpolation_matrix->setAllToAllMethod(_allToAllMethod);
   _interpolation_matrix->getAccessDEC()->Asynchronous( _asynchronous ) ;
   _interpolation_matrix->getAccessDEC()->SetTimeInterpolator( _timeinterpolationmethod ) ;
-       
+
   //setting up the communication DEC on both sides  
   if (_source_group->containsMyRank())
+  {
+    //locate the distant meshes
+    ElementLocator locator(*para_mesh, *_target_group);
+
+    //transfering option from IntersectionDEC to ElementLocator                 
+    double bb_adj;
+    getOption("BoundingBoxAdjustment",bb_adj);
+    locator.setOption("BoundingBoxAdjustment",bb_adj);
+
+    MESH* distant_mesh=0; 
+    int* distant_ids=0;
+    for (int i=0; i<_target_group->size(); i++)
     {
-      //locate the distant meshes
-      ElementLocator locator(*para_mesh, *_target_group);
-
-                       //transfering option from IntersectionDEC to ElementLocator                     
-                       double bb_adj;
-                       getOption("BoundingBoxAdjustment",bb_adj);
-                       locator.setOption("BoundingBoxAdjustment",bb_adj);
-
-      MESH* distant_mesh=0; 
-      int* distant_ids=0;
-      for (int i=0; i<_target_group->size(); i++)
-                               {
-                                       //      int idistant_proc = (i+_source_group->myRank())%_target_group->size();
-                                       int     idistant_proc=i;
-                                       
-                                       //gathers pieces of the target meshes that can intersect the local mesh
-                                       locator.exchangeMesh(idistant_proc,distant_mesh,distant_ids);
-                                       
-                                       if (distant_mesh !=0)
-                                               {
-                                                       //adds the contribution of the distant mesh on the local one
-                                                       int idistant_proc_in_union=_union_group->translateRank(_target_group,idistant_proc);
-                                                       cout <<"add contribution from proc "<<idistant_proc_in_union<<" to proc "<<_union_group->myRank()<<endl;
-                                                       _interpolation_matrix->addContribution(*distant_mesh,idistant_proc_in_union,distant_ids);
-                                                       
-                                                       delete distant_mesh;
-                                                       delete[] distant_ids;
-                                                       distant_mesh=0;
-                                                       distant_ids=0;
-                                               }
-                               }  
-                       
-               }
-       
+      //        int idistant_proc = (i+_source_group->myRank())%_target_group->size();
+      int       idistant_proc=i;
+
+      //gathers pieces of the target meshes that can intersect the local mesh
+      locator.exchangeMesh(idistant_proc,distant_mesh,distant_ids);
+
+      if (distant_mesh !=0)
+      {
+        //adds the contribution of the distant mesh on the local one
+        int idistant_proc_in_union=_union_group->translateRank(_target_group,idistant_proc);
+        cout <<"add contribution from proc "<<idistant_proc_in_union<<" to proc "<<_union_group->myRank()<<endl;
+        _interpolation_matrix->addContribution(*distant_mesh,idistant_proc_in_union,distant_ids);
+
+        delete distant_mesh;
+        delete[] distant_ids;
+        distant_mesh=0;
+        distant_ids=0;
+      }
+    }  
+
+  }
+
   if (_target_group->containsMyRank())
+  {
+    ElementLocator locator(*para_mesh, *_source_group);
+    //transfering option from IntersectionDEC to ElementLocator
+    double bb_adj;
+    MEDMEM::OptionManager::getOption("BoundingBoxAdjustment",bb_adj);
+    locator.setOption("BoundingBoxAdjustment",bb_adj);
+
+    MESH* distant_mesh=0;
+    int* distant_ids=0;
+    for (int i=0; i<_source_group->size(); i++)
     {
-      ElementLocator locator(*para_mesh, *_source_group);
-                       //transfering option from IntersectionDEC to ElementLocator
-                       double bb_adj;
-                       MEDMEM::OptionManager::getOption("BoundingBoxAdjustment",bb_adj);
-                       locator.setOption("BoundingBoxAdjustment",bb_adj);
-
-      MESH* distant_mesh=0;
-      int* distant_ids=0;
-      for (int i=0; i<_source_group->size(); i++)
-                               {
-                                       //      int idistant_proc = (i+_target_group->myRank())%_source_group->size();
-                                       int  idistant_proc=i;
-                                       //gathers pieces of the target meshes that can intersect the local mesh
-                                       locator.exchangeMesh(idistant_proc,distant_mesh,distant_ids);
-                                       cout << " Data sent from "<<_union_group->myRank()<<" to source proc "<< idistant_proc<<endl;
-                                       if (distant_mesh!=0)
-                                               {
-                                                       delete distant_mesh;
-                                                       delete[] distant_ids;
-                                                       distant_mesh=0;
-                                                       distant_ids=0;
-                                               }
-                               }      
-               }
+      //        int idistant_proc = (i+_target_group->myRank())%_source_group->size();
+      int  idistant_proc=i;
+      //gathers pieces of the target meshes that can intersect the local mesh
+      locator.exchangeMesh(idistant_proc,distant_mesh,distant_ids);
+      cout << " Data sent from "<<_union_group->myRank()<<" to source proc "<< idistant_proc<<endl;
+      if (distant_mesh!=0)
+      {
+        delete distant_mesh;
+        delete[] distant_ids;
+        distant_mesh=0;
+        distant_ids=0;
+      }
+    }      
+  }
   _interpolation_matrix->prepare();
-       
+
 }
 
 
 /*!
-Receives the data whether the processor is on the working side or on the lazy side. It must match a \a sendData() call on the other side.
- */
+  Receives the data whether the processor is on the working side or on the lazy side. It must match a \a sendData() call on the other side.
+*/
 void IntersectionDEC::recvData()
 {
 
index e2197dcd1c245cd97b12ba3334905b216dd8306f..9f83cecebf6d5a659d1378517c79ff8b479ae158 100644 (file)
@@ -267,7 +267,7 @@ void MxN_Mapping::reverseSendRecv(double* recvfield, MEDMEM::FIELD<double>& fiel
 {
   CommInterface comm_interface=_union_group->getCommInterface();
   const MPIProcessorGroup* group = static_cast<const MPIProcessorGroup*>(_union_group);
+
   int nbcomp=field.getNumberOfComponents();
   double* sendbuf=0;
   double* recvbuf=0;
@@ -275,12 +275,12 @@ void MxN_Mapping::reverseSendRecv(double* recvfield, MEDMEM::FIELD<double>& fiel
     sendbuf = new double[_recv_ids.size()*nbcomp];
   if (_sending_ids.size()>0)
     recvbuf = new double[_sending_ids.size()*nbcomp];
-    
+
   int* sendcounts = new int[_union_group->size()];
   int* senddispls=new int[_union_group->size()];
   int* recvcounts=new int[_union_group->size()];
   int* recvdispls=new int[_union_group->size()];
-  
+
   for (int i=0; i< _union_group->size(); i++)
   {
     sendcounts[i]=nbcomp*(_recv_proc_offsets[i+1]-_recv_proc_offsets[i]);
@@ -290,67 +290,67 @@ void MxN_Mapping::reverseSendRecv(double* recvfield, MEDMEM::FIELD<double>& fiel
   }
   //building the buffer of the elements to be sent
   vector<int> offsets = _recv_proc_offsets;
-       
-       for (int iproc=0; iproc<_union_group->size();iproc++)
-               for (int i=_recv_proc_offsets[iproc]; i<_recv_proc_offsets[iproc+1]; i++)
-                       {
-                                       for (int icomp=0; icomp<nbcomp; icomp++)
-                                               sendbuf[i*nbcomp+icomp]=field.getValueIJ(_recv_ids[i],icomp+1);
-                                       //                                      offsets[iproc]++;
-                       }
+
+  for (int iproc=0; iproc<_union_group->size();iproc++)
+    for (int i=_recv_proc_offsets[iproc]; i<_recv_proc_offsets[iproc+1]; i++)
+    {
+      for (int icomp=0; icomp<nbcomp; icomp++)
+        sendbuf[i*nbcomp+icomp]=field.getValueIJ(_recv_ids[i],icomp+1);
+      //                                        offsets[iproc]++;
+    }
   // for (int i=0; i<_recv_ids.size();i++)
-//             { 
-//                     //    int iproc = _recv_ids[i].first;
-//                     int iproc=_recv_ids[i];
-//                     for (int icomp=0; icomp<nbcomp; icomp++)
-//                             //      sendbuf[offsets[iproc]*nbcomp+icomp]=recvfield[i+1*nbcomp+icomp];
-//                             sendbuf[offsets[iproc]*nbcomp+icomp]=field.getValueIJ(i+1,icomp+1);
-//                     offsets[iproc]++;
-//             }
-  
+  //            { 
+  //                    //    int iproc = _recv_ids[i].first;
+  //                    int iproc=_recv_ids[i];
+  //                    for (int icomp=0; icomp<nbcomp; icomp++)
+  //                            //      sendbuf[offsets[iproc]*nbcomp+icomp]=recvfield[i+1*nbcomp+icomp];
+  //                            sendbuf[offsets[iproc]*nbcomp+icomp]=field.getValueIJ(i+1,icomp+1);
+  //                    offsets[iproc]++;
+  //            }
+
   //communication phase
-       switch (_allToAllMethod) {
-    case Native:
-                       {
+  switch (_allToAllMethod) {
+  case Native:
+    {
       const MPI_Comm* comm = group->getComm();
       comm_interface.allToAllV(sendbuf, sendcounts, senddispls, MPI_DOUBLE,
                                recvbuf, recvcounts, recvdispls, MPI_DOUBLE,
                                *comm);
-                       }
-      break;
-    case PointToPoint:
-      _accessDEC->AllToAllv(sendbuf, sendcounts, senddispls, MPI_DOUBLE,
-                            recvbuf, recvcounts, recvdispls, MPI_DOUBLE);
-      break;
+    }
+    break;
+  case PointToPoint:
+    _accessDEC->AllToAllv(sendbuf, sendcounts, senddispls, MPI_DOUBLE,
+                          recvbuf, recvcounts, recvdispls, MPI_DOUBLE);
+    break;
   }  
-       
-  
+
+
   //setting zero values in the field
-       //   for (int i=0; i< field.getSupport()->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS);i++)
-       //     for (int j=0; j<field.getNumberOfComponents(); j++)
-       //       field.setValueIJ(i+1,j+1,0.0);
-  
+  //   for (int i=0; i< field.getSupport()->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS);i++)
+  //     for (int j=0; j<field.getNumberOfComponents(); j++)
+  //       field.setValueIJ(i+1,j+1,0.0);
+
   //setting the received values in the field
   double* recvptr=recvbuf;                         
   for (int i=0; i< _send_proc_offsets[_union_group->size()]; i++)
-               {
-                       for (int icomp=0; icomp<nbcomp; icomp++)
-                               {
-                                       //                                      recvfield[(_sending_ids[i].second-1)*nbcomp+icomp]+=*recvptr;
-                                       recvfield[i*nbcomp+icomp]=*recvptr;
-                                       recvptr++;
-                               }  
-               }       
-       
-  
-//  if (sendbuf!=0) delete[] sendbuf;
+  {
+    for (int icomp=0; icomp<nbcomp; icomp++)
+    {
+      //                                        recvfield[(_sending_ids[i].second-1)*nbcomp+icomp]+=*recvptr;
+      recvfield[i*nbcomp+icomp]=*recvptr;
+      recvptr++;
+    }  
+  }       
+
+
+  //  if (sendbuf!=0) delete[] sendbuf;
   if (sendbuf!=0 && _allToAllMethod == Native) delete[] sendbuf;
   if (recvbuf!=0) delete[] recvbuf;
   delete[] sendcounts;
   delete[] recvcounts;
   delete[] senddispls; 
   delete[] recvdispls;
-  
+
 }
 
 
index 5649bb453b9d2bb8d6f7bc6822bad9e2a38617ad..70f795577b8fdc5ba209d58427fc076897ea89b6 100644 (file)
@@ -58,7 +58,8 @@ ParaGRID::~ParaGRID(){if (_grid !=0) delete _grid;};
 void ParaGRID::write(MEDMEM::driverTypes driverType, const string& master_filename)
 throw (MEDMEM::MEDEXCEPTION){
        
-       BEGIN_OF("ParaMEDMEM::ParaGRID::write()");
+  const char* LOC = "ParaMEDMEM::ParaGRID::write()";
+  BEGIN_OF(LOC);
         
        if (!_block_topology->getProcGroup()->containsMyRank()) return;
         
index 9288dc3d7b3a923d36d01608fa7ebf452377cef8..15f99ac30a23bde1519d0ce3973ed39337566420 100644 (file)
@@ -20,7 +20,8 @@ ParaMESH::ParaMESH(MEDMEM::driverTypes driver_type, const string& filename,
        const ProcessorGroup& group)
 throw (MEDMEM::MEDEXCEPTION) :_has_mesh_ownership(true) {
 
-  BEGIN_OF("MEDSPLITTER::MESHCollectionDriver::read()")
+  const char* LOC = "MEDSPLITTER::MESHCollectionDriver::read()";
+  BEGIN_OF(LOC);
   
  
   string meshstring;
@@ -234,7 +235,8 @@ ParaMESH::~ParaMESH()
 void ParaMESH::write(MEDMEM::driverTypes driverType, const string& master_filename)
 throw (MEDMEM::MEDEXCEPTION){
        
-       BEGIN_OF("ParaMEDMEM::ParaMESH::write()");
+  const char* LOC = "ParaMEDMEM::ParaMESH::write()";
+  BEGIN_OF(LOC);
         
        if (!_block_topology->getProcGroup()->containsMyRank()) return;