Salome HOME
Merge remote branch 'origin/V8_5_asterstudy'
[modules/smesh.git] / src / StdMeshers_I / StdMeshers_Adaptive1D_i.cxx
1 // Copyright (C) 2007-2016  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 : webmaster.salome@opencascade.com
21 //
22 //  File   : StdMeshers_Adaptive1D_i.cxx
23 //  Module : SMESH
24 //
25
26 #include "StdMeshers_Adaptive1D_i.hxx"
27 #include "SMESH_Gen_i.hxx"
28 #include "SMESH_Gen.hxx"
29 #include "SMESH_PythonDump.hxx"
30
31 #include "StdMeshers_Adaptive1D.hxx"
32
33 #include "Utils_CorbaException.hxx"
34 #include "utilities.h"
35
36 //=======================================================================
37 //function : StdMeshers_Adaptive1D_i
38 //purpose  : Constructor
39 //=======================================================================
40
41 StdMeshers_Adaptive1D_i::StdMeshers_Adaptive1D_i( PortableServer::POA_ptr thePOA,
42                                                   ::SMESH_Gen*            theGenImpl )
43   : SALOME::GenericObj_i( thePOA ), 
44     SMESH_Hypothesis_i( thePOA )
45 {
46   myBaseImpl = new ::StdMeshers_Adaptive1D( theGenImpl->GetANewId(),
47                                             theGenImpl );
48 }
49
50 //=======================================================================
51 //function : ~StdMeshers_Adaptive1D_i
52 //purpose  : Destructor
53 //=======================================================================
54
55 StdMeshers_Adaptive1D_i::~StdMeshers_Adaptive1D_i()
56 {
57 }
58
59 //=======================================================================
60 //function : SetMinSize
61 //purpose  : Sets minimal allowed segment length
62 //=======================================================================
63
64 void StdMeshers_Adaptive1D_i::SetMinSize( CORBA::Double minSegLen )
65   throw (SALOME::SALOME_Exception)
66 {
67   ASSERT( myBaseImpl );
68   try {
69     this->GetImpl()->SetMinSize( minSegLen );
70   }
71   catch ( SALOME_Exception& S_ex ) {
72     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
73   }
74
75   // Update Python script
76   SMESH::TPythonDump() << _this() << ".SetMinSize( " << SMESH::TVar(minSegLen) << " )";
77 }
78
79 //=======================================================================
80 //function : GetMinSize
81 //purpose  : Returns minimal allowed segment length
82 //=======================================================================
83
84 CORBA::Double StdMeshers_Adaptive1D_i::GetMinSize()
85 {
86   ASSERT( myBaseImpl );
87   return this->GetImpl()->GetMinSize();
88 }
89
90 //=======================================================================
91 //function : SetMaxSize
92 //purpose  : Sets maximal allowed segment length
93 //=======================================================================
94
95 void StdMeshers_Adaptive1D_i::SetMaxSize( CORBA::Double maxSegLen )
96   throw (SALOME::SALOME_Exception)
97 {
98   ASSERT( myBaseImpl );
99   try {
100     this->GetImpl()->SetMaxSize( maxSegLen );
101   }
102   catch ( SALOME_Exception& S_ex ) {
103     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
104   }
105
106   // Update Python script
107   SMESH::TPythonDump() << _this() << ".SetMaxSize( " << SMESH::TVar(maxSegLen) << " )";
108 }
109
110 //=======================================================================
111 //function : GetMaxSize
112 //purpose  : Returns maximal allowed segment length
113 //=======================================================================
114
115 CORBA::Double StdMeshers_Adaptive1D_i::GetMaxSize()
116 {
117   ASSERT( myBaseImpl );
118   return this->GetImpl()->GetMaxSize();
119 }
120
121 //=======================================================================
122 //function : SetDeflection
123 //purpose  : Sets a maximal allowed distance between a segment and an edge.
124 //=======================================================================
125
126 void StdMeshers_Adaptive1D_i::SetDeflection( CORBA::Double theValue )
127   throw ( SALOME::SALOME_Exception )
128 {
129   ASSERT( myBaseImpl );
130   try {
131     this->GetImpl()->SetDeflection( theValue );
132   }
133   catch ( SALOME_Exception& S_ex ) {
134     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
135   }
136
137   // Update Python script
138   SMESH::TPythonDump() << _this() << ".SetDeflection( " << SMESH::TVar(theValue) << " )";
139 }
140
141 //=======================================================================
142 //function : GetDeflection
143 //purpose  : Returns deflection
144 //=======================================================================
145
146 CORBA::Double StdMeshers_Adaptive1D_i::GetDeflection()
147 {
148   ASSERT( myBaseImpl );
149   return this->GetImpl()->GetDeflection();
150 }
151
152 //=======================================================================
153 //function : GetImpl
154 //purpose  : Get implementation
155 //=======================================================================
156
157 ::StdMeshers_Adaptive1D* StdMeshers_Adaptive1D_i::GetImpl()
158 {
159   return ( ::StdMeshers_Adaptive1D* )myBaseImpl;
160 }
161
162 //=======================================================================
163 //function : IsDimSupported
164 //purpose  : Verify whether hypothesis supports given entity type
165 //=======================================================================
166
167 CORBA::Boolean StdMeshers_Adaptive1D_i::IsDimSupported( SMESH::Dimension type )
168 {
169   return type == SMESH::DIM_1D;
170 }