Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
dorie
dorie
Commits
14a7d5c9
Commit
14a7d5c9
authored
Aug 18, 2018
by
Lukas Riedel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for the new grid implementation
[ci skip]
parent
0507c49d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
0 deletions
+83
-0
dune/dorie/CMakeLists.txt
dune/dorie/CMakeLists.txt
+1
-0
dune/dorie/grid-test/CMakeLists.txt
dune/dorie/grid-test/CMakeLists.txt
+2
-0
dune/dorie/grid-test/grid-test.cc
dune/dorie/grid-test/grid-test.cc
+80
-0
No files found.
dune/dorie/CMakeLists.txt
View file @
14a7d5c9
...
@@ -2,6 +2,7 @@ add_subdirectory(interface)
...
@@ -2,6 +2,7 @@ add_subdirectory(interface)
add_subdirectory
(
solver
)
add_subdirectory
(
solver
)
add_subdirectory
(
impl
)
add_subdirectory
(
impl
)
add_subdirectory
(
test
)
add_subdirectory
(
test
)
add_subdirectory
(
grid-test
)
add_executable
(
"dorie"
dorie.cc
)
add_executable
(
"dorie"
dorie.cc
)
dune_target_link_libraries
(
dorie dorie-impl
${
DUNE_LIBS
}
)
dune_target_link_libraries
(
dorie dorie-impl
${
DUNE_LIBS
}
)
...
...
dune/dorie/grid-test/CMakeLists.txt
0 → 100644
View file @
14a7d5c9
add_executable
(
grid-test grid-test.cc
)
dune_target_link_libraries
(
grid-test
${
DUNE_LIBS
}
)
\ No newline at end of file
dune/dorie/grid-test/grid-test.cc
0 → 100644
View file @
14a7d5c9
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string>
#include <iostream>
#include <cstdio>
#include <thread>
#include <dune/common/exceptions.hh>
#include <dune/common/parametertree.hh>
#include <dune/common/parametertreeparser.hh>
#include <dune/common/parallel/mpihelper.hh>
#include <dune/grid/yaspgrid.hh>
#include <dune/grid/uggrid.hh>
#include <dune/grid/io/file/vtk/vtkwriter.hh>
#include <dune/dorie/solver/util_grid_creator.hh>
int
main
(
int
argc
,
char
**
argv
)
{
try
{
//Initialize Mpi
Dune
::
MPIHelper
&
helper
=
Dune
::
MPIHelper
::
instance
(
argc
,
argv
);
if
(
argc
!=
2
)
DUNE_THROW
(
Dune
::
IOError
,
"No parameter file specified!"
);
const
std
::
string
inifilename
=
argv
[
1
];
// Read ini file
Dune
::
ParameterTree
inifile
;
Dune
::
ParameterTreeParser
ptreeparser
;
ptreeparser
.
readINITree
(
inifilename
,
inifile
);
// maybe attach debugger
if
(
helper
.
size
()
>
1
&&
inifile
.
get
<
bool
>
(
"misc.debugMode"
,
false
))
{
int
i
=
0
;
std
::
cout
<<
"Attach now"
<<
std
::
endl
;
while
(
0
==
i
)
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
100
));
}
// build the grid creator
using
GridType
=
Dune
::
UGGrid
<
2
>
;
Dune
::
Dorie
::
GridCreator
<
GridType
>
gc
(
helper
,
inifile
);
auto
[
grid
,
mapper
]
=
gc
.
get_grid_and_mapper
();
auto
element_map
=
mapper
.
get_element_index_map
();
auto
boundary_map
=
mapper
.
get_boundary_index_map
();
std
::
cout
<<
"Process "
<<
helper
.
rank
()
<<
std
::
endl
;
std
::
cout
<<
"Element index map ("
<<
element_map
.
size
()
<<
"): "
;
for
(
auto
&&
value
:
element_map
)
{
std
::
cout
<<
value
<<
" "
;
}
std
::
cout
<<
std
::
endl
;
auto
gv
=
grid
->
levelGridView
(
0
);
Dune
::
VTKWriter
writer
(
gv
);
writer
.
addCellData
(
element_map
,
"mapping"
);
writer
.
pwrite
(
inifile
.
get
<
std
::
string
>
(
"output.fileName"
),
inifile
.
get
<
std
::
string
>
(
"output.outputPath"
),
"./"
);
return
0
;
}
catch
(
Dune
::
Exception
&
e
){
std
::
cerr
<<
"Dune reported error: "
<<
e
<<
std
::
endl
;
return
1
;
}
catch
(...){
std
::
cerr
<<
"Unknown exception thrown!"
<<
std
::
endl
;
throw
;
return
1
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment