Salome HOME
Update copyright
[modules/smesh.git] / src / StdMeshers / StdMeshers_ImportSource.hxx
1 // Copyright (C) 2007-2011  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.
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 : webmaster.salome@opencascade.com
21 //
22
23 //  SMESH StdMeshers : implementaion 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
41 //==============================================================================
42 /*!
43  * \brief Stores groups to import elements from
44  */
45 //==============================================================================
46
47 class STDMESHERS_EXPORT StdMeshers_ImportSource1D : public SMESH_Hypothesis
48 {
49  public:
50   StdMeshers_ImportSource1D(int hypId, int studyId, SMESH_Gen * gen);
51   virtual ~ StdMeshers_ImportSource1D();
52
53   void SetGroups(const std::vector<SMESH_Group*>& groups);
54   const std::vector<SMESH_Group*>& GetGroups() const;
55
56   void SetCopySourceMesh(bool toCopyMesh, bool toCopyGroups);
57   void GetCopySourceMesh(bool& toCopyMesh, bool& toCopyGroups) const;
58   
59   virtual std::ostream & SaveTo(std::ostream & save);
60   virtual std::istream & LoadFrom(std::istream & load);
61   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
62   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
63   void RestoreGroups(const std::vector<SMESH_Group*>& groups);
64
65   void StoreResultGroups(const std::vector<SMESH_Group*>& groups,
66                          const SMESHDS_Mesh&              srcMesh,
67                          const SMESHDS_Mesh&              tgtMesh);
68   std::vector<SMESH_Group*>* GetResultGroups(const SMESHDS_Mesh& srcMesh,
69                                              const SMESHDS_Mesh& tgtMesh);
70
71   std::vector<SMESH_Mesh*> GetSourceMeshes() const;
72
73 private:
74
75   std::vector<SMESH_Group*> _groups;
76   bool _toCopyMesh, _toCopyGroups;
77
78   // groups imported using this hypothesis
79   typedef std::map< std::pair<int, int>, std::vector<SMESH_Group*> > TResGroupMap;
80   TResGroupMap      _resultGroups;
81   std::vector<int>  _resultGroupsStorage; // persistent representation of _resultGroups
82
83   void resultGroupsToIntVec();
84 };
85
86 //==============================================================================
87 /*!
88  * \brief Redefines name and dimension of inherited StdMeshers_ImportSource1D
89  */
90 //==============================================================================
91
92 class STDMESHERS_EXPORT StdMeshers_ImportSource2D : public StdMeshers_ImportSource1D
93 {
94  public:
95   StdMeshers_ImportSource2D(int hypId, int studyId, SMESH_Gen * gen);
96 };
97 #endif