From: vbd Date: Wed, 1 Aug 2007 06:36:14 +0000 (+0000) Subject: suppressing source and trget field by local field X-Git-Tag: trio_trio_coupling~91 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=95e673243bb57aa0029c4699512b826531d1ae5e;p=tools%2Fmedcoupling.git suppressing source and trget field by local field --- diff --git a/src/ParaMEDMEM/DEC.cxx b/src/ParaMEDMEM/DEC.cxx index b702ec21b..1bcf37d16 100644 --- a/src/ParaMEDMEM/DEC.cxx +++ b/src/ParaMEDMEM/DEC.cxx @@ -13,11 +13,10 @@ 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(field->getTopology()); _comm_interface=&(field->getTopology()->getProcGroup()->getCommInterface()); //} } -void DEC::attachSourceField(const ParaFIELD* field) -{ - _source_field=field; - //if (field!=0) - //{ - // BlockTopology* topo=dynamic_cast(field->getTopology()); - _comm_interface=&(field->getTopology()->getProcGroup()->getCommInterface()); - //} -} + } diff --git a/src/ParaMEDMEM/DEC.hxx b/src/ParaMEDMEM/DEC.hxx index 5f6a8b8fe..b4a83de1a 100644 --- a/src/ParaMEDMEM/DEC.hxx +++ b/src/ParaMEDMEM/DEC.hxx @@ -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; diff --git a/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx b/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx index e9ca495ef..e5b3632a8 100644 --- a/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx +++ b/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx @@ -24,15 +24,15 @@ ExplicitCoincidentDEC::~ExplicitCoincidentDEC() */ void ExplicitCoincidentDEC::synchronize() { - if (_source_field!=0) + if (_source_group->containsMyRank()) { - _toposource = dynamic_cast(_source_field->getTopology()); + _toposource = dynamic_cast(_local_field->getTopology()); _sourcegroup= _toposource->getProcGroup()->createProcGroup(); _targetgroup=_toposource->getProcGroup()->createComplementProcGroup(); } - if (_target_field!=0) + if (_target_group->containsMyRank()) { - _topotarget = dynamic_cast(_target_field->getTopology()); + _topotarget = dynamic_cast(_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() diff --git a/src/ParaMEDMEM/ParaFIELD.cxx b/src/ParaMEDMEM/ParaFIELD.cxx index 50b4988bc..3a195d114 100644 --- a/src/ParaMEDMEM/ParaFIELD.cxx +++ b/src/ParaMEDMEM/ParaFIELD.cxx @@ -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(); diff --git a/src/ParaMEDMEM/StructuredCoincidentDEC.cxx b/src/ParaMEDMEM/StructuredCoincidentDEC.cxx index 881fca22a..f59b17e81 100644 --- a/src/ParaMEDMEM/StructuredCoincidentDEC.cxx +++ b/src/ParaMEDMEM/StructuredCoincidentDEC.cxx @@ -24,10 +24,10 @@ StructuredCoincidentDEC::~StructuredCoincidentDEC() */ void StructuredCoincidentDEC::synchronize() { - if (_source_field!=0) - _toposource = dynamic_cast(_source_field->getTopology()); - if (_target_field!=0) - _topotarget = dynamic_cast(_target_field->getTopology()); + if (_source_group->containsMyRank()) + _toposource = dynamic_cast(_local_field->getTopology()); + if (_target_group->containsMyRank()) + _topotarget = dynamic_cast(_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<getField()->setValue(value); + _local_field->getField()->setValue(value); } void StructuredCoincidentDEC::sendData()