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
1ae7355d
Commit
1ae7355d
authored
11 years ago
by
Oliver Sander
Committed by
sander
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[cleanup] Define GridView and IndexSet once and for all
[[Imported from SVN: r9654]]
parent
d610403d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cosserat-continuum.cc
+23
-19
23 additions, 19 deletions
cosserat-continuum.cc
with
23 additions
and
19 deletions
cosserat-continuum.cc
+
23
−
19
View file @
1ae7355d
...
...
@@ -164,8 +164,11 @@ int main (int argc, char *argv[]) try
grid
->
globalRefine
(
numLevels
-
1
);
typedef
P1NodalBasis
<
GridType
::
LeafGridView
,
double
>
FEBasis
;
FEBasis
feBasis
(
grid
->
leafGridView
());
typedef
GridType
::
LeafGridView
GridView
;
GridView
gridView
=
grid
->
leafGridView
();
typedef
P1NodalBasis
<
GridView
,
double
>
FEBasis
;
FEBasis
feBasis
(
gridView
);
SolutionType
x
(
feBasis
.
size
());
...
...
@@ -176,8 +179,10 @@ int main (int argc, char *argv[]) try
BitSetVector
<
blocksize
>
dirichletNodes
(
feBasis
.
size
(),
false
);
BitSetVector
<
1
>
neumannNodes
(
feBasis
.
size
(),
false
);
GridType
::
Codim
<
dim
>::
LeafIterator
vIt
=
grid
->
leafbegin
<
dim
>
();
GridType
::
Codim
<
dim
>::
LeafIterator
vEndIt
=
grid
->
leafend
<
dim
>
();
GridType
::
Codim
<
dim
>::
LeafIterator
vIt
=
gridView
.
begin
<
dim
>
();
GridType
::
Codim
<
dim
>::
LeafIterator
vEndIt
=
gridView
.
end
<
dim
>
();
const
GridView
::
IndexSet
&
indexSet
=
gridView
.
indexSet
();
for
(;
vIt
!=
vEndIt
;
++
vIt
)
{
...
...
@@ -185,33 +190,33 @@ int main (int argc, char *argv[]) try
if (vIt->geometry().corner(0)[0] < 1.0+1e-3 /* or vIt->geometry().corner(0)[0] > upper[0]-1e-3*/ ) {
// Only translation dofs are Dirichlet
for (int j=0; j<3; j++)
dirichletNodes[
grid->leafI
ndexSet
()
.index(*vIt)][j] = true;
dirichletNodes[
i
ndexSet.index(*vIt)][j] = true;
}
if (vIt->geometry().corner(0)[0] > upper[0]-1e-3 )
neumannNodes[
grid->leafI
ndexSet
()
.index(*vIt)][0] = true;
neumannNodes[
i
ndexSet.index(*vIt)][0] = true;
#endif
#if 1 // Boundary conditions for the shearing/wrinkling example
if
(
vIt
->
geometry
().
corner
(
0
)[
1
]
<
1e-4
or
vIt
->
geometry
().
corner
(
0
)[
1
]
>
upper
[
1
]
-
1e-4
)
{
// Only translation dofs are Dirichlet
for
(
int
j
=
0
;
j
<
5
;
j
++
)
dirichletNodes
[
grid
->
leafI
ndexSet
()
.
index
(
*
vIt
)][
j
]
=
true
;
dirichletNodes
[
i
ndexSet
.
index
(
*
vIt
)][
j
]
=
true
;
}
#endif
#if 0 // Boundary conditions for the twisted-strip example
if (vIt->geometry().corner(0)[0] < lower[0]+1e-3 or vIt->geometry().corner(0)[0] > upper[0]-1e-3 ) {
// Only translation dofs are Dirichlet
for (int j=0; j<3; j++)
dirichletNodes[
grid->leafI
ndexSet
()
.index(*vIt)][j] = true;
dirichletNodes[
i
ndexSet.index(*vIt)][j] = true;
}
#endif
#if 0 // Boundary conditions for the L-shape example
if (vIt->geometry().corner(0)[0] < 1.0) {
// Only translation dofs are Dirichlet
for (int j=0; j<3; j++)
dirichletNodes[
grid->leafI
ndexSet
()
.index(*vIt)][j] = true;
dirichletNodes[
i
ndexSet.index(*vIt)][j] = true;
}
if (vIt->geometry().corner(0)[1] < -239 )
neumannNodes[
grid->leafI
ndexSet
()
.index(*vIt)][0] = true;
neumannNodes[
i
ndexSet.index(*vIt)][0] = true;
#endif
}
...
...
@@ -219,7 +224,7 @@ int main (int argc, char *argv[]) try
// Assemble Neumann term
//////////////////////////////////////////////////////////////////////////////
BoundaryPatch
<
GridType
::
Leaf
GridView
>
neumannBoundary
(
grid
->
leafGrid
View
()
,
neumannNodes
);
BoundaryPatch
<
GridView
>
neumannBoundary
(
gridView
,
neumannNodes
);
std
::
cout
<<
"Neumann boundary has "
<<
neumannBoundary
.
numFaces
()
<<
" faces
\n
"
;
...
...
@@ -227,10 +232,10 @@ int main (int argc, char *argv[]) try
// Initial solution
// //////////////////////////
vIt
=
grid
->
leaf
begin
<
dim
>
();
vIt
=
grid
View
.
begin
<
dim
>
();
for
(;
vIt
!=
vEndIt
;
++
vIt
)
{
int
idx
=
grid
->
leafI
ndexSet
()
.
index
(
*
vIt
);
int
idx
=
i
ndexSet
.
index
(
*
vIt
);
x
[
idx
].
r
=
0
;
for
(
int
i
=
0
;
i
<
dim
;
i
++
)
...
...
@@ -268,17 +273,16 @@ int main (int argc, char *argv[]) try
materialParameters
.
report
();
// Assembler using ADOL-C
CosseratEnergyLocalStiffness
<
GridType
::
Leaf
GridView
,
CosseratEnergyLocalStiffness
<
GridView
,
FEBasis
::
LocalFiniteElement
,
3
,
adouble
>
cosseratEnergyADOLCLocalStiffness
(
materialParameters
,
&
neumannBoundary
,
neumannFunction
.
get
());
LocalGeodesicFEADOLCStiffness
<
GridType
::
Leaf
GridView
,
LocalGeodesicFEADOLCStiffness
<
GridView
,
FEBasis
::
LocalFiniteElement
,
TargetSpace
>
localGFEADOLCStiffness
(
&
cosseratEnergyADOLCLocalStiffness
);
GeodesicFEAssembler
<
FEBasis
,
TargetSpace
>
assembler
(
grid
->
leafGridView
(),
&
localGFEADOLCStiffness
);
GeodesicFEAssembler
<
FEBasis
,
TargetSpace
>
assembler
(
gridView
,
&
localGFEADOLCStiffness
);
// /////////////////////////////////////////////////
// Create a Riemannian trust-region solver
...
...
@@ -303,9 +307,9 @@ int main (int argc, char *argv[]) try
// Set Dirichlet values
////////////////////////////////////////////////////////
for
(
vIt
=
grid
->
leaf
begin
<
dim
>
();
vIt
!=
vEndIt
;
++
vIt
)
{
for
(
vIt
=
grid
View
.
begin
<
dim
>
();
vIt
!=
vEndIt
;
++
vIt
)
{
int
idx
=
grid
->
leafI
ndexSet
()
.
index
(
*
vIt
);
int
idx
=
i
ndexSet
.
index
(
*
vIt
);
if
(
dirichletNodes
[
idx
][
0
])
{
// Only the positions have Dirichlet values
...
...
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