Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-gfe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sander, Oliver
dune-gfe
Commits
02f85983
Commit
02f85983
authored
11 years ago
by
Oliver Sander
Committed by
sander
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use OpenMP to speed up matrix assembly
[[Imported from SVN: r9284]]
parent
b72aad12
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile.am
+1
-1
1 addition, 1 deletion
Makefile.am
dune/gfe/localgeodesicfestiffness.hh
+9
-11
9 additions, 11 deletions
dune/gfe/localgeodesicfestiffness.hh
with
10 additions
and
12 deletions
Makefile.am
+
1
−
1
View file @
02f85983
...
...
@@ -12,7 +12,7 @@ AM_CPPFLAGS += $(IPOPT_CPPFLAGS)
noinst_PROGRAMS
=
cosserat-continuum rodobstacle rod3d harmonicmaps harmonicmaps-eoc dirneucoupling rod-eoc
cosserat_continuum_SOURCES
=
cosserat-continuum.cc
cosserat_continuum_CXXFLAGS
=
$(
UG_CPPFLAGS
)
$(
AMIRAMESH_CPPFLAGS
)
$(
IPOPT_CPPFLAGS
)
$(
PSURFACE_CPPFLAGS
)
cosserat_continuum_CXXFLAGS
=
$(
UG_CPPFLAGS
)
$(
AMIRAMESH_CPPFLAGS
)
$(
IPOPT_CPPFLAGS
)
$(
PSURFACE_CPPFLAGS
)
-fopenmp
cosserat_continuum_LDADD
=
$(
UG_LDFLAGS
)
$(
AMIRAMESH_LDFLAGS
)
$(
UG_LIBS
)
$(
AMIRAMESH_LIBS
)
\
$(
IPOPT_LDFLAGS
)
$(
IPOPT_LIBS
)
$(
PSURFACE_LDFLAGS
)
$(
PSURFACE_LIBS
)
...
...
This diff is collapsed.
Click to expand it.
dune/gfe/localgeodesicfestiffness.hh
+
9
−
11
View file @
02f85983
#ifndef LOCAL_GEODESIC_FE_STIFFNESS_HH
#define LOCAL_GEODESIC_FE_STIFFNESS_HH
#include
"omp.h"
#include
<dune/istl/bcrsmatrix.hh>
#include
<dune/common/fmatrix.hh>
#include
<dune/istl/matrixindexset.hh>
...
...
@@ -139,6 +141,8 @@ assembleHessian(const Entity& element,
// Precompute energy infinitesimal corrections in the directions of the local basis vectors
std
::
vector
<
Dune
::
array
<
double
,
blocksize
>
>
forwardEnergy
(
nDofs
);
std
::
vector
<
Dune
::
array
<
double
,
blocksize
>
>
backwardEnergy
(
nDofs
);
#pragma omp parallel for schedule (dynamic)
for
(
size_t
i
=
0
;
i
<
localSolution
.
size
();
i
++
)
{
for
(
size_t
i2
=
0
;
i2
<
blocksize
;
i2
++
)
{
Dune
::
FieldVector
<
double
,
embeddedBlocksize
>
epsXi
=
B
[
i
][
i2
];
...
...
@@ -158,18 +162,19 @@ assembleHessian(const Entity& element,
}
}
// finite-difference approximation
std
::
vector
<
TargetSpace
>
forwardSolutionXiEta
=
localSolution
;
std
::
vector
<
TargetSpace
>
backwardSolutionXiEta
=
localSolution
;
// we loop over the lower left triangular half of the matrix.
// The other half follows from symmetry
#pragma omp parallel for schedule (dynamic)
for
(
size_t
i
=
0
;
i
<
localSolution
.
size
();
i
++
)
{
for
(
size_t
i2
=
0
;
i2
<
blocksize
;
i2
++
)
{
for
(
size_t
j
=
0
;
j
<=
i
;
j
++
)
{
for
(
size_t
j2
=
0
;
j2
<
((
i
==
j
)
?
i2
+
1
:
blocksize
);
j2
++
)
{
std
::
vector
<
TargetSpace
>
forwardSolutionXiEta
=
localSolution
;
std
::
vector
<
TargetSpace
>
backwardSolutionXiEta
=
localSolution
;
Dune
::
FieldVector
<
double
,
embeddedBlocksize
>
epsXi
=
B
[
i
][
i2
];
epsXi
*=
eps
;
Dune
::
FieldVector
<
double
,
embeddedBlocksize
>
epsEta
=
B
[
j
][
j2
];
epsEta
*=
eps
;
...
...
@@ -195,17 +200,10 @@ assembleHessian(const Entity& element,
A_
[
i
][
j
][
i2
][
j2
]
=
A_
[
j
][
i
][
j2
][
i2
]
=
0.5
*
(
forwardValue
-
2
*
centerValue
+
backwardValue
)
/
(
eps
*
eps
);
// Restore the forwardSolutionXiEta and backwardSolutionXiEta variables.
// They will both be identical to the 'solution' array again.
forwardSolutionXiEta
[
i
]
=
backwardSolutionXiEta
[
i
]
=
localSolution
[
i
];
if
(
i
!=
j
)
forwardSolutionXiEta
[
j
]
=
backwardSolutionXiEta
[
j
]
=
localSolution
[
j
];
}
}
}
}
}
#endif
...
...
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