]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
Ready to detach trio part.
authorgeay <anthony.geay@cea.fr>
Fri, 6 Jun 2014 09:42:04 +0000 (11:42 +0200)
committergeay <anthony.geay@cea.fr>
Fri, 6 Jun 2014 09:42:04 +0000 (11:42 +0200)
14 files changed:
src/MEDCoupling/MEDCouplingField.cxx
src/MEDCoupling/MEDCouplingFieldDouble.cxx
src/ParaMEDMEM/DEC.cxx
src/ParaMEDMEM/DisjointDEC.cxx
src/ParaMEDMEM/DisjointDEC.hxx
src/ParaMEDMEM/ExplicitCoincidentDEC.cxx
src/ParaMEDMEM/ICoCoField.cxx
src/ParaMEDMEM/ICoCoField.hxx
src/ParaMEDMEM/ICoCoMEDField.cxx
src/ParaMEDMEM/ICoCoMEDField.hxx
src/ParaMEDMEM/ICoCoTrioField.cxx
src/ParaMEDMEM/ICoCoTrioField.hxx
src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx
src/ParaMEDMEMTest/test_perf.cxx

index a9d5ff5e46c4eeb2df44b5afbf337abd15714ee0..1c9ca16a391915284d051778106786f006afed11 100644 (file)
@@ -541,7 +541,7 @@ DataArrayInt *MEDCouplingField::computeTupleIdsToSelectFromCellIds(const int *st
 
 /*!
  * Returns number of tuples expected regarding the spatial discretization of \a this
- * field and number of entities in the underlying mesh.
+ * field and number of entities in the underlying mesh. This method behaves exactly as MEDCouplingFieldDouble::getNumberOfTuples.
  *  \return int - the number of expected tuples.
  *  \throw If the spatial discretization of \a this field is NULL.
  *  \throw If the mesh is not set.
index cfa138f3aab1f986f8c3c203ae5ea9c02a03f5d4..2a6c6475574d274ae3a8a9242208d33805ea6249 100644 (file)
@@ -1877,25 +1877,32 @@ int MEDCouplingFieldDouble::getNumberOfComponents() const
 }
 
 /*!
+ * Use MEDCouplingField::getNumberOfTuplesExpected instead of this method. This method will be removed soon, because it is
+ * confusing compared to getNumberOfComponents() and getNumberOfValues() behaviour.
+ *
  * Returns number of tuples in \a this field, that depends on 
  * - the number of entities in the underlying mesh
  * - \ref MEDCouplingSpatialDisc "spatial discretization" of \a this field (e.g. number
  * of Gauss points if \a this->getTypeOfField() == 
  * \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT").
  *
- * The returned value does **not depend** on the number of tuples in the data array
+ * The returned value does \b not \b depend on the number of tuples in the data array
  * (which has to be equal to the returned value), \b contrary to
  * getNumberOfComponents() and getNumberOfValues() that retrieve information from the
- * data array.
+ * data array (Sorry, it is confusing !).
+ * So \b this \b method \b behaves \b exactly \b as MEDCouplingField::getNumberOfTuplesExpected \b method.
+ *
  * \warning No checkCoherency() is done here.
  * For more info on the data arrays, see \ref MEDCouplingArrayPage.
  *  \return int - the number of tuples.
  *  \throw If the mesh is not set.
  *  \throw If the spatial discretization of \a this field is NULL.
  *  \throw If the spatial discretization is not fully defined.
+ *  \sa MEDCouplingField::getNumberOfTuplesExpected
  */
 int MEDCouplingFieldDouble::getNumberOfTuples() const
 {
+  //std::cerr << " ******* MEDCouplingFieldDouble::getNumberOfTuples is deprecated : use MEDCouplingField::getNumberOfTuplesExpected instead ! ******" << std::endl;
   if(!_mesh)
     throw INTERP_KERNEL::Exception("Impossible to retrieve number of tuples because no mesh specified !");
   if(!((const MEDCouplingFieldDiscretization *)_type))
index e186a47230a8629a3560c4c82235425aaec55194..b4584faa4bf46d822fb89dbda0b1f2cbff9a66dc 100644 (file)
@@ -26,7 +26,6 @@
 #include "DEC.hxx"
 #include "ICoCoField.hxx"
 #include "ICoCoMEDField.hxx"
-#include "ICoCoTrioField.hxx"
 #include "MPIProcessorGroup.hxx"
 
 #include <cmath>
index 3170acb82381185e8174c9061c4a499c30b6f1e7..1b1c2f360b16e1ff213f9a2bc7978507adf06ed0 100644 (file)
@@ -26,7 +26,6 @@
 #include "ParaMESH.hxx"
 #include "ICoCoField.hxx"
 #include "ICoCoMEDField.hxx"
-#include "ICoCoTrioField.hxx"
 #include "MPIProcessorGroup.hxx"
 
 #include <cmath>
@@ -80,13 +79,12 @@ namespace ParaMEDMEM
                                                                                        _source_group(&source_group),
                                                                                        _target_group(&target_group),
                                                                                        _owns_field(false),
-                                                                                       _owns_groups(false),
-                                                                                       _icoco_field(0)
+                                                                                       _owns_groups(false)
   {
     _union_group = source_group.fuse(target_group);  
   }
   
-  DisjointDEC::DisjointDEC(const DisjointDEC& s):DEC(s),_local_field(0),_union_group(0),_source_group(0),_target_group(0),_owns_field(false),_owns_groups(false),_icoco_field(0)
+  DisjointDEC::DisjointDEC(const DisjointDEC& s):DEC(s),_local_field(0),_union_group(0),_source_group(0),_target_group(0),_owns_field(false),_owns_groups(false)
   {
     copyInstance(s);
   }
@@ -118,8 +116,7 @@ namespace ParaMEDMEM
 
   DisjointDEC::DisjointDEC(const std::set<int>& source_ids, const std::set<int>& target_ids, const MPI_Comm& world_comm):_local_field(0), 
                                                                                                                          _owns_field(false),
-                                                                                                                         _owns_groups(true),
-                                                                                                                         _icoco_field(0)
+                                                                                                                         _owns_groups(true)
   {
     ParaMEDMEM::CommInterface comm;
     // Create the list of procs including source and target
@@ -195,8 +192,6 @@ namespace ParaMEDMEM
     _owns_groups=false;
     _source_group=0;
     _target_group=0;
-    delete _icoco_field;
-    _icoco_field=0;
     delete _union_group;
     _union_group=0;
   }
@@ -212,7 +207,7 @@ namespace ParaMEDMEM
     will be updated by a recvData() call.
     Reversely, if the processor is on the sending end, the field will be read, possibly transformed, and sent appropriately to the other side.
   */
-  void DisjointDEC::attachLocalField(const ParaFIELD* field, bool ownPt) 
+  void DisjointDEC::attachLocalField(const ParaFIELD *field, bool ownPt)
   {
     if(!isInUnion())
       return ;
@@ -234,7 +229,7 @@ namespace ParaMEDMEM
     and sent appropriately to the other side.
   */
 
-  void DisjointDEC::attachLocalField(MEDCouplingFieldDouble* field) 
+  void DisjointDEC::attachLocalField(MEDCouplingFieldDouble *field)
   {
     if(!isInUnion())
       return ;
@@ -262,32 +257,13 @@ namespace ParaMEDMEM
     - a ICOCo::TrioField, that is created from tables extracted from a TRIO-U structure.
     
   */
-  void DisjointDEC::attachLocalField(const ICoCo::Field* field)
+  void DisjointDEC::attachLocalField(const ICoCo::MEDField *field)
   {
     if(!isInUnion())
       return ;
-    const ICoCo::MEDField* medfield=dynamic_cast<const ICoCo::MEDField*> (field);
-    if(medfield !=0)
-      {
-        attachLocalField(medfield->getField());
-        return;
-      }
-    const ICoCo::TrioField* triofield=dynamic_cast<const ICoCo::TrioField*> (field);
-    if (triofield !=0)
-      {
-        /* Strange part of code localgroup not used !
-        ProcessorGroup* localgroup;
-        if (_source_group->containsMyRank())
-          localgroup=_source_group;
-        else
-        localgroup=_target_group;*/
-        delete _icoco_field;
-        
-        _icoco_field=new ICoCo::MEDField(*const_cast<ICoCo::TrioField* >(triofield));
-        attachLocalField(_icoco_field);
-        return;
-      }
-    throw INTERP_KERNEL::Exception("incompatible field type");
+    if(!field)
+      throw INTERP_KERNEL::Exception("DisjointDEC::attachLocalField : ICoCo::MEDField pointer is NULL !");
+    attachLocalField(field->getField());
   }
   
   /*!
index 77421f35998785ab35b897fbbd27c111b7f2b80e..0cac7c597ae76d88b17ba99fcebe776a77f11d14 100644 (file)
@@ -29,7 +29,7 @@
 
 namespace ICoCo
 {
-  class Field;
+  class MEDField;
 }
 
 namespace ParaMEDMEM
@@ -40,16 +40,16 @@ namespace ParaMEDMEM
   class DisjointDEC : public DEC
   {
   public:
-    DisjointDEC():_local_field(0),_union_group(0),_source_group(0),_target_group(0),_owns_field(false),_owns_groups(false),_icoco_field(0) { }
+    DisjointDEC():_local_field(0),_union_group(0),_source_group(0),_target_group(0),_owns_field(false),_owns_groups(false) { }
     DisjointDEC(ProcessorGroup& source_group, ProcessorGroup& target_group);
     DisjointDEC(const DisjointDEC&);
     DisjointDEC &operator=(const DisjointDEC& s);
     DisjointDEC(const std::set<int>& src_ids, const std::set<int>& trg_ids,
                 const MPI_Comm& world_comm=MPI_COMM_WORLD);
     void setNature(NatureOfField nature);
-    void attachLocalField( MEDCouplingFieldDoublefield);
-    void attachLocalField(const ParaFIELDfield, bool ownPt=false);
-    void attachLocalField(const ICoCo::Field* field);
+    void attachLocalField( MEDCouplingFieldDouble *field);
+    void attachLocalField(const ParaFIELD *field, bool ownPt=false);
+    void attachLocalField(const ICoCo::MEDField *field);
     
     virtual void prepareSourceDE() = 0;
     virtual void prepareTargetDE() = 0;
@@ -80,8 +80,6 @@ namespace ParaMEDMEM
     const CommInterface* _comm_interface;
     bool _owns_field;
     bool _owns_groups;
-  private:
-    ICoCo::Field* _icoco_field;
   };
 }
 
index 9d055de70bcb07a871418ac9f13fc3ff78f11e43..01d4beacbc858afa693c7ad2eb3d5b3c4263ced3 100644 (file)
@@ -218,7 +218,7 @@ namespace ParaMEDMEM
       }
     else
       {
-        vector <int> size (group->size());
+        vector <int> size2(group->size());
         int myworldrank=group->myRank();
         for (int iproc=0; iproc<group->size();iproc++)
           {
@@ -240,7 +240,7 @@ namespace ParaMEDMEM
                     int sendlocal=topotemp->globalToLocal(global);
                     if (sendlocal!=-1)
                       {
-                        size[iproc]++;
+                        size2[iproc]++;
                         _explicit_mapping.pushBackElem(make_pair(iproc,sendlocal));
                       }
                   }
index 38d58e7f6f281f939e1dc8cf5bddd41699f5d431..3db974ef66d22323f0b002022e8b218b2ba5896f 100644 (file)
 using namespace ICoCo;
 using std::string;
 
-Field::Field() {
-  _name=new string;
+Field::Field()
+{
 }
 
-Field::~Field() {
-  delete _name;
+Field::~Field()
+{
 }
 
-void Field::setName(const string& name) {
-  *_name=name;
+void Field::setName(const string& name)
+{
+  _name=name;
 }
 
-const string& Field::getName() const {
-  return *_name;
+const string& Field::getName() const
+{
+  return _name;
 }
 
-const char* Field::getCharName() const {
-  return _name->c_str();
+const char *Field::getCharName() const
+{
+  return _name.c_str();
 }
index 25427b3ebeb491f84289855ba80d7ad6d062518f..ce8e24adeea7e7a57fe0ada51c064414d27be500 100644 (file)
 
 #ifndef _ICoCoField_included_
 #define _ICoCoField_included_
-#include <string>
-
 
-namespace ICoCo {
+#include <string>
 
-  class Field {
+namespace ICoCo
+{
+  class Field
+  {
   public:
     Field();
     virtual ~Field();
     void setName(const std::string& name);
     const std::string& getName() const;
-    const char* getCharName() const;
-    
+    const char *getCharName() const;
   private:
-    std::string* _name;
+    std::string _name;
   };
 }
+
 #endif
index 76eee2d473a17aa7790d19bed4c02d107b1fcf6a..907c2f3297c7944bf9589d711f96437380e86d6e 100644 (file)
@@ -18,7 +18,6 @@
 //
 
 #include "ICoCoMEDField.hxx"
-#include "ICoCoTrioField.hxx"
 #include "ProcessorGroup.hxx"
 #include "MEDCouplingUMesh.hxx"
 #include "MEDCouplingFieldDouble.hxx"
 namespace ICoCo
 {
 
-  /*! Constructor directly attaching a MEDCouplingUMesh and a MEDCouplingFieldDouble
+  /*! Constructor directly attaching a MEDCouplingFieldDouble
     the object does not take the control the objects pointed by 
-    \a mesh and \a field.
+    \a field.
   */
     
-  MEDField::MEDField(ParaMEDMEM::MEDCouplingUMesh* mesh, ParaMEDMEM::MEDCouplingFieldDouble* field): 
-    _mesh(mesh),
-    _field(field)
+  MEDField::MEDField(ParaMEDMEM::MEDCouplingFieldDouble *field):_field(field)
   {
-    if(_mesh)
-      _mesh->incrRef();
     if(_field)
       _field->incrRef();
   }
-  
-  MEDField::MEDField(TrioField& triofield)
-  {
-    _mesh = ParaMEDMEM::MEDCouplingUMesh::New();
-    _mesh->setMeshDimension(triofield._space_dim);
-    ParaMEDMEM::DataArrayDouble *myCoords=ParaMEDMEM::DataArrayDouble::New();
-    myCoords->alloc(triofield._nbnodes,triofield._space_dim);
-    _mesh->setCoords(myCoords);
-    myCoords->decrRef();
-    double *ptr=myCoords->getPointer();
-    std::copy(triofield._coords,triofield._coords+triofield._space_dim*triofield._nbnodes,ptr);
-    _mesh->allocateCells(triofield._nb_elems);
-    INTERP_KERNEL::NormalizedCellType elemtype;
-    switch (triofield._mesh_dim)
-      {
-      case 1:
-        switch (triofield._nodes_per_elem)
-          {
-          case 2:
-            elemtype=INTERP_KERNEL::NORM_SEG2;
-            break;
-          default:
-            throw INTERP_KERNEL::Exception("incompatible Trio field - wrong nb of nodes per elem");
-          }
-      case 2:
-        switch (triofield._nodes_per_elem)
-          {
-          case 3:
-            elemtype=INTERP_KERNEL::NORM_TRI3;
-            break;
-          case 4 : 
-            elemtype=INTERP_KERNEL::NORM_QUAD4;
-            break;
-          default:
-            throw INTERP_KERNEL::Exception("incompatible Trio field - wrong nb of nodes per elem");
-          }
-        break;
-      case 3:
-        switch (triofield._nodes_per_elem)
-          {
-          case 4:
-            elemtype=INTERP_KERNEL::NORM_TETRA4;
-            break;
-          case 8 : 
-            elemtype=INTERP_KERNEL::NORM_HEXA8;
-            break;
-          default:
-            throw INTERP_KERNEL::Exception("incompatible Trio field - wrong nb of nodes per elem");
-          }
-        break;
-      default:
-        throw INTERP_KERNEL::Exception("incompatible Trio field - wrong mesh dimension");
-      }
-    //creating a connectivity table that complies to MED (1 indexing)
-    //and passing it to _mesh
-    int* conn=new int[triofield._nodes_per_elem];
-    _mesh->setMeshDimension(triofield._mesh_dim);
-    for (int i=0; i<triofield._nb_elems;i++)
-      {
-        for(int j=0;j<triofield._nodes_per_elem;j++)
-          {
-            conn[j]=(triofield._connectivity)[i*triofield._nodes_per_elem+j];
-          }
-        _mesh->insertNextCell(elemtype,triofield._nodes_per_elem,conn);
-      }
-    delete[] conn;
-    
-    _mesh->finishInsertingCells();
-    
-    //field on the sending end
-    int nb_case=triofield.nb_values();
-    if (triofield._type==0)
-      {
-        _field =  ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS,ParaMEDMEM::ONE_TIME);
-      }
-    else
-      {
-        _field =  ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_NODES,ParaMEDMEM::ONE_TIME ); 
-      }
-    _field->setMesh(_mesh);
-    _field->setNature(ParaMEDMEM::ConservativeVolumic);
-    ParaMEDMEM::DataArrayDouble *fieldArr=ParaMEDMEM::DataArrayDouble::New();
-    fieldArr->alloc(_field->getNumberOfTuples(),triofield._nb_field_components);
-    _field->setName(triofield.getName().c_str());
-    std::string meshName("SupportOf_"); meshName+=_field->getName();
-    _mesh->setName(meshName.c_str());
-    _field->setTime(triofield._time1,0,triofield._itnumber);
-    if (triofield._field!=0)
-      {
-        for (int i =0; i<nb_case; i++)
-          for (int j=0; j<triofield._nb_field_components; j++)
-            {
-              fieldArr->setIJ(i,j,triofield._field[i*triofield._nb_field_components+j]);
-            }
-      }
-    //field on the receiving end
-    else
-      {
-        // the trio field points to the pointer inside the MED field
-        triofield._field=const_cast<double*> (fieldArr->getPointer());
-        for (int i=0; i<triofield._nb_field_components*nb_case;i++)
-          triofield._field[i]=0.0;
-      }
-    _field->setArray(fieldArr);
-    fieldArr->decrRef();
-  }
 
   MEDField::~MEDField()
   {
     if(_field)
       _field->decrRef();
-    if(_mesh)
-      _mesh->decrRef();
   }
 }
index 1cebec3f033567a8365554aa2ee364f48b504028..95b873a539a2e5e177b5ea2acc173699f8275567 100644 (file)
@@ -33,15 +33,13 @@ namespace ICoCo
   class MEDField : public ICoCo::Field
   {
   public:
-    MEDField():_mesh(0),_field(0) { }
-    MEDField(ParaMEDMEM::MEDCouplingUMesh* mesh, ParaMEDMEM::MEDCouplingFieldDouble* field);
-    MEDField(TrioField&);
+    MEDField():_field(0) { }
+    MEDField(ParaMEDMEM::MEDCouplingFieldDouble* field);
     virtual ~MEDField();
-    ParaMEDMEM::MEDCouplingFieldDoublegetField() const  { return _field; }
-    ParaMEDMEM::MEDCouplingUMesh* getMesh()const { return _mesh; }
+    ParaMEDMEM::MEDCouplingFieldDouble *getField() const  { return _field; }
+    const ParaMEDMEM::MEDCouplingMesh *getMesh() const { return _field->getMesh(); }
   private:
-    ParaMEDMEM::MEDCouplingUMesh* _mesh;
-    ParaMEDMEM::MEDCouplingFieldDouble* _field;
+    ParaMEDMEM::MEDCouplingFieldDouble *_field;
   };
 }
 
