1 // Copyright (C) 2007-2013 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.
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::getDirectChildren() const
104 std::vector<const BigMemoryObject *> ret;
106 ret.push_back(_array);
110 bool MEDCouplingTimeDiscretization::areCompatible(const MEDCouplingTimeDiscretization *other) const
112 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
114 if(_array==0 && other->_array==0)
116 if(_array==0 || other->_array==0)
118 if(_array->getNumberOfComponents()!=other->_array->getNumberOfComponents())
123 bool MEDCouplingTimeDiscretization::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
125 std::ostringstream oss; oss.precision(15);
126 if(_time_unit!=other->_time_unit)
128 oss << "Field discretizations differ : this time unit = \"" << _time_unit << "\" and other time unit = \"" << other->_time_unit << "\" !";
132 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
134 oss << "Field discretizations differ : this time tolerance = \"" << _time_tolerance << "\" and other time tolerance = \"" << other->_time_tolerance << "\" !";
138 if(_array==0 && other->_array==0)
140 if(_array==0 || other->_array==0)
142 reason="Field discretizations differ : Only one timediscretization between the two this and other has a DataArrayDouble for values defined";
145 if(_array->getNumberOfComponents()!=other->_array->getNumberOfComponents())
147 if(_array->getNumberOfTuples()!=other->_array->getNumberOfTuples())
152 bool MEDCouplingTimeDiscretization::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
154 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
156 if(_array==0 && other->_array==0)
158 if(_array==0 || other->_array==0)
160 if(_array->getNumberOfTuples()!=other->_array->getNumberOfTuples())
165 bool MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
167 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
169 if(_array==0 && other->_array==0)
171 if(_array==0 || other->_array==0)
173 int nbC1=_array->getNumberOfComponents();
174 int nbC2=other->_array->getNumberOfComponents();
175 int nbMin=std::min(nbC1,nbC2);
176 if(nbC1!=nbC2 && nbMin!=1)
181 bool MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
183 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
185 if(_array==0 && other->_array==0)
187 if(_array==0 || other->_array==0)
189 int nbC1=_array->getNumberOfComponents();
190 int nbC2=other->_array->getNumberOfComponents();
191 if(nbC1!=nbC2 && nbC2!=1)
196 bool MEDCouplingTimeDiscretization::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
198 if(!areStrictlyCompatible(other,reason))
200 if(_array==other->_array)
202 return _array->isEqualIfNotWhy(*other->_array,prec,reason);
205 bool MEDCouplingTimeDiscretization::isEqual(const MEDCouplingTimeDiscretization *other, double prec) const
208 return isEqualIfNotWhy(other,prec,reason);
211 bool MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
214 if(!areStrictlyCompatible(other,tmp))
216 if(_array==other->_array)
218 return _array->isEqualWithoutConsideringStr(*other->_array,prec);
221 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const
223 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(type);
224 ret->setTimeUnit(getTimeUnit());
225 const DataArrayDouble *arrSrc=getArray();
226 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr;
228 arr=arrSrc->performCpy(deepCpy);
229 ret->setArray(arr,0);
233 void MEDCouplingTimeDiscretization::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
237 tinyInfo.push_back(_array->getNumberOfTuples());
238 tinyInfo.push_back(_array->getNumberOfComponents());
242 tinyInfo.push_back(-1);
243 tinyInfo.push_back(-1);
247 void MEDCouplingTimeDiscretization::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
252 DataArrayDouble *arr=0;
253 if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
255 arr=DataArrayDouble::New();
256 arr->alloc(tinyInfoI[0],tinyInfoI[1]);
262 void MEDCouplingTimeDiscretization::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
264 _time_tolerance=tinyInfoD[0];
265 int nbOfCompo=_array->getNumberOfComponents();
266 for(int i=0;i<nbOfCompo;i++)
267 _array->setInfoOnComponent(i,tinyInfoS[i].c_str());
270 void MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
272 tinyInfo.push_back(_time_tolerance);
275 void MEDCouplingTimeDiscretization::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
277 int nbOfCompo=_array->getNumberOfComponents();
278 for(int i=0;i<nbOfCompo;i++)
279 tinyInfo.push_back(_array->getInfoOnComponent(i));
282 MEDCouplingTimeDiscretization::MEDCouplingTimeDiscretization():_time_tolerance(TIME_TOLERANCE_DFT),_array(0)
286 MEDCouplingTimeDiscretization::MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCpy):_time_unit(other._time_unit),_time_tolerance(other._time_tolerance)
289 _array=other._array->performCpy(deepCpy);
294 MEDCouplingTimeDiscretization::~MEDCouplingTimeDiscretization()
300 void MEDCouplingTimeDiscretization::setArray(DataArrayDouble *array, TimeLabel *owner)
310 owner->declareAsNew();
314 const DataArrayDouble *MEDCouplingTimeDiscretization::getEndArray() const
316 throw INTERP_KERNEL::Exception("getEndArray not available for this type of time discretization !");
319 DataArrayDouble *MEDCouplingTimeDiscretization::getEndArray()
321 throw INTERP_KERNEL::Exception("getEndArray not available for this type of time discretization !");
324 void MEDCouplingTimeDiscretization::setEndArray(DataArrayDouble *array, TimeLabel *owner)
326 throw INTERP_KERNEL::Exception("setEndArray not available for this type of time discretization !");
329 void MEDCouplingTimeDiscretization::setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner)
332 throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretization::setArrays : number of arrays must be one.");
333 setArray(arrays.back(),owner);
336 void MEDCouplingTimeDiscretization::getArrays(std::vector<DataArrayDouble *>& arrays) const
342 bool MEDCouplingTimeDiscretization::isBefore(const MEDCouplingTimeDiscretization *other) const
345 double time1=getEndTime(iteration,order)-_time_tolerance;
346 double time2=other->getStartTime(iteration,order)+other->getTimeTolerance();
350 bool MEDCouplingTimeDiscretization::isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const
353 double time1=getEndTime(iteration,order)+_time_tolerance;
354 double time2=other->getStartTime(iteration,order)-other->getTimeTolerance();
358 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::doublyContractedProduct() const
360 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
361 ret->setTimeUnit(getTimeUnit());
362 std::vector<DataArrayDouble *> arrays;
364 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
365 for(std::size_t j=0;j<arrays.size();j++)
368 arrays2[j]=arrays[j]->doublyContractedProduct();
372 std::vector<DataArrayDouble *> arrays3(arrays.size());
373 for(std::size_t j=0;j<arrays.size();j++)
374 arrays3[j]=arrays2[j];
375 ret->setArrays(arrays3,0);
379 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::determinant() const
381 std::vector<DataArrayDouble *> arrays;
383 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
384 for(std::size_t j=0;j<arrays.size();j++)
387 arrays2[j]=arrays[j]->determinant();
391 std::vector<DataArrayDouble *> arrays3(arrays.size());
392 for(std::size_t j=0;j<arrays.size();j++)
393 arrays3[j]=arrays2[j];
394 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
395 ret->setTimeUnit(getTimeUnit());
396 ret->setArrays(arrays3,0);
400 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenValues() const
402 std::vector<DataArrayDouble *> arrays;
404 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
405 for(std::size_t j=0;j<arrays.size();j++)
408 arrays2[j]=arrays[j]->eigenValues();
412 std::vector<DataArrayDouble *> arrays3(arrays.size());
413 for(std::size_t j=0;j<arrays.size();j++)
414 arrays3[j]=arrays2[j];
415 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
416 ret->setTimeUnit(getTimeUnit());
417 ret->setArrays(arrays3,0);
421 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenVectors() const
423 std::vector<DataArrayDouble *> arrays;
425 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
426 for(std::size_t j=0;j<arrays.size();j++)
429 arrays2[j]=arrays[j]->eigenVectors();
433 std::vector<DataArrayDouble *> arrays3(arrays.size());
434 for(std::size_t j=0;j<arrays.size();j++)
435 arrays3[j]=arrays2[j];
436 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
437 ret->setTimeUnit(getTimeUnit());
438 ret->setArrays(arrays3,0);
442 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::inverse() const
444 std::vector<DataArrayDouble *> arrays;
446 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
447 for(std::size_t j=0;j<arrays.size();j++)
450 arrays2[j]=arrays[j]->inverse();
454 std::vector<DataArrayDouble *> arrays3(arrays.size());
455 for(std::size_t j=0;j<arrays.size();j++)
456 arrays3[j]=arrays2[j];
457 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
458 ret->setTimeUnit(getTimeUnit());
459 ret->setArrays(arrays3,0);
463 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::trace() const
465 std::vector<DataArrayDouble *> arrays;
467 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
468 for(std::size_t j=0;j<arrays.size();j++)
471 arrays2[j]=arrays[j]->trace();
475 std::vector<DataArrayDouble *> arrays3(arrays.size());
476 for(std::size_t j=0;j<arrays.size();j++)
477 arrays3[j]=arrays2[j];
478 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
479 ret->setTimeUnit(getTimeUnit());
480 ret->setArrays(arrays3,0);
484 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::deviator() const
486 std::vector<DataArrayDouble *> arrays;
488 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
489 for(std::size_t j=0;j<arrays.size();j++)
492 arrays2[j]=arrays[j]->deviator();
496 std::vector<DataArrayDouble *> arrays3(arrays.size());
497 for(std::size_t j=0;j<arrays.size();j++)
498 arrays3[j]=arrays2[j];
499 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
500 ret->setTimeUnit(getTimeUnit());
501 ret->setArrays(arrays3,0);
505 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::magnitude() const
507 std::vector<DataArrayDouble *> arrays;
509 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
510 for(std::size_t j=0;j<arrays.size();j++)
513 arrays2[j]=arrays[j]->magnitude();
517 std::vector<DataArrayDouble *> arrays3(arrays.size());
518 for(std::size_t j=0;j<arrays.size();j++)
519 arrays3[j]=arrays2[j];
520 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
521 ret->setTimeUnit(getTimeUnit());
522 ret->setArrays(arrays3,0);
526 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::negate() const
528 std::vector<DataArrayDouble *> arrays;
530 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
531 for(std::size_t j=0;j<arrays.size();j++)
534 arrays2[j]=arrays[j]->negate();
538 std::vector<DataArrayDouble *> arrays3(arrays.size());
539 for(std::size_t j=0;j<arrays.size();j++)
540 arrays3[j]=arrays2[j];
541 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
542 ret->setTimeUnit(getTimeUnit());
543 ret->setArrays(arrays3,0);
547 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::maxPerTuple() const
549 std::vector<DataArrayDouble *> arrays;
551 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
552 for(std::size_t j=0;j<arrays.size();j++)
555 arrays2[j]=arrays[j]->maxPerTuple();
559 std::vector<DataArrayDouble *> arrays3(arrays.size());
560 for(std::size_t j=0;j<arrays.size();j++)
561 arrays3[j]=arrays2[j];
562 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
563 ret->setTimeUnit(getTimeUnit());
564 ret->setArrays(arrays3,0);
568 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedComponents(const std::vector<int>& compoIds) const
570 std::vector<DataArrayDouble *> arrays;
572 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
573 for(std::size_t j=0;j<arrays.size();j++)
576 arrays2[j]=static_cast<DataArrayDouble *>(arrays[j]->keepSelectedComponents(compoIds));
580 std::vector<DataArrayDouble *> arrays3(arrays.size());
581 for(std::size_t j=0;j<arrays.size();j++)
582 arrays3[j]=arrays2[j];
583 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
584 ret->setTimeUnit(getTimeUnit());
585 ret->setArrays(arrays3,0);
589 void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds)
591 std::vector<DataArrayDouble *> arrays1,arrays2;
593 other->getArrays(arrays2);
594 if(arrays1.size()!=arrays2.size())
595 throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : number of arrays mismatch !");
596 for(std::size_t i=0;i<arrays1.size();i++)
598 if(arrays1[i]!=0 && arrays2[i]!=0)
599 arrays1[i]->setSelectedComponents(arrays2[i],compoIds);
600 else if(arrays1[i]!=0 || arrays2[i]!=0)
601 throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : some time array in correspondance are not defined symetrically !");
605 void MEDCouplingTimeDiscretization::changeNbOfComponents(int newNbOfComp, double dftValue)
607 std::vector<DataArrayDouble *> arrays;
609 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
610 for(std::size_t j=0;j<arrays.size();j++)
613 arrays2[j]=arrays[j]->changeNbOfComponents(newNbOfComp,dftValue);
617 std::vector<DataArrayDouble *> arrays3(arrays.size());
618 for(std::size_t j=0;j<arrays.size();j++)
619 arrays3[j]=arrays2[j];
620 setArrays(arrays3,0);
623 void MEDCouplingTimeDiscretization::sortPerTuple(bool asc)
625 std::vector<DataArrayDouble *> arrays;
627 for(std::size_t j=0;j<arrays.size();j++)
630 arrays[j]->sortPerTuple(asc);
634 void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, int nbOfCompo, double value)
636 std::vector<DataArrayDouble *> arrays;
638 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
639 for(std::size_t j=0;j<arrays.size();j++)
643 arrays2[j]=arrays[j]->changeNbOfComponents(nbOfCompo,value);
644 arrays2[j]->fillWithValue(value);
648 arrays2[j]=DataArrayDouble::New();
649 arrays2[j]->alloc(nbOfTuple,nbOfCompo);
650 arrays2[j]->fillWithValue(value);
653 std::vector<DataArrayDouble *> arrays3(arrays.size());
654 for(std::size_t j=0;j<arrays.size();j++)
655 arrays3[j]=arrays2[j];
656 setArrays(arrays3,0);
659 void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value)
661 std::vector<DataArrayDouble *> arrays;
663 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
665 for(std::size_t j=0;j<arrays.size();j++)
669 arrays2[j]=arrays[j]; arrays2[j]->incrRef();
670 arrays2[j]->fillWithValue(value);
675 arrays2[j]=DataArrayDouble::New();
676 arrays2[j]->alloc(nbOfTuple,1);
677 arrays2[j]->fillWithValue(value);
682 std::vector<DataArrayDouble *> arrays3(arrays.size());
683 for(std::size_t j=0;j<arrays.size();j++)
684 arrays3[j]=arrays2[j];
685 setArrays(arrays3,0);
689 void MEDCouplingTimeDiscretization::applyLin(double a, double b, int compoId)
691 std::vector<DataArrayDouble *> arrays;
693 for(std::size_t j=0;j<arrays.size();j++)
696 arrays[j]->applyLin(a,b,compoId);
700 void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, FunctionToEvaluate func)
702 std::vector<DataArrayDouble *> arrays;
704 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
705 for(std::size_t j=0;j<arrays.size();j++)
708 arrays2[j]=arrays[j]->applyFunc(nbOfComp,func);
712 std::vector<DataArrayDouble *> arrays3(arrays.size());
713 for(std::size_t j=0;j<arrays.size();j++)
714 arrays3[j]=arrays2[j];
715 setArrays(arrays3,0);
718 void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const char *func)
720 std::vector<DataArrayDouble *> arrays;
722 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
723 for(std::size_t j=0;j<arrays.size();j++)
726 arrays2[j]=arrays[j]->applyFunc(nbOfComp,func);
730 std::vector<DataArrayDouble *> arrays3(arrays.size());
731 for(std::size_t j=0;j<arrays.size();j++)
732 arrays3[j]=arrays2[j];
733 setArrays(arrays3,0);
736 void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const char *func)
738 std::vector<DataArrayDouble *> arrays;
740 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
741 for(std::size_t j=0;j<arrays.size();j++)
744 arrays2[j]=arrays[j]->applyFunc2(nbOfComp,func);
748 std::vector<DataArrayDouble *> arrays3(arrays.size());
749 for(std::size_t j=0;j<arrays.size();j++)
750 arrays3[j]=arrays2[j];
751 setArrays(arrays3,0);
754 void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func)
756 std::vector<DataArrayDouble *> arrays;
758 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
759 for(std::size_t j=0;j<arrays.size();j++)
762 arrays2[j]=arrays[j]->applyFunc3(nbOfComp,varsOrder,func);
766 std::vector<DataArrayDouble *> arrays3(arrays.size());
767 for(std::size_t j=0;j<arrays.size();j++)
768 arrays3[j]=arrays2[j];
769 setArrays(arrays3,0);
772 void MEDCouplingTimeDiscretization::applyFunc(const char *func)
774 std::vector<DataArrayDouble *> arrays;
776 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
777 for(std::size_t j=0;j<arrays.size();j++)
780 arrays2[j]=arrays[j]->applyFunc(func);
784 std::vector<DataArrayDouble *> arrays3(arrays.size());
785 for(std::size_t j=0;j<arrays.size();j++)
786 arrays3[j]=arrays2[j];
787 setArrays(arrays3,0);
790 void MEDCouplingTimeDiscretization::applyFuncFast32(const char *func)
792 std::vector<DataArrayDouble *> arrays;
794 for(std::size_t j=0;j<arrays.size();j++)
797 arrays[j]->applyFuncFast32(func);
801 void MEDCouplingTimeDiscretization::applyFuncFast64(const char *func)
803 std::vector<DataArrayDouble *> arrays;
805 for(std::size_t j=0;j<arrays.size();j++)
808 arrays[j]->applyFuncFast64(func);
812 void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func)
814 std::vector<DataArrayDouble *> arrays;
816 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
817 for(std::size_t j=0;j<arrays.size();j++)
818 arrays2[j]=loc->applyFunc(nbOfComp,func);
819 std::vector<DataArrayDouble *> arrays3(arrays.size());
820 for(std::size_t j=0;j<arrays.size();j++)
821 arrays3[j]=arrays2[j];
822 setArrays(arrays3,0);
825 void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const char *func)
827 std::vector<DataArrayDouble *> arrays;
829 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
830 for(std::size_t j=0;j<arrays.size();j++)
831 arrays2[j]=loc->applyFunc(nbOfComp,func);
832 std::vector<DataArrayDouble *> arrays3(arrays.size());
833 for(std::size_t j=0;j<arrays.size();j++)
834 arrays3[j]=arrays2[j];
835 setArrays(arrays3,0);
838 void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const char *func)
840 std::vector<DataArrayDouble *> arrays;
842 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
843 for(std::size_t j=0;j<arrays.size();j++)
844 arrays2[j]=loc->applyFunc2(nbOfComp,func);
845 std::vector<DataArrayDouble *> arrays3(arrays.size());
846 for(std::size_t j=0;j<arrays.size();j++)
847 arrays3[j]=arrays2[j];
848 setArrays(arrays3,0);
851 void MEDCouplingTimeDiscretization::fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func)
853 std::vector<DataArrayDouble *> arrays;
855 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
856 for(std::size_t j=0;j<arrays.size();j++)
857 arrays2[j]=loc->applyFunc3(nbOfComp,varsOrder,func);
858 std::vector<DataArrayDouble *> arrays3(arrays.size());
859 for(std::size_t j=0;j<arrays.size();j++)
860 arrays3[j]=arrays2[j];
861 setArrays(arrays3,0);
864 MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel()
868 MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy)
872 std::string MEDCouplingNoTimeLabel::getStringRepr() const
874 std::ostringstream stream;
876 stream << "\nTime unit is : \"" << _time_unit << "\"";
880 void MEDCouplingNoTimeLabel::synchronizeTimeWith(const MEDCouplingMesh *mesh)
882 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::synchronizeTimeWith : impossible to synchronize time with a MEDCouplingMesh because the time discretization is incompatible with it !");
885 bool MEDCouplingNoTimeLabel::areCompatible(const MEDCouplingTimeDiscretization *other) const
887 if(!MEDCouplingTimeDiscretization::areCompatible(other))
889 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
893 bool MEDCouplingNoTimeLabel::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
895 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
897 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
900 reason.insert(0,"time discretization of this is NO_TIME, other has a different time discretization.");
904 bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
906 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
908 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
912 bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
914 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
916 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
920 bool MEDCouplingNoTimeLabel::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
922 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
924 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
928 bool MEDCouplingNoTimeLabel::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
930 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
933 reason="This has time discretization NO_TIME, other not.";
936 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
939 bool MEDCouplingNoTimeLabel::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
941 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
944 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
947 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const MEDCouplingTimeDiscretization *other) const
949 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
951 throw INTERP_KERNEL::Exception("NoTimeLabel::aggregation on mismatched time discretization !");
952 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
953 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
954 ret->setArray(arr,0);
958 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
960 std::vector<const DataArrayDouble *> a(other.size());
962 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
964 const MEDCouplingNoTimeLabel *itC=dynamic_cast<const MEDCouplingNoTimeLabel *>(*it);
966 throw INTERP_KERNEL::Exception("NoTimeLabel::aggregate on mismatched time discretization !");
967 a[i]=itC->getArray();
969 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
970 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
971 ret->setArray(arr,0);
975 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::meld(const MEDCouplingTimeDiscretization *other) const
977 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
979 throw INTERP_KERNEL::Exception("NoTimeLabel::meld on mismatched time discretization !");
980 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
981 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
982 ret->setTimeTolerance(getTimeTolerance());
983 ret->setArray(arr,0);
987 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::dot(const MEDCouplingTimeDiscretization *other) const
989 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
991 throw INTERP_KERNEL::Exception("NoTimeLabel::dot on mismatched time discretization !");
992 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
993 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
994 ret->setArray(arr,0);
998 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::crossProduct(const MEDCouplingTimeDiscretization *other) const
1000 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1002 throw INTERP_KERNEL::Exception("NoTimeLabel::crossProduct on mismatched time discretization !");
1003 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
1004 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1005 ret->setArray(arr,0);
1009 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::max(const MEDCouplingTimeDiscretization *other) const
1011 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1013 throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
1014 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
1015 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1016 ret->setArray(arr,0);
1020 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::min(const MEDCouplingTimeDiscretization *other) const
1022 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1024 throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
1025 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
1026 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1027 ret->setArray(arr,0);
1031 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::add(const MEDCouplingTimeDiscretization *other) const
1033 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1035 throw INTERP_KERNEL::Exception("NoTimeLabel::add on mismatched time discretization !");
1036 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
1037 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1038 ret->setArray(arr,0);
1042 void MEDCouplingNoTimeLabel::addEqual(const MEDCouplingTimeDiscretization *other)
1044 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1046 throw INTERP_KERNEL::Exception("NoTimeLabel::addEqual on mismatched time discretization !");
1048 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::addEqual : Data Array is NULL !");
1049 getArray()->addEqual(other->getArray());
1052 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::substract(const MEDCouplingTimeDiscretization *other) const
1054 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1056 throw INTERP_KERNEL::Exception("NoTimeLabel::substract on mismatched time discretization !");
1058 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::substract : Data Array is NULL !");
1059 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
1060 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1061 ret->setArray(arr,0);
1065 void MEDCouplingNoTimeLabel::substractEqual(const MEDCouplingTimeDiscretization *other)
1067 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1069 throw INTERP_KERNEL::Exception("NoTimeLabel::substractEqual on mismatched time discretization !");
1071 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::substractEqual : Data Array is NULL !");
1072 getArray()->substractEqual(other->getArray());
1075 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::multiply(const MEDCouplingTimeDiscretization *other) const
1077 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1079 throw INTERP_KERNEL::Exception("NoTimeLabel::multiply on mismatched time discretization !");
1080 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
1081 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1082 ret->setArray(arr,0);
1086 void MEDCouplingNoTimeLabel::multiplyEqual(const MEDCouplingTimeDiscretization *other)
1088 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1090 throw INTERP_KERNEL::Exception("NoTimeLabel::multiplyEqual on mismatched time discretization !");
1092 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::multiplyEqual : Data Array is NULL !");
1093 getArray()->multiplyEqual(other->getArray());
1096 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::divide(const MEDCouplingTimeDiscretization *other) const
1098 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1100 throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
1101 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
1102 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1103 ret->setArray(arr,0);
1107 void MEDCouplingNoTimeLabel::divideEqual(const MEDCouplingTimeDiscretization *other)
1109 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1111 throw INTERP_KERNEL::Exception("NoTimeLabel::divideEqual on mismatched time discretization !");
1113 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::divideEqual : Data Array is NULL !");
1114 getArray()->divideEqual(other->getArray());
1117 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::pow(const MEDCouplingTimeDiscretization *other) const
1119 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1121 throw INTERP_KERNEL::Exception("pow on mismatched time discretization !");
1122 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
1123 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1124 ret->setArray(arr,0);
1128 void MEDCouplingNoTimeLabel::powEqual(const MEDCouplingTimeDiscretization *other)
1130 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1132 throw INTERP_KERNEL::Exception("NoTimeLabel::powEqual on mismatched time discretization !");
1134 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::powEqual : Data Array is NULL !");
1135 getArray()->powEqual(other->getArray());
1138 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::performCpy(bool deepCpy) const
1140 return new MEDCouplingNoTimeLabel(*this,deepCpy);
1143 void MEDCouplingNoTimeLabel::checkTimePresence(double time) const
1145 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1148 std::vector< const DataArrayDouble *> MEDCouplingNoTimeLabel::getArraysForTime(double time) const
1150 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1153 void MEDCouplingNoTimeLabel::getValueForTime(double time, const std::vector<double>& vals, double *res) const
1155 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1158 bool MEDCouplingNoTimeLabel::isBefore(const MEDCouplingTimeDiscretization *other) const
1160 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1163 bool MEDCouplingNoTimeLabel::isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const
1165 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1168 double MEDCouplingNoTimeLabel::getStartTime(int& iteration, int& order) const
1170 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1173 double MEDCouplingNoTimeLabel::getEndTime(int& iteration, int& order) const
1175 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1178 void MEDCouplingNoTimeLabel::setStartIteration(int it)
1180 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1183 void MEDCouplingNoTimeLabel::setEndIteration(int it)
1185 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1188 void MEDCouplingNoTimeLabel::setStartOrder(int order)
1190 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1193 void MEDCouplingNoTimeLabel::setEndOrder(int order)
1195 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1198 void MEDCouplingNoTimeLabel::setStartTimeValue(double time)
1200 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1203 void MEDCouplingNoTimeLabel::setEndTimeValue(double time)
1205 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1208 void MEDCouplingNoTimeLabel::setStartTime(double time, int iteration, int order)
1210 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1213 void MEDCouplingNoTimeLabel::setEndTime(double time, int iteration, int order)
1215 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1218 void MEDCouplingNoTimeLabel::getValueOnTime(int eltId, double time, double *value) const
1220 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1223 void MEDCouplingNoTimeLabel::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
1225 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1229 * idem getTinySerializationIntInformation except that it is for multi field fetch
1231 void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
1237 * idem getTinySerializationDbleInformation except that it is for multi field fetch
1239 void MEDCouplingNoTimeLabel::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
1242 tinyInfo[0]=_time_tolerance;
1246 * idem finishUnserialization except that it is for multi field fetch
1248 void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
1250 _time_tolerance=tinyInfoD[0];
1253 MEDCouplingWithTimeStep::MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy),
1254 _time(other._time),_iteration(other._iteration),_order(other._order)
1258 MEDCouplingWithTimeStep::MEDCouplingWithTimeStep():_time(0.),_iteration(-1),_order(-1)
1262 std::string MEDCouplingWithTimeStep::getStringRepr() const
1264 std::ostringstream stream;
1265 stream << REPR << " Time is defined by iteration=" << _iteration << " order=" << _order << " and time=" << _time << ".";
1266 stream << "\nTime unit is : \"" << _time_unit << "\"";
1267 return stream.str();
1270 void MEDCouplingWithTimeStep::synchronizeTimeWith(const MEDCouplingMesh *mesh)
1273 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
1275 double val=mesh->getTime(it,order);
1276 _time=val; _iteration=it; _order=order;
1277 std::string tUnit=mesh->getTimeUnit();
1281 void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
1283 MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
1284 tinyInfo.push_back(_iteration);
1285 tinyInfo.push_back(_order);
1288 void MEDCouplingWithTimeStep::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
1290 MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
1291 tinyInfo.push_back(_time);
1294 void MEDCouplingWithTimeStep::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
1296 MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
1298 _iteration=tinyInfoI[2];
1299 _order=tinyInfoI[3];
1303 * idem getTinySerializationIntInformation except that it is for multi field fetch
1305 void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
1308 tinyInfo[0]=_iteration;
1313 * idem getTinySerializationDbleInformation except that it is for multi field fetch
1315 void MEDCouplingWithTimeStep::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
1318 tinyInfo[0]=_time_tolerance;
1323 * idem finishUnserialization except that it is for multi field fetch
1325 void MEDCouplingWithTimeStep::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
1327 _iteration=tinyInfoI[0];
1328 _order=tinyInfoI[1];
1329 _time_tolerance=tinyInfoD[0];
1333 bool MEDCouplingWithTimeStep::areCompatible(const MEDCouplingTimeDiscretization *other) const
1335 if(!MEDCouplingTimeDiscretization::areCompatible(other))
1337 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1341 bool MEDCouplingWithTimeStep::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
1343 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
1345 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1348 reason.insert(0,"time discretization of this is ONE_TIME, other has a different time discretization.");
1352 bool MEDCouplingWithTimeStep::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
1354 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
1356 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1360 bool MEDCouplingWithTimeStep::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
1362 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
1364 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1368 bool MEDCouplingWithTimeStep::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
1370 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
1372 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1376 bool MEDCouplingWithTimeStep::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
1378 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1379 std::ostringstream oss; oss.precision(15);
1382 reason="This has time discretization ONE_TIME, other not.";
1385 if(_iteration!=otherC->_iteration)
1387 oss << "iterations differ. this iteration=" << _iteration << " other iteration=" << otherC->_iteration;
1391 if(_order!=otherC->_order)
1393 oss << "orders differ. this order=" << _order << " other order=" << otherC->_order;
1397 if(std::fabs(_time-otherC->_time)>_time_tolerance)
1399 oss << "times differ. this time=" << _time << " other time=" << otherC->_time;
1403 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
1406 bool MEDCouplingWithTimeStep::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
1408 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1411 if(_iteration!=otherC->_iteration)
1413 if(_order!=otherC->_order)
1415 if(std::fabs(_time-otherC->_time)>_time_tolerance)
1417 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
1420 void MEDCouplingWithTimeStep::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
1422 MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
1423 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(&other);
1425 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::copyTinyAttrFrom : mismatch of time discretization !");
1426 _time=otherC->_time;
1427 _iteration=otherC->_iteration;
1428 _order=otherC->_order;
1431 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const MEDCouplingTimeDiscretization *other) const
1433 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1435 throw INTERP_KERNEL::Exception("WithTimeStep::aggregation on mismatched time discretization !");
1436 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
1437 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1438 ret->setArray(arr,0);
1442 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
1444 std::vector<const DataArrayDouble *> a(other.size());
1446 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
1448 const MEDCouplingWithTimeStep *itC=dynamic_cast<const MEDCouplingWithTimeStep *>(*it);
1450 throw INTERP_KERNEL::Exception("WithTimeStep::aggregate on mismatched time discretization !");
1451 a[i]=itC->getArray();
1453 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
1454 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1455 ret->setArray(arr,0);
1459 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::meld(const MEDCouplingTimeDiscretization *other) const
1461 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1463 throw INTERP_KERNEL::Exception("WithTimeStep::meld on mismatched time discretization !");
1464 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
1465 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1466 ret->setArray(arr,0);
1470 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::dot(const MEDCouplingTimeDiscretization *other) const
1472 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1474 throw INTERP_KERNEL::Exception("WithTimeStep::dot on mismatched time discretization !");
1475 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1476 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
1477 ret->setArray(arr,0);
1481 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::crossProduct(const MEDCouplingTimeDiscretization *other) const
1483 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1485 throw INTERP_KERNEL::Exception("WithTimeStep::crossProduct on mismatched time discretization !");
1486 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
1487 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1488 ret->setArray(arr,0);
1492 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::max(const MEDCouplingTimeDiscretization *other) const
1494 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1496 throw INTERP_KERNEL::Exception("WithTimeStep::max on mismatched time discretization !");
1497 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
1498 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1499 ret->setArray(arr,0);
1503 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::min(const MEDCouplingTimeDiscretization *other) const
1505 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1507 throw INTERP_KERNEL::Exception("WithTimeStep::min on mismatched time discretization !");
1508 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
1509 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1510 ret->setArray(arr,0);
1514 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::add(const MEDCouplingTimeDiscretization *other) const
1516 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1518 throw INTERP_KERNEL::Exception("WithTimeStep::add on mismatched time discretization !");
1519 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
1520 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1521 ret->setArray(arr,0);
1523 double tmp3=getStartTime(tmp1,tmp2);
1524 ret->setStartTime(tmp3,tmp1,tmp2);
1528 void MEDCouplingWithTimeStep::addEqual(const MEDCouplingTimeDiscretization *other)
1530 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1532 throw INTERP_KERNEL::Exception("WithTimeStep::addEqual on mismatched time discretization !");
1534 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::addEqual : Data Array is NULL !");
1535 getArray()->addEqual(other->getArray());
1538 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::substract(const MEDCouplingTimeDiscretization *other) const
1540 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1542 throw INTERP_KERNEL::Exception("WithTimeStep::substract on mismatched time discretization !");
1543 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
1544 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1545 ret->setArray(arr,0);
1547 double tmp3=getStartTime(tmp1,tmp2);
1548 ret->setStartTime(tmp3,tmp1,tmp2);
1552 void MEDCouplingWithTimeStep::substractEqual(const MEDCouplingTimeDiscretization *other)
1554 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1556 throw INTERP_KERNEL::Exception("WithTimeStep::substractEqual on mismatched time discretization !");
1558 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::substractEqual : Data Array is NULL !");
1559 getArray()->substractEqual(other->getArray());
1562 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::multiply(const MEDCouplingTimeDiscretization *other) const
1564 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1566 throw INTERP_KERNEL::Exception("WithTimeStep::multiply on mismatched time discretization !");
1567 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
1568 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1569 ret->setArray(arr,0);
1571 double tmp3=getStartTime(tmp1,tmp2);
1572 ret->setStartTime(tmp3,tmp1,tmp2);
1576 void MEDCouplingWithTimeStep::multiplyEqual(const MEDCouplingTimeDiscretization *other)
1578 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1580 throw INTERP_KERNEL::Exception("WithTimeStep::multiplyEqual on mismatched time discretization !");
1582 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::multiplyEqual : Data Array is NULL !");
1583 getArray()->multiplyEqual(other->getArray());
1586 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::divide(const MEDCouplingTimeDiscretization *other) const
1588 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1590 throw INTERP_KERNEL::Exception("WithTimeStep::divide on mismatched time discretization !");
1591 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
1592 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1593 ret->setArray(arr,0);
1595 double tmp3=getStartTime(tmp1,tmp2);
1596 ret->setStartTime(tmp3,tmp1,tmp2);
1600 void MEDCouplingWithTimeStep::divideEqual(const MEDCouplingTimeDiscretization *other)
1602 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1604 throw INTERP_KERNEL::Exception("WithTimeStep::divideEqual on mismatched time discretization !");
1606 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::divideEqual : Data Array is NULL !");
1607 getArray()->divideEqual(other->getArray());
1610 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::pow(const MEDCouplingTimeDiscretization *other) const
1612 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1614 throw INTERP_KERNEL::Exception("WithTimeStep::pow on mismatched time discretization !");
1615 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
1616 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1617 ret->setArray(arr,0);
1619 double tmp3=getStartTime(tmp1,tmp2);
1620 ret->setStartTime(tmp3,tmp1,tmp2);
1624 void MEDCouplingWithTimeStep::powEqual(const MEDCouplingTimeDiscretization *other)
1626 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1628 throw INTERP_KERNEL::Exception("WithTimeStep::powEqual on mismatched time discretization !");
1630 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::powEqual : Data Array is NULL !");
1631 getArray()->powEqual(other->getArray());
1634 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::performCpy(bool deepCpy) const
1636 return new MEDCouplingWithTimeStep(*this,deepCpy);
1639 void MEDCouplingWithTimeStep::checkNoTimePresence() const
1641 throw INTERP_KERNEL::Exception("No time specified on a field defined on one time");
1644 void MEDCouplingWithTimeStep::checkTimePresence(double time) const
1646 if(std::fabs(time-_time)>_time_tolerance)
1648 std::ostringstream stream;
1649 stream << "The field is defined on time " << _time << " with eps=" << _time_tolerance << " and asking time = " << time << " !";
1650 throw INTERP_KERNEL::Exception(stream.str().c_str());
1654 std::vector< const DataArrayDouble *> MEDCouplingWithTimeStep::getArraysForTime(double time) const
1656 if(std::fabs(time-_time)<=_time_tolerance)
1658 std::vector< const DataArrayDouble *> ret(1);
1663 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1666 void MEDCouplingWithTimeStep::getValueForTime(double time, const std::vector<double>& vals, double *res) const
1668 std::copy(vals.begin(),vals.end(),res);
1671 void MEDCouplingWithTimeStep::getValueOnTime(int eltId, double time, double *value) const
1673 if(std::fabs(time-_time)<=_time_tolerance)
1675 _array->getTuple(eltId,value);
1677 throw INTERP_KERNEL::Exception("No array existing.");
1679 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1682 void MEDCouplingWithTimeStep::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
1684 if(_iteration==iteration && _order==order)
1686 _array->getTuple(eltId,value);
1688 throw INTERP_KERNEL::Exception("No array existing.");
1690 throw INTERP_KERNEL::Exception("No data on this discrete time.");
1693 MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval():_start_time(0.),_end_time(0.),_start_iteration(-1),_end_iteration(-1),_start_order(-1),_end_order(-1)
1697 void MEDCouplingConstOnTimeInterval::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
1699 MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
1700 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(&other);
1702 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::copyTinyAttrFrom : mismatch of time discretization !");
1703 _start_time=otherC->_start_time;
1704 _end_time=otherC->_end_time;
1705 _start_iteration=otherC->_start_iteration;
1706 _end_iteration=otherC->_end_iteration;
1707 _start_order=otherC->_start_order;
1708 _end_order=otherC->_end_order;
1711 void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
1713 MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
1714 tinyInfo.push_back(_start_iteration);
1715 tinyInfo.push_back(_start_order);
1716 tinyInfo.push_back(_end_iteration);
1717 tinyInfo.push_back(_end_order);
1720 void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
1722 MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
1723 tinyInfo.push_back(_start_time);
1724 tinyInfo.push_back(_end_time);
1727 void MEDCouplingConstOnTimeInterval::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
1729 MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
1730 _start_time=tinyInfoD[1];
1731 _end_time=tinyInfoD[2];
1732 _start_iteration=tinyInfoI[2];
1733 _start_order=tinyInfoI[3];
1734 _end_iteration=tinyInfoI[4];
1735 _end_order=tinyInfoI[5];
1739 * idem getTinySerializationIntInformation except that it is for multi field fetch
1741 void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
1744 tinyInfo[0]=_start_iteration;
1745 tinyInfo[1]=_start_order;
1746 tinyInfo[2]=_end_iteration;
1747 tinyInfo[3]=_end_order;
1751 * idem getTinySerializationDbleInformation except that it is for multi field fetch
1753 void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
1756 tinyInfo[0]=_time_tolerance;
1757 tinyInfo[1]=_start_time;
1758 tinyInfo[2]=_end_time;
1762 * idem finishUnserialization except that it is for multi field fetch
1764 void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
1766 _start_iteration=tinyInfoI[0];
1767 _start_order=tinyInfoI[1];
1768 _end_iteration=tinyInfoI[2];
1769 _end_order=tinyInfoI[3];
1770 _time_tolerance=tinyInfoD[0];
1771 _start_time=tinyInfoD[1];
1772 _end_time=tinyInfoD[2];
1775 MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCpy):
1776 MEDCouplingTimeDiscretization(other,deepCpy),_start_time(other._start_time),_end_time(other._end_time),_start_iteration(other._start_iteration),
1777 _end_iteration(other._end_iteration),_start_order(other._start_order),_end_order(other._end_order)
1781 std::string MEDCouplingConstOnTimeInterval::getStringRepr() const
1783 std::ostringstream stream;
1784 stream << REPR << " Time interval is defined by :\niteration_start=" << _start_iteration << " order_start=" << _start_order << " and time_start=" << _start_time << "\n";
1785 stream << "iteration_end=" << _end_iteration << " order_end=" << _end_order << " and end_time=" << _end_time << "\n";
1786 stream << "\nTime unit is : \"" << _time_unit << "\"";
1787 return stream.str();
1790 void MEDCouplingConstOnTimeInterval::synchronizeTimeWith(const MEDCouplingMesh *mesh)
1793 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
1795 double val=mesh->getTime(it,order);
1796 _start_time=val; _start_iteration=it; _start_order=order;
1797 _end_time=val; _end_iteration=it; _end_order=order;
1798 std::string tUnit=mesh->getTimeUnit();
1802 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::performCpy(bool deepCpy) const
1804 return new MEDCouplingConstOnTimeInterval(*this,deepCpy);
1807 std::vector< const DataArrayDouble *> MEDCouplingConstOnTimeInterval::getArraysForTime(double time) const
1809 if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
1811 std::vector< const DataArrayDouble *> ret(1);
1816 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1819 void MEDCouplingConstOnTimeInterval::getValueForTime(double time, const std::vector<double>& vals, double *res) const
1821 std::copy(vals.begin(),vals.end(),res);
1824 bool MEDCouplingConstOnTimeInterval::areCompatible(const MEDCouplingTimeDiscretization *other) const
1826 if(!MEDCouplingTimeDiscretization::areCompatible(other))
1828 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1832 bool MEDCouplingConstOnTimeInterval::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
1834 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
1836 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1839 reason.insert(0,"time discretization of this is CONST_ON_TIME_INTERVAL, other has a different time discretization.");
1843 bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
1845 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
1847 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1851 bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
1853 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
1855 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1859 bool MEDCouplingConstOnTimeInterval::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
1861 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
1863 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1867 bool MEDCouplingConstOnTimeInterval::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
1869 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1870 std::ostringstream oss; oss.precision(15);
1873 reason="This has time discretization CONST_ON_TIME_INTERVAL, other not.";
1876 if(_start_iteration!=otherC->_start_iteration)
1878 oss << "start iterations differ. this start iteration=" << _start_iteration << " other start iteration=" << otherC->_start_iteration;
1882 if(_start_order!=otherC->_start_order)
1884 oss << "start orders differ. this start order=" << _start_order << " other start order=" << otherC->_start_order;
1888 if(std::fabs(_start_time-otherC->_start_time)>_time_tolerance)
1890 oss << "start times differ. this start time=" << _start_time << " other start time=" << otherC->_start_time;
1894 if(_end_iteration!=otherC->_end_iteration)
1896 oss << "end iterations differ. this end iteration=" << _end_iteration << " other end iteration=" << otherC->_end_iteration;
1900 if(_end_order!=otherC->_end_order)
1902 oss << "end orders differ. this end order=" << _end_order << " other end order=" << otherC->_end_order;
1906 if(std::fabs(_end_time-otherC->_end_time)>_time_tolerance)
1908 oss << "end times differ. this end time=" << _end_time << " other end time=" << otherC->_end_time;
1912 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
1915 bool MEDCouplingConstOnTimeInterval::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
1917 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1920 if(_start_iteration!=otherC->_start_iteration)
1922 if(_start_order!=otherC->_start_order)
1924 if(std::fabs(_start_time-otherC->_start_time)>_time_tolerance)
1926 if(_end_iteration!=otherC->_end_iteration)
1928 if(_end_order!=otherC->_end_order)
1930 if(std::fabs(_end_time-otherC->_end_time)>_time_tolerance)
1932 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
1935 void MEDCouplingConstOnTimeInterval::getValueOnTime(int eltId, double time, double *value) const
1937 if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
1939 _array->getTuple(eltId,value);
1941 throw INTERP_KERNEL::Exception("No array existing.");
1943 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1946 void MEDCouplingConstOnTimeInterval::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
1948 if(iteration>=_start_iteration && iteration<=_end_iteration)
1950 _array->getTuple(eltId,value);
1952 throw INTERP_KERNEL::Exception("No array existing.");
1954 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1957 void MEDCouplingConstOnTimeInterval::checkNoTimePresence() const
1959 throw INTERP_KERNEL::Exception("No time specified on a field defined as constant on one time interval");
1962 void MEDCouplingConstOnTimeInterval::checkTimePresence(double time) const
1964 if(time<_start_time-_time_tolerance || time>_end_time+_time_tolerance)
1966 std::ostringstream stream;
1967 stream << "The field is defined between times " << _start_time << " and " << _end_time << " worderh tolerance ";
1968 stream << _time_tolerance << " and trying to access on time = " << time;
1969 throw INTERP_KERNEL::Exception(stream.str().c_str());
1973 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const MEDCouplingTimeDiscretization *other) const
1975 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1977 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregation on mismatched time discretization !");
1978 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
1979 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
1980 ret->setArray(arr,0);
1984 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
1986 std::vector<const DataArrayDouble *> a(other.size());
1988 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
1990 const MEDCouplingConstOnTimeInterval *itC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(*it);
1992 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregate on mismatched time discretization !");
1993 a[i]=itC->getArray();
1995 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
1996 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
1997 ret->setArray(arr,0);
2001 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::meld(const MEDCouplingTimeDiscretization *other) const
2003 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2005 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::meld on mismatched time discretization !");
2006 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
2007 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2008 ret->setTimeTolerance(getTimeTolerance());
2009 ret->setArray(arr,0);
2013 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::dot(const MEDCouplingTimeDiscretization *other) const
2015 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2017 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::dot on mismatched time discretization !");
2018 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
2019 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2020 ret->setArray(arr,0);
2024 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::crossProduct(const MEDCouplingTimeDiscretization *other) const
2026 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2028 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::crossProduct on mismatched time discretization !");
2029 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
2030 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2031 ret->setArray(arr,0);
2035 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::max(const MEDCouplingTimeDiscretization *other) const
2037 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2039 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::max on mismatched time discretization !");
2040 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
2041 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2042 ret->setArray(arr,0);
2046 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::min(const MEDCouplingTimeDiscretization *other) const
2048 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2050 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::min on mismatched time discretization !");
2051 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
2052 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2053 ret->setArray(arr,0);
2057 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::add(const MEDCouplingTimeDiscretization *other) const
2059 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2061 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::add on mismatched time discretization !");
2062 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
2063 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2064 ret->setArray(arr,0);
2066 double tmp3=getStartTime(tmp1,tmp2);
2067 ret->setStartTime(tmp3,tmp1,tmp2);
2068 tmp3=getEndTime(tmp1,tmp2);
2069 ret->setEndTime(tmp3,tmp1,tmp2);
2073 void MEDCouplingConstOnTimeInterval::addEqual(const MEDCouplingTimeDiscretization *other)
2075 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2077 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::addEqual on mismatched time discretization !");
2079 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::substractaddEqual : Data Array is NULL !");
2080 getArray()->addEqual(other->getArray());
2083 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const MEDCouplingTimeDiscretization *other) const
2085 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2087 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substract on mismatched time discretization !");
2088 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
2089 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2090 ret->setArray(arr,0);
2092 double tmp3=getStartTime(tmp1,tmp2);
2093 ret->setStartTime(tmp3,tmp1,tmp2);
2094 tmp3=getEndTime(tmp1,tmp2);
2095 ret->setEndTime(tmp3,tmp1,tmp2);
2099 void MEDCouplingConstOnTimeInterval::substractEqual(const MEDCouplingTimeDiscretization *other)
2101 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2103 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substractEqual on mismatched time discretization !");
2105 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::substractEqual : Data Array is NULL !");
2106 getArray()->substractEqual(other->getArray());
2109 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::multiply(const MEDCouplingTimeDiscretization *other) const
2111 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2113 throw INTERP_KERNEL::Exception("multiply on mismatched time discretization !");
2114 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
2115 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2116 ret->setArray(arr,0);
2118 double tmp3=getStartTime(tmp1,tmp2);
2119 ret->setStartTime(tmp3,tmp1,tmp2);
2120 tmp3=getEndTime(tmp1,tmp2);
2121 ret->setEndTime(tmp3,tmp1,tmp2);
2125 void MEDCouplingConstOnTimeInterval::multiplyEqual(const MEDCouplingTimeDiscretization *other)
2127 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2129 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::multiplyEqual on mismatched time discretization !");
2131 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::multiplyEqual : Data Array is NULL !");
2132 getArray()->multiplyEqual(other->getArray());
2135 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::divide(const MEDCouplingTimeDiscretization *other) const
2137 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2139 throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
2140 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
2141 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2142 ret->setArray(arr,0);
2144 double tmp3=getStartTime(tmp1,tmp2);
2145 ret->setStartTime(tmp3,tmp1,tmp2);
2146 tmp3=getEndTime(tmp1,tmp2);
2147 ret->setEndTime(tmp3,tmp1,tmp2);
2151 void MEDCouplingConstOnTimeInterval::divideEqual(const MEDCouplingTimeDiscretization *other)
2153 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2155 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::divideEqual on mismatched time discretization !");
2157 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::divideEqual : Data Array is NULL !");
2158 getArray()->divideEqual(other->getArray());
2161 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::pow(const MEDCouplingTimeDiscretization *other) const
2163 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2165 throw INTERP_KERNEL::Exception("pow on mismatched time discretization !");
2166 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
2167 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2168 ret->setArray(arr,0);
2170 double tmp3=getStartTime(tmp1,tmp2);
2171 ret->setStartTime(tmp3,tmp1,tmp2);
2172 tmp3=getEndTime(tmp1,tmp2);
2173 ret->setEndTime(tmp3,tmp1,tmp2);
2177 void MEDCouplingConstOnTimeInterval::powEqual(const MEDCouplingTimeDiscretization *other)
2179 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2181 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::powEqual on mismatched time discretization !");
2183 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::powEqual : Data Array is NULL !");
2184 getArray()->powEqual(other->getArray());
2187 MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy),
2188 _start_time(other._start_time),_end_time(other._end_time),
2189 _start_iteration(other._start_iteration),_end_iteration(other._end_iteration),
2190 _start_order(other._start_order),_end_order(other._end_order)
2192 if(other._end_array)
2193 _end_array=other._end_array->performCpy(deepCpy);
2198 void MEDCouplingTwoTimeSteps::updateTime() const
2200 MEDCouplingTimeDiscretization::updateTime();
2202 updateTimeWith(*_end_array);
2205 void MEDCouplingTwoTimeSteps::synchronizeTimeWith(const MEDCouplingMesh *mesh)
2208 throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
2210 double val=mesh->getTime(it,order);
2211 _start_time=val; _start_iteration=it; _start_order=order;
2212 _end_time=val; _end_iteration=it; _end_order=order;
2213 std::string tUnit=mesh->getTimeUnit();
2217 std::size_t MEDCouplingTwoTimeSteps::getHeapMemorySizeWithoutChildren() const
2219 return MEDCouplingTimeDiscretization::getHeapMemorySizeWithoutChildren();
2222 std::vector<const BigMemoryObject *> MEDCouplingTwoTimeSteps::getDirectChildren() const
2224 std::vector<const BigMemoryObject *> ret(MEDCouplingTimeDiscretization::getDirectChildren());
2226 ret.push_back(_end_array);
2230 void MEDCouplingTwoTimeSteps::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
2232 MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
2233 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(&other);
2235 throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::copyTinyAttrFrom : mismatch of time discretization !");
2236 _start_time=otherC->_start_time;
2237 _end_time=otherC->_end_time;
2238 _start_iteration=otherC->_start_iteration;
2239 _end_iteration=otherC->_end_iteration;
2240 _start_order=otherC->_start_order;
2241 _end_order=otherC->_end_order;
2244 void MEDCouplingTwoTimeSteps::copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other)
2246 MEDCouplingTimeDiscretization::copyTinyStringsFrom(other);
2247 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(&other);
2249 throw INTERP_KERNEL::Exception("Trying to operate copyTinyStringsFrom on different field type (two times//one time) !");
2250 if(_end_array && otherC->_end_array)
2251 _end_array->copyStringInfoFrom(*otherC->_end_array);
2254 const DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray() const
2259 DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray()
2264 void MEDCouplingTwoTimeSteps::checkCoherency() const
2266 MEDCouplingTimeDiscretization::checkCoherency();
2268 throw INTERP_KERNEL::Exception("No end array specified !");
2269 if(_array->getNumberOfComponents()!=_end_array->getNumberOfComponents())
2270 throw INTERP_KERNEL::Exception("The number of components mismatch between the start and the end arrays !");
2271 if(_array->getNumberOfTuples()!=_end_array->getNumberOfTuples())
2272 throw INTERP_KERNEL::Exception("The number of tuples mismatch between the start and the end arrays !");
2275 bool MEDCouplingTwoTimeSteps::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
2277 std::ostringstream oss;
2278 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(other);
2281 reason="This has time discretization LINEAR_TIME, other not.";
2284 if(_start_iteration!=otherC->_start_iteration)
2286 oss << "start iterations differ. this start iteration=" << _start_iteration << " other start iteration=" << otherC->_start_iteration;
2290 if(_start_order!=otherC->_start_order)
2292 oss << "start orders differ. this start order=" << _start_order << " other start order=" << otherC->_start_order;
2296 if(std::fabs(_start_time-otherC->_start_time)>_time_tolerance)
2298 oss << "start times differ. this start time=" << _start_time << " other start time=" << otherC->_start_time;
2302 if(_end_iteration!=otherC->_end_iteration)
2304 oss << "end iterations differ. this end iteration=" << _end_iteration << " other end iteration=" << otherC->_end_iteration;
2308 if(_end_order!=otherC->_end_order)
2310 oss << "end orders differ. this end order=" << _end_order << " other end order=" << otherC->_end_order;
2314 if(std::fabs(_end_time-otherC->_end_time)>_time_tolerance)
2316 oss << "end times differ. this end time=" << _end_time << " other end time=" << otherC->_end_time;
2320 if(_end_array!=otherC->_end_array)
2321 if(!_end_array->isEqualIfNotWhy(*otherC->_end_array,prec,reason))
2323 reason.insert(0,"end arrays differ for linear time.");
2326 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
2329 bool MEDCouplingTwoTimeSteps::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
2331 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(other);
2334 if(_start_iteration!=otherC->_start_iteration)
2336 if(_end_iteration!=otherC->_end_iteration)
2338 if(_start_order!=otherC->_start_order)
2340 if(_end_order!=otherC->_end_order)
2342 if(std::fabs(_start_time-otherC->_start_time)>_time_tolerance)
2344 if(std::fabs(_end_time-otherC->_end_time)>_time_tolerance)
2346 if(_end_array!=otherC->_end_array)
2347 if(!_end_array->isEqualWithoutConsideringStr(*otherC->_end_array,prec))
2349 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
2352 MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps():_start_time(0.),_end_time(0.),_start_iteration(-1),_end_iteration(-1),_start_order(-1),_end_order(-1),_end_array(0)
2356 MEDCouplingTwoTimeSteps::~MEDCouplingTwoTimeSteps()
2359 _end_array->decrRef();
2362 void MEDCouplingTwoTimeSteps::checkNoTimePresence() const
2364 throw INTERP_KERNEL::Exception("The field presents a time to be specified in every access !");
2367 void MEDCouplingTwoTimeSteps::checkTimePresence(double time) const
2369 if(time<_start_time-_time_tolerance || time>_end_time+_time_tolerance)
2371 std::ostringstream stream;
2372 stream << "The field is defined between times " << _start_time << " and " << _end_time << " worderh tolerance ";
2373 stream << _time_tolerance << " and trying to access on time = " << time;
2374 throw INTERP_KERNEL::Exception(stream.str().c_str());
2378 void MEDCouplingTwoTimeSteps::getArrays(std::vector<DataArrayDouble *>& arrays) const
2382 arrays[1]=_end_array;
2385 void MEDCouplingTwoTimeSteps::setEndArray(DataArrayDouble *array, TimeLabel *owner)
2387 if(array!=_end_array)
2390 _end_array->decrRef();
2393 _end_array->incrRef();
2395 owner->declareAsNew();
2399 void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
2401 MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
2402 tinyInfo.push_back(_start_iteration);
2403 tinyInfo.push_back(_start_order);
2404 tinyInfo.push_back(_end_iteration);
2405 tinyInfo.push_back(_end_order);
2408 tinyInfo.push_back(_end_array->getNumberOfTuples());
2409 tinyInfo.push_back(_end_array->getNumberOfComponents());
2413 tinyInfo.push_back(-1);
2414 tinyInfo.push_back(-1);
2418 void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
2420 MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
2421 tinyInfo.push_back(_start_time);
2422 tinyInfo.push_back(_end_time);
2425 void MEDCouplingTwoTimeSteps::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
2427 int nbOfCompo=_array->getNumberOfComponents();
2428 for(int i=0;i<nbOfCompo;i++)
2429 tinyInfo.push_back(_array->getInfoOnComponent(i));
2430 for(int i=0;i<nbOfCompo;i++)
2431 tinyInfo.push_back(_end_array->getInfoOnComponent(i));
2434 void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
2440 _end_array->decrRef();
2441 DataArrayDouble *arr=0;
2442 if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
2444 arr=DataArrayDouble::New();
2445 arr->alloc(tinyInfoI[0],tinyInfoI[1]);
2450 if(tinyInfoI[6]!=-1 && tinyInfoI[7]!=-1)
2452 arr=DataArrayDouble::New();
2453 arr->alloc(tinyInfoI[6],tinyInfoI[7]);
2459 void MEDCouplingTwoTimeSteps::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
2461 MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
2462 _start_time=tinyInfoD[1];
2463 _end_time=tinyInfoD[2];
2464 _start_iteration=tinyInfoI[2];
2465 _start_order=tinyInfoI[3];
2466 _end_iteration=tinyInfoI[4];
2467 _end_order=tinyInfoI[5];
2471 * idem getTinySerializationIntInformation except that it is for multi field fetch
2473 void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
2476 tinyInfo[0]=_start_iteration;
2477 tinyInfo[1]=_start_order;
2478 tinyInfo[2]=_end_iteration;
2479 tinyInfo[3]=_end_order;
2483 * idem getTinySerializationDbleInformation except that it is for multi field fetch
2485 void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
2488 tinyInfo[0]=_time_tolerance;
2489 tinyInfo[1]=_start_time;
2490 tinyInfo[2]=_end_time;
2494 * idem finishUnserialization except that it is for multi field fetch
2496 void MEDCouplingTwoTimeSteps::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
2498 _start_iteration=tinyInfoI[0];
2499 _start_order=tinyInfoI[1];
2500 _end_iteration=tinyInfoI[2];
2501 _end_order=tinyInfoI[3];
2502 _time_tolerance=tinyInfoD[0];
2503 _start_time=tinyInfoD[1];
2504 _end_time=tinyInfoD[2];
2507 std::vector< const DataArrayDouble *> MEDCouplingTwoTimeSteps::getArraysForTime(double time) const
2509 if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
2511 std::vector< const DataArrayDouble *> ret(2);
2517 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
2520 void MEDCouplingTwoTimeSteps::setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner)
2522 if(arrays.size()!=2)
2523 throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::setArrays : number of arrays must be two.");
2524 setArray(arrays.front(),owner);
2525 setEndArray(arrays.back(),owner);
2528 MEDCouplingLinearTime::MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCpy):MEDCouplingTwoTimeSteps(other,deepCpy)
2532 MEDCouplingLinearTime::MEDCouplingLinearTime()
2536 std::string MEDCouplingLinearTime::getStringRepr() const
2538 std::ostringstream stream;
2539 stream << REPR << " Time interval is defined by :\niteration_start=" << _start_iteration << " order_start=" << _start_order << " and time_start=" << _start_time << "\n";
2540 stream << "iteration_end=" << _end_iteration << " order_end=" << _end_order << " and end_time=" << _end_time << "\n";
2541 stream << "Time unit is : \"" << _time_unit << "\"";
2542 return stream.str();
2545 void MEDCouplingLinearTime::checkCoherency() const
2547 MEDCouplingTwoTimeSteps::checkCoherency();
2548 if(std::fabs(_start_time-_end_time)<_time_tolerance)
2549 throw INTERP_KERNEL::Exception("Start time and end time are equals regarding time tolerance.");
2552 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::performCpy(bool deepCpy) const
2554 return new MEDCouplingLinearTime(*this,deepCpy);
2557 bool MEDCouplingLinearTime::areCompatible(const MEDCouplingTimeDiscretization *other) const
2559 if(!MEDCouplingTimeDiscretization::areCompatible(other))
2561 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2564 if(_end_array==0 && otherC->_end_array==0)
2566 if(_end_array==0 || otherC->_end_array==0)
2568 if(_end_array->getNumberOfComponents()!=otherC->_end_array->getNumberOfComponents())
2573 bool MEDCouplingLinearTime::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
2575 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
2577 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2580 reason.insert(0,"time discretization of this is LINEAR_TIME, other has a different time discretization.");
2584 bool MEDCouplingLinearTime::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
2586 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
2588 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2592 bool MEDCouplingLinearTime::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
2594 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
2596 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2599 if(_end_array==0 && otherC->_end_array==0)
2601 if(_end_array==0 || otherC->_end_array==0)
2603 int nbC1=_end_array->getNumberOfComponents();
2604 int nbC2=otherC->_end_array->getNumberOfComponents();
2605 if(nbC1!=nbC2 && nbC2!=1)
2610 bool MEDCouplingLinearTime::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
2612 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
2614 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2619 * vals is expected to be of size 2*_array->getNumberOfTuples()==_array->getNumberOfTuples()+_end_array->getNumberOfTuples()
2621 void MEDCouplingLinearTime::getValueForTime(double time, const std::vector<double>& vals, double *res) const
2623 double alpha=(_end_time-time)/(_end_time-_start_time);
2624 std::size_t nbComp=vals.size()/2;
2625 std::transform(vals.begin(),vals.begin()+nbComp,res,std::bind2nd(std::multiplies<double>(),alpha));
2626 std::vector<double> tmp(nbComp);
2627 std::transform(vals.begin()+nbComp,vals.end(),tmp.begin(),std::bind2nd(std::multiplies<double>(),1-alpha));
2628 std::transform(tmp.begin(),tmp.end(),res,res,std::plus<double>());
2631 void MEDCouplingLinearTime::getValueOnTime(int eltId, double time, double *value) const
2633 double alpha=(_end_time-time)/(_end_time-_start_time);
2636 _array->getTuple(eltId,value);
2638 throw INTERP_KERNEL::Exception("No start array existing.");
2639 nbComp=_array->getNumberOfComponents();
2640 std::transform(value,value+nbComp,value,std::bind2nd(std::multiplies<double>(),alpha));
2641 std::vector<double> tmp(nbComp);
2643 _end_array->getTuple(eltId,&tmp[0]);
2645 throw INTERP_KERNEL::Exception("No end array existing.");
2646 std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::multiplies<double>(),1-alpha));
2647 std::transform(tmp.begin(),tmp.end(),value,value,std::plus<double>());
2650 void MEDCouplingLinearTime::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
2652 if(iteration==_start_iteration && order==_start_order)
2655 _array->getTuple(eltId,value);
2657 throw INTERP_KERNEL::Exception("iteration order match with start time but no start array existing.");
2659 if(iteration==_end_iteration && order==_end_order)
2662 _end_array->getTuple(eltId,value);
2664 throw INTERP_KERNEL::Exception("iteration order match with end time but no end array existing.");
2667 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
2670 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const MEDCouplingTimeDiscretization *other) const
2672 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2674 throw INTERP_KERNEL::Exception("LinearTime::aggregation on mismatched time discretization !");
2675 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Aggregate(getArray(),other->getArray());
2676 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Aggregate(getEndArray(),other->getEndArray());
2677 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2678 ret->setArray(arr1,0);
2679 ret->setEndArray(arr2,0);
2683 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
2685 std::vector<const DataArrayDouble *> a(other.size());
2686 std::vector<const DataArrayDouble *> b(other.size());
2688 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
2690 const MEDCouplingLinearTime *itC=dynamic_cast<const MEDCouplingLinearTime *>(*it);
2692 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::aggregate on mismatched time discretization !");
2693 a[i]=itC->getArray();
2694 b[i]=itC->getEndArray();
2696 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
2697 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Aggregate(b);
2698 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2699 ret->setArray(arr,0);
2700 ret->setEndArray(arr2,0);
2704 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::meld(const MEDCouplingTimeDiscretization *other) const
2706 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2708 throw INTERP_KERNEL::Exception("LinearTime::meld on mismatched time discretization !");
2709 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Meld(getArray(),other->getArray());
2710 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Meld(getEndArray(),other->getEndArray());
2711 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2712 ret->setTimeTolerance(getTimeTolerance());
2713 ret->setArray(arr1,0);
2714 ret->setEndArray(arr2,0);
2718 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::dot(const MEDCouplingTimeDiscretization *other) const
2720 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2722 throw INTERP_KERNEL::Exception("LinearTime::dot on mismatched time discretization !");
2723 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Dot(getArray(),other->getArray());
2724 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Dot(getEndArray(),other->getEndArray());
2725 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2726 ret->setArray(arr1,0);
2727 ret->setEndArray(arr2,0);
2731 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::crossProduct(const MEDCouplingTimeDiscretization *other) const
2733 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2735 throw INTERP_KERNEL::Exception("LinearTime::crossProduct on mismatched time discretization !");
2736 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::CrossProduct(getArray(),other->getArray());
2737 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::CrossProduct(getEndArray(),other->getEndArray());
2738 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2739 ret->setArray(arr1,0);
2740 ret->setEndArray(arr2,0);
2744 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::max(const MEDCouplingTimeDiscretization *other) const
2746 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2748 throw INTERP_KERNEL::Exception("LinearTime::max on mismatched time discretization !");
2749 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2750 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Max(getArray(),other->getArray());
2751 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Max(getEndArray(),other->getEndArray());
2752 ret->setArray(arr1,0);
2753 ret->setEndArray(arr2,0);
2757 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::min(const MEDCouplingTimeDiscretization *other) const
2759 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2761 throw INTERP_KERNEL::Exception("LinearTime::min on mismatched time discretization !");
2762 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Min(getArray(),other->getArray());
2763 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Min(getEndArray(),other->getEndArray());
2764 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2765 ret->setArray(arr1,0);
2766 ret->setEndArray(arr2,0);
2770 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::add(const MEDCouplingTimeDiscretization *other) const
2772 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2774 throw INTERP_KERNEL::Exception("LinearTime::add on mismatched time discretization !");
2775 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Add(getArray(),other->getArray());
2776 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Add(getEndArray(),other->getEndArray());
2777 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2778 ret->setArray(arr1,0);
2779 ret->setEndArray(arr2,0);
2783 void MEDCouplingLinearTime::addEqual(const MEDCouplingTimeDiscretization *other)
2785 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2787 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2789 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::addEqual : Data Array is NULL !");
2791 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::addEqual : Data Array (end) is NULL !");
2792 getArray()->addEqual(other->getArray());
2793 getEndArray()->addEqual(other->getEndArray());
2796 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::substract(const MEDCouplingTimeDiscretization *other) const
2798 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2800 throw INTERP_KERNEL::Exception("LinearTime::substract on mismatched time discretization !");
2801 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Substract(getArray(),other->getArray());
2802 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Substract(getEndArray(),other->getEndArray());
2803 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2804 ret->setArray(arr1,0);
2805 ret->setEndArray(arr2,0);
2809 void MEDCouplingLinearTime::substractEqual(const MEDCouplingTimeDiscretization *other)
2811 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2813 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2815 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::substractEqual : Data Array is NULL !");
2817 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::substractEqual : Data Array (end) is NULL !");
2818 getArray()->substractEqual(other->getArray());
2819 getEndArray()->substractEqual(other->getEndArray());
2822 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::multiply(const MEDCouplingTimeDiscretization *other) const
2824 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2826 throw INTERP_KERNEL::Exception("LinearTime::multiply on mismatched time discretization !");
2827 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Multiply(getArray(),other->getArray());
2828 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Multiply(getEndArray(),other->getEndArray());
2829 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2830 ret->setArray(arr1,0);
2831 ret->setEndArray(arr2,0);
2835 void MEDCouplingLinearTime::multiplyEqual(const MEDCouplingTimeDiscretization *other)
2837 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2839 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2841 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::multiplyEqual : Data Array is NULL !");
2843 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::multiplyEqual : Data Array (end) is NULL !");
2844 getArray()->multiplyEqual(other->getArray());
2845 getEndArray()->multiplyEqual(other->getEndArray());
2848 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::divide(const MEDCouplingTimeDiscretization *other) const
2850 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2852 throw INTERP_KERNEL::Exception("LinearTime::divide on mismatched time discretization !");
2853 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Divide(getArray(),other->getArray());
2854 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Divide(getEndArray(),other->getEndArray());
2855 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2856 ret->setArray(arr1,0);
2857 ret->setEndArray(arr2,0);
2861 void MEDCouplingLinearTime::divideEqual(const MEDCouplingTimeDiscretization *other)
2863 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2865 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2867 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::divideEqual : Data Array is NULL !");
2869 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::divideEqual : Data Array (end) is NULL !");
2870 getArray()->divideEqual(other->getArray());
2871 getEndArray()->divideEqual(other->getEndArray());
2874 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::pow(const MEDCouplingTimeDiscretization *other) const
2876 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2878 throw INTERP_KERNEL::Exception("LinearTime::pow on mismatched time discretization !");
2879 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Pow(getArray(),other->getArray());
2880 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Pow(getEndArray(),other->getEndArray());
2881 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2882 ret->setArray(arr1,0);
2883 ret->setEndArray(arr2,0);
2887 void MEDCouplingLinearTime::powEqual(const MEDCouplingTimeDiscretization *other)
2889 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2891 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2893 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::powEqual : Data Array is NULL !");
2895 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::powEqual : Data Array (end) is NULL !");
2896 getArray()->powEqual(other->getArray());
2897 getEndArray()->powEqual(other->getEndArray());