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 : idl implementation based on 'SMESH' unit's classes 00024 // File : StdMeshers_LayerDistribution.cxx 00025 // Author : Edward AGAPOV 00026 // Module : SMESH 00027 // 00028 #include "StdMeshers_LayerDistribution.hxx" 00029 00030 #include "utilities.h" 00031 00032 using namespace std; 00033 00034 00035 //============================================================================= 00041 //============================================================================= 00042 00043 StdMeshers_LayerDistribution::StdMeshers_LayerDistribution(int hypId, int studyId, 00044 SMESH_Gen * gen) 00045 : SMESH_Hypothesis(hypId, studyId, gen) 00046 { 00047 _name = "LayerDistribution"; // used by RadialPrism_3D 00048 _param_algo_dim = 3; // 3D 00049 myHyp = 0; 00050 } 00051 00052 //============================================================================= 00058 //============================================================================= 00059 00060 StdMeshers_LayerDistribution::~StdMeshers_LayerDistribution() 00061 { 00062 MESSAGE( "StdMeshers_LayerDistribution::~StdMeshers_LayerDistribution" ); 00063 } 00064 00065 //============================================================================= 00070 //============================================================================= 00071 00072 void StdMeshers_LayerDistribution::SetLayerDistribution(SMESH_Hypothesis* hyp1D) 00073 throw ( SALOME_Exception ) 00074 { 00075 if ( myHyp != hyp1D ) { 00076 if ( myHyp && hyp1D->GetDim() != 1 ) 00077 throw SALOME_Exception(LOCALIZED("1D hypothesis is expected")); 00078 myHyp = hyp1D; 00079 } 00080 std::ostringstream os; 00081 if ( myHyp ) 00082 myHyp->SaveTo( os ); 00083 00084 if ( mySavedHyp != os.str() ) 00085 NotifySubMeshesHypothesisModification(); 00086 00087 mySavedHyp = os.str(); 00088 } 00089 00090 //============================================================================= 00094 //============================================================================= 00095 00096 ostream & StdMeshers_LayerDistribution::SaveTo(ostream & save) 00097 { 00098 return save; 00099 } 00100 00101 //============================================================================= 00105 //============================================================================= 00106 00107 istream & StdMeshers_LayerDistribution::LoadFrom(istream & load) 00108 { 00109 return load; 00110 } 00111 00112 //============================================================================= 00116 //============================================================================= 00117 00118 ostream & operator <<(ostream & save, StdMeshers_LayerDistribution & hyp) 00119 { 00120 return hyp.SaveTo( save ); 00121 } 00122 00123 //============================================================================= 00127 //============================================================================= 00128 00129 istream & operator >>(istream & load, StdMeshers_LayerDistribution & hyp) 00130 { 00131 return hyp.LoadFrom( load ); 00132 } 00133 00134 //================================================================================ 00141 //================================================================================ 00142 00143 bool StdMeshers_LayerDistribution::SetParametersByMesh(const SMESH_Mesh* , 00144 const TopoDS_Shape& ) 00145 { 00146 return false; 00147 } 00148 //================================================================================ 00153 //================================================================================ 00154 00155 bool StdMeshers_LayerDistribution::SetParametersByDefaults(const TDefaults& dflts, 00156 const SMESH_Mesh* theMesh) 00157 { 00158 return myHyp ? myHyp->SetParametersByDefaults(dflts,theMesh) : false; 00159 }