index 604d66ac8fd3238be0bb4681abe7cf14e9ddabfa..ea0b81e4a6ad223f06589bfa5ce8e669f70d0c88 100644 (file)
 // version 1.2 10/05/2010
 
 #include <ICoCoTrioField.hxx>
+
+#include "ICoCoMEDField.hxx"
+#include "MEDCouplingUMesh.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+
 #include <string.h>
 #include <iostream>
 #include <iomanip>
@@ -272,5 +278,118 @@ TrioField& TrioField::operator=(const TrioField& NewField){
 
 }
 
+/*!
+ * This method is non const only due to this->_field that can be modified (to point to the same zone than returned object).
+ * So \b warning, to access to \a this->_field only when the returned object is alive.
+ */
+MEDField *TrioField::build_medfield()
+{
+  ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingUMesh> mesh(ParaMEDMEM::MEDCouplingUMesh::New("",_mesh_dim));
+  ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::DataArrayDouble> coo(ParaMEDMEM::DataArrayDouble::New()); coo->alloc(_nbnodes,_space_dim);
+  mesh->setCoords(coo);
+  double *ptr(coo->getPointer());
+  std::copy(_coords,_coords+_space_dim*_nbnodes,ptr);
+  mesh->allocateCells(_nb_elems);
+  INTERP_KERNEL::NormalizedCellType elemtype;
+  switch(_mesh_dim)
+  {
+    case 1:
+      {
+        switch (_nodes_per_elem)
+        {
+          case 2:
+            elemtype=INTERP_KERNEL::NORM_SEG2;
+            break;
+          default:
+            throw INTERP_KERNEL::Exception("incompatible Trio field - wrong nb of nodes per elem");
+        }
+        break;
+      }
+    case 2:
+      {
+        switch (_nodes_per_elem)
+        {
+          case 3:
+            elemtype=INTERP_KERNEL::NORM_TRI3;
+            break;
+          case 4 :
+            elemtype=INTERP_KERNEL::NORM_QUAD4;
+            break;
+          default:
+            throw INTERP_KERNEL::Exception("incompatible Trio field - wrong nb of nodes per elem");
+        }
+        break;
+      }
+    case 3:
+      {
+        switch (_nodes_per_elem)
+        {
+          case 4:
+            elemtype=INTERP_KERNEL::NORM_TETRA4;
+            break;
+          case 8 :
+            elemtype=INTERP_KERNEL::NORM_HEXA8;
+            break;
+          default:
+            throw INTERP_KERNEL::Exception("incompatible Trio field - wrong nb of nodes per elem");
+        }
+        break;
+          default:
+            throw INTERP_KERNEL::Exception("incompatible Trio field - wrong mesh dimension");
+      }
+  }
+  //creating a connectivity table that complies to MED (1 indexing)
+  //and passing it to _mesh
+  ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingFieldDouble> field;
+  int *conn(new int[_nodes_per_elem]);
+  for (int i=0; i<_nb_elems;i++)
+    {
+      for(int j=0;j<_nodes_per_elem;j++)
+        {
+          conn[j]=_connectivity[i*_nodes_per_elem+j];
+        }
+      mesh->insertNextCell(elemtype,_nodes_per_elem,conn);
+    }
+  delete [] conn;
+  mesh->finishInsertingCells();
+  //
+  //field on the sending end
+  int nb_case=nb_values();
+  if (_type==0)
+    {
+      field =  ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS,ParaMEDMEM::ONE_TIME);
+    }
+  else
+    {
+      field =  ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_NODES,ParaMEDMEM::ONE_TIME );
+    }
+  field->setMesh(mesh);
+  field->setNature(ParaMEDMEM::ConservativeVolumic);
+  ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::DataArrayDouble> fieldArr(ParaMEDMEM::DataArrayDouble::New());
+  fieldArr->alloc(field->getNumberOfTuplesExpected(),_nb_field_components);
+  field->setName(getName().c_str());
+  std::string meshName("SupportOf_"); meshName+=getName();
+  mesh->setName(meshName.c_str());
+  field->setTime(_time1,0,_itnumber);
+  if (_field!=0)
+    {
+      for (int i =0; i<nb_case; i++)
+        for (int j=0; j<_nb_field_components; j++)
+          {
+            fieldArr->setIJ(i,j,_field[i*_nb_field_components+j]);
+          }
+    }
+  //field on the receiving end
+  else
+    {
+      // the trio field points to the pointer inside the MED field
+      _field=fieldArr->getPointer();
+      for (int i=0; i<_nb_field_components*nb_case;i++)
+        _field[i]=0.0;
+    }
+  field->setArray(fieldArr);
+  return new MEDField(field);
+}
+
 
 
index a9de213c9d7e0deef787265ad67dd60e5ccdc710..c0b81b128f314ab0d12ad008d993369b8be9ac53 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <ICoCoField.hxx>
 namespace ICoCo {
-
+  class MEDField;
   //////////////////////////////////////////////////////////////////////////////
   //
   // .DESCRIPTION 
@@ -52,7 +52,7 @@ namespace ICoCo {
     void save(std::ostream& os) const;
     void restore(std::istream& in);
     int nb_values() const ;
-
+    MEDField *build_medfield();
   public:
     int _type ; // 0 elem 1 nodes
     int _mesh_dim;
index cb51ac75365ff756ebf18093e57da9b28a312316..e2687395cec6e42bc4089c4fe3b4d3fe6675b156 100644 (file)
@@ -494,7 +494,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta
   ParaMEDMEM::MEDCouplingUMesh* mesh;
   ParaMEDMEM::ParaMESH* paramesh;
   ParaMEDMEM::ParaFIELD* parafield;
-  ICoCo::Field* icocofield ;
+  ICoCo::MEDField* icocofield ;
   
   string filename_xml1              = getResourceFile("square1_split");
   string filename_xml2              = getResourceFile("square2_split");
@@ -539,7 +539,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta
         value[ielem]=1.0;
     
       //      ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield);
-      icocofield=new ICoCo::MEDField((MEDCouplingUMesh *)paramesh->getCellMesh(),parafield->getField());
+      icocofield=new ICoCo::MEDField(parafield->getField());
       dec.setMethod(srcMeth);
       dec.attachLocalField(icocofield);
     }
@@ -574,7 +574,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta
       for(int ielem=0; ielem<nb_local;ielem++)
         value[ielem]=0.0;
       //      ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield);
-      icocofield=new ICoCo::MEDField((MEDCouplingUMesh *)paramesh->getCellMesh(),parafield->getField());
+      icocofield=new ICoCo::MEDField(parafield->getField());
       dec.setMethod(targetMeth);
       dec.attachLocalField(icocofield);
     }
