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
cb2f87d3
Commit
cb2f87d3
authored
15 years ago
by
Oliver Sander
Committed by
sander@PCPOOL.MI.FU-BERLIN.DE
15 years ago
Browse files
Options
Downloads
Patches
Plain Diff
beginning a global assembler for general geodesic fe problems
[[Imported from SVN: r4024]]
parent
1e49289f
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
src/geodesicfeassembler.hh
+133
-0
133 additions, 0 deletions
src/geodesicfeassembler.hh
with
133 additions
and
0 deletions
src/geodesicfeassembler.hh
0 → 100644
+
133
−
0
View file @
cb2f87d3
#ifndef GLOBAL_GEODESIC_FE_ASSEMBLER_HH
#define GLOBAL_GEODESIC_FE_ASSEMBLER_HH
#include
<dune/istl/bcrsmatrix.hh>
#include
<dune/common/fmatrix.hh>
#include
<dune/istl/matrixindexset.hh>
#include
<dune/istl/matrix.hh>
#include
"localgeodesicfestiffness.hh"
/** \brief A global FE assembler for problems involving functions that map into non-Euclidean spaces
*/
template
<
class
GridView
,
class
TargetSpace
>
class
GeodesicFEAssembler
{
typedef
typename
GridView
::
template
Codim
<
0
>
::
Entity
EntityType
;
typedef
typename
GridView
::
template
Codim
<
0
>
::
EntityPointer
EntityPointer
;
typedef
typename
GridView
::
template
Codim
<
0
>
::
Iterator
ElementIterator
;
//! Dimension of the grid.
enum
{
gridDim
=
GridView
::
dimension
};
//! Dimension of a tangent space
enum
{
blocksize
=
TargetSpace
::
TangentVector
::
size
};
//!
typedef
Dune
::
FieldMatrix
<
double
,
blocksize
,
blocksize
>
MatrixBlock
;
const
GridView
gridView_
;
const
LocalGeodesicFEStiffness
<
GridView
,
TargetSpace
>*
localStiffness_
;
public
:
/** \brief Constructor for a given grid */
GeodesicFEAssembler
(
const
GridView
&
gridView
)
:
gridView_
(
gridView
)
{}
/** \brief Assemble the tangent stiffness matrix
*/
void
assembleMatrix
(
const
std
::
vector
<
TargetSpace
>&
sol
,
Dune
::
BCRSMatrix
<
MatrixBlock
>&
matrix
)
const
;
/** \brief Assemble the gradient */
void
assembleGradient
(
const
std
::
vector
<
TargetSpace
>&
sol
,
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
blocksize
>
>&
grad
)
const
;
/** \brief Assemble the gradient using a finite difference approximation */
void
assembleGradientFD
(
const
std
::
vector
<
TargetSpace
>&
sol
,
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
blocksize
>
>&
grad
)
const
;
/** \brief Compute the energy of a deformation state */
double
computeEnergy
(
const
std
::
vector
<
TargetSpace
>&
sol
)
const
;
protected
:
void
getNeighborsPerVertex
(
Dune
::
MatrixIndexSet
&
nb
)
const
;
};
// end class
template
<
class
GridView
,
class
TargetSpace
>
void
GeodesicFEAssembler
<
GridView
,
TargetSpace
>::
getNeighborsPerVertex
(
Dune
::
MatrixIndexSet
&
nb
)
const
{
const
typename
GridView
::
IndexSet
&
indexSet
=
gridView_
->
indexSet
();
int
n
=
gridView_
->
size
(
gridDim
);
nb
.
resize
(
n
,
n
);
ElementIterator
it
=
gridView_
->
template
begin
<
0
>();
ElementIterator
endit
=
gridView_
->
template
end
<
0
>
();
for
(;
it
!=
endit
;
++
it
)
{
for
(
int
i
=
0
;
i
<
it
->
template
count
<
gridDim
>();
i
++
)
{
for
(
int
j
=
0
;
j
<
it
->
template
count
<
gridDim
>();
j
++
)
{
int
iIdx
=
indexSet
.
subIndex
(
*
it
,
i
,
gridDim
);
int
jIdx
=
indexSet
.
subIndex
(
*
it
,
j
,
gridDim
);
nb
.
add
(
iIdx
,
jIdx
);
}
}
}
}
template
<
class
GridView
,
class
TargetSpace
>
double
GeodesicFEAssembler
<
GridView
,
TargetSpace
>::
computeEnergy
(
const
std
::
vector
<
TargetSpace
>&
sol
)
const
{
double
energy
=
0
;
const
typename
GridView
::
IndexSet
&
indexSet
=
gridView_
.
indexSet
();
if
(
sol
.
size
()
!=
indexSet
.
size
(
gridDim
))
DUNE_THROW
(
Dune
::
Exception
,
"Solution vector doesn't match the grid!"
);
std
::
vector
<
TargetSpace
>
localSolution
;
ElementIterator
it
=
gridView_
.
template
begin
<
0
>();
ElementIterator
endIt
=
gridView_
.
template
end
<
0
>();
// Loop over all elements
for
(;
it
!=
endIt
;
++
it
)
{
localSolution
.
resize
(
it
->
template
count
<
gridDim
>());
for
(
int
i
=
0
;
i
<
it
->
template
count
<
gridDim
>();
i
++
)
localSolution
[
i
]
=
sol
[
indexSet
.
subIndex
(
*
it
,
i
,
gridDim
)];
energy
+=
localStiffness_
->
energy
(
*
it
,
localSolution
);
}
return
energy
;
}
#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