1 // Copyright (C) 2007-2014 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.hxx"
22 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
23 #include "MEDCouplingMemArray.hxx"
24 #include "MEDCouplingMesh.hxx"
32 using namespace ParaMEDMEM;
34 const double MEDCouplingTimeDiscretization::TIME_TOLERANCE_DFT=1.e-12;
36 const char MEDCouplingNoTimeLabel::EXCEPTION_MSG[]="MEDCouplingNoTimeLabel::setTime : no time info attached.";
38 const char MEDCouplingNoTimeLabel::REPR[]="No time label defined.";
40 const char MEDCouplingWithTimeStep::EXCEPTION_MSG[]="No data on this time.";
42 const char MEDCouplingWithTimeStep::REPR[]="One time label.";
44 const char MEDCouplingConstOnTimeInterval::EXCEPTION_MSG[]="No data on this time.";
46 const char MEDCouplingConstOnTimeInterval::REPR[]="Constant on a time interval.";
48 const char MEDCouplingTwoTimeSteps::EXCEPTION_MSG[]="No data on this time.";
50 const char MEDCouplingLinearTime::REPR[]="Linear time between 2 time steps.";
52 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::New(TypeOfTimeDiscretization type)
56 case MEDCouplingNoTimeLabel::DISCRETIZATION:
57 return new MEDCouplingNoTimeLabel;
58 case MEDCouplingWithTimeStep::DISCRETIZATION:
59 return new MEDCouplingWithTimeStep;
60 case MEDCouplingConstOnTimeInterval::DISCRETIZATION:
61 return new MEDCouplingConstOnTimeInterval;
62 case MEDCouplingLinearTime::DISCRETIZATION:
63 return new MEDCouplingLinearTime;
65 throw INTERP_KERNEL::Exception("Time discretization not implemented yet");
69 void MEDCouplingTimeDiscretization::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
71 _time_tolerance=other._time_tolerance;
72 _time_unit=other._time_unit;
75 void MEDCouplingTimeDiscretization::copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other)
77 _time_unit=other._time_unit;
78 if(_array && other._array)
79 _array->copyStringInfoFrom(*other._array);
82 void MEDCouplingTimeDiscretization::checkCoherency() const
85 throw INTERP_KERNEL::Exception("Field invalid because no values set !");
86 if(_time_tolerance<0.)
87 throw INTERP_KERNEL::Exception("time tolerance is expected to be greater than 0. !");
90 void MEDCouplingTimeDiscretization::updateTime() const
93 updateTimeWith(*_array);
96 std::size_t MEDCouplingTimeDiscretization::getHeapMemorySizeWithoutChildren() const
98 std::size_t ret(_time_unit.capacity());
102 std::vector<const BigMemoryObject *> MEDCouplingTimeDiscretization::getDirectChildrenWithNull() const
104 std::vector<const BigMemoryObject *> ret;
105 ret.push_back(_array);
109 bool MEDCouplingTimeDiscretization::areCompatible(const MEDCouplingTimeDiscretization *other) const
111 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
113 if(_array==0 && other->_array==0)
115 if(_array==0 || other->_array==0)
117 if(_array->getNumberOfComponents()!=other->_array->getNumberOfComponents())
122 bool MEDCouplingTimeDiscretization::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
124 std::ostringstream oss; oss.precision(15);
125 if(_time_unit!=other->_time_unit)
127 oss << "Field discretizations differ : this time unit = \"" << _time_unit << "\" and other time unit = \"" << other->_time_unit << "\" !";
131 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
133 oss << "Field discretizations differ : this time tolerance = \"" << _time_tolerance << "\" and other time tolerance = \"" << other->_time_tolerance << "\" !";
137 if(_array==0 && other->_array==0)
139 if(_array==0 || other->_array==0)
141 reason="Field discretizations differ : Only one timediscretization between the two this and other has a DataArrayDouble for values defined";
144 if(_array->getNumberOfComponents()!=other->_array->getNumberOfComponents())
146 if(_array->getNumberOfTuples()!=other->_array->getNumberOfTuples())
151 bool MEDCouplingTimeDiscretization::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
153 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
155 if(_array==0 && other->_array==0)
157 if(_array==0 || other->_array==0)
159 if(_array->getNumberOfTuples()!=other->_array->getNumberOfTuples())
164 bool MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
166 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
168 if(_array==0 && other->_array==0)
170 if(_array==0 || other->_array==0)
172 int nbC1=_array->getNumberOfComponents();
173 int nbC2=other->_array->getNumberOfComponents();
174 int nbMin=std::min(nbC1,nbC2);
175 if(nbC1!=nbC2 && nbMin!=1)
180 bool MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
182 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
184 if(_array==0 && other->_array==0)
186 if(_array==0 || other->_array==0)
188 int nbC1=_array->getNumberOfComponents();
189 int nbC2=other->_array->getNumberOfComponents();
190 if(nbC1!=nbC2 && nbC2!=1)
195 bool MEDCouplingTimeDiscretization::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
197 if(!areStrictlyCompatible(other,reason))
199 if(_array==other->_array)
201 return _array->isEqualIfNotWhy(*other->_array,prec,reason);
204 bool MEDCouplingTimeDiscretization::isEqual(const MEDCouplingTimeDiscretization *other, double prec) const
207 return isEqualIfNotWhy(other,prec,reason);
210 bool MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
213 if(!areStrictlyCompatible(other,tmp))
215 if(_array==other->_array)
217 return _array->isEqualWithoutConsideringStr(*other->_array,prec);
220 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const
222 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(type);
223 ret->setTimeUnit(getTimeUnit());
224 const DataArrayDouble *arrSrc=getArray();
225 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr;
227 arr=arrSrc->performCpy(deepCpy);
228 ret->setArray(arr,0);
232 void MEDCouplingTimeDiscretization::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
236 tinyInfo.push_back(_array->getNumberOfTuples());
237 tinyInfo.push_back(_array->getNumberOfComponents());
241 tinyInfo.push_back(-1);
242 tinyInfo.push_back(-1);
246 void MEDCouplingTimeDiscretization::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
251 DataArrayDouble *arr=0;
252 if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
254 arr=DataArrayDouble::New();
255 arr->alloc(tinyInfoI[0],tinyInfoI[1]);
261 void MEDCouplingTimeDiscretization::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
263 _time_tolerance=tinyInfoD[0];
264 int nbOfCompo=_array->getNumberOfComponents();
265 for(int i=0;i<nbOfCompo;i++)
266 _array->setInfoOnComponent(i,tinyInfoS[i]);
269 void MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
271 tinyInfo.push_back(_time_tolerance);
274 void MEDCouplingTimeDiscretization::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
276 int nbOfCompo=_array->getNumberOfComponents();
277 for(int i=0;i<nbOfCompo;i++)
278 tinyInfo.push_back(_array->getInfoOnComponent(i));
281 MEDCouplingTimeDiscretization::MEDCouplingTimeDiscretization():_time_tolerance(TIME_TOLERANCE_DFT),_array(0)
285 MEDCouplingTimeDiscretization::MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCpy):_time_unit(other._time_unit),_time_tolerance(other._time_tolerance)
288 _array=other._array->performCpy(deepCpy);
293 MEDCouplingTimeDiscretization::~MEDCouplingTimeDiscretization()
299 void MEDCouplingTimeDiscretization::setArray(DataArrayDouble *array, TimeLabel *owner)
309 owner->declareAsNew();
313 const DataArrayDouble *MEDCouplingTimeDiscretization::getEndArray() const
315 throw INTERP_KERNEL::Exception("getEndArray not available for this type of time discretization !");
318 DataArrayDouble *MEDCouplingTimeDiscretization::getEndArray()
320 throw INTERP_KERNEL::Exception("getEndArray not available for this type of time discretization !");
323 void MEDCouplingTimeDiscretization::setEndArray(DataArrayDouble *array, TimeLabel *owner)
325 throw INTERP_KERNEL::Exception("setEndArray not available for this type of time discretization !");
328 void MEDCouplingTimeDiscretization::setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner)
331 throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretization::setArrays : number of arrays must be one.");
332 setArray(arrays.back(),owner);
335 void MEDCouplingTimeDiscretization::getArrays(std::vector<DataArrayDouble *>& arrays) const
341 bool MEDCouplingTimeDiscretization::isBefore(const MEDCouplingTimeDiscretization *other) const
344 double time1=getEndTime(iteration,order)-_time_tolerance;
345 double time2=other->getStartTime(iteration,order)+other->getTimeTolerance();
349 bool MEDCouplingTimeDiscretization::isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const
352 double time1=getEndTime(iteration,order)+_time_tolerance;
353 double time2=other->getStartTime(iteration,order)-other->getTimeTolerance();
357 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::doublyContractedProduct() const
359 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
360 ret->setTimeUnit(getTimeUnit());
361 std::vector<DataArrayDouble *> arrays;
363 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
364 for(std::size_t j=0;j<arrays.size();j++)
367 arrays2[j]=arrays[j]->doublyContractedProduct();
371 std::vector<DataArrayDouble *> arrays3(arrays.size());
372 for(std::size_t j=0;j<arrays.size();j++)
373 arrays3[j]=arrays2[j];
374 ret->setArrays(arrays3,0);
378 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::determinant() const
380 std::vector<DataArrayDouble *> arrays;
382 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
383 for(std::size_t j=0;j<arrays.size();j++)
386 arrays2[j]=arrays[j]->determinant();
390 std::vector<DataArrayDouble *> arrays3(arrays.size());
391 for(std::size_t j=0;j<arrays.size();j++)
392 arrays3[j]=arrays2[j];
393 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
394 ret->setTimeUnit(getTimeUnit());
395 ret->setArrays(arrays3,0);
399 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenValues() const
401 std::vector<DataArrayDouble *> arrays;
403 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
404 for(std::size_t j=0;j<arrays.size();j++)
407 arrays2[j]=arrays[j]->eigenValues();
411 std::vector<DataArrayDouble *> arrays3(arrays.size());
412 for(std::size_t j=0;j<arrays.size();j++)
413 arrays3[j]=arrays2[j];
414 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
415 ret->setTimeUnit(getTimeUnit());
416 ret->setArrays(arrays3,0);
420 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenVectors() const
422 std::vector<DataArrayDouble *> arrays;
424 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
425 for(std::size_t j=0;j<arrays.size();j++)
428 arrays2[j]=arrays[j]->eigenVectors();
432 std::vector<DataArrayDouble *> arrays3(arrays.size());
433 for(std::size_t j=0;j<arrays.size();j++)
434 arrays3[j]=arrays2[j];
435 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
436 ret->setTimeUnit(getTimeUnit());
437 ret->setArrays(arrays3,0);
441 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::inverse() const
443 std::vector<DataArrayDouble *> arrays;
445 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
446 for(std::size_t j=0;j<arrays.size();j++)
449 arrays2[j]=arrays[j]->inverse();
453 std::vector<DataArrayDouble *> arrays3(arrays.size());
454 for(std::size_t j=0;j<arrays.size();j++)
455 arrays3[j]=arrays2[j];
456 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
457 ret->setTimeUnit(getTimeUnit());
458 ret->setArrays(arrays3,0);
462 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::trace() const
464 std::vector<DataArrayDouble *> arrays;
466 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
467 for(std::size_t j=0;j<arrays.size();j++)
470 arrays2[j]=arrays[j]->trace();
474 std::vector<DataArrayDouble *> arrays3(arrays.size());
475 for(std::size_t j=0;j<arrays.size();j++)
476 arrays3[j]=arrays2[j];
477 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
478 ret->setTimeUnit(getTimeUnit());
479 ret->setArrays(arrays3,0);
483 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::deviator() const
485 std::vector<DataArrayDouble *> arrays;
487 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
488 for(std::size_t j=0;j<arrays.size();j++)
491 arrays2[j]=arrays[j]->deviator();
495 std::vector<DataArrayDouble *> arrays3(arrays.size());
496 for(std::size_t j=0;j<arrays.size();j++)
497 arrays3[j]=arrays2[j];
498 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
499 ret->setTimeUnit(getTimeUnit());
500 ret->setArrays(arrays3,0);
504 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::magnitude() const
506 std::vector<DataArrayDouble *> arrays;
508 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
509 for(std::size_t j=0;j<arrays.size();j++)
512 arrays2[j]=arrays[j]->magnitude();
516 std::vector<DataArrayDouble *> arrays3(arrays.size());
517 for(std::size_t j=0;j<arrays.size();j++)
518 arrays3[j]=arrays2[j];
519 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
520 ret->setTimeUnit(getTimeUnit());
521 ret->setArrays(arrays3,0);
525 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::negate() const
527 std::vector<DataArrayDouble *> arrays;
529 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
530 for(std::size_t j=0;j<arrays.size();j++)
533 arrays2[j]=arrays[j]->negate();
537 std::vector<DataArrayDouble *> arrays3(arrays.size());
538 for(std::size_t j=0;j<arrays.size();j++)
539 arrays3[j]=arrays2[j];
540 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
541 ret->setTimeUnit(getTimeUnit());
542 ret->setArrays(arrays3,0);
546 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::maxPerTuple() const
548 std::vector<DataArrayDouble *> arrays;
550 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
551 for(std::size_t j=0;j<arrays.size();j++)
554 arrays2[j]=arrays[j]->maxPerTuple();
558 std::vector<DataArrayDouble *> arrays3(arrays.size());
559 for(std::size_t j=0;j<arrays.size();j++)
560 arrays3[j]=arrays2[j];
561 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
562 ret->setTimeUnit(getTimeUnit());
563 ret->setArrays(arrays3,0);
567 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedComponents(const std::vector<int>& compoIds) const
569 std::vector<DataArrayDouble *> arrays;
571 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
572 for(std::size_t j=0;j<arrays.size();j++)
575 arrays2[j]=static_cast<DataArrayDouble *>(arrays[j]->keepSelectedComponents(compoIds));
579 std::vector<DataArrayDouble *> arrays3(arrays.size());
580 for(std::size_t j=0;j<arrays.size();j++)
581 arrays3[j]=arrays2[j];
582 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
583 ret->setTimeUnit(getTimeUnit());
584 ret->setArrays(arrays3,0);
588 void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds)
590 std::vector<DataArrayDouble *> arrays1,arrays2;
592 other->getArrays(arrays2);
593 if(arrays1.size()!=arrays2.size())
594 throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : number of arrays mismatch !");
595 for(std::size_t i=0;i<arrays1.size();i++)
597 if(arrays1[i]!=0 && arrays2[i]!=0)
598 arrays1[i]->setSelectedComponents(arrays2[i],compoIds);
599 else if(arrays1[i]!=0 || arrays2[i]!=0)
600 throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : some time array in correspondance are not defined symetrically !");
604 void MEDCouplingTimeDiscretization::changeNbOfComponents(int newNbOfComp, double dftValue)
606 std::vector<DataArrayDouble *> arrays;
608 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
609 for(std::size_t j=0;j<arrays.size();j++)
612 arrays2[j]=arrays[j]->changeNbOfComponents(newNbOfComp,dftValue);
616 std::vector<DataArrayDouble *> arrays3(arrays.size());
617 for(std::size_t j=0;j<arrays.size();j++)
618 arrays3[j]=arrays2[j];
619 setArrays(arrays3,0);
622 void MEDCouplingTimeDiscretization::sortPerTuple(bool asc)
624 std::vector<DataArrayDouble *> arrays;
626 for(std::size_t j=0;j<arrays.size();j++)
629 arrays[j]->sortPerTuple(asc);
633 void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, int nbOfCompo, double value)
635 std::vector<DataArrayDouble *> arrays;
637 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
638 for(std::size_t j=0;j<arrays.size();j++)
642 arrays2[j]=arrays[j]->changeNbOfComponents(nbOfCompo,value);
643 arrays2[j]->fillWithValue(value);
647 arrays2[j]=DataArrayDouble::New();
648 arrays2[j]->alloc(nbOfTuple,nbOfCompo);
649 arrays2[j]->fillWithValue(value);
652 std::vector<DataArrayDouble *> arrays3(arrays.size());
653 for(std::size_t j=0;j<arrays.size();j++)
654 arrays3[j]=arrays2[j];
655 setArrays(arrays3,0);
658 void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value)
660 std::vector<DataArrayDouble *> arrays;
662 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
664 for(std::size_t j=0;j<arrays.size();j++)
668 arrays2[j]=arrays[j]; arrays2[j]->incrRef();
669 arrays2[j]->fillWithValue(value);
674 arrays2[j]=DataArrayDouble::New();
675 arrays2[j]->alloc(nbOfTuple,1);
676 arrays2[j]->fillWithValue(value);
681 std::vector<DataArrayDouble *> arrays3(arrays.size());
682 for(std::size_t j=0;j<arrays.size();j++)
683 arrays3[j]=arrays2[j];
684 setArrays(arrays3,0);
688 void MEDCouplingTimeDiscretization::applyLin(double a, double b, int compoId)
690 std::vector<DataArrayDouble *> arrays;
692 for(std::size_t j=0;j<arrays.size();j++)
695 arrays[j]->applyLin(a,b,compoId);
699 void MEDCouplingTimeDiscretization::applyLin(double a, double b)
701 std::vector<DataArrayDouble *> arrays;
703 for(std::size_t j=0;j<arrays.size();j++)
706 arrays[j]->applyLin(a,b);
710 void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, FunctionToEvaluate func)
712 std::vector<DataArrayDouble *> arrays;
714 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
715 for(std::size_t j=0;j<arrays.size();j++)
718 arrays2[j]=arrays[j]->applyFunc(nbOfComp,func);
722 std::vector<DataArrayDouble *> arrays3(arrays.size());
723 for(std::size_t j=0;j<arrays.size();j++)
724 arrays3[j]=arrays2[j];
725 setArrays(arrays3,0);
728 void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const std::string& func)
730 std::vector<DataArrayDouble *> arrays;
732 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
733 for(std::size_t j=0;j<arrays.size();j++)
736 arrays2[j]=arrays[j]->applyFunc(nbOfComp,func);
740 std::vector<DataArrayDouble *> arrays3(arrays.size());
741 for(std::size_t j=0;j<arrays.size();j++)
742 arrays3[j]=arrays2[j];
743 setArrays(arrays3,0);
746 void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const std::string& func)
748 std::vector<DataArrayDouble *> arrays;
750 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
751 for(std::size_t j=0;j<arrays.size();j++)
754 arrays2[j]=arrays[j]->applyFunc2(nbOfComp,func);
758 std::vector<DataArrayDouble *> arrays3(arrays.size());
759 for(std::size_t j=0;j<arrays.size();j++)
760 arrays3[j]=arrays2[j];
761 setArrays(arrays3,0);
764 void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
766 std::vector<DataArrayDouble *> arrays;
768 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
769 for(std::size_t j=0;j<arrays.size();j++)
772 arrays2[j]=arrays[j]->applyFunc3(nbOfComp,varsOrder,func);
776 std::vector<DataArrayDouble *> arrays3(arrays.size());
777 for(std::size_t j=0;j<arrays.size();j++)
778 arrays3[j]=arrays2[j];
779 setArrays(arrays3,0);
782 void MEDCouplingTimeDiscretization::applyFunc(const std::string& func)
784 std::vector<DataArrayDouble *> arrays;
786 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
787 for(std::size_t j=0;j<arrays.size();j++)
790 arrays2[j]=arrays[j]->applyFunc(func);
794 std::vector<DataArrayDouble *> arrays3(arrays.size());
795 for(std::size_t j=0;j<arrays.size();j++)
796 arrays3[j]=arrays2[j];
797 setArrays(arrays3,0);
800 void MEDCouplingTimeDiscretization::applyFuncFast32(const std::string& func)
802 std::vector<DataArrayDouble *> arrays;
804 for(std::size_t j=0;j<arrays.size();j++)
807 arrays[j]->applyFuncFast32(func);
811 void MEDCouplingTimeDiscretization::applyFuncFast64(const std::string& func)
813 std::vector<DataArrayDouble *> arrays;
815 for(std::size_t j=0;j<arrays.size();j++)
818 arrays[j]->applyFuncFast64(func);
822 void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func)
824 std::vector<DataArrayDouble *> arrays;
826 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
827 for(std::size_t j=0;j<arrays.size();j++)
828 arrays2[j]=loc->applyFunc(nbOfComp,func);
829 std::vector<DataArrayDouble *> arrays3(arrays.size());
830 for(std::size_t j=0;j<arrays.size();j++)
831 arrays3[j]=arrays2[j];
832 setArrays(arrays3,0);
835 void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const std::string& func)
837 std::vector<DataArrayDouble *> arrays;
839 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
840 for(std::size_t j=0;j<arrays.size();j++)
841 arrays2[j]=loc->applyFunc(nbOfComp,func);
842 std::vector<DataArrayDouble *> arrays3(arrays.size());
843 for(std::size_t j=0;j<arrays.size();j++)
844 arrays3[j]=arrays2[j];
845 setArrays(arrays3,0);
848 void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const std::string& func)
850 std::vector<DataArrayDouble *> arrays;
852 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
853 for(std::size_t j=0;j<arrays.size();j++)
854 arrays2[j]=loc->applyFunc2(nbOfComp,func);
855 std::vector<DataArrayDouble *> arrays3(arrays.size());
856 for(std::size_t j=0;j<arrays.size();j++)
857 arrays3[j]=arrays2[j];
858 setArrays(arrays3,0);
861 void MEDCouplingTimeDiscretization::fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
863 std::vector<DataArrayDouble *> arrays;
865 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
866 for(std::size_t j=0;j<arrays.size();j++)
867 arrays2[j]=loc->applyFunc3(nbOfComp,varsOrder,func);
868 std::vector<DataArrayDouble *> arrays3(arrays.size());
869 for(std::size_t j=0;j<arrays.size();j++)
870 arrays3[j]=arrays2[j];
871 setArrays(arrays3,0);
874 MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel()
878 MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy)
882 std::string MEDCouplingNoTimeLabel::getStringRepr() const
884 std::ostringstream stream;
886 stream << "\nTime unit is : \"" << _time_unit << "\"";
890 void MEDCouplingNoTimeLabel::synchronizeTimeWith(const MEDCouplingMesh *mesh)
892 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::synchronizeTimeWith : impossible to synchronize time with a MEDCouplingMesh because the time discretization is incompatible with it !");
895 bool MEDCouplingNoTimeLabel::areCompatible(const MEDCouplingTimeDiscretization *other) const
897 if(!MEDCouplingTimeDiscretization::areCompatible(other))
899 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
903 bool MEDCouplingNoTimeLabel::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
905 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
907 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
910 reason.insert(0,"time discretization of this is NO_TIME, other has a different time discretization.");
914 bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
916 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
918 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
922 bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
924 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
926 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
930 bool MEDCouplingNoTimeLabel::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
932 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
934 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
938 bool MEDCouplingNoTimeLabel::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
940 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
943 reason="This has time discretization NO_TIME, other not.";
946 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
949 bool MEDCouplingNoTimeLabel::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
951 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
954 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
957 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const MEDCouplingTimeDiscretization *other) const
959 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
961 throw INTERP_KERNEL::Exception("NoTimeLabel::aggregation on mismatched time discretization !");
962 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
963 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
964 ret->setArray(arr,0);
968 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
970 std::vector<const DataArrayDouble *> a(other.size());
972 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
974 const MEDCouplingNoTimeLabel *itC=dynamic_cast<const MEDCouplingNoTimeLabel *>(*it);
976 throw INTERP_KERNEL::Exception("NoTimeLabel::aggregate on mismatched time discretization !");
977 a[i]=itC->getArray();
979 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
980 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
981 ret->setArray(arr,0);
985 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::meld(const MEDCouplingTimeDiscretization *other) const
987 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
989 throw INTERP_KERNEL::Exception("NoTimeLabel::meld on mismatched time discretization !");
990 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
991 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
992 ret->setTimeTolerance(getTimeTolerance());
993 ret->setArray(arr,0);
997 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::dot(const MEDCouplingTimeDiscretization *other) const
999 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1001 throw INTERP_KERNEL::Exception("NoTimeLabel::dot on mismatched time discretization !");
1002 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
1003 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1004 ret->setArray(arr,0);
1008 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::crossProduct(const MEDCouplingTimeDiscretization *other) const
1010 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1012 throw INTERP_KERNEL::Exception("NoTimeLabel::crossProduct on mismatched time discretization !");
1013 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
1014 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1015 ret->setArray(arr,0);
1019 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::max(const MEDCouplingTimeDiscretization *other) const
1021 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1023 throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
1024 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
1025 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1026 ret->setArray(arr,0);
1030 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::min(const MEDCouplingTimeDiscretization *other) const
1032 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1034 throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
1035 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
1036 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1037 ret->setArray(arr,0);
1041 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::add(const MEDCouplingTimeDiscretization *other) const
1043 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1045 throw INTERP_KERNEL::Exception("NoTimeLabel::add on mismatched time discretization !");
1046 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
1047 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1048 ret->setArray(arr,0);
1052 void MEDCouplingNoTimeLabel::addEqual(const MEDCouplingTimeDiscretization *other)
1054 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1056 throw INTERP_KERNEL::Exception("NoTimeLabel::addEqual on mismatched time discretization !");
1058 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::addEqual : Data Array is NULL !");
1059 getArray()->addEqual(other->getArray());
1062 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::substract(const MEDCouplingTimeDiscretization *other) const
1064 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1066 throw INTERP_KERNEL::Exception("NoTimeLabel::substract on mismatched time discretization !");
1068 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::substract : Data Array is NULL !");
1069 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
1070 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1071 ret->setArray(arr,0);
1075 void MEDCouplingNoTimeLabel::substractEqual(const MEDCouplingTimeDiscretization *other)
1077 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1079 throw INTERP_KERNEL::Exception("NoTimeLabel::substractEqual on mismatched time discretization !");
1081 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::substractEqual : Data Array is NULL !");
1082 getArray()->substractEqual(other->getArray());
1085 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::multiply(const MEDCouplingTimeDiscretization *other) const
1087 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1089 throw INTERP_KERNEL::Exception("NoTimeLabel::multiply on mismatched time discretization !");
1090 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
1091 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1092 ret->setArray(arr,0);
1096 void MEDCouplingNoTimeLabel::multiplyEqual(const MEDCouplingTimeDiscretization *other)
1098 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1100 throw INTERP_KERNEL::Exception("NoTimeLabel::multiplyEqual on mismatched time discretization !");
1102 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::multiplyEqual : Data Array is NULL !");
1103 getArray()->multiplyEqual(other->getArray());
1106 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::divide(const MEDCouplingTimeDiscretization *other) const
1108 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1110 throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
1111 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
1112 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1113 ret->setArray(arr,0);
1117 void MEDCouplingNoTimeLabel::divideEqual(const MEDCouplingTimeDiscretization *other)
1119 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1121 throw INTERP_KERNEL::Exception("NoTimeLabel::divideEqual on mismatched time discretization !");
1123 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::divideEqual : Data Array is NULL !");
1124 getArray()->divideEqual(other->getArray());
1127 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::pow(const MEDCouplingTimeDiscretization *other) const
1129 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1131 throw INTERP_KERNEL::Exception("pow on mismatched time discretization !");
1132 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
1133 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1134 ret->setArray(arr,0);
1138 void MEDCouplingNoTimeLabel::powEqual(const MEDCouplingTimeDiscretization *other)
1140 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1142 throw INTERP_KERNEL::Exception("NoTimeLabel::powEqual on mismatched time discretization !");
1144 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::powEqual : Data Array is NULL !");
1145 getArray()->powEqual(other->getArray());
1148 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::performCpy(bool deepCpy) const
1150 return new MEDCouplingNoTimeLabel(*this,deepCpy);
1153 void MEDCouplingNoTimeLabel::checkTimePresence(double time) const
1155 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1158 std::vector< const DataArrayDouble *> MEDCouplingNoTimeLabel::getArraysForTime(double time) const
1160 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1163 void MEDCouplingNoTimeLabel::getValueForTime(double time, const std::vector<double>& vals, double *res) const
1165 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1168 bool MEDCouplingNoTimeLabel::isBefore(const MEDCouplingTimeDiscretization *other) const
1170 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1173 bool MEDCouplingNoTimeLabel::isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const
1175 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1178 double MEDCouplingNoTimeLabel::getStartTime(int& iteration, int& order) const
1180 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1183 double MEDCouplingNoTimeLabel::getEndTime(int& iteration, int& order) const
1185 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1188 void MEDCouplingNoTimeLabel::setStartIteration(int it)
1190 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1193 void MEDCouplingNoTimeLabel::setEndIteration(int it)
1195 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1198 void MEDCouplingNoTimeLabel::setStartOrder(int order)
1200 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1203 void MEDCouplingNoTimeLabel::setEndOrder(int order)
1205 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1208 void MEDCouplingNoTimeLabel::setStartTimeValue(double time)
1210 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1213 void MEDCouplingNoTimeLabel::setEndTimeValue(double time)
1215 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1218 void MEDCouplingNoTimeLabel::setStartTime(double time, int iteration, int order)
1220 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1223 void MEDCouplingNoTimeLabel::setEndTime(double time, int iteration, int order)
1225 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1228 void MEDCouplingNoTimeLabel::getValueOnTime(int eltId, double time, double *value) const
1230 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1233 void MEDCouplingNoTimeLabel::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
1235 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1239 * idem getTinySerializationIntInformation except that it is for multi field fetch
1241 void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
1247 * idem getTinySerializationDbleInformation except that it is for multi field fetch
1249 void MEDCouplingNoTimeLabel::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
1252 tinyInfo[0]=_time_tolerance;
1256 * idem finishUnserialization except that it is for multi field fetch
1258 void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
1260 _time_tolerance=tinyInfoD[0];
1263 MEDCouplingWithTimeStep::MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy),
1264 _time(other._time),_iteration(other._iteration),_order(other._order)
1268 MEDCouplingWithTimeStep::MEDCouplingWithTimeStep():_time(0.),_iteration(-1),_order(-1)
1272 std::string MEDCouplingWithTimeStep::getStringRepr() const
1274 std::ostringstream stream;
1275 stream << REPR << " Time is defined by iteration=" << _iteration << " order=" << _order << " and time=" << _time << ".";
1276 stream << "\nTime unit is : \"" << _time_unit << "\"";
1277 return stream.str();
1280 void MEDCouplingWithTimeStep::synchronizeTimeWith(const MEDCouplingMesh *mesh)
1283 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
1285 double val=mesh->getTime(it,order);
1286 _time=val; _iteration=it; _order=order;
1287 std::string tUnit=mesh->getTimeUnit();
1291 void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
1293 MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
1294 tinyInfo.push_back(_iteration);
1295 tinyInfo.push_back(_order);
1298 void MEDCouplingWithTimeStep::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
1300 MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
1301 tinyInfo.push_back(_time);
1304 void MEDCouplingWithTimeStep::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
1306 MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
1308 _iteration=tinyInfoI[2];
1309 _order=tinyInfoI[3];
1313 * idem getTinySerializationIntInformation except that it is for multi field fetch
1315 void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
1318 tinyInfo[0]=_iteration;
1323 * idem getTinySerializationDbleInformation except that it is for multi field fetch
1325 void MEDCouplingWithTimeStep::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
1328 tinyInfo[0]=_time_tolerance;
1333 * idem finishUnserialization except that it is for multi field fetch
1335 void MEDCouplingWithTimeStep::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
1337 _iteration=tinyInfoI[0];
1338 _order=tinyInfoI[1];
1339 _time_tolerance=tinyInfoD[0];
1343 bool MEDCouplingWithTimeStep::areCompatible(const MEDCouplingTimeDiscretization *other) const
1345 if(!MEDCouplingTimeDiscretization::areCompatible(other))
1347 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1351 bool MEDCouplingWithTimeStep::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
1353 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
1355 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1358 reason.insert(0,"time discretization of this is ONE_TIME, other has a different time discretization.");
1362 bool MEDCouplingWithTimeStep::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
1364 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
1366 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1370 bool MEDCouplingWithTimeStep::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
1372 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
1374 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1378 bool MEDCouplingWithTimeStep::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
1380 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
1382 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1386 bool MEDCouplingWithTimeStep::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
1388 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1389 std::ostringstream oss; oss.precision(15);
1392 reason="This has time discretization ONE_TIME, other not.";
1395 if(_iteration!=otherC->_iteration)
1397 oss << "iterations differ. this iteration=" << _iteration << " other iteration=" << otherC->_iteration;
1401 if(_order!=otherC->_order)
1403 oss << "orders differ. this order=" << _order << " other order=" << otherC->_order;
1407 if(std::fabs(_time-otherC->_time)>_time_tolerance)
1409 oss << "times differ. this time=" << _time << " other time=" << otherC->_time;
1413 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
1416 bool MEDCouplingWithTimeStep::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
1418 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1421 if(_iteration!=otherC->_iteration)
1423 if(_order!=otherC->_order)
1425 if(std::fabs(_time-otherC->_time)>_time_tolerance)
1427 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
1430 void MEDCouplingWithTimeStep::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
1432 MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
1433 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(&other);
1435 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::copyTinyAttrFrom : mismatch of time discretization !");
1436 _time=otherC->_time;
1437 _iteration=otherC->_iteration;
1438 _order=otherC->_order;
1441 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const MEDCouplingTimeDiscretization *other) const
1443 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1445 throw INTERP_KERNEL::Exception("WithTimeStep::aggregation on mismatched time discretization !");
1446 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
1447 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1448 ret->setArray(arr,0);
1452 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
1454 std::vector<const DataArrayDouble *> a(other.size());
1456 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
1458 const MEDCouplingWithTimeStep *itC=dynamic_cast<const MEDCouplingWithTimeStep *>(*it);
1460 throw INTERP_KERNEL::Exception("WithTimeStep::aggregate on mismatched time discretization !");
1461 a[i]=itC->getArray();
1463 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
1464 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1465 ret->setArray(arr,0);
1469 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::meld(const MEDCouplingTimeDiscretization *other) const
1471 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1473 throw INTERP_KERNEL::Exception("WithTimeStep::meld on mismatched time discretization !");
1474 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
1475 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1476 ret->setArray(arr,0);
1480 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::dot(const MEDCouplingTimeDiscretization *other) const
1482 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1484 throw INTERP_KERNEL::Exception("WithTimeStep::dot on mismatched time discretization !");
1485 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1486 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
1487 ret->setArray(arr,0);
1491 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::crossProduct(const MEDCouplingTimeDiscretization *other) const
1493 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1495 throw INTERP_KERNEL::Exception("WithTimeStep::crossProduct on mismatched time discretization !");
1496 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
1497 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1498 ret->setArray(arr,0);
1502 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::max(const MEDCouplingTimeDiscretization *other) const
1504 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1506 throw INTERP_KERNEL::Exception("WithTimeStep::max on mismatched time discretization !");
1507 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
1508 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1509 ret->setArray(arr,0);
1513 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::min(const MEDCouplingTimeDiscretization *other) const
1515 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1517 throw INTERP_KERNEL::Exception("WithTimeStep::min on mismatched time discretization !");
1518 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
1519 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1520 ret->setArray(arr,0);
1524 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::add(const MEDCouplingTimeDiscretization *other) const
1526 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1528 throw INTERP_KERNEL::Exception("WithTimeStep::add on mismatched time discretization !");
1529 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
1530 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1531 ret->setArray(arr,0);
1533 double tmp3=getStartTime(tmp1,tmp2);
1534 ret->setStartTime(tmp3,tmp1,tmp2);
1538 void MEDCouplingWithTimeStep::addEqual(const MEDCouplingTimeDiscretization *other)
1540 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1542 throw INTERP_KERNEL::Exception("WithTimeStep::addEqual on mismatched time discretization !");
1544 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::addEqual : Data Array is NULL !");
1545 getArray()->addEqual(other->getArray());
1548 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::substract(const MEDCouplingTimeDiscretization *other) const
1550 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1552 throw INTERP_KERNEL::Exception("WithTimeStep::substract on mismatched time discretization !");
1553 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
1554 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1555 ret->setArray(arr,0);
1557 double tmp3=getStartTime(tmp1,tmp2);
1558 ret->setStartTime(tmp3,tmp1,tmp2);
1562 void MEDCouplingWithTimeStep::substractEqual(const MEDCouplingTimeDiscretization *other)
1564 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1566 throw INTERP_KERNEL::Exception("WithTimeStep::substractEqual on mismatched time discretization !");
1568 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::substractEqual : Data Array is NULL !");
1569 getArray()->substractEqual(other->getArray());
1572 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::multiply(const MEDCouplingTimeDiscretization *other) const
1574 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1576 throw INTERP_KERNEL::Exception("WithTimeStep::multiply on mismatched time discretization !");
1577 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
1578 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1579 ret->setArray(arr,0);
1581 double tmp3=getStartTime(tmp1,tmp2);
1582 ret->setStartTime(tmp3,tmp1,tmp2);
1586 void MEDCouplingWithTimeStep::multiplyEqual(const MEDCouplingTimeDiscretization *other)
1588 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1590 throw INTERP_KERNEL::Exception("WithTimeStep::multiplyEqual on mismatched time discretization !");
1592 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::multiplyEqual : Data Array is NULL !");
1593 getArray()->multiplyEqual(other->getArray());
1596 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::divide(const MEDCouplingTimeDiscretization *other) const
1598 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1600 throw INTERP_KERNEL::Exception("WithTimeStep::divide on mismatched time discretization !");
1601 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
1602 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1603 ret->setArray(arr,0);
1605 double tmp3=getStartTime(tmp1,tmp2);
1606 ret->setStartTime(tmp3,tmp1,tmp2);
1610 void MEDCouplingWithTimeStep::divideEqual(const MEDCouplingTimeDiscretization *other)
1612 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1614 throw INTERP_KERNEL::Exception("WithTimeStep::divideEqual on mismatched time discretization !");
1616 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::divideEqual : Data Array is NULL !");
1617 getArray()->divideEqual(other->getArray());
1620 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::pow(const MEDCouplingTimeDiscretization *other) const
1622 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1624 throw INTERP_KERNEL::Exception("WithTimeStep::pow on mismatched time discretization !");
1625 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
1626 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1627 ret->setArray(arr,0);
1629 double tmp3=getStartTime(tmp1,tmp2);
1630 ret->setStartTime(tmp3,tmp1,tmp2);
1634 void MEDCouplingWithTimeStep::powEqual(const MEDCouplingTimeDiscretization *other)
1636 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1638 throw INTERP_KERNEL::Exception("WithTimeStep::powEqual on mismatched time discretization !");
1640 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::powEqual : Data Array is NULL !");
1641 getArray()->powEqual(other->getArray());
1644 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::performCpy(bool deepCpy) const
1646 return new MEDCouplingWithTimeStep(*this,deepCpy);
1649 void MEDCouplingWithTimeStep::checkNoTimePresence() const
1651 throw INTERP_KERNEL::Exception("No time specified on a field defined on one time");
1654 void MEDCouplingWithTimeStep::checkTimePresence(double time) const
1656 if(std::fabs(time-_time)>_time_tolerance)
1658 std::ostringstream stream;
1659 stream << "The field is defined on time " << _time << " with eps=" << _time_tolerance << " and asking time = " << time << " !";
1660 throw INTERP_KERNEL::Exception(stream.str().c_str());
1664 std::vector< const DataArrayDouble *> MEDCouplingWithTimeStep::getArraysForTime(double time) const
1666 if(std::fabs(time-_time)<=_time_tolerance)
1668 std::vector< const DataArrayDouble *> ret(1);
1673 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1676 void MEDCouplingWithTimeStep::getValueForTime(double time, const std::vector<double>& vals, double *res) const
1678 std::copy(vals.begin(),vals.end(),res);
1681 void MEDCouplingWithTimeStep::getValueOnTime(int eltId, double time, double *value) const
1683 if(std::fabs(time-_time)<=_time_tolerance)
1685 _array->getTuple(eltId,value);
1687 throw INTERP_KERNEL::Exception("No array existing.");
1689 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1692 void MEDCouplingWithTimeStep::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
1694 if(_iteration==iteration && _order==order)
1696 _array->getTuple(eltId,value);
1698 throw INTERP_KERNEL::Exception("No array existing.");
1700 throw INTERP_KERNEL::Exception("No data on this discrete time.");
1703 MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval():_start_time(0.),_end_time(0.),_start_iteration(-1),_end_iteration(-1),_start_order(-1),_end_order(-1)
1707 void MEDCouplingConstOnTimeInterval::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
1709 MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
1710 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(&other);
1712 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::copyTinyAttrFrom : mismatch of time discretization !");
1713 _start_time=otherC->_start_time;
1714 _end_time=otherC->_end_time;
1715 _start_iteration=otherC->_start_iteration;
1716 _end_iteration=otherC->_end_iteration;
1717 _start_order=otherC->_start_order;
1718 _end_order=otherC->_end_order;
1721 void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
1723 MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
1724 tinyInfo.push_back(_start_iteration);
1725 tinyInfo.push_back(_start_order);
1726 tinyInfo.push_back(_end_iteration);
1727 tinyInfo.push_back(_end_order);
1730 void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
1732 MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
1733 tinyInfo.push_back(_start_time);
1734 tinyInfo.push_back(_end_time);
1737 void MEDCouplingConstOnTimeInterval::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
1739 MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
1740 _start_time=tinyInfoD[1];
1741 _end_time=tinyInfoD[2];
1742 _start_iteration=tinyInfoI[2];
1743 _start_order=tinyInfoI[3];
1744 _end_iteration=tinyInfoI[4];
1745 _end_order=tinyInfoI[5];
1749 * idem getTinySerializationIntInformation except that it is for multi field fetch
1751 void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
1754 tinyInfo[0]=_start_iteration;
1755 tinyInfo[1]=_start_order;
1756 tinyInfo[2]=_end_iteration;
1757 tinyInfo[3]=_end_order;
1761 * idem getTinySerializationDbleInformation except that it is for multi field fetch
1763 void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
1766 tinyInfo[0]=_time_tolerance;
1767 tinyInfo[1]=_start_time;
1768 tinyInfo[2]=_end_time;
1772 * idem finishUnserialization except that it is for multi field fetch
1774 void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
1776 _start_iteration=tinyInfoI[0];
1777 _start_order=tinyInfoI[1];
1778 _end_iteration=tinyInfoI[2];
1779 _end_order=tinyInfoI[3];
1780 _time_tolerance=tinyInfoD[0];
1781 _start_time=tinyInfoD[1];
1782 _end_time=tinyInfoD[2];
1785 MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCpy):
1786 MEDCouplingTimeDiscretization(other,deepCpy),_start_time(other._start_time),_end_time(other._end_time),_start_iteration(other._start_iteration),
1787 _end_iteration(other._end_iteration),_start_order(other._start_order),_end_order(other._end_order)
1791 std::string MEDCouplingConstOnTimeInterval::getStringRepr() const
1793 std::ostringstream stream;
1794 stream << REPR << " Time interval is defined by :\niteration_start=" << _start_iteration << " order_start=" << _start_order << " and time_start=" << _start_time << "\n";
1795 stream << "iteration_end=" << _end_iteration << " order_end=" << _end_order << " and end_time=" << _end_time << "\n";
1796 stream << "\nTime unit is : \"" << _time_unit << "\"";
1797 return stream.str();
1800 void MEDCouplingConstOnTimeInterval::synchronizeTimeWith(const MEDCouplingMesh *mesh)
1803 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
1805 double val=mesh->getTime(it,order);
1806 _start_time=val; _start_iteration=it; _start_order=order;
1807 _end_time=val; _end_iteration=it; _end_order=order;
1808 std::string tUnit=mesh->getTimeUnit();
1812 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::performCpy(bool deepCpy) const
1814 return new MEDCouplingConstOnTimeInterval(*this,deepCpy);
1817 std::vector< const DataArrayDouble *> MEDCouplingConstOnTimeInterval::getArraysForTime(double time) const
1819 if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
1821 std::vector< const DataArrayDouble *> ret(1);
1826 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1829 void MEDCouplingConstOnTimeInterval::getValueForTime(double time, const std::vector<double>& vals, double *res) const
1831 std::copy(vals.begin(),vals.end(),res);
1834 bool MEDCouplingConstOnTimeInterval::areCompatible(const MEDCouplingTimeDiscretization *other) const
1836 if(!MEDCouplingTimeDiscretization::areCompatible(other))
1838 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1842 bool MEDCouplingConstOnTimeInterval::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
1844 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
1846 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1849 reason.insert(0,"time discretization of this is CONST_ON_TIME_INTERVAL, other has a different time discretization.");
1853 bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
1855 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
1857 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1861 bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
1863 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
1865 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1869 bool MEDCouplingConstOnTimeInterval::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
1871 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
1873 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1877 bool MEDCouplingConstOnTimeInterval::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
1879 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1880 std::ostringstream oss; oss.precision(15);
1883 reason="This has time discretization CONST_ON_TIME_INTERVAL, other not.";
1886 if(_start_iteration!=otherC->_start_iteration)
1888 oss << "start iterations differ. this start iteration=" << _start_iteration << " other start iteration=" << otherC->_start_iteration;
1892 if(_start_order!=otherC->_start_order)
1894 oss << "start orders differ. this start order=" << _start_order << " other start order=" << otherC->_start_order;
1898 if(std::fabs(_start_time-otherC->_start_time)>_time_tolerance)
1900 oss << "start times differ. this start time=" << _start_time << " other start time=" << otherC->_start_time;
1904 if(_end_iteration!=otherC->_end_iteration)
1906 oss << "end iterations differ. this end iteration=" << _end_iteration << " other end iteration=" << otherC->_end_iteration;
1910 if(_end_order!=otherC->_end_order)
1912 oss << "end orders differ. this end order=" << _end_order << " other end order=" << otherC->_end_order;
1916 if(std::fabs(_end_time-otherC->_end_time)>_time_tolerance)
1918 oss << "end times differ. this end time=" << _end_time << " other end time=" << otherC->_end_time;
1922 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
1925 bool MEDCouplingConstOnTimeInterval::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
1927 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1930 if(_start_iteration!=otherC->_start_iteration)
1932 if(_start_order!=otherC->_start_order)
1934 if(std::fabs(_start_time-otherC->_start_time)>_time_tolerance)
1936 if(_end_iteration!=otherC->_end_iteration)
1938 if(_end_order!=otherC->_end_order)
1940 if(std::fabs(_end_time-otherC->_end_time)>_time_tolerance)
1942 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
1945 void MEDCouplingConstOnTimeInterval::getValueOnTime(int eltId, double time, double *value) const
1947 if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
1949 _array->getTuple(eltId,value);
1951 throw INTERP_KERNEL::Exception("No array existing.");
1953 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1956 void MEDCouplingConstOnTimeInterval::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
1958 if(iteration>=_start_iteration && iteration<=_end_iteration)
1960 _array->getTuple(eltId,value);
1962 throw INTERP_KERNEL::Exception("No array existing.");
1964 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1967 void MEDCouplingConstOnTimeInterval::checkNoTimePresence() const
1969 throw INTERP_KERNEL::Exception("No time specified on a field defined as constant on one time interval");
1972 void MEDCouplingConstOnTimeInterval::checkTimePresence(double time) const
1974 if(time<_start_time-_time_tolerance || time>_end_time+_time_tolerance)
1976 std::ostringstream stream;
1977 stream << "The field is defined between times " << _start_time << " and " << _end_time << " worderh tolerance ";
1978 stream << _time_tolerance << " and trying to access on time = " << time;
1979 throw INTERP_KERNEL::Exception(stream.str().c_str());
1983 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const MEDCouplingTimeDiscretization *other) const
1985 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1987 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregation on mismatched time discretization !");
1988 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
1989 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
1990 ret->setArray(arr,0);
1994 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
1996 std::vector<const DataArrayDouble *> a(other.size());
1998 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
2000 const MEDCouplingConstOnTimeInterval *itC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(*it);
2002 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregate on mismatched time discretization !");
2003 a[i]=itC->getArray();
2005 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
2006 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2007 ret->setArray(arr,0);
2011 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::meld(const MEDCouplingTimeDiscretization *other) const
2013 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2015 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::meld on mismatched time discretization !");
2016 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
2017 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2018 ret->setTimeTolerance(getTimeTolerance());
2019 ret->setArray(arr,0);
2023 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::dot(const MEDCouplingTimeDiscretization *other) const
2025 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2027 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::dot on mismatched time discretization !");
2028 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
2029 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2030 ret->setArray(arr,0);
2034 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::crossProduct(const MEDCouplingTimeDiscretization *other) const
2036 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2038 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::crossProduct on mismatched time discretization !");
2039 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
2040 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2041 ret->setArray(arr,0);
2045 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::max(const MEDCouplingTimeDiscretization *other) const
2047 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2049 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::max on mismatched time discretization !");
2050 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
2051 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2052 ret->setArray(arr,0);
2056 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::min(const MEDCouplingTimeDiscretization *other) const
2058 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2060 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::min on mismatched time discretization !");
2061 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
2062 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2063 ret->setArray(arr,0);
2067 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::add(const MEDCouplingTimeDiscretization *other) const
2069 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2071 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::add on mismatched time discretization !");
2072 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
2073 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2074 ret->setArray(arr,0);
2076 double tmp3=getStartTime(tmp1,tmp2);
2077 ret->setStartTime(tmp3,tmp1,tmp2);
2078 tmp3=getEndTime(tmp1,tmp2);
2079 ret->setEndTime(tmp3,tmp1,tmp2);
2083 void MEDCouplingConstOnTimeInterval::addEqual(const MEDCouplingTimeDiscretization *other)
2085 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2087 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::addEqual on mismatched time discretization !");
2089 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::substractaddEqual : Data Array is NULL !");
2090 getArray()->addEqual(other->getArray());
2093 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const MEDCouplingTimeDiscretization *other) const
2095 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2097 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substract on mismatched time discretization !");
2098 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
2099 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2100 ret->setArray(arr,0);
2102 double tmp3=getStartTime(tmp1,tmp2);
2103 ret->setStartTime(tmp3,tmp1,tmp2);
2104 tmp3=getEndTime(tmp1,tmp2);
2105 ret->setEndTime(tmp3,tmp1,tmp2);
2109 void MEDCouplingConstOnTimeInterval::substractEqual(const MEDCouplingTimeDiscretization *other)
2111 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2113 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substractEqual on mismatched time discretization !");
2115 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::substractEqual : Data Array is NULL !");
2116 getArray()->substractEqual(other->getArray());
2119 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::multiply(const MEDCouplingTimeDiscretization *other) const
2121 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2123 throw INTERP_KERNEL::Exception("multiply on mismatched time discretization !");
2124 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
2125 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2126 ret->setArray(arr,0);
2128 double tmp3=getStartTime(tmp1,tmp2);
2129 ret->setStartTime(tmp3,tmp1,tmp2);
2130 tmp3=getEndTime(tmp1,tmp2);
2131 ret->setEndTime(tmp3,tmp1,tmp2);
2135 void MEDCouplingConstOnTimeInterval::multiplyEqual(const MEDCouplingTimeDiscretization *other)
2137 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2139 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::multiplyEqual on mismatched time discretization !");
2141 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::multiplyEqual : Data Array is NULL !");
2142 getArray()->multiplyEqual(other->getArray());
2145 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::divide(const MEDCouplingTimeDiscretization *other) const
2147 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2149 throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
2150 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
2151 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2152 ret->setArray(arr,0);
2154 double tmp3=getStartTime(tmp1,tmp2);
2155 ret->setStartTime(tmp3,tmp1,tmp2);
2156 tmp3=getEndTime(tmp1,tmp2);
2157 ret->setEndTime(tmp3,tmp1,tmp2);
2161 void MEDCouplingConstOnTimeInterval::divideEqual(const MEDCouplingTimeDiscretization *other)
2163 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2165 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::divideEqual on mismatched time discretization !");
2167 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::divideEqual : Data Array is NULL !");
2168 getArray()->divideEqual(other->getArray());
2171 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::pow(const MEDCouplingTimeDiscretization *other) const
2173 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2175 throw INTERP_KERNEL::Exception("pow on mismatched time discretization !");
2176 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
2177 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2178 ret->setArray(arr,0);
2180 double tmp3=getStartTime(tmp1,tmp2);
2181 ret->setStartTime(tmp3,tmp1,tmp2);
2182 tmp3=getEndTime(tmp1,tmp2);
2183 ret->setEndTime(tmp3,tmp1,tmp2);
2187 void MEDCouplingConstOnTimeInterval::powEqual(const MEDCouplingTimeDiscretization *other)
2189 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2191 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::powEqual on mismatched time discretization !");
2193 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::powEqual : Data Array is NULL !");
2194 getArray()->powEqual(other->getArray());
2197 MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy),
2198 _start_time(other._start_time),_end_time(other._end_time),
2199 _start_iteration(other._start_iteration),_end_iteration(other._end_iteration),
2200 _start_order(other._start_order),_end_order(other._end_order)
2202 if(other._end_array)
2203 _end_array=other._end_array->performCpy(deepCpy);
2208 void MEDCouplingTwoTimeSteps::updateTime() const
2210 MEDCouplingTimeDiscretization::updateTime();
2212 updateTimeWith(*_end_array);
2215 void MEDCouplingTwoTimeSteps::synchronizeTimeWith(const MEDCouplingMesh *mesh)
2218 throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
2220 double val=mesh->getTime(it,order);
2221 _start_time=val; _start_iteration=it; _start_order=order;
2222 _end_time=val; _end_iteration=it; _end_order=order;
2223 std::string tUnit=mesh->getTimeUnit();
2227 std::size_t MEDCouplingTwoTimeSteps::getHeapMemorySizeWithoutChildren() const
2229 return MEDCouplingTimeDiscretization::getHeapMemorySizeWithoutChildren();
2232 std::vector<const BigMemoryObject *> MEDCouplingTwoTimeSteps::getDirectChildrenWithNull() const
2234 std::vector<const BigMemoryObject *> ret(MEDCouplingTimeDiscretization::getDirectChildrenWithNull());
2235 ret.push_back(_end_array);
2239 void MEDCouplingTwoTimeSteps::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
2241 MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
2242 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(&other);
2244 throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::copyTinyAttrFrom : mismatch of time discretization !");
2245 _start_time=otherC->_start_time;
2246 _end_time=otherC->_end_time;
2247 _start_iteration=otherC->_start_iteration;
2248 _end_iteration=otherC->_end_iteration;
2249 _start_order=otherC->_start_order;
2250 _end_order=otherC->_end_order;
2253 void MEDCouplingTwoTimeSteps::copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other)
2255 MEDCouplingTimeDiscretization::copyTinyStringsFrom(other);
2256 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(&other);
2258 throw INTERP_KERNEL::Exception("Trying to operate copyTinyStringsFrom on different field type (two times//one time) !");
2259 if(_end_array && otherC->_end_array)
2260 _end_array->copyStringInfoFrom(*otherC->_end_array);
2263 const DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray() const
2268 DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray()
2273 void MEDCouplingTwoTimeSteps::checkCoherency() const
2275 MEDCouplingTimeDiscretization::checkCoherency();
2277 throw INTERP_KERNEL::Exception("No end array specified !");
2278 if(_array->getNumberOfComponents()!=_end_array->getNumberOfComponents())
2279 throw INTERP_KERNEL::Exception("The number of components mismatch between the start and the end arrays !");
2280 if(_array->getNumberOfTuples()!=_end_array->getNumberOfTuples())
2281 throw INTERP_KERNEL::Exception("The number of tuples mismatch between the start and the end arrays !");
2284 bool MEDCouplingTwoTimeSteps::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
2286 std::ostringstream oss;
2287 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(other);
2290 reason="This has time discretization LINEAR_TIME, other not.";
2293 if(_start_iteration!=otherC->_start_iteration)
2295 oss << "start iterations differ. this start iteration=" << _start_iteration << " other start iteration=" << otherC->_start_iteration;
2299 if(_start_order!=otherC->_start_order)
2301 oss << "start orders differ. this start order=" << _start_order << " other start order=" << otherC->_start_order;
2305 if(std::fabs(_start_time-otherC->_start_time)>_time_tolerance)
2307 oss << "start times differ. this start time=" << _start_time << " other start time=" << otherC->_start_time;
2311 if(_end_iteration!=otherC->_end_iteration)
2313 oss << "end iterations differ. this end iteration=" << _end_iteration << " other end iteration=" << otherC->_end_iteration;
2317 if(_end_order!=otherC->_end_order)
2319 oss << "end orders differ. this end order=" << _end_order << " other end order=" << otherC->_end_order;
2323 if(std::fabs(_end_time-otherC->_end_time)>_time_tolerance)
2325 oss << "end times differ. this end time=" << _end_time << " other end time=" << otherC->_end_time;
2329 if(_end_array!=otherC->_end_array)
2330 if(!_end_array->isEqualIfNotWhy(*otherC->_end_array,prec,reason))
2332 reason.insert(0,"end arrays differ for linear time.");
2335 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
2338 bool MEDCouplingTwoTimeSteps::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
2340 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(other);
2343 if(_start_iteration!=otherC->_start_iteration)
2345 if(_end_iteration!=otherC->_end_iteration)
2347 if(_start_order!=otherC->_start_order)
2349 if(_end_order!=otherC->_end_order)
2351 if(std::fabs(_start_time-otherC->_start_time)>_time_tolerance)
2353 if(std::fabs(_end_time-otherC->_end_time)>_time_tolerance)
2355 if(_end_array!=otherC->_end_array)
2356 if(!_end_array->isEqualWithoutConsideringStr(*otherC->_end_array,prec))
2358 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
2361 MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps():_start_time(0.),_end_time(0.),_start_iteration(-1),_end_iteration(-1),_start_order(-1),_end_order(-1),_end_array(0)
2365 MEDCouplingTwoTimeSteps::~MEDCouplingTwoTimeSteps()
2368 _end_array->decrRef();
2371 void MEDCouplingTwoTimeSteps::checkNoTimePresence() const
2373 throw INTERP_KERNEL::Exception("The field presents a time to be specified in every access !");
2376 void MEDCouplingTwoTimeSteps::checkTimePresence(double time) const
2378 if(time<_start_time-_time_tolerance || time>_end_time+_time_tolerance)
2380 std::ostringstream stream;
2381 stream << "The field is defined between times " << _start_time << " and " << _end_time << " worderh tolerance ";
2382 stream << _time_tolerance << " and trying to access on time = " << time;
2383 throw INTERP_KERNEL::Exception(stream.str().c_str());
2387 void MEDCouplingTwoTimeSteps::getArrays(std::vector<DataArrayDouble *>& arrays) const
2391 arrays[1]=_end_array;
2394 void MEDCouplingTwoTimeSteps::setEndArray(DataArrayDouble *array, TimeLabel *owner)
2396 if(array!=_end_array)
2399 _end_array->decrRef();
2402 _end_array->incrRef();
2404 owner->declareAsNew();
2408 void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
2410 MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
2411 tinyInfo.push_back(_start_iteration);
2412 tinyInfo.push_back(_start_order);
2413 tinyInfo.push_back(_end_iteration);
2414 tinyInfo.push_back(_end_order);
2417 tinyInfo.push_back(_end_array->getNumberOfTuples());
2418 tinyInfo.push_back(_end_array->getNumberOfComponents());
2422 tinyInfo.push_back(-1);
2423 tinyInfo.push_back(-1);
2427 void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
2429 MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
2430 tinyInfo.push_back(_start_time);
2431 tinyInfo.push_back(_end_time);
2434 void MEDCouplingTwoTimeSteps::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
2436 int nbOfCompo=_array->getNumberOfComponents();
2437 for(int i=0;i<nbOfCompo;i++)
2438 tinyInfo.push_back(_array->getInfoOnComponent(i));
2439 for(int i=0;i<nbOfCompo;i++)
2440 tinyInfo.push_back(_end_array->getInfoOnComponent(i));
2443 void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
2449 _end_array->decrRef();
2450 DataArrayDouble *arr=0;
2451 if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
2453 arr=DataArrayDouble::New();
2454 arr->alloc(tinyInfoI[0],tinyInfoI[1]);
2459 if(tinyInfoI[6]!=-1 && tinyInfoI[7]!=-1)
2461 arr=DataArrayDouble::New();
2462 arr->alloc(tinyInfoI[6],tinyInfoI[7]);
2468 void MEDCouplingTwoTimeSteps::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
2470 MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
2471 _start_time=tinyInfoD[1];
2472 _end_time=tinyInfoD[2];
2473 _start_iteration=tinyInfoI[2];
2474 _start_order=tinyInfoI[3];
2475 _end_iteration=tinyInfoI[4];
2476 _end_order=tinyInfoI[5];
2480 * idem getTinySerializationIntInformation except that it is for multi field fetch
2482 void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
2485 tinyInfo[0]=_start_iteration;
2486 tinyInfo[1]=_start_order;
2487 tinyInfo[2]=_end_iteration;
2488 tinyInfo[3]=_end_order;
2492 * idem getTinySerializationDbleInformation except that it is for multi field fetch
2494 void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
2497 tinyInfo[0]=_time_tolerance;
2498 tinyInfo[1]=_start_time;
2499 tinyInfo[2]=_end_time;
2503 * idem finishUnserialization except that it is for multi field fetch
2505 void MEDCouplingTwoTimeSteps::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
2507 _start_iteration=tinyInfoI[0];
2508 _start_order=tinyInfoI[1];
2509 _end_iteration=tinyInfoI[2];
2510 _end_order=tinyInfoI[3];
2511 _time_tolerance=tinyInfoD[0];
2512 _start_time=tinyInfoD[1];
2513 _end_time=tinyInfoD[2];
2516 std::vector< const DataArrayDouble *> MEDCouplingTwoTimeSteps::getArraysForTime(double time) const
2518 if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
2520 std::vector< const DataArrayDouble *> ret(2);
2526 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
2529 void MEDCouplingTwoTimeSteps::setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner)
2531 if(arrays.size()!=2)
2532 throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::setArrays : number of arrays must be two.");
2533 setArray(arrays.front(),owner);
2534 setEndArray(arrays.back(),owner);
2537 MEDCouplingLinearTime::MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCpy):MEDCouplingTwoTimeSteps(other,deepCpy)
2541 MEDCouplingLinearTime::MEDCouplingLinearTime()
2545 std::string MEDCouplingLinearTime::getStringRepr() const
2547 std::ostringstream stream;
2548 stream << REPR << " Time interval is defined by :\niteration_start=" << _start_iteration << " order_start=" << _start_order << " and time_start=" << _start_time << "\n";
2549 stream << "iteration_end=" << _end_iteration << " order_end=" << _end_order << " and end_time=" << _end_time << "\n";
2550 stream << "Time unit is : \"" << _time_unit << "\"";
2551 return stream.str();
2554 void MEDCouplingLinearTime::checkCoherency() const
2556 MEDCouplingTwoTimeSteps::checkCoherency();
2557 if(std::fabs(_start_time-_end_time)<_time_tolerance)
2558 throw INTERP_KERNEL::Exception("Start time and end time are equals regarding time tolerance.");
2561 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::performCpy(bool deepCpy) const
2563 return new MEDCouplingLinearTime(*this,deepCpy);
2566 bool MEDCouplingLinearTime::areCompatible(const MEDCouplingTimeDiscretization *other) const
2568 if(!MEDCouplingTimeDiscretization::areCompatible(other))
2570 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2573 if(_end_array==0 && otherC->_end_array==0)
2575 if(_end_array==0 || otherC->_end_array==0)
2577 if(_end_array->getNumberOfComponents()!=otherC->_end_array->getNumberOfComponents())
2582 bool MEDCouplingLinearTime::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
2584 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
2586 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2589 reason.insert(0,"time discretization of this is LINEAR_TIME, other has a different time discretization.");
2593 bool MEDCouplingLinearTime::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
2595 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
2597 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2601 bool MEDCouplingLinearTime::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
2603 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
2605 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2608 if(_end_array==0 && otherC->_end_array==0)
2610 if(_end_array==0 || otherC->_end_array==0)
2612 int nbC1=_end_array->getNumberOfComponents();
2613 int nbC2=otherC->_end_array->getNumberOfComponents();
2614 if(nbC1!=nbC2 && nbC2!=1)
2619 bool MEDCouplingLinearTime::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
2621 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
2623 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2628 * vals is expected to be of size 2*_array->getNumberOfTuples()==_array->getNumberOfTuples()+_end_array->getNumberOfTuples()
2630 void MEDCouplingLinearTime::getValueForTime(double time, const std::vector<double>& vals, double *res) const
2632 double alpha=(_end_time-time)/(_end_time-_start_time);
2633 std::size_t nbComp=vals.size()/2;
2634 std::transform(vals.begin(),vals.begin()+nbComp,res,std::bind2nd(std::multiplies<double>(),alpha));
2635 std::vector<double> tmp(nbComp);
2636 std::transform(vals.begin()+nbComp,vals.end(),tmp.begin(),std::bind2nd(std::multiplies<double>(),1-alpha));
2637 std::transform(tmp.begin(),tmp.end(),res,res,std::plus<double>());
2640 void MEDCouplingLinearTime::getValueOnTime(int eltId, double time, double *value) const
2642 double alpha=(_end_time-time)/(_end_time-_start_time);
2645 _array->getTuple(eltId,value);
2647 throw INTERP_KERNEL::Exception("No start array existing.");
2648 nbComp=_array->getNumberOfComponents();
2649 std::transform(value,value+nbComp,value,std::bind2nd(std::multiplies<double>(),alpha));
2650 std::vector<double> tmp(nbComp);
2652 _end_array->getTuple(eltId,&tmp[0]);
2654 throw INTERP_KERNEL::Exception("No end array existing.");
2655 std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::multiplies<double>(),1-alpha));
2656 std::transform(tmp.begin(),tmp.end(),value,value,std::plus<double>());
2659 void MEDCouplingLinearTime::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
2661 if(iteration==_start_iteration && order==_start_order)
2664 _array->getTuple(eltId,value);
2666 throw INTERP_KERNEL::Exception("iteration order match with start time but no start array existing.");
2668 if(iteration==_end_iteration && order==_end_order)
2671 _end_array->getTuple(eltId,value);
2673 throw INTERP_KERNEL::Exception("iteration order match with end time but no end array existing.");
2676 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
2679 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const MEDCouplingTimeDiscretization *other) const
2681 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2683 throw INTERP_KERNEL::Exception("LinearTime::aggregation on mismatched time discretization !");
2684 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Aggregate(getArray(),other->getArray());
2685 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Aggregate(getEndArray(),other->getEndArray());
2686 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2687 ret->setArray(arr1,0);
2688 ret->setEndArray(arr2,0);
2692 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
2694 std::vector<const DataArrayDouble *> a(other.size());
2695 std::vector<const DataArrayDouble *> b(other.size());
2697 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
2699 const MEDCouplingLinearTime *itC=dynamic_cast<const MEDCouplingLinearTime *>(*it);
2701 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::aggregate on mismatched time discretization !");
2702 a[i]=itC->getArray();
2703 b[i]=itC->getEndArray();
2705 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
2706 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Aggregate(b);
2707 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2708 ret->setArray(arr,0);
2709 ret->setEndArray(arr2,0);
2713 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::meld(const MEDCouplingTimeDiscretization *other) const
2715 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2717 throw INTERP_KERNEL::Exception("LinearTime::meld on mismatched time discretization !");
2718 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Meld(getArray(),other->getArray());
2719 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Meld(getEndArray(),other->getEndArray());
2720 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2721 ret->setTimeTolerance(getTimeTolerance());
2722 ret->setArray(arr1,0);
2723 ret->setEndArray(arr2,0);
2727 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::dot(const MEDCouplingTimeDiscretization *other) const
2729 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2731 throw INTERP_KERNEL::Exception("LinearTime::dot on mismatched time discretization !");
2732 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Dot(getArray(),other->getArray());
2733 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Dot(getEndArray(),other->getEndArray());
2734 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2735 ret->setArray(arr1,0);
2736 ret->setEndArray(arr2,0);
2740 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::crossProduct(const MEDCouplingTimeDiscretization *other) const
2742 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2744 throw INTERP_KERNEL::Exception("LinearTime::crossProduct on mismatched time discretization !");
2745 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::CrossProduct(getArray(),other->getArray());
2746 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::CrossProduct(getEndArray(),other->getEndArray());
2747 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2748 ret->setArray(arr1,0);
2749 ret->setEndArray(arr2,0);
2753 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::max(const MEDCouplingTimeDiscretization *other) const
2755 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2757 throw INTERP_KERNEL::Exception("LinearTime::max on mismatched time discretization !");
2758 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2759 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Max(getArray(),other->getArray());
2760 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Max(getEndArray(),other->getEndArray());
2761 ret->setArray(arr1,0);
2762 ret->setEndArray(arr2,0);
2766 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::min(const MEDCouplingTimeDiscretization *other) const
2768 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2770 throw INTERP_KERNEL::Exception("LinearTime::min on mismatched time discretization !");
2771 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Min(getArray(),other->getArray());
2772 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Min(getEndArray(),other->getEndArray());
2773 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2774 ret->setArray(arr1,0);
2775 ret->setEndArray(arr2,0);
2779 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::add(const MEDCouplingTimeDiscretization *other) const
2781 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2783 throw INTERP_KERNEL::Exception("LinearTime::add on mismatched time discretization !");
2784 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Add(getArray(),other->getArray());
2785 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Add(getEndArray(),other->getEndArray());
2786 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2787 ret->setArray(arr1,0);
2788 ret->setEndArray(arr2,0);
2792 void MEDCouplingLinearTime::addEqual(const MEDCouplingTimeDiscretization *other)
2794 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2796 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2798 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::addEqual : Data Array is NULL !");
2800 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::addEqual : Data Array (end) is NULL !");
2801 getArray()->addEqual(other->getArray());
2802 getEndArray()->addEqual(other->getEndArray());
2805 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::substract(const MEDCouplingTimeDiscretization *other) const
2807 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2809 throw INTERP_KERNEL::Exception("LinearTime::substract on mismatched time discretization !");
2810 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Substract(getArray(),other->getArray());
2811 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Substract(getEndArray(),other->getEndArray());
2812 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2813 ret->setArray(arr1,0);
2814 ret->setEndArray(arr2,0);
2818 void MEDCouplingLinearTime::substractEqual(const MEDCouplingTimeDiscretization *other)
2820 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2822 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2824 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::substractEqual : Data Array is NULL !");
2826 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::substractEqual : Data Array (end) is NULL !");
2827 getArray()->substractEqual(other->getArray());
2828 getEndArray()->substractEqual(other->getEndArray());
2831 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::multiply(const MEDCouplingTimeDiscretization *other) const
2833 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2835 throw INTERP_KERNEL::Exception("LinearTime::multiply on mismatched time discretization !");
2836 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Multiply(getArray(),other->getArray());
2837 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Multiply(getEndArray(),other->getEndArray());
2838 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2839 ret->setArray(arr1,0);
2840 ret->setEndArray(arr2,0);
2844 void MEDCouplingLinearTime::multiplyEqual(const MEDCouplingTimeDiscretization *other)
2846 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2848 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2850 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::multiplyEqual : Data Array is NULL !");
2852 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::multiplyEqual : Data Array (end) is NULL !");
2853 getArray()->multiplyEqual(other->getArray());
2854 getEndArray()->multiplyEqual(other->getEndArray());
2857 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::divide(const MEDCouplingTimeDiscretization *other) const
2859 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2861 throw INTERP_KERNEL::Exception("LinearTime::divide on mismatched time discretization !");
2862 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Divide(getArray(),other->getArray());
2863 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Divide(getEndArray(),other->getEndArray());
2864 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2865 ret->setArray(arr1,0);
2866 ret->setEndArray(arr2,0);
2870 void MEDCouplingLinearTime::divideEqual(const MEDCouplingTimeDiscretization *other)
2872 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2874 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2876 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::divideEqual : Data Array is NULL !");
2878 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::divideEqual : Data Array (end) is NULL !");
2879 getArray()->divideEqual(other->getArray());
2880 getEndArray()->divideEqual(other->getEndArray());
2883 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::pow(const MEDCouplingTimeDiscretization *other) const
2885 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2887 throw INTERP_KERNEL::Exception("LinearTime::pow on mismatched time discretization !");
2888 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Pow(getArray(),other->getArray());
2889 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Pow(getEndArray(),other->getEndArray());
2890 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2891 ret->setArray(arr1,0);
2892 ret->setEndArray(arr2,0);
2896 void MEDCouplingLinearTime::powEqual(const MEDCouplingTimeDiscretization *other)
2898 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2900 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2902 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::powEqual : Data Array is NULL !");
2904 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::powEqual : Data Array (end) is NULL !");
2905 getArray()->powEqual(other->getArray());
2906 getEndArray()->powEqual(other->getEndArray());