#include "MPIProcessorGroup.hxx"
#include "ParaMESH.hxx"
#include "DEC.hxx"
-#include "InterpolationMatrix.hxx"
#include "InterpKernelDEC.hxx"
#include "ElementLocator.hxx"
namespace MEDCoupling
{
- InterpKernelDEC::InterpKernelDEC():
- DisjointDEC(),
- _interpolation_matrix(0)
+ InterpKernelDEC::InterpKernelDEC():_interpolation_matrix(nullptr)
{
}
*/
InterpKernelDEC::InterpKernelDEC(ProcessorGroup& source_group, ProcessorGroup& target_group):
- DisjointDEC(source_group, target_group),
- _interpolation_matrix(0)
+ DisjointDEC(source_group, target_group)
{
}
*/
InterpKernelDEC::InterpKernelDEC(const std::set<int>& src_ids, const std::set<int>& trg_ids,
const MPI_Comm& world_comm):
- DisjointDEC(src_ids,trg_ids,world_comm),
- _interpolation_matrix(0)
+ DisjointDEC(src_ids,trg_ids,world_comm)
{
}
void InterpKernelDEC::release()
{
- if (_interpolation_matrix != nullptr)
- delete _interpolation_matrix;
- _interpolation_matrix = nullptr;
+ _interpolation_matrix.reset(nullptr);
DisjointDEC::cleanInstance();
}
{
if(!isInUnion())
return ;
- delete _interpolation_matrix;
- _interpolation_matrix = new InterpolationMatrix (_local_field, *_source_group,*_target_group,*this,*this);
+ _interpolation_matrix.reset( new InterpolationMatrix (_local_field, *_source_group,*_target_group,*this,*this) );
//setting up the communication DEC on both sides
if (_source_group->containsMyRank())
#include "DisjointDEC.hxx"
#include "MxN_Mapping.hxx"
#include "InterpolationOptions.hxx"
+#include "InterpolationMatrix.hxx"
+
+#include <memory>
namespace MEDCoupling
{
- class InterpolationMatrix;
-
/*!
\anchor InterpKernelDEC-det
\class InterpKernelDEC
InterpKernelDEC();
InterpKernelDEC(ProcessorGroup& source_group, ProcessorGroup& target_group);
InterpKernelDEC(const std::set<int>& src_ids, const std::set<int>& trg_ids, const MPI_Comm& world_comm=MPI_COMM_WORLD);
+ InterpKernelDEC(InterpKernelDEC&& other) = default;
+ InterpKernelDEC& operator=(InterpKernelDEC&& other) = default;
virtual ~InterpKernelDEC();
void release();
MCAuto<DataArrayIdType> retrieveNonFetchedIdsSource() const;
MCAuto<DataArrayIdType> retrieveNonFetchedIdsTarget() const;
private:
- InterpolationMatrix* _interpolation_matrix;
+ std::unique_ptr<InterpolationMatrix> _interpolation_matrix;
};
}
namespace MEDCoupling
{
class ElementLocator;
+ class MEDCouplingPointSet;
/*!
Internal class, not part of the public API.
#include <iostream>
#include <set>
#include <algorithm>
+#include <memory>
#include "mpi.h"
using namespace std;
_comm_interface.commSize(_world_comm,&size);
for (int i=0; i<size; i++)
_proc_ids.insert(i);
-
}
/*! Creates a processor group that is based on the processors included in \a proc_ids.
_comm_interface.commRank(_world_comm,&rank_world);
_comm_interface.commGroup(_world_comm, &group_world);
- int* ranks=new int[_proc_ids.size()];
+ std::unique_ptr<int[]> ranks( new int[_proc_ids.size()] );
// copying proc_ids in ranks
- copy<set<int>::const_iterator,int*> (_proc_ids.begin(), _proc_ids.end(), ranks);
+ copy<set<int>::const_iterator,int*> (_proc_ids.begin(), _proc_ids.end(), ranks.get());
for (int i=0; i< (int)_proc_ids.size();i++)
if (ranks[i]>size_world-1)
{
- delete[] ranks;
_comm_interface.groupFree(&group_world); // MPI_Group is a C structure and won't get de-allocated automatically?
throw INTERP_KERNEL::Exception("invalid rank in set<int> argument of MPIProcessorGroup constructor");
}
- _comm_interface.groupIncl(group_world, (int)_proc_ids.size(), ranks, &_group);
+ _comm_interface.groupIncl(group_world, (int)_proc_ids.size(), ranks.get(), &_group);
_comm_interface.commCreate(_world_comm, _group, &_comm);
// clean-up
- delete[] ranks;
_comm_interface.groupFree(&group_world); // MPI_Group is a C structure and won't get de-allocated automatically?
}