]> SALOME platform Git repositories - plugins/netgenplugin.git/blob - src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.cxx
Salome HOME
Merge from V5_1_4_BR 07/05/2010
[plugins/netgenplugin.git] / src / NETGENPlugin / NETGENPlugin_SimpleHypothesis_2D_i.cxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
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 //  NETGENPlugin : C++ implementation
21 // File      : NETGENPlugin_SimpleHypothesis_2D_i.cxx
22 // Author    : Edward AGAPOV
23 // Project   : SALOME
24 //=============================================================================
25 //
26 #include "NETGENPlugin_SimpleHypothesis_2D_i.hxx"
27 #include "NETGENPlugin_SimpleHypothesis_2D.hxx"
28
29 #include <SMESH_Gen.hxx>
30 #include <SMESH_PythonDump.hxx>
31
32 #include <Utils_CorbaException.hxx>
33 #include <utilities.h>
34
35 using namespace std;
36
37 //=============================================================================
38 /*!
39  *  NETGENPlugin_SimpleHypothesis_2D_i::NETGENPlugin_SimpleHypothesis_2D_i
40  *
41  *  Constructor
42  */
43 //=============================================================================
44 NETGENPlugin_SimpleHypothesis_2D_i::
45 NETGENPlugin_SimpleHypothesis_2D_i (PortableServer::POA_ptr thePOA,
46                                     int                     theStudyId,
47                                     ::SMESH_Gen*            theGenImpl)
48   : SALOME::GenericObj_i( thePOA ),
49     SMESH_Hypothesis_i( thePOA )
50 {
51   MESSAGE( "NETGENPlugin_SimpleHypothesis_2D_i::NETGENPlugin_SimpleHypothesis_2D_i" );
52   myBaseImpl = new ::NETGENPlugin_SimpleHypothesis_2D (theGenImpl->GetANewId(),
53                                                        theStudyId,
54                                                        theGenImpl);
55 }
56
57 //=============================================================================
58 /*!
59  *  NETGENPlugin_SimpleHypothesis_2D_i::~NETGENPlugin_SimpleHypothesis_2D_i
60  *
61  *  Destructor
62  */
63 //=============================================================================
64 NETGENPlugin_SimpleHypothesis_2D_i::~NETGENPlugin_SimpleHypothesis_2D_i()
65 {
66   MESSAGE( "NETGENPlugin_SimpleHypothesis_2D_i::~NETGENPlugin_SimpleHypothesis_2D_i" );
67 }
68
69 //=============================================================================
70 /*!
71  *  NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments
72  */
73 //=============================================================================
74 void NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments(CORBA::Short nb)
75   throw ( SALOME::SALOME_Exception )
76 {
77   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments");
78   ASSERT(myBaseImpl);
79   try {
80     this->GetImpl()->SetNumberOfSegments(nb);
81   }
82   catch (SALOME_Exception& S_ex) {
83     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
84   }
85   SMESH::TPythonDump() << _this() << ".SetNumberOfSegments( " << nb << " )";
86 }
87
88 //=============================================================================
89 /*!
90  *  NETGENPlugin_SimpleHypothesis_2D_i::GetNumberOfSegments()
91  */
92 //=============================================================================
93 CORBA::Short NETGENPlugin_SimpleHypothesis_2D_i::GetNumberOfSegments()
94 {
95   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::GetNumberOfSegments");
96   ASSERT(myBaseImpl);
97   return this->GetImpl()->GetNumberOfSegments();
98 }
99
100 //================================================================================
101 /*!
102  * LocalLength()
103  */
104 //================================================================================
105
106 void NETGENPlugin_SimpleHypothesis_2D_i::SetLocalLength(CORBA::Double segmentLength)
107 {
108   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::SetLocalLength");
109   ASSERT(myBaseImpl);
110   try {
111     this->GetImpl()->SetLocalLength(segmentLength);
112   }
113   catch (SALOME_Exception& S_ex) {
114     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
115   }
116   SMESH::TPythonDump() << _this() << ".SetLocalLength( " << segmentLength << " )";
117 }
118
119 //================================================================================
120 /*!
121  * GetLocalLength()
122  */
123 //================================================================================
124
125 CORBA::Double NETGENPlugin_SimpleHypothesis_2D_i::GetLocalLength()
126 {
127   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::GetLocalLength");
128   ASSERT(myBaseImpl);
129   return this->GetImpl()->GetLocalLength();
130 }
131
132 //=============================================================================
133 /*!
134  *  NETGENPlugin_SimpleHypothesis_2D_i::LengthFromEdges()
135  */
136 //=============================================================================
137 void NETGENPlugin_SimpleHypothesis_2D_i::LengthFromEdges()
138 {
139   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::LengthFromEdges");
140   ASSERT(myBaseImpl);
141   this->GetImpl()->LengthFromEdges();
142   SMESH::TPythonDump() << _this() << ".LengthFromEdges()";
143 }
144
145 //=============================================================================
146 /*!
147  *  NETGENPlugin_SimpleHypothesis_2D_i::SetMaxElementArea()
148  */
149 //=============================================================================
150 void NETGENPlugin_SimpleHypothesis_2D_i::SetMaxElementArea(CORBA::Double area)
151 {
152   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::SetMaxElementArea");
153   ASSERT(myBaseImpl);
154   this->GetImpl()->SetMaxElementArea(area);
155   SMESH::TPythonDump() << _this() << ".SetMaxElementArea( " << area << " )";
156 }
157
158
159 //=============================================================================
160 /*!
161  *  NETGENPlugin_SimpleHypothesis_2D_i::GetMaxElementArea()
162  */
163 //=============================================================================
164 CORBA::Double NETGENPlugin_SimpleHypothesis_2D_i::GetMaxElementArea()
165 {
166   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::GetMaxElementArea");
167   ASSERT(myBaseImpl);
168   return this->GetImpl()->GetMaxElementArea();
169 }
170 //=============================================================================
171 /*!
172  *  NETGENPlugin_SimpleHypothesis_2D_i::GetImpl
173  */
174 //=============================================================================
175 ::NETGENPlugin_SimpleHypothesis_2D* NETGENPlugin_SimpleHypothesis_2D_i::GetImpl()
176 {
177   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::GetImpl");
178   return (::NETGENPlugin_SimpleHypothesis_2D*)myBaseImpl;
179 }
180
181 //================================================================================
182 /*!
183  * \brief Verify whether hypothesis supports given entity type 
184   * \param type - dimension (see SMESH::Dimension enumeration)
185   * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
186  * 
187  * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
188  */
189 //================================================================================  
190 CORBA::Boolean NETGENPlugin_SimpleHypothesis_2D_i::IsDimSupported( SMESH::Dimension type )
191 {
192   return type == SMESH::DIM_2D;
193 }