1 // Copyright (C) 2020-2021 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
28 #include "MEDLoaderForPV.h"
30 class MEDLOADERFORPV_EXPORT ExtractGroupStatus
33 ExtractGroupStatus():_status(false) { }
34 ExtractGroupStatus(const char *name);
35 bool getStatus() const { return _status; }
36 void setStatus(bool status) const { _status=status; }
37 void cpyStatusFrom(const ExtractGroupStatus& other) { _status=other._status; }
38 std::string getName() const { return _name; }
39 void resetStatus() const { _status=false; }
40 const char *getKeyOfEntry() const { return _ze_key_name.c_str(); }
41 virtual void printMySelf(std::ostream& os) const;
42 virtual bool isSameAs(const ExtractGroupStatus& other) const;
46 std::string _ze_key_name;
49 class MEDLOADERFORPV_EXPORT ExtractGroupGrp : public ExtractGroupStatus
52 ExtractGroupGrp(const char *name):ExtractGroupStatus(name) { std::ostringstream oss; oss << START << name; _ze_key_name=oss.str(); }
53 void setFamilies(const std::vector<std::string>& fams) { _fams=fams; }
54 const std::vector<std::string>& getFamiliesLyingOn() const { return _fams; }
55 bool isSameAs(const ExtractGroupGrp& other) const;
57 static const char START[];
58 std::vector<std::string> _fams;
61 class MEDLOADERFORPV_EXPORT ExtractGroupFam : public ExtractGroupStatus
64 ExtractGroupFam(const char *name);
65 void printMySelf(std::ostream& os) const;
66 void fillIdsToKeep(std::set<int>& s) const;
67 int getId() const { return _id; }
68 bool isSameAs(const ExtractGroupFam& other) const;
70 static const char START[];
75 class vtkInformationDataObjectMetaDataKey;
76 class vtkMutableDirectedGraph;
79 class MEDLOADERFORPV_EXPORT ExtractGroupInternal
82 void loadFrom(vtkMutableDirectedGraph *sil);
83 int getNumberOfEntries() const;
84 const char *getMeshName() const;
85 const char *getKeyOfEntry(int i) const;
86 bool getStatusOfEntryStr(const char *entry) const;
87 void setStatusOfEntryStr(const char *entry, bool status);
88 void printMySelf(std::ostream& os) const;
89 std::set<int> getIdsToKeep() const;
90 std::vector< std::pair<std::string,std::vector<int> > > getAllGroups() const;
91 void clearSelection() const;
92 int getIdOfFamily(const std::string& famName) const;
93 static bool IndependantIsInformationOK(vtkInformationDataObjectMetaDataKey *medReaderMetaData, vtkInformation *info);
95 std::map<std::string,int> computeFamStrIdMap() const;
96 const ExtractGroupStatus& getEntry(const char *entry) const;
97 ExtractGroupStatus& getEntry(const char *entry);
99 std::vector<ExtractGroupGrp> _groups;
100 std::vector<ExtractGroupFam> _fams;
101 mutable std::vector< std::pair<std::string,bool> > _selection;
102 std::string _mesh_name;