Back to index

salome-med  6.5.0
MEDCalculatorBrowserStep.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #include "MEDCalculatorBrowserStep.hxx"
00021 
00022 #include <sstream>
00023 
00024 using namespace ParaMEDMEM;
00025 
00026 MEDCalculatorBrowserStep::~MEDCalculatorBrowserStep()
00027 {
00028 }
00029 
00030 //  Equal to int operator
00031 //  Used to compare the time step id with input argument.
00032 //  Return if equal or not.
00033 bool MEDCalculatorBrowserStep::operator==(int ts)
00034 {
00035   return _time_step==ts;
00036 }
00037 
00038 //  Equal to int operator
00039 //  Used to compare the time step id with input argument.
00040 //  Return if equal or not.
00041 bool MEDCalculatorBrowserStep::operator==(int ts) const
00042 {
00043   return _time_step==ts;
00044 }
00045 
00046 //  Equal to bool operator
00047 //  To test if this time step is selected or not comparing to a boolean
00048 //  Return if it has the same statement or not.
00049 bool MEDCalculatorBrowserStep::operator==(bool sel)
00050 {
00051   return sel==_selection;
00052 }
00053 
00054 //  str method
00055 //  Construct a std::string to print this time step, using std::cout for example
00056 //  Put x or o for selected or not
00057 //  Add time step id value ( tiem value )
00058 //  Return a std::string
00059 std::string MEDCalculatorBrowserStep::str()
00060 {
00061   std::ostringstream res;
00062   _selection?res<<"x ":res<<"o ";
00063   res << _time_step << "," << _order;
00064   res << " (";
00065   res << _time_value;
00066   res << ")";
00067   return res.str();
00068 }
00069 
00070 //  Select this time step setting selection flag to true
00071 void MEDCalculatorBrowserStep::select()
00072 {
00073   _selection = true;
00074 }
00075 
00076 //  Unselect this time step setting selection flag to false
00077 void MEDCalculatorBrowserStep::unselect()
00078 {
00079   _selection = false;
00080 }
00081 
00082 //  Return if this time step is selected or not
00083 bool MEDCalculatorBrowserStep::isSelected()
00084 {
00085   return _selection;
00086 }
00087 
00088 //  Return the timestep id
00089 int MEDCalculatorBrowserStep::getTimeStep() const
00090 {
00091   return _time_step;
00092 }
00093 
00094 //  Return the time value
00095 const double& MEDCalculatorBrowserStep::getTimeValue() const
00096 {
00097   return _time_value;
00098 }
00099 
00100 //  Return the name of the support meshing
00101 const std::string& MEDCalculatorBrowserStep::getCorrespondingMeshFromStep() const
00102 {
00103   return _mesh;
00104 }