From 38d8d61e20ebfc4d863293669948957058d5d61b Mon Sep 17 00:00:00 2001 From: ageay Date: Mon, 28 Jun 2010 12:58:44 +0000 Subject: [PATCH] API change of DECs constructors. --- src/ParaMEDMEM/DEC.cxx | 19 ++++++++----------- src/ParaMEDMEM/DEC.hxx | 3 +-- src/ParaMEDMEM/InterpKernelDEC.cxx | 5 ++--- src/ParaMEDMEM/InterpKernelDEC.hxx | 3 +-- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/ParaMEDMEM/DEC.cxx b/src/ParaMEDMEM/DEC.cxx index 32bcc69ea..d8256bdc0 100644 --- a/src/ParaMEDMEM/DEC.cxx +++ b/src/ParaMEDMEM/DEC.cxx @@ -85,8 +85,7 @@ namespace ParaMEDMEM _union_group = source_group.fuse(target_group); } - DEC::DEC(const int *src_ids_bg, const int *src_ids_end, - const int *trg_ids_bg, const int *trg_ids_end, + DEC::DEC(const std::set& src_ids, const std::set& trg_ids, const MPI_Comm& world_comm):_local_field(0), _owns_field(false), _owns_groups(true), @@ -94,10 +93,10 @@ namespace ParaMEDMEM { ParaMEDMEM::CommInterface comm; // Create the list of procs including source and target - int nbOfProcsInComm=std::distance(src_ids_bg,src_ids_end)+std::distance(trg_ids_bg,trg_ids_end); + int nbOfProcsInComm=src_ids.size()+trg_ids.size(); int *allRanks=new int[nbOfProcsInComm]; - std::copy(src_ids_bg,src_ids_end,allRanks); - std::copy(trg_ids_bg,trg_ids_end,allRanks+std::distance(src_ids_bg,src_ids_end)); + std::copy(src_ids.begin(),src_ids.end(),allRanks); + std::copy(trg_ids.begin(),trg_ids.end(),allRanks+src_ids.size()); // Create a communicator on these procs MPI_Group src_trg_group, world_group; comm.commGroup(world_comm,&world_group); @@ -113,12 +112,10 @@ namespace ParaMEDMEM _union_group=0; return; } - std::set source_ids(src_ids_bg,src_ids_end); - _source_group=new MPIProcessorGroup(comm,source_ids,src_trg_comm); - std::set target_ids(trg_ids_bg,trg_ids_end); - _target_group=new MPIProcessorGroup(comm,target_ids,src_trg_comm); - std::set src_trg_ids(src_ids_bg,src_ids_end); - src_trg_ids.insert(trg_ids_bg,trg_ids_end); + _source_group=new MPIProcessorGroup(comm,src_ids,src_trg_comm); + _target_group=new MPIProcessorGroup(comm,trg_ids,src_trg_comm); + std::set src_trg_ids(src_ids); + src_trg_ids.insert(trg_ids.begin(),trg_ids.end()); _union_group=new MPIProcessorGroup(comm,src_trg_ids,src_trg_comm); } diff --git a/src/ParaMEDMEM/DEC.hxx b/src/ParaMEDMEM/DEC.hxx index e60825168..7054c2fd2 100644 --- a/src/ParaMEDMEM/DEC.hxx +++ b/src/ParaMEDMEM/DEC.hxx @@ -39,8 +39,7 @@ namespace ParaMEDMEM public: DEC():_local_field(0) { } DEC(ProcessorGroup& source_group, ProcessorGroup& target_group); - DEC(const int *src_ids_bg, const int *src_ids_end, - const int *trg_ids_bg, const int *trg_ids_end, + DEC(const std::set& src_ids, const std::set& trg_ids, const MPI_Comm& world_comm=MPI_COMM_WORLD); void setNature(NatureOfField nature); void attachLocalField( MEDCouplingFieldDouble* field); diff --git a/src/ParaMEDMEM/InterpKernelDEC.cxx b/src/ParaMEDMEM/InterpKernelDEC.cxx index 1eb5a243e..3545092bf 100644 --- a/src/ParaMEDMEM/InterpKernelDEC.cxx +++ b/src/ParaMEDMEM/InterpKernelDEC.cxx @@ -123,9 +123,8 @@ namespace ParaMEDMEM } - InterpKernelDEC::InterpKernelDEC(const int *src_ids_bg, const int *src_ids_end, - const int *trg_ids_bg, const int *trg_ids_end, - const MPI_Comm& world_comm):DEC(src_ids_bg,src_ids_end,trg_ids_bg,trg_ids_end,world_comm), + InterpKernelDEC::InterpKernelDEC(const std::set& src_ids, const std::set& trg_ids, + const MPI_Comm& world_comm):DEC(src_ids,trg_ids,world_comm), _interpolation_matrix(0) { } diff --git a/src/ParaMEDMEM/InterpKernelDEC.hxx b/src/ParaMEDMEM/InterpKernelDEC.hxx index 908f21700..7930a044d 100644 --- a/src/ParaMEDMEM/InterpKernelDEC.hxx +++ b/src/ParaMEDMEM/InterpKernelDEC.hxx @@ -33,8 +33,7 @@ namespace ParaMEDMEM public: InterpKernelDEC(); InterpKernelDEC(ProcessorGroup& source_group, ProcessorGroup& target_group); - InterpKernelDEC(const int *src_ids_bg, const int *src_ids_end, - const int *trg_ids_bg, const int *trg_ids_end, + InterpKernelDEC(const std::set& src_ids, const std::set& trg_ids, const MPI_Comm& world_comm=MPI_COMM_WORLD); virtual ~InterpKernelDEC(); void synchronize(); -- 2.39.2