Commit 03ebd5b5 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

moved examples to tests

parent 94411458
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 dunepolygongrid
dune_add_test(SOURCES polygongrid.cc
LINK_LIBRARIES dunevtk dunepolygongrid)
endif ()
add_subdirectory(test)
\ No newline at end of file
......@@ -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";
}
}
......
......@@ -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());
});
}
......@@ -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
......@@ -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");
}
......@@ -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
......@@ -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
}
......
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
......
......@@ -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
......@@ -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
......@@ -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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment