Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-tectonic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Show more breadcrumbs
podlesny
dune-tectonic
Commits
1b9f9b0d
Commit
1b9f9b0d
authored
13 years ago
by
Elias Pipping
Committed by
Elias Pipping
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Call leafView() only once; pass gridview only
parent
d6e682b0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/one-body-sample.cc
+15
-13
15 additions, 13 deletions
src/one-body-sample.cc
with
15 additions
and
13 deletions
src/one-body-sample.cc
+
15
−
13
View file @
1b9f9b0d
...
...
@@ -40,25 +40,23 @@
int
const
dim
=
2
;
template
<
class
Grid
Type
>
void
setup_boundary
(
Grid
Type
const
&
grid
,
template
<
class
Grid
View
>
void
setup_boundary
(
Grid
View
const
&
grid
View
,
Dune
::
FieldVector
<
double
,
dim
>
const
&
end_points
,
Dune
::
BitSetVector
<
dim
>
&
ignoreNodes
,
Dune
::
BitSetVector
<
1
>
&
neumannNodes
,
Dune
::
BitSetVector
<
1
>
&
frictionalNodes
)
{
typedef
typename
GridType
::
LeafGridView
GridView
;
GridView
const
leafView
=
grid
.
leafView
();
typedef
typename
GridView
::
template
Codim
<
dim
>
::
Iterator
VertexLeafIterator
;
typedef
Dune
::
MultipleCodimMultipleGeomTypeMapper
<
GridView
,
Dune
::
MCMGVertexLayout
>
VertexMapper
;
VertexMapper
const
myVertexMapper
(
leaf
View
);
VertexMapper
const
myVertexMapper
(
grid
View
);
size_t
dirichlet_nodes
=
0
;
size_t
neumann_nodes
=
0
;
size_t
frictional_nodes
=
0
;
for
(
VertexLeafIterator
it
=
leaf
View
.
template
begin
<
dim
>();
it
!=
leaf
View
.
template
end
<
dim
>();
++
it
)
{
for
(
VertexLeafIterator
it
=
grid
View
.
template
begin
<
dim
>();
it
!=
grid
View
.
template
end
<
dim
>();
++
it
)
{
Dune
::
GeometryType
const
gt
=
it
->
type
();
assert
(
it
->
geometry
().
corners
()
==
1
);
Dune
::
FieldVector
<
double
,
dim
>
const
coordinates
=
it
->
geometry
().
corner
(
0
);
...
...
@@ -136,7 +134,7 @@ int main() {
size_t
const
solver_maxIterations
=
100
;
double
const
solver_tolerance
=
1e-4
;
// Set up grid
//
{{{
Set up grid
typedef
Dune
::
YaspGrid
<
dim
>
GridType
;
Dune
::
FieldVector
<
double
,
dim
>
const
end_points
(
1
);
// nth dimension (zero-indexed) goes from 0 to end_points[n]
...
...
@@ -147,9 +145,13 @@ int main() {
0
);
// zero overlap (whatever that is)
grid
.
globalRefine
(
refinements
);
typedef
GridType
::
LeafGridView
GridView
;
GridView
const
leafView
=
grid
.
leafView
();
// }}}
// Set up nodal basis
typedef
P1NodalBasis
<
GridType
::
LeafGridView
,
double
>
P1Basis
;
P1Basis
const
p1Basis
(
grid
.
leafView
()
);
P1Basis
const
p1Basis
(
leafView
);
// Assemble elastic force on the body
StVenantKirchhoffAssembler
<
GridType
,
P1Basis
::
LocalFiniteElement
,
...
...
@@ -163,8 +165,8 @@ int main() {
Dune
::
BitSetVector
<
1
>
neumannNodes
(
grid
.
size
(
grid
.
maxLevel
(),
dim
),
false
);
Dune
::
BitSetVector
<
1
>
frictionalNodes
(
grid
.
size
(
grid
.
maxLevel
(),
dim
),
false
);
setup_boundary
<
GridType
>
(
grid
,
end_points
,
ignoreNodes
,
neumannNodes
,
frictionalNodes
);
setup_boundary
<
GridType
::
LeafGridView
>
(
leafView
,
end_points
,
ignoreNodes
,
neumannNodes
,
frictionalNodes
);
VectorType
u1
(
grid
.
size
(
grid
.
maxLevel
(),
dim
));
u1
=
0
;
...
...
@@ -172,12 +174,12 @@ int main() {
VectorType
f
(
grid
.
size
(
grid
.
maxLevel
(),
dim
));
assemble_neumann
<
GridType
,
GridType
::
LeafGridView
,
SmallVector
,
P1Basis
>
(
grid
.
leafView
()
,
p1Basis
,
neumannNodes
,
f
);
leafView
,
p1Basis
,
neumannNodes
,
f
);
// {{{ Assemble terms for the nonlinearity
std
::
vector
<
Dune
::
FieldVector
<
double
,
1
>>
nodalIntegrals
;
assemble_frictional
<
GridType
,
GridType
::
LeafGridView
,
SmallVector
,
P1Basis
>
(
grid
.
leafView
()
,
p1Basis
,
frictionalNodes
,
nodalIntegrals
);
leafView
,
p1Basis
,
frictionalNodes
,
nodalIntegrals
);
// TODO: populate on S_F
std
::
vector
<
double
>
normalStress
;
...
...
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