Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iwr
dune-vtk
Commits
03ebd5b5
Commit
03ebd5b5
authored
Sep 04, 2018
by
Praetorius, Simon
Browse files
moved examples to tests
parent
94411458
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
03ebd5b5
dune_add_test
(
SOURCES vtkreader.cc
LINK_LIBRARIES dunevtk
)
add_executable
(
"vtkreader"
vtkreader.cc
)
target_link_dune_default_libraries
(
"vtkreader"
)
target_link_libraries
(
"vtkreader"
dunevtk
)
dune_add_test
(
SOURCES legacyvtkwriter.cc
LINK_LIBRARIES dunevtk
)
add_executable
(
"legacyvtkwriter"
legacyvtkwriter.cc
)
target_link_dune_default_libraries
(
"legacyvtkwriter"
)
target_link_libraries
(
"legacyvtkwriter"
dunevtk
)
if
(
dune-functions_FOUND
)
add_executable
(
"vtkwriter"
vtkwriter.cc
)
target_link_dune_default_libraries
(
"vtkwriter"
)
target_link_libraries
(
"vtkwriter"
dunevtk
)
dune_add_test
(
SOURCES vtkwriter.cc
LINK_LIBRARIES dunevtk
CMAKE_GUARD dune-functions_FOUND
)
add_executable
(
"benchmark"
benchmark.cc
)
target_link_dune_default_libraries
(
"benchmark"
)
target_link_libraries
(
"benchmark"
dunevtk
)
dune_add_test
(
SOURCES
benchmark.cc
LINK_LIBRARIES dunevtk
CMAKE_GUARD dune-functions_FOUND
)
add_executable
(
"datacollector"
datacollector.cc
)
target_link_dune_default_libraries
(
"datacollector"
)
target_link_libraries
(
"datacollector"
dunevtk
)
dune_add_test
(
SOURCES
datacollector.cc
LINK_LIBRARIES dunevtk
CMAKE_GUARD dune-functions_FOUND
)
add_executable
(
"structuredgridwriter"
structuredgridwriter.cc
)
target_link_dune_default_libraries
(
"structuredgridwriter"
)
target_link_libraries
(
"structuredgridwriter"
dunevtk
)
dune_add_test
(
SOURCES
structuredgridwriter.cc
LINK_LIBRARIES dunevtk
CMAKE_GUARD dune-functions_FOUND
)
add_executable
(
"geometrygrid"
geometrygrid.cc
)
target_link_dune_default_libraries
(
"geometrygrid"
)
target_link_libraries
(
"geometrygrid"
dunevtk
)
dune_add_test
(
SOURCES
geometrygrid.cc
LINK_LIBRARIES dunevtk
CMAKE_GUARD dune-functions_FOUND
)
add_executable
(
"timeserieswriter"
timeserieswriter.cc
)
target_link_dune_default_libraries
(
"timeserieswriter"
)
target_link_libraries
(
"timeserieswriter"
dunevtk
)
dune_add_test
(
SOURCES
timeserieswriter.cc
LINK_LIBRARIES dunevtk
CMAKE_GUARD dune-functions_FOUND
)
add_executable
(
"pvdwriter"
pvdwriter.cc
)
target_link_dune_default_libraries
(
"pvdwriter"
)
target_link_libraries
(
"pvdwriter"
dunevtk
)
dune_add_test
(
SOURCES pvdwriter.cc
LINK_LIBRARIES dunevtk
CMAKE_GUARD dune-functions_FOUND
)
dune_add_test
(
SOURCES vectorwriter.cc
LINK_LIBRARIES dunevtk
CMAKE_GUARD dune-functions_FOUND
)
add_executable
(
"vectorwriter"
vectorwriter.cc
)
target_link_dune_default_libraries
(
"vectorwriter"
)
target_link_libraries
(
"vectorwriter"
dunevtk
)
endif
()
if
(
dune-polygongrid_FOUND
)
add_executable
(
"polygongrid"
polygongrid
.cc
)
target_link_dune_default_libraries
(
"
polygongrid
"
)
target_link_libraries
(
"polygongrid"
dunevtk dunepolygongrid
)
# CMAKE_GUARD can not be used, since a dummy target is created and linked against dune
polygongrid
dune_add_test
(
SOURCES
polygongrid
.cc
LINK_LIBRARIES
dunevtk dunepolygongrid
)
endif
()
add_subdirectory
(
test
)
\ No newline at end of file
src/benchmark.cc
View file @
03ebd5b5
...
...
@@ -50,7 +50,7 @@ void writer_old (GridView const& gridView)
for
(
auto
const
&
test_case
:
test_cases_old
)
{
t
.
reset
();
VTKWriter
<
GridView
>
vtkWriter
(
gridView
,
std
::
get
<
2
>
(
test_case
));
vtkWriter
.
write
(
"writer_old_"
+
std
::
get
<
0
>
(
test_case
)
+
".vtu"
,
vtkWriter
.
write
(
"
benchmark_
writer_old_"
+
std
::
get
<
0
>
(
test_case
)
+
".vtu"
,
std
::
get
<
1
>
(
test_case
));
std
::
cout
<<
" time (writer_old_"
+
std
::
get
<
0
>
(
test_case
)
+
") = "
<<
t
.
elapsed
()
<<
"
\n
"
;
}
...
...
@@ -63,7 +63,7 @@ void writer_new (GridView const& gridView)
for
(
auto
const
&
test_case
:
test_cases_new
)
{
t
.
reset
();
VtkUnstructuredGridWriter
<
GridView
>
vtkWriter
(
gridView
,
std
::
get
<
1
>
(
test_case
),
std
::
get
<
2
>
(
test_case
));
vtkWriter
.
write
(
"writer_new_"
+
std
::
get
<
0
>
(
test_case
)
+
".vtu"
);
vtkWriter
.
write
(
"
benchmark_
writer_new_"
+
std
::
get
<
0
>
(
test_case
)
+
".vtu"
);
std
::
cout
<<
" time (writer_new_"
+
std
::
get
<
0
>
(
test_case
)
+
") = "
<<
t
.
elapsed
()
<<
"
\n
"
;
}
}
...
...
src/datacollector.cc
View file @
03ebd5b5
...
...
@@ -79,6 +79,6 @@ int main(int argc, char** argv)
FieldVector
<
double
,
dim
.
value
>
upperRight
;
upperRight
=
1.0
;
auto
numElements
=
filledArray
<
dim
.
value
,
int
>
(
8
);
GridType
grid
(
upperRight
,
numElements
,
0
,
0
);
write
(
"yasp"
,
grid
.
leafGridView
());
write
(
"
datacollector_
yasp"
,
grid
.
leafGridView
());
});
}
src/geometrygrid.cc
View file @
03ebd5b5
...
...
@@ -74,5 +74,5 @@ int main (int argc, char** argv)
using
Grid
=
GeometryGrid
<
HostGrid
,
TorusMapper
>
;
Grid
grid
{
hostGrid
,
mapper
};
write
(
"torus"
,
grid
.
leafGridView
());
write
(
"
geometrygrid_
torus"
,
grid
.
leafGridView
());
}
\ No newline at end of file
src/legacyvtkwriter.cc
View file @
03ebd5b5
...
...
@@ -40,5 +40,5 @@ int main(int argc, char** argv)
using
Writer
=
VtkUnstructuredGridWriter
<
GridView
>
;
Writer
vtkWriter
(
gridView
,
Vtk
::
ASCII
);
vtkWriter
.
addPointData
(
p1FctWrapped
);
vtkWriter
.
write
(
"
test
_ascii_float32.vtu"
);
vtkWriter
.
write
(
"
legacyvtkwriter
_ascii_float32.vtu"
);
}
src/pvdwriter.cc
View file @
03ebd5b5
...
...
@@ -54,5 +54,5 @@ int main (int argc, char** argv)
FieldVector
<
double
,
2
>
upperRight
;
upperRight
=
1.0
;
auto
numElements
=
filledArray
<
2
,
int
>
(
8
);
GridType
grid
(
upperRight
,
numElements
,
0
,
0
);
write
(
"yasp"
,
grid
.
leafGridView
());
write
(
"
pvdwriter_
yasp"
,
grid
.
leafGridView
());
}
\ No newline at end of file
src/structuredgridwriter.cc
View file @
03ebd5b5
...
...
@@ -81,7 +81,7 @@ void write_yaspgrid(std::integral_constant<int,dim>)
GridType
grid
(
upperRight
,
numElements
,
0
,
0
);
grid
.
globalRefine
(
1
);
write
(
"yasp_"
+
std
::
to_string
(
dim
)
+
"d_"
,
grid
.
leafGridView
());
write
(
"
structuredgridwriter_
yasp_"
+
std
::
to_string
(
dim
)
+
"d_"
,
grid
.
leafGridView
());
}
template
<
int
dim
>
...
...
@@ -94,7 +94,7 @@ void write_spgrid(std::integral_constant<int,dim>)
GridType
grid
(
SPDomain
<
double
,
dim
>::
unitCube
(),
numElements
);
// grid.globalRefine(1);
write
(
"sp_"
+
std
::
to_string
(
dim
)
+
"d_"
,
grid
.
leafGridView
());
write
(
"
structuredgridwriter_
sp_"
+
std
::
to_string
(
dim
)
+
"d_"
,
grid
.
leafGridView
());
#endif
}
...
...
src/test/CMakeLists.txt
View file @
03ebd5b5
dune_add_test
(
SOURCES reader_writer_test.cc
LINK_LIBRARIES dunevtk
CMAKE_GUARD
)
LINK_LIBRARIES dunevtk
)
dune_add_test
(
SOURCES mixed_element_test.cc
LINK_LIBRARIES dunevtk
...
...
src/timeserieswriter.cc
View file @
03ebd5b5
...
...
@@ -53,5 +53,5 @@ int main (int argc, char** argv)
FieldVector
<
double
,
3
>
upperRight
;
upperRight
=
1.0
;
auto
numElements
=
filledArray
<
3
,
int
>
(
8
);
GridType
grid
(
upperRight
,
numElements
,
0
,
0
);
write
(
"yasp"
,
grid
.
leafGridView
());
write
(
"
timeserieswriter_
yasp"
,
grid
.
leafGridView
());
}
\ No newline at end of file
src/vectorwriter.cc
View file @
03ebd5b5
...
...
@@ -72,6 +72,6 @@ int main (int argc, char** argv)
FieldVector
<
double
,
dim
.
value
>
upperRight
;
upperRight
=
1.0
;
auto
numElements
=
filledArray
<
dim
.
value
,
int
>
(
8
);
GridType
grid
(
upperRight
,
numElements
,
0
,
0
);
write
(
"yasp
_vec
"
,
grid
.
leafGridView
());
write
(
"
vectorwriter_
yasp"
,
grid
.
leafGridView
());
});
}
\ No newline at end of file
src/vtkwriter.cc
View file @
03ebd5b5
...
...
@@ -83,7 +83,7 @@ int main (int argc, char** argv)
auto
numElements
=
filledArray
<
dim
.
value
,
unsigned
int
>
(
8
);
auto
gridPtr
=
StructuredGridFactory
<
GridType
>::
createSimplexGrid
(
lowerLeft
,
upperRight
,
numElements
);
write
(
"ug"
,
gridPtr
->
leafGridView
());
write
(
"
vtkwriter_
ug"
,
gridPtr
->
leafGridView
());
}
});
#endif
...
...
@@ -95,6 +95,6 @@ int main (int argc, char** argv)
FieldVector
<
double
,
dim
.
value
>
upperRight
;
upperRight
=
1.0
;
auto
numElements
=
filledArray
<
dim
.
value
,
int
>
(
8
);
GridType
grid
(
upperRight
,
numElements
,
0
,
0
);
write
(
"yasp"
,
grid
.
leafGridView
());
write
(
"
vtkwriter_
yasp"
,
grid
.
leafGridView
());
});
}
\ No newline at end of file
Write
Preview
Supports
Markdown
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