Version: 6.3.1

src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
00024 //  File   : StdMeshers_ViscousLayers_i.cxx
00025 //  Module : SMESH
00026 //
00027 #include "StdMeshers_ViscousLayers_i.hxx"
00028 
00029 #include "SMESH_Gen.hxx"
00030 #include "SMESH_Gen_i.hxx"
00031 #include "SMESH_PythonDump.hxx"
00032 //#include "StdMeshers_ObjRefUlils.hxx"
00033 
00034 #include "Utils_CorbaException.hxx"
00035 #include "utilities.h"
00036 
00037 #include <TCollection_AsciiString.hxx>
00038 
00039 #include CORBA_SERVER_HEADER(SMESH_Group)
00040 
00041 using namespace std;
00042 
00043 //=============================================================================
00049 //=============================================================================
00050 
00051 StdMeshers_ViscousLayers_i::StdMeshers_ViscousLayers_i( PortableServer::POA_ptr thePOA,
00052                                                         int                     theStudyId,
00053                                                         ::SMESH_Gen*            theGenImpl )
00054   : SALOME::GenericObj_i( thePOA ), 
00055     SMESH_Hypothesis_i( thePOA )
00056 {
00057   MESSAGE( "StdMeshers_ViscousLayers_i::StdMeshers_ViscousLayers_i" );
00058   myBaseImpl = new ::StdMeshers_ViscousLayers( theGenImpl->GetANewId(),
00059                                                theStudyId,
00060                                                theGenImpl );
00061 }
00062 
00063 //=============================================================================
00069 //=============================================================================
00070 
00071 StdMeshers_ViscousLayers_i::~StdMeshers_ViscousLayers_i()
00072 {
00073   MESSAGE( "StdMeshers_ViscousLayers_i::~StdMeshers_ViscousLayers_i" );
00074 }
00075 
00076 //================================================================================
00080 //================================================================================
00081 
00082 void StdMeshers_ViscousLayers_i::SetIgnoreFaces(const ::SMESH::long_array& faceIDs)
00083 throw ( SALOME::SALOME_Exception )
00084 {
00085   vector<int> ids( faceIDs.length() );
00086   for ( unsigned i = 0; i < ids.size(); ++i )
00087     if (( ids[i] = faceIDs[i] ) < 1 )
00088       THROW_SALOME_CORBA_EXCEPTION( "Invalid face id", SALOME::BAD_PARAM );
00089   GetImpl()->SetIgnoreFaces( ids );
00090   SMESH::TPythonDump() << _this() << ".SetIgnoreFaces( " << faceIDs << " )";
00091 }
00092 
00093 //================================================================================
00097 //================================================================================
00098 
00099 SMESH::long_array* StdMeshers_ViscousLayers_i::GetIgnoreFaces()
00100 {
00101   vector<int> idsVec = GetImpl()->GetIgnoreFaces();
00102   SMESH::long_array_var ids = new SMESH::long_array;
00103   ids->length( idsVec.size() );
00104   for ( unsigned i = 0; i < idsVec.size(); ++i )
00105     ids[i] = idsVec[i];
00106   return ids._retn();
00107 }
00108 
00109 //================================================================================
00113 //================================================================================
00114 
00115 void StdMeshers_ViscousLayers_i::SetTotalThickness(::CORBA::Double thickness)
00116 throw ( SALOME::SALOME_Exception )
00117 {
00118   if ( thickness < 1e-100 )
00119     THROW_SALOME_CORBA_EXCEPTION( "Invalid thickness", SALOME::BAD_PARAM );
00120   GetImpl()->SetTotalThickness(thickness);
00121   SMESH::TPythonDump() << _this() << ".SetTotalThickness( " << thickness << " )";
00122 }
00123 
00124 //================================================================================
00128 //================================================================================
00129 
00130 ::CORBA::Double StdMeshers_ViscousLayers_i::GetTotalThickness()
00131 {
00132   return GetImpl()->GetTotalThickness();
00133 }
00134 
00135 //================================================================================
00140 //================================================================================
00141 
00142 void StdMeshers_ViscousLayers_i::SetNumberLayers(::CORBA::Short nb)
00143 throw ( SALOME::SALOME_Exception )
00144 {
00145   if ( nb < 1 )
00146     THROW_SALOME_CORBA_EXCEPTION( "Invalid number of layers", SALOME::BAD_PARAM );
00147   GetImpl()->SetNumberLayers( nb );
00148   SMESH::TPythonDump() << _this() << ".SetNumberLayers( " << nb << " )";
00149 }
00150 
00151 //================================================================================
00155 //================================================================================
00156 
00157 ::CORBA::Short StdMeshers_ViscousLayers_i::GetNumberLayers()
00158 {
00159   return CORBA::Short( GetImpl()->GetNumberLayers() );
00160 }
00161 
00162 //================================================================================
00167 //================================================================================
00168 
00169 void StdMeshers_ViscousLayers_i::SetStretchFactor(::CORBA::Double factor)
00170 throw ( SALOME::SALOME_Exception )
00171 {
00172   if ( factor < 1 )
00173     THROW_SALOME_CORBA_EXCEPTION( "Invalid stretch factor, it must be >= 1.0", SALOME::BAD_PARAM );
00174   GetImpl()->SetStretchFactor(factor);
00175   SMESH::TPythonDump() << _this() << ".SetStretchFactor( " << factor << " )";
00176 }
00177 
00178 //================================================================================
00183 //================================================================================
00184 
00185 ::CORBA::Double StdMeshers_ViscousLayers_i::GetStretchFactor()
00186 {
00187   return GetImpl()->GetStretchFactor();
00188 }
00189 
00190 //=============================================================================
00194 //=============================================================================
00195 
00196 ::StdMeshers_ViscousLayers* StdMeshers_ViscousLayers_i::GetImpl()
00197 {
00198   MESSAGE( "StdMeshers_ViscousLayers_i::GetImpl" );
00199   return ( ::StdMeshers_ViscousLayers* )myBaseImpl;
00200 }
00201 
00202 //================================================================================
00210 //================================================================================  
00211 CORBA::Boolean StdMeshers_ViscousLayers_i::IsDimSupported( SMESH::Dimension type )
00212 {
00213   return type == SMESH::DIM_3D;
00214 }
00215 
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS