]> SALOME platform Git repositories - modules/med.git/blob - src/MEDCalculator/MEDCalculatorBrowserField.hxx
Salome HOME
819497b32485251d6a5a815cd8dc2dac58097dfb
[modules/med.git] / src / MEDCalculator / MEDCalculatorBrowserField.hxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef __MEDCALCULATORBROWSERFIELD_HXX__
21 #define __MEDCALCULATORBROWSERFIELD_HXX__
22
23 #include "MedCalculatorDefines.hxx"
24 #include "MEDCalculatorBrowserStep.hxx"
25
26 #include "InterpKernelException.hxx"
27 #include "MEDCouplingRefCountObject.hxx"
28
29 #include <string>
30 #include <vector>
31
32 //  This class correspond to a MED field of a file
33 //  It contains the field name, the components, the time steps and selection methods
34 //  It's used to select a field, it's components and time steps
35 namespace ParaMEDMEM
36 {
37   class MEDCalculatorBrowserStep;//  top prevent cross include
38   class MEDCALCULATOR_EXPORT MEDCalculatorBrowserField
39   {
40   public :
41     MEDCalculatorBrowserField(const char* nm);
42     ~MEDCalculatorBrowserField();
43     MEDCalculatorBrowserField(const char *fname, const char *fieldName);
44     bool operator==(const std::string&);//  Equal to string operator, to test if fieldname of this field is the same as input argument
45     bool operator==(bool);//  Equal to bool operator, to use with std::find on std::vector<CalculatorBrowserField> to find selected fields
46     std::string str();//  Return a std::string corresponding to x/o (selected or not) Field fieldname \n steps
47     void selectStep(int);//  Select a specific time step according to its id
48     void selectAllSteps();//  Select all time steps
49     void unselectStep(int);//  Unselect a specific time step according to its id
50     void unselectAllSteps();// Unselect all time steps
51     void selectComponent(int);//  Select a specific component according to its id
52     void selectAllComponents();//  Select all components
53     void unselectComponent(int);//  Unselect a specific component according to its id
54     void unselectAllComponents();// Unselect all components
55     bool isSelected();//  Return if this field is selected or not, i.e. selection flag to true or false
56     const std::string& getFileName() const { return _file_name; }
57     TypeOfField getType() const { return _type; }
58     const std::string& getName() const;//  Return fieldname
59     const std::vector<MEDCalculatorBrowserStep>& getSteps() const;//  Return a copy of the steps vector
60     void setSteps(const std::vector<MEDCalculatorBrowserStep>& steps);
61     const std::vector<std::string>& getComponents() const;//  Return the components vector
62     const std::vector<bool>& getSelectedComponents() const;//  Return the selected components vector
63     const double& getTimeValue(int) const;//  Return the time value of the time step with id equal to input
64     unsigned int getStepsSize() const;//  Return the number of time steps
65     unsigned int getComponentsSize() const;//  Return the number of components
66     void addStep(int,double);//  Add a time step to steps vector with (id, time value)
67     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
68     const std::string& getCorrespondingMeshFromStep(int) const;//  Return a std::string which contains the mesh name used by the time steps (id) as supporting meshes
69     void setComponentName(int,const std::string&);//  Change the name of a component
70     bool isAnySelection() const;
71     void setMeshName(const std::string& m);
72     MEDCalculatorBrowserField getSelectedTimeSteps() const throw(INTERP_KERNEL::Exception);
73   private:
74     std::string _name;// field name
75     std::string _file_name;// file name
76     TypeOfField _type;
77     std::vector<MEDCalculatorBrowserStep> _steps;// liste of time steps
78     std::vector<std::string> _components;//  list of components
79     std::vector<bool> _selected_components;//  list of selected components, by default, all
80     bool _selection;//  select flag
81     std::vector<std::string> _corresponding_meshes;//  vector containing all the meshes name used by time steps as support
82   };
83 }
84
85 #endif