@@ -857,7 +857,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta
   ParaMEDMEM::MEDCouplingUMesh* mesh;
   ParaMEDMEM::ParaMESH* paramesh;
   ParaMEDMEM::ParaFIELD* parafield;
-  ICoCo::Field* icocofield ;
+  ICoCo::MEDField* icocofield ;
   
   string tmp_dir                    = getenv("TMP");
   if (tmp_dir == "")
@@ -905,7 +905,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta
         value[ielem]=1.0;
     
       //      ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield);
-      icocofield=new ICoCo::MEDField((MEDCouplingUMesh *)paramesh->getCellMesh(),parafield->getField());
+      icocofield=new ICoCo::MEDField(parafield->getField());
       dec.setMethod(srcMeth);
       dec.attachLocalField(icocofield);
     }
@@ -940,7 +940,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta
       for(int ielem=0; ielem<nb_local;ielem++)
         value[ielem]=0.0;
       //      ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield);
-      icocofield=new ICoCo::MEDField((MEDCouplingUMesh *)paramesh->getCellMesh(),parafield->getField());
+      icocofield=new ICoCo::MEDField(parafield->getField());
       dec.setMethod(targetMeth);
       dec.attachLocalField(icocofield);
     }  
@@ -2106,7 +2106,7 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA
   ParaMEDMEM::ParaMESH* paramesh;
   ParaMEDMEM::ParaFIELD* parafield;
   
