Subdomain whit diferents tensor in linear elasticity

I am creating a linear elasticity model, in this, i have diferent subdomains and i need to assign a particular elasticity Tensor (1 material is an isotropic material and one anisotropic)
I have trying to do this like if i asiggns diferent material properties to the subdomain, but it dont work…

The code is:

from dolfin import*
from mshr import*
from fenics import*
from ufl import nabla_div
import numpy as np

mesh = Mesh("Brillador_norajo.xml")
#plot(mesh)
cd=MeshFunction('size_t',mesh,"Brillador_norajo_physical_region.xml")
#plot(cd)

alfa=30
a=alfa*np.pi/180
G=5
nu=0.3
R=2.5
Ex=30
Ey=Ex/R
E=30

a11 = np.sin(a)**4/Ey + np.cos(a)**4/Ex + np.sin(2*a)**2*0.25*(1/G-2*nu/Ey)
a12 = np.sin(2*a)**2*0.25*(Ey**-1+Ex**-1-G**-1)-nu*Ey**-1*(np.cos(a)**4+np.sin(a)**4)
a16 = np.sin(2*a)*((np.sin(a)**2/Ey-np.cos(a)**2/Ex)+(0.5*G**-1-nu*Ex**-1)*np.cos(2*a))
a22 = np.cos(a)**4/Ey+np.sin(a)**4/Ex+np.sin(2*a)**2/4*(G**-1-2*nu/Ey)
a26 = np.sin(2*a)*((np.cos(a)**2/Ey-np.sin(a)**2/Ex)-(0.5/G-nu/Ey)*np.cos(2*a))
a66 = np.sin(2*a)**2*(1/Ey+1/Ex+2*nu/Ey)+np.cos(2*a)**2/G

T1=as_matrix([[a11,a12,a16],[a12,a22,a26],[a16,a26,a66]])
T2=as_matrix([[1./E,-nu/E,0.],[-nu/E,1./E,0.],[0.,0.,1./G]])


class Tensor(UserExpression): # UserExpression instead of Expression
    def __init__(self, markers, **kwargs):
        super().__init__(**kwargs) # This part is new!
        self.markers = markers
    def eval_cell(self, values, x, cell):
        if self.markers[cell.index] == 1:
            values[0] = T2
        elif self.markers[cell.index] ==2:
            values[0] = T1
        elif self.markers[cell.index] ==3:
            values[0] = T2
        elif self.markers[cell.index] ==4:
            values[0] = T1
        else:
            values[0] = T2
S=Tensor(cd,degree=0)
C = inv(S)
x_max = 969.3292
def eps(v):
  return sym(grad(v))
def strain2voigt(e):
#"""e is a 2nd-order tensor, returns its Voigt vectorial representation"""
  return as_vector([e[0,0],e[1,1],2*e[0,1]])
def voigt2stress(s):
#"""
#s is a stress-like vector (no 2 factor on last component)
#returns its tensorial representation
#"""
  return as_tensor([[s[0], s[2]],
  [s[2], s[1]]])
def sigma(v):
  return voigt2stress(dot(C, strain2voigt(eps(v))))

I hope you can help me please

the error whit this code is:

Dot product requires non-scalar arguments, got arguments with ranks 0 and 1.
Traceback (most recent call last):
 File "Ani_Dir2.py", line 95, in <module>
   a = inner(sigma(du), eps(u_))*dx
 File "Ani_Dir2.py", line 63, in sigma
   return voigt2stress(dot(C, strain2voigt(eps(v))))
 File "/home/nicolas/anaconda3/envs/fenics2018/lib/python3.7/site-packages/ufl/operators.py", line 162, in dot
   return Dot(a, b)
 File "/home/nicolas/anaconda3/envs/fenics2018/lib/python3.7/site-packages/ufl/tensoralgebra.py", line 204, in __new__
   "got arguments with ranks %d and %d." % (ar, br))
 File "/home/nicolas/anaconda3/envs/fenics2018/lib/python3.7/site-packages/ufl/log.py", line 172, in error
   raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: Dot product requires non-scalar arguments, got arguments with ranks 0 and 1.

Please make sure that your code snippets are reproducible, i.e. that they can be executed by anyone and produce the error message. Currently, your code uses a built in mesh, and does not have the necessary definitions to reproduce the error