From a179320694adfd035dd04efb1526db820dd93b45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com>
Date: Sat, 20 May 2023 09:10:36 +0200
Subject: [PATCH] Add inflow and outflow boundary condition descriptors

---
 src/scheme/IBoundaryConditionDescriptor.hpp   |  2 +
 .../InflowBoundaryConditionDescriptor.hpp     | 55 +++++++++++++++++++
 .../OutflowBoundaryConditionDescriptor.hpp    | 46 ++++++++++++++++
 3 files changed, 103 insertions(+)
 create mode 100644 src/scheme/InflowBoundaryConditionDescriptor.hpp
 create mode 100644 src/scheme/OutflowBoundaryConditionDescriptor.hpp

diff --git a/src/scheme/IBoundaryConditionDescriptor.hpp b/src/scheme/IBoundaryConditionDescriptor.hpp
index f99eff935..1350aa4db 100644
--- a/src/scheme/IBoundaryConditionDescriptor.hpp
+++ b/src/scheme/IBoundaryConditionDescriptor.hpp
@@ -16,7 +16,9 @@ class IBoundaryConditionDescriptor
     fourier,
     fixed,
     free,
+    inflow,
     neumann,
+    outflow,
     symmetry
   };
 
diff --git a/src/scheme/InflowBoundaryConditionDescriptor.hpp b/src/scheme/InflowBoundaryConditionDescriptor.hpp
new file mode 100644
index 000000000..e648c1593
--- /dev/null
+++ b/src/scheme/InflowBoundaryConditionDescriptor.hpp
@@ -0,0 +1,55 @@
+#ifndef INFLOW_BOUNDARY_CONDITION_DESCRIPTOR_HPP
+#define INFLOW_BOUNDARY_CONDITION_DESCRIPTOR_HPP
+
+#include <language/utils/FunctionSymbolId.hpp>
+#include <mesh/IBoundaryDescriptor.hpp>
+#include <scheme/IBoundaryConditionDescriptor.hpp>
+
+#include <memory>
+
+class InflowBoundaryConditionDescriptor : public IBoundaryConditionDescriptor
+{
+ private:
+  std::ostream&
+  _write(std::ostream& os) const final
+  {
+    os << "inflow(" << ',' << *m_boundary_descriptor << ")";
+    return os;
+  }
+
+  std::shared_ptr<const IBoundaryDescriptor> m_boundary_descriptor;
+  const FunctionSymbolId m_function_symbol_id;
+
+ public:
+  FunctionSymbolId
+  functionSymbolId() const
+  {
+    return m_function_symbol_id;
+  }
+
+  const IBoundaryDescriptor&
+  boundaryDescriptor() const final
+  {
+    return *m_boundary_descriptor;
+  }
+
+  Type
+  type() const final
+  {
+    return Type::inflow;
+  }
+
+  InflowBoundaryConditionDescriptor(std::shared_ptr<const IBoundaryDescriptor> boundary_descriptor,
+                                    const FunctionSymbolId& function_symbol_id)
+    : m_boundary_descriptor(boundary_descriptor), m_function_symbol_id{function_symbol_id}
+  {
+    ;
+  }
+
+  InflowBoundaryConditionDescriptor(const InflowBoundaryConditionDescriptor&) = delete;
+  InflowBoundaryConditionDescriptor(InflowBoundaryConditionDescriptor&&)      = delete;
+
+  ~InflowBoundaryConditionDescriptor() = default;
+};
+
+#endif   // INFLOW_BOUNDARY_CONDITION_DESCRIPTOR_HPP
diff --git a/src/scheme/OutflowBoundaryConditionDescriptor.hpp b/src/scheme/OutflowBoundaryConditionDescriptor.hpp
new file mode 100644
index 000000000..83ef7a775
--- /dev/null
+++ b/src/scheme/OutflowBoundaryConditionDescriptor.hpp
@@ -0,0 +1,46 @@
+#ifndef OUTFLOW_BOUNDARY_CONDITION_DESCRIPTOR_HPP
+#define OUTFLOW_BOUNDARY_CONDITION_DESCRIPTOR_HPP
+
+#include <mesh/IBoundaryDescriptor.hpp>
+#include <scheme/IBoundaryConditionDescriptor.hpp>
+
+#include <memory>
+
+class OutflowBoundaryConditionDescriptor : public IBoundaryConditionDescriptor
+{
+ private:
+  std::ostream&
+  _write(std::ostream& os) const final
+  {
+    os << "outflow(" << *m_boundary_descriptor << ")";
+    return os;
+  }
+
+  std::shared_ptr<const IBoundaryDescriptor> m_boundary_descriptor;
+
+ public:
+  const IBoundaryDescriptor&
+  boundaryDescriptor() const final
+  {
+    return *m_boundary_descriptor;
+  }
+
+  Type
+  type() const final
+  {
+    return Type::outflow;
+  }
+
+  OutflowBoundaryConditionDescriptor(std::shared_ptr<const IBoundaryDescriptor> boundary_descriptor)
+    : m_boundary_descriptor(boundary_descriptor)
+  {
+    ;
+  }
+
+  OutflowBoundaryConditionDescriptor(const OutflowBoundaryConditionDescriptor&) = delete;
+  OutflowBoundaryConditionDescriptor(OutflowBoundaryConditionDescriptor&&)      = delete;
+
+  ~OutflowBoundaryConditionDescriptor() = default;
+};
+
+#endif   // OUTFLOW_BOUNDARY_CONDITION_DESCRIPTOR_HPP
-- 
GitLab