aboutsummaryrefslogtreecommitdiff
path: root/mg2d_boundary.h
diff options
context:
space:
mode:
Diffstat (limited to 'mg2d_boundary.h')
-rw-r--r--mg2d_boundary.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/mg2d_boundary.h b/mg2d_boundary.h
index 4a7dcee..12c897f 100644
--- a/mg2d_boundary.h
+++ b/mg2d_boundary.h
@@ -45,6 +45,10 @@ enum MG2DBCType {
*/
enum MG2DBoundaryLoc {
/**
+ * Undefined boundary location.
+ */
+ MG2D_BOUNDARY_NONE = -1,
+ /**
* coord0 lower
*/
MG2D_BOUNDARY_0L,
@@ -94,4 +98,28 @@ typedef struct MG2DBoundary {
MG2DBoundaryInternal *priv;
} MG2DBoundary;
+/**
+ * @return index of the coordinate that is kept constant along this boundary
+ * (x: 0, y: 1)
+ */
+int mg2d_bnd_coord_idx(enum MG2DBoundaryLoc loc);
+
+/**
+ * @return 1 if this is the upper boundary, 0 for the lower one
+ */
+int mg2d_bnd_is_upper(enum MG2DBoundaryLoc loc);
+
+/**
+ * @return 1 if the corresponding variable increases in the direction from the
+ * computational domain across the boundary, -1 if it decreases.
+ *
+ * @note this is equivalent to (mg2d_bnd_is_upper(loc) ? 1 : -1)
+ */
+int mg2d_bnd_out_dir(enum MG2DBoundaryLoc loc);
+
+/**
+ * Construct the boundary id from coordinate and upper/lower specification.
+ */
+enum MG2DBoundaryLoc mg2d_bnd_id(int coord_idx, int is_upper);
+
#endif // MG2D_BOUNDARY_H