1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : StdMeshers_Adaptive1D_i.cxx
26 #include "StdMeshers_Adaptive1D_i.hxx"
27 #include "SMESH_Gen_i.hxx"
28 #include "SMESH_Gen.hxx"
29 #include "SMESH_PythonDump.hxx"
31 #include "StdMeshers_Adaptive1D.hxx"
33 #include "Utils_CorbaException.hxx"
34 #include "utilities.h"
36 //=======================================================================
37 //function : StdMeshers_Adaptive1D_i
38 //purpose : Constructor
39 //=======================================================================
41 StdMeshers_Adaptive1D_i::StdMeshers_Adaptive1D_i( PortableServer::POA_ptr thePOA,
43 ::SMESH_Gen* theGenImpl )
44 : SALOME::GenericObj_i( thePOA ),
45 SMESH_Hypothesis_i( thePOA )
47 myBaseImpl = new ::StdMeshers_Adaptive1D( theGenImpl->GetANewId(),
52 //=======================================================================
53 //function : ~StdMeshers_Adaptive1D_i
54 //purpose : Destructor
55 //=======================================================================
57 StdMeshers_Adaptive1D_i::~StdMeshers_Adaptive1D_i()
61 //=======================================================================
62 //function : SetMinSize
63 //purpose : Sets minimal allowed segment length
64 //=======================================================================
66 void StdMeshers_Adaptive1D_i::SetMinSize( CORBA::Double minSegLen )
67 throw (SALOME::SALOME_Exception)
71 this->GetImpl()->SetMinSize( minSegLen );
73 catch ( SALOME_Exception& S_ex ) {
74 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
77 // Update Python script
78 SMESH::TPythonDump() << _this() << ".SetMinSize( " << SMESH::TVar(minSegLen) << " )";
81 //=======================================================================
82 //function : GetMinSize
83 //purpose : Returns minimal allowed segment length
84 //=======================================================================
86 CORBA::Double StdMeshers_Adaptive1D_i::GetMinSize()
89 return this->GetImpl()->GetMinSize();
92 //=======================================================================
93 //function : SetMaxSize
94 //purpose : Sets maximal allowed segment length
95 //=======================================================================
97 void StdMeshers_Adaptive1D_i::SetMaxSize( CORBA::Double maxSegLen )
98 throw (SALOME::SALOME_Exception)
100 ASSERT( myBaseImpl );
102 this->GetImpl()->SetMaxSize( maxSegLen );
104 catch ( SALOME_Exception& S_ex ) {
105 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
108 // Update Python script
109 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << SMESH::TVar(maxSegLen) << " )";
112 //=======================================================================
113 //function : GetMaxSize
114 //purpose : Returns maximal allowed segment length
115 //=======================================================================
117 CORBA::Double StdMeshers_Adaptive1D_i::GetMaxSize()
119 ASSERT( myBaseImpl );
120 return this->GetImpl()->GetMaxSize();
123 //=======================================================================
124 //function : SetDeflection
125 //purpose : Sets a maximal allowed distance between a segment and an edge.
126 //=======================================================================
128 void StdMeshers_Adaptive1D_i::SetDeflection( CORBA::Double theValue )
129 throw ( SALOME::SALOME_Exception )
131 ASSERT( myBaseImpl );
133 this->GetImpl()->SetDeflection( theValue );
135 catch ( SALOME_Exception& S_ex ) {
136 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
139 // Update Python script
140 SMESH::TPythonDump() << _this() << ".SetDeflection( " << SMESH::TVar(theValue) << " )";
143 //=======================================================================
144 //function : GetDeflection
145 //purpose : Returns deflection
146 //=======================================================================
148 CORBA::Double StdMeshers_Adaptive1D_i::GetDeflection()
150 ASSERT( myBaseImpl );
151 return this->GetImpl()->GetDeflection();
154 //=======================================================================
156 //purpose : Get implementation
157 //=======================================================================
159 ::StdMeshers_Adaptive1D* StdMeshers_Adaptive1D_i::GetImpl()
161 return ( ::StdMeshers_Adaptive1D* )myBaseImpl;
164 //=======================================================================
165 //function : IsDimSupported
166 //purpose : Verify whether hypothesis supports given entity type
167 //=======================================================================
169 CORBA::Boolean StdMeshers_Adaptive1D_i::IsDimSupported( SMESH::Dimension type )
171 return type == SMESH::DIM_1D;