From 1a6fe2978b4fc9dc3ffad173f932e7c4fd599d28 Mon Sep 17 00:00:00 2001
From: Laurent FACQ <laurent.facq@math.u-bordeaux.fr>
Date: Tue, 18 Jan 2022 12:34:20 +0100
Subject: [PATCH] Add grid->isInterfaceDomainBorder(interId or inter)

---
 src/core/Grid.cpp | 23 +++++++++++++++++++++++
 src/core/Grid.hpp | 18 ++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/src/core/Grid.cpp b/src/core/Grid.cpp
index d127f19..6151d52 100644
--- a/src/core/Grid.cpp
+++ b/src/core/Grid.cpp
@@ -233,6 +233,29 @@ bool Grid::hasVertexOnBorder(const int& interId,
   return hasVertexOnBord;
 }
 
+bool Grid::isInterfaceDomainBorder(const long& id)
+{
+  bitpit::Interface& inter = this->getInterface(id);
+  bitpit::Cell& cell = this->getCell(inter.getOwner());
+
+  if (inter.isBorder() && cell.isInterior())
+  {
+    return true;
+  }
+  return false;
+}
+
+bool Grid::isInterfaceDomainBorder(const bitpit::Interface& inter)
+{
+  bitpit::Cell& cell = this->getCell(inter.getOwner());
+  
+  if (inter.isBorder() && cell.isInterior())
+  {
+    return true;
+  }
+  return false;
+}
+
 bool Grid::isBorder(const long& id)
 {
 
diff --git a/src/core/Grid.hpp b/src/core/Grid.hpp
index 40b3f27..219b416 100644
--- a/src/core/Grid.hpp
+++ b/src/core/Grid.hpp
@@ -264,6 +264,24 @@ std::vector<int> getFaceVertexLocalIds(int face);
 bool hasVertexOnBorder(const int& interId,
                        int& interOnBorder);
 
+/**
+ * @brief Is the interface "interId" is a domain boundary cell ?
+ *
+ * @param[in] interId Global id of the interface
+ *
+ * @return True if the interface is on the domain boundary
+ */
+bool isInterfaceDomainBorder(const long& interId );
+
+/**
+ * @brief Is the interface "inter" a domain boundary cell ?
+ *
+ * @param[in] inter : the interface 
+ *
+ * @return True if the interface is on the domain boundary
+ */
+bool isInterfaceDomainBorder(const bitpit::Interface& inter);
+
 /**
  * @brief Is the cell "cellId" is a boundary cell ?
  *
-- 
GitLab