Commit 8554254d authored by Praetorius, Simon's avatar Praetorius, Simon

added gitlabci tests

parent fa055d7e
Pipeline #1463 canceled with stage
in 0 seconds
---
before_script:
- . /duneci/bin/duneci-init-job
- duneci-install-module https://gitlab.dune-project.org/core/dune-common.git
- duneci-install-module https://gitlab.dune-project.org/core/dune-geometry.git
- duneci-install-module https://gitlab.dune-project.org/core/dune-grid.git
debian:10 gcc-8-noassert-17:
image: registry.dune-project.org/docker/ci/debian:10
script: duneci-standard-test
variables:
DUNECI_TOOLCHAIN: gcc-8-noassert-17
tags: [duneci]
debian:10 clang-6-libcpp-17:
image: registry.dune-project.org/docker/ci/debian:10
script: duneci-standard-test
variables:
DUNECI_TOOLCHAIN: clang-6-libcpp-17
tags: [duneci]
debian:9 gcc-6-14:
image: registry.dune-project.org/docker/ci/debian:9
script: duneci-standard-test
variables:
DUNECI_TOOLCHAIN: gcc-6-14
tags: [duneci]
debian:9 clang-3.8-14:
image: registry.dune-project.org/docker/ci/debian:9
script: duneci-standard-test
variables:
DUNECI_TOOLCHAIN: clang-3.8-14
tags: [duneci]
ubuntu:16.04 gcc-5-14:
image: registry.dune-project.org/docker/ci/ubuntu:16.04
script: duneci-standard-test
variables:
DUNECI_TOOLCHAIN: gcc-5-14
tags: [duneci]
ubuntu:18.04 clang-6-17:
image: registry.dune-project.org/docker/ci/ubuntu:18.04
script: duneci-standard-test
variables:
DUNECI_TOOLCHAIN: clang-6-17
tags: [duneci]
...@@ -7,5 +7,5 @@ Module: dune-multimesh ...@@ -7,5 +7,5 @@ Module: dune-multimesh
Version: 0.1 Version: 0.1
Maintainer: simon.praetorius@tu-dresden.de Maintainer: simon.praetorius@tu-dresden.de
#depending on #depending on
Depends: dune-common dune-grid Depends: dune-grid
Suggests: dune-uggrid dune-alugrid dune-foamgrid dune-functions dune-geometry dune-istl Suggests: dune-alugrid dune-foamgrid dune-functions dune-istl dune-spgrid dune-uggrid
...@@ -19,20 +19,21 @@ namespace Dune ...@@ -19,20 +19,21 @@ namespace Dune
private: private:
using ctype = typename HostGrid::ctype; using ctype = typename HostGrid::ctype;
/// Entity in the host grid
using HostGridEntity = typename HostGrid::Traits::template Codim<0>::Entity;
public: public:
enum { dimension = HostGrid::dimension }; enum { codimension = 0 };
enum { dimension = HostGridEntity::dimension };
enum { mydimension = HostGridEntity::mydimension };
/// The type of a local geometry /// The type of a local geometry
using LocalGeometry = MultiMeshLocalGeometry<dimension, dimension, HostGrid>; using LocalGeometry = MultiMeshLocalGeometry<dimension, dimension, HostGrid>;
using EntitySeed = MultiMeshEntitySeed<0, HostGrid>; /// Seed representing the vector of entities in the MultiMesh
using EntitySeed = MultiEntitySeed<0, HostGrid>;
/// Entity in the host grid
using HostGridEntity = typename HostGrid::Traits::template Codim<0>::Entity;
/// Containertype
using Super = std::vector<HostGridEntity>;
public:
/// Constructor from std::vector /// Constructor from std::vector
using std::vector<HostGridEntity>::vector; using std::vector<HostGridEntity>::vector;
...@@ -62,6 +63,13 @@ namespace Dune ...@@ -62,6 +63,13 @@ namespace Dune
return localGeometry(source, target).global(sourceLocal); return localGeometry(source, target).global(sourceLocal);
} }
/// Return the partitionType of any entity in the multiEntity
// [[ expects: all partitionType are the same ]]
PartitionType partitionType () const
{
return max().partitionType();
}
/// Return the geometry of the entity with maximal level /// Return the geometry of the entity with maximal level
typename HostGridEntity::Geometry geometry () const typename HostGridEntity::Geometry geometry () const
{ {
...@@ -95,9 +103,15 @@ namespace Dune ...@@ -95,9 +103,15 @@ namespace Dune
* The MultiMeshEntitySeed contains the HostGridEntitySeed and the index of * The MultiMeshEntitySeed contains the HostGridEntitySeed and the index of
* the grid it is extracted from. * the grid it is extracted from.
**/ **/
EntitySeed seed (std::size_t entity_i) const MultiMeshEntitySeed<0,HostGrid> seed (std::size_t idx) const
{
return {(*this)[idx], idx};
}
/// Return an entity seed to restore the multi-entity.
EntitySeed seed () const
{ {
return {(*this)[entity_i], entity_i}; return {*this};
} }
/// Return the entity with maximal level /// Return the entity with maximal level
......
...@@ -10,16 +10,16 @@ namespace Dune ...@@ -10,16 +10,16 @@ namespace Dune
* \ingroup MultiMesh * \ingroup MultiMesh
* *
*/ */
template <int codim, class GridImp> template <int codim, class HostGrid>
class MultiMeshEntitySeed class MultiMeshEntitySeed
{ {
protected: protected:
/// Entity type of the hostgrid /// Entity type of the hostgrid
typedef typename GridImp::HostGrid::Traits::template Codim<codim>::Entity HostEntity; using HostEntity = typename HostGrid::Traits::template Codim<codim>::Entity;
/// EntitySeed type of the hostgrid /// EntitySeed type of the hostgrid
typedef typename GridImp::HostGrid::Traits::template Codim<codim>::EntitySeed HostEntitySeed; using HostEntitySeed = typename HostGrid::Traits::template Codim<codim>::EntitySeed;
public: public:
enum { codimension = codim }; enum { codimension = codim };
...@@ -66,13 +66,11 @@ namespace Dune ...@@ -66,13 +66,11 @@ namespace Dune
class MultiEntity; class MultiEntity;
// An entity seed for a vector of entities // An entity seed for a vector of entities
template <int codim, class GridImp> template <int codim, class HostGrid>
class MultiEntitySeed class MultiEntitySeed
{ {
protected: protected:
using HostGrid = typename GridImp::HostGrid;
/// Entity type of the hostgrid /// Entity type of the hostgrid
using HostEntity = typename HostGrid::Traits::template Codim<codim>::Entity; using HostEntity = typename HostGrid::Traits::template Codim<codim>::Entity;
...@@ -87,14 +85,11 @@ namespace Dune ...@@ -87,14 +85,11 @@ namespace Dune
{} {}
/// \brief Create EntitySeed from hostgrid Entity /// \brief Create EntitySeed from hostgrid Entity
/** template <class MultiEntity>
* We call hostEntity.seed() directly in the constructor MultiEntitySeed (const MultiEntity& multiEntity)
* of MultiMeshEntitySeed to allow for return value optimization.
*/
MultiEntitySeed (const MultiEntity<HostGrid>& multiEntity)
{ {
// for (auto const& e : multiEntity) for (auto const& e : multiEntity)
// hostEntitySeeds_.emplace_back(e.seed()); hostEntitySeeds_.emplace_back(e.seed());
} }
/// Get stored HostEntitySeed /// Get stored HostEntitySeed
...@@ -106,8 +101,9 @@ namespace Dune ...@@ -106,8 +101,9 @@ namespace Dune
/// Check whether it is safe to create an Entity from this Seed /// Check whether it is safe to create an Entity from this Seed
bool isValid () const bool isValid () const
{ {
return std::all_of(hostEntitySeeds_.begin(), hostEntitySeeds_.end(), return hostEntitySeeds_.empty() ? false :
[](auto const& seed) { return seed.isValid(); }); std::all_of(hostEntitySeeds_.begin(), hostEntitySeeds_.end(),
[](auto const& seed) { return seed.isValid(); });
} }
private: private:
......
...@@ -56,7 +56,7 @@ namespace Dune ...@@ -56,7 +56,7 @@ namespace Dune
using Grid = typename Traits::Grid; using Grid = typename Traits::Grid;
/// Type of the corresponding GridType hosted by the MultiMesh /// Type of the corresponding GridType hosted by the MultiMesh
using HostGrid = typename GridImp::HostGridType; using HostGrid = typename GridImp::HostGrid;
using IndexSet = typename Traits::IndexSet; using IndexSet = typename Traits::IndexSet;
using Intersection = typename Traits::Intersection; using Intersection = typename Traits::Intersection;
......
...@@ -117,11 +117,17 @@ namespace Dune ...@@ -117,11 +117,17 @@ namespace Dune
// 3. go down in tree until leaf entity // 3. go down in tree until leaf entity
auto child = dereference(); auto child = dereference();
for (; !(contains_(child) || child.isLeaf()); child = dereference()) { for (; !(contains_(child) || child.isLeaf()); child = dereference()) {
assert(child.isRegular() && "No irregular elements allowed in multi-mesh traversal");
entityStack_.emplace(child); entityStack_.emplace(child);
assert( entityStack_.size() <= maxLevel_ ); assert( entityStack_.size() <= maxLevel_ );
} }
// 4. go up in tree again to the first regular entity, since
// irregular element can not be traversed in a multi-mesh sense
while (!child.isRegular() && !entityStack_.empty()) {
entityStack_.pop();
child = dereference();
}
assert(contains_(child) && "No valid child element found in gridView"); assert(contains_(child) && "No valid child element found in gridView");
} }
...@@ -150,11 +156,17 @@ namespace Dune ...@@ -150,11 +156,17 @@ namespace Dune
// 1. go down in tree until leaf entity // 1. go down in tree until leaf entity
auto child = dereference(); auto child = dereference();
for (; !(contains_(child) || child.isLeaf()); child = dereference()) { for (; !(contains_(child) || child.isLeaf()); child = dereference()) {
assert(child.isRegular() && "No irregular elements allowed in multi-mesh traversal");
entityStack_.emplace(child); entityStack_.emplace(child);
assert( entityStack_.size() <= maxLevel_ ); assert( entityStack_.size() <= maxLevel_ );
} }
// 2. go up in tree again to the first regular entity, since
// irregular element can not be traversed in a multi-mesh sense
while (!child.isRegular() && !entityStack_.empty()) {
entityStack_.pop();
child = dereference();
}
assert(contains_(child) && "No valid child element found in gridView"); assert(contains_(child) && "No valid child element found in gridView");
} }
...@@ -167,7 +179,7 @@ namespace Dune ...@@ -167,7 +179,7 @@ namespace Dune
}; };
template <class Entity, class GridView> template <class Entity, class GridView>
inline auto childs(const Entity& entity, const GridView& gridView) inline auto childs (const Entity& entity, const GridView& gridView)
{ {
using Iterator = MultiMeshHierarchicIterator<typename GridView::Grid>; using Iterator = MultiMeshHierarchicIterator<typename GridView::Grid>;
return IteratorRange<Iterator>{ Iterator{entity, gridView}, Iterator{true} }; return IteratorRange<Iterator>{ Iterator{entity, gridView}, Iterator{true} };
......
...@@ -111,6 +111,8 @@ namespace Dune ...@@ -111,6 +111,8 @@ namespace Dune
/// The type used to store coordinates, inherited from the HostGrid /// The type used to store coordinates, inherited from the HostGrid
using ctype = typename HostGrid::ctype; using ctype = typename HostGrid::ctype;
enum { dimension = HostGrid::dimension };
enum { dimensionworld = HostGrid::dimensionworld };
/// \brief Constructor, stores n copies of the hostgrid /// \brief Constructor, stores n copies of the hostgrid
/** /**
...@@ -475,7 +477,7 @@ namespace Dune ...@@ -475,7 +477,7 @@ namespace Dune
template <class HostGrid, int codim> template <class HostGrid, int codim>
struct hasEntityIterator<MultiMesh<HostGrid>, codim> struct hasEntityIterator<MultiMesh<HostGrid>, codim>
{ {
static const bool v = hasEntityIterator<HostGrid, codim>::v; static const bool v = (codim == 0);
}; };
/** \brief has conforming level grids when host grid has /** \brief has conforming level grids when host grid has
......
...@@ -25,6 +25,16 @@ if (HAVE_ALBERTA) ...@@ -25,6 +25,16 @@ if (HAVE_ALBERTA)
add_dune_alberta_flags("taylorhood") add_dune_alberta_flags("taylorhood")
endif () endif ()
add_executable("benchmark" benchmark.cc)
target_link_dune_default_libraries("benchmark")
if (HAVE_ALBERTA)
add_dune_alberta_flags(GRIDDIM 2 WORLDDIM 2 "benchmark")
endif ()
add_executable("profiling" profiling.cc)
target_link_dune_default_libraries("profiling")
find_package(MTL PATHS /opt/development/mtl4) find_package(MTL PATHS /opt/development/mtl4)
if (MTL_FOUND) if (MTL_FOUND)
set(CXX_ELEVEN_FEATURE_LIST "MOVE" "AUTO" "RANGEDFOR" "INITLIST" "STATICASSERT" "DEFAULTIMPL") set(CXX_ELEVEN_FEATURE_LIST "MOVE" "AUTO" "RANGEDFOR" "INITLIST" "STATICASSERT" "DEFAULTIMPL")
......
// -*- 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/filledarray.hh>
#include <dune/common/timer.hh>
#include <dune/grid/onedgrid.hh>
#include <dune/grid/yaspgrid.hh>
#if HAVE_ALBERTA
#include <dune/grid/albertagrid.hh>
#endif
#if HAVE_UG
#include <dune/grid/uggrid.hh>
#endif
#if HAVE_DUNE_ALUGRID
#include <dune/alugrid/grid.hh>
#endif
#if HAVE_DUNE_FOAMGRID
#include <dune/foamgrid/foamgrid.hh>
#endif
#if HAVE_DUNE_SPGRID
#include <dune/grid/spgrid.hh>
#endif
#include <dune/multimesh/multimesh.hh>
#include <dune/multimesh/mmgridfactory.hh>
#include <dune/multimesh/utility/structuredgridbuilder.hh>
using namespace Dune;
template <class Grid>
std::size_t traverse(Grid const& grid)
{
std::size_t num = 0;
for (auto const& entities : elements(grid.leafGridView())) {
++num;
}
return num;
}
template <class HostGrid>
void simplex_grid(std::string name, int refCount)
{
const int dow = HostGrid::dimensionworld;
using Factory = StructuredGridBuilder<MultiMesh<HostGrid> >;
GridFactory<MultiMesh<HostGrid> > gridFactory(2);
FieldVector<double,dow> lower; lower = -1.5;
FieldVector<double,dow> upper; upper = 1.5;
auto num_elements = filledArray<dow,unsigned int>(2);
Factory::createSimplexGrid(gridFactory, lower, upper, num_elements);
auto gridPtr = gridFactory.createGrid();
auto& grids = *gridPtr;
grids.globalRefine(refCount);
std::cout << name << "\n";
Timer t;
std::size_t num_multimesh = traverse(grids);
double time_multimesh = t.elapsed();
t.reset();
std::size_t num_singlemesh = traverse(grids[0]);
double time_singlemesh = t.elapsed();
std::cout << " [size(multimesh), size(singlemesh)]: [" << num_multimesh << ", " << num_singlemesh << "]\n";
std::cout << " multimesh: " << time_multimesh << "sec\n";
std::cout << " singlemesh: " << time_singlemesh << "sec\n";
std::cout << " ratio: " << (time_multimesh / time_singlemesh) << "\n";
}
template <class HostGrid>
void cubes_grid(std::string name, int refCount)
{
const int dow = HostGrid::dimensionworld;
using Factory = StructuredGridBuilder<MultiMesh<HostGrid> >;
GridFactory<MultiMesh<HostGrid> > gridFactory(2);
FieldVector<double,dow> lower; lower = -1.5;
FieldVector<double,dow> upper; upper = 1.5;
auto num_elements = filledArray<dow,unsigned int>(2);
Factory::createCubeGrid(gridFactory, lower, upper, num_elements);
auto gridPtr = gridFactory.createGrid();
auto& grids = *gridPtr;
grids.globalRefine(refCount);
std::cout << name << "\n";
Timer t;
std::size_t num_multimesh = traverse(grids);
double time_multimesh = t.elapsed();
t.reset();
std::size_t num_singlemesh = traverse(grids[0]);
double time_singlemesh = t.elapsed();
std::cout << " [size(multimesh), size(singlemesh)]: [" << num_multimesh << ", " << num_singlemesh << "]\n";
std::cout << " multimesh: " << time_multimesh << "sec\n";
std::cout << " singlemesh: " << time_singlemesh << "sec\n";
std::cout << " ratio: " << (time_multimesh / time_singlemesh) << "\n";
}
template <class HostGrid, class... Args>
void structured_grid(std::string name, int refCount, Args&&... args)
{
MultiMesh<HostGrid> grids(2, std::forward<Args>(args)...);
grids.globalRefine(refCount);
std::cout << name << "\n";
Timer t;
std::size_t num_multimesh = traverse(grids);
double time_multimesh = t.elapsed();
t.reset();
std::size_t num_singlemesh = traverse(grids[0]);
double time_singlemesh = t.elapsed();
std::cout << " [size(multimesh), size(singlemesh)]: [" << num_multimesh << ", " << num_singlemesh << "]\n";
std::cout << " multimesh: " << time_multimesh << "sec\n";
std::cout << " singlemesh: " << time_singlemesh << "sec\n";
std::cout << " ratio: " << (time_multimesh / time_singlemesh) << "\n";
}
int main(int argc, char** argv)
{
MPIHelper::instance(argc, argv);
FieldVector<double,1> lower1{-1.5};
FieldVector<double,2> lower2{-1.5,-1.5};
FieldVector<double,3> lower3{-1.5,-1.5,-1.5};
FieldVector<double,1> upper1{1.5};
FieldVector<double,2> upper2{1.5,1.5};
FieldVector<double,3> upper3{1.5,1.5,1.5};
structured_grid<OneDGrid>("OneDGrid", 16, 2, lower1[0], upper1[0]);
structured_grid<YaspGrid<1,EquidistantOffsetCoordinates<double,1>>>("YaspGrid<1>", 16, lower1, upper1, std::array<int,1>{2});
structured_grid<YaspGrid<2,EquidistantOffsetCoordinates<double,2>>>("YaspGrid<2>", 8, lower2, upper2, std::array<int,2>{2,2});
structured_grid<YaspGrid<3,EquidistantOffsetCoordinates<double,3>>>("YaspGrid<3>", 6, lower3, upper3, std::array<int,3>{2,2,2});
#if HAVE_ALBERTA
// simplex_grid<AlbertaGrid<1,1>>("AlbertaGrid<1>", 8);
// simplex_grid<AlbertaGrid<2,2>>("AlbertaGrid<2>", 6);
simplex_grid<AlbertaGrid<ALBERTA_DIM,ALBERTA_DIM>>("AlbertaGrid<" + std::to_string(ALBERTA_DIM) + ">", 4);
#endif
#if HAVE_UG
// simplex_grid<UGGrid<1>>("UGGrid<1>", 8);
simplex_grid<UGGrid<2>>("UGGrid<2>", 8);
simplex_grid<UGGrid<3>>("UGGrid<3>", 4);
cubes_grid<UGGrid<2>>("UGGrid<2,cube>", 8);
cubes_grid<UGGrid<3>>("UGGrid<3,cube>", 4);
#endif
#if HAVE_DUNE_ALUGRID
simplex_grid<Dune::ALUGrid<2, 2, simplex, conforming> >("ALUGrid<2,conforming>", 8);
// simplex_grid<Dune::ALUGrid<3, 3, simplex, conforming> >("ALUGrid<3,conforming>", 4);
simplex_grid<Dune::ALUGrid<2, 2, simplex, nonconforming> >("ALUGrid<2,nonconforming>", 6);
simplex_grid<Dune::ALUGrid<3, 3, simplex, nonconforming> >("ALUGrid<3,nonconforming>", 4);
cubes_grid<Dune::ALUGrid<2, 2, cube, nonconforming> >("ALUGrid<2,cube,nonconforming>", 6);
cubes_grid<Dune::ALUGrid<3, 3, cube, nonconforming> >("ALUGrid<3,cube,nonconforming>", 4);
#endif
#if HAVE_DUNE_SPGRID
structured_grid<SPGrid<double,1>>("SPGrid<1>", 16, lower1, upper1, std::array<int,1>{2});
structured_grid<SPGrid<double,2>>("SPGrid<2>", 8, lower2, upper2, std::array<int,2>{2,2});
structured_grid<SPGrid<double,3>>("SPGrid<3>", 6, lower3, upper3, std::array<int,3>{2,2,2});
#endif
}
...@@ -126,7 +126,7 @@ int main(int argc, char** argv) ...@@ -126,7 +126,7 @@ int main(int argc, char** argv)
double timeInterpolate = 0; double timeInterpolate = 0;
double timeWriteFile = 0; double timeWriteFile = 0;
Interpolation<Grid, VectorType> interpolation(grids); Interpolation<Grid> interpolation(grids);
// assemble a sequence of systems for finer and finer grids // assemble a sequence of systems for finer and finer grids
for (int i = 1; i < 20; ++i) { for (int i = 1; i < 20; ++i) {
......
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <iostream>
#include <dune/common/parallel/mpihelper.hh> // An initializer of MPI
#include <dune/common/timer.hh>
#include <dune/grid/onedgrid.hh>
#include <dune/grid/yaspgrid.hh>
#include <dune/multimesh/multimesh.hh>
using namespace Dune;
template <class Grid>
void traverse(Grid const& grid)
{
double area = 0;
int num_boundary_elements = 0;
for (auto const& entities : elements(grid.leafGridView())) {
area += entities.geometry().volume();
num_boundary_elements += entities.hasBoundaryIntersections() ? 1 : 0;
}
std::cout << " boundaryIntersections: " << num_boundary_elements << "\n";
std::cout << " area: " << area << "\n";
}
int main(int argc, char** argv)
{
MPIHelper::instance(argc, argv);
using HostGrid = YaspGrid<2,EquidistantOffsetCoordinates<double,2>>;
FieldVector<double,2> lower2{-1.5,-1.5};
FieldVector<double,2> upper2{1.5,1.5};
MultiMesh<HostGrid> grids(2, lower2, upper2, std::array<int,2>{32,32});
std::cout << "YaspGrid<2>\n";
Timer t;
traverse(grids);
std::cout << " time:" << t.elapsed() << "sec\n";
}
Markdown is supported
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