]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
just fix indentation
authoreap <eap@opencascade.com>
Tue, 11 Nov 2008 15:38:11 +0000 (15:38 +0000)
committereap <eap@opencascade.com>
Tue, 11 Nov 2008 15:38:11 +0000 (15:38 +0000)
src/ParaMEDMEM/DEC.cxx
src/ParaMEDMEM/InterpolationMatrix.cxx
src/ParaMEDMEM/InterpolationMatrix.hxx
src/ParaMEDMEM/IntersectionDEC.cxx
src/ParaMEDMEM/ParaMESH.cxx
src/ParaMEDMEM/ParaMESH.hxx
src/ParaMEDMEM/ParaSUPPORT.cxx

index 734e3594abe41a19de606b615947537534624c5f..4e09289bc0d3f907094747517d9651bcd78cae6b 100644 (file)
@@ -53,17 +53,17 @@ namespace ParaMEDMEM
 //     TimeInterpolationMethod DECOptions::_timeInterpolationMethod=WithoutTimeInterp;
 //     bool DECOptions::_asynchronous = false;
 //     bool DECOptions::_forcedRenormalization = false;
-       
+
 //     AllToAllMethod DECOptions::_allToAllMethod = Native;
 
-       /*! \addtogroup dec
-               @{ 
-       */
+  /*! \addtogroup dec
+    @{ 
+  */
   DEC::DEC(ProcessorGroup& source_group, ProcessorGroup& target_group):_local_field(0), 
-                                                                                                                                                                                                                                                                                        _source_group(&source_group),
-                                                                                                                                                                                                                                                                                        _target_group(&target_group),
-                                                                                                                                                                                                                                                                                         _owns_field(false),
-                                                                                                                                                                                                                                                                                        _icoco_field(0)
+                                                                       _source_group(&source_group),
+                                                                       _target_group(&target_group),
+                                                                       _owns_field(false),
+                                                                       _icoco_field(0)
   {
     _union_group = source_group.fuse(target_group);  
   }
@@ -71,84 +71,84 @@ namespace ParaMEDMEM
   DEC::~DEC()
   {
     //    delete _union_group;
-               if (_owns_field)
-                       delete _local_field;
-               delete _icoco_field;
+    if (_owns_field)
+      delete _local_field;
+    delete _icoco_field;
     delete _union_group;
   }  
