2015-08-24 01:14:03 +03:00
|
|
|
|
# This file is a part of JuliaFEM.
|
|
|
|
|
|
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
|
|
|
|
|
|
2015-08-31 20:15:28 +03:00
|
|
|
|
using FactCheck
|
2015-09-10 02:20:34 +03:00
|
|
|
|
using ForwardDiff
|
2015-08-31 20:15:28 +03:00
|
|
|
|
|
2015-08-25 00:21:05 +03:00
|
|
|
|
abstract Element
|
2015-08-24 01:14:03 +03:00
|
|
|
|
|
2015-09-10 02:20:34 +03:00
|
|
|
|
#= ELEMENT DEFINITIONS
|
|
|
|
|
|
|
|
|
|
|
|
Each element must have
|
|
|
|
|
|
|
|
|
|
|
|
1. Connectivity information. How element is connected to other elements.
|
|
|
|
|
|
This is typically node ids in Lagrange elements.
|
|
|
|
|
|
2. Ability to store fields, in array of shape dim × nnodes, where dim is
|
|
|
|
|
|
dimension of field and nnodes is number of nodes of element. Note that
|
|
|
|
|
|
this is always 2d array.
|
|
|
|
|
|
3. Default constructor which takes connectivity as argument.
|
|
|
|
|
|
4. Basis functions and derivative of basis functions.
|
|
|
|
|
|
|
|
|
|
|
|
These rules probably will change, but there's a test_element function which
|
|
|
|
|
|
tests element and that it obeys current rules. If test_element passes,
|
|
|
|
|
|
everything should be ok. I use Quad4 as an example element here.
|
|
|
|
|
|
Several functions are inherited from Element abstract type:
|
|
|
|
|
|
|
|
|
|
|
|
- get_connectivity
|
2015-09-10 20:35:28 +03:00
|
|
|
|
- get_number_of_basis_functions*
|
2015-09-10 02:20:34 +03:00
|
|
|
|
- get_element_dimension *
|
|
|
|
|
|
- get_basis *
|
2015-09-10 20:35:28 +03:00
|
|
|
|
- get_dbasisdxi*
|
2015-09-10 02:20:34 +03:00
|
|
|
|
- get_dbasisdX
|
|
|
|
|
|
- get_field
|
|
|
|
|
|
- set_field
|
|
|
|
|
|
- interpolate
|
|
|
|
|
|
- ...
|
|
|
|
|
|
|
|
|
|
|
|
Which should work if element is defined following some rules. Functions marked with asterisk * are the ones which must necessarily to implement by your own.
|
|
|
|
|
|
|
|
|
|
|
|
=#
|
|
|
|
|
|
|
|
|
|
|
|
# These must be implemented for your own element
|
2015-09-10 20:35:28 +03:00
|
|
|
|
get_number_of_basis_functions(el::Type{Element}) = nothing
|
2015-09-13 20:58:51 +03:00
|
|
|
|
get_number_of_basis_functions(el::Element) = nothing
|
2015-09-10 02:20:34 +03:00
|
|
|
|
get_element_dimension(el::Element) = nothing
|
|
|
|
|
|
get_basis(el::Element, xi) = nothing
|
2015-09-10 20:35:28 +03:00
|
|
|
|
get_dbasisdxi(el::Element, xi) = nothing
|
2015-09-13 20:58:51 +03:00
|
|
|
|
get_connectivity(el::Element) = el.connectivity
|
2015-09-10 02:20:34 +03:00
|
|
|
|
|
2015-09-10 20:35:28 +03:00
|
|
|
|
"""
|
|
|
|
|
|
Create new element with element_name to family element_family
|
2015-09-10 02:20:34 +03:00
|
|
|
|
|
2015-09-10 20:35:28 +03:00
|
|
|
|
Examples
|
|
|
|
|
|
--------
|
|
|
|
|
|
>>> @create_element(Seg2, CG, "2 node linear segment")
|
2015-09-10 02:20:34 +03:00
|
|
|
|
"""
|
2015-09-10 20:35:28 +03:00
|
|
|
|
macro create_element(element_name, element_family, element_description)
|
2015-09-13 20:58:51 +03:00
|
|
|
|
# Logging.debug("Creating element ", element_name, ": ", element_description, "\n")
|
2015-09-10 20:35:28 +03:00
|
|
|
|
eltype = esc(element_name)
|
|
|
|
|
|
elfam = esc(element_family)
|
|
|
|
|
|
quote
|
|
|
|
|
|
global get_element_description
|
|
|
|
|
|
type $eltype <: $elfam
|
|
|
|
|
|
connectivity :: Array{Int, 1}
|
|
|
|
|
|
fields :: Dict{Any, Any}
|
|
|
|
|
|
end
|
|
|
|
|
|
$eltype(connectivity) = $eltype(connectivity, Dict{Any, Any}())
|
|
|
|
|
|
get_element_description(el::Type{$eltype}) = $element_description
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2015-09-10 02:20:34 +03:00
|
|
|
|
|
2015-09-10 20:35:28 +03:00
|
|
|
|
#=
|
2015-09-10 02:20:34 +03:00
|
|
|
|
|
2015-09-10 20:35:28 +03:00
|
|
|
|
Start of example
|
|
|
|
|
|
|
|
|
|
|
|
Example how to create new element. This is commented because I use code
|
|
|
|
|
|
generation for simple elements like Lagrage elements. Feel free to use
|
|
|
|
|
|
code generation but elements can be of course created manually too!
|
2015-09-10 02:20:34 +03:00
|
|
|
|
|
|
|
|
|
|
type Quad4 <: CG
|
|
|
|
|
|
connectivity :: Array{Int, 1}
|
|
|
|
|
|
fields :: Dict{Any, Any}
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
""" Default contructor. """
|
|
|
|
|
|
Quad4(connectivity) = Quad4(connectivity, Dict{Any, Any}())
|
|
|
|
|
|
|
|
|
|
|
|
""" Return number of basis functions of this element. """
|
2015-09-10 20:35:28 +03:00
|
|
|
|
get_number_of_basis_functions(el::Type{Quad4}) = 4
|
2015-09-10 02:20:34 +03:00
|
|
|
|
|
|
|
|
|
|
""" Return element dimension (length of xi vector). """
|
|
|
|
|
|
get_element_dimension(el::Type{Quad4}) = 2
|
|
|
|
|
|
|
|
|
|
|
|
""" Return basis functions for this element (xi dim = 2, functions = 4). """
|
|
|
|
|
|
function get_basis(el::Quad4, xi)
|
|
|
|
|
|
[(1-xi[1])*(1-xi[2])/4
|
|
|
|
|
|
(1+xi[1])*(1-xi[2])/4
|
|
|
|
|
|
(1+xi[1])*(1+xi[2])/4
|
|
|
|
|
|
(1-xi[1])*(1+xi[2])/4]
|
|
|
|
|
|
end
|
2015-08-31 20:15:28 +03:00
|
|
|
|
|
2015-09-10 02:20:34 +03:00
|
|
|
|
""" Return partial derivatives of basis functions. """
|
|
|
|
|
|
function get_dbasisdxi(el::Quad4, xi)
|
|
|
|
|
|
[-(1-xi[2])/4.0 -(1-xi[1])/4.0
|
|
|
|
|
|
(1-xi[2])/4.0 -(1+xi[1])/4.0
|
|
|
|
|
|
(1+xi[2])/4.0 (1+xi[1])/4.0
|
|
|
|
|
|
-(1+xi[2])/4.0 (1-xi[1])/4.0]
|
|
|
|
|
|
end
|
2015-09-10 20:35:28 +03:00
|
|
|
|
|
|
|
|
|
|
End of example.
|
|
|
|
|
|
|
|
|
|
|
|
=#
|
|
|
|
|
|
|
2015-09-13 20:58:51 +03:00
|
|
|
|
### LAGRANGE ELEMENTS ###
|
|
|
|
|
|
|
2015-09-10 20:35:28 +03:00
|
|
|
|
abstract CG <: Element # Lagrange (continous Galerkin) element family
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
Given polynomial P and coordinates of reference element, calculate
|
|
|
|
|
|
Lagrange basis function and partial derivatives.
|
|
|
|
|
|
"""
|
|
|
|
|
|
function calculate_lagrange_basis(P, X)
|
|
|
|
|
|
dim, nbasis = size(X)
|
|
|
|
|
|
A = zeros(nbasis, nbasis)
|
|
|
|
|
|
for i=1:nbasis
|
|
|
|
|
|
A[i,:] = P(X[:, i])
|
|
|
|
|
|
end
|
2015-09-13 20:58:51 +03:00
|
|
|
|
# Logging.debug("Calculating inverse of A")
|
2015-09-10 20:35:28 +03:00
|
|
|
|
invA = inv(A)'
|
|
|
|
|
|
basis(xi) = invA*P(xi)
|
|
|
|
|
|
dbasisdxi = ForwardDiff.jacobian(basis)
|
|
|
|
|
|
basis, dbasisdxi
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
Assign Lagrange basis for element.
|
|
|
|
|
|
"""
|
|
|
|
|
|
macro create_lagrange_basis(element_name, X, P)
|
2015-09-14 16:15:36 +03:00
|
|
|
|
|
2015-09-13 20:58:51 +03:00
|
|
|
|
# Logging.debug("Creating Lagrange basis for element ", element_name, ". ")
|
2015-09-10 20:35:28 +03:00
|
|
|
|
eltype = esc(element_name)
|
|
|
|
|
|
|
|
|
|
|
|
quote
|
|
|
|
|
|
|
|
|
|
|
|
global get_number_of_basis_functions, get_element_dimension
|
|
|
|
|
|
global get_basis, get_dbasisdxi
|
|
|
|
|
|
|
|
|
|
|
|
dim = size($X, 1)
|
|
|
|
|
|
nbasis = size($X, 2)
|
2015-09-13 20:58:51 +03:00
|
|
|
|
# Logging.debug("Number of basis functions: ", nbasis, ". ")
|
|
|
|
|
|
# Logging.debug("Element dimension: ", dim)
|
2015-09-10 20:35:28 +03:00
|
|
|
|
|
|
|
|
|
|
get_number_of_basis_functions(el::Type{$(esc(element_name))}) = nbasis
|
2015-09-13 20:58:51 +03:00
|
|
|
|
get_number_of_basis_functions(el::$(esc(element_name))) = nbasis
|
2015-09-10 20:35:28 +03:00
|
|
|
|
get_element_dimension(el::$(esc(element_name))) = dim
|
|
|
|
|
|
|
|
|
|
|
|
basis, dbasisdxi = calculate_lagrange_basis($P, $X)
|
|
|
|
|
|
get_basis(el::$eltype, xi) = basis(xi)
|
|
|
|
|
|
get_dbasisdxi(el::$eltype, xi) = dbasisdxi(xi)
|
2015-09-13 20:58:51 +03:00
|
|
|
|
# Logging.debug("Element ", $element_name, " created.")
|
2015-09-10 20:35:28 +03:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# 0d Lagrange element
|
|
|
|
|
|
|
|
|
|
|
|
@create_element(Point1, CG, "1 node point element")
|
|
|
|
|
|
|
|
|
|
|
|
# 1d Lagrange elements
|
|
|
|
|
|
|
|
|
|
|
|
@create_element(Seg2, CG, "2 node linear line element")
|
|
|
|
|
|
@create_lagrange_basis(Seg2, [-1.0 1.0], (xi) -> [1.0, xi[1]])
|
|
|
|
|
|
|
|
|
|
|
|
@create_element(Seg3, CG, "3 node quadratic line element")
|
|
|
|
|
|
@create_lagrange_basis(Seg3, [-1.0 1.0 0.0], (xi) -> [1.0, xi[1], xi[1]^2])
|
|
|
|
|
|
|
|
|
|
|
|
# 2d Lagrange elements
|
|
|
|
|
|
|
|
|
|
|
|
@create_element(Quad4, CG, "4 node bilinear quadrangle element")
|
|
|
|
|
|
@create_lagrange_basis(Quad4,
|
|
|
|
|
|
[-1.0 1.0 1.0 -1.0
|
|
|
|
|
|
-1.0 -1.0 1.0 1.0],
|
|
|
|
|
|
(xi) -> [1.0, xi[1], xi[2], xi[1]*xi[2]])
|
|
|
|
|
|
|
|
|
|
|
|
# 3d Lagrange elements
|
2015-09-13 20:58:51 +03:00
|
|
|
|
|
2015-09-10 20:35:28 +03:00
|
|
|
|
@create_element(Tet10, CG, "10 node quadratic tetrahedron")
|
|
|
|
|
|
@create_lagrange_basis(Tet10,
|
|
|
|
|
|
[0.0 1.0 0.0 0.0 0.5 0.5 0.0 0.0 0.5 0.0
|
|
|
|
|
|
0.0 0.0 1.0 0.0 0.0 0.5 0.5 0.0 0.0 0.5
|
|
|
|
|
|
0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.5 0.5 0.5],
|
|
|
|
|
|
(xi) -> [ 1.0, xi[1], xi[2], xi[3], xi[1]^2,
|
|
|
|
|
|
xi[2]^2, xi[3]^2, xi[1]*xi[2], xi[2]*xi[3], xi[3]*xi[1]])
|
2015-09-10 02:20:34 +03:00
|
|
|
|
|
|
|
|
|
|
|
2015-09-13 20:58:51 +03:00
|
|
|
|
### HIERARCHICAL ELEMENTS ###
|
|
|
|
|
|
|
|
|
|
|
|
include("hierarchical.jl")
|
|
|
|
|
|
|
|
|
|
|
|
# Common element routines
|
2015-09-10 20:35:28 +03:00
|
|
|
|
|
2015-09-10 02:20:34 +03:00
|
|
|
|
"""
|
|
|
|
|
|
Test routine for element.
|
|
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
|
----------
|
|
|
|
|
|
eltype::Type{Element}
|
|
|
|
|
|
Element to test
|
2015-08-31 20:15:28 +03:00
|
|
|
|
|
2015-09-10 02:20:34 +03:00
|
|
|
|
Raises
|
|
|
|
|
|
------
|
|
|
|
|
|
This uses FactCheck and throws exception if element is not passing.
|
|
|
|
|
|
"""
|
2015-08-31 20:15:28 +03:00
|
|
|
|
function test_element(eltype)
|
2015-09-10 20:35:28 +03:00
|
|
|
|
Logging.info("Testing element $eltype")
|
2015-08-31 20:15:28 +03:00
|
|
|
|
local el
|
2015-09-10 20:35:28 +03:00
|
|
|
|
n = get_number_of_basis_functions(eltype)
|
|
|
|
|
|
Logging.info("number of basis functions in this element: $n")
|
|
|
|
|
|
@fact n --> not(nothing) """
|
|
|
|
|
|
Unable to determine number of nodes for $eltype define a function
|
|
|
|
|
|
'get_number_of_basis_functions' which returns the number of nodes
|
|
|
|
|
|
for this element."""
|
|
|
|
|
|
|
|
|
|
|
|
Logging.info("Initializing element")
|
2015-08-31 20:15:28 +03:00
|
|
|
|
try
|
|
|
|
|
|
el = eltype(collect(1:n))
|
|
|
|
|
|
catch
|
2015-09-10 20:35:28 +03:00
|
|
|
|
Logging.error("""
|
|
|
|
|
|
Unable to create element with default constructor define function
|
|
|
|
|
|
$eltype(connectivity) which initializes this element.""")
|
2015-09-10 02:20:34 +03:00
|
|
|
|
return false
|
2015-08-31 20:15:28 +03:00
|
|
|
|
end
|
2015-09-10 20:35:28 +03:00
|
|
|
|
|
2015-08-31 20:15:28 +03:00
|
|
|
|
dim = get_element_dimension(el)
|
|
|
|
|
|
Logging.info("Element dimension: $dim")
|
2015-09-10 20:35:28 +03:00
|
|
|
|
@fact dim --> not(nothing) """
|
|
|
|
|
|
Unable to get element dimension define function 'get_element_dimension'
|
|
|
|
|
|
which return the dimension of this element (1, 2, 3)"""
|
2015-08-31 20:15:28 +03:00
|
|
|
|
|
|
|
|
|
|
# try to interpolate some scalar field
|
|
|
|
|
|
fld = collect(1:n)'
|
|
|
|
|
|
Logging.info("Setting scalar field $fld to element.")
|
|
|
|
|
|
set_field(el, "field1", fld)
|
|
|
|
|
|
@fact get_field(el, "field1") --> fld
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
get_basis(el, zeros(dim))
|
|
|
|
|
|
catch
|
2015-09-10 20:35:28 +03:00
|
|
|
|
Logging.error("""
|
|
|
|
|
|
Unable to evaluate basis, define function 'get_basis' for
|
|
|
|
|
|
this element.""")
|
2015-08-31 20:15:28 +03:00
|
|
|
|
end
|
|
|
|
|
|
try
|
|
|
|
|
|
get_dbasisdxi(el, zeros(dim))
|
|
|
|
|
|
catch
|
2015-09-10 20:35:28 +03:00
|
|
|
|
Logging.error("""
|
|
|
|
|
|
Unable to evaluate partial derivatives of basis,
|
|
|
|
|
|
define function 'get_dbasisdxi' for this element.""")
|
2015-08-31 20:15:28 +03:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
xi = zeros(dim)
|
|
|
|
|
|
Logging.info("Interpolating scalar field at $xi")
|
|
|
|
|
|
i = interpolate(el, "field1", zeros(dim))
|
|
|
|
|
|
Logging.info("Value: $i")
|
|
|
|
|
|
Logging.info("Element $eltype passed tests.")
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2015-08-24 01:14:03 +03:00
|
|
|
|
"""
|
2015-09-13 20:58:51 +03:00
|
|
|
|
Get jacobian of element evaluated at point ξ on element in reference configuration.
|
2015-09-10 02:20:34 +03:00
|
|
|
|
|
|
|
|
|
|
Notes
|
|
|
|
|
|
-----
|
|
|
|
|
|
This function assumes that element has field :geometry defined.
|
2015-08-24 01:14:03 +03:00
|
|
|
|
"""
|
2015-09-14 16:15:36 +03:00
|
|
|
|
#function get_Jacobian(el::Element, xi)
|
|
|
|
|
|
# dbasisdxi = get_dbasisdxi(el, xi)
|
|
|
|
|
|
# X = get_field(el, :geometry)
|
|
|
|
|
|
# J = X*dbasisdxi
|
|
|
|
|
|
# return J
|
|
|
|
|
|
#end
|
|
|
|
|
|
function get_Jacobian(el::Element, xi, geometry_field=:geometry)
|
|
|
|
|
|
dinterpolate(el, geometry_field, xi)
|
2015-08-24 01:14:03 +03:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
2015-09-13 20:58:51 +03:00
|
|
|
|
Get jacobian of element evaluated at point ξ on element in current configuration.
|
|
|
|
|
|
|
|
|
|
|
|
Notes
|
|
|
|
|
|
-----
|
|
|
|
|
|
This function assumes that element has fields :geometry and :displacement defined.
|
|
|
|
|
|
"""
|
|
|
|
|
|
function get_jacobian(el::Element, xi)
|
|
|
|
|
|
dbasisdxi = get_dbasisdxi(el, xi)
|
|
|
|
|
|
X = get_field(el, :geometry)
|
|
|
|
|
|
u = get_field(el, :displacement)
|
|
|
|
|
|
j = (X+u)*dbasisdxi
|
|
|
|
|
|
return j
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
Evaluate partial derivatives of basis, dbasis/dX
|
2015-08-24 01:14:03 +03:00
|
|
|
|
"""
|
2015-08-25 00:21:05 +03:00
|
|
|
|
function get_dbasisdX(el::Element, xi)
|
|
|
|
|
|
dbasisdxi = get_dbasisdxi(el, xi)
|
2015-09-13 20:58:51 +03:00
|
|
|
|
J = get_Jacobian(el, xi)
|
2015-08-25 00:21:05 +03:00
|
|
|
|
dbasisdxi*inv(J)
|
2015-08-24 01:14:03 +03:00
|
|
|
|
end
|
|
|
|
|
|
|
2015-09-13 20:58:51 +03:00
|
|
|
|
"""
|
|
|
|
|
|
Evaluate partial derivatives of basis, dbasis/dx
|
|
|
|
|
|
"""
|
|
|
|
|
|
function get_dbasisdx(el::Element, xi)
|
|
|
|
|
|
dbasisdxi = get_dbasisdxi(el, xi)
|
|
|
|
|
|
j = get_jacobian(el, xi)
|
|
|
|
|
|
dbasisdxi*inv(j)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2015-09-10 02:20:34 +03:00
|
|
|
|
""" Set field variable. """
|
2015-08-25 21:18:11 +03:00
|
|
|
|
function set_field(el::Element, field_name, field_value)
|
|
|
|
|
|
el.fields[field_name] = field_value
|
2015-08-24 01:14:03 +03:00
|
|
|
|
end
|
|
|
|
|
|
|
2015-09-14 16:15:36 +03:00
|
|
|
|
""" Create new empty field of some type. """
|
|
|
|
|
|
function new_field(el::Element, field_name, field_type)
|
|
|
|
|
|
el.fields[field_name] = field_type[]
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
""" Push to existing field. """
|
|
|
|
|
|
function push_field!(el::Element, field_name, field_value)
|
|
|
|
|
|
push!(el.fields[field_name], field_value)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2015-09-10 02:20:34 +03:00
|
|
|
|
""" Get field variable. """
|
2015-08-25 21:18:11 +03:00
|
|
|
|
function get_field(el::Element, field_name)
|
|
|
|
|
|
el.fields[field_name]
|
2015-08-24 01:14:03 +03:00
|
|
|
|
end
|
|
|
|
|
|
|
2015-09-13 20:58:51 +03:00
|
|
|
|
"""Evaluate some field in point ξ on element using basis functions.
|
|
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
|
----------
|
|
|
|
|
|
el :: Element
|
|
|
|
|
|
field :: Union{ASCIIString, Symbol}
|
|
|
|
|
|
xi :: Vector
|
|
|
|
|
|
|
|
|
|
|
|
Returns
|
|
|
|
|
|
-------
|
|
|
|
|
|
Scalar, Vector, Tensor, depending on what is type of field to interpolate.
|
|
|
|
|
|
|
|
|
|
|
|
Notes
|
|
|
|
|
|
-----
|
|
|
|
|
|
This has another version which returns multiple values for set of coordinates {ξᵢ}.
|
|
|
|
|
|
dinterpolate returns derivatives.
|
|
|
|
|
|
|
|
|
|
|
|
Examples
|
|
|
|
|
|
--------
|
|
|
|
|
|
>>> field = [1.0, 2.0, 3.0, 4.0]
|
|
|
|
|
|
>>> set_field(el, :temperature, field)
|
|
|
|
|
|
>>> interpolate(el, :temperature, [0.0, 0.0])
|
|
|
|
|
|
15.0
|
|
|
|
|
|
"""
|
|
|
|
|
|
function interpolate(el::Element, field, xi::Vector)
|
|
|
|
|
|
field = get_field(el, field)
|
|
|
|
|
|
sum(get_basis(el, xi) .* field)
|
|
|
|
|
|
end
|
|
|
|
|
|
function interpolate(el::Element, field, xis::Array{Vector, 1})
|
|
|
|
|
|
field = get_field(el, field)
|
|
|
|
|
|
interpolate_(xi) = sum(get_basis(el, xi) .* field)
|
|
|
|
|
|
map(interpolate_, xis)
|
|
|
|
|
|
end
|
|
|
|
|
|
function dinterpolate(el::Element, field, xi::Vector)
|
2015-09-14 16:15:36 +03:00
|
|
|
|
fld = get_field(el, field)
|
2015-09-13 20:58:51 +03:00
|
|
|
|
dbasis = get_dbasisdxi(el, xi)
|
|
|
|
|
|
if isa(dbasis, Vector)
|
2015-09-14 20:51:39 +03:00
|
|
|
|
return sum(dbasis .* fld)
|
2015-08-31 20:15:28 +03:00
|
|
|
|
end
|
2015-09-14 16:15:36 +03:00
|
|
|
|
return sum([fld[i]*dbasis[i,:] for i in 1:length(fld)])
|
2015-08-24 01:14:03 +03:00
|
|
|
|
end
|