Version: 6.3.1

src/MEDCalculator/MEDCalculatorBrowserField.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  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 #ifndef __MEDCALCULATORBROWSERFIELD_HXX__
00021 #define __MEDCALCULATORBROWSERFIELD_HXX__
00022 
00023 #include "MEDCalculatorBrowserStep.hxx"
00024 
00025 #include "InterpKernelException.hxx"
00026 #include "MEDCouplingRefCountObject.hxx"
00027 
00028 #include <string>
00029 #include <vector>
00030 
00031 //  This class correspond to a MED field of a file
00032 //  It contains the field name, the components, the time steps and selection methods
00033 //  It's used to select a field, it's components and time steps
00034 namespace ParaMEDMEM
00035 {
00036   class MEDCalculatorBrowserStep;//  top prevent cross include
00037   class MEDCalculatorBrowserField
00038   {
00039   public :
00040     MEDCalculatorBrowserField(const char* nm);
00041     ~MEDCalculatorBrowserField();
00042     MEDCalculatorBrowserField(const char *fname, const char *fieldName);
00043     bool operator==(const std::string&);//  Equal to string operator, to test if fieldname of this field is the same as input argument
00044     bool operator==(bool);//  Equal to bool operator, to use with std::find on std::vector<CalculatorBrowserField> to find selected fields
00045     std::string str();//  Return a std::string corresponding to x/o (selected or not) Field fieldname \n steps
00046     void selectStep(int);//  Select a specific time step according to its id
00047     void selectAllSteps();//  Select all time steps
00048     void unselectStep(int);//  Unselect a specific time step according to its id
00049     void unselectAllSteps();// Unselect all time steps
00050     void selectComponent(int);//  Select a specific component according to its id
00051     void selectAllComponents();//  Select all components
00052     void unselectComponent(int);//  Unselect a specific component according to its id
00053     void unselectAllComponents();// Unselect all components
00054     bool isSelected();//  Return if this field is selected or not, i.e. selection flag to true or false
00055     const std::string& getFileName() const { return _file_name; }
00056     TypeOfField getType() const { return _type; }
00057     const std::string& getName() const;//  Return fieldname
00058     const std::vector<MEDCalculatorBrowserStep>& getSteps() const;//  Return a copy of the steps vector
00059     void setSteps(const std::vector<MEDCalculatorBrowserStep>& steps);
00060     const std::vector<std::string>& getComponents() const;//  Return the components vector
00061     const std::vector<bool>& getSelectedComponents() const;//  Return the selected components vector
00062     const double& getTimeValue(int) const;//  Return the time value of the time step with id equal to input
00063     unsigned int getStepsSize() const;//  Return the number of time steps
00064     unsigned int getComponentsSize() const;//  Return the number of components
00065     void addStep(int,double);//  Add a time step to steps vector with (id, time value)
00066     const std::vector<std::string>& getCorrespondingMeshesFromField() const;//  Return a std::vector of std::string which contains all the meshes name used by all the time steps as supporting meshes
00067     const std::string& getCorrespondingMeshFromStep(int) const;//  Return a std::string which contains the mesh name used by the time steps (id) as supporting meshes
00068     void setComponentName(int,const std::string&);//  Change the name of a component
00069     bool isAnySelection() const;
00070     void setMeshName(const std::string& m);
00071     MEDCalculatorBrowserField getSelectedTimeSteps() const throw(INTERP_KERNEL::Exception);
00072   private:
00073     std::string _name;// field name
00074     std::string _file_name;// file name
00075     TypeOfField _type;
00076     std::vector<MEDCalculatorBrowserStep> _steps;// liste of time steps
00077     std::vector<std::string> _components;//  list of components
00078     std::vector<bool> _selected_components;//  list of selected components, by default, all
00079     bool _selection;//  select flag
00080     std::vector<std::string> _corresponding_meshes;//  vector containing all the meshes name used by time steps as support
00081   };
00082 }
00083 
00084 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS