%include "ComponentTopology.hxx"
%include "DEC.hxx"
%include "DisjointDEC.hxx"
-%include "InterpKernelDEC.hxx"
%include "StructuredCoincidentDEC.hxx"
-%include "OverlapDEC.hxx"
%newobject MEDCoupling::ParaUMesh::New;
%newobject MEDCoupling::ParaUMesh::getMesh;
%newobject MEDCoupling::ParaSkyLineArray::getSkyLineArray;
%newobject MEDCoupling::ParaSkyLineArray::getGlobalIdsArray;
+%newobject MEDCoupling::InterpKernelDEC::_NewWithComm_internal;
+%newobject MEDCoupling::OverlapDEC::_NewWithComm_internal;
+
%feature("unref") ParaSkyLineArray "$this->decrRef();"
%feature("unref") ParaUMesh "$this->decrRef();"
%feature("unref") ParaDataArrayInt32 "$this->decrRef();"
}
}
};
-}
-/* This object can be used only if MED_ENABLE_FVM is defined*/
-#ifdef MED_ENABLE_FVM
-class NonCoincidentDEC : public DEC
-{
-public:
- NonCoincidentDEC(ProcessorGroup& source, ProcessorGroup& target);
-};
-#endif
+ /* This object can be used only if MED_ENABLE_FVM is defined*/
+ #ifdef MED_ENABLE_FVM
+ class NonCoincidentDEC : public DEC
+ {
+ public:
+ NonCoincidentDEC(ProcessorGroup& source, ProcessorGroup& target);
+ };
+ #endif
+
+ class InterpKernelDEC : public DisjointDEC, public INTERP_KERNEL::InterpolationOptions
+ {
+ public:
+ InterpKernelDEC();
+ InterpKernelDEC(ProcessorGroup& source_group, ProcessorGroup& target_group);
+ virtual ~InterpKernelDEC();
+ void release();
+
+ void synchronize();
+ void recvData();
+ void recvData(double time);
+ void sendData();
+ void sendData(double time , double deltatime);
+ void prepareSourceDE();
+ void prepareTargetDE();
+
+ %extend {
+ // This one should really not be called directly by the user since it still has an interface with a pointer to MPI_Comm
+ // which Swig doesn't handle nicely.
+ // It is just here to provide a constructor taking a **pointer** to a comm - See pythoncode below.
+ static InterpKernelDEC* _NewWithComm_internal(const std::set<int>& src_ids, const std::set<int>& trg_ids, long another_comm)
+ {
+ return new InterpKernelDEC(src_ids,trg_ids, *(MPI_Comm*)another_comm); // I know, ugly cast ...
+ }
+ }
+ };
+
+ class OverlapDEC : public DEC, public INTERP_KERNEL::InterpolationOptions
+ {
+ public:
+ OverlapDEC(const std::set<int>& procIds);
+ virtual ~OverlapDEC();
+ void release();
+
+ void sendRecvData(bool way=true);
+ void sendData();
+ void recvData();
+ void synchronize();
+ void attachSourceLocalField(ParaFIELD *field, bool ownPt=false);
+ void attachTargetLocalField(ParaFIELD *field, bool ownPt=false);
+ void attachSourceLocalField(MEDCouplingFieldDouble *field);
+ void attachTargetLocalField(MEDCouplingFieldDouble *field);
+ void attachSourceLocalField(ICoCo::MEDDoubleField *field);
+ void attachTargetLocalField(ICoCo::MEDDoubleField *field);
+ ProcessorGroup *getGroup();
+ bool isInGroup() const;
+
+ void setDefaultValue(double val);
+ void setWorkSharingAlgo(int method);
+
+ void debugPrintWorkSharing(std::ostream & ostr) const;
+
+ %extend {
+ // This one should really not be called directly by the user since it still has an interface with a pointer to MPI_Comm
+ // which Swig doesn't handle nicely.
+ // It is just here to provide a constructor taking a **pointer** to a comm - See pythoncode below.
+ static OverlapDEC* _NewWithComm_internal(const std::set<int>& ids, long another_comm)
+ {
+ return new OverlapDEC(ids, *(MPI_Comm*)another_comm); // I know, ugly cast ...
+ }
+ }
+ };
+
+} // end namespace MEDCoupling
%extend MEDCoupling::ParaMESH
{
else:
ParaDataArrayInt = ParaDataArrayInt32
%}
+
+%pythoncode %{
+
+# And here we use mpi4py ability to provide its internal (C++) pointer to the communicator:
+def _InterpKernelDEC_WithComm_internal(src_procs, tgt_procs, mpicomm):
+ from mpi4py import MPI
+ return InterpKernelDEC._NewWithComm_internal(src_procs, tgt_procs, MPI._addressof(mpicomm))
+
+def _OverlapDEC_WithComm_internal(procs, mpicomm):
+ from mpi4py import MPI
+ return OverlapDEC._NewWithComm_internal(procs, MPI._addressof(mpicomm))
+
+InterpKernelDEC.NewWithCustomComm = _InterpKernelDEC_WithComm_internal
+OverlapDEC.NewWithCustomComm = _OverlapDEC_WithComm_internal
+
+%}