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()
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());
- //}
-}
+
}
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;
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;
*/
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();
}
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();
value[ielem*ncomp+icomp]=_recvbuffer[counters[iproc]*ncomp+icomp];
counters[iproc]++;
}
- _target_field->getField()->setValue(value);
+ _local_field->getField()->setValue(value);
}
void ExplicitCoincidentDEC::sendData()
{
data_channel=new ExplicitCoincidentDEC();
}
- data_channel->attachTargetField(this);
+ data_channel->attachLocalField(this);
data_channel->synchronize();
data_channel->prepareTargetDE();
data_channel->recvData();
{
data_channel=new ExplicitCoincidentDEC();
}
- data_channel->attachSourceField(this);
+ data_channel->attachLocalField(this);
data_channel->synchronize();
data_channel->prepareSourceDE();
data_channel->sendData();
*/
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);
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++)
{
}
- _target_field->getField()->setValue(value);
+ _local_field->getField()->setValue(value);
}
void StructuredCoincidentDEC::sendData()