-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
+#include <BRepBndLib.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <BRep_Tool.hxx>
#include <Bnd_B3d.hxx>
+#include <Bnd_Box.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <Geom_Curve.hxx>
vector< int > _elementIDs;
};
//================================================================================
- /*!
- * \brief BRepMesh_IncrementalMesh with access to its protected Bnd_Box
- */
- struct IncrementalMesh : public BRepMesh_IncrementalMesh
- {
- IncrementalMesh(const TopoDS_Shape& shape,
- const Standard_Real deflection,
- const bool relative):
- BRepMesh_IncrementalMesh( shape, deflection, relative )
- {
- }
- Bnd_B3d GetBox() const
- {
- Standard_Real TXmin, TYmin, TZmin, TXmax, TYmax, TZmax;
- myBox.Get(TXmin, TYmin, TZmin, TXmax, TYmax, TZmax);
- Bnd_B3d bb;
- bb.Add( gp_XYZ( TXmin, TYmin, TZmin ));
- bb.Add( gp_XYZ( TXmax, TYmax, TZmax ));
- return bb;
- }
- };
- //================================================================================
/*!
* \brief Link of two nodes
*/
myMinSize = 1e-10;
myMaxSize = 1e+10;
myDeflection = 1e-2;
- myGrading = 1e-2;
myAlgo = NULL;
_name = "Adaptive1D";
_param_algo_dim = 1; // is used by SMESH_Regular_1D
}
}
//=======================================================================
-//function : SetGrading
-//purpose :
-void StdMeshers_Adaptive1D::SetGrading(double value)
- throw(SALOME_Exception)
-{
- if (value <= std::numeric_limits<double>::min() )
- throw SALOME_Exception("Grading must be greater that zero");
- if (myGrading != value)
- {
- myGrading = value;
- NotifySubMeshesHypothesisModification();
- }
-}
-//=======================================================================
//function : SetMinSize
//purpose : Sets minimal allowed segment length
void StdMeshers_Adaptive1D::SetMinSize(double minSize)
//purpose : Persistence
ostream & StdMeshers_Adaptive1D::SaveTo(ostream & save)
{
- save << myMinSize << " " << myMaxSize << " " << myDeflection << " " << myGrading;
+ save << myMinSize << " " << myMaxSize << " " << myDeflection;
save << " " << -1 << " " << -1; // preview addition of parameters
return save;
}
istream & StdMeshers_Adaptive1D::LoadFrom(istream & load)
{
int dummyParam;
- bool isOK = (load >> myMinSize >> myMaxSize >> myDeflection >> myGrading >> dummyParam >> dummyParam);
+ bool isOK = (load >> myMinSize >> myMaxSize >> myDeflection >> dummyParam >> dummyParam);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
return load;
myMinSize = dflts._elemLength / 10;
myMaxSize = dflts._elemLength * 2;
myDeflection = myMinSize / 7;
- myGrading = 0.7;
return true;
}
myMesh = &theMesh;
SMESH_MesherHelper helper( theMesh );
- const double grading = myHyp->GetGrading();
+ const double grading = 0.7;
TopTools_IndexedMapOfShape edgeMap, faceMap;
TopExp::MapShapes( theShape, TopAbs_EDGE, edgeMap );
TopExp::MapShapes( theMesh.GetShapeToMesh(), TopAbs_FACE, faceMap );
// Triangulate the shape with the given deflection ?????????
+ {
+ BRepMesh_IncrementalMesh im( theMesh.GetShapeToMesh(), myHyp->GetDeflection(), /*isRelatif=*/0);
+ }
+
+ // get a bnd box
Bnd_B3d box;
{
- IncrementalMesh im( theMesh.GetShapeToMesh(), myHyp->GetDeflection(), /*Relatif=*/false);
- box = im.GetBox();
+ Bnd_Box aBox;
+ BRepBndLib::Add( theMesh.GetShapeToMesh(), aBox);
+ Standard_Real TXmin, TYmin, TZmin, TXmax, TYmax, TZmax;
+ aBox.Get(TXmin, TYmin, TZmin, TXmax, TYmax, TZmax);
+ box.Add( gp_XYZ( TXmin, TYmin, TZmin ));
+ box.Add( gp_XYZ( TXmax, TYmax, TZmax ));
}
// *theProgress = 0.3;
eData.AddPoint( eData.myPoints.end(), eData.myC3d.LastParameter() );
}
}
+ if ( myEdges.empty() ) return true;
if ( _computeCanceled ) return false;
// Take into account size of already existing segments