Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-simon
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
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Show more breadcrumbs
simon29996
dune-simon
Commits
a6468dc6
Commit
a6468dc6
authored
4 years ago
by
simon29996
Browse files
Options
Downloads
Patches
Plain Diff
Added comments
parent
9a218b18
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dune-simon.cc
+12
-1
12 additions, 1 deletion
src/dune-simon.cc
with
12 additions
and
1 deletion
src/dune-simon.cc
+
12
−
1
View file @
a6468dc6
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
using
namespace
Dune
;
using
namespace
Dune
;
// Generate the index set Z_{eta,>}
void
indexSet
(
const
int
&
eta
,
int
&
c
,
std
::
vector
<
int
>&
k0
,
std
::
vector
<
int
>&
k1
)
void
indexSet
(
const
int
&
eta
,
int
&
c
,
std
::
vector
<
int
>&
k0
,
std
::
vector
<
int
>&
k1
)
{
{
c
=
0
;
c
=
0
;
...
@@ -51,6 +52,7 @@ void indexSet(const int& eta, int& c, std::vector<int>& k0, std::vector<int>& k1
...
@@ -51,6 +52,7 @@ void indexSet(const int& eta, int& c, std::vector<int>& k0, std::vector<int>& k1
}
}
// Generate a random graph function
template
<
class
VectorType
>
template
<
class
VectorType
>
void
generateSurfaceFunction
(
int
&
c
,
std
::
vector
<
int
>&
k0
,
std
::
vector
<
int
>&
k1
,
VectorType
&
xk
,
void
generateSurfaceFunction
(
int
&
c
,
std
::
vector
<
int
>&
k0
,
std
::
vector
<
int
>&
k1
,
VectorType
&
xk
,
VectorType
&
yk
,
const
double
&
kappa
,
const
double
&
sigma
)
VectorType
&
yk
,
const
double
&
kappa
,
const
double
&
sigma
)
...
@@ -73,6 +75,7 @@ void generateSurfaceFunction(int& c, std::vector<int>& k0, std::vector<int>& k1,
...
@@ -73,6 +75,7 @@ void generateSurfaceFunction(int& c, std::vector<int>& k0, std::vector<int>& k1,
}
}
// Evaluate the first fundamental form of the surface at a given point x
template
<
class
CoordinateType
,
class
VectorType
,
class
MatrixType
>
template
<
class
CoordinateType
,
class
VectorType
,
class
MatrixType
>
void
getFundamentalMatrix
(
CoordinateType
&
x
,
MatrixType
&
fundamentalmatrix
,
int
&
c
,
void
getFundamentalMatrix
(
CoordinateType
&
x
,
MatrixType
&
fundamentalmatrix
,
int
&
c
,
std
::
vector
<
int
>&
k0
,
std
::
vector
<
int
>&
k1
,
VectorType
&
xk
,
VectorType
&
yk
,
double
&
pi
)
std
::
vector
<
int
>&
k0
,
std
::
vector
<
int
>&
k1
,
VectorType
&
xk
,
VectorType
&
yk
,
double
&
pi
)
...
@@ -99,6 +102,7 @@ void getFundamentalMatrix(CoordinateType& x, MatrixType& fundamentalmatrix, int&
...
@@ -99,6 +102,7 @@ void getFundamentalMatrix(CoordinateType& x, MatrixType& fundamentalmatrix, int&
}
}
// Assemble the local stiffness and mass matrices
template
<
class
LocalView
,
class
VectorType
,
class
MatrixType
>
template
<
class
LocalView
,
class
VectorType
,
class
MatrixType
>
void
getLocalMatrices
(
const
LocalView
&
localview
,
MatrixType
&
localstiffnessmatrix
,
void
getLocalMatrices
(
const
LocalView
&
localview
,
MatrixType
&
localstiffnessmatrix
,
MatrixType
&
localmassmatrix
,
int
&
c
,
std
::
vector
<
int
>&
k0
,
std
::
vector
<
int
>&
k1
,
MatrixType
&
localmassmatrix
,
int
&
c
,
std
::
vector
<
int
>&
k0
,
std
::
vector
<
int
>&
k1
,
...
@@ -177,6 +181,7 @@ void getLocalMatrices(const LocalView& localview, MatrixType& localstiffnessmatr
...
@@ -177,6 +181,7 @@ void getLocalMatrices(const LocalView& localview, MatrixType& localstiffnessmatr
}
}
// Return true/false depending on if the index is on the right or top boundary of the domain
template
<
class
IndexType
>
template
<
class
IndexType
>
bool
isOnBoundary
(
IndexType
&
index
,
const
int
&
elementnumber
,
const
int
&
feorder
)
bool
isOnBoundary
(
IndexType
&
index
,
const
int
&
elementnumber
,
const
int
&
feorder
)
{
{
...
@@ -205,6 +210,7 @@ bool isOnBoundary(IndexType& index, const int& elementnumber, const int& feorder
...
@@ -205,6 +210,7 @@ bool isOnBoundary(IndexType& index, const int& elementnumber, const int& feorder
}
}
// Shift index, if it is on the right/top boundary, to the identified one on the left/bottom boundary
template
<
class
IndexType
>
template
<
class
IndexType
>
void
indexCorrection
(
IndexType
&
index
,
const
int
&
elementnumber
,
const
int
&
feorder
)
void
indexCorrection
(
IndexType
&
index
,
const
int
&
elementnumber
,
const
int
&
feorder
)
{
{
...
@@ -276,6 +282,7 @@ void getOccupationPattern(const FEBasis& febasis, MatrixIndexSet& matrixindexset
...
@@ -276,6 +282,7 @@ void getOccupationPattern(const FEBasis& febasis, MatrixIndexSet& matrixindexset
}
}
// Add nonzero entries on the diagonal of the boundary nodes
for
(
int
i
=
0
;
i
<
n
;
i
++
){
for
(
int
i
=
0
;
i
<
n
;
i
++
){
if
(
isOnBoundary
(
i
,
elementnumber
,
feorder
)){
if
(
isOnBoundary
(
i
,
elementnumber
,
feorder
)){
matrixindexset
.
add
(
i
,
i
);
matrixindexset
.
add
(
i
,
i
);
...
@@ -352,6 +359,7 @@ void assembleMatrices(const FEBasis& febasis, MatrixType& stiffnessmatrix, Matri
...
@@ -352,6 +359,7 @@ void assembleMatrices(const FEBasis& febasis, MatrixType& stiffnessmatrix, Matri
}
}
// Make the stiffness matrix to the identity for all boundary nodes to ensure that the final matrix is invertible
for
(
int
i
=
0
;
i
<
n
;
i
++
){
for
(
int
i
=
0
;
i
<
n
;
i
++
){
if
(
isOnBoundary
(
i
,
elementnumber
,
feorder
)){
if
(
isOnBoundary
(
i
,
elementnumber
,
feorder
)){
stiffnessmatrix
[
i
][
i
]
=
1
;
stiffnessmatrix
[
i
][
i
]
=
1
;
...
@@ -361,6 +369,7 @@ void assembleMatrices(const FEBasis& febasis, MatrixType& stiffnessmatrix, Matri
...
@@ -361,6 +369,7 @@ void assembleMatrices(const FEBasis& febasis, MatrixType& stiffnessmatrix, Matri
}
}
// Copy all values of a vector to the identified boundary points
template
<
class
VectorType
>
template
<
class
VectorType
>
void
copyToBoundary
(
VectorType
&
vector
,
const
int
&
n
,
const
int
&
elementnumber
,
const
int
&
feorder
)
void
copyToBoundary
(
VectorType
&
vector
,
const
int
&
n
,
const
int
&
elementnumber
,
const
int
&
feorder
)
{
{
...
@@ -374,6 +383,7 @@ void copyToBoundary(VectorType& vector, const int& n, const int& elementnumber,
...
@@ -374,6 +383,7 @@ void copyToBoundary(VectorType& vector, const int& n, const int& elementnumber,
}
}
// Interpolate the surface function in the grid view
template
<
class
FEBasis
,
class
GridView
,
class
VectorType
>
template
<
class
FEBasis
,
class
GridView
,
class
VectorType
>
void
interpolateSurfaceFunction
(
const
FEBasis
&
febasis
,
GridView
&
gridview
,
VectorType
&
surface
,
void
interpolateSurfaceFunction
(
const
FEBasis
&
febasis
,
GridView
&
gridview
,
VectorType
&
surface
,
std
::
vector
<
char
>&
nonboundarynodes
,
const
int
&
elementnumber
,
const
int
&
feorder
,
int
&
c
,
std
::
vector
<
int
>&
k0
,
std
::
vector
<
char
>&
nonboundarynodes
,
const
int
&
elementnumber
,
const
int
&
feorder
,
int
&
c
,
std
::
vector
<
int
>&
k0
,
...
@@ -400,6 +410,7 @@ void interpolateSurfaceFunction(const FEBasis& febasis, GridView& gridview, Vect
...
@@ -400,6 +410,7 @@ void interpolateSurfaceFunction(const FEBasis& febasis, GridView& gridview, Vect
}
}
// Compute one implicit Euler step
template
<
class
FEBasis
,
class
Solver
,
class
VectorType
,
class
MatrixType
>
template
<
class
FEBasis
,
class
Solver
,
class
VectorType
,
class
MatrixType
>
void
implicitEuler
(
const
FEBasis
&
febasis
,
Solver
&
solver
,
VectorType
&
iter
,
void
implicitEuler
(
const
FEBasis
&
febasis
,
Solver
&
solver
,
VectorType
&
iter
,
MatrixType
&
massmatrix
)
MatrixType
&
massmatrix
)
...
...
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