X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingDefinitionTime.cxx;h=d75b63cf41f96f4fa05d4ac72bf54c18181eb2e7;hb=90b7c9c73054965b8085ab0ecd2646a3d59f475a;hp=45aa50c7af222d18b1f804432a5f24dace06c48a;hpb=f1a947b32a36d8dc8e3079b25305bb50e8cb59a0;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingDefinitionTime.cxx b/src/MEDCoupling/MEDCouplingDefinitionTime.cxx index 45aa50c7a..d75b63cf4 100644 --- a/src/MEDCoupling/MEDCouplingDefinitionTime.cxx +++ b/src/MEDCoupling/MEDCouplingDefinitionTime.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2020 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -23,17 +23,17 @@ #include -using namespace ParaMEDMEM; +using namespace MEDCoupling; const double MEDCouplingDefinitionTime::EPS_DFT=1e-15; -MEDCouplingDefinitionTimeSlice *MEDCouplingDefinitionTimeSlice::New(const MEDCouplingFieldDouble *f, int meshId, const std::vector& arrId, int fieldId) throw(INTERP_KERNEL::Exception) +MEDCouplingDefinitionTimeSlice *MEDCouplingDefinitionTimeSlice::New(const MEDCouplingFieldDouble *f, int meshId, const std::vector& arrId, int fieldId) { static const char msg[]="TimeSlice::New : mismatch of arrays number of a fieldDouble and its policy !!! Internal error !!!"; if(!f) throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTimeSlice::New : empty field !"); switch(f->getTimeDiscretization()) - { + { case ONE_TIME: { if(arrId.size()!=1) @@ -53,16 +53,16 @@ MEDCouplingDefinitionTimeSlice *MEDCouplingDefinitionTimeSlice::New(const MEDCou return new MEDCouplingDefinitionTimeSliceLT(f,meshId,arrId[0],arrId[1],fieldId); } case NO_TIME: - throw INTERP_KERNEL::Exception("Invalide time discretization ! NO_TIME ! Impossible to build a definition time slice !"); + throw INTERP_KERNEL::Exception("Invalid time discretization ! NO_TIME ! Impossible to build a definition time slice !"); default: - throw INTERP_KERNEL::Exception("Invalide time discretization : Not recognized !"); - } + throw INTERP_KERNEL::Exception("Invalid time discretization : Not recognized !"); + } } -MEDCouplingDefinitionTimeSlice *MEDCouplingDefinitionTimeSlice::New(TypeOfTimeDiscretization type, const std::vector& tiI, const std::vector& tiD) throw(INTERP_KERNEL::Exception) +MEDCouplingDefinitionTimeSlice *MEDCouplingDefinitionTimeSlice::New(TypeOfTimeDiscretization type, const std::vector& tiI, const std::vector& tiD) { switch(type) - { + { case ONE_TIME: return MEDCouplingDefinitionTimeSliceInst::New(tiI,tiD); case CONST_ON_TIME_INTERVAL: @@ -71,7 +71,7 @@ MEDCouplingDefinitionTimeSlice *MEDCouplingDefinitionTimeSlice::New(TypeOfTimeDi return MEDCouplingDefinitionTimeSliceLT::New(tiI,tiD); default: throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTimeSlice::New : unrecognized time discretization type !"); - } + } } bool MEDCouplingDefinitionTimeSlice::isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const @@ -100,7 +100,7 @@ void MEDCouplingDefinitionTimeSlice::appendRepr(std::ostream& stream) const stream << " *** MeshId : " << _mesh_id << " ArrayId : " << _array_id; } -MEDCouplingDefinitionTimeSlice::MEDCouplingDefinitionTimeSlice(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId) throw(INTERP_KERNEL::Exception):_mesh_id(meshId),_array_id(arrId),_field_id(fieldId) +MEDCouplingDefinitionTimeSlice::MEDCouplingDefinitionTimeSlice(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId):_mesh_id(meshId),_array_id(arrId),_field_id(fieldId) { int tmp1,tmp2; double t1=f->getStartTime(tmp1,tmp2); @@ -109,11 +109,16 @@ MEDCouplingDefinitionTimeSlice::MEDCouplingDefinitionTimeSlice(const MEDCoupling throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTimeSlice : End time strictly before Start time ..."); } -std::size_t MEDCouplingDefinitionTimeSlice::getHeapMemorySize() const +std::size_t MEDCouplingDefinitionTimeSlice::getHeapMemorySizeWithoutChildren() const { return 0; } +std::vector MEDCouplingDefinitionTimeSlice::getDirectChildrenWithNull() const +{ + return std::vector(); +} + bool MEDCouplingDefinitionTimeSlice::isFullyIncludedInMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const { double t1=getStartTime(); @@ -195,7 +200,7 @@ void MEDCouplingDefinitionTimeSliceInst::getHotSpotsTime(std::vector& re ret[0]=_instant; } -void MEDCouplingDefinitionTimeSliceInst::getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception) +void MEDCouplingDefinitionTimeSliceInst::getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const { meshId=_mesh_id; arrId=_array_id; @@ -224,7 +229,7 @@ double MEDCouplingDefinitionTimeSliceInst::getEndTime() const return _instant; } -MEDCouplingDefinitionTimeSliceInst::MEDCouplingDefinitionTimeSliceInst(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId) throw(INTERP_KERNEL::Exception):MEDCouplingDefinitionTimeSlice(f,meshId,arrId,fieldId) +MEDCouplingDefinitionTimeSliceInst::MEDCouplingDefinitionTimeSliceInst(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId):MEDCouplingDefinitionTimeSlice(f,meshId,arrId,fieldId) { int tmp1,tmp2; double t1=f->getStartTime(tmp1,tmp2); @@ -265,7 +270,7 @@ void MEDCouplingDefinitionTimeSliceCstOnTI::getHotSpotsTime(std::vector& ret[0]=(_start+_end)/2.; } -void MEDCouplingDefinitionTimeSliceCstOnTI::getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception) +void MEDCouplingDefinitionTimeSliceCstOnTI::getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const { meshId=_mesh_id; arrId=_array_id; @@ -313,7 +318,7 @@ TypeOfTimeDiscretization MEDCouplingDefinitionTimeSliceCstOnTI::getTimeType() co return CONST_ON_TIME_INTERVAL; } -MEDCouplingDefinitionTimeSliceCstOnTI::MEDCouplingDefinitionTimeSliceCstOnTI(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId) throw(INTERP_KERNEL::Exception):MEDCouplingDefinitionTimeSlice(f,meshId,arrId,fieldId) +MEDCouplingDefinitionTimeSliceCstOnTI::MEDCouplingDefinitionTimeSliceCstOnTI(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId):MEDCouplingDefinitionTimeSlice(f,meshId,arrId,fieldId) { int tmp1,tmp2; double t1=f->getStartTime(tmp1,tmp2); @@ -355,7 +360,7 @@ void MEDCouplingDefinitionTimeSliceLT::getHotSpotsTime(std::vector& ret) ret[1]=_end; } -void MEDCouplingDefinitionTimeSliceLT::getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception) +void MEDCouplingDefinitionTimeSliceLT::getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const { if(fabs(tm-_start)getStartTime(tmp1,tmp2); @@ -435,17 +440,17 @@ MEDCouplingDefinitionTime::MEDCouplingDefinitionTime():_eps(EPS_DFT) { } -MEDCouplingDefinitionTime::MEDCouplingDefinitionTime(const std::vector& fs, const std::vector& meshRefs, const std::vector >& arrRefs) throw(INTERP_KERNEL::Exception) +MEDCouplingDefinitionTime::MEDCouplingDefinitionTime(const std::vector& fs, const std::vector& meshRefs, const std::vector >& arrRefs) { std::size_t sz=fs.size(); if(sz!=arrRefs.size()) throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime constructor : internal error ! should never happen !"); _slices.resize(sz); - for(std::size_t i=0;i MEDCouplingDefinitionTime::getDirectChildrenWithNull() const +{ + return std::vector(); +} + void MEDCouplingDefinitionTime::assign(const MEDCouplingDefinitionTime& other) { std::size_t sz=other._slices.size(); @@ -488,7 +498,7 @@ bool MEDCouplingDefinitionTime::isEqual(const MEDCouplingDefinitionTime& other) return true; } -void MEDCouplingDefinitionTime::getIdsOnTimeRight(double tm, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception) +void MEDCouplingDefinitionTime::getIdsOnTimeRight(double tm, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const { std::vector meshIds; std::vector arrIds; @@ -501,7 +511,7 @@ void MEDCouplingDefinitionTime::getIdsOnTimeRight(double tm, int& meshId, int& a fieldId=fieldIds.back(); } -void MEDCouplingDefinitionTime::getIdsOnTimeLeft(double tm, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception) +void MEDCouplingDefinitionTime::getIdsOnTimeLeft(double tm, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const { std::vector meshIds; std::vector arrIds; @@ -514,11 +524,11 @@ void MEDCouplingDefinitionTime::getIdsOnTimeLeft(double tm, int& meshId, int& ar fieldId=fieldIds.front(); } -void MEDCouplingDefinitionTime::getIdsOnTime(double tm, std::vector& meshIds, std::vector& arrIds, std::vector& arrIdsInField, std::vector& fieldIds) const throw(INTERP_KERNEL::Exception) +void MEDCouplingDefinitionTime::getIdsOnTime(double tm, std::vector& meshIds, std::vector& arrIds, std::vector& arrIdsInField, std::vector& fieldIds) const { std::vector ids; int id=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_slices.begin();it!=_slices.end();it++,id++) + for(std::vector< MCAuto >::const_iterator it=_slices.begin();it!=_slices.end();it++,id++) if((*it)->isContaining(tm,_eps)) ids.push_back(id); if(ids.empty()) @@ -538,7 +548,7 @@ void MEDCouplingDefinitionTime::getIdsOnTime(double tm, std::vector& meshId std::vector MEDCouplingDefinitionTime::getHotSpotsTime() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_slices.begin();it!=_slices.end();it++) + for(std::vector< MCAuto >::const_iterator it=_slices.begin();it!=_slices.end();it++) { std::vector tmp; (*it)->getHotSpotsTime(tmp); @@ -558,7 +568,7 @@ std::vector MEDCouplingDefinitionTime::getHotSpotsTime() const void MEDCouplingDefinitionTime::appendRepr(std::ostream& stream) const { stream << "Time definition :\n"; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_slices.begin();it!=_slices.end();it++) + for(std::vector< MCAuto >::const_iterator it=_slices.begin();it!=_slices.end();it++) { stream << " - "; (*it)->appendRepr(stream);