-       /*! Attaches a local field to a DEC.
-If the processor is on the receiving end of the DEC, the field
-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 DEC::attachLocalField(const ParaFIELD* field) 
-       {
-               _local_field=field;
-               _comm_interface=&(field->getTopology()->getProcGroup()->getCommInterface());
-       }
-
-       /*! Attaches a local field to a DEC. The method will test whether the processor
-is on the source or the target side and will associate the mesh underlying the 
-field to the local side.
-
-If the processor is on the receiving end of the DEC, the field
-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 DEC::attachLocalField(MEDMEM::FIELD<double>* field) 
-       {
-               ProcessorGroup* local_group;
-               if (_source_group->containsMyRank())
-                       local_group=_source_group;
-               else if (_target_group->containsMyRank())
-                       local_group=_target_group;
-               else
-                       throw MEDMEM::MEDEXCEPTION("Invalid procgroup for field attachment to DEC");
-                               
-               _local_field= new ParaFIELD(field, *local_group);
-               _owns_field=true;
-               _comm_interface=&(local_group->getCommInterface());
-       }
-
-       /*! 
-               Attaches a local field to a DEC.
-               If the processor is on the receiving end of the DEC, the field
-               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.
-               The field type is a generic ICoCo Field, so that the DEC can couple a number of different fields :
-               - a ICoCo::MEDField, that is created from a MEDMEM structure
-               - a ICOCo::TrioField, that is created from tables extracted from a TRIO-U structure.
-               
-       */
-       
-       void DEC::attachLocalField(const ICoCo::Field* field)
-       {
-               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)
-                       {
-                               ProcessorGroup* localgroup;
-                               if (_source_group->containsMyRank()) localgroup=_source_group;
-                               else localgroup=_target_group;
-                               _icoco_field=new ICoCo::MEDField(*const_cast<ICoCo::TrioField* >(triofield), *localgroup);
-                               //                              _owns_field = true;
-                               attachLocalField(_icoco_field);
-                               return;
-                       }
-               throw MEDMEM::MEDEXCEPTION("incompatible field type");
-       }
-       
-       /*!
-               Computes the field norm over its support 
-               on the source side and renormalizes the field on the target side
-               so that the norms match.
+  /*! Attaches a local field to a DEC.
+    If the processor is on the receiving end of the DEC, the field
+    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 DEC::attachLocalField(const ParaFIELD* field) 
+  {
+    _local_field=field;
+    _comm_interface=&(field->getTopology()->getProcGroup()->getCommInterface());
+  }
+
+  /*! Attaches a local field to a DEC. The method will test whether the processor
+    is on the source or the target side and will associate the mesh underlying the 
+    field to the local side.
+
+    If the processor is on the receiving end of the DEC, the field
+    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 DEC::attachLocalField(MEDMEM::FIELD<double>* field) 
+  {
+    ProcessorGroup* local_group;
+    if (_source_group->containsMyRank())
+      local_group=_source_group;
+    else if (_target_group->containsMyRank())
+      local_group=_target_group;
+    else
+      throw MEDMEM::MEDEXCEPTION("Invalid procgroup for field attachment to DEC");
+
+    _local_field= new ParaFIELD(field, *local_group);
+    _owns_field=true;
+    _comm_interface=&(local_group->getCommInterface());
+  }
+
+  /*! 
+    Attaches a local field to a DEC.
+    If the processor is on the receiving end of the DEC, the field
+    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.
+    The field type is a generic ICoCo Field, so that the DEC can couple a number of different fields :
+    - a ICoCo::MEDField, that is created from a MEDMEM structure
+    - a ICOCo::TrioField, that is created from tables extracted from a TRIO-U structure.
+
+  */
+
+  void DEC::attachLocalField(const ICoCo::Field* field)
+  {
+    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)
+    {
+      ProcessorGroup* localgroup;
+      if (_source_group->containsMyRank()) localgroup=_source_group;
+      else localgroup=_target_group;
+      _icoco_field=new ICoCo::MEDField(*const_cast<ICoCo::TrioField* >(triofield), *localgroup);
+      //                               _owns_field = true;
+      attachLocalField(_icoco_field);
+      return;
+    }
+    throw MEDMEM::MEDEXCEPTION("incompatible field type");
+  }
+
+  /*!
+    Computes the field norm over its support 
+    on the source side and renormalizes the field on the target side
+    so that the norms match.
 
                \f[
                I_{source}=\sum_{i=1}^{n_{source}}V_{i}.|\Phi^{source}_{i}|^2,
@@ -157,34 +157,34 @@ Reversely, if the processor is on the sending end, the field will be read, possi
                \f[
                I_{target}=\sum_{i=1}^{n_{target}}V_{i}.|\Phi^{target}_{i}|^2,
                \f]
-               
+
                \f[
                \Phi^{target}:=\Phi^{target}.\sqrt{I_{source}/I_{target}}.
                \f]
 
-        */
-       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);
-            }
-          }
-        }
-       /*! @} */
+  */
+  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);
+      }
+    }
+  }
+  /*! @} */
 }
index 8152888ea5f559649c2a025bf055e98152690dca..cdc3691f994713eaa0cb3fc7d337b487b61ddf29 100644 (file)
@@ -299,27 +299,27 @@ namespace ParaMEDMEM
     }
   }
 
-       /*!
-               \brief returns the volumes of the cells underlying the field \a field
-
-               For 2D geometries, the returned field contains the areas.
-               For 3D geometries, the returned field contains the volumes.
-
-               \param field field on which cells the volumes are required
-               \return field containing the volumes
-       */
-       MEDMEM::FIELD<double>* InterpolationMatrix::getSupportVolumes(const MEDMEM::SUPPORT& support)
-       {
-               const MEDMEM::MESH* mesh=support.getMesh();
-               int dim = mesh->getMeshDimension();
-               switch (dim)
-                       {
-                       case 2:
-                               return mesh->getArea(&support);
-                       case 3:
-                               return mesh->getVolume(&support);
-                       default:
-                               throw MEDMEM::MEDEXCEPTION("interpolation is not available for this dimension");
-                       }
-       }
+  /*!
+    \brief returns the volumes of the cells underlying the field \a field
+
+    For 2D geometries, the returned field contains the areas.
+    For 3D geometries, the returned field contains the volumes.
+
+    \param field field on which cells the volumes are required
+    \return field containing the volumes
+  */
+  MEDMEM::FIELD<double>* InterpolationMatrix::getSupportVolumes(const MEDMEM::SUPPORT& support)
+  {
+    const MEDMEM::MESH* mesh=support.getMesh();
+    int dim = mesh->getMeshDimension();
+    switch (dim)
+    {
+    case 2:
+      return mesh->getArea(&support);
+    case 3:
+      return mesh->getVolume(&support);
+    default:
+      throw MEDMEM::MEDEXCEPTION("interpolation is not available for this dimension");
+    }
+  }
 }
