Salome HOME
Implementation of Quadrangle (Mapping) for faces built on 3 edges (0018911 from Mantis).
[modules/smesh.git] / src / StdMeshers / StdMeshers_QuadrangleParams.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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 //  SMESH SMESH : implementaion of SMESH idl descriptions
23 //  File   : StdMeshers_QuadrangleParams.cxx
24 //  Author : Sergey KUUL, OCC
25 //  Module : SMESH
26 //
27 #include "StdMeshers_QuadrangleParams.hxx"
28
29 #include "SMESH_Algo.hxx"
30 #include "SMESH_Mesh.hxx"
31
32 #include <BRep_Tool.hxx>
33 #include <GCPnts_AbscissaPoint.hxx>
34 #include <GeomAdaptor_Curve.hxx>
35 #include <Geom_Curve.hxx>
36 #include <TopExp.hxx>
37 #include <TopLoc_Location.hxx>
38 #include <TopTools_IndexedMapOfShape.hxx>
39 #include <TopoDS.hxx>
40 #include <TopoDS_Edge.hxx>
41
42 using namespace std;
43
44 //=============================================================================
45 /*!
46  *  
47  */
48 //=============================================================================
49
50 StdMeshers_QuadrangleParams::StdMeshers_QuadrangleParams(int hypId, int studyId,
51                                                          SMESH_Gen * gen)
52   :SMESH_Hypothesis(hypId, studyId, gen)
53 {
54   _name = "QuadrangleParams";
55   _param_algo_dim = 2;
56   _triaVertexID = -1;
57 }
58
59 //=============================================================================
60 /*!
61  *  
62  */
63 //=============================================================================
64
65 StdMeshers_QuadrangleParams::~StdMeshers_QuadrangleParams()
66 {
67 }
68
69 //=============================================================================
70 /*!
71  *  
72  */
73 //=============================================================================
74
75 void StdMeshers_QuadrangleParams::SetTriaVertex(int id)
76 {
77   if ( id != _triaVertexID ) {
78     _triaVertexID = id;
79     NotifySubMeshesHypothesisModification();
80   }
81 }
82
83 //=============================================================================
84 /*!
85  *  
86  */
87 //=============================================================================
88
89 ostream & StdMeshers_QuadrangleParams::SaveTo(ostream & save)
90 {
91   save << _triaVertexID << " " << _objEntry;
92   return save;
93 }
94
95 //=============================================================================
96 /*!
97  *  
98  */
99 //=============================================================================
100
101 istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load)
102 {
103   bool isOK = true;
104   isOK = (load >> _triaVertexID);
105   if (!isOK)
106     load.clear(ios::badbit | load.rdstate());
107
108   isOK = (load >> _objEntry);
109
110   return load;
111 }
112
113 //=============================================================================
114 /*!
115  *  
116  */
117 //=============================================================================
118
119 ostream & operator <<(ostream & save, StdMeshers_QuadrangleParams & hyp)
120 {
121   return hyp.SaveTo( save );
122 }
123
124 //=============================================================================
125 /*!
126  *  
127  */
128 //=============================================================================
129
130 istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp)
131 {
132   return hyp.LoadFrom( load );
133 }
134
135 //================================================================================
136 /*!
137  * \brief Redifined method
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_QuadrangleParams::SetParametersByMesh(const SMESH_Mesh* theMesh,
145                                                       const TopoDS_Shape& theShape)
146 {
147   if ( !theMesh || theShape.IsNull() )
148     return false;
149
150   return true;
151 }
152
153 //================================================================================
154 /*!
155  * \brief Initialize my parameter values by default parameters.
156  *  \retval bool - true if parameter values have been successfully defined
157  */
158 //================================================================================
159
160 bool StdMeshers_QuadrangleParams::SetParametersByDefaults(const TDefaults&  dflts,
161                                                           const SMESH_Mesh* /*mesh*/)
162 {
163   return true;
164 }
165