Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-elasticity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
agnumpde
dune-elasticity
Commits
afca8d2d
Commit
afca8d2d
authored
4 years ago
by
oliver.sander_at_tu-dresden.de
Browse files
Options
Downloads
Plain Diff
Merge branch 'stop-using-pythonfunction' into 'master'
Stop using deprecated class PythonFunction See merge request
!55
parents
942fc339
c7ae343e
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!55
Stop using deprecated class PythonFunction
Pipeline
#34332
failed
4 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/finite-strain-elasticity.cc
+6
-11
6 additions, 11 deletions
src/finite-strain-elasticity.cc
with
6 additions
and
11 deletions
src/finite-strain-elasticity.cc
+
6
−
11
View file @
afca8d2d
...
@@ -160,21 +160,16 @@ int main (int argc, char *argv[]) try
...
@@ -160,21 +160,16 @@ int main (int argc, char *argv[]) try
// Make Python function that computes which vertices are on the Dirichlet boundary,
// Make Python function that computes which vertices are on the Dirichlet boundary,
// based on the vertex positions.
// based on the vertex positions.
std
::
string
lambda
=
std
::
string
(
"lambda x: ("
)
+
parameterSet
.
get
<
std
::
string
>
(
"dirichletVerticesPredicate"
)
+
std
::
string
(
")"
);
std
::
string
lambda
=
std
::
string
(
"lambda x: ("
)
+
parameterSet
.
get
<
std
::
string
>
(
"dirichletVerticesPredicate"
)
+
std
::
string
(
")"
);
PythonFunction
<
FieldVector
<
double
,
dim
>
,
bool
>
pythonDirichletVertices
(
Python
::
evaluate
(
lambda
));
auto
pythonDirichletVertices
=
Python
::
make_function
<
bool
>
(
Python
::
evaluate
(
lambda
));
// Same for the Neumann boundary
// Same for the Neumann boundary
lambda
=
std
::
string
(
"lambda x: ("
)
+
parameterSet
.
get
<
std
::
string
>
(
"neumannVerticesPredicate"
,
"0"
)
+
std
::
string
(
")"
);
lambda
=
std
::
string
(
"lambda x: ("
)
+
parameterSet
.
get
<
std
::
string
>
(
"neumannVerticesPredicate"
,
"0"
)
+
std
::
string
(
")"
);
PythonFunction
<
FieldVector
<
double
,
dim
>
,
bool
>
pythonNeumannVertices
(
Python
::
evaluate
(
lambda
));
auto
pythonNeumannVertices
=
Python
::
make_function
<
bool
>
(
Python
::
evaluate
(
lambda
));
for
(
auto
&&
v
:
vertices
(
gridView
))
for
(
auto
&&
v
:
vertices
(
gridView
))
{
{
bool
isDirichlet
;
dirichletVertices
[
indexSet
.
index
(
v
)]
=
pythonDirichletVertices
(
v
.
geometry
().
corner
(
0
));
pythonDirichletVertices
.
evaluate
(
v
.
geometry
().
corner
(
0
),
isDirichlet
);
neumannVertices
[
indexSet
.
index
(
v
)]
=
pythonNeumannVertices
(
v
.
geometry
().
corner
(
0
));
dirichletVertices
[
indexSet
.
index
(
v
)]
=
isDirichlet
;
bool
isNeumann
;
pythonNeumannVertices
.
evaluate
(
v
.
geometry
().
corner
(
0
),
isNeumann
);
neumannVertices
[
indexSet
.
index
(
v
)]
=
isNeumann
;
}
}
BoundaryPatch
<
GridView
>
dirichletBoundary
(
gridView
,
dirichletVertices
);
BoundaryPatch
<
GridView
>
dirichletBoundary
(
gridView
,
dirichletVertices
);
...
@@ -202,7 +197,7 @@ int main (int argc, char *argv[]) try
...
@@ -202,7 +197,7 @@ int main (int argc, char *argv[]) try
SolutionType
x
(
basis
.
size
());
SolutionType
x
(
basis
.
size
());
lambda
=
std
::
string
(
"lambda x: ("
)
+
parameterSet
.
get
<
std
::
string
>
(
"initialDeformation"
)
+
std
::
string
(
")"
);
lambda
=
std
::
string
(
"lambda x: ("
)
+
parameterSet
.
get
<
std
::
string
>
(
"initialDeformation"
)
+
std
::
string
(
")"
);
PythonFunction
<
FieldVector
<
double
,
dim
>
,
FieldVector
<
double
,
dim
>
>
pythonInitialDeformation
(
Python
::
evaluate
(
lambda
));
auto
pythonInitialDeformation
=
Python
::
make_function
<
FieldVector
<
double
,
dim
>
>
(
Python
::
evaluate
(
lambda
));
Dune
::
Functions
::
interpolate
(
basis
,
x
,
pythonInitialDeformation
);
Dune
::
Functions
::
interpolate
(
basis
,
x
,
pythonInitialDeformation
);
...
@@ -328,7 +323,7 @@ int main (int argc, char *argv[]) try
...
@@ -328,7 +323,7 @@ int main (int argc, char *argv[]) try
Python
::
Reference
dirichletValuesPythonObject
=
C
(
homotopyParameter
);
Python
::
Reference
dirichletValuesPythonObject
=
C
(
homotopyParameter
);
// Extract object member functions as Dune functions
// Extract object member functions as Dune functions
PythonFunction
<
FieldVector
<
double
,
dim
>
,
FieldVector
<
double
,
dim
>
>
dirichletValues
(
dirichletValuesPythonObject
.
get
(
"dirichletValues"
));
auto
dirichletValues
=
Python
::
make_function
<
FieldVector
<
double
,
dim
>
>
(
dirichletValuesPythonObject
.
get
(
"dirichletValues"
));
Dune
::
Functions
::
interpolate
(
basis
,
x
,
dirichletValues
,
dirichletDofs
);
Dune
::
Functions
::
interpolate
(
basis
,
x
,
dirichletValues
,
dirichletDofs
);
...
...
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