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
c52b2bf5
Commit
c52b2bf5
authored
13 years ago
by
Elias Pipping
Committed by
Elias Pipping
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove faulty gauss-seidel sample
parent
63e014d5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Makefile.am
+0
-4
0 additions, 4 deletions
src/Makefile.am
src/gauss-seidel-sample.cc
+0
-50
0 additions, 50 deletions
src/gauss-seidel-sample.cc
src/gaussseidel.hh
+0
-52
0 additions, 52 deletions
src/gaussseidel.hh
with
0 additions
and
106 deletions
src/Makefile.am
+
0
−
4
View file @
c52b2bf5
...
...
@@ -5,15 +5,11 @@ check_PROGRAMS = \
test-gradient-method
bin_PROGRAMS
=
\
gauss-seidel-sample
\
one-body-sample
one_body_sample_SOURCES
=
\
one-body-sample.cc
gauss_seidel_sample_SOURCES
=
\
gauss-seidel-sample.cc gaussseidel.hh
test_python_SOURCES
=
\
test-python.cc
...
...
This diff is collapsed.
Click to expand it.
src/gauss-seidel-sample.cc
deleted
100644 → 0
+
0
−
50
View file @
63e014d5
/* -*- mode:c++; mode:semantic -*- */
#ifdef HAVE_CONFIG_H
#include
"config.h"
#endif
#include
<dune/common/fmatrix.hh>
#include
<dune/common/fvector.hh>
#include
"nicefunction.hh"
#include
"mynonlinearity.hh"
#include
"gaussseidel.hh"
int
main
()
{
size_t
const
dimension
=
3
;
typedef
Dune
::
FieldMatrix
<
double
,
dimension
,
dimension
>
LocalMatrix
;
typedef
Dune
::
FieldVector
<
double
,
dimension
>
LocalVector
;
size_t
const
nodes
=
10
;
typedef
Dune
::
FieldMatrix
<
LocalMatrix
,
nodes
,
nodes
>
GlobalMatrix
;
typedef
Dune
::
FieldVector
<
LocalVector
,
nodes
>
GlobalVector
;
GlobalMatrix
A
;
// semi-random data
for
(
size_t
i
=
0
;
i
<
nodes
;
++
i
)
for
(
size_t
k
=
0
;
k
<
nodes
;
++
k
)
for
(
size_t
j
=
0
;
j
<
dimension
;
++
j
)
for
(
size_t
l
=
0
;
l
<
dimension
;
++
l
)
A
[
i
][
k
][
j
][
l
]
=
((
i
==
k
)
&&
(
j
==
l
)
?
1
:
0
);
GlobalVector
b
;
// semi-random data
for
(
size_t
i
=
0
;
i
<
nodes
;
++
i
)
for
(
size_t
j
=
0
;
j
<
dimension
;
++
j
)
b
[
i
][
j
]
=
1
;
Dune
::
SampleFunction
const
f
=
Dune
::
SampleFunction
();
// semi-random function
Dune
::
MyNonlinearity
<
dimension
>
const
phi
(
f
);
GlobalVector
unu
(
LocalVector
(
0
));
// semi-random data
for
(
size_t
m
=
0
;
m
<
nodes
;
++
m
)
for
(
size_t
j
=
0
;
j
<
dimension
;
++
j
)
unu
[
m
][
j
]
=
m
+
j
;
GaussSeidel
(
unu
,
A
,
b
,
phi
);
std
::
cout
<<
std
::
endl
<<
std
::
endl
;
GaussSeidel
(
unu
,
A
,
b
,
phi
);
return
0
;
}
This diff is collapsed.
Click to expand it.
src/gaussseidel.hh
deleted
100644 → 0
+
0
−
52
View file @
63e014d5
/* -*- mode:c++; mode:semantic -*- */
#include
<dune/common/fmatrix.hh>
#include
<dune/common/fvector.hh>
#include
"nicefunction.hh"
#include
"mynonlinearity.hh"
#include
"samplefunctional.hh"
// Just for debugging
template
<
int
dim
,
int
nodes
>
double
J_eval
(
Dune
::
FieldMatrix
<
Dune
::
FieldMatrix
<
double
,
dim
,
dim
>
,
nodes
,
nodes
>
const
&
A
,
Dune
::
FieldVector
<
Dune
::
FieldVector
<
double
,
dim
>
,
nodes
>
const
&
b
,
Dune
::
MyNonlinearity
<
dim
>
phi
,
Dune
::
FieldVector
<
Dune
::
FieldVector
<
double
,
dim
>
,
nodes
>
const
&
v
)
{
double
ret
=
0
;
for
(
size_t
i
=
0
;
i
<
nodes
;
++
i
)
{
for
(
size_t
k
=
0
;
k
<
nodes
;
++
k
)
{
Dune
::
FieldMatrix
<
double
,
dim
,
dim
>
const
localA
=
A
[
i
][
k
];
Dune
::
FieldVector
<
double
,
dim
>
tmp
;
localA
.
mv
(
v
[
k
],
tmp
);
ret
+=
1
/
2
*
(
tmp
*
v
[
i
]);
}
ret
-=
b
[
i
]
*
v
[
i
];
ret
+=
phi
(
v
[
i
]);
// an example of phi^i(v[i]) (phi is independent of i here)
}
return
ret
;
}
template
<
int
dim
,
int
nodes
>
void
GaussSeidel
(
Dune
::
FieldVector
<
Dune
::
FieldVector
<
double
,
dim
>
,
nodes
>
&
unu
,
Dune
::
FieldMatrix
<
Dune
::
FieldMatrix
<
double
,
dim
,
dim
>
,
nodes
,
nodes
>
const
&
A
,
Dune
::
FieldVector
<
Dune
::
FieldVector
<
double
,
dim
>
,
nodes
>
const
&
b
,
Dune
::
MyNonlinearity
<
dim
>
const
&
phi
)
{
for
(
size_t
m
=
0
;
m
<
nodes
;
++
m
)
{
typename
Dune
::
SampleFunctional
<
dim
>::
SmallVector
const
localb
=
b
[
m
];
typename
Dune
::
SampleFunctional
<
dim
>::
SmallMatrix
const
localA
=
A
[
m
][
m
];
Dune
::
SampleFunctional
<
dim
>
J
(
localA
,
localb
,
phi
);
typename
Dune
::
SampleFunctional
<
dim
>::
SmallVector
correction
;
for
(
size_t
local_iteration
=
0
;
local_iteration
<
2
;
++
local_iteration
)
{
// 2 is random here
Dune
::
minimise
(
J
,
unu
[
m
],
correction
);
unu
[
m
]
+=
correction
;
}
std
::
cout
<<
J_eval
(
A
,
b
,
phi
,
unu
)
<<
std
::
endl
;
// debugging
}
}
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