index ad2610ed65b15c1abfe1f691cea7af2936dea4cc..09cd332f57489632c6651930334eba9b0ca20308 100644 (file)
@@ -14,25 +14,25 @@ namespace ParaMEDMEM
   public:
     
     InterpolationMatrix(const ParaMEDMEM::ParaMESH& source_support, 
-                                                                                               const ProcessorGroup& local_group,
-                                                                                               const ProcessorGroup& distant_group,
-                                                                                               const DECOptions& dec_opt,
-                                                                                               const InterpolationOptions& i_opt);
+                        const ProcessorGroup& local_group,
+                        const ProcessorGroup& distant_group,
+                        const DECOptions& dec_opt,
+                        const InterpolationOptions& i_opt);
 
     
     virtual ~InterpolationMatrix();
     void addContribution(MEDMEM::MESH& distant_support, int iproc_distant, int* distant_elems);
     void multiply(MEDMEM::FIELD<double>&) const;
-               void transposeMultiply(MEDMEM::FIELD<double>&)const;
+    void transposeMultiply(MEDMEM::FIELD<double>&)const;
     void prepare();
     int getNbRows() const {return _row_offsets.size();}
-               MPI_AccessDEC* getAccessDEC(){return _mapping.getAccessDEC();}
+    MPI_AccessDEC* getAccessDEC(){return _mapping.getAccessDEC();}
 
   private:
 
-               MEDMEM::FIELD<double>* getSupportVolumes(const MEDMEM::SUPPORT& field);
+    MEDMEM::FIELD<double>* getSupportVolumes(const MEDMEM::SUPPORT& field);
 
-       private:
+  private:
     vector<int> _row_offsets;
     vector<pair<int,int> > _col_offsets;
     const MEDMEM::MESH& _source_support; 
@@ -41,7 +41,7 @@ namespace ParaMEDMEM
     const ProcessorGroup& _source_group;
     const ProcessorGroup& _target_group;
     vector<double> _target_volume;
-               vector<double> _source_volume;
+    vector<double> _source_volume;
     vector<vector<pair<int,double> > > _coeffs;
   };
   
index ad821ea682169d15a36f506091ca13a1d2fa5783..45d2f53d3c61d8a91b756d028b054802c16ead6d 100644 (file)
@@ -228,24 +228,23 @@ It must match a recvData() call on the other side.
  */
 void IntersectionDEC::sendData()
 {
-       if (_source_group->containsMyRank())
-               {
-    
-                       _interpolation_matrix->multiply(*_local_field->getField());
-                       if (getForcedRenormalization())
-                               renormalizeTargetField();
-               
-               }
-       else if (_target_group->containsMyRank())
-               _interpolation_matrix->transposeMultiply(*_local_field->getField());
+  if (_source_group->containsMyRank())
+  {
+
+    _interpolation_matrix->multiply(*_local_field->getField());
+    if (getForcedRenormalization())
+      renormalizeTargetField();
+
+  }
+  else if (_target_group->containsMyRank())
+    _interpolation_matrix->transposeMultiply(*_local_field->getField());
 }
 
