]> SALOME platform Git repositories - tools/medcoupling.git/blobdiff - src/ParaMEDMEM/NonCoincidentDEC.cxx
Salome HOME
Missing wrap of appendFieldProfileFlatly
[tools/medcoupling.git] / src / ParaMEDMEM / NonCoincidentDEC.cxx
index 6ca700a0b8895e87490023132d1d7f831699e79f..9c62a6b6b0ca67b66c863f89110536c02a510f8f 100644 (file)
@@ -1,21 +1,22 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
 //
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
+
 #include <mpi.h>
 #include "CommInterface.hxx"
 #include "Topology.hxx"
 #include <mpi.h>
 #include "CommInterface.hxx"
 #include "Topology.hxx"
@@ -33,25 +34,27 @@ extern "C" {
 #include <fvm_locator.h>
 }
 
 #include <fvm_locator.h>
 }
 
-namespace ParaMEDMEM
+namespace MEDCoupling
 {
 
   /*!
 {
 
   /*!
-    \defgroup noncoincidentdec NonCoincidentDEC
-
-    \section overview Overview
+    \anchor NonCoincidentDEC-det
+    \class NonCoincidentDEC
 
 
-    \c NonCoincidentDEC enables nonconservative remapping of fields 
+    \c NonCoincidentDEC enables non-conservative remapping of fields
     between two parallel codes. 
     The computation is possible for 3D meshes and 2D meshes.
     between two parallel codes. 
     The computation is possible for 3D meshes and 2D meshes.
-    It is not available for 3D surfaces. The computation enables fast parallel localization, based on the 
-    FVM library. The computation is based on a point in element search, followed 
+    It is not available for 3D surfaces.
+
+    The computation enables fast parallel localization, and is based on a point in element search, followed
     by a field evaluation at the point location. Thus, it is typically
     by a field evaluation at the point location. Thus, it is typically
-    faster than the \ref intersectiondec which gives a \ref conservativeremapping.
-    It is particularly true for the initialisation phase (synchronize)
-    which is very computationnaly intensive in \ref intersectiondec.
+    faster than the \ref InterpKernelDEC-det "InterpKernelDEC" which uses a
+    \ref InterpKerRemapGlobal "conservative remapping" (i.e. the same algorithms of volume
+    intersection as in the \ref remapper "sequential remapper")
+    It is particularly true for the initialisation phase (synchronize() method)
+    which has a significant computation cost in \ref InterpKernelDEC-det.
 
 
-    In the present version, only fields lying on elements are considered. 
+    In the present version, only fields lying on elements ("P0") are considered.
     The value is estimated by locating the barycenter of the target
     side cell in a source cell and sending the value of this source cell 
     as the value of the target cell.
     The value is estimated by locating the barycenter of the target
     side cell in a source cell and sending the value of this source cell 
     as the value of the target cell.
@@ -98,7 +101,8 @@ namespace ParaMEDMEM
   fvm_nodal_t*  medmemMeshToFVMMesh(const MEDMEM::MESH* mesh)
   {
     // create an FVM structure from the paramesh structure
   fvm_nodal_t*  medmemMeshToFVMMesh(const MEDMEM::MESH* mesh)
   {
     // create an FVM structure from the paramesh structure
-    fvm_nodal_t * fvm_nodal = fvm_nodal_create(mesh->getName().c_str(),mesh->getMeshDimension());
+    std::string meshName(mesh->getName());//this line avoid that mesh->getName() object killed before fvm_nodal_create read the const char *.
+    fvm_nodal_t * fvm_nodal = fvm_nodal_create(meshName.c_str(),mesh->getMeshDimension());
       
     //loop on cell types
     int nbtypes = mesh->getNumberOfTypes(MED_EN::MED_CELL);
       
     //loop on cell types
     int nbtypes = mesh->getNumberOfTypes(MED_EN::MED_CELL);
@@ -168,7 +172,8 @@ namespace ParaMEDMEM
   {
 
     // create an FVM structure from the paramesh structure
   {
 
     // create an FVM structure from the paramesh structure
-    fvm_nodal_t * fvm_nodal = fvm_nodal_create(support->getName().c_str(),1);
+    std::string supportName(support->getName());//this line avoid that support->getName() object killed before fvm_nodal_create read the const char *.
+    fvm_nodal_t * fvm_nodal = fvm_nodal_create(supportName.c_str(),1);
       
     const MEDMEM::MESH* mesh= support->getMesh();
       
       
     const MEDMEM::MESH* mesh= support->getMesh();
       
@@ -212,7 +217,7 @@ namespace ParaMEDMEM
           {
             elem_numbers = const_cast<fvm_lnum_t*> (support->getNumber(types[itype]));
            
           {
             elem_numbers = const_cast<fvm_lnum_t*> (support->getNumber(types[itype]));
            
-            //creating work arrays to store list of elems for partial suports
+            //creating work arrays to store list of elems for partial supports
             if (itype>0)
               {
                 fvm_lnum_t* temp = new int[nbelems];
             if (itype>0)
               {
                 fvm_lnum_t* temp = new int[nbelems];
@@ -240,12 +245,7 @@ namespace ParaMEDMEM
   {  
   }
 
   {  
   }
 
-  /*!
-    \addtogroup noncoincidentdec
-    @{
-  */
-
-  /*! Constructor of a non coincident DEC with 
+  /*! Constructor of a non coincident \ref para-dec "DEC" with
    * a source group on which lies a field lying on a mesh and a 
    * target group on which lies a mesh.
    * 
    * a source group on which lies a field lying on a mesh and a 
    * target group on which lies a mesh.
    * 
@@ -286,7 +286,7 @@ namespace ParaMEDMEM
     if (_source_group->containsMyRank())
       {
         MEDMEM::MESH* mesh = _local_field->getField()->getSupport()->getMesh();
     if (_source_group->containsMyRank())
       {
         MEDMEM::MESH* mesh = _local_field->getField()->getSupport()->getMesh();
-        fvm_nodal_t* source_nodal = ParaMEDMEM::medmemMeshToFVMMesh(mesh);
+        fvm_nodal_t* source_nodal = MEDCoupling::medmemMeshToFVMMesh(mesh);
       
         int target_size = _target_group->size()  ;
         int start_rank=  _source_group->size();
       
         int target_size = _target_group->size()  ;
         int start_rank=  _source_group->size();
@@ -314,7 +314,7 @@ namespace ParaMEDMEM
       {
         MEDMEM::MESH* mesh = _local_field->getField()->getSupport()->getMesh();
       
       {
         MEDMEM::MESH* mesh = _local_field->getField()->getSupport()->getMesh();
       
-        fvm_nodal_t* target_nodal = ParaMEDMEM::medmemMeshToFVMMesh(mesh);
+        fvm_nodal_t* target_nodal = MEDCoupling::medmemMeshToFVMMesh(mesh);
         int source_size = _source_group->size();
         int start_rank=  0 ;
         const MPI_Comm* comm = (dynamic_cast<const MPIProcessorGroup*> (_union_group))->getComm();
         int source_size = _source_group->size();
         int start_rank=  0 ;
         const MPI_Comm* comm = (dynamic_cast<const MPIProcessorGroup*> (_union_group))->getComm();
@@ -372,7 +372,7 @@ namespace ParaMEDMEM
     int nbcomp = _local_field->getField()->getNumberOfComponents();
     double* distant_values = new double [_nb_distant_points*nbcomp];
 
     int nbcomp = _local_field->getField()->getNumberOfComponents();
     double* distant_values = new double [_nb_distant_points*nbcomp];
 
-    //cheap interpolation :  the value of the cell is transfered to the point
+    //cheap interpolation :  the value of the cell is transferred to the point
     for (int i=0; i<_nb_distant_points; i++)
       for (int j=0; j <nbcomp; j++)
         distant_values[i*nbcomp+j]=values[(_distant_locations[i]-1)*nbcomp+j];
     for (int i=0; i<_nb_distant_points; i++)
       for (int j=0; j <nbcomp; j++)
         distant_values[i*nbcomp+j]=values[(_distant_locations[i]-1)*nbcomp+j];
@@ -390,7 +390,4 @@ namespace ParaMEDMEM
       renormalizeTargetField();
 
   }
       renormalizeTargetField();
 
   }
-  /*!
-    @}
-  */  
 }
 }