Salome HOME
new method MEDCouplingUMesh::computeNeighborsOfNodes
[tools/medcoupling.git] / src / MEDCoupling / MEDCouplingTimeDiscretization.cxx
index f0900c107911a1e8948d49a264f2ee1e78677204..3f27e506ae0033032bab5ee8bc8ed04969b0ee63 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2014  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
@@ -52,7 +52,7 @@ const char MEDCouplingLinearTime::REPR[]="Linear time between 2 time steps.";
 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::New(TypeOfTimeDiscretization type)
 {
   switch(type)
-    {
+  {
     case MEDCouplingNoTimeLabel::DISCRETIZATION:
       return new MEDCouplingNoTimeLabel;
     case MEDCouplingWithTimeStep::DISCRETIZATION:
@@ -63,7 +63,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::New(TypeOfTimeDisc
       return new MEDCouplingLinearTime;
     default:
       throw INTERP_KERNEL::Exception("Time discretization not implemented yet");
-    }
+  }
 }
 
 void MEDCouplingTimeDiscretization::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
@@ -264,7 +264,7 @@ void MEDCouplingTimeDiscretization::finishUnserialization(const std::vector<int>
   _time_tolerance=tinyInfoD[0];
   int nbOfCompo=_array->getNumberOfComponents();
   for(int i=0;i<nbOfCompo;i++)
-    _array->setInfoOnComponent(i,tinyInfoS[i].c_str());
+    _array->setInfoOnComponent(i,tinyInfoS[i]);
 }
 
 void MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
@@ -715,7 +715,7 @@ void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, FunctionToEvaluate f
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const char *func)
+void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -733,7 +733,7 @@ void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const char *func)
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const char *func)
+void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -751,7 +751,7 @@ void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const char *func)
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func)
+void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -769,7 +769,7 @@ void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<s
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFunc(const char *func)
+void MEDCouplingTimeDiscretization::applyFunc(const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -787,7 +787,7 @@ void MEDCouplingTimeDiscretization::applyFunc(const char *func)
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFuncFast32(const char *func)
+void MEDCouplingTimeDiscretization::applyFuncFast32(const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -798,7 +798,7 @@ void MEDCouplingTimeDiscretization::applyFuncFast32(const char *func)
     }
 }
 
-void MEDCouplingTimeDiscretization::applyFuncFast64(const char *func)
+void MEDCouplingTimeDiscretization::applyFuncFast64(const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -822,7 +822,7 @@ void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc,
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const char *func)
+void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -835,7 +835,7 @@ void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc,
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const char *func)
+void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -848,7 +848,7 @@ void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func)
+void MEDCouplingTimeDiscretization::fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -1251,7 +1251,7 @@ void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector<int>& tiny
 }
 
 MEDCouplingWithTimeStep::MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy),
-                                                                                                     _time(other._time),_iteration(other._iteration),_order(other._order)
+    _time(other._time),_iteration(other._iteration),_order(other._order)
 {
 }
 
@@ -1773,8 +1773,8 @@ void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector<in
 }
 
 MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCpy):
-  MEDCouplingTimeDiscretization(other,deepCpy),_start_time(other._start_time),_end_time(other._end_time),_start_iteration(other._start_iteration),
-  _end_iteration(other._end_iteration),_start_order(other._start_order),_end_order(other._end_order)
+      MEDCouplingTimeDiscretization(other,deepCpy),_start_time(other._start_time),_end_time(other._end_time),_start_iteration(other._start_iteration),
+      _end_iteration(other._end_iteration),_start_order(other._start_order),_end_order(other._end_order)
 {
 }
 
@@ -2079,7 +2079,7 @@ void MEDCouplingConstOnTimeInterval::addEqual(const MEDCouplingTimeDiscretizatio
     throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::substractaddEqual : Data Array is NULL !");
   getArray()->addEqual(other->getArray());
 }
+
 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const MEDCouplingTimeDiscretization *other) const
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
@@ -2185,9 +2185,9 @@ void MEDCouplingConstOnTimeInterval::powEqual(const MEDCouplingTimeDiscretizatio
 }
 
 MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy),
-                                                                                                     _start_time(other._start_time),_end_time(other._end_time),
-                                                                                                     _start_iteration(other._start_iteration),_end_iteration(other._end_iteration),
-                                                                                                     _start_order(other._start_order),_end_order(other._end_order)
+    _start_time(other._start_time),_end_time(other._end_time),
+    _start_iteration(other._start_iteration),_end_iteration(other._end_iteration),
+    _start_order(other._start_order),_end_order(other._end_order)
 {
   if(other._end_array)
     _end_array=other._end_array->performCpy(deepCpy);
@@ -2506,7 +2506,7 @@ void MEDCouplingTwoTimeSteps::finishUnserialization2(const std::vector<int>& tin
 
 std::vector< const DataArrayDouble *> MEDCouplingTwoTimeSteps::getArraysForTime(double time) const
 {
-   if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
+  if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
     {
       std::vector< const DataArrayDouble *> ret(2);
       ret[0]=_array;