-       /*!
-               Sends the data available at time \a time in asynchronous mode. 
+/*!
+  Sends the data available at time \a time in asynchronous mode. 
                \param time time at which the value is available
                \param deltatime time interval between the value presently sent and the next one. 
-       */
-
+*/
 
 void IntersectionDEC::sendData( double time , double deltatime )
 {
index 15f99ac30a23bde1519d0ce3973ed39337566420..68e72fb2e862a8c4a40c6c2b551a09d649538b57 100644 (file)
@@ -18,203 +18,203 @@ namespace ParaMEDMEM
 
 ParaMESH::ParaMESH(MEDMEM::driverTypes driver_type, const string& filename, 
        const ProcessorGroup& group)
-throw (MEDMEM::MEDEXCEPTION) :_has_mesh_ownership(true) {
-
+throw (MEDMEM::MEDEXCEPTION) :_has_mesh_ownership(true)
+{
   const char* LOC = "MEDSPLITTER::MESHCollectionDriver::read()";
   BEGIN_OF(LOC);
-  
+
+
   string meshstring;
   char file[256];
   char meshname[MED_TAILLE_NOM];
   int domain_id=group.myRank();
-  
+
   // reading ascii master file
   try{
-       MESSAGE("Start reading");
+    MESSAGE("Start reading");
     ifstream asciiinput(filename.c_str());
     char charbuffer[512];
     asciiinput.getline(charbuffer,512);
-    
+
     while (charbuffer[0]=='#')
-      {
-       asciiinput.getline(charbuffer,512);
-     }
+    {
+      asciiinput.getline(charbuffer,512);
+    }
 
     //reading number of domains
     int nbdomain=atoi(charbuffer);
     cout << "nb domain"<<nbdomain<<endl;
     //    asciiinput>>nbdomain;
-   
+
     string mesh;
-       int idomain;
-       string host;
-       string medfilename;
-  
+    int idomain;
+    string host;
+    string medfilename;
+
     for (int i=0; i<=domain_id;i++)
+    {
+      //reading information about the domain
+
+
+      asciiinput >> mesh >> idomain >> meshstring >> host >> medfilename;
+
+      if (idomain!=i+1)
       {
-       //reading information about the domain
-               
-      
-               asciiinput >> mesh >> idomain >> meshstring >> host >> medfilename;
-               
-               if (idomain!=i+1)
-                 {
-                   cerr<<"Error : domain must be written from 1 to N in asciifile descriptor"<<endl;
-                       throw (MEDEXCEPTION("Error : domain must be written from 1 to N in asciifile descriptor"));
-                 }
-               strcpy(meshname,meshstring.c_str());
-               strcpy(file,medfilename.c_str());
+        cerr<<"Error : domain must be written from 1 to N in asciifile descriptor"<<endl;
+        throw (MEDEXCEPTION("Error : domain must be written from 1 to N in asciifile descriptor"));
       }
+      strcpy(meshname,meshstring.c_str());
+      strcpy(file,medfilename.c_str());
+    }
     _name=meshstring;
-       ///////////////////////////////////////////
-       // treatment of the domain that corresponds
-       // to the local id
-       ///////////////////////////////////////////
-       _mesh=new MEDMEM::MESH(driver_type,file, meshname);
-               
-       //reading MEDSPLITTER::CONNECTZONEs NODE/NODE and CELL/CELL
-       med_2_3::med_idt fid = med_2_3::MEDouvrir(file,med_2_3::MED_LECTURE);
-       med_2_3::med_int njoint = med_2_3::MEDnJoint(fid, meshname);
-       for (int ijoint=1; ijoint<=njoint; ijoint++)
-       {
-               int distant;
-               char joint_description[MED_TAILLE_DESC];
-           char name[MED_TAILLE_NOM];
-           char name_distant[MED_TAILLE_NOM];
-           // cout << "arguments"<< fid<<" "<<file<<" "<<ijoint<<" "<<name<<" "<<joint_description<<" "<<distant<<" "<<name_distant<<endl;
-           int ncorr = med_2_3::MEDjointInfo(fid,meshname, ijoint, name, 
-               joint_description,
-                      &distant, name_distant);
-               cout << "Found " << ncorr <<"correspondances in joint "<<ijoint<<endl;
-
-       for (int ic=1; ic<=ncorr; ic++)
-           {
-             med_2_3::med_entite_maillage cor_typent_local;
-             med_2_3::med_geometrie_element cor_typgeo_local;
-             med_2_3::med_entite_maillage cor_typent_dist;
-             med_2_3::med_geometrie_element cor_typgeo_dist;
-         
-          
-             int ncouples;
-             ncouples = med_2_3::MEDjointTypeCorres(fid, meshname, name, ic,
-                                           &cor_typent_local,  &cor_typgeo_local,
-                                           &cor_typent_dist, &cor_typgeo_dist
-                                           );
-             int* node_corresp=new int[ncouples];
-             if (cor_typent_local == med_2_3::MED_NOEUD && cor_typent_dist == med_2_3::MED_NOEUD)
-                       {
-         
-                         med_2_3::MEDjointLire(fid, meshname, name,
-                      node_corresp,ncouples,
-                      cor_typent_local,  cor_typgeo_local,
-                      cor_typent_dist, cor_typgeo_dist
-                      );
-                       }
-                       //constructing the connect zone and adding it to the connect zone list
-                       MEDMEM::CONNECTZONE* cz = new MEDMEM::CONNECTZONE();
-                       cz->setName(string(name));
-                       cz->setDescription(joint_description);
-                       cz->setLocalDomainNumber(domain_id);
-                       cz->setDistantDomainNumber(distant);
-                       //cz->setLocalMesh((m_collection->getMesh())[i]);
-                       //cz->setDistantMesh((m_collection->getMesh())[distant]);
-                       cz->setNodeCorresp(node_corresp,ncouples);
-                       _connect_zone.push_back(cz);
-                       
-           }//loop on correspondances
-       }//loop on joints       
-       
-       //
-       // Reading global numbering
-       // 
-       int ncell=_mesh->getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS);
-       int * array=new int[ncell];
-       int offset=0;
-       MESSAGE("Reading cell global numbering for mesh "<< domain_id);
-       MED_EN::MESH_ENTITIES::const_iterator currentEntity;
-       list<MED_EN::medGeometryElement>::const_iterator iter;
-       currentEntity  = MED_EN::meshEntities.find(MED_EN::MED_CELL);
-       char meshchar[MED_TAILLE_NOM];
-       strcpy(meshchar,_mesh->getName().c_str());
-       for (iter = (*currentEntity).second.begin();iter != (*currentEntity).second.end(); iter++)
-       {
-               MED_EN::medGeometryElement type=*iter;
-               if (type/100 != _mesh->getMeshDimension()) continue;
-               int ntype = _mesh->getNumberOfElements(MED_EN::MED_CELL,type);
-               if (ntype==0) continue;
-               med_2_3::MEDglobalNumLire(fid,meshname, array+offset, ntype,
-               med_2_3::MED_MAILLE, (med_2_3::med_geometrie_element)type);
-        offset+=ntype;
-       }
-       _cellglobal=array;
-       
-       MESSAGE("Reading node global numbering");
-       int nnode= _mesh->getNumberOfNodes();
-       array=new int[nnode];
-       med_2_3::MEDglobalNumLire(fid,meshname, array, nnode,
-                       med_2_3::MED_NOEUD, med_2_3::MED_POINT1); 
-       _nodeglobal=array;
-       
-       MESSAGE("Reading face global numbering for mesh "<<domain_id);
-       int nbface=_mesh->getNumberOfElements(MED_EN::MED_FACE,MED_EN::MED_ALL_ELEMENTS);
-       array=new int[nbface];
-       currentEntity  = MED_EN::meshEntities.find(MED_EN::MED_FACE);
-       offset=0;
-       for (iter = (*currentEntity).second.begin();iter != (*currentEntity).second.end(); iter++)
-       {
-               MED_EN::medGeometryElement type=*iter;
-               if (type/100 != _mesh->getMeshDimension()-1) continue;
-               int ntype = _mesh->getNumberOfElements(MED_EN::MED_FACE,type);
-               if (ntype==0) continue;
-               med_2_3::MEDglobalNumLire(fid,meshname, array+offset, ntype,
-               med_2_3::MED_FACE, (med_2_3::med_geometrie_element)type);
-        offset+=ntype;
-       }
-       _faceglobal=array;
-//             faceglobal[i]=0;
+    ///////////////////////////////////////////
+    // treatment of the domain that corresponds
+    // to the local id
+    ///////////////////////////////////////////
+    _mesh=new MEDMEM::MESH(driver_type,file, meshname);
+
+    //reading MEDSPLITTER::CONNECTZONEs NODE/NODE and CELL/CELL
+    med_2_3::med_idt fid = med_2_3::MEDouvrir(file,med_2_3::MED_LECTURE);
+    med_2_3::med_int njoint = med_2_3::MEDnJoint(fid, meshname);
+    for (int ijoint=1; ijoint<=njoint; ijoint++)
+    {
+      int distant;
+      char joint_description[MED_TAILLE_DESC];
+      char name[MED_TAILLE_NOM];
+      char name_distant[MED_TAILLE_NOM];
+      // cout << "arguments"<< fid<<" "<<file<<" "<<ijoint<<" "<<name<<" "<<joint_description<<" "<<distant<<" "<<name_distant<<endl;
+      int ncorr = med_2_3::MEDjointInfo(fid,meshname, ijoint, name, 
+                                        joint_description,
+                                        &distant, name_distant);
+      cout << "Found " << ncorr <<"correspondances in joint "<<ijoint<<endl;
+
+      for (int ic=1; ic<=ncorr; ic++)
+      {
+        med_2_3::med_entite_maillage cor_typent_local;
+        med_2_3::med_geometrie_element cor_typgeo_local;
+        med_2_3::med_entite_maillage cor_typent_dist;
+        med_2_3::med_geometrie_element cor_typgeo_dist;
+
+
+        int ncouples;
+        ncouples = med_2_3::MEDjointTypeCorres(fid, meshname, name, ic,
+                                               &cor_typent_local,  &cor_typgeo_local,
+                                               &cor_typent_dist, &cor_typgeo_dist
+                                               );
+        int* node_corresp=new int[ncouples];
+        if (cor_typent_local == med_2_3::MED_NOEUD && cor_typent_dist == med_2_3::MED_NOEUD)
+        {
+
+          med_2_3::MEDjointLire(fid, meshname, name,
+                                node_corresp,ncouples,
+                                cor_typent_local,  cor_typgeo_local,
+                                cor_typent_dist, cor_typgeo_dist
+                                );
+        }
+        //constructing the connect zone and adding it to the connect zone list
+        MEDMEM::CONNECTZONE* cz = new MEDMEM::CONNECTZONE();
+        cz->setName(string(name));
+        cz->setDescription(joint_description);
+        cz->setLocalDomainNumber(domain_id);
+        cz->setDistantDomainNumber(distant);
+        //cz->setLocalMesh((m_collection->getMesh())[i]);
+        //cz->setDistantMesh((m_collection->getMesh())[distant]);
+        cz->setNodeCorresp(node_corresp,ncouples);
+        _connect_zone.push_back(cz);
+
+      }//loop on correspondances
+    }//loop on joints   
+
+    //
+    // Reading global numbering
+    // 
+    int ncell=_mesh->getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS);
+    int * array=new int[ncell];
+    int offset=0;
+    MESSAGE("Reading cell global numbering for mesh "<< domain_id);
+    MED_EN::MESH_ENTITIES::const_iterator currentEntity;
+    list<MED_EN::medGeometryElement>::const_iterator iter;
+    currentEntity  = MED_EN::meshEntities.find(MED_EN::MED_CELL);
+    char meshchar[MED_TAILLE_NOM];
+    strcpy(meshchar,_mesh->getName().c_str());
+    for (iter = (*currentEntity).second.begin();iter != (*currentEntity).second.end(); iter++)
+    {
+      MED_EN::medGeometryElement type=*iter;
+      if (type/100 != _mesh->getMeshDimension()) continue;
+      int ntype = _mesh->getNumberOfElements(MED_EN::MED_CELL,type);
+      if (ntype==0) continue;
+      med_2_3::MEDglobalNumLire(fid,meshname, array+offset, ntype,
+                                med_2_3::MED_MAILLE, (med_2_3::med_geometrie_element)type);
+      offset+=ntype;
+    }
+    _cellglobal=array;
+
+    MESSAGE("Reading node global numbering");
+    int nnode= _mesh->getNumberOfNodes();
+    array=new int[nnode];
+    med_2_3::MEDglobalNumLire(fid,meshname, array, nnode,
+                              med_2_3::MED_NOEUD, med_2_3::MED_POINT1); 
+    _nodeglobal=array;
+
+    MESSAGE("Reading face global numbering for mesh "<<domain_id);
+    int nbface=_mesh->getNumberOfElements(MED_EN::MED_FACE,MED_EN::MED_ALL_ELEMENTS);
+    array=new int[nbface];
+    currentEntity  = MED_EN::meshEntities.find(MED_EN::MED_FACE);
+    offset=0;
+    for (iter = (*currentEntity).second.begin();iter != (*currentEntity).second.end(); iter++)
+    {
+      MED_EN::medGeometryElement type=*iter;
+      if (type/100 != _mesh->getMeshDimension()-1) continue;
+      int ntype = _mesh->getNumberOfElements(MED_EN::MED_FACE,type);
+      if (ntype==0) continue;
+      med_2_3::MEDglobalNumLire(fid,meshname, array+offset, ntype,
+                                med_2_3::MED_FACE, (med_2_3::med_geometrie_element)type);
+      offset+=ntype;
+    }
+    _faceglobal=array;
+    //          faceglobal[i]=0;
     med_2_3::MEDfermer(fid);
-       
+
     _block_topology=new BlockTopology(group,ncell); 
-  
-     MESSAGE("end of read");
-      
+
+    MESSAGE("end of read");
+
   }//of try
   catch(...)
-    {
-      cerr << "I/O error reading parallel MED file"<<endl;
-      throw;
-    }
-   
-  
+  {
+    cerr << "I/O error reading parallel MED file"<<endl;
+    throw;
+  }
+
+
   //creation of topology from mesh and connect zones
   //m_collection->setTopology(
-  //   new ParallelTopology((m_collection->getMesh()),(m_collection->getCZ()),cellglobal,nodeglobal,faceglobal)
-   // );
-    
-    END_OF("MEDSPLITTER::MESHCollectionDriver::read()")
-};
+  //    new ParallelTopology((m_collection->getMesh()),(m_collection->getCZ()),cellglobal,nodeglobal,faceglobal)
+  // );
+
+  END_OF(LOC);
+}
 
 /*! Constructor for creating a ParaMESH from a local mesh and
  * a processor group. Constructor must be called by all the processors
  * in the group. */
 
 ParaMESH::ParaMESH(MEDMEM::MESH& subdomain_mesh, const ProcessorGroup& proc_group, const string& name):
