return getTimeStepAtPos(pos);
}
+/*!
+ * This method groups not null items in \a vectFMTS per time step series. Two time series are considered equal if the list of their pair of integers iteration,order are equal.
+ * The float64 value of time attached to the pair of integers are not considered here.
+ *
+ * \param [in] vectFMTS - vector of not null fields defined on a same global data pointer.
+ * \throw If there is a null pointer in \a vectFMTS.
+ */
+std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS) throw(INTERP_KERNEL::Exception)
+{
+ static const char msg[]="MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries : presence of null instance in input vector !";
+ std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
+ std::list<MEDFileAnyTypeFieldMultiTS *> lstFMTS(vectFMTS.begin(),vectFMTS.end());
+ while(!lstFMTS.empty())
+ {
+ std::list<MEDFileAnyTypeFieldMultiTS *>::iterator it(lstFMTS.begin());
+ MEDFileAnyTypeFieldMultiTS *curIt(*it);
+ if(!curIt)
+ throw INTERP_KERNEL::Exception(msg);
+ std::vector< std::pair<int,int> > refIts=curIt->getIterations();
+ std::vector<MEDFileAnyTypeFieldMultiTS *> elt;
+ elt.push_back(curIt); it=lstFMTS.erase(it);
+ while(it!=lstFMTS.end())
+ {
+ curIt=*it;
+ if(!curIt)
+ throw INTERP_KERNEL::Exception(msg);
+ std::vector< std::pair<int,int> > curIts=curIt->getIterations();
+ if(refIts==curIts)
+ { elt.push_back(curIt); it=lstFMTS.erase(it);}
+ else
+ it++;
+ }
+ ret.push_back(elt);
+ }
+ return ret;
+}
+
MEDFileAnyTypeFieldMultiTSIterator *MEDFileAnyTypeFieldMultiTS::iterator() throw(INTERP_KERNEL::Exception)
{
return new MEDFileAnyTypeFieldMultiTSIterator(this);
virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception) = 0;
MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
+ static std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > SplitIntoCommonTimeSeries(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS) throw(INTERP_KERNEL::Exception);
public:// direct forwarding to MEDFileField1TSWithoutSDA instance _content
std::string getName() const;
void setName(const char *name);
convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
self->pushBackTimeSteps(tmp);
}
+
+ static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
+ convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
+ std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
+ std::size_t sz=ret.size();
+ PyObject *retPy=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ std::size_t sz2=ret[i].size();
+ PyObject *ret1Py=PyList_New(sz2);
+ for(std::size_t j=0;j<sz2;j++)
+ {
+ MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
+ if(elt)
+ elt->incrRef();
+ PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
+ }
+ PyList_SetItem(retPy,i,ret1Py);
+ }
+ return retPy;
+ }
}
};