Salome HOME
updating or adding when merging in the main trunk with the version in the
[modules/smesh.git] / src / SMESH / SMESH_MaxElementVolume.cxx
index cd77ebe8eaf2036c9d3a6e407bc27d3a700b9824..cb25383d7859f6e84ee2e7d39ea068d720ecded4 100644 (file)
 //  $Header$
 
 using namespace std;
+
+#include "SMESH_MaxElementVolume.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+SMESH_MaxElementVolume::SMESH_MaxElementVolume(int hypId, int studyId, SMESH_Gen* gen)
+  : SMESH_Hypothesis(hypId, studyId, gen)
+{
+  _maxVolume =1.;
+  _name = "MaxElementVolume";
+//   SCRUTE(_name);
+  SCRUTE(&_name);
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+SMESH_MaxElementVolume::~SMESH_MaxElementVolume()
+{
+  MESSAGE("SMESH_MaxElementVolume::~SMESH_MaxElementVolume");
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void SMESH_MaxElementVolume::SetMaxVolume(double maxVolume)
+  throw (SALOME_Exception)
+{
+  double oldVolume = _maxVolume;
+  if (maxVolume <= 0) 
+    throw SALOME_Exception(LOCALIZED("maxVolume must be positive"));
+  _maxVolume = maxVolume;
+  if (_maxVolume != oldVolume)
+    NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+double SMESH_MaxElementVolume::GetMaxVolume() const
+{
+  return _maxVolume;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & SMESH_MaxElementVolume::SaveTo(ostream & save)
+{
+  return save << this;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & SMESH_MaxElementVolume::LoadFrom(istream & load)
+{
+  return load >> (*this);
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator << (ostream & save, SMESH_MaxElementVolume & hyp)
+{
+  save << hyp._maxVolume;
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >> (istream & load, SMESH_MaxElementVolume & hyp)
+{
+  bool isOK = true;
+  double a;
+  isOK = (load >> a);
+  if (isOK) hyp._maxVolume = a;
+  else load.clear(ios::badbit | load.rdstate());
+  return load;
+}
+