-_mesh(&subdomain_mesh),
-_my_domain_id(proc_group.myRank()),
-_block_topology (new BlockTopology(proc_group, subdomain_mesh.getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS))),
-_has_mesh_ownership(false)
+  _mesh(&subdomain_mesh),
+  _my_domain_id(proc_group.myRank()),
+  _block_topology (new BlockTopology(proc_group, subdomain_mesh.getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS))),
+  _has_mesh_ownership(false)
 {
-       ostringstream stream;
-       stream<<name<<"_"<<_my_domain_id+1;
-       _name=stream.str();
+  ostringstream stream;
+  stream<<name<<"_"<<_my_domain_id+1;
+  _name=stream.str();
 
   _cellglobal = new int[subdomain_mesh.getNumberOfElements(MED_EN::MED_CELL, MED_EN::MED_ALL_ELEMENTS)];
   int offset = _block_topology->localToGlobal(make_pair(_my_domain_id,0));
   for (int i=0; i<subdomain_mesh.getNumberOfElements(MED_EN::MED_CELL, MED_EN::MED_ALL_ELEMENTS); i++)
-    {
-      _cellglobal[i]=offset+i;
-    }
+  {
+    _cellglobal[i]=offset+i;
+  }
 }
 
 
@@ -233,73 +233,73 @@ ParaMESH::~ParaMESH()
  */
  
 void ParaMESH::write(MEDMEM::driverTypes driverType, const string& master_filename)
