1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // File : StdMeshers_QuadrangleParams.cxx
20 // Author : Sergey KUUL, OCC
23 #include "StdMeshers_QuadrangleParams.hxx"
25 #include "SMESH_Algo.hxx"
26 #include "SMESH_Mesh.hxx"
28 #include <BRep_Tool.hxx>
29 #include <GCPnts_AbscissaPoint.hxx>
30 #include <GeomAdaptor_Curve.hxx>
31 #include <Geom_Curve.hxx>
33 #include <TopLoc_Location.hxx>
34 #include <TopTools_IndexedMapOfShape.hxx>
36 #include <TopoDS_Edge.hxx>
40 //=============================================================================
44 //=============================================================================
45 StdMeshers_QuadrangleParams::StdMeshers_QuadrangleParams(int hypId, int studyId,
47 : SMESH_Hypothesis(hypId, studyId, gen)
49 _name = "QuadrangleParams";
52 _quadType = QUAD_STANDARD;
55 //=============================================================================
59 //=============================================================================
60 StdMeshers_QuadrangleParams::~StdMeshers_QuadrangleParams()
64 //=============================================================================
68 //=============================================================================
69 void StdMeshers_QuadrangleParams::SetTriaVertex (int id)
71 if (id != _triaVertexID) {
73 NotifySubMeshesHypothesisModification();
77 //=============================================================================
81 //=============================================================================
82 void StdMeshers_QuadrangleParams::SetQuadType (StdMeshers_QuadType type)
84 if (type != _quadType) {
86 NotifySubMeshesHypothesisModification();
90 //=============================================================================
94 //=============================================================================
95 ostream & StdMeshers_QuadrangleParams::SaveTo(ostream & save)
97 if (_objEntry.size() == 0)
98 save << _triaVertexID << " UNDEFINED " << int(_quadType);
100 save << _triaVertexID << " " << _objEntry << " " << int(_quadType);
104 //=============================================================================
108 //=============================================================================
109 istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load)
112 isOK = (load >> _triaVertexID);
114 load.clear(ios::badbit | load.rdstate());
116 isOK = (load >> _objEntry);
118 load.clear(ios::badbit | load.rdstate());
121 isOK = (load >> type);
123 _quadType = StdMeshers_QuadType(type);
128 //=============================================================================
132 //=============================================================================
133 ostream & operator <<(ostream & save, StdMeshers_QuadrangleParams & hyp)
135 return hyp.SaveTo( save );
138 //=============================================================================
142 //=============================================================================
143 istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp)
145 return hyp.LoadFrom( load );
148 //================================================================================
150 * \brief Redifined method
151 * \param theMesh - the built mesh
152 * \param theShape - the geometry of interest
153 * \retval bool - true if parameter values have been successfully defined
155 //================================================================================
156 bool StdMeshers_QuadrangleParams::SetParametersByMesh(const SMESH_Mesh* theMesh,
157 const TopoDS_Shape& theShape)
159 if ( !theMesh || theShape.IsNull() )
165 //================================================================================
167 * \brief Initialize my parameter values by default parameters.
168 * \retval bool - true if parameter values have been successfully defined
170 //================================================================================
171 bool StdMeshers_QuadrangleParams::SetParametersByDefaults(const TDefaults& dflts,
172 const SMESH_Mesh* /*mesh*/)