Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/smesh.git] / src / StdMeshers / StdMeshers_LayerDistribution.cxx
1 //  SMESH SMESH : idl implementation based on 'SMESH' unit's classes
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : StdMeshers_LayerDistribution.cxx
25 //  Author : Edward AGAPOV
26 //  Module : SMESH
27 //  $Header$
28
29 #include "StdMeshers_LayerDistribution.hxx"
30
31 #include "utilities.h"
32
33 using namespace std;
34
35
36 //=============================================================================
37 /*!
38  *  StdMeshers_LayerDistribution::StdMeshers_LayerDistribution
39  *
40  *  Constructor
41  */
42 //=============================================================================
43
44 StdMeshers_LayerDistribution::StdMeshers_LayerDistribution(int hypId, int studyId,
45                                                            SMESH_Gen * gen)
46   : SMESH_Hypothesis(hypId, studyId, gen)
47 {
48   _name = "LayerDistribution"; // used by RadialPrism_3D
49   _param_algo_dim = 3; // 3D
50   myHyp = 0;
51 }
52
53 //=============================================================================
54 /*!
55  *  StdMeshers_LayerDistribution::~StdMeshers_LayerDistribution
56  *
57  *  Destructor
58  */
59 //=============================================================================
60
61 StdMeshers_LayerDistribution::~StdMeshers_LayerDistribution()
62 {
63   MESSAGE( "StdMeshers_LayerDistribution::~StdMeshers_LayerDistribution" );
64 }
65
66 //=============================================================================
67   /*!
68    * \brief Sets  1D hypothesis specifying distribution of layers
69     * \param hyp1D - 1D hypothesis
70    */
71 //=============================================================================
72
73 void StdMeshers_LayerDistribution::SetLayerDistribution(SMESH_Hypothesis* hyp1D)
74   throw ( SALOME_Exception )
75 {
76   if ( myHyp != hyp1D ) {
77     if ( myHyp && hyp1D->GetDim() != 1 )
78       throw SALOME_Exception(LOCALIZED("1D hypothesis is expected"));
79     myHyp = hyp1D;
80   }
81   std::ostringstream os;
82   if ( myHyp )
83     myHyp->SaveTo( os );
84
85   if ( mySavedHyp != os.str() )
86     NotifySubMeshesHypothesisModification();
87
88   mySavedHyp = os.str();
89 }
90
91 //=============================================================================
92 /*!
93  *  Servant saves and loads my hypothesis
94  */
95 //=============================================================================
96
97 ostream & StdMeshers_LayerDistribution::SaveTo(ostream & save)
98 {
99   return save;
100 }
101
102 //=============================================================================
103 /*!
104  *   Servant saves and loads my hypothesis
105  */
106 //=============================================================================
107
108 istream & StdMeshers_LayerDistribution::LoadFrom(istream & load)
109 {
110   return load;
111 }
112
113 //=============================================================================
114 /*!
115  *  
116  */
117 //=============================================================================
118
119 ostream & operator <<(ostream & save, StdMeshers_LayerDistribution & hyp)
120 {
121   return hyp.SaveTo( save );
122 }
123
124 //=============================================================================
125 /*!
126  *  
127  */
128 //=============================================================================
129
130 istream & operator >>(istream & load, StdMeshers_LayerDistribution & hyp)
131 {
132   return hyp.LoadFrom( load );
133 }
134
135 //================================================================================
136 /*!
137  * \brief Initialize start and end length by the mesh built on the geometry
138  * \param theMesh - the built mesh
139  * \param theShape - the geometry of interest
140  * \retval bool - true if parameter values have been successfully defined
141  */
142 //================================================================================
143
144 bool StdMeshers_LayerDistribution::SetParametersByMesh(const SMESH_Mesh*   ,
145                                                        const TopoDS_Shape& )
146 {
147   return false;
148 }