1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
21 #include "MEDCouplingTimeDiscretization.hxx"
22 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
23 #include "MEDCouplingMemArray.hxx"
24 #include "MEDCouplingMesh.hxx"
32 using namespace ParaMEDMEM;
34 const double MEDCouplingTimeDiscretization::TIME_TOLERANCE_DFT=1.e-12;
36 const char MEDCouplingNoTimeLabel::EXCEPTION_MSG[]="MEDCouplingNoTimeLabel::setTime : no time info attached.";
38 const char MEDCouplingNoTimeLabel::REPR[]="No time label defined.";
40 const char MEDCouplingWithTimeStep::EXCEPTION_MSG[]="No data on this time.";
42 const char MEDCouplingWithTimeStep::REPR[]="One time label.";
44 const char MEDCouplingConstOnTimeInterval::EXCEPTION_MSG[]="No data on this time.";
46 const char MEDCouplingConstOnTimeInterval::REPR[]="Constant on a time interval.";
48 const char MEDCouplingTwoTimeSteps::EXCEPTION_MSG[]="No data on this time.";
50 const char MEDCouplingLinearTime::REPR[]="Linear time between 2 time steps.";
52 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::New(TypeOfTimeDiscretization type)
56 case MEDCouplingNoTimeLabel::DISCRETIZATION:
57 return new MEDCouplingNoTimeLabel;
58 case MEDCouplingWithTimeStep::DISCRETIZATION:
59 return new MEDCouplingWithTimeStep;
60 case MEDCouplingConstOnTimeInterval::DISCRETIZATION:
61 return new MEDCouplingConstOnTimeInterval;
62 case MEDCouplingLinearTime::DISCRETIZATION:
63 return new MEDCouplingLinearTime;
65 throw INTERP_KERNEL::Exception("Time discretization not implemented yet");
69 void MEDCouplingTimeDiscretization::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
71 _time_tolerance=other._time_tolerance;
72 _time_unit=other._time_unit;
75 void MEDCouplingTimeDiscretization::copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other)
77 _time_unit=other._time_unit;
78 if(_array && other._array)
79 _array->copyStringInfoFrom(*other._array);
82 void MEDCouplingTimeDiscretization::checkCoherency() const
85 throw INTERP_KERNEL::Exception("Field invalid because no values set !");
86 if(_time_tolerance<0.)
87 throw INTERP_KERNEL::Exception("time tolerance is expected to be greater than 0. !");
90 void MEDCouplingTimeDiscretization::updateTime() const
93 updateTimeWith(*_array);
96 std::size_t MEDCouplingTimeDiscretization::getHeapMemorySizeWithoutChildren() const
98 std::size_t ret(_time_unit.capacity());
102 std::vector<const BigMemoryObject *> MEDCouplingTimeDiscretization::getDirectChildrenWithNull() const
104 std::vector<const BigMemoryObject *> ret;
105 ret.push_back(_array);
109 bool MEDCouplingTimeDiscretization::areCompatible(const MEDCouplingTimeDiscretization *other) const
111 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
113 if(_array==0 && other->_array==0)
115 if(_array==0 || other->_array==0)
117 if(_array->getNumberOfComponents()!=other->_array->getNumberOfComponents())
122 bool MEDCouplingTimeDiscretization::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
124 std::ostringstream oss; oss.precision(15);
125 if(_time_unit!=other->_time_unit)
127 oss << "Field discretizations differ : this time unit = \"" << _time_unit << "\" and other time unit = \"" << other->_time_unit << "\" !";
131 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
133 oss << "Field discretizations differ : this time tolerance = \"" << _time_tolerance << "\" and other time tolerance = \"" << other->_time_tolerance << "\" !";
137 if(_array==0 && other->_array==0)
139 if(_array==0 || other->_array==0)
141 reason="Field discretizations differ : Only one timediscretization between the two this and other has a DataArrayDouble for values defined";
144 if(_array->getNumberOfComponents()!=other->_array->getNumberOfComponents())
146 if(_array->getNumberOfTuples()!=other->_array->getNumberOfTuples())
151 bool MEDCouplingTimeDiscretization::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
153 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
155 if(_array==0 && other->_array==0)
157 if(_array==0 || other->_array==0)
159 if(_array->getNumberOfTuples()!=other->_array->getNumberOfTuples())
164 bool MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
166 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
168 if(_array==0 && other->_array==0)
170 if(_array==0 || other->_array==0)
172 int nbC1=_array->getNumberOfComponents();
173 int nbC2=other->_array->getNumberOfComponents();
174 int nbMin=std::min(nbC1,nbC2);
175 if(nbC1!=nbC2 && nbMin!=1)
180 bool MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
182 if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
184 if(_array==0 && other->_array==0)
186 if(_array==0 || other->_array==0)
188 int nbC1=_array->getNumberOfComponents();
189 int nbC2=other->_array->getNumberOfComponents();
190 if(nbC1!=nbC2 && nbC2!=1)
195 bool MEDCouplingTimeDiscretization::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
197 if(!areStrictlyCompatible(other,reason))
199 if(_array==other->_array)
201 return _array->isEqualIfNotWhy(*other->_array,prec,reason);
204 bool MEDCouplingTimeDiscretization::isEqual(const MEDCouplingTimeDiscretization *other, double prec) const
207 return isEqualIfNotWhy(other,prec,reason);
210 bool MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
213 if(!areStrictlyCompatible(other,tmp))
215 if(_array==other->_array)
217 return _array->isEqualWithoutConsideringStr(*other->_array,prec);
220 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const
222 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(type);
223 ret->setTimeUnit(getTimeUnit());
224 const DataArrayDouble *arrSrc=getArray();
225 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr;
227 arr=arrSrc->performCpy(deepCpy);
228 ret->setArray(arr,0);
232 void MEDCouplingTimeDiscretization::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
236 tinyInfo.push_back(_array->getNumberOfTuples());
237 tinyInfo.push_back(_array->getNumberOfComponents());
241 tinyInfo.push_back(-1);
242 tinyInfo.push_back(-1);
246 void MEDCouplingTimeDiscretization::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
251 DataArrayDouble *arr=0;
252 if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
254 arr=DataArrayDouble::New();
255 arr->alloc(tinyInfoI[0],tinyInfoI[1]);
261 void MEDCouplingTimeDiscretization::checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays)
263 static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size one !";
265 throw INTERP_KERNEL::Exception(MSG);
269 if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
272 throw INTERP_KERNEL::Exception(MSG);
273 arrays[0]->checkNbOfTuplesAndComp(tinyInfoI[0],tinyInfoI[1],MSG);
279 void MEDCouplingTimeDiscretization::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
281 _time_tolerance=tinyInfoD[0];
282 int nbOfCompo=_array->getNumberOfComponents();
283 for(int i=0;i<nbOfCompo;i++)
284 _array->setInfoOnComponent(i,tinyInfoS[i]);
287 void MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
289 tinyInfo.push_back(_time_tolerance);
292 void MEDCouplingTimeDiscretization::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
294 int nbOfCompo=_array->getNumberOfComponents();
295 for(int i=0;i<nbOfCompo;i++)
296 tinyInfo.push_back(_array->getInfoOnComponent(i));
299 MEDCouplingTimeDiscretization::MEDCouplingTimeDiscretization():_time_tolerance(TIME_TOLERANCE_DFT),_array(0)
303 MEDCouplingTimeDiscretization::MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCpy):_time_unit(other._time_unit),_time_tolerance(other._time_tolerance)
306 _array=other._array->performCpy(deepCpy);
311 MEDCouplingTimeDiscretization::~MEDCouplingTimeDiscretization()
317 void MEDCouplingTimeDiscretization::setArray(DataArrayDouble *array, TimeLabel *owner)
327 owner->declareAsNew();
331 const DataArrayDouble *MEDCouplingTimeDiscretization::getEndArray() const
333 throw INTERP_KERNEL::Exception("getEndArray not available for this type of time discretization !");
336 DataArrayDouble *MEDCouplingTimeDiscretization::getEndArray()
338 throw INTERP_KERNEL::Exception("getEndArray not available for this type of time discretization !");
341 void MEDCouplingTimeDiscretization::setEndArray(DataArrayDouble *array, TimeLabel *owner)
343 throw INTERP_KERNEL::Exception("setEndArray not available for this type of time discretization !");
346 void MEDCouplingTimeDiscretization::setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner)
349 throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretization::setArrays : number of arrays must be one.");
350 setArray(arrays.back(),owner);
353 void MEDCouplingTimeDiscretization::getArrays(std::vector<DataArrayDouble *>& arrays) const
359 bool MEDCouplingTimeDiscretization::isBefore(const MEDCouplingTimeDiscretization *other) const
362 double time1=getEndTime(iteration,order)-_time_tolerance;
363 double time2=other->getStartTime(iteration,order)+other->getTimeTolerance();
367 bool MEDCouplingTimeDiscretization::isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const
370 double time1=getEndTime(iteration,order)+_time_tolerance;
371 double time2=other->getStartTime(iteration,order)-other->getTimeTolerance();
375 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::doublyContractedProduct() const
377 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
378 ret->setTimeUnit(getTimeUnit());
379 std::vector<DataArrayDouble *> arrays;
381 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
382 for(std::size_t j=0;j<arrays.size();j++)
385 arrays2[j]=arrays[j]->doublyContractedProduct();
389 std::vector<DataArrayDouble *> arrays3(arrays.size());
390 for(std::size_t j=0;j<arrays.size();j++)
391 arrays3[j]=arrays2[j];
392 ret->setArrays(arrays3,0);
396 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::determinant() const
398 std::vector<DataArrayDouble *> arrays;
400 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
401 for(std::size_t j=0;j<arrays.size();j++)
404 arrays2[j]=arrays[j]->determinant();
408 std::vector<DataArrayDouble *> arrays3(arrays.size());
409 for(std::size_t j=0;j<arrays.size();j++)
410 arrays3[j]=arrays2[j];
411 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
412 ret->setTimeUnit(getTimeUnit());
413 ret->setArrays(arrays3,0);
417 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenValues() const
419 std::vector<DataArrayDouble *> arrays;
421 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
422 for(std::size_t j=0;j<arrays.size();j++)
425 arrays2[j]=arrays[j]->eigenValues();
429 std::vector<DataArrayDouble *> arrays3(arrays.size());
430 for(std::size_t j=0;j<arrays.size();j++)
431 arrays3[j]=arrays2[j];
432 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
433 ret->setTimeUnit(getTimeUnit());
434 ret->setArrays(arrays3,0);
438 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenVectors() const
440 std::vector<DataArrayDouble *> arrays;
442 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
443 for(std::size_t j=0;j<arrays.size();j++)
446 arrays2[j]=arrays[j]->eigenVectors();
450 std::vector<DataArrayDouble *> arrays3(arrays.size());
451 for(std::size_t j=0;j<arrays.size();j++)
452 arrays3[j]=arrays2[j];
453 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
454 ret->setTimeUnit(getTimeUnit());
455 ret->setArrays(arrays3,0);
459 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::inverse() const
461 std::vector<DataArrayDouble *> arrays;
463 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
464 for(std::size_t j=0;j<arrays.size();j++)
467 arrays2[j]=arrays[j]->inverse();
471 std::vector<DataArrayDouble *> arrays3(arrays.size());
472 for(std::size_t j=0;j<arrays.size();j++)
473 arrays3[j]=arrays2[j];
474 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
475 ret->setTimeUnit(getTimeUnit());
476 ret->setArrays(arrays3,0);
480 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::trace() const
482 std::vector<DataArrayDouble *> arrays;
484 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
485 for(std::size_t j=0;j<arrays.size();j++)
488 arrays2[j]=arrays[j]->trace();
492 std::vector<DataArrayDouble *> arrays3(arrays.size());
493 for(std::size_t j=0;j<arrays.size();j++)
494 arrays3[j]=arrays2[j];
495 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
496 ret->setTimeUnit(getTimeUnit());
497 ret->setArrays(arrays3,0);
501 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::deviator() const
503 std::vector<DataArrayDouble *> arrays;
505 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
506 for(std::size_t j=0;j<arrays.size();j++)
509 arrays2[j]=arrays[j]->deviator();
513 std::vector<DataArrayDouble *> arrays3(arrays.size());
514 for(std::size_t j=0;j<arrays.size();j++)
515 arrays3[j]=arrays2[j];
516 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
517 ret->setTimeUnit(getTimeUnit());
518 ret->setArrays(arrays3,0);
522 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::magnitude() const
524 std::vector<DataArrayDouble *> arrays;
526 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
527 for(std::size_t j=0;j<arrays.size();j++)
530 arrays2[j]=arrays[j]->magnitude();
534 std::vector<DataArrayDouble *> arrays3(arrays.size());
535 for(std::size_t j=0;j<arrays.size();j++)
536 arrays3[j]=arrays2[j];
537 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
538 ret->setTimeUnit(getTimeUnit());
539 ret->setArrays(arrays3,0);
543 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::negate() const
545 std::vector<DataArrayDouble *> arrays;
547 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
548 for(std::size_t j=0;j<arrays.size();j++)
551 arrays2[j]=arrays[j]->negate();
555 std::vector<DataArrayDouble *> arrays3(arrays.size());
556 for(std::size_t j=0;j<arrays.size();j++)
557 arrays3[j]=arrays2[j];
558 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
559 ret->setTimeUnit(getTimeUnit());
560 ret->setArrays(arrays3,0);
564 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::maxPerTuple() const
566 std::vector<DataArrayDouble *> arrays;
568 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
569 for(std::size_t j=0;j<arrays.size();j++)
572 arrays2[j]=arrays[j]->maxPerTuple();
576 std::vector<DataArrayDouble *> arrays3(arrays.size());
577 for(std::size_t j=0;j<arrays.size();j++)
578 arrays3[j]=arrays2[j];
579 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
580 ret->setTimeUnit(getTimeUnit());
581 ret->setArrays(arrays3,0);
585 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedComponents(const std::vector<int>& compoIds) const
587 std::vector<DataArrayDouble *> arrays;
589 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
590 for(std::size_t j=0;j<arrays.size();j++)
593 arrays2[j]=static_cast<DataArrayDouble *>(arrays[j]->keepSelectedComponents(compoIds));
597 std::vector<DataArrayDouble *> arrays3(arrays.size());
598 for(std::size_t j=0;j<arrays.size();j++)
599 arrays3[j]=arrays2[j];
600 MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
601 ret->setTimeUnit(getTimeUnit());
602 ret->setArrays(arrays3,0);
606 void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds)
608 std::vector<DataArrayDouble *> arrays1,arrays2;
610 other->getArrays(arrays2);
611 if(arrays1.size()!=arrays2.size())
612 throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : number of arrays mismatch !");
613 for(std::size_t i=0;i<arrays1.size();i++)
615 if(arrays1[i]!=0 && arrays2[i]!=0)
616 arrays1[i]->setSelectedComponents(arrays2[i],compoIds);
617 else if(arrays1[i]!=0 || arrays2[i]!=0)
618 throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : some time array in correspondance are not defined symetrically !");
622 void MEDCouplingTimeDiscretization::changeNbOfComponents(int newNbOfComp, double dftValue)
624 std::vector<DataArrayDouble *> arrays;
626 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
627 for(std::size_t j=0;j<arrays.size();j++)
630 arrays2[j]=arrays[j]->changeNbOfComponents(newNbOfComp,dftValue);
634 std::vector<DataArrayDouble *> arrays3(arrays.size());
635 for(std::size_t j=0;j<arrays.size();j++)
636 arrays3[j]=arrays2[j];
637 setArrays(arrays3,0);
640 void MEDCouplingTimeDiscretization::sortPerTuple(bool asc)
642 std::vector<DataArrayDouble *> arrays;
644 for(std::size_t j=0;j<arrays.size();j++)
647 arrays[j]->sortPerTuple(asc);
651 void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, int nbOfCompo, double value)
653 std::vector<DataArrayDouble *> arrays;
655 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
656 for(std::size_t j=0;j<arrays.size();j++)
660 arrays2[j]=arrays[j]->changeNbOfComponents(nbOfCompo,value);
661 arrays2[j]->fillWithValue(value);
665 arrays2[j]=DataArrayDouble::New();
666 arrays2[j]->alloc(nbOfTuple,nbOfCompo);
667 arrays2[j]->fillWithValue(value);
670 std::vector<DataArrayDouble *> arrays3(arrays.size());
671 for(std::size_t j=0;j<arrays.size();j++)
672 arrays3[j]=arrays2[j];
673 setArrays(arrays3,0);
676 void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value)
678 std::vector<DataArrayDouble *> arrays;
680 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
682 for(std::size_t j=0;j<arrays.size();j++)
686 arrays2[j]=arrays[j]; arrays2[j]->incrRef();
687 arrays2[j]->fillWithValue(value);
692 arrays2[j]=DataArrayDouble::New();
693 arrays2[j]->alloc(nbOfTuple,1);
694 arrays2[j]->fillWithValue(value);
699 std::vector<DataArrayDouble *> arrays3(arrays.size());
700 for(std::size_t j=0;j<arrays.size();j++)
701 arrays3[j]=arrays2[j];
702 setArrays(arrays3,0);
706 void MEDCouplingTimeDiscretization::applyLin(double a, double b, int compoId)
708 std::vector<DataArrayDouble *> arrays;
710 for(std::size_t j=0;j<arrays.size();j++)
713 arrays[j]->applyLin(a,b,compoId);
717 void MEDCouplingTimeDiscretization::applyLin(double a, double b)
719 std::vector<DataArrayDouble *> arrays;
721 for(std::size_t j=0;j<arrays.size();j++)
724 arrays[j]->applyLin(a,b);
728 void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, FunctionToEvaluate func)
730 std::vector<DataArrayDouble *> arrays;
732 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
733 for(std::size_t j=0;j<arrays.size();j++)
736 arrays2[j]=arrays[j]->applyFunc(nbOfComp,func);
740 std::vector<DataArrayDouble *> arrays3(arrays.size());
741 for(std::size_t j=0;j<arrays.size();j++)
742 arrays3[j]=arrays2[j];
743 setArrays(arrays3,0);
746 void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const std::string& func)
748 std::vector<DataArrayDouble *> arrays;
750 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
751 for(std::size_t j=0;j<arrays.size();j++)
754 arrays2[j]=arrays[j]->applyFunc(nbOfComp,func);
758 std::vector<DataArrayDouble *> arrays3(arrays.size());
759 for(std::size_t j=0;j<arrays.size();j++)
760 arrays3[j]=arrays2[j];
761 setArrays(arrays3,0);
764 void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const std::string& func)
766 std::vector<DataArrayDouble *> arrays;
768 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
769 for(std::size_t j=0;j<arrays.size();j++)
772 arrays2[j]=arrays[j]->applyFunc2(nbOfComp,func);
776 std::vector<DataArrayDouble *> arrays3(arrays.size());
777 for(std::size_t j=0;j<arrays.size();j++)
778 arrays3[j]=arrays2[j];
779 setArrays(arrays3,0);
782 void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
784 std::vector<DataArrayDouble *> arrays;
786 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
787 for(std::size_t j=0;j<arrays.size();j++)
790 arrays2[j]=arrays[j]->applyFunc3(nbOfComp,varsOrder,func);
794 std::vector<DataArrayDouble *> arrays3(arrays.size());
795 for(std::size_t j=0;j<arrays.size();j++)
796 arrays3[j]=arrays2[j];
797 setArrays(arrays3,0);
800 void MEDCouplingTimeDiscretization::applyFunc(const std::string& func)
802 std::vector<DataArrayDouble *> arrays;
804 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
805 for(std::size_t j=0;j<arrays.size();j++)
808 arrays2[j]=arrays[j]->applyFunc(func);
812 std::vector<DataArrayDouble *> arrays3(arrays.size());
813 for(std::size_t j=0;j<arrays.size();j++)
814 arrays3[j]=arrays2[j];
815 setArrays(arrays3,0);
818 void MEDCouplingTimeDiscretization::applyFuncFast32(const std::string& func)
820 std::vector<DataArrayDouble *> arrays;
822 for(std::size_t j=0;j<arrays.size();j++)
825 arrays[j]->applyFuncFast32(func);
829 void MEDCouplingTimeDiscretization::applyFuncFast64(const std::string& func)
831 std::vector<DataArrayDouble *> arrays;
833 for(std::size_t j=0;j<arrays.size();j++)
836 arrays[j]->applyFuncFast64(func);
840 void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func)
842 std::vector<DataArrayDouble *> arrays;
844 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
845 for(std::size_t j=0;j<arrays.size();j++)
846 arrays2[j]=loc->applyFunc(nbOfComp,func);
847 std::vector<DataArrayDouble *> arrays3(arrays.size());
848 for(std::size_t j=0;j<arrays.size();j++)
849 arrays3[j]=arrays2[j];
850 setArrays(arrays3,0);
853 void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const std::string& func)
855 std::vector<DataArrayDouble *> arrays;
857 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
858 for(std::size_t j=0;j<arrays.size();j++)
859 arrays2[j]=loc->applyFunc(nbOfComp,func);
860 std::vector<DataArrayDouble *> arrays3(arrays.size());
861 for(std::size_t j=0;j<arrays.size();j++)
862 arrays3[j]=arrays2[j];
863 setArrays(arrays3,0);
866 void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const std::string& func)
868 std::vector<DataArrayDouble *> arrays;
870 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
871 for(std::size_t j=0;j<arrays.size();j++)
872 arrays2[j]=loc->applyFunc2(nbOfComp,func);
873 std::vector<DataArrayDouble *> arrays3(arrays.size());
874 for(std::size_t j=0;j<arrays.size();j++)
875 arrays3[j]=arrays2[j];
876 setArrays(arrays3,0);
879 void MEDCouplingTimeDiscretization::fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
881 std::vector<DataArrayDouble *> arrays;
883 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
884 for(std::size_t j=0;j<arrays.size();j++)
885 arrays2[j]=loc->applyFunc3(nbOfComp,varsOrder,func);
886 std::vector<DataArrayDouble *> arrays3(arrays.size());
887 for(std::size_t j=0;j<arrays.size();j++)
888 arrays3[j]=arrays2[j];
889 setArrays(arrays3,0);
892 MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel()
896 MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy)
900 std::string MEDCouplingNoTimeLabel::getStringRepr() const
902 std::ostringstream stream;
904 stream << "\nTime unit is : \"" << _time_unit << "\"";
908 void MEDCouplingNoTimeLabel::synchronizeTimeWith(const MEDCouplingMesh *mesh)
910 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::synchronizeTimeWith : impossible to synchronize time with a MEDCouplingMesh because the time discretization is incompatible with it !");
913 bool MEDCouplingNoTimeLabel::areCompatible(const MEDCouplingTimeDiscretization *other) const
915 if(!MEDCouplingTimeDiscretization::areCompatible(other))
917 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
921 bool MEDCouplingNoTimeLabel::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
923 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
925 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
928 reason.insert(0,"time discretization of this is NO_TIME, other has a different time discretization.");
932 bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
934 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
936 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
940 bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
942 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
944 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
948 bool MEDCouplingNoTimeLabel::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
950 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
952 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
956 bool MEDCouplingNoTimeLabel::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
958 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
961 reason="This has time discretization NO_TIME, other not.";
964 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
967 bool MEDCouplingNoTimeLabel::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
969 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
972 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
975 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const MEDCouplingTimeDiscretization *other) const
977 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
979 throw INTERP_KERNEL::Exception("NoTimeLabel::aggregation on mismatched time discretization !");
980 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
981 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
982 ret->setArray(arr,0);
986 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
988 std::vector<const DataArrayDouble *> a(other.size());
990 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
992 const MEDCouplingNoTimeLabel *itC=dynamic_cast<const MEDCouplingNoTimeLabel *>(*it);
994 throw INTERP_KERNEL::Exception("NoTimeLabel::aggregate on mismatched time discretization !");
995 a[i]=itC->getArray();
997 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
998 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
999 ret->setArray(arr,0);
1003 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::meld(const MEDCouplingTimeDiscretization *other) const
1005 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1007 throw INTERP_KERNEL::Exception("NoTimeLabel::meld on mismatched time discretization !");
1008 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
1009 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1010 ret->setTimeTolerance(getTimeTolerance());
1011 ret->setArray(arr,0);
1015 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::dot(const MEDCouplingTimeDiscretization *other) const
1017 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1019 throw INTERP_KERNEL::Exception("NoTimeLabel::dot on mismatched time discretization !");
1020 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
1021 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1022 ret->setArray(arr,0);
1026 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::crossProduct(const MEDCouplingTimeDiscretization *other) const
1028 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1030 throw INTERP_KERNEL::Exception("NoTimeLabel::crossProduct on mismatched time discretization !");
1031 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
1032 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1033 ret->setArray(arr,0);
1037 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::max(const MEDCouplingTimeDiscretization *other) const
1039 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1041 throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
1042 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
1043 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1044 ret->setArray(arr,0);
1048 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::min(const MEDCouplingTimeDiscretization *other) const
1050 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1052 throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
1053 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
1054 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1055 ret->setArray(arr,0);
1059 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::add(const MEDCouplingTimeDiscretization *other) const
1061 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1063 throw INTERP_KERNEL::Exception("NoTimeLabel::add on mismatched time discretization !");
1064 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
1065 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1066 ret->setArray(arr,0);
1070 void MEDCouplingNoTimeLabel::addEqual(const MEDCouplingTimeDiscretization *other)
1072 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1074 throw INTERP_KERNEL::Exception("NoTimeLabel::addEqual on mismatched time discretization !");
1076 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::addEqual : Data Array is NULL !");
1077 getArray()->addEqual(other->getArray());
1080 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::substract(const MEDCouplingTimeDiscretization *other) const
1082 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1084 throw INTERP_KERNEL::Exception("NoTimeLabel::substract on mismatched time discretization !");
1086 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::substract : Data Array is NULL !");
1087 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
1088 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1089 ret->setArray(arr,0);
1093 void MEDCouplingNoTimeLabel::substractEqual(const MEDCouplingTimeDiscretization *other)
1095 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1097 throw INTERP_KERNEL::Exception("NoTimeLabel::substractEqual on mismatched time discretization !");
1099 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::substractEqual : Data Array is NULL !");
1100 getArray()->substractEqual(other->getArray());
1103 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::multiply(const MEDCouplingTimeDiscretization *other) const
1105 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1107 throw INTERP_KERNEL::Exception("NoTimeLabel::multiply on mismatched time discretization !");
1108 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
1109 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1110 ret->setArray(arr,0);
1114 void MEDCouplingNoTimeLabel::multiplyEqual(const MEDCouplingTimeDiscretization *other)
1116 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1118 throw INTERP_KERNEL::Exception("NoTimeLabel::multiplyEqual on mismatched time discretization !");
1120 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::multiplyEqual : Data Array is NULL !");
1121 getArray()->multiplyEqual(other->getArray());
1124 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::divide(const MEDCouplingTimeDiscretization *other) const
1126 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1128 throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
1129 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
1130 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1131 ret->setArray(arr,0);
1135 void MEDCouplingNoTimeLabel::divideEqual(const MEDCouplingTimeDiscretization *other)
1137 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1139 throw INTERP_KERNEL::Exception("NoTimeLabel::divideEqual on mismatched time discretization !");
1141 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::divideEqual : Data Array is NULL !");
1142 getArray()->divideEqual(other->getArray());
1145 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::pow(const MEDCouplingTimeDiscretization *other) const
1147 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1149 throw INTERP_KERNEL::Exception("pow on mismatched time discretization !");
1150 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
1151 MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
1152 ret->setArray(arr,0);
1156 void MEDCouplingNoTimeLabel::powEqual(const MEDCouplingTimeDiscretization *other)
1158 const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
1160 throw INTERP_KERNEL::Exception("NoTimeLabel::powEqual on mismatched time discretization !");
1162 throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::powEqual : Data Array is NULL !");
1163 getArray()->powEqual(other->getArray());
1166 MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::performCpy(bool deepCpy) const
1168 return new MEDCouplingNoTimeLabel(*this,deepCpy);
1171 void MEDCouplingNoTimeLabel::checkTimePresence(double time) const
1173 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1176 std::vector< const DataArrayDouble *> MEDCouplingNoTimeLabel::getArraysForTime(double time) const
1178 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1181 void MEDCouplingNoTimeLabel::getValueForTime(double time, const std::vector<double>& vals, double *res) const
1183 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1186 bool MEDCouplingNoTimeLabel::isBefore(const MEDCouplingTimeDiscretization *other) const
1188 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1191 bool MEDCouplingNoTimeLabel::isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const
1193 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1196 double MEDCouplingNoTimeLabel::getStartTime(int& iteration, int& order) const
1198 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1201 double MEDCouplingNoTimeLabel::getEndTime(int& iteration, int& order) const
1203 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1206 void MEDCouplingNoTimeLabel::setStartIteration(int it)
1208 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1211 void MEDCouplingNoTimeLabel::setEndIteration(int it)
1213 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1216 void MEDCouplingNoTimeLabel::setStartOrder(int order)
1218 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1221 void MEDCouplingNoTimeLabel::setEndOrder(int order)
1223 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1226 void MEDCouplingNoTimeLabel::setStartTimeValue(double time)
1228 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1231 void MEDCouplingNoTimeLabel::setEndTimeValue(double time)
1233 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1236 void MEDCouplingNoTimeLabel::setStartTime(double time, int iteration, int order)
1238 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1241 void MEDCouplingNoTimeLabel::setEndTime(double time, int iteration, int order)
1243 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1246 void MEDCouplingNoTimeLabel::getValueOnTime(int eltId, double time, double *value) const
1248 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1251 void MEDCouplingNoTimeLabel::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
1253 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1257 * idem getTinySerializationIntInformation except that it is for multi field fetch
1259 void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
1265 * idem getTinySerializationDbleInformation except that it is for multi field fetch
1267 void MEDCouplingNoTimeLabel::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
1270 tinyInfo[0]=_time_tolerance;
1274 * idem finishUnserialization except that it is for multi field fetch
1276 void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
1278 _time_tolerance=tinyInfoD[0];
1281 MEDCouplingWithTimeStep::MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy),
1282 _time(other._time),_iteration(other._iteration),_order(other._order)
1286 MEDCouplingWithTimeStep::MEDCouplingWithTimeStep():_time(0.),_iteration(-1),_order(-1)
1290 std::string MEDCouplingWithTimeStep::getStringRepr() const
1292 std::ostringstream stream;
1293 stream << REPR << " Time is defined by iteration=" << _iteration << " order=" << _order << " and time=" << _time << ".";
1294 stream << "\nTime unit is : \"" << _time_unit << "\"";
1295 return stream.str();
1298 void MEDCouplingWithTimeStep::synchronizeTimeWith(const MEDCouplingMesh *mesh)
1301 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
1303 double val=mesh->getTime(it,order);
1304 _time=val; _iteration=it; _order=order;
1305 std::string tUnit=mesh->getTimeUnit();
1309 void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
1311 MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
1312 tinyInfo.push_back(_iteration);
1313 tinyInfo.push_back(_order);
1316 void MEDCouplingWithTimeStep::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
1318 MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
1319 tinyInfo.push_back(_time);
1322 void MEDCouplingWithTimeStep::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
1324 MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
1326 _iteration=tinyInfoI[2];
1327 _order=tinyInfoI[3];
1331 * idem getTinySerializationIntInformation except that it is for multi field fetch
1333 void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
1336 tinyInfo[0]=_iteration;
1341 * idem getTinySerializationDbleInformation except that it is for multi field fetch
1343 void MEDCouplingWithTimeStep::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
1346 tinyInfo[0]=_time_tolerance;
1351 * idem finishUnserialization except that it is for multi field fetch
1353 void MEDCouplingWithTimeStep::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
1355 _iteration=tinyInfoI[0];
1356 _order=tinyInfoI[1];
1357 _time_tolerance=tinyInfoD[0];
1361 bool MEDCouplingWithTimeStep::areCompatible(const MEDCouplingTimeDiscretization *other) const
1363 if(!MEDCouplingTimeDiscretization::areCompatible(other))
1365 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1369 bool MEDCouplingWithTimeStep::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
1371 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
1373 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1376 reason.insert(0,"time discretization of this is ONE_TIME, other has a different time discretization.");
1380 bool MEDCouplingWithTimeStep::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
1382 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
1384 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1388 bool MEDCouplingWithTimeStep::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
1390 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
1392 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1396 bool MEDCouplingWithTimeStep::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
1398 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
1400 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1404 bool MEDCouplingWithTimeStep::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
1406 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1407 std::ostringstream oss; oss.precision(15);
1410 reason="This has time discretization ONE_TIME, other not.";
1413 if(_iteration!=otherC->_iteration)
1415 oss << "iterations differ. this iteration=" << _iteration << " other iteration=" << otherC->_iteration;
1419 if(_order!=otherC->_order)
1421 oss << "orders differ. this order=" << _order << " other order=" << otherC->_order;
1425 if(std::fabs(_time-otherC->_time)>_time_tolerance)
1427 oss << "times differ. this time=" << _time << " other time=" << otherC->_time;
1431 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
1434 bool MEDCouplingWithTimeStep::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
1436 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1439 if(_iteration!=otherC->_iteration)
1441 if(_order!=otherC->_order)
1443 if(std::fabs(_time-otherC->_time)>_time_tolerance)
1445 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
1448 void MEDCouplingWithTimeStep::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
1450 MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
1451 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(&other);
1453 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::copyTinyAttrFrom : mismatch of time discretization !");
1454 _time=otherC->_time;
1455 _iteration=otherC->_iteration;
1456 _order=otherC->_order;
1459 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const MEDCouplingTimeDiscretization *other) const
1461 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1463 throw INTERP_KERNEL::Exception("WithTimeStep::aggregation on mismatched time discretization !");
1464 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
1465 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1466 ret->setArray(arr,0);
1470 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
1472 std::vector<const DataArrayDouble *> a(other.size());
1474 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
1476 const MEDCouplingWithTimeStep *itC=dynamic_cast<const MEDCouplingWithTimeStep *>(*it);
1478 throw INTERP_KERNEL::Exception("WithTimeStep::aggregate on mismatched time discretization !");
1479 a[i]=itC->getArray();
1481 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
1482 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1483 ret->setArray(arr,0);
1487 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::meld(const MEDCouplingTimeDiscretization *other) const
1489 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1491 throw INTERP_KERNEL::Exception("WithTimeStep::meld on mismatched time discretization !");
1492 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
1493 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1494 ret->setArray(arr,0);
1498 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::dot(const MEDCouplingTimeDiscretization *other) const
1500 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1502 throw INTERP_KERNEL::Exception("WithTimeStep::dot on mismatched time discretization !");
1503 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1504 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
1505 ret->setArray(arr,0);
1509 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::crossProduct(const MEDCouplingTimeDiscretization *other) const
1511 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1513 throw INTERP_KERNEL::Exception("WithTimeStep::crossProduct on mismatched time discretization !");
1514 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
1515 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1516 ret->setArray(arr,0);
1520 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::max(const MEDCouplingTimeDiscretization *other) const
1522 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1524 throw INTERP_KERNEL::Exception("WithTimeStep::max on mismatched time discretization !");
1525 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
1526 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1527 ret->setArray(arr,0);
1531 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::min(const MEDCouplingTimeDiscretization *other) const
1533 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1535 throw INTERP_KERNEL::Exception("WithTimeStep::min on mismatched time discretization !");
1536 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
1537 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1538 ret->setArray(arr,0);
1542 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::add(const MEDCouplingTimeDiscretization *other) const
1544 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1546 throw INTERP_KERNEL::Exception("WithTimeStep::add on mismatched time discretization !");
1547 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
1548 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1549 ret->setArray(arr,0);
1551 double tmp3=getStartTime(tmp1,tmp2);
1552 ret->setStartTime(tmp3,tmp1,tmp2);
1556 void MEDCouplingWithTimeStep::addEqual(const MEDCouplingTimeDiscretization *other)
1558 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1560 throw INTERP_KERNEL::Exception("WithTimeStep::addEqual on mismatched time discretization !");
1562 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::addEqual : Data Array is NULL !");
1563 getArray()->addEqual(other->getArray());
1566 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::substract(const MEDCouplingTimeDiscretization *other) const
1568 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1570 throw INTERP_KERNEL::Exception("WithTimeStep::substract on mismatched time discretization !");
1571 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
1572 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1573 ret->setArray(arr,0);
1575 double tmp3=getStartTime(tmp1,tmp2);
1576 ret->setStartTime(tmp3,tmp1,tmp2);
1580 void MEDCouplingWithTimeStep::substractEqual(const MEDCouplingTimeDiscretization *other)
1582 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1584 throw INTERP_KERNEL::Exception("WithTimeStep::substractEqual on mismatched time discretization !");
1586 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::substractEqual : Data Array is NULL !");
1587 getArray()->substractEqual(other->getArray());
1590 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::multiply(const MEDCouplingTimeDiscretization *other) const
1592 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1594 throw INTERP_KERNEL::Exception("WithTimeStep::multiply on mismatched time discretization !");
1595 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
1596 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1597 ret->setArray(arr,0);
1599 double tmp3=getStartTime(tmp1,tmp2);
1600 ret->setStartTime(tmp3,tmp1,tmp2);
1604 void MEDCouplingWithTimeStep::multiplyEqual(const MEDCouplingTimeDiscretization *other)
1606 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1608 throw INTERP_KERNEL::Exception("WithTimeStep::multiplyEqual on mismatched time discretization !");
1610 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::multiplyEqual : Data Array is NULL !");
1611 getArray()->multiplyEqual(other->getArray());
1614 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::divide(const MEDCouplingTimeDiscretization *other) const
1616 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1618 throw INTERP_KERNEL::Exception("WithTimeStep::divide on mismatched time discretization !");
1619 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
1620 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1621 ret->setArray(arr,0);
1623 double tmp3=getStartTime(tmp1,tmp2);
1624 ret->setStartTime(tmp3,tmp1,tmp2);
1628 void MEDCouplingWithTimeStep::divideEqual(const MEDCouplingTimeDiscretization *other)
1630 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1632 throw INTERP_KERNEL::Exception("WithTimeStep::divideEqual on mismatched time discretization !");
1634 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::divideEqual : Data Array is NULL !");
1635 getArray()->divideEqual(other->getArray());
1638 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::pow(const MEDCouplingTimeDiscretization *other) const
1640 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1642 throw INTERP_KERNEL::Exception("WithTimeStep::pow on mismatched time discretization !");
1643 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
1644 MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
1645 ret->setArray(arr,0);
1647 double tmp3=getStartTime(tmp1,tmp2);
1648 ret->setStartTime(tmp3,tmp1,tmp2);
1652 void MEDCouplingWithTimeStep::powEqual(const MEDCouplingTimeDiscretization *other)
1654 const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
1656 throw INTERP_KERNEL::Exception("WithTimeStep::powEqual on mismatched time discretization !");
1658 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeLabel::powEqual : Data Array is NULL !");
1659 getArray()->powEqual(other->getArray());
1662 MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::performCpy(bool deepCpy) const
1664 return new MEDCouplingWithTimeStep(*this,deepCpy);
1667 void MEDCouplingWithTimeStep::checkNoTimePresence() const
1669 throw INTERP_KERNEL::Exception("No time specified on a field defined on one time");
1672 void MEDCouplingWithTimeStep::checkTimePresence(double time) const
1674 if(std::fabs(time-_time)>_time_tolerance)
1676 std::ostringstream stream;
1677 stream << "The field is defined on time " << _time << " with eps=" << _time_tolerance << " and asking time = " << time << " !";
1678 throw INTERP_KERNEL::Exception(stream.str().c_str());
1682 std::vector< const DataArrayDouble *> MEDCouplingWithTimeStep::getArraysForTime(double time) const
1684 if(std::fabs(time-_time)<=_time_tolerance)
1686 std::vector< const DataArrayDouble *> ret(1);
1691 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1694 void MEDCouplingWithTimeStep::getValueForTime(double time, const std::vector<double>& vals, double *res) const
1696 std::copy(vals.begin(),vals.end(),res);
1699 void MEDCouplingWithTimeStep::getValueOnTime(int eltId, double time, double *value) const
1701 if(std::fabs(time-_time)<=_time_tolerance)
1703 _array->getTuple(eltId,value);
1705 throw INTERP_KERNEL::Exception("No array existing.");
1707 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1710 void MEDCouplingWithTimeStep::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
1712 if(_iteration==iteration && _order==order)
1714 _array->getTuple(eltId,value);
1716 throw INTERP_KERNEL::Exception("No array existing.");
1718 throw INTERP_KERNEL::Exception("No data on this discrete time.");
1721 MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval():_start_time(0.),_end_time(0.),_start_iteration(-1),_end_iteration(-1),_start_order(-1),_end_order(-1)
1725 void MEDCouplingConstOnTimeInterval::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
1727 MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
1728 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(&other);
1730 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::copyTinyAttrFrom : mismatch of time discretization !");
1731 _start_time=otherC->_start_time;
1732 _end_time=otherC->_end_time;
1733 _start_iteration=otherC->_start_iteration;
1734 _end_iteration=otherC->_end_iteration;
1735 _start_order=otherC->_start_order;
1736 _end_order=otherC->_end_order;
1739 void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
1741 MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
1742 tinyInfo.push_back(_start_iteration);
1743 tinyInfo.push_back(_start_order);
1744 tinyInfo.push_back(_end_iteration);
1745 tinyInfo.push_back(_end_order);
1748 void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
1750 MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
1751 tinyInfo.push_back(_start_time);
1752 tinyInfo.push_back(_end_time);
1755 void MEDCouplingConstOnTimeInterval::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
1757 MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
1758 _start_time=tinyInfoD[1];
1759 _end_time=tinyInfoD[2];
1760 _start_iteration=tinyInfoI[2];
1761 _start_order=tinyInfoI[3];
1762 _end_iteration=tinyInfoI[4];
1763 _end_order=tinyInfoI[5];
1767 * idem getTinySerializationIntInformation except that it is for multi field fetch
1769 void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
1772 tinyInfo[0]=_start_iteration;
1773 tinyInfo[1]=_start_order;
1774 tinyInfo[2]=_end_iteration;
1775 tinyInfo[3]=_end_order;
1779 * idem getTinySerializationDbleInformation except that it is for multi field fetch
1781 void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
1784 tinyInfo[0]=_time_tolerance;
1785 tinyInfo[1]=_start_time;
1786 tinyInfo[2]=_end_time;
1790 * idem finishUnserialization except that it is for multi field fetch
1792 void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
1794 _start_iteration=tinyInfoI[0];
1795 _start_order=tinyInfoI[1];
1796 _end_iteration=tinyInfoI[2];
1797 _end_order=tinyInfoI[3];
1798 _time_tolerance=tinyInfoD[0];
1799 _start_time=tinyInfoD[1];
1800 _end_time=tinyInfoD[2];
1803 MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCpy):
1804 MEDCouplingTimeDiscretization(other,deepCpy),_start_time(other._start_time),_end_time(other._end_time),_start_iteration(other._start_iteration),
1805 _end_iteration(other._end_iteration),_start_order(other._start_order),_end_order(other._end_order)
1809 std::string MEDCouplingConstOnTimeInterval::getStringRepr() const
1811 std::ostringstream stream;
1812 stream << REPR << " Time interval is defined by :\niteration_start=" << _start_iteration << " order_start=" << _start_order << " and time_start=" << _start_time << "\n";
1813 stream << "iteration_end=" << _end_iteration << " order_end=" << _end_order << " and end_time=" << _end_time << "\n";
1814 stream << "\nTime unit is : \"" << _time_unit << "\"";
1815 return stream.str();
1818 void MEDCouplingConstOnTimeInterval::synchronizeTimeWith(const MEDCouplingMesh *mesh)
1821 throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
1823 double val=mesh->getTime(it,order);
1824 _start_time=val; _start_iteration=it; _start_order=order;
1825 _end_time=val; _end_iteration=it; _end_order=order;
1826 std::string tUnit=mesh->getTimeUnit();
1830 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::performCpy(bool deepCpy) const
1832 return new MEDCouplingConstOnTimeInterval(*this,deepCpy);
1835 std::vector< const DataArrayDouble *> MEDCouplingConstOnTimeInterval::getArraysForTime(double time) const
1837 if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
1839 std::vector< const DataArrayDouble *> ret(1);
1844 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1847 void MEDCouplingConstOnTimeInterval::getValueForTime(double time, const std::vector<double>& vals, double *res) const
1849 std::copy(vals.begin(),vals.end(),res);
1852 bool MEDCouplingConstOnTimeInterval::areCompatible(const MEDCouplingTimeDiscretization *other) const
1854 if(!MEDCouplingTimeDiscretization::areCompatible(other))
1856 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1860 bool MEDCouplingConstOnTimeInterval::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
1862 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
1864 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1867 reason.insert(0,"time discretization of this is CONST_ON_TIME_INTERVAL, other has a different time discretization.");
1871 bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
1873 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
1875 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1879 bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
1881 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
1883 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1887 bool MEDCouplingConstOnTimeInterval::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
1889 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
1891 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1895 bool MEDCouplingConstOnTimeInterval::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
1897 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1898 std::ostringstream oss; oss.precision(15);
1901 reason="This has time discretization CONST_ON_TIME_INTERVAL, other not.";
1904 if(_start_iteration!=otherC->_start_iteration)
1906 oss << "start iterations differ. this start iteration=" << _start_iteration << " other start iteration=" << otherC->_start_iteration;
1910 if(_start_order!=otherC->_start_order)
1912 oss << "start orders differ. this start order=" << _start_order << " other start order=" << otherC->_start_order;
1916 if(std::fabs(_start_time-otherC->_start_time)>_time_tolerance)
1918 oss << "start times differ. this start time=" << _start_time << " other start time=" << otherC->_start_time;
1922 if(_end_iteration!=otherC->_end_iteration)
1924 oss << "end iterations differ. this end iteration=" << _end_iteration << " other end iteration=" << otherC->_end_iteration;
1928 if(_end_order!=otherC->_end_order)
1930 oss << "end orders differ. this end order=" << _end_order << " other end order=" << otherC->_end_order;
1934 if(std::fabs(_end_time-otherC->_end_time)>_time_tolerance)
1936 oss << "end times differ. this end time=" << _end_time << " other end time=" << otherC->_end_time;
1940 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
1943 bool MEDCouplingConstOnTimeInterval::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
1945 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
1948 if(_start_iteration!=otherC->_start_iteration)
1950 if(_start_order!=otherC->_start_order)
1952 if(std::fabs(_start_time-otherC->_start_time)>_time_tolerance)
1954 if(_end_iteration!=otherC->_end_iteration)
1956 if(_end_order!=otherC->_end_order)
1958 if(std::fabs(_end_time-otherC->_end_time)>_time_tolerance)
1960 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
1963 void MEDCouplingConstOnTimeInterval::getValueOnTime(int eltId, double time, double *value) const
1965 if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
1967 _array->getTuple(eltId,value);
1969 throw INTERP_KERNEL::Exception("No array existing.");
1971 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1974 void MEDCouplingConstOnTimeInterval::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
1976 if(iteration>=_start_iteration && iteration<=_end_iteration)
1978 _array->getTuple(eltId,value);
1980 throw INTERP_KERNEL::Exception("No array existing.");
1982 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
1985 void MEDCouplingConstOnTimeInterval::checkNoTimePresence() const
1987 throw INTERP_KERNEL::Exception("No time specified on a field defined as constant on one time interval");
1990 void MEDCouplingConstOnTimeInterval::checkTimePresence(double time) const
1992 if(time<_start_time-_time_tolerance || time>_end_time+_time_tolerance)
1994 std::ostringstream stream;
1995 stream << "The field is defined between times " << _start_time << " and " << _end_time << " worderh tolerance ";
1996 stream << _time_tolerance << " and trying to access on time = " << time;
1997 throw INTERP_KERNEL::Exception(stream.str().c_str());
2001 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const MEDCouplingTimeDiscretization *other) const
2003 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2005 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregation on mismatched time discretization !");
2006 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
2007 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2008 ret->setArray(arr,0);
2012 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
2014 std::vector<const DataArrayDouble *> a(other.size());
2016 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
2018 const MEDCouplingConstOnTimeInterval *itC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(*it);
2020 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregate on mismatched time discretization !");
2021 a[i]=itC->getArray();
2023 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
2024 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2025 ret->setArray(arr,0);
2029 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::meld(const MEDCouplingTimeDiscretization *other) const
2031 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2033 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::meld on mismatched time discretization !");
2034 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
2035 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2036 ret->setTimeTolerance(getTimeTolerance());
2037 ret->setArray(arr,0);
2041 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::dot(const MEDCouplingTimeDiscretization *other) const
2043 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2045 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::dot on mismatched time discretization !");
2046 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
2047 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2048 ret->setArray(arr,0);
2052 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::crossProduct(const MEDCouplingTimeDiscretization *other) const
2054 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2056 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::crossProduct on mismatched time discretization !");
2057 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
2058 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2059 ret->setArray(arr,0);
2063 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::max(const MEDCouplingTimeDiscretization *other) const
2065 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2067 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::max on mismatched time discretization !");
2068 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
2069 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2070 ret->setArray(arr,0);
2074 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::min(const MEDCouplingTimeDiscretization *other) const
2076 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2078 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::min on mismatched time discretization !");
2079 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
2080 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2081 ret->setArray(arr,0);
2085 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::add(const MEDCouplingTimeDiscretization *other) const
2087 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2089 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::add on mismatched time discretization !");
2090 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
2091 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2092 ret->setArray(arr,0);
2094 double tmp3=getStartTime(tmp1,tmp2);
2095 ret->setStartTime(tmp3,tmp1,tmp2);
2096 tmp3=getEndTime(tmp1,tmp2);
2097 ret->setEndTime(tmp3,tmp1,tmp2);
2101 void MEDCouplingConstOnTimeInterval::addEqual(const MEDCouplingTimeDiscretization *other)
2103 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2105 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::addEqual on mismatched time discretization !");
2107 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::substractaddEqual : Data Array is NULL !");
2108 getArray()->addEqual(other->getArray());
2111 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const MEDCouplingTimeDiscretization *other) const
2113 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2115 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substract on mismatched time discretization !");
2116 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
2117 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2118 ret->setArray(arr,0);
2120 double tmp3=getStartTime(tmp1,tmp2);
2121 ret->setStartTime(tmp3,tmp1,tmp2);
2122 tmp3=getEndTime(tmp1,tmp2);
2123 ret->setEndTime(tmp3,tmp1,tmp2);
2127 void MEDCouplingConstOnTimeInterval::substractEqual(const MEDCouplingTimeDiscretization *other)
2129 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2131 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substractEqual on mismatched time discretization !");
2133 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::substractEqual : Data Array is NULL !");
2134 getArray()->substractEqual(other->getArray());
2137 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::multiply(const MEDCouplingTimeDiscretization *other) const
2139 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2141 throw INTERP_KERNEL::Exception("multiply on mismatched time discretization !");
2142 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
2143 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2144 ret->setArray(arr,0);
2146 double tmp3=getStartTime(tmp1,tmp2);
2147 ret->setStartTime(tmp3,tmp1,tmp2);
2148 tmp3=getEndTime(tmp1,tmp2);
2149 ret->setEndTime(tmp3,tmp1,tmp2);
2153 void MEDCouplingConstOnTimeInterval::multiplyEqual(const MEDCouplingTimeDiscretization *other)
2155 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2157 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::multiplyEqual on mismatched time discretization !");
2159 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::multiplyEqual : Data Array is NULL !");
2160 getArray()->multiplyEqual(other->getArray());
2163 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::divide(const MEDCouplingTimeDiscretization *other) const
2165 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2167 throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
2168 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
2169 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2170 ret->setArray(arr,0);
2172 double tmp3=getStartTime(tmp1,tmp2);
2173 ret->setStartTime(tmp3,tmp1,tmp2);
2174 tmp3=getEndTime(tmp1,tmp2);
2175 ret->setEndTime(tmp3,tmp1,tmp2);
2179 void MEDCouplingConstOnTimeInterval::divideEqual(const MEDCouplingTimeDiscretization *other)
2181 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2183 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::divideEqual on mismatched time discretization !");
2185 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::divideEqual : Data Array is NULL !");
2186 getArray()->divideEqual(other->getArray());
2189 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::pow(const MEDCouplingTimeDiscretization *other) const
2191 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2193 throw INTERP_KERNEL::Exception("pow on mismatched time discretization !");
2194 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
2195 MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
2196 ret->setArray(arr,0);
2198 double tmp3=getStartTime(tmp1,tmp2);
2199 ret->setStartTime(tmp3,tmp1,tmp2);
2200 tmp3=getEndTime(tmp1,tmp2);
2201 ret->setEndTime(tmp3,tmp1,tmp2);
2205 void MEDCouplingConstOnTimeInterval::powEqual(const MEDCouplingTimeDiscretization *other)
2207 const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
2209 throw INTERP_KERNEL::Exception("ConstOnTimeInterval::powEqual on mismatched time discretization !");
2211 throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::powEqual : Data Array is NULL !");
2212 getArray()->powEqual(other->getArray());
2215 MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy),
2216 _start_time(other._start_time),_end_time(other._end_time),
2217 _start_iteration(other._start_iteration),_end_iteration(other._end_iteration),
2218 _start_order(other._start_order),_end_order(other._end_order)
2220 if(other._end_array)
2221 _end_array=other._end_array->performCpy(deepCpy);
2226 void MEDCouplingTwoTimeSteps::updateTime() const
2228 MEDCouplingTimeDiscretization::updateTime();
2230 updateTimeWith(*_end_array);
2233 void MEDCouplingTwoTimeSteps::synchronizeTimeWith(const MEDCouplingMesh *mesh)
2236 throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
2238 double val=mesh->getTime(it,order);
2239 _start_time=val; _start_iteration=it; _start_order=order;
2240 _end_time=val; _end_iteration=it; _end_order=order;
2241 std::string tUnit=mesh->getTimeUnit();
2245 std::size_t MEDCouplingTwoTimeSteps::getHeapMemorySizeWithoutChildren() const
2247 return MEDCouplingTimeDiscretization::getHeapMemorySizeWithoutChildren();
2250 std::vector<const BigMemoryObject *> MEDCouplingTwoTimeSteps::getDirectChildrenWithNull() const
2252 std::vector<const BigMemoryObject *> ret(MEDCouplingTimeDiscretization::getDirectChildrenWithNull());
2253 ret.push_back(_end_array);
2257 void MEDCouplingTwoTimeSteps::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
2259 MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
2260 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(&other);
2262 throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::copyTinyAttrFrom : mismatch of time discretization !");
2263 _start_time=otherC->_start_time;
2264 _end_time=otherC->_end_time;
2265 _start_iteration=otherC->_start_iteration;
2266 _end_iteration=otherC->_end_iteration;
2267 _start_order=otherC->_start_order;
2268 _end_order=otherC->_end_order;
2271 void MEDCouplingTwoTimeSteps::copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other)
2273 MEDCouplingTimeDiscretization::copyTinyStringsFrom(other);
2274 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(&other);
2276 throw INTERP_KERNEL::Exception("Trying to operate copyTinyStringsFrom on different field type (two times//one time) !");
2277 if(_end_array && otherC->_end_array)
2278 _end_array->copyStringInfoFrom(*otherC->_end_array);
2281 const DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray() const
2286 DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray()
2291 void MEDCouplingTwoTimeSteps::checkCoherency() const
2293 MEDCouplingTimeDiscretization::checkCoherency();
2295 throw INTERP_KERNEL::Exception("No end array specified !");
2296 if(_array->getNumberOfComponents()!=_end_array->getNumberOfComponents())
2297 throw INTERP_KERNEL::Exception("The number of components mismatch between the start and the end arrays !");
2298 if(_array->getNumberOfTuples()!=_end_array->getNumberOfTuples())
2299 throw INTERP_KERNEL::Exception("The number of tuples mismatch between the start and the end arrays !");
2302 bool MEDCouplingTwoTimeSteps::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
2304 std::ostringstream oss;
2305 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(other);
2308 reason="This has time discretization LINEAR_TIME, other not.";
2311 if(_start_iteration!=otherC->_start_iteration)
2313 oss << "start iterations differ. this start iteration=" << _start_iteration << " other start iteration=" << otherC->_start_iteration;
2317 if(_start_order!=otherC->_start_order)
2319 oss << "start orders differ. this start order=" << _start_order << " other start order=" << otherC->_start_order;
2323 if(std::fabs(_start_time-otherC->_start_time)>_time_tolerance)
2325 oss << "start times differ. this start time=" << _start_time << " other start time=" << otherC->_start_time;
2329 if(_end_iteration!=otherC->_end_iteration)
2331 oss << "end iterations differ. this end iteration=" << _end_iteration << " other end iteration=" << otherC->_end_iteration;
2335 if(_end_order!=otherC->_end_order)
2337 oss << "end orders differ. this end order=" << _end_order << " other end order=" << otherC->_end_order;
2341 if(std::fabs(_end_time-otherC->_end_time)>_time_tolerance)
2343 oss << "end times differ. this end time=" << _end_time << " other end time=" << otherC->_end_time;
2347 if(_end_array!=otherC->_end_array)
2348 if(!_end_array->isEqualIfNotWhy(*otherC->_end_array,prec,reason))
2350 reason.insert(0,"end arrays differ for linear time.");
2353 return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
2356 bool MEDCouplingTwoTimeSteps::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
2358 const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(other);
2361 if(_start_iteration!=otherC->_start_iteration)
2363 if(_end_iteration!=otherC->_end_iteration)
2365 if(_start_order!=otherC->_start_order)
2367 if(_end_order!=otherC->_end_order)
2369 if(std::fabs(_start_time-otherC->_start_time)>_time_tolerance)
2371 if(std::fabs(_end_time-otherC->_end_time)>_time_tolerance)
2373 if(_end_array!=otherC->_end_array)
2374 if(!_end_array->isEqualWithoutConsideringStr(*otherC->_end_array,prec))
2376 return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
2379 MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps():_start_time(0.),_end_time(0.),_start_iteration(-1),_end_iteration(-1),_start_order(-1),_end_order(-1),_end_array(0)
2383 MEDCouplingTwoTimeSteps::~MEDCouplingTwoTimeSteps()
2386 _end_array->decrRef();
2389 void MEDCouplingTwoTimeSteps::checkNoTimePresence() const
2391 throw INTERP_KERNEL::Exception("The field presents a time to be specified in every access !");
2394 void MEDCouplingTwoTimeSteps::checkTimePresence(double time) const
2396 if(time<_start_time-_time_tolerance || time>_end_time+_time_tolerance)
2398 std::ostringstream stream;
2399 stream << "The field is defined between times " << _start_time << " and " << _end_time << " worderh tolerance ";
2400 stream << _time_tolerance << " and trying to access on time = " << time;
2401 throw INTERP_KERNEL::Exception(stream.str().c_str());
2405 void MEDCouplingTwoTimeSteps::getArrays(std::vector<DataArrayDouble *>& arrays) const
2409 arrays[1]=_end_array;
2412 void MEDCouplingTwoTimeSteps::setEndArray(DataArrayDouble *array, TimeLabel *owner)
2414 if(array!=_end_array)
2417 _end_array->decrRef();
2420 _end_array->incrRef();
2422 owner->declareAsNew();
2426 void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
2428 MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
2429 tinyInfo.push_back(_start_iteration);
2430 tinyInfo.push_back(_start_order);
2431 tinyInfo.push_back(_end_iteration);
2432 tinyInfo.push_back(_end_order);
2435 tinyInfo.push_back(_end_array->getNumberOfTuples());
2436 tinyInfo.push_back(_end_array->getNumberOfComponents());
2440 tinyInfo.push_back(-1);
2441 tinyInfo.push_back(-1);
2445 void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
2447 MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
2448 tinyInfo.push_back(_start_time);
2449 tinyInfo.push_back(_end_time);
2452 void MEDCouplingTwoTimeSteps::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
2454 int nbOfCompo=_array->getNumberOfComponents();
2455 for(int i=0;i<nbOfCompo;i++)
2456 tinyInfo.push_back(_array->getInfoOnComponent(i));
2457 for(int i=0;i<nbOfCompo;i++)
2458 tinyInfo.push_back(_end_array->getInfoOnComponent(i));
2461 void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
2467 _end_array->decrRef();
2468 DataArrayDouble *arr=0;
2469 if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
2471 arr=DataArrayDouble::New();
2472 arr->alloc(tinyInfoI[0],tinyInfoI[1]);
2477 if(tinyInfoI[6]!=-1 && tinyInfoI[7]!=-1)
2479 arr=DataArrayDouble::New();
2480 arr->alloc(tinyInfoI[6],tinyInfoI[7]);
2486 void MEDCouplingTwoTimeSteps::checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays)
2488 static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size two !";
2489 if(arrays.size()!=2)
2490 throw INTERP_KERNEL::Exception(MSG);
2494 _end_array->decrRef();
2495 _array=0; _end_array=0;
2496 if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
2499 throw INTERP_KERNEL::Exception(MSG);
2500 arrays[0]->checkNbOfTuplesAndComp(tinyInfoI[0],tinyInfoI[1],MSG);
2501 _array=arrays[0]; _array->incrRef();
2503 if(tinyInfoI[6]!=-1 && tinyInfoI[7]!=-1)
2506 throw INTERP_KERNEL::Exception(MSG);
2507 arrays[1]->checkNbOfTuplesAndComp(tinyInfoI[0],tinyInfoI[1],MSG);
2508 _end_array=arrays[1]; _end_array->incrRef();
2512 void MEDCouplingTwoTimeSteps::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
2514 MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
2515 _start_time=tinyInfoD[1];
2516 _end_time=tinyInfoD[2];
2517 _start_iteration=tinyInfoI[2];
2518 _start_order=tinyInfoI[3];
2519 _end_iteration=tinyInfoI[4];
2520 _end_order=tinyInfoI[5];
2524 * idem getTinySerializationIntInformation except that it is for multi field fetch
2526 void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
2529 tinyInfo[0]=_start_iteration;
2530 tinyInfo[1]=_start_order;
2531 tinyInfo[2]=_end_iteration;
2532 tinyInfo[3]=_end_order;
2536 * idem getTinySerializationDbleInformation except that it is for multi field fetch
2538 void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
2541 tinyInfo[0]=_time_tolerance;
2542 tinyInfo[1]=_start_time;
2543 tinyInfo[2]=_end_time;
2547 * idem finishUnserialization except that it is for multi field fetch
2549 void MEDCouplingTwoTimeSteps::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
2551 _start_iteration=tinyInfoI[0];
2552 _start_order=tinyInfoI[1];
2553 _end_iteration=tinyInfoI[2];
2554 _end_order=tinyInfoI[3];
2555 _time_tolerance=tinyInfoD[0];
2556 _start_time=tinyInfoD[1];
2557 _end_time=tinyInfoD[2];
2560 std::vector< const DataArrayDouble *> MEDCouplingTwoTimeSteps::getArraysForTime(double time) const
2562 if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
2564 std::vector< const DataArrayDouble *> ret(2);
2570 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
2573 void MEDCouplingTwoTimeSteps::setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner)
2575 if(arrays.size()!=2)
2576 throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::setArrays : number of arrays must be two.");
2577 setArray(arrays.front(),owner);
2578 setEndArray(arrays.back(),owner);
2581 MEDCouplingLinearTime::MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCpy):MEDCouplingTwoTimeSteps(other,deepCpy)
2585 MEDCouplingLinearTime::MEDCouplingLinearTime()
2589 std::string MEDCouplingLinearTime::getStringRepr() const
2591 std::ostringstream stream;
2592 stream << REPR << " Time interval is defined by :\niteration_start=" << _start_iteration << " order_start=" << _start_order << " and time_start=" << _start_time << "\n";
2593 stream << "iteration_end=" << _end_iteration << " order_end=" << _end_order << " and end_time=" << _end_time << "\n";
2594 stream << "Time unit is : \"" << _time_unit << "\"";
2595 return stream.str();
2598 void MEDCouplingLinearTime::checkCoherency() const
2600 MEDCouplingTwoTimeSteps::checkCoherency();
2601 if(std::fabs(_start_time-_end_time)<_time_tolerance)
2602 throw INTERP_KERNEL::Exception("Start time and end time are equals regarding time tolerance.");
2605 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::performCpy(bool deepCpy) const
2607 return new MEDCouplingLinearTime(*this,deepCpy);
2610 bool MEDCouplingLinearTime::areCompatible(const MEDCouplingTimeDiscretization *other) const
2612 if(!MEDCouplingTimeDiscretization::areCompatible(other))
2614 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2617 if(_end_array==0 && otherC->_end_array==0)
2619 if(_end_array==0 || otherC->_end_array==0)
2621 if(_end_array->getNumberOfComponents()!=otherC->_end_array->getNumberOfComponents())
2626 bool MEDCouplingLinearTime::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
2628 if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
2630 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2633 reason.insert(0,"time discretization of this is LINEAR_TIME, other has a different time discretization.");
2637 bool MEDCouplingLinearTime::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
2639 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
2641 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2645 bool MEDCouplingLinearTime::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
2647 if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
2649 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2652 if(_end_array==0 && otherC->_end_array==0)
2654 if(_end_array==0 || otherC->_end_array==0)
2656 int nbC1=_end_array->getNumberOfComponents();
2657 int nbC2=otherC->_end_array->getNumberOfComponents();
2658 if(nbC1!=nbC2 && nbC2!=1)
2663 bool MEDCouplingLinearTime::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
2665 if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
2667 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2672 * vals is expected to be of size 2*_array->getNumberOfTuples()==_array->getNumberOfTuples()+_end_array->getNumberOfTuples()
2674 void MEDCouplingLinearTime::getValueForTime(double time, const std::vector<double>& vals, double *res) const
2676 double alpha=(_end_time-time)/(_end_time-_start_time);
2677 std::size_t nbComp=vals.size()/2;
2678 std::transform(vals.begin(),vals.begin()+nbComp,res,std::bind2nd(std::multiplies<double>(),alpha));
2679 std::vector<double> tmp(nbComp);
2680 std::transform(vals.begin()+nbComp,vals.end(),tmp.begin(),std::bind2nd(std::multiplies<double>(),1-alpha));
2681 std::transform(tmp.begin(),tmp.end(),res,res,std::plus<double>());
2684 void MEDCouplingLinearTime::getValueOnTime(int eltId, double time, double *value) const
2686 double alpha=(_end_time-time)/(_end_time-_start_time);
2689 _array->getTuple(eltId,value);
2691 throw INTERP_KERNEL::Exception("No start array existing.");
2692 nbComp=_array->getNumberOfComponents();
2693 std::transform(value,value+nbComp,value,std::bind2nd(std::multiplies<double>(),alpha));
2694 std::vector<double> tmp(nbComp);
2696 _end_array->getTuple(eltId,&tmp[0]);
2698 throw INTERP_KERNEL::Exception("No end array existing.");
2699 std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::multiplies<double>(),1-alpha));
2700 std::transform(tmp.begin(),tmp.end(),value,value,std::plus<double>());
2703 void MEDCouplingLinearTime::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
2705 if(iteration==_start_iteration && order==_start_order)
2708 _array->getTuple(eltId,value);
2710 throw INTERP_KERNEL::Exception("iteration order match with start time but no start array existing.");
2712 if(iteration==_end_iteration && order==_end_order)
2715 _end_array->getTuple(eltId,value);
2717 throw INTERP_KERNEL::Exception("iteration order match with end time but no end array existing.");
2720 throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
2723 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const MEDCouplingTimeDiscretization *other) const
2725 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2727 throw INTERP_KERNEL::Exception("LinearTime::aggregation on mismatched time discretization !");
2728 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Aggregate(getArray(),other->getArray());
2729 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Aggregate(getEndArray(),other->getEndArray());
2730 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2731 ret->setArray(arr1,0);
2732 ret->setEndArray(arr2,0);
2736 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
2738 std::vector<const DataArrayDouble *> a(other.size());
2739 std::vector<const DataArrayDouble *> b(other.size());
2741 for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
2743 const MEDCouplingLinearTime *itC=dynamic_cast<const MEDCouplingLinearTime *>(*it);
2745 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::aggregate on mismatched time discretization !");
2746 a[i]=itC->getArray();
2747 b[i]=itC->getEndArray();
2749 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
2750 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Aggregate(b);
2751 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2752 ret->setArray(arr,0);
2753 ret->setEndArray(arr2,0);
2757 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::meld(const MEDCouplingTimeDiscretization *other) const
2759 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2761 throw INTERP_KERNEL::Exception("LinearTime::meld on mismatched time discretization !");
2762 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Meld(getArray(),other->getArray());
2763 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Meld(getEndArray(),other->getEndArray());
2764 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2765 ret->setTimeTolerance(getTimeTolerance());
2766 ret->setArray(arr1,0);
2767 ret->setEndArray(arr2,0);
2771 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::dot(const MEDCouplingTimeDiscretization *other) const
2773 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2775 throw INTERP_KERNEL::Exception("LinearTime::dot on mismatched time discretization !");
2776 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Dot(getArray(),other->getArray());
2777 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Dot(getEndArray(),other->getEndArray());
2778 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2779 ret->setArray(arr1,0);
2780 ret->setEndArray(arr2,0);
2784 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::crossProduct(const MEDCouplingTimeDiscretization *other) const
2786 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2788 throw INTERP_KERNEL::Exception("LinearTime::crossProduct on mismatched time discretization !");
2789 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::CrossProduct(getArray(),other->getArray());
2790 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::CrossProduct(getEndArray(),other->getEndArray());
2791 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2792 ret->setArray(arr1,0);
2793 ret->setEndArray(arr2,0);
2797 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::max(const MEDCouplingTimeDiscretization *other) const
2799 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2801 throw INTERP_KERNEL::Exception("LinearTime::max on mismatched time discretization !");
2802 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2803 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Max(getArray(),other->getArray());
2804 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Max(getEndArray(),other->getEndArray());
2805 ret->setArray(arr1,0);
2806 ret->setEndArray(arr2,0);
2810 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::min(const MEDCouplingTimeDiscretization *other) const
2812 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2814 throw INTERP_KERNEL::Exception("LinearTime::min on mismatched time discretization !");
2815 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Min(getArray(),other->getArray());
2816 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Min(getEndArray(),other->getEndArray());
2817 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2818 ret->setArray(arr1,0);
2819 ret->setEndArray(arr2,0);
2823 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::add(const MEDCouplingTimeDiscretization *other) const
2825 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2827 throw INTERP_KERNEL::Exception("LinearTime::add on mismatched time discretization !");
2828 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Add(getArray(),other->getArray());
2829 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Add(getEndArray(),other->getEndArray());
2830 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2831 ret->setArray(arr1,0);
2832 ret->setEndArray(arr2,0);
2836 void MEDCouplingLinearTime::addEqual(const MEDCouplingTimeDiscretization *other)
2838 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2840 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2842 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::addEqual : Data Array is NULL !");
2844 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::addEqual : Data Array (end) is NULL !");
2845 getArray()->addEqual(other->getArray());
2846 getEndArray()->addEqual(other->getEndArray());
2849 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::substract(const MEDCouplingTimeDiscretization *other) const
2851 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2853 throw INTERP_KERNEL::Exception("LinearTime::substract on mismatched time discretization !");
2854 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Substract(getArray(),other->getArray());
2855 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Substract(getEndArray(),other->getEndArray());
2856 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2857 ret->setArray(arr1,0);
2858 ret->setEndArray(arr2,0);
2862 void MEDCouplingLinearTime::substractEqual(const MEDCouplingTimeDiscretization *other)
2864 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2866 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2868 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::substractEqual : Data Array is NULL !");
2870 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::substractEqual : Data Array (end) is NULL !");
2871 getArray()->substractEqual(other->getArray());
2872 getEndArray()->substractEqual(other->getEndArray());
2875 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::multiply(const MEDCouplingTimeDiscretization *other) const
2877 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2879 throw INTERP_KERNEL::Exception("LinearTime::multiply on mismatched time discretization !");
2880 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Multiply(getArray(),other->getArray());
2881 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Multiply(getEndArray(),other->getEndArray());
2882 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2883 ret->setArray(arr1,0);
2884 ret->setEndArray(arr2,0);
2888 void MEDCouplingLinearTime::multiplyEqual(const MEDCouplingTimeDiscretization *other)
2890 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2892 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2894 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::multiplyEqual : Data Array is NULL !");
2896 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::multiplyEqual : Data Array (end) is NULL !");
2897 getArray()->multiplyEqual(other->getArray());
2898 getEndArray()->multiplyEqual(other->getEndArray());
2901 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::divide(const MEDCouplingTimeDiscretization *other) const
2903 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2905 throw INTERP_KERNEL::Exception("LinearTime::divide on mismatched time discretization !");
2906 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Divide(getArray(),other->getArray());
2907 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Divide(getEndArray(),other->getEndArray());
2908 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2909 ret->setArray(arr1,0);
2910 ret->setEndArray(arr2,0);
2914 void MEDCouplingLinearTime::divideEqual(const MEDCouplingTimeDiscretization *other)
2916 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2918 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2920 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::divideEqual : Data Array is NULL !");
2922 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::divideEqual : Data Array (end) is NULL !");
2923 getArray()->divideEqual(other->getArray());
2924 getEndArray()->divideEqual(other->getEndArray());
2927 MEDCouplingTimeDiscretization *MEDCouplingLinearTime::pow(const MEDCouplingTimeDiscretization *other) const
2929 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2931 throw INTERP_KERNEL::Exception("LinearTime::pow on mismatched time discretization !");
2932 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Pow(getArray(),other->getArray());
2933 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Pow(getEndArray(),other->getEndArray());
2934 MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
2935 ret->setArray(arr1,0);
2936 ret->setEndArray(arr2,0);
2940 void MEDCouplingLinearTime::powEqual(const MEDCouplingTimeDiscretization *other)
2942 const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
2944 throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
2946 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::powEqual : Data Array is NULL !");
2948 throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::powEqual : Data Array (end) is NULL !");
2949 getArray()->powEqual(other->getArray());
2950 getEndArray()->powEqual(other->getEndArray());