Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hyteg
hog
Commits
6a2d44f7
Commit
6a2d44f7
authored
9 months ago
by
Nils Kohl
Browse files
Options
Downloads
Patches
Plain Diff
Fixing FE coefficient "getter" for vector spaces.
parent
3190dc38
No related branches found
No related tags found
1 merge request
!24
Parametric mappings
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hog/fem_helpers.py
+9
-5
9 additions, 5 deletions
hog/fem_helpers.py
with
9 additions
and
5 deletions
hog/fem_helpers.py
+
9
−
5
View file @
6a2d44f7
...
@@ -468,10 +468,13 @@ def fem_function_on_element(
...
@@ -468,10 +468,13 @@ def fem_function_on_element(
domain
==
"
reference
"
domain
==
"
reference
"
),
"
Tabulating the basis evaluation not implemented for affine domain.
"
),
"
Tabulating the basis evaluation not implemented for affine domain.
"
rows
=
geometry
.
dimensions
if
function_space
.
is_vectorial
else
1
if
domain
==
"
reference
"
:
if
domain
==
"
reference
"
:
# On the reference domain, the reference coordinates symbols can be used directly, so no substitution
# On the reference domain, the reference coordinates symbols can be used directly, so no substitution
# has to be performed for the shape functions.
# has to be performed for the shape functions.
s
=
sp
.
zeros
(
1
,
1
)
s
=
sp
.
zeros
(
rows
,
1
)
for
dof
,
phi
in
zip
(
for
dof
,
phi
in
zip
(
dofs
,
dofs
,
(
(
...
@@ -487,7 +490,7 @@ def fem_function_on_element(
...
@@ -487,7 +490,7 @@ def fem_function_on_element(
# On the affine / computational domain, the evaluation point is first mapped to reference space and then
# On the affine / computational domain, the evaluation point is first mapped to reference space and then
# the reference space coordinate symbols are substituted with the transformed point.
# the reference space coordinate symbols are substituted with the transformed point.
eval_point_on_ref
=
trafo_affine_point_to_ref
(
geometry
,
symbolizer
=
symbolizer
)
eval_point_on_ref
=
trafo_affine_point_to_ref
(
geometry
,
symbolizer
=
symbolizer
)
s
=
sp
.
zeros
(
1
,
1
)
s
=
sp
.
zeros
(
rows
,
1
)
for
dof
,
phi
in
zip
(
for
dof
,
phi
in
zip
(
dofs
,
dofs
,
function_space
.
shape
(
function_space
.
shape
(
...
@@ -523,7 +526,7 @@ def fem_function_gradient_on_element(
...
@@ -523,7 +526,7 @@ def fem_function_gradient_on_element(
dof_map
:
Optional
[
List
[
int
]]
=
None
,
dof_map
:
Optional
[
List
[
int
]]
=
None
,
basis_eval
:
Union
[
str
,
List
[
sp
.
Expr
]]
=
"
default
"
,
basis_eval
:
Union
[
str
,
List
[
sp
.
Expr
]]
=
"
default
"
,
dof_symbols
:
Optional
[
List
[
DoFSymbol
]]
=
None
,
dof_symbols
:
Optional
[
List
[
DoFSymbol
]]
=
None
,
)
->
sp
.
Matrix
:
)
->
Tuple
[
sp
.
Matrix
,
List
[
DoFSymbol
]]
:
"""
Returns an expression that is the gradient of the element-local polynomial, either in affine or reference coordinates.
"""
Returns an expression that is the gradient of the element-local polynomial, either in affine or reference coordinates.
The expression is build using DoFSymbol instances so that the DoFs can be resolved later.
The expression is build using DoFSymbol instances so that the DoFs can be resolved later.
...
@@ -553,7 +556,8 @@ def fem_function_gradient_on_element(
...
@@ -553,7 +556,8 @@ def fem_function_gradient_on_element(
if
domain
==
"
reference
"
:
if
domain
==
"
reference
"
:
# On the reference domain, the reference coordinates symbols can be used directly, so no substitution
# On the reference domain, the reference coordinates symbols can be used directly, so no substitution
# has to be performed for the shape functions.
# has to be performed for the shape functions.
s
=
sp
.
zeros
(
geometry
.
dimensions
,
1
)
cols
=
geometry
.
dimensions
if
function_space
.
is_vectorial
else
1
s
=
sp
.
zeros
(
geometry
.
dimensions
,
cols
)
for
dof
,
grad_phi
in
zip
(
for
dof
,
grad_phi
in
zip
(
dofs
,
dofs
,
(
(
...
@@ -571,4 +575,4 @@ def fem_function_gradient_on_element(
...
@@ -571,4 +575,4 @@ def fem_function_gradient_on_element(
raise
HOGException
(
raise
HOGException
(
f
"
Invalid domain
'
{
domain
}
'
: cannot evaluate local polynomial here.
"
f
"
Invalid domain
'
{
domain
}
'
: cannot evaluate local polynomial here.
"
)
)
return
s
,
dofs
return
s
p
.
Matrix
(
s
)
,
dofs
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment