From 86b0193c294cfa299250fcb90e032e26f979f6bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=BChle=2C=20Laura=20Christine=20=28lakue103=29?=
 <laura.kuehle@uni-duesseldorf.de>
Date: Fri, 23 Sep 2022 13:24:59 +0200
Subject: [PATCH] Adjusted one-sided Heaviside class to have non-symmetric
 values.

---
 Initial_Condition.py | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/Initial_Condition.py b/Initial_Condition.py
index d6aad0c..cb03f31 100644
--- a/Initial_Condition.py
+++ b/Initial_Condition.py
@@ -127,7 +127,7 @@ class Sine(InitialCondition):
     Attributes
     ----------
     factor : float
-        Factor by which is the evaluation point is multiplied before applying
+        Factor by which the evaluation point is multiplied before applying
         sine.
 
     Methods
@@ -335,7 +335,7 @@ class Linear(InitialCondition):
     Attributes
     ----------
     factor : float
-        Factor by which is the evaluation point is multiplied.
+        Factor by which the evaluation point is multiplied.
 
     Methods
     -------
@@ -393,7 +393,7 @@ class LinearAbsolut(InitialCondition):
     Attributes
     ----------
     factor : float
-        Factor by which is the evaluation point is multiplied.
+        Factor by which the evaluation point is multiplied.
 
     Methods
     -------
@@ -459,9 +459,9 @@ class DiscontinuousConstant(InitialCondition):
     x0 : float
         X-value where jump is induced.
     left_factor : float
-        Factor by which is the evaluation point is multiplied before the jump.
+        Factor by which the evaluation point is multiplied before the jump.
     right_factor : float
-        Factor by which is the evaluation point is multiplied after the jump.
+        Factor by which the evaluation point is multiplied after the jump.
 
     Methods
     -------
@@ -513,7 +513,7 @@ class Polynomial(InitialCondition):
     Attributes
     ----------
     factor : float
-        Factor by which is the evaluation point is multiplied.
+        Factor by which the evaluation point is multiplied.
     exponential : int
         Degree of the polynomial.
 
@@ -575,7 +575,7 @@ class Continuous(InitialCondition):
     Attributes
     ----------
     factor : float
-        Factor by which is the evaluation point is multiplied.
+        Factor by which the evaluation point is multiplied.
 
     Methods
     -------
@@ -632,8 +632,10 @@ class HeavisideOneSided(InitialCondition):
 
     Attributes
     ----------
-    factor : float
-        Factor by which is the evaluation point is multiplied.
+    left_factor : float
+        Factor by which the evaluation point is multiplied before the jump.
+    right_factor : float
+        Factor by which the evaluation point is multiplied after the jump.
 
     Methods
     -------
@@ -655,7 +657,8 @@ class HeavisideOneSided(InitialCondition):
         super()._reset(config)
 
         # Unpack necessary configurations
-        self._factor = config.pop('factor', -1)
+        self._left_factor = config.pop('factor', 1)
+        self._right_factor = config.pop('factor', 2)
 
     def is_smooth(self):
         """Returns flag that function is not smooth."""
@@ -670,8 +673,10 @@ class HeavisideOneSided(InitialCondition):
             Fixed parameters for initial condition.
 
         """
-        factor = config.pop('factor', np.random.choice([-100, 100]))
-        config = {'factor': factor}
+        left_factor = config.pop('left_factor', np.random.choice([-100, 100]))
+        right_factor = config.pop('right_factor',
+                                  np.random.choice([-100, 100]))
+        config = {'left_factor': left_factor, 'right_factor': right_factor}
         self._reset(config)
 
     def _get_point(self, x):
@@ -688,7 +693,8 @@ class HeavisideOneSided(InitialCondition):
             Value of function evaluates at x-value.
 
         """
-        return self._factor - 2 * self._factor * np.heaviside(x, 0)
+        return self._left_factor + \
+            (self._right_factor - self._left_factor) * np.heaviside(x, 0)
 
 
 class HeavisideTwoSided(InitialCondition):
@@ -697,9 +703,9 @@ class HeavisideTwoSided(InitialCondition):
     Attributes
     ----------
     left_factor : float
-        Factor by which is the evaluation point is multiplied before the jump.
+        Factor by which the evaluation point is multiplied before the jump.
     right_factor : float
-        Factor by which is the evaluation point is multiplied after the jump.
+        Factor by which the evaluation point is multiplied after the jump.
     adjustment : float
         Extent of adjustment of evaluation point in x-direction.
 
-- 
GitLab