#include "InterpKernelException.hxx"
#include <vector>
+#include <algorithm>
namespace MEDCoupling
{
T *_ptr;
};
+ template<class T>
+ std::vector<const T*> FromVecAutoToVecOfConst(const std::vector<MCAuto<T>>& inputVec)
+ {
+ std::size_t size(inputVec.size());
+ std::vector< const T *> ret(size);
+ typename std::vector< const T *>::iterator itArrays(ret.begin());
+ std::for_each(inputVec.begin(),inputVec.end(),[&itArrays](MCAuto<T> elt) { *itArrays++=elt; });
+ return ret;
+ }
+
template<class T, class U>
typename MEDCoupling::MCAuto<U> DynamicCast(typename MEDCoupling::MCAuto<T>& autoSubPtr) throw()
{
this->commSize(comm,&size);
if( arrays.size() != ToSizeT(size) )
throw INTERP_KERNEL::Exception("AllToAllArrays : internal error ! Invalid size of input array.");
- std::vector< const DataArrayIdType *> arraysBis(size);
- {
- std::vector< const DataArrayIdType *>::iterator itArraysBis(arraysBis.begin());
- std::for_each(arrays.begin(),arrays.end(),[&itArraysBis](MCAuto<DataArrayIdType> elt) { *itArraysBis++=elt; });
- }
+
+ std::vector< const DataArrayIdType *> arraysBis(FromVecAutoToVecOfConst<DataArrayIdType>(arrays));
std::unique_ptr<mcIdType[]> nbOfElems2(new mcIdType[size]),nbOfElems3(new mcIdType[size]);
for(int curRk = 0 ; curRk < size ; ++curRk)
{
}
}
// communication : 3 arrays are going to be all2allized : ids, SkyLine index and SyLine values
- std::vector< MCAuto<DataArrayIdType> > myRkIdsCaptured, myRkSkIndex, myRkSkValues;
- ci.allToAllArrays(comm,idsCaptured,myRkIdsCaptured);
+ MCAuto<DataArrayIdType> aggregatedIds,indices,values;
{
+ std::vector< MCAuto<DataArrayIdType> > myRkIdsCaptured;
+ ci.allToAllArrays(comm,idsCaptured,myRkIdsCaptured);
+ aggregatedIds = DataArrayIdType::Aggregate(FromVecAutoToVecOfConst<DataArrayIdType>(myRkIdsCaptured));
+ }
+ {
+ std::vector< MCAuto<DataArrayIdType> > myRkSkIndex;
std::vector< MCAuto<DataArrayIdType> > indexToBeSent(MEDCouplingSkyLineArray::RetrieveVecIndex(skToBeSent));
ci.allToAllArrays(comm,indexToBeSent,myRkSkIndex);
+ indices = DataArrayIdType::AggregateIndexes(FromVecAutoToVecOfConst<DataArrayIdType>(myRkSkIndex));
}
{
+ std::vector< MCAuto<DataArrayIdType> > myRkSkValues;
std::vector< MCAuto<DataArrayIdType> > valuesToBeSent(MEDCouplingSkyLineArray::RetrieveVecValues(skToBeSent));
ci.allToAllArrays(comm,valuesToBeSent,myRkSkValues);
+ values = DataArrayIdType::Aggregate(FromVecAutoToVecOfConst<DataArrayIdType>(myRkSkValues));
}
- // assemble the 3 arrays myRkIdsCaptured, myRkSkIndex, myRkSkValues
}
\ No newline at end of file