# Path: gprMax/constants.py

# 
# Path: gprMax/constants.py

# 
# Path: gprMax/constants.py

# 
# Path: gprMax/exceptions.py
# class GeneralError(ValueError):
#     """Handles general errors. Subclasses the ValueError class."""
# 
#     def __init__(self, message, *args):
# 
#         self.message = message
#         super(GeneralError, self).__init__(message, *args)
#         print(Fore.RED)


from importlib import import_module
from tqdm import tqdm
from gprMax.constants import e0
from gprMax.constants import z0
from gprMax.constants import floattype
from gprMax.exceptions import GeneralError
import numpy as np
        import pycuda.gpuarray as gpuarray
            if not cfs.sigma.max:
                cfs.calculate_sigmamax(self.d, er, mr, G)
            Ealpha, Halpha = cfs.calculate_values(self.thickness, cfs.alpha)
            Ekappa, Hkappa = cfs.calculate_values(self.thickness, cfs.kappa)
            Esigma, Hsigma = cfs.calculate_values(self.thickness, cfs.sigma)

            # Define different parameters depending on PML formulation
            if G.pmlformulation == 'HORIPML':
                # HORIPML electric update coefficients
                tmp = (2 * e0 * Ekappa) + G.dt * (Ealpha * Ekappa + Esigma)
                self.ERA[x, :] = (2 * e0 + G.dt * Ealpha) / tmp
                self.ERB[x, :] = (2 * e0 * Ekappa) / tmp
                self.ERE[x, :] = ((2 * e0 * Ekappa) - G.dt * (Ealpha * Ekappa + Esigma)) / tmp
                self.ERF[x, :] = (2 * Esigma * G.dt) / (Ekappa * tmp)

                # HORIPML magnetic update coefficients
                tmp = (2 * e0 * Hkappa) + G.dt * (Halpha * Hkappa + Hsigma)
                self.HRA[x, :] = (2 * e0 + G.dt * Halpha) / tmp
                self.HRB[x, :] = (2 * e0 * Hkappa) / tmp
                self.HRE[x, :] = ((2 * e0 * Hkappa) - G.dt * (Halpha * Hkappa + Hsigma)) / tmp
                self.HRF[x, :] = (2 * Hsigma * G.dt) / (Hkappa * tmp)

            elif G.pmlformulation == 'MRIPML':
                tmp = 2 * e0 + G.dt * Ealpha
                self.ERA[x, :] = Ekappa + (G.dt * Esigma) / tmp
                self.ERB[x, :] = (2 * e0) / tmp
                self.ERE[x, :] = ((2 * e0) - G.dt * Ealpha) / tmp
                self.ERF[x, :] = (2 * Esigma * G.dt) / tmp

                # MRIPML magnetic update coefficients

# Path: gprMax/constants.py

# 
# Path: gprMax/constants.py

# 
# Path: gprMax/constants.py

# 
# Path: gprMax/exceptions.py
# class GeneralError(ValueError):
#     """Handles general errors. Subclasses the ValueError class."""
# 
#     def __init__(self, message, *args):
# 
#         self.message = message
#         super(GeneralError, self).__init__(message, *args)
#         print(Fore.RED)


# Path: gprMax/pml.py
from importlib import import_module
from tqdm import tqdm
from gprMax.constants import e0
from gprMax.constants import z0
from gprMax.constants import floattype
from gprMax.exceptions import GeneralError
import numpy as np
        import pycuda.gpuarray as gpuarray

            if not cfs.sigma.max:
                cfs.calculate_sigmamax(self.d, er, mr, G)
            Ealpha, Halpha = cfs.calculate_values(self.thickness, cfs.alpha)
            Ekappa, Hkappa = cfs.calculate_values(self.thickness, cfs.kappa)
            Esigma, Hsigma = cfs.calculate_values(self.thickness, cfs.sigma)

            # Define different parameters depending on PML formulation
            if G.pmlformulation == 'HORIPML':
                # HORIPML electric update coefficients
                tmp = (2 * e0 * Ekappa) + G.dt * (Ealpha * Ekappa + Esigma)
                self.ERA[x, :] = (2 * e0 + G.dt * Ealpha) / tmp
                self.ERB[x, :] = (2 * e0 * Ekappa) / tmp
                self.ERE[x, :] = ((2 * e0 * Ekappa) - G.dt * (Ealpha * Ekappa + Esigma)) / tmp
                self.ERF[x, :] = (2 * Esigma * G.dt) / (Ekappa * tmp)

                # HORIPML magnetic update coefficients
                tmp = (2 * e0 * Hkappa) + G.dt * (Halpha * Hkappa + Hsigma)
                self.HRA[x, :] = (2 * e0 + G.dt * Halpha) / tmp
                self.HRB[x, :] = (2 * e0 * Hkappa) / tmp
                self.HRE[x, :] = ((2 * e0 * Hkappa) - G.dt * (Halpha * Hkappa + Hsigma)) / tmp
                self.HRF[x, :] = (2 * Hsigma * G.dt) / (Hkappa * tmp)

            elif G.pmlformulation == 'MRIPML':
                tmp = 2 * e0 + G.dt * Ealpha
                self.ERA[x, :] = Ekappa + (G.dt * Esigma) / tmp
                self.ERB[x, :] = (2 * e0) / tmp
                self.ERE[x, :] = ((2 * e0) - G.dt * Ealpha) / tmp
                self.ERF[x, :] = (2 * Esigma * G.dt) / tmp

                # MRIPML magnetic update coefficients

                tmp = 2 * e0 + G.dt * Halpha