-throw (MEDMEM::MEDEXCEPTION){
-       
+throw (MEDMEM::MEDEXCEPTION)
+{
   const char* LOC = "ParaMEDMEM::ParaMESH::write()";
   BEGIN_OF(LOC);
-        
-       if (!_block_topology->getProcGroup()->containsMyRank()) return;
-        
-       int myrank=_block_topology->getProcGroup()->myRank();
-       cout << "Myrank in write " << myrank<<endl;
-       
-       int nbdomains= _block_topology->getProcGroup()->size(); 
-       vector<string> filename(nbdomains);
-                               
-       //loop on the domains
-       for (int i=0; i<nbdomains;i++)
-       {
-               char distfilename[256];
-       
-               ostringstream suffix;
-               
-               suffix << master_filename<< i+1 <<".med";
-               
-               strcpy(distfilename,suffix.str().c_str());
-               filename[i]=string(distfilename);
-               MESSAGE("File name "<<string(distfilename));
-       }       
-       
-       //creation of the master file by proc 0 on ProgGroup    
-       if (myrank==0)
-       {
-               MESSAGE("Master File Name "<<master_filename);
-               ofstream file(master_filename.c_str());
-               if (!file) throw (MEDEXCEPTION("Unable to create master file"));
-               file <<"#MED Fichier V 2.3"<<" "<<endl;
-               file <<"#"<<" "<<endl;
-               file<<nbdomains<<" "<<endl;
-               for (int i=0; i<nbdomains;i++)
-               {
-                       //updating the ascii description file
-                 file << _name <<" "<< i+1 << " "<< _name <<"_"<<i+1<< " localhost " << filename[i] << " "<<endl;
-               }
-               
-       }
-               
-       int id=_mesh->addDriver(MEDMEM::MED_DRIVER,filename[myrank],_name);
-               
-       MESSAGE("Start writing");
-       _mesh->write(id);
-       _mesh->rmDriver(id);            
-       END_OF("ParaMEDMEM::ParaMESH::write()");
+
+  if (!_block_topology->getProcGroup()->containsMyRank()) return;
+
+  int myrank=_block_topology->getProcGroup()->myRank();
+  cout << "Myrank in write " << myrank<<endl;
+
+  int nbdomains= _block_topology->getProcGroup()->size();       
+  vector<string> filename(nbdomains);
+
+  //loop on the domains
+  for (int i=0; i<nbdomains;i++)
+  {
+    char distfilename[256];
+
+    ostringstream suffix;
+
+    suffix << master_filename<< i+1 <<".med";
+
+    strcpy(distfilename,suffix.str().c_str());
+    filename[i]=string(distfilename);
+    MESSAGE("File name "<<string(distfilename));
+  }     
+
+  //creation of the master file by proc 0 on ProgGroup  
+  if (myrank==0)
+  {
+    MESSAGE("Master File Name "<<master_filename);
+    ofstream file(master_filename.c_str());
+    if (!file) throw (MEDEXCEPTION("Unable to create master file"));
+    file <<"#MED Fichier V 2.3"<<" "<<endl;
+    file <<"#"<<" "<<endl;
+    file<<nbdomains<<" "<<endl;
+    for (int i=0; i<nbdomains;i++)
+    {
+      //updating the ascii description file
+      file << _name <<" "<< i+1 << " "<< _name <<"_"<<i+1<< " localhost " << filename[i] << " "<<endl;
+    }
+
+  }
+
+  int id=_mesh->addDriver(MEDMEM::MED_DRIVER,filename[myrank],_name);
+
+  MESSAGE("Start writing");
+  _mesh->write(id);
+  _mesh->rmDriver(id);          
+  END_OF(LOC);
 };
 
 const int* ParaMESH::getGlobalNumbering(const MED_EN::medEntityMesh entity)const
 {
-       switch (entity)
-       {
-               case MED_CELL:
-                       return _cellglobal;
-               case MED_FACE :
-                       return _faceglobal;
-               case MED_EDGE :
-                       return _edgeglobal;
-               case MED_NODE:
-                       return _nodeglobal;
-    default :
-      return 0;
-       }
+  switch (entity)
+  {
+  case MED_CELL:
+    return _cellglobal;
+  case MED_FACE :
+    return _faceglobal;
+  case MED_EDGE :
+    return _edgeglobal;
+  case MED_NODE:
+    return _nodeglobal;
+  default :
+    return 0;
+  }
 }      
        
 }
