# Path: gprMax/constants.py

# 
# Path: gprMax/constants.py

# 
# Path: gprMax/grid.py
# def Ix(x, y, z, Hx, Hy, Hz, G):
#     """Calculates the x-component of current at a grid position.
# 
#     Args:
#         x, y, z (float): Coordinates of position in grid.
#         Hx, Hy, Hz (memory view): numpy array of magnetic field values.
#         G (class): Grid class instance - holds essential parameters describing the model.
#     """
# 
#     if y == 0 or z == 0:
#         Ix = 0
#     else:
#         Ix = G.dy * (Hy[x, y, z - 1] - Hy[x, y, z]) + G.dz * (Hz[x, y, z] - Hz[x, y - 1, z])
# 
#     return Ix
# 
# Path: gprMax/grid.py
# def Iy(x, y, z, Hx, Hy, Hz, G):
#     """Calculates the y-component of current at a grid position.
# 
#     Args:
#         x, y, z (float): Coordinates of position in grid.
#         Hx, Hy, Hz (memory view): numpy array of magnetic field values.
#         G (class): Grid class instance - holds essential parameters describing the model.
#     """
# 
#     if x == 0 or z == 0:
#         Iy = 0
#     else:
#         Iy = G.dx * (Hx[x, y, z] - Hx[x, y, z - 1]) + G.dz * (Hz[x - 1, y, z] - Hz[x, y, z])
# 
#     return Iy
# 
# Path: gprMax/grid.py
# def Iz(x, y, z, Hx, Hy, Hz, G):
#     """Calculates the z-component of current at a grid position.
# 
#     Args:
#         x, y, z (float): Coordinates of position in grid.
#         Hx, Hy, Hz (memory view): numpy array of magnetic field values.
#         G (class): Grid class instance - holds essential parameters describing the model.
#     """
# 
#     if x == 0 or y == 0:
#         Iz = 0
#     else:
#         Iz = G.dx * (Hx[x, y - 1, z] - Hx[x, y, z]) + G.dy * (Hy[x, y, z] - Hy[x - 1, y, z])
# 
#     return Iz
# 
# Path: gprMax/utilities.py
# def round_value(value, decimalplaces=0):
#     """Rounding function.
# 
#     Args:
#         value (float): Number to round.
#         decimalplaces (int): Number of decimal places of float to represent rounded value.
# 
#     Returns:
#         rounded (int/float): Rounded value.
#     """
# 
#     # Rounds to nearest integer (half values are rounded downwards)
#     if decimalplaces == 0:
#         rounded = int(d.Decimal(value).quantize(d.Decimal('1'), rounding=d.ROUND_HALF_DOWN))
# 
#     # Rounds down to nearest float represented by number of decimal places
#     else:
#         precision = '1.{places}'.format(places='0' * decimalplaces)
#         rounded = float(d.Decimal(value).quantize(d.Decimal(precision), rounding=d.ROUND_FLOOR))
# 
#     return rounded


from copy import deepcopy
from gprMax.constants import c
from gprMax.constants import floattype
from gprMax.grid import Ix
from gprMax.grid import Iy
from gprMax.grid import Iz
from gprMax.utilities import round_value
import numpy as np
    import pycuda.gpuarray as gpuarray
        self.nl = round_value(0.667 * G.iterations)

        # Cell position of the one-way injector excitation in the transmission line
        self.srcpos = 5

        # Cell position of where line connects to antenna/main grid
        self.antpos = 10

        # Voltage values along the line
        self.voltage = np.zeros(self.nl, dtype=floattype)

        # Current values along the line
        self.current = np.zeros(self.nl, dtype=floattype)

        # Total (incident and scattered) voltage and current
        self.Vtotal = np.zeros(G.iterations, dtype=floattype)
        self.Itotal = np.zeros(G.iterations, dtype=floattype)

    def calculate_incident_V_I(self, G):
        """
        Calculates the incident voltage and current with a long length
            transmission line, initially not connected to the main grid from: 
            http://dx.doi.org/10.1002/mop.10415. Incident voltage and current,
            are only used to calculate s-parameters after the simulation has
            run.

        Args:
            G (class): Grid class instance - holds essential parameters describing the model.
        """


# Path: gprMax/constants.py

