uggrid.cc 1.01 KB
Newer Older
Praetorius, Simon's avatar
Praetorius, Simon committed
1 2 3 4 5 6 7 8 9 10 11
// -*- 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 <iostream>
#include <dune/common/parallel/mpihelper.hh> // An initializer of MPI
#include <dune/common/exceptions.hh> // We use exceptions
#include <dune/common/timer.hh>

Praetorius, Simon's avatar
Praetorius, Simon committed
12
#if HAVE_UG
Praetorius, Simon's avatar
Praetorius, Simon committed
13
#include <dune/grid/uggrid.hh>
Praetorius, Simon's avatar
Praetorius, Simon committed
14
#endif
Praetorius, Simon's avatar
Praetorius, Simon committed
15 16 17 18 19 20 21 22 23 24
#include <dune/multimesh/multimesh.hh>
#include <dune/multimesh/mmgridfactory.hh>
#include <dune/multimesh/utility/structuredgridbuilder.hh>

using namespace Dune;

int main(int argc, char** argv)
{
  MPIHelper::instance(argc, argv);

Praetorius, Simon's avatar
Praetorius, Simon committed
25
#if HAVE_UG
Praetorius, Simon's avatar
Praetorius, Simon committed
26 27 28 29 30 31 32
  FieldVector<double,2> lower_left = {-1.5, -1.5};
  FieldVector<double,2> bbox = {1.5, 1.5};
  std::array<unsigned int,2> num_elements = {2, 2};
  using HostGrid = Dune::UGGrid<2>;
  using Factory = StructuredGridBuilder<MultiMesh<HostGrid> >;
  GridFactory<MultiMesh<HostGrid> > factory(1);

33 34
  Factory::createSimplexGrid(factory, lower_left, bbox, num_elements);
  auto gridPtr = factory.createGrid();
Praetorius, Simon's avatar
Praetorius, Simon committed
35
#endif
Praetorius, Simon's avatar
Praetorius, Simon committed
36
}