Salome HOME
bos #20584 EDF 22720 - degenerated edge / projection
[modules/smesh.git] / src / StdMeshers / StdMeshers_CartesianParameters3D.cxx
index 7226e4beb656deae5ac2a67643e58d55a33c4a9e..6b3e24ed40333b95b7fe6402b071c38486e5595d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020  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
@@ -61,11 +61,13 @@ using namespace std;
 //=======================================================================
 
 StdMeshers_CartesianParameters3D::StdMeshers_CartesianParameters3D(int         hypId,
-                                                                   int         studyId,
                                                                    SMESH_Gen * gen)
-  : SMESH_Hypothesis(hypId, studyId, gen),
+  : SMESH_Hypothesis(hypId, gen),
     _sizeThreshold( 4.0 ), // default according to the customer specification
-    _toAddEdges( false )
+    _toAddEdges( false ),
+    _toConsiderInternalFaces( false ),
+    _toUseThresholdForInternalFaces( false ),
+    _toCreateFaces( false )
 {
   _name = "CartesianParameters3D"; // used by "Cartesian_3D"
   _param_algo_dim = 3; // 3D
@@ -131,7 +133,6 @@ namespace
   void checkGridSpacing(std::vector<std::string>& spaceFunctions,
                         std::vector<double>&      internalPoints,
                         const std::string&        axis)
-    throw ( SALOME_Exception )
   {
     if ( spaceFunctions.empty() )
       throw SALOME_Exception(SMESH_Comment("Empty space function for ") << axis );
@@ -168,7 +169,6 @@ namespace
 //=======================================================================
 
 void StdMeshers_CartesianParameters3D::SetGrid(std::vector<double>& coords, int axis)
-  throw ( SALOME_Exception )
 {
   checkAxis( axis );
 
@@ -196,7 +196,6 @@ void StdMeshers_CartesianParameters3D::SetGrid(std::vector<double>& coords, int
 void StdMeshers_CartesianParameters3D::SetGridSpacing(std::vector<string>& xSpaceFuns,
                                                       std::vector<double>& xInternalPoints,
                                                       const int            axis)
-  throw ( SALOME_Exception )
 {
   checkAxis( axis );
 
@@ -250,7 +249,6 @@ bool StdMeshers_CartesianParameters3D::GetFixedPoint(double p[3]) const
 //=======================================================================
 
 void StdMeshers_CartesianParameters3D::SetSizeThreshold(const double threshold)
-  throw ( SALOME_Exception )
 {
   if ( threshold <= 1.0 )
     throw SALOME_Exception(LOCALIZED("threshold must be > 1.0"));
@@ -270,7 +268,6 @@ void StdMeshers_CartesianParameters3D::SetSizeThreshold(const double threshold)
 void StdMeshers_CartesianParameters3D::GetGridSpacing(std::vector<std::string>& spaceFunctions,
                                                       std::vector<double>&      internalPoints,
                                                       const int                 axis) const
-  throw ( SALOME_Exception )
 {
   if ( !IsGridBySpacing(axis) )
     throw SALOME_Exception(LOCALIZED("The grid is defined by coordinates and not by spacing"));
@@ -284,7 +281,6 @@ void StdMeshers_CartesianParameters3D::GetGridSpacing(std::vector<std::string>&
 //=======================================================================
 
 bool StdMeshers_CartesianParameters3D::IsGridBySpacing(const int axis) const
-  throw ( SALOME_Exception )
 {
   checkAxis(axis);
   return !_spaceFunctions[axis].empty();
@@ -303,7 +299,6 @@ void StdMeshers_CartesianParameters3D::ComputeCoordinates(const double    x0,
                                                           vector<double>& coords,
                                                           const string&   axis,
                                                           const double*   xForced )
-  throw ( SALOME_Exception )
 {
   checkGridSpacing( theSpaceFuns, thePoints, axis );
 
@@ -402,7 +397,6 @@ void StdMeshers_CartesianParameters3D::GetCoordinates(std::vector<double>& xNode
                                                       std::vector<double>& yNodes,
                                                       std::vector<double>& zNodes,
                                                       const Bnd_Box&       bndBox) const
-  throw ( SALOME_Exception )
 {
   double x0,y0,z0, x1,y1,z1;
   if ( IsGridBySpacing(0) || IsGridBySpacing(1) || IsGridBySpacing(2))
@@ -653,7 +647,6 @@ ComputeOptimalAxesDirs(const TopoDS_Shape& shape,
 //=======================================================================
 
 void StdMeshers_CartesianParameters3D::SetAxisDirs(const double* the9DirComps)
-  throw ( SALOME_Exception )
 {
   gp_Vec x( the9DirComps[0],
             the9DirComps[1],
@@ -695,7 +688,6 @@ void StdMeshers_CartesianParameters3D::SetAxisDirs(const double* the9DirComps)
 //=======================================================================
 
 void StdMeshers_CartesianParameters3D::GetGrid(std::vector<double>& coords, int axis) const
-  throw ( SALOME_Exception )
 {
   if ( IsGridBySpacing(axis) )
     throw SALOME_Exception(LOCALIZED("The grid is defined by spacing and not by coordinates"));
@@ -740,6 +732,48 @@ bool StdMeshers_CartesianParameters3D::GetToAddEdges() const
   return _toAddEdges;
 }
 
+//=======================================================================
+//function : SetToConsiderInternalFaces
+//purpose  : Enables treatment of geom faces either shared by solids or internal
+//=======================================================================
+
+void StdMeshers_CartesianParameters3D::SetToConsiderInternalFaces(bool toTreat)
+{
+  if ( _toConsiderInternalFaces != toTreat )
+  {
+    _toConsiderInternalFaces = toTreat;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetToUseThresholdForInternalFaces
+//purpose  : Enables applying size threshold to grid cells cut by internal geom faces.
+//=======================================================================
+
+void StdMeshers_CartesianParameters3D::SetToUseThresholdForInternalFaces(bool toUse)
+{
+  if ( _toUseThresholdForInternalFaces != toUse )
+  {
+    _toUseThresholdForInternalFaces = toUse;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetToCreateFaces
+//purpose  : Enables creation of mesh faces.
+//=======================================================================
+
+void StdMeshers_CartesianParameters3D::SetToCreateFaces(bool toCreate)
+{
+  if ( _toCreateFaces != toCreate )
+  {
+    _toCreateFaces = toCreate;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
 //=======================================================================
 //function : IsDefined
 //purpose  : Return true if parameters are well defined
@@ -787,12 +821,16 @@ std::ostream & StdMeshers_CartesianParameters3D::SaveTo(std::ostream & save)
   for ( int i = 0; i < 3; ++i )
     save << _fixedPoint[i] << " ";
 
+  save << " " << _toConsiderInternalFaces
+       << " " << _toUseThresholdForInternalFaces
+       << " " << _toCreateFaces;
+
   return save;
 }
 
 //=======================================================================
 //function : LoadFrom
-//purpose  : resore my parameters from a stream
+//purpose  : restore my parameters from a stream
 //=======================================================================
 
 std::istream & StdMeshers_CartesianParameters3D::LoadFrom(std::istream & load)
@@ -845,6 +883,12 @@ std::istream & StdMeshers_CartesianParameters3D::LoadFrom(std::istream & load)
   for ( int i = 0; i < 3 && ok ; ++i )
     ok = static_cast<bool>( load >> _fixedPoint[i]);
 
+  if ( load >> _toConsiderInternalFaces )
+  {
+    load >> _toUseThresholdForInternalFaces;
+    load >> _toCreateFaces;
+  }
+
   return load;
 }