Back to index

salome-smesh  6.5.0
StdMeshers_QuadrangleParams.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 //  File   : StdMeshers_QuadrangleParams.cxx
00020 //  Author : Sergey KUUL, OCC
00021 //  Module : SMESH
00022 
00023 #include "StdMeshers_QuadrangleParams.hxx"
00024 
00025 #include "SMESH_Algo.hxx"
00026 #include "SMESH_Mesh.hxx"
00027 
00028 #include <BRep_Tool.hxx>
00029 #include <GCPnts_AbscissaPoint.hxx>
00030 #include <GeomAdaptor_Curve.hxx>
00031 #include <Geom_Curve.hxx>
00032 #include <TopExp.hxx>
00033 #include <TopLoc_Location.hxx>
00034 #include <TopTools_IndexedMapOfShape.hxx>
00035 #include <TopoDS.hxx>
00036 #include <TopoDS_Edge.hxx>
00037 
00038 using namespace std;
00039 
00040 //=============================================================================
00044 //=============================================================================
00045 StdMeshers_QuadrangleParams::StdMeshers_QuadrangleParams(int hypId, int studyId,
00046                                                          SMESH_Gen * gen)
00047   : SMESH_Hypothesis(hypId, studyId, gen)
00048 {
00049   _name = "QuadrangleParams";
00050   _param_algo_dim = 2;
00051   _triaVertexID = -1;
00052   _quadType = QUAD_STANDARD;
00053 }
00054 
00055 //=============================================================================
00059 //=============================================================================
00060 StdMeshers_QuadrangleParams::~StdMeshers_QuadrangleParams()
00061 {
00062 }
00063 
00064 //=============================================================================
00068 //=============================================================================
00069 void StdMeshers_QuadrangleParams::SetTriaVertex (int id)
00070 {
00071   if (id != _triaVertexID) {
00072     _triaVertexID = id;
00073     NotifySubMeshesHypothesisModification();
00074   }
00075 }
00076 
00077 //=============================================================================
00081 //=============================================================================
00082 void StdMeshers_QuadrangleParams::SetQuadType (StdMeshers_QuadType type)
00083 {
00084   if (type != _quadType) {
00085     _quadType = type;
00086     NotifySubMeshesHypothesisModification();
00087   }
00088 }
00089 
00090 //=============================================================================
00094 //=============================================================================
00095 ostream & StdMeshers_QuadrangleParams::SaveTo(ostream & save)
00096 {
00097   if (_objEntry.size() == 0)
00098     save << _triaVertexID << " UNDEFINED " << int(_quadType);
00099   else
00100     save << _triaVertexID << " " << _objEntry << " " << int(_quadType);
00101   return save;
00102 }
00103 
00104 //=============================================================================
00108 //=============================================================================
00109 istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load)
00110 {
00111   bool isOK = true;
00112   isOK = (load >> _triaVertexID);
00113   if (!isOK)
00114     load.clear(ios::badbit | load.rdstate());
00115 
00116   isOK = (load >> _objEntry);
00117   if (!isOK)
00118     load.clear(ios::badbit | load.rdstate());
00119 
00120   int type;
00121   isOK = (load >> type);
00122   if (isOK)
00123     _quadType = StdMeshers_QuadType(type);
00124 
00125   return load;
00126 }
00127 
00128 //=============================================================================
00132 //=============================================================================
00133 ostream & operator <<(ostream & save, StdMeshers_QuadrangleParams & hyp)
00134 {
00135   return hyp.SaveTo( save );
00136 }
00137 
00138 //=============================================================================
00142 //=============================================================================
00143 istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp)
00144 {
00145   return hyp.LoadFrom( load );
00146 }
00147 
00148 //================================================================================
00155 //================================================================================
00156 bool StdMeshers_QuadrangleParams::SetParametersByMesh(const SMESH_Mesh* theMesh,
00157                                                       const TopoDS_Shape& theShape)
00158 {
00159   if ( !theMesh || theShape.IsNull() )
00160     return false;
00161 
00162   return true;
00163 }
00164 
00165 //================================================================================
00170 //================================================================================
00171 bool StdMeshers_QuadrangleParams::SetParametersByDefaults(const TDefaults&  dflts,
00172                                                           const SMESH_Mesh* /*mesh*/)
00173 {
00174   return true;
00175 }