Salome HOME
Merge branch 'abn/mpi_imp'
[tools/medcoupling.git] / src / ParaMEDMEM / OverlapInterpolationMatrix.cxx
index 95b7e1b942198468d5772c6397dd6fa94270c63a..0607838330ff4bbb9b6d81ad6617182a5fc059b5 100644 (file)
@@ -48,14 +48,15 @@ namespace ParaMEDMEM
                                                          ParaFIELD *target_field,
                                                          const ProcessorGroup& group,
                                                          const DECOptions& dec_options,
-                                                         const INTERP_KERNEL::InterpolationOptions& i_opt):
+                                                         const INTERP_KERNEL::InterpolationOptions& i_opt,
+                                                         const OverlapElementLocator & locator):
     INTERP_KERNEL::InterpolationOptions(i_opt),
     DECOptions(dec_options),
     _source_field(source_field),
     _target_field(target_field),
     _source_support(source_field->getSupport()->getCellMesh()),
     _target_support(target_field->getSupport()->getCellMesh()),
-    _mapping(group),
+    _mapping(group, locator),
     _group(group)
   {
   }
@@ -76,12 +77,14 @@ namespace ParaMEDMEM
 
   // TODO? Merge with MEDCouplingRemapper::prepareInterpKernelOnlyUU() ?
   /**!
+   * Local run (on this proc) of the sequential interpolation algorithm.
+   *
    * @param srcIds is null if the source mesh is on the local proc
    * @param trgIds is null if the source mesh is on the local proc
    *
    * One of the 2 is necessarily null (the two can be null together)
    */
-  void OverlapInterpolationMatrix::addContribution(const MEDCouplingPointSet *src, const DataArrayInt *srcIds, const std::string& srcMeth, int srcProcId,
+  void OverlapInterpolationMatrix::computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayInt *srcIds, const std::string& srcMeth, int srcProcId,
                                                    const MEDCouplingPointSet *trg, const DataArrayInt *trgIds, const std::string& trgMeth, int trgProcId)
   {
     std::string interpMethod(srcMeth);
@@ -240,7 +243,6 @@ namespace ParaMEDMEM
     _mapping.addContributionST(sparse_matrix_part,srcIds,srcProcId,trgIds,trgProcId);
   }
 
-
   /*!
    * 'procsToSendField' gives the list of procs field data has to be sent to.
    * See OverlapElementLocator::computeBoundingBoxesAndTodoList()
@@ -253,17 +255,34 @@ namespace ParaMEDMEM
       _mapping.prepare(procsToSendField,0);
   }
 
-  void OverlapInterpolationMatrix::computeDeno()
+  void OverlapInterpolationMatrix::computeSurfacesAndDeno()
   {
     if(_target_field->getField()->getNature()==ConservativeVolumic)
       _mapping.computeDenoConservativeVolumic(_target_field->getField()->getNumberOfTuplesExpected());
     else
-      throw INTERP_KERNEL::Exception("Policy Not implemented yet : only ConservativeVolumic defined !");
+      throw INTERP_KERNEL::Exception("OverlapDEC: Policy not implemented yet: only ConservativeVolumic!");
+//      {
+//      if(_target_field->getField()->getNature()==RevIntegral)
+//        {
+//          MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f;
+//          int orient = getOrientation(); // From InterpolationOptions inheritance
+//          if(orient == 2)  // absolute areas
+//             f = _target_support->getMeasureField(true);
+//          else
+//            if(orient == 0)  // relative areas
+//              f = _target_support->getMeasureField(false);
+//            else
+//              throw INTERP_KERNEL::Exception("OverlapDEC: orientation policy not impl. yet!");
+//          _mapping.computeDenoRevIntegral(*f->getArray());
+//        }
+//      else
+//        throw INTERP_KERNEL::Exception("OverlapDEC: Policy not implemented yet: only ConservativeVolumic and RevIntegral defined!");
+//      }
   }
 
-  void OverlapInterpolationMatrix::multiply()
+  void OverlapInterpolationMatrix::multiply(double default_val)
   {
-    _mapping.multiply(_source_field->getField(),_target_field->getField());
+    _mapping.multiply(_source_field->getField(),_target_field->getField(), default_val);
   }
 
   void OverlapInterpolationMatrix::transposeMultiply()
@@ -271,11 +290,6 @@ namespace ParaMEDMEM
     _mapping.transposeMultiply(_target_field->getField(),_source_field->getField());
   }
   
-//  bool OverlapInterpolationMatrix::isSurfaceComputationNeeded(const std::string& method) const
-//  {
-//    return method=="P0";
-//  }
-
   void OverlapInterpolationMatrix::TransposeMatrix(const std::vector<SparseDoubleVec >& matIn,
                                                    int nbColsMatIn, std::vector<SparseDoubleVec >& matOut)
   {