Back to index

salome-med  6.5.0
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
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 or email :
00018 //
00023 #include "MedCalculatorDefines.hxx"
00024 #include "MEDCalculatorBrowserMesh.hxx"
00025 #include "MEDCalculatorBrowserField.hxx"
00027 #include <string>
00028 #include <vector>
00030 //  This class correspond to a MED File
00031 //  It contains fields and meshes from a file
00032 //  It also has methods for selecting/unselecting meshes, field and components from fields
00033 namespace ParaMEDMEM
00034 {
00035   class MEDCALCULATOR_EXPORT MEDCalculatorBrowserLiteStruct
00036   {
00037   public :
00038     MEDCalculatorBrowserLiteStruct();
00039     ~MEDCalculatorBrowserLiteStruct();
00040     MEDCalculatorBrowserLiteStruct(const char *);//  Constructor with a complet file name (with path) and simplified file name as parameters
00041     bool operator==(const std::string&);//  Equal to string operator, compare simplified name to input
00042     std::string str();//  Return a std::string corresponding to x/o (selected or not) File filename \n meshes \n fields
00043     void setSelected(bool);//  Set selection to input bool
00044     void selectAll();//  Select all meshes and fields
00045     void selectAllMeshes();//  Select all meshes
00046     void selectAllFields();//  Select all fields
00047     void unselectAll();//  Unselect all meshes and fields
00048     void unselectAllMeshes();//  Unselect all meshes
00049     void unselectAllFields();//  Unselect all fields
00050     bool isSelection();//  Return if there is selection or not (selection flag)
00051     const std::string& getName() const;//  Return file simplified name
00052     const std::string& getFile() const;//  Return full file name
00053     unsigned int getNumberOfMeshes();//  Return number of meshes
00054     unsigned int getNumberOfFields();//  Return number of fields
00055     const std::string& getMeshName(int) const;//  Return a mesh name according to its id
00056     const std::string& getFieldName(int) const;//  Return a field name according to its id
00057     MEDCalculatorBrowserField& getField(int);//  Return a reference on a field according to its id
00058     const MEDCalculatorBrowserField& getField(int) const;
00059     MEDCalculatorBrowserField& getField(const std::string&);//  Return a reference on a field according to its name
00060     MEDCalculatorBrowserMesh& getMesh(int);//  Return a reference on a mesh according to its id
00061     MEDCalculatorBrowserMesh& getMesh(const std::string&);//  Return a reference on a mesh according to its name
00062     void selectMesh(const std::string&);//  Select a specific mesh according to its name
00063     void selectField(const std::string&);//  Select a specific field according to its name
00064     void unselectMesh(const std::string&);//  Unselect a specific mesh according to its name
00065     void unselectField(const std::string&);//  Unselect a specific field according to its name
00066     std::vector<std::string> getCorrespondingMeshesFromField(int);//  Return a list of meshes names supporting time steps of a field
00067     std::vector<std::string> getCorrespondingMeshesFromLS();//  Return a list of meshes supporting all fields of this file
00068   private:
00069     void computeBaseName();
00070   private :
00071     std::string _name;//  simplified file name
00072     std::string _file;//  full path file name
00073     std::vector<MEDCalculatorBrowserMesh> _meshes;//  list of all meshes from this file
00074     std::vector<MEDCalculatorBrowserField> _fields;//  list of all fields from this file
00075     bool _any_selection;//  selection flag
00076   };
00077 }
00079 #endif