X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingTimeDiscretization.cxx;h=7836e91c4efddfb39a4bfb6b65e3eaad02481e89;hb=f1a947b32a36d8dc8e3079b25305bb50e8cb59a0;hp=1f4e1fef5ad0f1bf3e2856fe5fd35bde23f44aef;hpb=10f37bf6f33a762626d7f1093b2f5450c1688667;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx index 1f4e1fef5..7836e91c4 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2013 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 @@ -16,10 +16,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// Author : Anthony Geay (CEA/DEN) #include "MEDCouplingTimeDiscretization.hxx" -#include "MEDCouplingMemArray.hxx" #include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MEDCouplingMemArray.hxx" +#include "MEDCouplingMesh.hxx" #include #include @@ -91,6 +93,14 @@ void MEDCouplingTimeDiscretization::updateTime() const updateTimeWith(*_array); } +std::size_t MEDCouplingTimeDiscretization::getHeapMemorySize() const +{ + std::size_t ret=_time_unit.capacity(); + if(_array) + ret+=_array->getHeapMemorySize(); + return ret; +} + bool MEDCouplingTimeDiscretization::areCompatible(const MEDCouplingTimeDiscretization *other) const { if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16) @@ -812,6 +822,11 @@ std::string MEDCouplingNoTimeLabel::getStringRepr() const return stream.str(); } +void MEDCouplingNoTimeLabel::synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception) +{ + throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::synchronizeTimeWith : impossible to synchronize time with a MEDCouplingMesh because the time discretization is incompatible with it !"); +} + bool MEDCouplingNoTimeLabel::areCompatible(const MEDCouplingTimeDiscretization *other) const { if(!MEDCouplingTimeDiscretization::areCompatible(other)) @@ -1176,6 +1191,17 @@ std::string MEDCouplingWithTimeStep::getStringRepr() const return stream.str(); } +void MEDCouplingWithTimeStep::synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception) +{ + if(!mesh) + throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !"); + int it=-1,order=-1; + double val=mesh->getTime(it,order); + _time=val; _iteration=it; _order=order; + std::string tUnit=mesh->getTimeUnit(); + _time_unit=tUnit; +} + void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector& tinyInfo) const { MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo); @@ -1661,6 +1687,18 @@ std::string MEDCouplingConstOnTimeInterval::getStringRepr() const return stream.str(); } +void MEDCouplingConstOnTimeInterval::synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception) +{ + if(!mesh) + throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !"); + int it=-1,order=-1; + double val=mesh->getTime(it,order); + _start_time=val; _start_iteration=it; _start_order=order; + _end_time=val; _end_iteration=it; _end_order=order; + std::string tUnit=mesh->getTimeUnit(); + _time_unit=tUnit; +} + MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::performCpy(bool deepCpy) const { return new MEDCouplingConstOnTimeInterval(*this,deepCpy); @@ -2038,6 +2076,26 @@ void MEDCouplingTwoTimeSteps::updateTime() const updateTimeWith(*_end_array); } +void MEDCouplingTwoTimeSteps::synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception) +{ + if(!mesh) + throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !"); + int it=-1,order=-1; + double val=mesh->getTime(it,order); + _start_time=val; _start_iteration=it; _start_order=order; + _end_time=val; _end_iteration=it; _end_order=order; + std::string tUnit=mesh->getTimeUnit(); + _time_unit=tUnit; +} + +std::size_t MEDCouplingTwoTimeSteps::getHeapMemorySize() const +{ + std::size_t ret=0; + if(_end_array) + ret+=_end_array->getHeapMemorySize(); + return MEDCouplingTimeDiscretization::getHeapMemorySize()+ret; +} + void MEDCouplingTwoTimeSteps::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception) { MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);