1 // Copyright (C) 2007-2020 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
23 // SMESH SMESH : idl implementation based on 'SMESH' unit's classes
24 // File : StdMeshers_LayerDistribution.cxx
25 // Author : Edward AGAPOV
28 #include "StdMeshers_LayerDistribution.hxx"
30 #include "utilities.h"
35 //=============================================================================
37 * StdMeshers_LayerDistribution::StdMeshers_LayerDistribution
41 //=============================================================================
43 StdMeshers_LayerDistribution::StdMeshers_LayerDistribution(int hypId,
45 : SMESH_Hypothesis(hypId, gen)
47 _name = "LayerDistribution"; // used by RadialPrism_3D
48 _param_algo_dim = 3; // 3D
52 //=============================================================================
54 * StdMeshers_LayerDistribution::~StdMeshers_LayerDistribution
58 //=============================================================================
60 StdMeshers_LayerDistribution::~StdMeshers_LayerDistribution()
64 //=============================================================================
66 * \brief Sets 1D hypothesis specifying distribution of layers
67 * \param hyp1D - 1D hypothesis
69 //=============================================================================
71 void StdMeshers_LayerDistribution::SetLayerDistribution(SMESH_Hypothesis* hyp1D)
73 if ( myHyp != hyp1D ) {
74 if ( myHyp && hyp1D->GetDim() != 1 )
75 throw SALOME_Exception(LOCALIZED("1D hypothesis is expected"));
78 std::ostringstream os;
82 if ( mySavedHyp != os.str() )
83 NotifySubMeshesHypothesisModification();
85 mySavedHyp = os.str();
88 //=============================================================================
90 * Servant saves and loads my hypothesis
92 //=============================================================================
94 ostream & StdMeshers_LayerDistribution::SaveTo(ostream & save)
96 save << "StdMeshers_LayerDistribution"; // just to enable "Edit" in pop-up menu
100 //=============================================================================
102 * Servant saves and loads my hypothesis
104 //=============================================================================
106 istream & StdMeshers_LayerDistribution::LoadFrom(istream & load)
111 //=============================================================================
115 //=============================================================================
117 ostream & operator <<(ostream & save, StdMeshers_LayerDistribution & hyp)
119 return hyp.SaveTo( save );
122 //=============================================================================
126 //=============================================================================
128 istream & operator >>(istream & load, StdMeshers_LayerDistribution & hyp)
130 return hyp.LoadFrom( load );
133 //================================================================================
135 * \brief Initialize start and end length by the mesh built on the geometry
136 * \param theMesh - the built mesh
137 * \param theShape - the geometry of interest
138 * \retval bool - true if parameter values have been successfully defined
140 //================================================================================
142 bool StdMeshers_LayerDistribution::SetParametersByMesh(const SMESH_Mesh* ,
143 const TopoDS_Shape& )
147 //================================================================================
149 * \brief Initialize my parameter values by default parameters.
150 * \retval bool - true if parameter values have been successfully defined
152 //================================================================================
154 bool StdMeshers_LayerDistribution::SetParametersByDefaults(const TDefaults& dflts,
155 const SMESH_Mesh* theMesh)
157 return myHyp ? myHyp->SetParametersByDefaults(dflts,theMesh) : false;