// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- // vi: set et ts=4 sw=2 sts=2: #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include // An initializer of MPI #include // We use exceptions #include #if HAVE_DUNE_ALUGRID #include #endif #include #include #include using namespace Dune; template void printGrid(const CoarseGridView& coarse, const FineGridView& fine) { volatile std::size_t n = 0; Dune::Timer t; for (auto const& coarse_entity : elements(coarse)) { for (auto const& fine_entity : childs(coarse_entity, fine)) { n += fine.indexSet().index(fine_entity); std::cout << "indices = [" << coarse.indexSet().index(coarse_entity) << ", " << fine.indexSet().index(fine_entity) << "]\n"; } } std::cout << n << "\n"; std::cout << "time: " << t.elapsed() << "\n"; } int main(int argc, char** argv) { MPIHelper::instance(argc, argv); #if HAVE_DUNE_ALUGRID FieldVector lower_left = {-1.5, -1.5}; FieldVector bbox = {1.5, 1.5}; std::array num_elements = {2, 2}; using Grid = Dune::ALUGrid<2, 2, Dune::simplex, Dune::conforming>; using Factory = StructuredGridBuilder; auto gridPtr = Factory::createSimplexGrid(lower_left, bbox, num_elements); auto& grid = *gridPtr; grid.globalRefine(4); printGrid(grid.levelGridView(2), grid.leafGridView()); #endif }