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
a5024f3b
Commit
a5024f3b
authored
13 years ago
by
Elias Pipping
Committed by
Elias Pipping
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Move evaluate from octave to dune
parent
2e62f69b
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/Makefile.am
+1
-0
1 addition, 0 deletions
src/Makefile.am
src/duneevaluate.cc
+39
-0
39 additions, 0 deletions
src/duneevaluate.cc
src/duneevaluate.mk
+10
-0
10 additions, 0 deletions
src/duneevaluate.mk
src/foo.m
+2
-6
2 additions, 6 deletions
src/foo.m
with
52 additions
and
6 deletions
src/Makefile.am
+
1
−
0
View file @
a5024f3b
...
@@ -49,3 +49,4 @@ run-octave: duneevaluate.oct duneminimise.oct
...
@@ -49,3 +49,4 @@ run-octave: duneevaluate.oct duneminimise.oct
octave
--path
$(
abs_builddir
)
--path
$(
abs_srcdir
)
octave
--path
$(
abs_builddir
)
--path
$(
abs_srcdir
)
include
$(srcdir)/duneminimise.mk
include
$(srcdir)/duneminimise.mk
include
$(srcdir)/duneevaluate.mk
This diff is collapsed.
Click to expand it.
src/duneevaluate.cc
0 → 100644
+
39
−
0
View file @
a5024f3b
/* -*- mode:c++; mode:semantic -*- */
#include
<octave/oct.h>
#ifdef HAVE_CONFIG_H
#include
"config.h"
#endif
#include
"samplefunctional.hh"
#include
<cassert>
DEFUN_DLD
(
duneevaluate
,
args
,
nargout
,
"the help string"
)
{
assert
(
args
.
length
()
==
1
);
ColumnVector
point
(
args
(
0
).
matrix_value
());
// FIXME: We're only working with dimension two for now
assert
(
point
.
length
()
==
2
);
int
const
dim
=
2
;
typedef
Dune
::
SampleFunctional
<
dim
>
SampleFunctional
;
SampleFunctional
::
SmallMatrix
A
;
A
[
0
][
0
]
=
3
;
A
[
0
][
1
]
=
1.5
;
A
[
1
][
0
]
=
1.5
;
A
[
1
][
1
]
=
4
;
SampleFunctional
::
SmallVector
b
;
b
[
0
]
=
1
;
b
[
1
]
=
2
;
SampleFunctional
::
SmallVector
our_point
;
our_point
[
0
]
=
point
(
0
);
our_point
[
1
]
=
point
(
1
);
Dune
::
SampleFunction
f
;
SampleFunctional
J
(
A
,
b
,
Dune
::
MyNonlinearity
<
dim
>
(
f
));
return
octave_value
(
J
(
our_point
));
}
This diff is collapsed.
Click to expand it.
src/duneevaluate.mk
0 → 100644
+
10
−
0
View file @
a5024f3b
bin_PROGRAMS
+=
duneminimise.oct
# this would work if shared libraries were only passed via -L and -l, not directly
#duneminimise_LINK = libtool --tag=CXX --mode link $(MKOCTFILE) $(AM_LDFLAGS) -o $@
duneevaluate.oct
:
duneevaluate.o
$(
MKOCTFILE
)
-o
$@
$<
-ldunecommon
duneevaluate.o
:
duneevaluate.cc
$(
MKOCTFILE
)
$(
AM_CPPFLAGS
)
-c
-o
$@
$<
This diff is collapsed.
Click to expand it.
src/foo.m
+
2
−
6
View file @
a5024f3b
...
@@ -8,15 +8,11 @@ y = (-300:10:300)';
...
@@ -8,15 +8,11 @@ y = (-300:10:300)';
v
=
ones
(
length
(
x
),
1
);
v
=
ones
(
length
(
x
),
1
);
X
=
v
*
x
;
X
=
v
*
x
;
Y
=
y
*
v
'
;
Y
=
y
*
v
'
;
A
=
[
3
1.5
;
1.5
4
];
b
=
[
1
;
2
];
myfunc
=
@
(
x
)(
1
/
2
*
(
A
*
x
)
' * x - b'
*
x
+
H
(
norm
(
x
)));
for
i
=
1
:
length
(
x
)
for
i
=
1
:
length
(
x
)
for
j
=
1
:
length
(
y
)
for
j
=
1
:
length
(
y
)
vec
=
[
X
(
i
,
j
);
Y
(
i
,
j
)
];
vec
=
[
X
(
i
,
j
);
Y
(
i
,
j
)
];
val
=
myfunc
(
vec
);
val
=
duneevaluate
(
vec
);
f
(
i
,
j
)
=
val
;
f
(
i
,
j
)
=
val
;
end
end
end
end
...
@@ -30,7 +26,7 @@ for i=1:6
...
@@ -30,7 +26,7 @@ for i=1:6
newvec
=
duneminimise
(
oldvec
);
newvec
=
duneminimise
(
oldvec
);
line
([
oldvec
(
1
)
newvec
(
1
)],
...
line
([
oldvec
(
1
)
newvec
(
1
)],
...
[
oldvec
(
2
)
newvec
(
2
)],
...
[
oldvec
(
2
)
newvec
(
2
)],
...
[
myfunc
(
oldvec
)
myfunc
(
newvec
)],
...
[
duneevaluate
(
oldvec
)
duneevaluate
(
newvec
)],
...
'color'
,
'r'
);
'color'
,
'r'
);
norm
(
oldvec
-
newvec
)
norm
(
oldvec
-
newvec
)
oldvec
=
newvec
;
oldvec
=
newvec
;
...
...
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