Skip to content
Snippets Groups Projects
Commit fdb05845 authored by Timo Koch's avatar Timo Koch
Browse files

[gridmanager][test] Add mmesh test

parent 66d3b715
No related branches found
No related tags found
1 merge request!1751[mmesh] Add grid manager for dune-mmesh.
......@@ -249,3 +249,9 @@ dune_add_test(NAME test_gmshboundaryflag_caching
LABELS unit io
CMAKE_GUARD "( dune-alugrid_FOUND )"
)
dune_add_test(NAME test_gridmanager_mmesh
SOURCES test_gridmanager_mmesh.cc
LABELS unit io
CMAKE_GUARD "( dune-mmesh_FOUND )"
)
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \brief Test for the mmesh grid manager
*/
#include <config.h>
#include <dune/common/parallel/mpihelper.hh>
#include <dune/grid/io/file/vtk.hh>
#include <dumux/io/grid/gridmanager_mmesh.hh>
int main(int argc, char** argv) try
{
using namespace Dumux;
// Initialize MPI, finalize is done automatically on exit.
Dune::MPIHelper::instance(argc, argv);
// First set parameters
Dumux::Parameters::init([](auto& params){
params["Grid.LowerLeft"] = "-1 -1 -1";
params["Grid.UpperRight"] = "1 1 1";
});
{
using Grid = Dune::MovingMesh<3>;
GridManager<Grid> gridManager; gridManager.init();
Dune::VTKWriter<Grid::LeafGridView> vtkWriter(gridManager.grid().leafGridView());
vtkWriter.write("mmesh-3d");
}
Dumux::Parameters::init([](auto& params){
params["Grid.File"] = "grids/complex_equi_coarse_tri.msh";
});
{
using Grid = Dune::MovingMesh<2>;
GridManager<Grid> gridManager; gridManager.init();
Dune::VTKWriter<Grid::LeafGridView> vtkWriter(gridManager.grid().leafGridView());
vtkWriter.write("mmesh-2d");
}
return 0;
}
///////////////////////////////////////
//////// Error handler ////////////////
///////////////////////////////////////
catch (const Dumux::ParameterException& e) {
std::cerr << e << ". Abort!\n";
return 1;
}
catch (const Dune::Exception& e) {
std::cerr << "Dune reported error: " << e << std::endl;
return 3;
}
catch (...) {
std::cerr << "Unknown exception thrown!\n";
return 4;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment