]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
suppressing source and trget field by local field
authorvbd <vbd>
Wed, 1 Aug 2007 06:36:14 +0000 (06:36 +0000)
committervbd <vbd>
Wed, 1 Aug 2007 06:36:14 +0000 (06:36 +0000)
src/ParaMEDMEM/DEC.cxx
src/ParaMEDMEM/DEC.hxx
src/ParaMEDMEM/ExplicitCoincidentDEC.cxx
src/ParaMEDMEM/ParaFIELD.cxx
src/ParaMEDMEM/StructuredCoincidentDEC.cxx

index b702ec21bfd5b6232d7377299f880cd9122e8a7f..1bcf37d1645275e27c6bbc308b06c4db8ced59c4 100644 (file)
 namespace ParaMEDMEM
 {
   
-  DEC::DEC(ProcessorGroup& local_group, ProcessorGroup& distant_group):_source_field(0),_target_field(0), 
-  _source_group(&local_group), _target_group(&distant_group)
+  DEC::DEC(ProcessorGroup& source_group, ProcessorGroup& target_group):_local_field(0), 
+  _source_group(&source_group), _target_group(&target_group)
   {
-    
-    _union_group = local_group.fuse(distant_group);  
+    _union_group = source_group.fuse(target_group);  
   }
 
   DEC::~DEC()
@@ -25,22 +24,14 @@ namespace ParaMEDMEM
     delete _union_group;
   }  
 
-void DEC::attachTargetField(const ParaFIELD* field) 
+void DEC::attachLocalField(const ParaFIELD* field) 
 {
-  _target_field=field;
+  _local_field=field;
   //if (field!=0)
   //{
   //BlockTopology* topo=dynamic_cast<BlockTopology*>(field->getTopology());
   _comm_interface=&(field->getTopology()->getProcGroup()->getCommInterface());
   //}
 }
-void DEC::attachSourceField(const ParaFIELD* field) 
-{
-  _source_field=field;
-  //if (field!=0)
-  //{
-  //   BlockTopology* topo=dynamic_cast<BlockTopology*>(field->getTopology());
-  _comm_interface=&(field->getTopology()->getProcGroup()->getCommInterface());
-  //}
-}
+
 }
index 5f6a8b8febca5411149e8b3a7feec95c03b1bb6f..b4a83de1adbd27ef73383b827df0f4b7204723c0 100644 (file)
@@ -9,10 +9,9 @@ class CommInterface;
 class DEC
 {
 public:
-       DEC():_source_field(0),_target_field(0){}
+       DEC():_local_field(0){}
   DEC(ProcessorGroup& local_group, ProcessorGroup& distant_group); 
-       void attachTargetField(const ParaFIELD* field);
-       void attachSourceField(const ParaFIELD* field) ;
+       void attachLocalField(const ParaFIELD* field);
        virtual void prepareSourceDE()=0;
        virtual void prepareTargetDE()=0;
        virtual void recvData()=0;
@@ -21,8 +20,7 @@ public:
   virtual ~DEC();
        virtual void computeProcGroup(){};
 protected:
-       const ParaFIELD* _source_field;
-       const ParaFIELD* _target_field;
+       const ParaFIELD* _local_field;
        //! Processor group representing the union of target and source processors
        ProcessorGroup* _union_group;
   ProcessorGroup* _source_group;
index e9ca495ef50d54946fe34a3240062c12fc1b3d8f..e5b3632a8cf55aef69310cc3671d1aaea9c24a6d 100644 (file)
@@ -24,15 +24,15 @@ ExplicitCoincidentDEC::~ExplicitCoincidentDEC()
  */
 void ExplicitCoincidentDEC::synchronize()
 {
-  if (_source_field!=0)
+  if (_source_group->containsMyRank())
     {
-      _toposource = dynamic_cast<ExplicitTopology*>(_source_field->getTopology());
+      _toposource = dynamic_cast<ExplicitTopology*>(_local_field->getTopology());
       _sourcegroup= _toposource->getProcGroup()->createProcGroup();
       _targetgroup=_toposource->getProcGroup()->createComplementProcGroup();
     }
-  if (_target_field!=0)
+  if (_target_group->containsMyRank())
     {
-      _topotarget = dynamic_cast<ExplicitTopology*>(_target_field->getTopology());
+      _topotarget = dynamic_cast<ExplicitTopology*>(_local_field->getTopology());
       _sourcegroup= _topotarget->getProcGroup()->createComplementProcGroup();
       _targetgroup=_topotarget->getProcGroup()->createProcGroup();
     }
@@ -106,7 +106,7 @@ void ExplicitCoincidentDEC::prepareSourceDE()
     counter[i]=counter[i-1]+target_arrays[i-1].size();
   
   
-  const double* value = _source_field->getField()->getValue();
+  const double* value = _local_field->getField()->getValue();
   
   int* bufferindex= _explicit_mapping.getBufferIndex();
   
@@ -361,7 +361,7 @@ void ExplicitCoincidentDEC::recvData()
            value[ielem*ncomp+icomp]=_recvbuffer[counters[iproc]*ncomp+icomp];
          counters[iproc]++;
        }       
-       _target_field->getField()->setValue(value);
+       _local_field->getField()->setValue(value);
 }
 
 void ExplicitCoincidentDEC::sendData()
index 50b4988bc429d9cf263bf68651408136f950ebaf..3a195d1143d83ee3dec8eb4f41a7daef6f4ec2ff 100644 (file)
@@ -122,7 +122,7 @@ void ParaFIELD::synchronizeTarget(ParaFIELD* source_field){
        {
                data_channel=new ExplicitCoincidentDEC();
        }
-       data_channel->attachTargetField(this);
+       data_channel->attachLocalField(this);
        data_channel->synchronize();
        data_channel->prepareTargetDE();
        data_channel->recvData();
@@ -140,7 +140,7 @@ void ParaFIELD::synchronizeSource(ParaFIELD* target_field){
        {
                data_channel=new ExplicitCoincidentDEC();
        }
-       data_channel->attachSourceField(this);
+       data_channel->attachLocalField(this);
        data_channel->synchronize();
        data_channel->prepareSourceDE();
        data_channel->sendData();
index 881fca22afef94eda3a588d18db8ad1d8ddfbf78..f59b17e81e98086290396e99fb3d0cfc26a22773 100644 (file)
@@ -24,10 +24,10 @@ StructuredCoincidentDEC::~StructuredCoincidentDEC()
  */
 void StructuredCoincidentDEC::synchronize()
 {
-       if (_source_field!=0)
-               _toposource = dynamic_cast<BlockTopology*>(_source_field->getTopology());
-       if (_target_field!=0)
-               _topotarget = dynamic_cast<BlockTopology*>(_target_field->getTopology());
+       if (_source_group->containsMyRank())
+               _toposource = dynamic_cast<BlockTopology*>(_local_field->getTopology());
+       if (_target_group->containsMyRank())
+               _topotarget = dynamic_cast<BlockTopology*>(_local_field->getTopology());
        
        // Transmitting source topology to target code 
        broadcastTopology(_toposource,1000);
@@ -102,7 +102,7 @@ void StructuredCoincidentDEC::prepareSourceDE()
                counter[i]=counter[i-1]+target_arrays[i-1].size();
                
                        
-       const double* value = _source_field->getField()->getValue();
+       const double* value = _local_field->getField()->getValue();
        //cout << "Nb local " << nb_local<<endl;
        for (int ielem=0; ielem<nb_local ; ielem++)
        {
@@ -268,7 +268,7 @@ void StructuredCoincidentDEC::recvData()
        }
        
        
-       _target_field->getField()->setValue(value);
+       _local_field->getField()->setValue(value);
 }
 
 void StructuredCoincidentDEC::sendData()