index 1fd303b7b7e69d0a5d7db491a1d9226d4a34fe18..40b68710f6f89d711ee8a80f24f0f92b4afad7b4 100644 (file)
@@ -18,8 +18,8 @@ class ParaMESH
 {
 public:
        ParaMESH(MEDMEM::driverTypes driver_type, const std::string& file_name, 
-               const ProcessorGroup& group)
-       throw (MEDMEM::MEDEXCEPTION);
+                 const ProcessorGroup& group)
+          throw (MEDMEM::MEDEXCEPTION);
   ParaMESH(MEDMEM::MESH& subdomain_mesh, const ProcessorGroup& proc_group, const string& name);
        void write(MEDMEM::driverTypes driverType, const std::string& fileName="")
        throw (MEDMEM::MEDEXCEPTION);
index f2e94f0facfb4602342d87d45c7161a07ee93764..f1687443cab05e66220e6890c5713a1b57bc1d7e 100644 (file)
@@ -8,35 +8,35 @@ namespace ParaMEDMEM
   ParaSUPPORT::ParaSUPPORT()
   {
   }
-  
+
   ParaSUPPORT::ParaSUPPORT(const MEDMEM::SUPPORT& support, const ProcessorGroup& proc_group):
-  _support(&support), 
-  _has_support_ownership(false),
-  _has_mesh_ownership(true)
-   {
+    _support(&support), 
+    _has_support_ownership(false),
+    _has_mesh_ownership(true)
+  {
     _mesh = new ParaMESH(*(support.getMesh()),  proc_group, "mesh from support");
   } 
 
   ParaSUPPORT::~ParaSUPPORT()
   {
-               if (_has_support_ownership)
-                       {
-                               delete _support;
-                               _support=0;
-                       }
+    if (_has_support_ownership)
+    {
+      delete _support;
+      _support=0;
+    }
     if (_has_mesh_ownership)
-                       {
-                               delete _mesh;
-                               _mesh=0;
-                       }
+    {
+      delete _mesh;
+      _mesh=0;
+    }
   }
 
-       const int* ParaSUPPORT::getGlobalNumbering() const
-       {
-               if (! _support->isOnAllElements())
-                       throw MEDMEM::MEDEXCEPTION("GlobalNumbering can only be retrieved on supports on all elements");
-               return _mesh->getGlobalNumbering(_support->getEntity());
-       }
+  const int* ParaSUPPORT::getGlobalNumbering() const
+  {
+    if (! _support->isOnAllElements())
+      throw MEDMEM::MEDEXCEPTION("GlobalNumbering can only be retrieved on supports on all elements");
+    return _mesh->getGlobalNumbering(_support->getEntity());
+  }
 
 }