-  ICoCo::Field* icocofield ;
+  ICoCo::MEDField* icocofield ;
 
   string tmp_dir                    = getenv("TMP");
   if (tmp_dir == "")
@@ -2155,7 +2155,7 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA
         value[ielem]=0.0;
     
       //      ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield);
-      icocofield=new ICoCo::MEDField((MEDCouplingUMesh *)paramesh->getCellMesh(),parafield->getField());
+      icocofield=new ICoCo::MEDField(parafield->getField());
      
       dec.attachLocalField(icocofield);
 
@@ -2194,7 +2194,7 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA
       for(int ielem=0; ielem<nb_local;ielem++)
         value[ielem]=0.0;
       //      ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield);
-      icocofield=new ICoCo::MEDField((MEDCouplingUMesh *)paramesh->getCellMesh(),parafield->getField());
+      icocofield=new ICoCo::MEDField(parafield->getField());
       
       dec.attachLocalField(icocofield);
     }
index 6a5d646eae4ed12c285b8813f868fa2d83f873f1..74695d6b2cc399bc1a5ad737642fc80933ffe2ca 100644 (file)
@@ -149,7 +149,7 @@ void testInterpKernelDEC_2D(const string& filename_xml1, const string& meshname1
   ParaMEDMEM::MEDCouplingUMesh* mesh;
   ParaMEDMEM::ParaMESH* paramesh;
   ParaMEDMEM::ParaFIELD* parafield;
-  ICoCo::Field* icocofield ;
+  ICoCo::MEDField* icocofield ;
   
   // To remove tmp files from disk
   ParaMEDMEMTest_TmpFilesRemover aRemover;
@@ -187,7 +187,7 @@ void testInterpKernelDEC_2D(const string& filename_xml1, const string& meshname1
     for(int ielem=0; ielem<nb_local;ielem++)
       value[ielem]=1.0;
     
-    icocofield=new ICoCo::MEDField((MEDCouplingUMesh *)paramesh->getCellMesh(),parafield->getField());
+    icocofield=new ICoCo::MEDField(parafield->getField());
      
     dec.attachLocalField(icocofield);
   }
@@ -219,7 +219,7 @@ void testInterpKernelDEC_2D(const string& filename_xml1, const string& meshname1
     double *value=parafield->getField()->getArray()->getPointer();
     for(int ielem=0; ielem<nb_local;ielem++)
       value[ielem]=0.0;
-    icocofield=new ICoCo::MEDField((MEDCouplingUMesh *)paramesh->getCellMesh(),parafield->getField());
+    icocofield=new ICoCo::MEDField(parafield->getField());
       
     dec.attachLocalField(icocofield);
   }