Salome HOME
Revert "Merge branch 'yan/V8_3_BR' into pre/V8_3_BR"
[modules/hydrosolver.git] / src / mascaret_wrapper / Mascaret.hxx
diff --git a/src/mascaret_wrapper/Mascaret.hxx b/src/mascaret_wrapper/Mascaret.hxx
new file mode 100644 (file)
index 0000000..8a56508
--- /dev/null
@@ -0,0 +1,87 @@
+//  Copyright (C) 2012-2013 EDF
+//
+//  This file is part of SALOME HYDRO module.
+//
+//  SALOME HYDRO module is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  SALOME HYDRO module is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with SALOME HYDRO module.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef MASCARET_HXX_
+#define MASCARET_HXX_
+
+#include <stdexcept>
+#include <vector>
+
+namespace SalomeHydro
+{
+
+typedef struct MascaretFile
+{
+  std::string fileName;
+  std::string fileType;
+} MascaretFile;
+
+typedef std::vector<MascaretFile> MascaretFileList;
+
+class MascaretException: public std::runtime_error
+{
+public:
+
+  MascaretException(const std::string & msg);
+  virtual ~MascaretException() throw();
+
+  const char * __str__() const;
+
+};
+
+class Mascaret
+{
+public:
+
+  // Constructor and destructor
+  Mascaret();
+  virtual ~Mascaret();
+
+  // Get and set printing flag
+  bool isPrinting();
+  void setPrinting(bool printing);
+
+  // Model initialization
+  void importModel(const MascaretFileList & fileList);
+  void initState(const std::string & ligFileName);
+
+  // Save / restore state
+  int saveState();
+  void restoreState(int stateId);
+
+  // Computation
+  void compute(double startTime, double endTime, double timeStep);
+  void compute();
+
+  // Model and state edition
+  int getInt(const std::string & varName, int index1, int index2, int index3);
+  double getDouble(const std::string & varName, int index1, int index2, int index3);
+  void setInt(const std::string & varName, int index1, int index2, int index3, int value);
+  void setDouble(const std::string & varName, int index1, int index2, int index3, double value);
+
+protected:
+
+  void testMascaretResult(int res, const std::string & functionName);
+
+  int _id;
+  bool _printing;
+
+};
+
+}
+
+#endif /* MASCARET_HXX_ */