Debian Codegraph @

src/3rdParty/salomesmesh/inc/StdMeshers_ImportSource.hxx

raw
1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : [email protected]
21 //
22
23 // SMESH StdMeshers : implementation of SMESH idl descriptions
24 // File : StdMeshers_ImportSource1D.hxx
25 // Module : SMESH
26 //
27 #ifndef _StdMeshers_ImportSource_HXX_
28 #define _StdMeshers_ImportSource_HXX_
29
30 #include "SMESH_StdMeshers.hxx"
31
32 #include "SMESH_Hypothesis.hxx"
33 #include "Utils_SALOME_Exception.hxx"
34
35 #include <vector>
36 #include <map>
37
38 class SMESH_Group;
39 class SMESHDS_Mesh;
40 class SMESH_subMesh;
41
42 //==============================================================================
43 /*!
44 * \brief Stores groups to import elements from
45 */
46 //==============================================================================
47
48 class STDMESHERS_EXPORT StdMeshers_ImportSource1D : public SMESH_Hypothesis
49 {
50 public:
51 StdMeshers_ImportSource1D(int hypId, int studyId, SMESH_Gen * gen);
52 virtual ~ StdMeshers_ImportSource1D();
53
54 void SetGroups(const std::vector<SMESH_Group*>& groups);
55 const std::vector<SMESH_Group*>& GetGroups(bool loaded=false) const;
56
57 void SetCopySourceMesh(bool toCopyMesh, bool toCopyGroups);
58 void GetCopySourceMesh(bool& toCopyMesh, bool& toCopyGroups) const;
59
60 virtual std::ostream & SaveTo(std::ostream & save);
61 virtual std::istream & LoadFrom(std::istream & load);
62 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
63 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
64 virtual bool DataDependOnParams() const { return true; }
65 void RestoreGroups(const std::vector<SMESH_Group*>& groups);
66
67 void StoreResultGroups(const std::vector<SMESH_Group*>& groups,
68 const SMESHDS_Mesh& srcMesh,
69 const SMESHDS_Mesh& tgtMesh);
70 std::vector<SMESH_Group*>* GetResultGroups(const SMESHDS_Mesh& srcMesh,
71 const SMESHDS_Mesh& tgtMesh);
72
73 std::vector<SMESH_Mesh*> GetSourceMeshes() const;
74 std::vector<SMESH_subMesh*> GetSourceSubMeshes(const SMESH_Mesh* srcMesh) const;
75
76 private:
77
78 std::vector<SMESH_Group*> _groups;
79 bool _toCopyMesh, _toCopyGroups;
80
81 // groups imported using this hypothesis
82 typedef std::map< std::pair<int, int>, std::vector<SMESH_Group*> > TResGroupMap;
83 TResGroupMap _resultGroups;
84 std::vector<int> _resultGroupsStorage; // persistent representation of _resultGroups
85
86 void resultGroupsToIntVec();
87 };
88
89 //==============================================================================
90 /*!
91 * \brief Redefines name and dimension of inherited StdMeshers_ImportSource1D
92 */
93 //==============================================================================
94
95 class STDMESHERS_EXPORT StdMeshers_ImportSource2D : public StdMeshers_ImportSource1D
96 {
97 public:
98 StdMeshers_ImportSource2D(int hypId, int studyId, SMESH_Gen * gen);
99 };
100 #endif