# 
# Path: gprMax/constants.py

# 
# Path: gprMax/grid.py
# def Ix(x, y, z, Hx, Hy, Hz, G):
#     """Calculates the x-component of current at a grid position.
# 
#     Args:
#         x, y, z (float): Coordinates of position in grid.
#         Hx, Hy, Hz (memory view): numpy array of magnetic field values.
#         G (class): Grid class instance - holds essential parameters describing the model.
#     """
# 
#     if y == 0 or z == 0:
#         Ix = 0
#     else:
#         Ix = G.dy * (Hy[x, y, z - 1] - Hy[x, y, z]) + G.dz * (Hz[x, y, z] - Hz[x, y - 1, z])
# 
#     return Ix
# 
# Path: gprMax/grid.py
# def Iy(x, y, z, Hx, Hy, Hz, G):
#     """Calculates the y-component of current at a grid position.
# 
#     Args:
#         x, y, z (float): Coordinates of position in grid.
#         Hx, Hy, Hz (memory view): numpy array of magnetic field values.
#         G (class): Grid class instance - holds essential parameters describing the model.
#     """
# 
#     if x == 0 or z == 0:
#         Iy = 0
#     else:
#         Iy = G.dx * (Hx[x, y, z] - Hx[x, y, z - 1]) + G.dz * (Hz[x - 1, y, z] - Hz[x, y, z])
# 
#     return Iy
# 
# Path: gprMax/grid.py
# def Iz(x, y, z, Hx, Hy, Hz, G):
#     """Calculates the z-component of current at a grid position.
# 
#     Args:
#         x, y, z (float): Coordinates of position in grid.
#         Hx, Hy, Hz (memory view): numpy array of magnetic field values.
#         G (class): Grid class instance - holds essential parameters describing the model.
#     """
# 
#     if x == 0 or y == 0:
#         Iz = 0
#     else:
#         Iz = G.dx * (Hx[x, y - 1, z] - Hx[x, y, z]) + G.dy * (Hy[x, y, z] - Hy[x - 1, y, z])
# 
#     return Iz
# 
# Path: gprMax/utilities.py
# def round_value(value, decimalplaces=0):
#     """Rounding function.
# 
#     Args:
#         value (float): Number to round.
#         decimalplaces (int): Number of decimal places of float to represent rounded value.
# 
#     Returns:
#         rounded (int/float): Rounded value.
#     """
# 
#     # Rounds to nearest integer (half values are rounded downwards)
#     if decimalplaces == 0:
#         rounded = int(d.Decimal(value).quantize(d.Decimal('1'), rounding=d.ROUND_HALF_DOWN))
# 
#     # Rounds down to nearest float represented by number of decimal places
#     else:
#         precision = '1.{places}'.format(places='0' * decimalplaces)
#         rounded = float(d.Decimal(value).quantize(d.Decimal(precision), rounding=d.ROUND_FLOOR))
# 
#     return rounded


# Path: gprMax/sources.py
from copy import deepcopy
from gprMax.constants import c
from gprMax.constants import floattype
from gprMax.grid import Ix
from gprMax.grid import Iy
from gprMax.grid import Iz
from gprMax.utilities import round_value
import numpy as np
    import pycuda.gpuarray as gpuarray

        self.nl = round_value(0.667 * G.iterations)

        # Cell position of the one-way injector excitation in the transmission line
        self.srcpos = 5

        # Cell position of where line connects to antenna/main grid
        self.antpos = 10

        # Voltage values along the line
        self.voltage = np.zeros(self.nl, dtype=floattype)

        # Current values along the line
        self.current = np.zeros(self.nl, dtype=floattype)

        # Total (incident and scattered) voltage and current
        self.Vtotal = np.zeros(G.iterations, dtype=floattype)
        self.Itotal = np.zeros(G.iterations, dtype=floattype)

    def calculate_incident_V_I(self, G):
        """
        Calculates the incident voltage and current with a long length
            transmission line, initially not connected to the main grid from: 
            http://dx.doi.org/10.1002/mop.10415. Incident voltage and current,
            are only used to calculate s-parameters after the simulation has
            run.

        Args:
            G (class): Grid class instance - holds essential parameters describing the model.
        """


        self.Vinc = np.zeros(G.iterations, dtype=floattype)