Salome HOME
d678c85e35f8097c32c31cb89eaede5b5bf9de8b
[modules/med.git] / src / MEDCalculator / MEDCalculatorBrowserLiteStruct.hxx
1 // Copyright (C) 2007-2019  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, or (at your option) any later version.
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 // Author : Anthony Geay (CEA/DEN)
20
21 #ifndef __MEDCALCULATORBROWSERLITESTRUCT_HXX__
22 #define __MEDCALCULATORBROWSERLITESTRUCT_HXX__
23
24 #include "MedCalculatorDefines.hxx"
25 #include "MEDCalculatorBrowserMesh.hxx"
26 #include "MEDCalculatorBrowserField.hxx"
27
28 #include <string>
29 #include <vector>
30
31 //  This class correspond to a MED File
32 //  It contains fields and meshes from a file
33 //  It also has methods for selecting/unselecting meshes, field and components from fields
34 namespace MEDCoupling
35 {
36   class MEDCALCULATOR_EXPORT MEDCalculatorBrowserLiteStruct
37   {
38   public :
39     MEDCalculatorBrowserLiteStruct();
40     ~MEDCalculatorBrowserLiteStruct();
41     MEDCalculatorBrowserLiteStruct(const char *);//  Constructor with a complete file name (with path) and simplified file name as parameters
42     bool operator==(const std::string&);//  Equal to string operator, compare simplified name to input
43     std::string str();//  Return a std::string corresponding to x/o (selected or not) File filename \n meshes \n fields
44     void setSelected(bool);//  Set selection to input bool
45     void selectAll();//  Select all meshes and fields
46     void selectAllMeshes();//  Select all meshes
47     void selectAllFields();//  Select all fields
48     void unselectAll();//  Unselect all meshes and fields
49     void unselectAllMeshes();//  Unselect all meshes
50     void unselectAllFields();//  Unselect all fields
51     bool isSelection();//  Return if there is selection or not (selection flag)
52     const std::string& getName() const;//  Return file simplified name
53     const std::string& getFile() const;//  Return full file name
54     unsigned int getNumberOfMeshes();//  Return number of meshes
55     unsigned int getNumberOfFields();//  Return number of fields
56     const std::string& getMeshName(int) const;//  Return a mesh name according to its id
57     const std::string& getFieldName(int) const;//  Return a field name according to its id
58     MEDCalculatorBrowserField& getField(int);//  Return a reference on a field according to its id
59     const MEDCalculatorBrowserField& getField(int) const;
60     MEDCalculatorBrowserField& getField(const std::string&);//  Return a reference on a field according to its name
61     MEDCalculatorBrowserMesh& getMesh(int);//  Return a reference on a mesh according to its id
62     MEDCalculatorBrowserMesh& getMesh(const std::string&);//  Return a reference on a mesh according to its name
63     void selectMesh(const std::string&);//  Select a specific mesh according to its name
64     void selectField(const std::string&);//  Select a specific field according to its name
65     void unselectMesh(const std::string&);//  Unselect a specific mesh according to its name
66     void unselectField(const std::string&);//  Unselect a specific field according to its name
67     std::vector<std::string> getCorrespondingMeshesFromField(int);//  Return a list of meshes names supporting time steps of a field
68     std::vector<std::string> getCorrespondingMeshesFromLS();//  Return a list of meshes supporting all fields of this file
69   private:
70     void computeBaseName();
71   private :
72     std::string _name;//  simplified file name
73     std::string _file;//  full path file name
74     std::vector<MEDCalculatorBrowserMesh> _meshes;//  list of all meshes from this file
75     std::vector<MEDCalculatorBrowserField> _fields;//  list of all fields from this file
76     bool _any_selection;//  selection flag
77   };
78 }
79
80 #endif