Back to index

salome-smesh  6.5.0
StdMeshers_LengthFromEdges.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  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 : implementaion of SMESH idl descriptions
00024 //  File   : StdMeshers_LengthFromEdges.cxx
00025 //           Moved here from SMESH_LengthFromEdges.cxx
00026 //  Author : Paul RASCLE, EDF
00027 //  Module : SMESH
00028 //
00029 #include "StdMeshers_LengthFromEdges.hxx"
00030 
00031 #include "utilities.h"
00032 
00033 using namespace std;
00034 
00035 //=============================================================================
00039 //=============================================================================
00040 
00041 StdMeshers_LengthFromEdges::StdMeshers_LengthFromEdges(int hypId, int studyId, SMESH_Gen* gen)
00042   : SMESH_Hypothesis(hypId, studyId, gen)
00043 {
00044   _mode =1;
00045   _name = "LengthFromEdges";
00046   _param_algo_dim = 2; // is used by SMESH_MEFISTO_2D
00047 }
00048 
00049 //=============================================================================
00053 //=============================================================================
00054 
00055 StdMeshers_LengthFromEdges::~StdMeshers_LengthFromEdges()
00056 {
00057 }
00058 
00059 //=============================================================================
00063 //=============================================================================
00064 
00065 void StdMeshers_LengthFromEdges::SetMode(int mode)
00066   throw (SALOME_Exception)
00067 {
00068   int oldMode = _mode;
00069   if (mode <= 0) 
00070     throw SALOME_Exception(LOCALIZED("mode must be positive"));
00071   _mode = mode;
00072   if (oldMode != _mode)
00073     NotifySubMeshesHypothesisModification();
00074 }
00075 
00076 //=============================================================================
00080 //=============================================================================
00081 
00082 int StdMeshers_LengthFromEdges::GetMode()
00083 {
00084   return _mode;
00085 }
00086 
00087 //=============================================================================
00091 //=============================================================================
00092 
00093 ostream & StdMeshers_LengthFromEdges::SaveTo(ostream & save)
00094 {
00095   save << this->_mode;
00096   return save;
00097 }
00098 
00099 //=============================================================================
00103 //=============================================================================
00104 
00105 istream & StdMeshers_LengthFromEdges::LoadFrom(istream & load)
00106 {
00107   bool isOK = true;
00108   int a;
00109   isOK = (load >> a);
00110   if (isOK) 
00111     this->_mode = a;
00112   else 
00113     load.clear(ios::badbit | load.rdstate());
00114   return load;
00115 }
00116 
00117 //=============================================================================
00121 //=============================================================================
00122 
00123 ostream & operator << (ostream & save, StdMeshers_LengthFromEdges & hyp)
00124 {
00125   return hyp.SaveTo( save );
00126 }
00127 
00128 //=============================================================================
00132 //=============================================================================
00133 
00134 istream & operator >> (istream & load, StdMeshers_LengthFromEdges & hyp)
00135 {
00136   return hyp.LoadFrom( load );
00137 }
00138 
00139 //================================================================================
00148 //================================================================================
00149 
00150 bool StdMeshers_LengthFromEdges::SetParametersByMesh(const SMESH_Mesh* /*theMesh*/,
00151                                                      const TopoDS_Shape& /*theShape*/)
00152 {
00153   return false;
00154 }
00155 //================================================================================
00160 //================================================================================
00161 
00162 bool StdMeshers_LengthFromEdges::SetParametersByDefaults(const TDefaults&  /*dflts*/,
00163                                                          const SMESH_Mesh* /*theMesh*/)
00164 {
00165   return true;
00166 }