1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
21 #include "MEDCouplingTimeDiscretization.txx"
23 #include "MEDCouplingMemArray.hxx"
24 #include "MEDCouplingMesh.hxx"
30 using namespace MEDCoupling;
32 template class MEDCoupling::MEDCouplingTimeDiscretizationTemplate<double>;
33 template class MEDCoupling::MEDCouplingTimeDiscretizationTemplate<float>;
34 template class MEDCoupling::MEDCouplingTimeDiscretizationSimple<float>;
35 template class MEDCoupling::MEDCouplingTimeDiscretizationTemplate<int>;
36 template class MEDCoupling::MEDCouplingTimeDiscretizationSimple<int>;
38 const char MEDCouplingNoTimeLabel::EXCEPTION_MSG[]="MEDCouplingNoTimeLabel::setTime : no time info attached.";
40 const char MEDCouplingNoTimeLabel::REPR[]="No time label defined.";
42 const char MEDCouplingWithTimeStep::EXCEPTION_MSG[]="No data on this time.";
44 const char MEDCouplingWithTimeStep::REPR[]="One time label.";
46 const char MEDCouplingConstOnTimeInterval::EXCEPTION_MSG[]="No data on this time.";
48 const char MEDCouplingConstOnTimeInterval::REPR[]="Constant on a time interval.";
50 const char MEDCouplingTwoTimeSteps::EXCEPTION_MSG[]="No data on this time.";
52 const char MEDCouplingLinearTime::REPR[]="Linear time between 2 time steps.";
54 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::New(TypeOfTimeDiscretization type)
58 case MEDCouplingNoTimeLabel::DISCRETIZATION:
59 return new MEDCouplingNoTimeLabel;
60 case MEDCouplingWithTimeStep::DISCRETIZATION:
61 return new MEDCouplingWithTimeStep;
62 case MEDCouplingConstOnTimeInterval::DISCRETIZATION:
63 return new MEDCouplingConstOnTimeInterval;
64 case MEDCouplingLinearTime::DISCRETIZATION:
65 return new MEDCouplingLinearTime;
67 throw INTERP_KERNEL::Exception("Time discretization not implemented yet");
71 bool MEDCouplingTimeDiscretization::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
73 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
75 if(_array==0 && other->_array==0)
77 if(_array==0 || other->_array==0)
79 if(_array->getNumberOfTuples()!=other->_array->getNumberOfTuples())
84 bool MEDCouplingTimeDiscretization::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const
86 if(!areStrictlyCompatible(other,reason))
88 if(_array==other->getArray())
90 return _array->isEqualIfNotWhy(*other->getArray(),prec,reason);
93 bool MEDCouplingTimeDiscretization::isEqual(const MEDCouplingTimeDiscretization *other, double prec) const
96 return isEqualIfNotWhy(other,prec,reason);
99 bool MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const
102 if(!areStrictlyCompatible(other,tmp))
104 if(_array==other->getArray())
106 return _array->isEqualWithoutConsideringStr(*other->getArray(),prec);
109 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCopy) const
111 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(type);
112 ret->setTimeUnit(getTimeUnit());
113 const DataArrayDouble *arrSrc=getArray();
114 MCAuto<DataArrayDouble> arr;
116 arr=arrSrc->performCopyOrIncrRef(deepCopy);
117 ret->setArray(arr,0);
121 void MEDCouplingTimeDiscretization::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
125 tinyInfo.push_back(_array->getNumberOfTuples());
126 tinyInfo.push_back(_array->getNumberOfComponents());
130 tinyInfo.push_back(-1);
131 tinyInfo.push_back(-1);
135 void MEDCouplingTimeDiscretization::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
140 DataArrayDouble *arr=0;
141 if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
143 arr=DataArrayDouble::New();
144 arr->alloc(tinyInfoI[0],tinyInfoI[1]);
150 void MEDCouplingTimeDiscretization::checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays)
152 static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size one !";
154 throw INTERP_KERNEL::Exception(MSG);
158 if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
161 throw INTERP_KERNEL::Exception(MSG);
162 arrays[0]->checkNbOfTuplesAndComp(tinyInfoI[0],tinyInfoI[1],MSG);
168 void MEDCouplingTimeDiscretization::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
170 _time_tolerance=tinyInfoD[0];
171 int nbOfCompo=_array->getNumberOfComponents();
172 for(int i=0;i<nbOfCompo;i++)
173 _array->setInfoOnComponent(i,tinyInfoS[i]);
176 void MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
178 tinyInfo.push_back(_time_tolerance);
181 void MEDCouplingTimeDiscretization::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
183 int nbOfCompo=_array->getNumberOfComponents();
184 for(int i=0;i<nbOfCompo;i++)
185 tinyInfo.push_back(_array->getInfoOnComponent(i));
188 bool MEDCouplingTimeDiscretization::isBefore(const MEDCouplingTimeDiscretization *other) const
191 double time1=getEndTime(iteration,order)-_time_tolerance;
192 double time2=other->getStartTime(iteration,order)+other->getTimeTolerance();
196 bool MEDCouplingTimeDiscretization::isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const
199 double time1=getEndTime(iteration,order)+_time_tolerance;
200 double time2=other->getStartTime(iteration,order)-other->getTimeTolerance();
204 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::computeVectorFieldCyl(const DataArrayDouble *coords, const double center[3], const double vect[3]) const
206 MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
207 ret->setTimeUnit(getTimeUnit());
208 std::vector<DataArrayDouble *> arrays;
210 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
211 for(std::size_t j=0;j<arrays.size();j++)
214 arrays2[j]=arrays[j]->fromCartToCylGiven(coords,center,vect);
216 std::vector<DataArrayDouble *> arrays3(arrays.size());
217 for(std::size_t j=0;j<arrays.size();j++)
218 arrays3[j]=arrays2[j];
219 ret->setArrays(arrays3,0);
223 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::doublyContractedProduct() const
225 MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
226 ret->setTimeUnit(getTimeUnit());
227 std::vector<DataArrayDouble *> arrays;
229 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
230 for(std::size_t j=0;j<arrays.size();j++)
233 arrays2[j]=arrays[j]->doublyContractedProduct();
235 std::vector<DataArrayDouble *> arrays3(arrays.size());
236 for(std::size_t j=0;j<arrays.size();j++)
237 arrays3[j]=arrays2[j];
238 ret->setArrays(arrays3,0);
242 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::determinant() const
244 std::vector<DataArrayDouble *> arrays;
246 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
247 for(std::size_t j=0;j<arrays.size();j++)
250 arrays2[j]=arrays[j]->determinant();
252 std::vector<DataArrayDouble *> arrays3(arrays.size());
253 for(std::size_t j=0;j<arrays.size();j++)
254 arrays3[j]=arrays2[j];
255 MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
256 ret->setTimeUnit(getTimeUnit());
257 ret->setArrays(arrays3,0);
261 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenValues() const
263 std::vector<DataArrayDouble *> arrays;
265 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
266 for(std::size_t j=0;j<arrays.size();j++)
269 arrays2[j]=arrays[j]->eigenValues();
271 std::vector<DataArrayDouble *> arrays3(arrays.size());
272 for(std::size_t j=0;j<arrays.size();j++)
273 arrays3[j]=arrays2[j];
274 MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
275 ret->setTimeUnit(getTimeUnit());
276 ret->setArrays(arrays3,0);
280 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenVectors() const
282 std::vector<DataArrayDouble *> arrays;
284 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
285 for(std::size_t j=0;j<arrays.size();j++)
288 arrays2[j]=arrays[j]->eigenVectors();
290 std::vector<DataArrayDouble *> arrays3(arrays.size());
291 for(std::size_t j=0;j<arrays.size();j++)
292 arrays3[j]=arrays2[j];
293 MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
294 ret->setTimeUnit(getTimeUnit());
295 ret->setArrays(arrays3,0);
299 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::inverse() const
301 std::vector<DataArrayDouble *> arrays;
303 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
304 for(std::size_t j=0;j<arrays.size();j++)
307 arrays2[j]=arrays[j]->inverse();
309 std::vector<DataArrayDouble *> arrays3(arrays.size());
310 for(std::size_t j=0;j<arrays.size();j++)
311 arrays3[j]=arrays2[j];
312 MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
313 ret->setTimeUnit(getTimeUnit());
314 ret->setArrays(arrays3,0);
318 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::trace() const
320 std::vector<DataArrayDouble *> arrays;
322 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
323 for(std::size_t j=0;j<arrays.size();j++)
326 arrays2[j]=arrays[j]->trace();
328 std::vector<DataArrayDouble *> arrays3(arrays.size());
329 for(std::size_t j=0;j<arrays.size();j++)
330 arrays3[j]=arrays2[j];
331 MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
332 ret->setTimeUnit(getTimeUnit());
333 ret->setArrays(arrays3,0);
337 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::deviator() const
339 std::vector<DataArrayDouble *> arrays;
341 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
342 for(std::size_t j=0;j<arrays.size();j++)
345 arrays2[j]=arrays[j]->deviator();
347 std::vector<DataArrayDouble *> arrays3(arrays.size());
348 for(std::size_t j=0;j<arrays.size();j++)
349 arrays3[j]=arrays2[j];
350 MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
351 ret->setTimeUnit(getTimeUnit());
352 ret->setArrays(arrays3,0);
356 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::magnitude() const
358 std::vector<DataArrayDouble *> arrays;
360 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
361 for(std::size_t j=0;j<arrays.size();j++)
364 arrays2[j]=arrays[j]->magnitude();
366 std::vector<DataArrayDouble *> arrays3(arrays.size());
367 for(std::size_t j=0;j<arrays.size();j++)
368 arrays3[j]=arrays2[j];
369 MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
370 ret->setTimeUnit(getTimeUnit());
371 ret->setArrays(arrays3,0);
375 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::negate() const
377 std::vector<DataArrayDouble *> arrays;
379 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
380 for(std::size_t j=0;j<arrays.size();j++)
383 arrays2[j]=arrays[j]->negate();
385 std::vector<DataArrayDouble *> arrays3(arrays.size());
386 for(std::size_t j=0;j<arrays.size();j++)
387 arrays3[j]=arrays2[j];
388 MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
389 ret->setTimeUnit(getTimeUnit());
390 ret->setArrays(arrays3,0);
394 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::maxPerTuple() const
396 std::vector<DataArrayDouble *> arrays;
398 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
399 for(std::size_t j=0;j<arrays.size();j++)
402 arrays2[j]=arrays[j]->maxPerTuple();
404 std::vector<DataArrayDouble *> arrays3(arrays.size());
405 for(std::size_t j=0;j<arrays.size();j++)
406 arrays3[j]=arrays2[j];
407 MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
408 ret->setTimeUnit(getTimeUnit());
409 ret->setArrays(arrays3,0);
413 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedComponents(const std::vector<int>& compoIds) const
415 std::vector<DataArrayDouble *> arrays;
417 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
418 for(std::size_t j=0;j<arrays.size();j++)
421 arrays2[j]=static_cast<DataArrayDouble *>(arrays[j]->keepSelectedComponents(compoIds));
423 std::vector<DataArrayDouble *> arrays3(arrays.size());
424 for(std::size_t j=0;j<arrays.size();j++)
425 arrays3[j]=arrays2[j];
426 MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
427 ret->setTimeUnit(getTimeUnit());
428 ret->setArrays(arrays3,0);
432 void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds)
434 std::vector<DataArrayDouble *> arrays1,arrays2;
436 other->getArrays(arrays2);
437 if(arrays1.size()!=arrays2.size())
438 throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : number of arrays mismatch !");
439 for(std::size_t i=0;i<arrays1.size();i++)
441 if(arrays1[i]!=0 && arrays2[i]!=0)
442 arrays1[i]->setSelectedComponents(arrays2[i],compoIds);
443 else if(arrays1[i]!=0 || arrays2[i]!=0)
444 throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : some time array in correspondance are not defined symetrically !");
448 void MEDCouplingTimeDiscretization::changeNbOfComponents(int newNbOfComp, double dftValue)
450 std::vector<DataArrayDouble *> arrays;
452 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
453 for(std::size_t j=0;j<arrays.size();j++)
456 arrays2[j]=arrays[j]->changeNbOfComponents(newNbOfComp,dftValue);
458 std::vector<DataArrayDouble *> arrays3(arrays.size());
459 for(std::size_t j=0;j<arrays.size();j++)
460 arrays3[j]=arrays2[j];
461 setArrays(arrays3,0);
464 void MEDCouplingTimeDiscretization::sortPerTuple(bool asc)
466 std::vector<DataArrayDouble *> arrays;
468 for(std::size_t j=0;j<arrays.size();j++)
471 arrays[j]->sortPerTuple(asc);
475 void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, int nbOfCompo, double value)
477 std::vector<DataArrayDouble *> arrays;
479 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
480 for(std::size_t j=0;j<arrays.size();j++)
484 arrays2[j]=arrays[j]->changeNbOfComponents(nbOfCompo,value);
485 arrays2[j]->fillWithValue(value);
489 arrays2[j]=DataArrayDouble::New();
490 arrays2[j]->alloc(nbOfTuple,nbOfCompo);
491 arrays2[j]->fillWithValue(value);
494 std::vector<DataArrayDouble *> arrays3(arrays.size());
495 for(std::size_t j=0;j<arrays.size();j++)
496 arrays3[j]=arrays2[j];
497 setArrays(arrays3,0);
500 void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value)
502 std::vector<DataArrayDouble *> arrays;
504 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
506 for(std::size_t j=0;j<arrays.size();j++)
510 arrays2[j]=arrays[j]; arrays2[j]->incrRef();
511 arrays2[j]->fillWithValue(value);
516 arrays2[j]=DataArrayDouble::New();
517 arrays2[j]->alloc(nbOfTuple,1);
518 arrays2[j]->fillWithValue(value);
523 std::vector<DataArrayDouble *> arrays3(arrays.size());
524 for(std::size_t j=0;j<arrays.size();j++)
525 arrays3[j]=arrays2[j];
526 setArrays(arrays3,0);
530 void MEDCouplingTimeDiscretization::applyLin(double a, double b, int compoId)
532 std::vector<DataArrayDouble *> arrays;
534 for(std::size_t j=0;j<arrays.size();j++)
537 arrays[j]->applyLin(a,b,compoId);
541 void MEDCouplingTimeDiscretization::applyLin(double a, double b)
543 std::vector<DataArrayDouble *> arrays;
545 for(std::size_t j=0;j<arrays.size();j++)
548 arrays[j]->applyLin(a,b);
552 void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, FunctionToEvaluate func)
554 std::vector<DataArrayDouble *> arrays;
556 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
557 for(std::size_t j=0;j<arrays.size();j++)
560 arrays2[j]=arrays[j]->applyFunc(nbOfComp,func);
562 std::vector<DataArrayDouble *> arrays3(arrays.size());
563 for(std::size_t j=0;j<arrays.size();j++)
564 arrays3[j]=arrays2[j];
565 setArrays(arrays3,0);
568 void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const std::string& func)
570 std::vector<DataArrayDouble *> arrays;
572 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
573 for(std::size_t j=0;j<arrays.size();j++)
576 arrays2[j]=arrays[j]->applyFunc(nbOfComp,func);
580 std::vector<DataArrayDouble *> arrays3(arrays.size());
581 for(std::size_t j=0;j<arrays.size();j++)
582 arrays3[j]=arrays2[j];
583 setArrays(arrays3,0);
586 void MEDCouplingTimeDiscretization::applyFuncCompo(int nbOfComp, const std::string& func)
588 std::vector<DataArrayDouble *> arrays;
590 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
591 for(std::size_t j=0;j<arrays.size();j++)
594 arrays2[j]=arrays[j]->applyFuncCompo(nbOfComp,func);
596 std::vector<DataArrayDouble *> arrays3(arrays.size());
597 for(std::size_t j=0;j<arrays.size();j++)
598 arrays3[j]=arrays2[j];
599 setArrays(arrays3,0);
602 void MEDCouplingTimeDiscretization::applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
604 std::vector<DataArrayDouble *> arrays;
606 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
607 for(std::size_t j=0;j<arrays.size();j++)
610 arrays2[j]=arrays[j]->applyFuncNamedCompo(nbOfComp,varsOrder,func);
612 std::vector<DataArrayDouble *> arrays3(arrays.size());
613 for(std::size_t j=0;j<arrays.size();j++)
614 arrays3[j]=arrays2[j];
615 setArrays(arrays3,0);
618 void MEDCouplingTimeDiscretization::applyFunc(const std::string& func)
620 std::vector<DataArrayDouble *> arrays;
622 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
623 for(std::size_t j=0;j<arrays.size();j++)
626 arrays2[j]=arrays[j]->applyFunc(func);
628 std::vector<DataArrayDouble *> arrays3(arrays.size());
629 for(std::size_t j=0;j<arrays.size();j++)
630 arrays3[j]=arrays2[j];
631 setArrays(arrays3,0);
634 void MEDCouplingTimeDiscretization::applyFuncFast32(const std::string& func)
636 std::vector<DataArrayDouble *> arrays;
638 for(std::size_t j=0;j<arrays.size();j++)
641 arrays[j]->applyFuncFast32(func);
645 void MEDCouplingTimeDiscretization::applyFuncFast64(const std::string& func)
647 std::vector<DataArrayDouble *> arrays;
649 for(std::size_t j=0;j<arrays.size();j++)
652 arrays[j]->applyFuncFast64(func);
656 void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func)
658 std::vector<DataArrayDouble *> arrays;
660 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
661 for(std::size_t j=0;j<arrays.size();j++)
662 arrays2[j]=loc->applyFunc(nbOfComp,func);
663 std::vector<DataArrayDouble *> arrays3(arrays.size());
664 for(std::size_t j=0;j<arrays.size();j++)
665 arrays3[j]=arrays2[j];
666 setArrays(arrays3,0);
669 void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const std::string& func)
671 std::vector<DataArrayDouble *> arrays;
673 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
674 for(std::size_t j=0;j<arrays.size();j++)
675 arrays2[j]=loc->applyFunc(nbOfComp,func);
676 std::vector<DataArrayDouble *> arrays3(arrays.size());
677 for(std::size_t j=0;j<arrays.size();j++)
678 arrays3[j]=arrays2[j];
679 setArrays(arrays3,0);
682 void MEDCouplingTimeDiscretization::fillFromAnalyticCompo(const DataArrayDouble *loc, int nbOfComp, const std::string& func)
684 std::vector<DataArrayDouble *> arrays;
686 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
687 for(std::size_t j=0;j<arrays.size();j++)
688 arrays2[j]=loc->applyFuncCompo(nbOfComp,func);
689 std::vector<DataArrayDouble *> arrays3(arrays.size());
690 for(std::size_t j=0;j<arrays.size();j++)
691 arrays3[j]=arrays2[j];
692 setArrays(arrays3,0);
695 void MEDCouplingTimeDiscretization::fillFromAnalyticNamedCompo(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
697 std::vector<DataArrayDouble *> arrays;
699 std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
700 for(std::size_t j=0;j<arrays.size();j++)
701 arrays2[j]=loc->applyFuncNamedCompo(nbOfComp,varsOrder,func);
702 std::vector<DataArrayDouble *> arrays3(arrays.size());
703 for(std::size_t j=0;j<arrays.size();j++)
704 arrays3[j]=arrays2[j];
705 setArrays(arrays3,0);
708 ////////////////////////
710 bool MEDCouplingTimeKeeper::isEqualIfNotWhy(const MEDCouplingTimeKeeper& other, double prec, std::string& reason) const
712 std::ostringstream oss;
713 if(_iteration!=other._iteration)
715 oss << "iterations differ. this iteration=" << _iteration << " other iteration=" << other._iteration;
719 if(_order!=other._order)
721 oss << "orders differ. this order=" << _order << " other order=" << other._order;
725 if(std::fabs(_time-other._time)>prec)
727 oss << "times differ. this time=" << _time << " other time=" << other._time;
734 bool MEDCouplingTimeKeeper::isEqual(const MEDCouplingTimeKeeper& other, double prec) const
736 if(_iteration!=other._iteration)
738 if(_order!=other._order)
740 if(std::fabs(_time-other._time)>prec)
745 void MEDCouplingTimeKeeper::copyFrom(const MEDCouplingTimeKeeper& other)
748 _iteration=other._iteration;
752 void MEDCouplingTimeKeeper::checkTimePresence(double time, double eps) const
754 if(std::fabs(time-_time)>eps)
756 std::ostringstream stream;
757 stream << "The field is defined on time " << _time << " with eps=" << eps << " and asking time = " << time << " !";
758 throw INTERP_KERNEL::Exception(stream.str().c_str());
762 ////////////////////////
764 MEDCouplingTimeDiscretizationInt::MEDCouplingTimeDiscretizationInt(const MEDCouplingTimeDiscretizationInt& other, bool deepCopy):MEDCouplingTimeDiscretizationSimple<int>(other,deepCopy)
768 MEDCouplingTimeDiscretizationInt *MEDCouplingTimeDiscretizationInt::performCopyOrIncrRef(bool deepCopy) const
770 return new MEDCouplingTimeDiscretizationInt(*this,deepCopy);
773 MEDCouplingTimeDiscretizationInt *MEDCouplingTimeDiscretizationInt::New(TypeOfTimeDiscretization type)
777 case MEDCouplingTimeDiscretizationInt::DISCRETIZATION:
778 return new MEDCouplingTimeDiscretizationInt;
780 throw INTERP_KERNEL::Exception("Time discretization not implemented yet for intergers !");
784 bool MEDCouplingTimeDiscretizationInt::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<int> *other, int prec, std::string& reason) const
787 throw INTERP_KERNEL::Exception("isEqualIfNotWhy : only precision equal to 0 supported for int !");
790 reason="Time discretization is NULL.";
793 const MEDCouplingTimeDiscretizationInt *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt *>(other));
795 throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationInt !");
796 if(!MEDCouplingTimeDiscretizationTemplate<int>::areStrictlyCompatible(other,reason))
798 if(!_tk.isEqualIfNotWhy(otherC->_tk,_time_tolerance,reason))
800 if(_array==other->getArray())
802 return _array->isEqualIfNotWhy(*other->getArray(),reason);
805 bool MEDCouplingTimeDiscretizationInt::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<int> *other, int prec) const
808 throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationInt::isEqualWithoutConsideringStr : only precision 0 is supported !");
809 const MEDCouplingTimeDiscretizationInt *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt *>(other));
811 throw INTERP_KERNEL::Exception("isEqualWithoutConsideringStr : other is not a MEDCouplingTimeDiscretizationInt !");
813 if(!areStrictlyCompatible(other,tmp))
816 if(!_tk.isEqualIfNotWhy(otherC->_tk,_time_tolerance,reason))
818 if(_array==other->getArray())
820 return _array->isEqualWithoutConsideringStr(*(other->getArray()));
823 ////////////////////////
825 MEDCouplingTimeDiscretizationFloat::MEDCouplingTimeDiscretizationFloat(const MEDCouplingTimeDiscretizationFloat& other, bool deepCopy):MEDCouplingTimeDiscretizationSimple<float>(other,deepCopy)
829 MEDCouplingTimeDiscretizationFloat *MEDCouplingTimeDiscretizationFloat::performCopyOrIncrRef(bool deepCopy) const
831 return new MEDCouplingTimeDiscretizationFloat(*this,deepCopy);
834 MEDCouplingTimeDiscretizationFloat *MEDCouplingTimeDiscretizationFloat::New(TypeOfTimeDiscretization type)
838 case MEDCouplingTimeDiscretizationFloat::DISCRETIZATION:
839 return new MEDCouplingTimeDiscretizationFloat;
841 throw INTERP_KERNEL::Exception("Time discretization not implemented yet for intergers !");
845 bool MEDCouplingTimeDiscretizationFloat::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<int> *other, float prec, std::string& reason) const
848 throw INTERP_KERNEL::Exception("isEqualIfNotWhy : only precision equal to 0 supported for int !");
851 reason="Time discretization is NULL.";
854 const MEDCouplingTimeDiscretizationFloat *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationFloat *>(other));
856 throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationFloat !");
857 if(!MEDCouplingTimeDiscretizationTemplate<int>::areStrictlyCompatible(other,reason))
859 if(!_tk.isEqualIfNotWhy(otherC->_tk,_time_tolerance,reason))
861 if(_array==other->getArray())
863 return _array->isEqualIfNotWhy(*other->getArray(),reason);
866 bool MEDCouplingTimeDiscretizationFloat::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<int> *other, float prec) const
869 throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationFloat::isEqualWithoutConsideringStr : only precision 0 is supported !");
870 const MEDCouplingTimeDiscretizationFloat *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationFloat *>(other));
872 throw INTERP_KERNEL::Exception("isEqualWithoutConsideringStr : other is not a MEDCouplingTimeDiscretizationFloat !");
874 if(!areStrictlyCompatible(other,tmp))
877 if(!_tk.isEqualIfNotWhy(otherC->_tk,_time_tolerance,reason))
879 if(_array==other->getArray())
881 return _array->isEqualWithoutConsideringStr(*(other->getArray()));
884 ////////////////////////
886 MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel()
890 MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCopy):MEDCouplingTimeDiscretization(other,deepCopy)
894 std::string MEDCouplingNoTimeLabel::getStringRepr() const
896 std::ostringstream stream;
898 stream << "\nTime unit is : \"" << _time_unit << "\"";
902 void MEDCouplingNoTimeLabel::synchronizeTimeWith(const MEDCouplingMesh *mesh)
904 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::synchronizeTimeWith : impossible to synchronize time with a MEDCouplingMesh because the time discretization is incompatible with it !");
907 bool MEDCouplingNoTimeLabel::areCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
909 if(!MEDCouplingTimeDiscretization::areCompatible(other))
911 const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
915 bool MEDCouplingNoTimeLabel::areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const
917 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
919 const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
922 reason.insert(0,"time discretization of this is NO_TIME, other has a different time discretization.");
926 bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
928 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
930 const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
934 bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
936 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
938 const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
942 bool MEDCouplingNoTimeLabel::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
944 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
946 const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
950 bool MEDCouplingNoTimeLabel::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const
952 const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
955 reason="This has time discretization NO_TIME, other not.";
958 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
961 bool MEDCouplingNoTimeLabel::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const
963 const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
966 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
969 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const MEDCouplingTimeDiscretization *other) const
971 const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
973 throw INTERP_KERNEL::Exception("NoTimeLabel::aggregation on mismatched time discretization !");
974 MCAuto<DataArrayDouble> arr(DataArrayDouble::Aggregate(getArray(),other->getArray()));
975 MEDCouplingNoTimeLabel *ret(new MEDCouplingNoTimeLabel);
976 ret->setArray(arr,0);
980 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
982 std::vector<const DataArrayDouble *> a(other.size());
984 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
986 const MEDCouplingNoTimeLabel *itC=dynamic_cast<const MEDCouplingNoTimeLabel *>(*it);
988 throw INTERP_KERNEL::Exception("NoTimeLabel::aggregate on mismatched time discretization !");
989 a[i]=itC->getArray();
991 MCAuto<DataArrayDouble> arr(DataArrayDouble::Aggregate(a));
992 MEDCouplingNoTimeLabel *ret(new MEDCouplingNoTimeLabel);
993 ret->setArray(arr,0);
997 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::meld(const MEDCouplingTimeDiscretization *other) const
999 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1001 throw INTERP_KERNEL::Exception("NoTimeLabel::meld on mismatched time discretization !");
1002 MCAuto<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
1003 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1004 ret->setTimeTolerance(getTimeTolerance());
1005 ret->setArray(arr,0);
1009 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::dot(const MEDCouplingTimeDiscretization *other) const
1011 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1013 throw INTERP_KERNEL::Exception("NoTimeLabel::dot on mismatched time discretization !");
1014 MCAuto<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
1015 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1016 ret->setArray(arr,0);
1020 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::crossProduct(const MEDCouplingTimeDiscretization *other) const
1022 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1024 throw INTERP_KERNEL::Exception("NoTimeLabel::crossProduct on mismatched time discretization !");
1025 MCAuto<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
1026 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1027 ret->setArray(arr,0);
1031 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::max(const MEDCouplingTimeDiscretization *other) const
1033 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1035 throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
1036 MCAuto<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
1037 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1038 ret->setArray(arr,0);
1042 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::min(const MEDCouplingTimeDiscretization *other) const
1044 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1046 throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
1047 MCAuto<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
1048 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1049 ret->setArray(arr,0);
1053 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::add(const MEDCouplingTimeDiscretization *other) const
1055 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1057 throw INTERP_KERNEL::Exception("NoTimeLabel::add on mismatched time discretization !");
1058 MCAuto<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
1059 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1060 ret->setArray(arr,0);
1064 void MEDCouplingNoTimeLabel::addEqual(const MEDCouplingTimeDiscretization *other)
1066 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1068 throw INTERP_KERNEL::Exception("NoTimeLabel::addEqual on mismatched time discretization !");
1070 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::addEqual : Data Array is NULL !");
1071 getArray()->addEqual(other->getArray());
1074 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::substract(const MEDCouplingTimeDiscretization *other) const
1076 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1078 throw INTERP_KERNEL::Exception("NoTimeLabel::substract on mismatched time discretization !");
1080 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::substract : Data Array is NULL !");
1081 MCAuto<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
1082 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1083 ret->setArray(arr,0);
1087 void MEDCouplingNoTimeLabel::substractEqual(const MEDCouplingTimeDiscretization *other)
1089 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1091 throw INTERP_KERNEL::Exception("NoTimeLabel::substractEqual on mismatched time discretization !");
1093 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::substractEqual : Data Array is NULL !");
1094 getArray()->substractEqual(other->getArray());
1097 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::multiply(const MEDCouplingTimeDiscretization *other) const
1099 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1101 throw INTERP_KERNEL::Exception("NoTimeLabel::multiply on mismatched time discretization !");
1102 MCAuto<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
1103 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1104 ret->setArray(arr,0);
1108 void MEDCouplingNoTimeLabel::multiplyEqual(const MEDCouplingTimeDiscretization *other)
1110 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1112 throw INTERP_KERNEL::Exception("NoTimeLabel::multiplyEqual on mismatched time discretization !");
1114 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::multiplyEqual : Data Array is NULL !");
1115 getArray()->multiplyEqual(other->getArray());
1118 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::divide(const MEDCouplingTimeDiscretization *other) const
1120 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1122 throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
1123 MCAuto<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
1124 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1125 ret->setArray(arr,0);
1129 void MEDCouplingNoTimeLabel::divideEqual(const MEDCouplingTimeDiscretization *other)
1131 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1133 throw INTERP_KERNEL::Exception("NoTimeLabel::divideEqual on mismatched time discretization !");
1135 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::divideEqual : Data Array is NULL !");
1136 getArray()->divideEqual(other->getArray());
1139 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::pow(const MEDCouplingTimeDiscretization *other) const
1141 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1143 throw INTERP_KERNEL::Exception("pow on mismatched time discretization !");
1144 MCAuto<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
1145 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1146 ret->setArray(arr,0);
1150 void MEDCouplingNoTimeLabel::powEqual(const MEDCouplingTimeDiscretization *other)
1152 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1154 throw INTERP_KERNEL::Exception("NoTimeLabel::powEqual on mismatched time discretization !");
1156 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::powEqual : Data Array is NULL !");
1157 getArray()->powEqual(other->getArray());
1160 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::performCopyOrIncrRef(bool deepCopy) const
1162 return new MEDCouplingNoTimeLabel(*this,deepCopy);
1165 void MEDCouplingNoTimeLabel::checkTimePresence(double time) const
1167 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1170 std::vector< const DataArrayDouble *> MEDCouplingNoTimeLabel::getArraysForTime(double time) const
1172 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1175 void MEDCouplingNoTimeLabel::getValueForTime(double time, const std::vector<double>& vals, double *res) const
1177 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1180 bool MEDCouplingNoTimeLabel::isBefore(const MEDCouplingTimeDiscretization *other) const
1182 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1185 bool MEDCouplingNoTimeLabel::isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const
1187 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1190 double MEDCouplingNoTimeLabel::getStartTime(int& iteration, int& order) const
1192 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1195 double MEDCouplingNoTimeLabel::getEndTime(int& iteration, int& order) const
1197 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1200 void MEDCouplingNoTimeLabel::setStartIteration(int it)
1202 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1205 void MEDCouplingNoTimeLabel::setEndIteration(int it)
1207 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1210 void MEDCouplingNoTimeLabel::setStartOrder(int order)
1212 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1215 void MEDCouplingNoTimeLabel::setEndOrder(int order)
1217 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1220 void MEDCouplingNoTimeLabel::setStartTimeValue(double time)
1222 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1225 void MEDCouplingNoTimeLabel::setEndTimeValue(double time)
1227 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1230 void MEDCouplingNoTimeLabel::setStartTime(double time, int iteration, int order)
1232 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1235 void MEDCouplingNoTimeLabel::setEndTime(double time, int iteration, int order)
1237 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1240 void MEDCouplingNoTimeLabel::getValueOnTime(int eltId, double time, double *value) const
1242 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1245 void MEDCouplingNoTimeLabel::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
1247 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1251 * idem getTinySerializationIntInformation except that it is for multi field fetch
1253 void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
1259 * idem getTinySerializationDbleInformation except that it is for multi field fetch
1261 void MEDCouplingNoTimeLabel::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
1264 tinyInfo[0]=_time_tolerance;
1268 * idem finishUnserialization except that it is for multi field fetch
1270 void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
1272 _time_tolerance=tinyInfoD[0];
1275 MEDCouplingWithTimeStep::MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCopy):MEDCouplingTimeDiscretization(other,deepCopy),_tk(other._tk)
1279 MEDCouplingWithTimeStep::MEDCouplingWithTimeStep()
1283 std::string MEDCouplingWithTimeStep::getStringRepr() const
1285 std::ostringstream stream;
1286 stream << REPR << " Time is defined by iteration=" << _tk.getIteration() << " order=" << _tk.getOrder() << " and time=" << _tk.getTimeValue() << ".";
1287 stream << "\nTime unit is : \"" << _time_unit << "\"";
1288 return stream.str();
1291 void MEDCouplingWithTimeStep::synchronizeTimeWith(const MEDCouplingMesh *mesh)
1294 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
1296 double val=mesh->getTime(it,order);
1297 _tk.setAllInfo(val,it,order);
1298 std::string tUnit=mesh->getTimeUnit();
1302 void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
1304 MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
1305 tinyInfo.push_back(_tk.getIteration());
1306 tinyInfo.push_back(_tk.getOrder());
1309 void MEDCouplingWithTimeStep::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
1311 MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
1312 tinyInfo.push_back(_tk.getTimeValue());
1315 void MEDCouplingWithTimeStep::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
1317 MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
1318 _tk.setTimeValue(tinyInfoD[1]);
1319 _tk.setIteration(tinyInfoI[2]);
1320 _tk.setOrder(tinyInfoI[3]);
1324 * idem getTinySerializationIntInformation except that it is for multi field fetch
1326 void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
1329 tinyInfo[0]=_tk.getIteration();
1330 tinyInfo[1]=_tk.getOrder();
1334 * idem getTinySerializationDbleInformation except that it is for multi field fetch
1336 void MEDCouplingWithTimeStep::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
1339 tinyInfo[0]=_time_tolerance;
1340 tinyInfo[1]=_tk.getTimeValue();
1344 * idem finishUnserialization except that it is for multi field fetch
1346 void MEDCouplingWithTimeStep::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
1348 _tk.setIteration(tinyInfoI[0]);
1349 _tk.setOrder(tinyInfoI[1]);
1350 _time_tolerance=tinyInfoD[0];
1351 _tk.setTimeValue(tinyInfoD[1]);
1354 bool MEDCouplingWithTimeStep::areCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
1356 if(!MEDCouplingTimeDiscretization::areCompatible(other))
1358 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1362 bool MEDCouplingWithTimeStep::areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const
1364 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
1366 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1369 reason.insert(0,"time discretization of this is ONE_TIME, other has a different time discretization.");
1373 bool MEDCouplingWithTimeStep::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
1375 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
1377 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1381 bool MEDCouplingWithTimeStep::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
1383 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
1385 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1389 bool MEDCouplingWithTimeStep::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
1391 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
1393 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1397 bool MEDCouplingWithTimeStep::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const
1399 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1400 std::ostringstream oss; oss.precision(15);
1403 reason="This has time discretization ONE_TIME, other not.";
1406 if(!_tk.isEqualIfNotWhy(otherC->_tk,_time_tolerance,reason))
1408 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
1411 bool MEDCouplingWithTimeStep::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const
1413 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1416 if(!_tk.isEqual(otherC->_tk,_time_tolerance))
1418 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
1421 void MEDCouplingWithTimeStep::copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other)
1423 MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
1424 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(&other);
1426 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::copyTinyAttrFrom : mismatch of time discretization !");
1427 _tk.copyFrom(otherC->_tk);
1430 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const MEDCouplingTimeDiscretization *other) const
1432 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1434 throw INTERP_KERNEL::Exception("WithTimeStep::aggregation on mismatched time discretization !");
1435 MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
1436 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1437 ret->setArray(arr,0);
1441 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
1443 std::vector<const DataArrayDouble *> a(other.size());
1445 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
1447 const MEDCouplingWithTimeStep *itC=dynamic_cast<const MEDCouplingWithTimeStep *>(*it);
1449 throw INTERP_KERNEL::Exception("WithTimeStep::aggregate on mismatched time discretization !");
1450 a[i]=itC->getArray();
1452 MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
1453 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1454 ret->setArray(arr,0);
1458 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::meld(const MEDCouplingTimeDiscretization *other) const
1460 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1462 throw INTERP_KERNEL::Exception("WithTimeStep::meld on mismatched time discretization !");
1463 MCAuto<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
1464 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1465 ret->setArray(arr,0);
1469 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::dot(const MEDCouplingTimeDiscretization *other) const
1471 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1473 throw INTERP_KERNEL::Exception("WithTimeStep::dot on mismatched time discretization !");
1474 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1475 MCAuto<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
1476 ret->setArray(arr,0);
1480 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::crossProduct(const MEDCouplingTimeDiscretization *other) const
1482 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1484 throw INTERP_KERNEL::Exception("WithTimeStep::crossProduct on mismatched time discretization !");
1485 MCAuto<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
1486 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1487 ret->setArray(arr,0);
1491 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::max(const MEDCouplingTimeDiscretization *other) const
1493 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1495 throw INTERP_KERNEL::Exception("WithTimeStep::max on mismatched time discretization !");
1496 MCAuto<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
1497 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1498 ret->setArray(arr,0);
1502 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::min(const MEDCouplingTimeDiscretization *other) const
1504 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1506 throw INTERP_KERNEL::Exception("WithTimeStep::min on mismatched time discretization !");
1507 MCAuto<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
1508 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1509 ret->setArray(arr,0);
1513 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::add(const MEDCouplingTimeDiscretization *other) const
1515 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1517 throw INTERP_KERNEL::Exception("WithTimeStep::add on mismatched time discretization !");
1518 MCAuto<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
1519 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1520 ret->setArray(arr,0);
1522 double tmp3=getStartTime(tmp1,tmp2);
1523 ret->setStartTime(tmp3,tmp1,tmp2);
1527 void MEDCouplingWithTimeStep::addEqual(const MEDCouplingTimeDiscretization *other)
1529 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1531 throw INTERP_KERNEL::Exception("WithTimeStep::addEqual on mismatched time discretization !");
1533 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::addEqual : Data Array is NULL !");
1534 getArray()->addEqual(other->getArray());
1537 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::substract(const MEDCouplingTimeDiscretization *other) const
1539 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1541 throw INTERP_KERNEL::Exception("WithTimeStep::substract on mismatched time discretization !");
1542 MCAuto<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
1543 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1544 ret->setArray(arr,0);
1546 double tmp3=getStartTime(tmp1,tmp2);
1547 ret->setStartTime(tmp3,tmp1,tmp2);
1551 void MEDCouplingWithTimeStep::substractEqual(const MEDCouplingTimeDiscretization *other)
1553 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1555 throw INTERP_KERNEL::Exception("WithTimeStep::substractEqual on mismatched time discretization !");
1557 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::substractEqual : Data Array is NULL !");
1558 getArray()->substractEqual(other->getArray());
1561 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::multiply(const MEDCouplingTimeDiscretization *other) const
1563 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1565 throw INTERP_KERNEL::Exception("WithTimeStep::multiply on mismatched time discretization !");
1566 MCAuto<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
1567 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1568 ret->setArray(arr,0);
1570 double tmp3=getStartTime(tmp1,tmp2);
1571 ret->setStartTime(tmp3,tmp1,tmp2);
1575 void MEDCouplingWithTimeStep::multiplyEqual(const MEDCouplingTimeDiscretization *other)
1577 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1579 throw INTERP_KERNEL::Exception("WithTimeStep::multiplyEqual on mismatched time discretization !");
1581 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::multiplyEqual : Data Array is NULL !");
1582 getArray()->multiplyEqual(other->getArray());
1585 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::divide(const MEDCouplingTimeDiscretization *other) const
1587 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1589 throw INTERP_KERNEL::Exception("WithTimeStep::divide on mismatched time discretization !");
1590 MCAuto<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
1591 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1592 ret->setArray(arr,0);
1594 double tmp3=getStartTime(tmp1,tmp2);
1595 ret->setStartTime(tmp3,tmp1,tmp2);
1599 void MEDCouplingWithTimeStep::divideEqual(const MEDCouplingTimeDiscretization *other)
1601 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1603 throw INTERP_KERNEL::Exception("WithTimeStep::divideEqual on mismatched time discretization !");
1605 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::divideEqual : Data Array is NULL !");
1606 getArray()->divideEqual(other->getArray());
1609 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::pow(const MEDCouplingTimeDiscretization *other) const
1611 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1613 throw INTERP_KERNEL::Exception("WithTimeStep::pow on mismatched time discretization !");
1614 MCAuto<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
1615 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1616 ret->setArray(arr,0);
1618 double tmp3=getStartTime(tmp1,tmp2);
1619 ret->setStartTime(tmp3,tmp1,tmp2);
1623 void MEDCouplingWithTimeStep::powEqual(const MEDCouplingTimeDiscretization *other)
1625 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1627 throw INTERP_KERNEL::Exception("WithTimeStep::powEqual on mismatched time discretization !");
1629 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::powEqual : Data Array is NULL !");
1630 getArray()->powEqual(other->getArray());
1633 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::performCopyOrIncrRef(bool deepCopy) const
1635 return new MEDCouplingWithTimeStep(*this,deepCopy);
1638 void MEDCouplingWithTimeStep::checkNoTimePresence() const
1640 throw INTERP_KERNEL::Exception("No time specified on a field defined on one time");
1643 void MEDCouplingWithTimeStep::checkTimePresence(double time) const
1645 _tk.checkTimePresence(time,_time_tolerance);
1648 std::vector< const DataArrayDouble *> MEDCouplingWithTimeStep::getArraysForTime(double time) const
1650 if(std::fabs(time-_tk.getTimeValue())<=_time_tolerance)
1652 std::vector< const DataArrayDouble *> ret(1);
1657 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1660 void MEDCouplingWithTimeStep::getValueForTime(double time, const std::vector<double>& vals, double *res) const
1662 std::copy(vals.begin(),vals.end(),res);
1665 void MEDCouplingWithTimeStep::getValueOnTime(int eltId, double time, double *value) const
1667 if(std::fabs(time-_tk.getTimeValue())<=_time_tolerance)
1669 _array->getTuple(eltId,value);
1671 throw INTERP_KERNEL::Exception("No array existing.");
1673 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1676 void MEDCouplingWithTimeStep::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
1678 if(_tk.getIteration()==iteration && _tk.getOrder()==order)
1680 _array->getTuple(eltId,value);
1682 throw INTERP_KERNEL::Exception("No array existing.");
1684 throw INTERP_KERNEL::Exception("No data on this discrete time.");
1687 MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval()
1691 void MEDCouplingConstOnTimeInterval::copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other)
1693 MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
1694 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(&other);
1696 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::copyTinyAttrFrom : mismatch of time discretization !");
1697 _start.copyFrom(otherC->_start);
1698 _end.copyFrom(otherC->_end);
1701 void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
1703 MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
1704 tinyInfo.push_back(_start.getIteration());
1705 tinyInfo.push_back(_start.getOrder());
1706 tinyInfo.push_back(_end.getIteration());
1707 tinyInfo.push_back(_end.getOrder());
1710 void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
1712 MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
1713 tinyInfo.push_back(_start.getTimeValue());
1714 tinyInfo.push_back(_end.getTimeValue());
1717 void MEDCouplingConstOnTimeInterval::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
1719 MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
1720 _start.setTimeValue(tinyInfoD[1]);
1721 _end.setTimeValue(tinyInfoD[2]);
1722 _start.setIteration(tinyInfoI[2]);
1723 _start.setOrder(tinyInfoI[3]);
1724 _end.setIteration(tinyInfoI[4]);
1725 _end.setOrder(tinyInfoI[5]);
1729 * idem getTinySerializationIntInformation except that it is for multi field fetch
1731 void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
1734 tinyInfo[0]=_start.getIteration();
1735 tinyInfo[1]=_start.getOrder();
1736 tinyInfo[2]=_end.getIteration();
1737 tinyInfo[3]=_end.getOrder();
1741 * idem getTinySerializationDbleInformation except that it is for multi field fetch
1743 void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
1746 tinyInfo[0]=_time_tolerance;
1747 tinyInfo[1]=_start.getTimeValue();
1748 tinyInfo[2]=_end.getTimeValue();
1752 * idem finishUnserialization except that it is for multi field fetch
1754 void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
1756 _start.setIteration(tinyInfoI[0]);
1757 _start.setOrder(tinyInfoI[1]);
1758 _end.setIteration(tinyInfoI[2]);
1759 _end.setOrder(tinyInfoI[3]);
1760 _time_tolerance=tinyInfoD[0];
1761 _start.setTimeValue(tinyInfoD[1]);
1762 _end.setTimeValue(tinyInfoD[2]);
1765 MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCopy):
1766 MEDCouplingTimeDiscretization(other,deepCopy),_start(other._start),_end(other._end)
1770 std::string MEDCouplingConstOnTimeInterval::getStringRepr() const
1772 std::ostringstream stream;
1773 stream << REPR << " Time interval is defined by :\niteration_start=" << _start.getIteration() << " order_start=" << _start.getOrder() << " and time_start=" << _start.getTimeValue() << "\n";
1774 stream << "iteration_end=" << _end.getIteration() << " order_end=" << _end.getOrder() << " and end_time=" << _end.getTimeValue() << "\n";
1775 stream << "\nTime unit is : \"" << _time_unit << "\"";
1776 return stream.str();
1779 void MEDCouplingConstOnTimeInterval::synchronizeTimeWith(const MEDCouplingMesh *mesh)
1782 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
1784 double val=mesh->getTime(it,order);
1785 _start.setAllInfo(val,it,order);
1786 _end.setAllInfo(val,it,order);
1787 std::string tUnit(mesh->getTimeUnit());
1791 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::performCopyOrIncrRef(bool deepCopy) const
1793 return new MEDCouplingConstOnTimeInterval(*this,deepCopy);
1796 std::vector< const DataArrayDouble *> MEDCouplingConstOnTimeInterval::getArraysForTime(double time) const
1798 if(time>_start.getTimeValue()-_time_tolerance && time<_end.getTimeValue()+_time_tolerance)
1800 std::vector< const DataArrayDouble *> ret(1);
1805 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1808 void MEDCouplingConstOnTimeInterval::getValueForTime(double time, const std::vector<double>& vals, double *res) const
1810 std::copy(vals.begin(),vals.end(),res);
1813 bool MEDCouplingConstOnTimeInterval::areCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
1815 if(!MEDCouplingTimeDiscretization::areCompatible(other))
1817 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1821 bool MEDCouplingConstOnTimeInterval::areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const
1823 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
1825 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1828 reason.insert(0,"time discretization of this is CONST_ON_TIME_INTERVAL, other has a different time discretization.");
1832 bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
1834 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
1836 const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
1840 bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
1842 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
1844 const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
1848 bool MEDCouplingConstOnTimeInterval::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
1850 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
1852 const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
1856 bool MEDCouplingConstOnTimeInterval::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const
1858 const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
1859 std::ostringstream oss; oss.precision(15);
1862 reason="This has time discretization CONST_ON_TIME_INTERVAL, other not.";
1865 if(!_start.isEqualIfNotWhy(otherC->_start,_time_tolerance,reason))
1867 if(!_end.isEqualIfNotWhy(otherC->_end,_time_tolerance,reason))
1869 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
1872 bool MEDCouplingConstOnTimeInterval::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const
1874 const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
1877 if(!_start.isEqual(otherC->_start,_time_tolerance))
1879 if(!_end.isEqual(otherC->_end,_time_tolerance))
1881 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
1884 void MEDCouplingConstOnTimeInterval::getValueOnTime(int eltId, double time, double *value) const
1886 if(time>_start.getTimeValue()-_time_tolerance && time<_end.getTimeValue()+_time_tolerance)
1888 _array->getTuple(eltId,value);
1890 throw INTERP_KERNEL::Exception("No array existing.");
1892 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1895 void MEDCouplingConstOnTimeInterval::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
1897 if(iteration>=_start.getIteration() && iteration<=_end.getIteration())
1899 _array->getTuple(eltId,value);
1901 throw INTERP_KERNEL::Exception("No array existing.");
1903 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1906 void MEDCouplingConstOnTimeInterval::checkNoTimePresence() const
1908 throw INTERP_KERNEL::Exception("No time specified on a field defined as constant on one time interval");
1911 void MEDCouplingConstOnTimeInterval::checkTimePresence(double time) const
1913 if(time<_start.getTimeValue()-_time_tolerance || time>_end.getTimeValue()+_time_tolerance)
1915 std::ostringstream stream;
1916 stream << "The field is defined between times " << _start.getTimeValue() << " and " << _end.getTimeValue() << " worderh tolerance ";
1917 stream << _time_tolerance << " and trying to access on time = " << time;
1918 throw INTERP_KERNEL::Exception(stream.str().c_str());
1922 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const MEDCouplingTimeDiscretization *other) const
1924 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1926 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregation on mismatched time discretization !");
1927 MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
1928 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
1929 ret->setArray(arr,0);
1933 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
1935 std::vector<const DataArrayDouble *> a(other.size());
1937 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
1939 const MEDCouplingConstOnTimeInterval *itC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(*it);
1941 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregate on mismatched time discretization !");
1942 a[i]=itC->getArray();
1944 MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
1945 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
1946 ret->setArray(arr,0);
1950 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::meld(const MEDCouplingTimeDiscretization *other) const
1952 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1954 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::meld on mismatched time discretization !");
1955 MCAuto<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
1956 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
1957 ret->setTimeTolerance(getTimeTolerance());
1958 ret->setArray(arr,0);
1962 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::dot(const MEDCouplingTimeDiscretization *other) const
1964 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1966 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::dot on mismatched time discretization !");
1967 MCAuto<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
1968 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
1969 ret->setArray(arr,0);
1973 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::crossProduct(const MEDCouplingTimeDiscretization *other) const
1975 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1977 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::crossProduct on mismatched time discretization !");
1978 MCAuto<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
1979 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
1980 ret->setArray(arr,0);
1984 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::max(const MEDCouplingTimeDiscretization *other) const
1986 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1988 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::max on mismatched time discretization !");
1989 MCAuto<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
1990 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
1991 ret->setArray(arr,0);
1995 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::min(const MEDCouplingTimeDiscretization *other) const
1997 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1999 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::min on mismatched time discretization !");
2000 MCAuto<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
2001 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2002 ret->setArray(arr,0);
2006 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::add(const MEDCouplingTimeDiscretization *other) const
2008 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2010 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::add on mismatched time discretization !");
2011 MCAuto<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
2012 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2013 ret->setArray(arr,0);
2015 double tmp3=getStartTime(tmp1,tmp2);
2016 ret->setStartTime(tmp3,tmp1,tmp2);
2017 tmp3=getEndTime(tmp1,tmp2);
2018 ret->setEndTime(tmp3,tmp1,tmp2);
2022 void MEDCouplingConstOnTimeInterval::addEqual(const MEDCouplingTimeDiscretization *other)
2024 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2026 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::addEqual on mismatched time discretization !");
2028 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::substractaddEqual : Data Array is NULL !");
2029 getArray()->addEqual(other->getArray());
2032 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const MEDCouplingTimeDiscretization *other) const
2034 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2036 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substract on mismatched time discretization !");
2037 MCAuto<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
2038 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2039 ret->setArray(arr,0);
2041 double tmp3=getStartTime(tmp1,tmp2);
2042 ret->setStartTime(tmp3,tmp1,tmp2);
2043 tmp3=getEndTime(tmp1,tmp2);
2044 ret->setEndTime(tmp3,tmp1,tmp2);
2048 void MEDCouplingConstOnTimeInterval::substractEqual(const MEDCouplingTimeDiscretization *other)
2050 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2052 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substractEqual on mismatched time discretization !");
2054 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::substractEqual : Data Array is NULL !");
2055 getArray()->substractEqual(other->getArray());
2058 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::multiply(const MEDCouplingTimeDiscretization *other) const
2060 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2062 throw INTERP_KERNEL::Exception("multiply on mismatched time discretization !");
2063 MCAuto<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
2064 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2065 ret->setArray(arr,0);
2067 double tmp3=getStartTime(tmp1,tmp2);
2068 ret->setStartTime(tmp3,tmp1,tmp2);
2069 tmp3=getEndTime(tmp1,tmp2);
2070 ret->setEndTime(tmp3,tmp1,tmp2);
2074 void MEDCouplingConstOnTimeInterval::multiplyEqual(const MEDCouplingTimeDiscretization *other)
2076 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2078 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::multiplyEqual on mismatched time discretization !");
2080 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::multiplyEqual : Data Array is NULL !");
2081 getArray()->multiplyEqual(other->getArray());
2084 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::divide(const MEDCouplingTimeDiscretization *other) const
2086 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2088 throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
2089 MCAuto<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
2090 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2091 ret->setArray(arr,0);
2093 double tmp3=getStartTime(tmp1,tmp2);
2094 ret->setStartTime(tmp3,tmp1,tmp2);
2095 tmp3=getEndTime(tmp1,tmp2);
2096 ret->setEndTime(tmp3,tmp1,tmp2);
2100 void MEDCouplingConstOnTimeInterval::divideEqual(const MEDCouplingTimeDiscretization *other)
2102 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2104 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::divideEqual on mismatched time discretization !");
2106 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::divideEqual : Data Array is NULL !");
2107 getArray()->divideEqual(other->getArray());
2110 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::pow(const MEDCouplingTimeDiscretization *other) const
2112 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2114 throw INTERP_KERNEL::Exception("pow on mismatched time discretization !");
2115 MCAuto<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
2116 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2117 ret->setArray(arr,0);
2119 double tmp3=getStartTime(tmp1,tmp2);
2120 ret->setStartTime(tmp3,tmp1,tmp2);
2121 tmp3=getEndTime(tmp1,tmp2);
2122 ret->setEndTime(tmp3,tmp1,tmp2);
2126 void MEDCouplingConstOnTimeInterval::powEqual(const MEDCouplingTimeDiscretization *other)
2128 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2130 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::powEqual on mismatched time discretization !");
2132 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::powEqual : Data Array is NULL !");
2133 getArray()->powEqual(other->getArray());
2136 MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCopy):MEDCouplingTimeDiscretization(other,deepCopy),
2137 _start(other._start),_end(other._end)
2139 if(other._end_array)
2140 _end_array=other._end_array->performCopyOrIncrRef(deepCopy);
2145 void MEDCouplingTwoTimeSteps::updateTime() const
2147 MEDCouplingTimeDiscretization::updateTime();
2149 updateTimeWith(*_end_array);
2152 void MEDCouplingTwoTimeSteps::synchronizeTimeWith(const MEDCouplingMesh *mesh)
2155 throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
2157 double val=mesh->getTime(it,order);
2158 _start.setAllInfo(val,it,order);
2159 _end.setAllInfo(val,it,order);
2160 std::string tUnit=mesh->getTimeUnit();
2164 std::size_t MEDCouplingTwoTimeSteps::getHeapMemorySizeWithoutChildren() const
2166 return MEDCouplingTimeDiscretization::getHeapMemorySizeWithoutChildren();
2169 std::vector<const BigMemoryObject *> MEDCouplingTwoTimeSteps::getDirectChildrenWithNull() const
2171 std::vector<const BigMemoryObject *> ret(MEDCouplingTimeDiscretization::getDirectChildrenWithNull());
2172 ret.push_back(_end_array);
2176 void MEDCouplingTwoTimeSteps::copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other)
2178 MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
2179 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(&other);
2181 throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::copyTinyAttrFrom : mismatch of time discretization !");
2182 _start.copyFrom(otherC->_start);
2183 _end.copyFrom(otherC->_end);
2186 void MEDCouplingTwoTimeSteps::copyTinyStringsFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other)
2188 MEDCouplingTimeDiscretization::copyTinyStringsFrom(other);
2189 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(&other);
2191 throw INTERP_KERNEL::Exception("Trying to operate copyTinyStringsFrom on different field type (two times//one time) !");
2192 if(_end_array && otherC->_end_array)
2193 _end_array->copyStringInfoFrom(*otherC->_end_array);
2196 const DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray() const
2201 DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray()
2206 void MEDCouplingTwoTimeSteps::checkConsistencyLight() const
2208 MEDCouplingTimeDiscretization::checkConsistencyLight();
2210 throw INTERP_KERNEL::Exception("No end array specified !");
2211 if(_array->getNumberOfComponents()!=_end_array->getNumberOfComponents())
2212 throw INTERP_KERNEL::Exception("The number of components mismatch between the start and the end arrays !");
2213 if(_array->getNumberOfTuples()!=_end_array->getNumberOfTuples())
2214 throw INTERP_KERNEL::Exception("The number of tuples mismatch between the start and the end arrays !");
2217 bool MEDCouplingTwoTimeSteps::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const
2219 std::ostringstream oss;
2220 const MEDCouplingTwoTimeSteps *otherC(dynamic_cast<const MEDCouplingTwoTimeSteps *>(other));
2223 reason="This has time discretization LINEAR_TIME, other not.";
2226 if(!_start.isEqualIfNotWhy(otherC->_start,_time_tolerance,reason))
2228 if(!_end.isEqualIfNotWhy(otherC->_end,_time_tolerance,reason))
2230 if(_end_array!=otherC->_end_array)
2231 if(!_end_array->isEqualIfNotWhy(*otherC->_end_array,prec,reason))
2233 reason.insert(0,"end arrays differ for linear time.");
2236 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
2239 bool MEDCouplingTwoTimeSteps::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const
2241 const MEDCouplingTwoTimeSteps *otherC(dynamic_cast<const MEDCouplingTwoTimeSteps *>(other));
2244 if(!_start.isEqual(otherC->_start,_time_tolerance))
2246 if(!_end.isEqual(otherC->_end,_time_tolerance))
2248 if(_end_array!=otherC->_end_array)
2249 if(!_end_array->isEqualWithoutConsideringStr(*otherC->_end_array,prec))
2251 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
2254 MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps():_end_array(0)
2258 MEDCouplingTwoTimeSteps::~MEDCouplingTwoTimeSteps()
2261 _end_array->decrRef();
2264 void MEDCouplingTwoTimeSteps::checkNoTimePresence() const
2266 throw INTERP_KERNEL::Exception("The field presents a time to be specified in every access !");
2269 void MEDCouplingTwoTimeSteps::checkTimePresence(double time) const
2271 if(time<_start.getTimeValue()-_time_tolerance || time>_end.getTimeValue()+_time_tolerance)
2273 std::ostringstream stream;
2274 stream << "The field is defined between times " << _start.getTimeValue() << " and " << _end.getTimeValue() << " worderh tolerance ";
2275 stream << _time_tolerance << " and trying to access on time = " << time;
2276 throw INTERP_KERNEL::Exception(stream.str().c_str());
2280 void MEDCouplingTwoTimeSteps::getArrays(std::vector<DataArrayDouble *>& arrays) const
2284 arrays[1]=_end_array;
2287 void MEDCouplingTwoTimeSteps::setEndArray(DataArrayDouble *array, TimeLabel *owner)
2289 if(array!=_end_array)
2292 _end_array->decrRef();
2295 _end_array->incrRef();
2297 owner->declareAsNew();
2301 void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
2303 MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
2304 tinyInfo.push_back(_start.getIteration());
2305 tinyInfo.push_back(_start.getOrder());
2306 tinyInfo.push_back(_end.getIteration());
2307 tinyInfo.push_back(_end.getOrder());
2310 tinyInfo.push_back(_end_array->getNumberOfTuples());
2311 tinyInfo.push_back(_end_array->getNumberOfComponents());
2315 tinyInfo.push_back(-1);
2316 tinyInfo.push_back(-1);
2320 void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
2322 MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
2323 tinyInfo.push_back(_start.getTimeValue());
2324 tinyInfo.push_back(_end.getTimeValue());
2327 void MEDCouplingTwoTimeSteps::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
2329 int nbOfCompo=_array->getNumberOfComponents();
2330 for(int i=0;i<nbOfCompo;i++)
2331 tinyInfo.push_back(_array->getInfoOnComponent(i));
2332 for(int i=0;i<nbOfCompo;i++)
2333 tinyInfo.push_back(_end_array->getInfoOnComponent(i));
2336 void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
2342 _end_array->decrRef();
2343 DataArrayDouble *arr=0;
2344 if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
2346 arr=DataArrayDouble::New();
2347 arr->alloc(tinyInfoI[0],tinyInfoI[1]);
2352 if(tinyInfoI[6]!=-1 && tinyInfoI[7]!=-1)
2354 arr=DataArrayDouble::New();
2355 arr->alloc(tinyInfoI[6],tinyInfoI[7]);
2361 void MEDCouplingTwoTimeSteps::checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays)
2363 static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size two !";
2364 if(arrays.size()!=2)
2365 throw INTERP_KERNEL::Exception(MSG);
2369 _end_array->decrRef();
2370 _array=0; _end_array=0;
2371 if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
2374 throw INTERP_KERNEL::Exception(MSG);
2375 arrays[0]->checkNbOfTuplesAndComp(tinyInfoI[0],tinyInfoI[1],MSG);
2376 _array=arrays[0]; _array->incrRef();
2378 if(tinyInfoI[6]!=-1 && tinyInfoI[7]!=-1)
2381 throw INTERP_KERNEL::Exception(MSG);
2382 arrays[1]->checkNbOfTuplesAndComp(tinyInfoI[0],tinyInfoI[1],MSG);
2383 _end_array=arrays[1]; _end_array->incrRef();
2387 void MEDCouplingTwoTimeSteps::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
2389 MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
2390 _start.setTimeValue(tinyInfoD[1]);
2391 _end.setTimeValue(tinyInfoD[2]);
2392 _start.setIteration(tinyInfoI[2]);
2393 _start.setOrder(tinyInfoI[3]);
2394 _end.setIteration(tinyInfoI[4]);
2395 _end.setOrder(tinyInfoI[5]);
2399 * idem getTinySerializationIntInformation except that it is for multi field fetch
2401 void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
2404 tinyInfo[0]=_start.getIteration();
2405 tinyInfo[1]=_start.getOrder();
2406 tinyInfo[2]=_end.getIteration();
2407 tinyInfo[3]=_end.getOrder();
2411 * idem getTinySerializationDbleInformation except that it is for multi field fetch
2413 void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
2416 tinyInfo[0]=_time_tolerance;
2417 tinyInfo[1]=_start.getTimeValue();
2418 tinyInfo[2]=_end.getTimeValue();
2422 * idem finishUnserialization except that it is for multi field fetch
2424 void MEDCouplingTwoTimeSteps::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
2426 _start.setIteration(tinyInfoI[0]);
2427 _start.setOrder(tinyInfoI[1]);
2428 _end.setIteration(tinyInfoI[2]);
2429 _end.setOrder(tinyInfoI[3]);
2430 _time_tolerance=tinyInfoD[0];
2431 _start.setTimeValue(tinyInfoD[1]);
2432 _end.setTimeValue(tinyInfoD[2]);
2435 std::vector< const DataArrayDouble *> MEDCouplingTwoTimeSteps::getArraysForTime(double time) const
2437 if(time>_start.getTimeValue()-_time_tolerance && time<_end.getTimeValue()+_time_tolerance)
2439 std::vector< const DataArrayDouble *> ret(2);
2445 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
2448 void MEDCouplingTwoTimeSteps::setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner)
2450 if(arrays.size()!=2)
2451 throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::setArrays : number of arrays must be two.");
2452 setArray(arrays.front(),owner);
2453 setEndArray(arrays.back(),owner);
2456 MEDCouplingLinearTime::MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCopy):MEDCouplingTwoTimeSteps(other,deepCopy)
2460 MEDCouplingLinearTime::MEDCouplingLinearTime()
2464 std::string MEDCouplingLinearTime::getStringRepr() const
2466 std::ostringstream stream;
2467 stream << REPR << " Time interval is defined by :\niteration_start=" << _start.getIteration() << " order_start=" << _start.getOrder() << " and time_start=" << _start.getTimeValue() << "\n";
2468 stream << "iteration_end=" << _end.getIteration() << " order_end=" << _end.getOrder() << " and end_time=" << _end.getTimeValue() << "\n";
2469 stream << "Time unit is : \"" << _time_unit << "\"";
2470 return stream.str();
2473 void MEDCouplingLinearTime::checkConsistencyLight() const
2475 MEDCouplingTwoTimeSteps::checkConsistencyLight();
2476 if(std::fabs(_start.getTimeValue()-_end.getTimeValue())<_time_tolerance)
2477 throw INTERP_KERNEL::Exception("Start time and end time are equals regarding time tolerance.");
2480 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::performCopyOrIncrRef(bool deepCopy) const
2482 return new MEDCouplingLinearTime(*this,deepCopy);
2485 bool MEDCouplingLinearTime::areCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
2487 if(!MEDCouplingTimeDiscretization::areCompatible(other))
2489 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2492 if(_end_array==0 && otherC->_end_array==0)
2494 if(_end_array==0 || otherC->_end_array==0)
2496 if(_end_array->getNumberOfComponents()!=otherC->_end_array->getNumberOfComponents())
2501 bool MEDCouplingLinearTime::areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const
2503 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
2505 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2508 reason.insert(0,"time discretization of this is LINEAR_TIME, other has a different time discretization.");
2512 bool MEDCouplingLinearTime::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
2514 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
2516 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2520 bool MEDCouplingLinearTime::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
2522 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
2524 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2527 if(_end_array==0 && otherC->_end_array==0)
2529 if(_end_array==0 || otherC->_end_array==0)
2531 int nbC1=_end_array->getNumberOfComponents();
2532 int nbC2=otherC->_end_array->getNumberOfComponents();
2533 if(nbC1!=nbC2 && nbC2!=1)
2538 bool MEDCouplingLinearTime::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
2540 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
2542 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2547 * vals is expected to be of size 2*_array->getNumberOfTuples()==_array->getNumberOfTuples()+_end_array->getNumberOfTuples()
2549 void MEDCouplingLinearTime::getValueForTime(double time, const std::vector<double>& vals, double *res) const
2551 double alpha=(_end.getTimeValue()-time)/(_end.getTimeValue()-_start.getTimeValue());
2552 std::size_t nbComp=vals.size()/2;
2553 std::transform(vals.begin(),vals.begin()+nbComp,res,std::bind2nd(std::multiplies<double>(),alpha));
2554 std::vector<double> tmp(nbComp);
2555 std::transform(vals.begin()+nbComp,vals.end(),tmp.begin(),std::bind2nd(std::multiplies<double>(),1-alpha));
2556 std::transform(tmp.begin(),tmp.end(),res,res,std::plus<double>());
2559 void MEDCouplingLinearTime::getValueOnTime(int eltId, double time, double *value) const
2561 double alpha=(_end.getTimeValue()-time)/(_end.getTimeValue()-_start.getTimeValue());
2564 _array->getTuple(eltId,value);
2566 throw INTERP_KERNEL::Exception("No start array existing.");
2567 nbComp=_array->getNumberOfComponents();
2568 std::transform(value,value+nbComp,value,std::bind2nd(std::multiplies<double>(),alpha));
2569 std::vector<double> tmp(nbComp);
2571 _end_array->getTuple(eltId,&tmp[0]);
2573 throw INTERP_KERNEL::Exception("No end array existing.");
2574 std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::multiplies<double>(),1-alpha));
2575 std::transform(tmp.begin(),tmp.end(),value,value,std::plus<double>());
2578 void MEDCouplingLinearTime::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
2580 if(iteration==_start.getIteration() && order==_start.getOrder())
2583 _array->getTuple(eltId,value);
2585 throw INTERP_KERNEL::Exception("iteration order match with start time but no start array existing.");
2587 if(iteration==_end.getIteration() && order==_end.getOrder())
2590 _end_array->getTuple(eltId,value);
2592 throw INTERP_KERNEL::Exception("iteration order match with end time but no end array existing.");
2595 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
2598 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const MEDCouplingTimeDiscretization *other) const
2600 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2602 throw INTERP_KERNEL::Exception("LinearTime::aggregation on mismatched time discretization !");
2603 MCAuto<DataArrayDouble> arr1=DataArrayDouble::Aggregate(getArray(),other->getArray());
2604 MCAuto<DataArrayDouble> arr2=DataArrayDouble::Aggregate(getEndArray(),other->getEndArray());
2605 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2606 ret->setArray(arr1,0);
2607 ret->setEndArray(arr2,0);
2611 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
2613 std::vector<const DataArrayDouble *> a(other.size());
2614 std::vector<const DataArrayDouble *> b(other.size());
2616 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
2618 const MEDCouplingLinearTime *itC=dynamic_cast<const MEDCouplingLinearTime *>(*it);
2620 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::aggregate on mismatched time discretization !");
2621 a[i]=itC->getArray();
2622 b[i]=itC->getEndArray();
2624 MCAuto<DataArrayDouble> arr(DataArrayDouble::Aggregate(a)),arr2(DataArrayDouble::Aggregate(b));
2625 MEDCouplingLinearTime *ret(new MEDCouplingLinearTime);
2626 ret->setArray(arr,0);
2627 ret->setEndArray(arr2,0);
2631 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::meld(const MEDCouplingTimeDiscretization *other) const
2633 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2635 throw INTERP_KERNEL::Exception("LinearTime::meld on mismatched time discretization !");
2636 MCAuto<DataArrayDouble> arr1(DataArrayDouble::Meld(getArray(),other->getArray())),arr2(DataArrayDouble::Meld(getEndArray(),other->getEndArray()));
2637 MEDCouplingLinearTime *ret(new MEDCouplingLinearTime);
2638 ret->setTimeTolerance(getTimeTolerance());
2639 ret->setArray(arr1,0);
2640 ret->setEndArray(arr2,0);
2644 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::dot(const MEDCouplingTimeDiscretization *other) const
2646 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2648 throw INTERP_KERNEL::Exception("LinearTime::dot on mismatched time discretization !");
2649 MCAuto<DataArrayDouble> arr1(DataArrayDouble::Dot(getArray(),other->getArray())),arr2(DataArrayDouble::Dot(getEndArray(),other->getEndArray()));
2650 MEDCouplingLinearTime *ret(new MEDCouplingLinearTime);
2651 ret->setArray(arr1,0);
2652 ret->setEndArray(arr2,0);
2656 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::crossProduct(const MEDCouplingTimeDiscretization *other) const
2658 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2660 throw INTERP_KERNEL::Exception("LinearTime::crossProduct on mismatched time discretization !");
2661 MCAuto<DataArrayDouble> arr1(DataArrayDouble::CrossProduct(getArray(),other->getArray())),arr2(DataArrayDouble::CrossProduct(getEndArray(),other->getEndArray()));
2662 MEDCouplingLinearTime *ret(new MEDCouplingLinearTime);
2663 ret->setArray(arr1,0);
2664 ret->setEndArray(arr2,0);
2668 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::max(const MEDCouplingTimeDiscretization *other) const
2670 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2672 throw INTERP_KERNEL::Exception("LinearTime::max on mismatched time discretization !");
2673 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2674 MCAuto<DataArrayDouble> arr1(DataArrayDouble::Max(getArray(),other->getArray())),arr2(DataArrayDouble::Max(getEndArray(),other->getEndArray()));
2675 ret->setArray(arr1,0);
2676 ret->setEndArray(arr2,0);
2680 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::min(const MEDCouplingTimeDiscretization *other) const
2682 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2684 throw INTERP_KERNEL::Exception("LinearTime::min on mismatched time discretization !");
2685 MCAuto<DataArrayDouble> arr1(DataArrayDouble::Min(getArray(),other->getArray())),arr2(DataArrayDouble::Min(getEndArray(),other->getEndArray()));
2686 MEDCouplingLinearTime *ret(new MEDCouplingLinearTime);
2687 ret->setArray(arr1,0);
2688 ret->setEndArray(arr2,0);
2692 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::add(const MEDCouplingTimeDiscretization *other) const
2694 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2696 throw INTERP_KERNEL::Exception("LinearTime::add on mismatched time discretization !");
2697 MCAuto<DataArrayDouble> arr1(DataArrayDouble::Add(getArray(),other->getArray())),arr2(DataArrayDouble::Add(getEndArray(),other->getEndArray()));
2698 MEDCouplingLinearTime *ret(new MEDCouplingLinearTime);
2699 ret->setArray(arr1,0);
2700 ret->setEndArray(arr2,0);
2704 void MEDCouplingLinearTime::addEqual(const MEDCouplingTimeDiscretization *other)
2706 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2708 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2710 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::addEqual : Data Array is NULL !");
2712 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::addEqual : Data Array (end) is NULL !");
2713 getArray()->addEqual(other->getArray());
2714 getEndArray()->addEqual(other->getEndArray());
2717 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::substract(const MEDCouplingTimeDiscretization *other) const
2719 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2721 throw INTERP_KERNEL::Exception("LinearTime::substract on mismatched time discretization !");
2722 MCAuto<DataArrayDouble> arr1=DataArrayDouble::Substract(getArray(),other->getArray());
2723 MCAuto<DataArrayDouble> arr2=DataArrayDouble::Substract(getEndArray(),other->getEndArray());
2724 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2725 ret->setArray(arr1,0);
2726 ret->setEndArray(arr2,0);
2730 void MEDCouplingLinearTime::substractEqual(const MEDCouplingTimeDiscretization *other)
2732 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2734 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2736 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::substractEqual : Data Array is NULL !");
2738 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::substractEqual : Data Array (end) is NULL !");
2739 getArray()->substractEqual(other->getArray());
2740 getEndArray()->substractEqual(other->getEndArray());
2743 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::multiply(const MEDCouplingTimeDiscretization *other) const
2745 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2747 throw INTERP_KERNEL::Exception("LinearTime::multiply on mismatched time discretization !");
2748 MCAuto<DataArrayDouble> arr1=DataArrayDouble::Multiply(getArray(),other->getArray());
2749 MCAuto<DataArrayDouble> arr2=DataArrayDouble::Multiply(getEndArray(),other->getEndArray());
2750 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2751 ret->setArray(arr1,0);
2752 ret->setEndArray(arr2,0);
2756 void MEDCouplingLinearTime::multiplyEqual(const MEDCouplingTimeDiscretization *other)
2758 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2760 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2762 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::multiplyEqual : Data Array is NULL !");
2764 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::multiplyEqual : Data Array (end) is NULL !");
2765 getArray()->multiplyEqual(other->getArray());
2766 getEndArray()->multiplyEqual(other->getEndArray());
2769 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::divide(const MEDCouplingTimeDiscretization *other) const
2771 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2773 throw INTERP_KERNEL::Exception("LinearTime::divide on mismatched time discretization !");
2774 MCAuto<DataArrayDouble> arr1=DataArrayDouble::Divide(getArray(),other->getArray());
2775 MCAuto<DataArrayDouble> arr2=DataArrayDouble::Divide(getEndArray(),other->getEndArray());
2776 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2777 ret->setArray(arr1,0);
2778 ret->setEndArray(arr2,0);
2782 void MEDCouplingLinearTime::divideEqual(const MEDCouplingTimeDiscretization *other)
2784 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2786 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2788 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::divideEqual : Data Array is NULL !");
2790 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::divideEqual : Data Array (end) is NULL !");
2791 getArray()->divideEqual(other->getArray());
2792 getEndArray()->divideEqual(other->getEndArray());
2795 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::pow(const MEDCouplingTimeDiscretization *other) const
2797 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2799 throw INTERP_KERNEL::Exception("LinearTime::pow on mismatched time discretization !");
2800 MCAuto<DataArrayDouble> arr1=DataArrayDouble::Pow(getArray(),other->getArray());
2801 MCAuto<DataArrayDouble> arr2=DataArrayDouble::Pow(getEndArray(),other->getEndArray());
2802 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2803 ret->setArray(arr1,0);
2804 ret->setEndArray(arr2,0);
2808 void MEDCouplingLinearTime::powEqual(const MEDCouplingTimeDiscretization *other)
2810 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2812 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2814 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::powEqual : Data Array is NULL !");
2816 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::powEqual : Data Array (end) is NULL !");
2817 getArray()->powEqual(other->getArray());
2818 getEndArray()->powEqual(other->getEndArray());