]> SALOME platform Git repositories - plugins/hexablockplugin.git/blob - src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis.cxx
Salome HOME
First publish of HEXABLOCKPLUGIN
[plugins/hexablockplugin.git] / src / HEXABLOCKPlugin / HEXABLOCKPlugin_Hypothesis.cxx
1 //  Copyright (C) 2004-2010  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //=============================================================================
21 // File      : HEXABLOCKPlugin_Hypothesis.cxx
22 // Created   : Wed Apr  2 12:36:29 2008
23 // Author    : Lioka RAZAFINDRAZAKA (CEA)
24 //=============================================================================
25 //
26 #include "HEXABLOCKPlugin_Hypothesis.hxx"
27
28 //=======================================================================
29 //function : HEXABLOCKPlugin_Hypothesis
30 //=======================================================================
31
32 HEXABLOCKPlugin_Hypothesis::HEXABLOCKPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen)
33   : SMESH_Hypothesis(hypId, studyId, gen),
34   _document(NULL),
35   _dimension(3)
36 {
37   _name = "HEXABLOCK_Parameters";
38   _param_algo_dim = 3;
39 }
40
41 //=======================================================================
42 //function : GetDocument
43 //=======================================================================
44
45 HEXA_NS::Document* HEXABLOCKPlugin_Hypothesis::GetDocument() const
46 {
47   return(_document);
48 }
49
50 //=======================================================================
51 //function : SetDocument
52 //=======================================================================
53
54 void HEXABLOCKPlugin_Hypothesis::SetDocument(HEXA_NS::Document* doc)
55 {
56   _document = doc;
57 }
58
59 //=======================================================================
60 //function : GetDimension
61 //=======================================================================
62
63 int HEXABLOCKPlugin_Hypothesis::GetDimension() const
64 {
65   return(_dimension);
66 }
67
68 //=======================================================================
69 //function : SetDimension
70 //=======================================================================
71
72 void HEXABLOCKPlugin_Hypothesis::SetDimension(int dim)
73 {
74   _dimension = dim;
75 }
76
77 //=======================================================================
78 //function : SaveTo
79 //=======================================================================
80
81 std::ostream & HEXABLOCKPlugin_Hypothesis::SaveTo(std::ostream & save)
82 {
83 //save << _document->getXML() << " ";
84   save <<_dimension           << " ";
85
86   return save;
87 }
88
89 //=======================================================================
90 //function : LoadFrom
91 //=======================================================================
92
93 std::istream & HEXABLOCKPlugin_Hypothesis::LoadFrom(std::istream & load)
94 {
95     bool isOK = true;
96     int i;
97
98 //     char* str;
99 //     isOK = (load >> str);
100 //     if (isOK)
101 //         _document = xml_2_doc(str);
102 //     else
103 //         load.clear(ios::badbit | load.rdstate());
104     
105     isOK = (load >> i);
106     if (isOK)
107         _dimension = i;
108     else
109         load.clear(ios::badbit | load.rdstate());
110     
111   return load;
112 }
113
114 //=======================================================================
115 //function : SetParametersByMesh
116 //=======================================================================
117
118 bool HEXABLOCKPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* ,const TopoDS_Shape&)
119 {
120   return false;
121 }
122
123
124 //================================================================================
125 /*!
126  * \brief Return false
127  */
128 //================================================================================
129
130 bool HEXABLOCKPlugin_Hypothesis::SetParametersByDefaults(const TDefaults&  /*dflts*/,
131                                                      const SMESH_Mesh* /*theMesh*/)
132 {
133   return false;
134 }