Functions | |
def | constant_scalar |
def | L2_scalar |
def | H1_semi_scalar |
def | H1_scalar |
def | constant_vector |
def | constant_source_vector |
def | source_vector |
def | load_vector |
def | constant_matrix |
def | mass_matrix |
def | mass_with_c_matrix |
def | stiffness_matrix |
def | stiffness_with_M_matrix |
def | mass_boundary_matrix |
def | check |
def | form_name |
Variables | |
list | scalar_forms = [constant_scalar, L2_scalar, H1_semi_scalar, H1_scalar] |
list | vector_forms = [constant_vector, constant_source_vector, source_vector] |
list | matrix_forms = [constant_matrix, mass_matrix, mass_with_c_matrix, stiffness_matrix, stiffness_with_M_matrix] |
tuple | args = set(sys.argv[1:]) |
string | print_forms = "p" |
string | generate = "g" |
string | compile = "c" |
int | quad_order = 3 |
int | formcount = 0 |
dictionary | polygon = { 2: "triangle", 3: "tetrahedron" } |
tuple | fe0 = FiniteElement("P0", polygon, 0) |
tuple | fe1 = FiniteElement("Lagrange", polygon, 1) |
tuple | fe2 = FiniteElement("Lagrange", polygon, 2) |
list | scalar_elements = [fe0, fe1, fe2] |
tuple | vfe0 = VectorElement("P0", polygon, 0) |
tuple | vfe1 = VectorElement("Lagrange", polygon, 1) |
tuple | vfe2 = VectorElement("Lagrange", polygon, 2) |
list | vector_elements = [vfe0, vfe1, vfe2] |
tuple | tfe0 = TensorElement("P0", polygon, 0) |
tuple | tfe1 = TensorElement("Lagrange", polygon, 1) |
tuple | tfe2 = TensorElement("Lagrange", polygon, 2) |
list | tensor_elements = [tfe0, tfe1, tfe2] |
all_elements = scalar_elements+vector_elements+tensor_elements | |
dictionary | options = { "symbolic": symbolic, "quad_order": quad_order } |
callback = L2_scalar | |
list | basisfunctions = [] |
list | coefficients = [Function(fe)] |
tuple | form = Form(name=form_name(callback), basisfunctions=basisfunctions, coefficients=coefficients, cell_integrands=[callback], options=options) |
def sfc_callbacks::callback_forms::check | ( | form | ) |
Definition at line 116 of file callback_forms.py.
00116 : 00117 form.sanity_check() 00118 if print_forms: 00119 print form 00120 if generate or compile: 00121 if compile: 00122 compiled_form = compile_form(form) 00123 print "Successfully compiled form:" 00124 print compiled_form 00125 print dir(compiled_form) 00126 else: 00127 res = write_ufc_code(form) 00128 print "Successfully generated form code:" 00129 print res 00130 quad_order = 3
def sfc_callbacks::callback_forms::constant_matrix | ( | v, | ||
u, | ||||
itg | ||||
) |
a(v, u; ) = \int 1 dx
Definition at line 64 of file callback_forms.py.
00064 : 00065 """a(v, u; ) = \int 1 dx""" 00066 return numeric(1) 00067 def mass_matrix(v, u, itg):
def sfc_callbacks::callback_forms::constant_scalar | ( | itg | ) |
def sfc_callbacks::callback_forms::constant_source_vector | ( | v, | ||
itg | ||||
) |
a(v;) = \int v dx
Definition at line 42 of file callback_forms.py.
00042 : 00043 """a(v;) = \int v dx""" 00044 return v 00045 def source_vector(v, f, itg):
def sfc_callbacks::callback_forms::constant_vector | ( | v, | ||
itg | ||||
) |
a(v;) = \int 1 dx
Definition at line 38 of file callback_forms.py.
00038 : 00039 """a(v;) = \int 1 dx""" 00040 return numeric(1) 00041 def constant_source_vector(v, itg):
def sfc_callbacks::callback_forms::form_name | ( | callback | ) |
Definition at line 134 of file callback_forms.py.
00134 : 00135 global formcount 00136 name = "form_%s_%d" % (get_callable_name(callback), formcount) 00137 formcount += 1 00138 return name 00139 for nsd in [2, 3]:
def sfc_callbacks::callback_forms::H1_scalar | ( | w, | ||
itg | ||||
) |
a(;w) = \int w^2 + grad(w)^2 dx
Definition at line 26 of file callback_forms.py.
00026 : 00027 """a(;w) = \int w^2 + grad(w)^2 dx""" 00028 GinvT = itg.GinvT() 00029 Dw = grad(w, GinvT) 00030 return inner(w, w) + inner(Dw, Dw) 00031 scalar_forms = [constant_scalar, L2_scalar, H1_semi_scalar, H1_scalar]
def sfc_callbacks::callback_forms::H1_semi_scalar | ( | w, | ||
itg | ||||
) |
a(;w) = \int grad(w)^2 dx
Definition at line 20 of file callback_forms.py.
00020 : 00021 """a(;w) = \int grad(w)^2 dx""" 00022 GinvT = itg.GinvT() 00023 Dw = grad(w, GinvT) 00024 return inner(Dw, Dw) 00025 def H1_scalar(w, itg):
def sfc_callbacks::callback_forms::L2_scalar | ( | w, | ||
itg | ||||
) |
a(;w) = \int w^2 dx
Definition at line 16 of file callback_forms.py.
00016 : 00017 """a(;w) = \int w^2 dx""" 00018 return inner(w, w) 00019 def H1_semi_scalar(w, itg):
def sfc_callbacks::callback_forms::load_vector | ( | v, | ||
t, | ||||
itg | ||||
) |
a(v; t) = \int t . v dx
Definition at line 57 of file callback_forms.py.
00057 : 00058 """a(v; t) = \int t . v dx""" 00059 return inner(t, v) 00060 00061 00062 # ----------------------------------------------- Matrix forms: 00063 def constant_matrix(v, u, itg):
def sfc_callbacks::callback_forms::mass_boundary_matrix | ( | v, | ||
u, | ||||
itg | ||||
) |
a(v, u; ) = \int u . v ds
Definition at line 94 of file callback_forms.py.
00094 : 00095 """a(v, u; ) = \int u . v ds""" 00096 return inner(v, u) 00097 00098 00099 00100 # ----------------------------------------------- Testing: 00101 00102 if __name__ == "__main__":
def sfc_callbacks::callback_forms::mass_matrix | ( | v, | ||
u, | ||||
itg | ||||
) |
a(v, u; ) = \int u . v dx
Definition at line 68 of file callback_forms.py.
00068 : 00069 """a(v, u; ) = \int u . v dx""" 00070 return inner(v, u) 00071 def mass_with_c_matrix(v, u, c, itg):
def sfc_callbacks::callback_forms::mass_with_c_matrix | ( | v, | ||
u, | ||||
c, | ||||
itg | ||||
) |
a(v, u; c) = \int c (u . v) dx
Definition at line 72 of file callback_forms.py.
00072 : 00073 """a(v, u; c) = \int c (u . v) dx""" 00074 return c * inner(v, u) 00075 def stiffness_matrix(v, u, itg):
def sfc_callbacks::callback_forms::source_vector | ( | v, | ||
f, | ||||
itg | ||||
) |
a(v; f) = \int f . v dx
Definition at line 46 of file callback_forms.py.
00046 : 00047 """a(v; f) = \int f . v dx""" 00048 return inner(f, v) 00049 00050 vector_forms = [constant_vector, constant_source_vector, source_vector]
def sfc_callbacks::callback_forms::stiffness_matrix | ( | v, | ||
u, | ||||
itg | ||||
) |
Definition at line 76 of file callback_forms.py.
00076 : 00077 GinvT = itg.GinvT() 00078 Du = grad(u, GinvT) 00079 Dv = grad(v, GinvT) 00080 return inner(Du, Dv) 00081 def stiffness_with_M_matrix(v, u, M, itg):
def sfc_callbacks::callback_forms::stiffness_with_M_matrix | ( | v, | ||
u, | ||||
M, | ||||
itg | ||||
) |
Definition at line 82 of file callback_forms.py.
00082 : 00083 GinvT = itg.GinvT() 00084 Du = grad(u, GinvT) 00085 Dv = grad(v, GinvT) 00086 return inner(M * Du, Dv) 00087 matrix_forms = [constant_matrix, mass_matrix, mass_with_c_matrix, stiffness_matrix, stiffness_with_M_matrix]
Definition at line 164 of file callback_forms.py.
tuple sfc_callbacks::callback_forms::args = set(sys.argv[1:]) |
Definition at line 110 of file callback_forms.py.
Definition at line 179 of file callback_forms.py.
sfc_callbacks::callback_forms::callback = L2_scalar |
Definition at line 178 of file callback_forms.py.
list sfc_callbacks::callback_forms::coefficients = [Function(fe)] |
Definition at line 180 of file callback_forms.py.
string sfc_callbacks::callback_forms::compile = "c" |
Definition at line 114 of file callback_forms.py.
tuple sfc_callbacks::callback_forms::fe0 = FiniteElement("P0", polygon, 0) |
Definition at line 144 of file callback_forms.py.
tuple sfc_callbacks::callback_forms::fe1 = FiniteElement("Lagrange", polygon, 1) |
Definition at line 145 of file callback_forms.py.
tuple sfc_callbacks::callback_forms::fe2 = FiniteElement("Lagrange", polygon, 2) |
Definition at line 146 of file callback_forms.py.
Referenced by check_CrouzeixRaviart(), and main().
tuple sfc_callbacks::callback_forms::form = Form(name=form_name(callback), basisfunctions=basisfunctions, coefficients=coefficients, cell_integrands=[callback], options=options) |
Definition at line 181 of file callback_forms.py.
Definition at line 133 of file callback_forms.py.
string sfc_callbacks::callback_forms::generate = "g" |
Definition at line 113 of file callback_forms.py.
list sfc_callbacks::callback_forms::matrix_forms = [constant_matrix, mass_matrix, mass_with_c_matrix, stiffness_matrix, stiffness_with_M_matrix] |
Definition at line 88 of file callback_forms.py.
dictionary sfc_callbacks::callback_forms::options = { "symbolic": symbolic, "quad_order": quad_order } |
Definition at line 170 of file callback_forms.py.
dictionary sfc_callbacks::callback_forms::polygon = { 2: "triangle", 3: "tetrahedron" } |
Definition at line 141 of file callback_forms.py.
string sfc_callbacks::callback_forms::print_forms = "p" |
Definition at line 112 of file callback_forms.py.
Definition at line 131 of file callback_forms.py.
list sfc_callbacks::callback_forms::scalar_elements = [fe0, fe1, fe2] |
Definition at line 147 of file callback_forms.py.
list sfc_callbacks::callback_forms::scalar_forms = [constant_scalar, L2_scalar, H1_semi_scalar, H1_scalar] |
Definition at line 32 of file callback_forms.py.
Definition at line 157 of file callback_forms.py.
tuple sfc_callbacks::callback_forms::tfe0 = TensorElement("P0", polygon, 0) |
Definition at line 154 of file callback_forms.py.
tuple sfc_callbacks::callback_forms::tfe1 = TensorElement("Lagrange", polygon, 1) |
Definition at line 155 of file callback_forms.py.
tuple sfc_callbacks::callback_forms::tfe2 = TensorElement("Lagrange", polygon, 2) |
Definition at line 156 of file callback_forms.py.
Definition at line 152 of file callback_forms.py.
list sfc_callbacks::callback_forms::vector_forms = [constant_vector, constant_source_vector, source_vector] |
Definition at line 51 of file callback_forms.py.
tuple sfc_callbacks::callback_forms::vfe0 = VectorElement("P0", polygon, 0) |
Definition at line 149 of file callback_forms.py.
tuple sfc_callbacks::callback_forms::vfe1 = VectorElement("Lagrange", polygon, 1) |
Definition at line 150 of file callback_forms.py.
tuple sfc_callbacks::callback_forms::vfe2 = VectorElement("Lagrange", polygon, 2) |
Definition at line 151 of file callback_forms.py.