Salome HOME
Update of CheckDone
[modules/smesh.git] / src / StdMeshers / StdMeshers_CartesianParameters3D.cxx
index 7a920b5ff1531c6f467d1a5b19794d58f98e9fb0..66256788b7cc1727776f2bccf32f8f2e3c92d129 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -67,7 +67,9 @@ StdMeshers_CartesianParameters3D::StdMeshers_CartesianParameters3D(int         h
     _toAddEdges( false ),
     _toConsiderInternalFaces( false ),
     _toUseThresholdForInternalFaces( false ),
-    _toCreateFaces( false )
+    _toCreateFaces( false ),
+    _toUseQuanta(false),
+    _quanta(0.01)
 {
   _name = "CartesianParameters3D"; // used by "Cartesian_3D"
   _param_algo_dim = 3; // 3D
@@ -774,6 +776,37 @@ void StdMeshers_CartesianParameters3D::SetToCreateFaces(bool toCreate)
   }
 }
 
+//=======================================================================
+//function : SetToUseQuanta
+//purpose  : Enables use of quanta
+//=======================================================================
+
+void StdMeshers_CartesianParameters3D::SetToUseQuanta(bool toUseQuanta)
+{
+  if ( _toUseQuanta != toUseQuanta )
+  {
+    _toUseQuanta = toUseQuanta;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetQuanta
+//purpose  : Set size quanta value
+//=======================================================================
+
+void StdMeshers_CartesianParameters3D::SetQuanta(const double quanta)
+{
+  if ( quanta < 1e-6 || quanta > 1.0 )
+    throw SALOME_Exception(LOCALIZED("Quanta must be in the range [0.01,1] "));
+
+  bool changed = (_quanta != quanta); 
+  _quanta = quanta;
+  
+  if ( changed )
+    NotifySubMeshesHypothesisModification();
+}
+
 //=======================================================================
 //function : IsDefined
 //purpose  : Return true if parameters are well defined
@@ -823,7 +856,9 @@ std::ostream & StdMeshers_CartesianParameters3D::SaveTo(std::ostream & save)
 
   save << " " << _toConsiderInternalFaces
        << " " << _toUseThresholdForInternalFaces
-       << " " << _toCreateFaces;
+       << " " << _toCreateFaces
+       << " " << _toUseQuanta
+       << " " << _quanta;
 
   return save;
 }
@@ -889,6 +924,9 @@ std::istream & StdMeshers_CartesianParameters3D::LoadFrom(std::istream & load)
     load >> _toCreateFaces;
   }
 
+  if ( load >> _toUseQuanta )
+    load >> _quanta;
+
   return load;
 }