import os
import sys
import numpy as np

%matplotlib notebook
import matplotlib.pyplot as plt
from visualize import drawCoefficient, AllshapesSixdrawCoefficient

import buildcoef2d

bg = 0.05   #background
val = 1     #values
        
NWorldFine = np.array([11, 11])
NWorldFine2 = np.array([38,42]) 

"""
Explanation: Shapes for constructing diffusion coefficients
The coefficients that can be constructed with the 'buildcoef2d' class basically contain 6 main shapes. This script visualized all of them and once again presents the utilization of the class.
End of explanation
"""


CoefClass = buildcoef2d.Coefficient2d(NWorldFine, 
                                bg              = 0.05, 
                                val             = 1, 
                                length          = 7, 
                                thick           = 1, 
                                space           = 2, 
                                probfactor      = 1, 
                                right           = 1, 
                                down            = 0, 
                                diagr1          = 0, 
                                diagr2          = 0, 
                                diagl1          = 0, 
                                diagl2          = 0, 
                                BoundarySpace   = True)
                                                

CoefClass1 = buildcoef2d.Coefficient2d(NWorldFine, 
                                bg              = 0.05, 
                                val             = 1, 
                                length          = 7, 
                                thick           = 1, 
                                space           = 2, 
                                probfactor      = 1, 
                                right           = 0, 
                                down            = 1, 
                                diagr1          = 0, 
                                diagr2          = 0, 
                                diagl1          = 0, 
                                diagl2          = 0, 
                                BoundarySpace   = True)


CoefClass2 = buildcoef2d.Coefficient2d(NWorldFine, 
                                bg              = 0.05, 
                                val             = 1, 
                                length          = 6, 
                                thick           = 1, 
                                space           = 2, 
                                probfactor      = 1, 
                                right           = 0, 
                                down            = 0, 
                                diagr1          = 1, 
                                diagr2          = 0, 
                                diagl1          = 0, 
                                diagl2          = 0, 
                                BoundarySpace   = True)

CoefClass3 = buildcoef2d.Coefficient2d(NWorldFine, 
                                bg              = 0.05, 
                                val             = 1, 
                                length          = 6, 
                                thick           = 1, 
                                space           = 2, 
                                probfactor      = 1, 
                                right           = 0, 
                                down            = 0, 
                                diagr1          = 0, 
                                diagr2          = 1, 
                                diagl1          = 0, 
                                diagl2          = 0, 
                                BoundarySpace   = True)

CoefClass4 = buildcoef2d.Coefficient2d(NWorldFine, 
                                bg              = 0.05, 
                                val             = 1, 
                                length          = 6, 
                                thick           = 1, 
                                space           = 2, 
                                probfactor      = 1, 
                                right           = 0, 
                                down            = 0, 
                                diagr1          = 0, 
                                diagr2          = 0, 
                                diagl1          = 1, 
                                diagl2          = 0, 
                                BoundarySpace   = True)

CoefClass5 = buildcoef2d.Coefficient2d(NWorldFine, 
                                bg              = 0.05, 
                                val             = 1, 
                                length          = 6, 
                                thick           = 1, 
                                space           = 2, 
                                probfactor      = 1, 
                                right           = 0, 
                                down            = 0, 
                                diagr1          = 0, 
                                diagr2          = 0, 
                                diagl1          = 0, 
                                diagl2          = 1, 
                                BoundarySpace   = True)

CoefClass.BuildCoefficient()
CoefClass1.BuildCoefficient()
C = CoefClass2.BuildCoefficient()
D = CoefClass3.BuildCoefficient()
E = CoefClass4.BuildCoefficient()
F = CoefClass5.BuildCoefficient()

# modifications
A = CoefClass.SpecificVanish(Number=[0,2])
B = CoefClass1.SpecificVanish(Number=[0,2])

A1 = A.flatten()
A4 = B.flatten()
A2 = C.flatten()
A3 = D.flatten()
A5 = E.flatten()
A6 = F.flatten()

"""
Explanation: Coefficient classes for each shape
End of explanation
"""


plt.figure("Shape 1")
drawCoefficient(NWorldFine, A1)
plt.title("Shape 1")
plt.show()

plt.figure("Shape 2")
drawCoefficient(NWorldFine, A2)
plt.title("Shape 2")
plt.show()

plt.figure("Shape 3")
drawCoefficient(NWorldFine, A3)
plt.title("Shape 3")
plt.show()

plt.figure("Shape 4")
drawCoefficient(NWorldFine, A4)
plt.title("Shape 4")
plt.show()

plt.figure("Shape 5")
drawCoefficient(NWorldFine, A5)
plt.title("Shape 5")
plt.show()

plt.figure("Shape 6")
drawCoefficient(NWorldFine, A6)
plt.title("Shape 6")
plt.show()

"""
Explanation: Visualization
End of explanation
"""


plt.figure("All shapes")
AllshapesSixdrawCoefficient(NWorldFine, A1, A2, A3, A4, A5, A6)
plt.show()

"""
Explanation: All shapes
End of explanation
"""


