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