Commit 0f85c2a3 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

examples and tests cleaned up

parent c2f94e6d
Pipeline #4130 failed with stage
in 12 minutes and 51 seconds
[submodule "libs/nanoflann"]
path = libs/nanoflann
url = https://github.com/jlblancoc/nanoflann.git
# We require version CMake version 3.1 to prevent issues
# with dune_enable_all_packages and older CMake versions.
cmake_minimum_required(VERSION 3.1)
project(dune-curvedsurfacegrid CXX)
cmake_minimum_required(VERSION 3.13)
project(dune-curvedsurfacegrid LANGUAGES CXX VERSION 2.8)
if(NOT (dune-common_DIR OR dune-common_ROOT OR
"${CMAKE_PREFIX_PATH}" MATCHES ".*dune-common.*"))
......@@ -9,12 +7,12 @@ if(NOT (dune-common_DIR OR dune-common_ROOT OR
${PROJECT_BINARY_DIR})
endif()
#find dune-common and set the module path
# find dune-common and set the module path
find_package(dune-common REQUIRED)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules"
${dune-common_MODULE_PATH})
#include the dune macros
# include the dune macros
include(DuneMacros)
# start a dune project with information from dune.module
......@@ -22,11 +20,11 @@ dune_project()
dune_enable_all_packages()
add_subdirectory(src)
add_subdirectory(dune)
add_subdirectory(doc)
add_subdirectory(lib)
add_subdirectory(cmake/modules)
add_subdirectory(doc)
add_subdirectory(dune)
add_subdirectory(libs)
add_subdirectory(src)
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
......@@ -51,6 +51,7 @@ The `CurvedSurfaceGrid` constructs on request of the element geometry a LocalFin
of Lagrange basis functions for the internal parametrization of the geometry. The `ParametrizedGeometry`
is constructed, if the grid gets a polynomial order `k > 0`.
(See [example2.cc](https://gitlab.mn.tu-dresden.de/iwr/dune-curvedsurfacegrid/-/blob/master/src/example2.cc))
```c++
// Construct a reference grid
auto refGrid = GmshReader< FoamGrid<2,3> >::read("sphere.msh");
......@@ -71,6 +72,7 @@ function `derivative(f)` returning a callable that gives the Jacobian of the map
grid constructs a `LocalFunctionGeometry` on each element. This geometry is exactly parametrized
with the mapping and its derivative, i.e., no additional interpolation is performed.
(See [example3.cc](https://gitlab.mn.tu-dresden.de/iwr/dune-curvedsurfacegrid/-/blob/master/src/example3.cc))
```c++
auto gv = refGrid->leafGridView();
......
set(modules "DuneCurvedsurfacegridMacros.cmake")
install(FILES ${modules} DESTINATION ${DUNE_INSTALL_MODULEDIR})
install(FILES
DuneCurvedsurfacegridMacros.cmake
DESTINATION ${DUNE_INSTALL_MODULEDIR})
#after surfacedistance/vtureader has been removed all of this can be deleted.
find_package(Boost COMPONENTS iostreams)
if(Boost_FOUND)
add_definitions(-DDCSG_BOOST_IOSTREAMS)
dune_register_package_flags(LIBRARIES Boost::iostreams)
endif()
find_package(ZLIB)
if(ZLIB_FOUND)
add_definitions(-DDCSG_ZLIB)
dune_register_package_flags(INCLUDE_DIRS ${ZLIB_INCLUDE_DIR} LIBRARIES ${ZLIB_LIBRARIES})
endif()
add_subdirectory("doxygen")
add_subdirectory(doxygen)
......@@ -15,13 +15,13 @@ INPUT += @top_srcdir@/dune/
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
# EXCLUDE += @top_srcdir@/dune/curvedsurfacegrid/test
EXCLUDE += @top_srcdir@/dune/curvedsurfacegrid/test
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
# the \include command).
# EXAMPLE_PATH += @top_srcdir@/src
EXAMPLE_PATH += @top_srcdir@/src
# The IMAGE_PATH tag can be used to specify one or more files or
# directories that contain image that are included in the documentation (see
......
from sympy import *
import numpy as np
import collections
x, y, z = symbols("x y z", real=True)
a, b, c = symbols("a b c", positive=True)
......
from sympy import *
import numpy as np
import collections
x, y, z = symbols("x y z", real=True)
R, r = symbols("R r", positive=True)
......
......@@ -5,6 +5,7 @@ Point(4) = {0, 0.5, 0, 0.75};
Point(5) = {0, -0.5, 0, 0.75};
Point(6) = {0, 0, 2.0, 0.75};
Point(7) = {0, 0, -2.0, 0.75};
Ellipse(1) = {2, 1, 2, 4};
Ellipse(2) = {4, 1, 3, 3};
Ellipse(3) = {3, 1, 3, 5};
......
......@@ -5,6 +5,7 @@ Point(4) = {0, 1, 0, 0.75};
Point(5) = {0, -1, 0, 0.75};
Point(6) = {0, 0, 1, 0.75};
Point(7) = {0, 0, -1, 0.75};
Ellipse(1) = {2, 1, 2, 4};
Ellipse(2) = {4, 1, 3, 3};
Ellipse(3) = {3, 1, 3, 5};
......
This diff is collapsed.
This diff is collapsed.
......@@ -8,14 +8,12 @@ Point(3) = {r1, 0.0, r2, h};
Point(4) = {r1-r2, 0.0, 0.0, h};
Point(5) = {r1, 0.0,-r2, h};
Circle(1) = {2,1,3};
Circle(2) = {3,1,4};
Circle(3) = {4,1,5};
Circle(4) = {5,1,2};
Line Loop(5) = {1,2,3,4};
first[] = Extrude {{0,0,2}, {0,0,0}, -2*Pi/3}{Line{1,2,3,4}; Layers{10};};
second[] = Extrude {{0,0,2}, {0,0,0}, -2*Pi/3}{Line{first[0],first[4],first[8],first[12]}; Layers{10};};
third[] = Extrude {{0,0,2}, {0,0,0}, -2*Pi/3}{Line{second[0],second[4],second[8],second[12]}; Layers{10};};
......@@ -7,4 +7,4 @@ Module: dune-curvedsurfacegrid
Version: 2.8
Maintainer: florian.stenger@tu-dresden.de
Depends: dune-common dune-geometry dune-grid dune-curvedgeometry
Suggests: dune-localfunctions dune-functions dune-foamgrid
Suggests: dune-localfunctions dune-functions dune-foamgrid dune-alugrid
install(FILES
backuprestore.hh
capabilities.hh
......@@ -22,6 +21,5 @@ install(FILES
add_subdirectory(geometries)
add_subdirectory(gridfunctions)
add_subdirectory(surfacedistance)
add_subdirectory(test)
add_subdirectory(utility)
......@@ -7,11 +7,7 @@
#include <dune/curvedsurfacegrid/utility/kdtree.hh>
#include <dune/curvedsurfacegrid/utility/vertexcache.hh>
#ifndef COLLECTOR_BENCHMARK
#define COLLECTOR_BENCHMARK 1 // $benchmark
#endif
#if COLLECTOR_BENCHMARK != 0
#if COLLECTOR_BENCHMARK
#include <dune/common/timer.hh>
#endif
......@@ -24,7 +20,7 @@ namespace Dune {
* grid should be very fine-grained and triangles should not have acute
* angles. A delaunay-triangulation would be perfect.
**/
template <class T>
template <class T = double>
class ExplicitSurfaceProjection
{
using Self = ExplicitSurfaceProjection<T>;
......@@ -149,7 +145,7 @@ class ExplicitSurfaceProjection
}
public:
//constructor using a pre-loaded Dune-surface-grid
// constructor using a pre-loaded Dune-surface-grid
template <class Grid>
ExplicitSurfaceProjection (const Grid& grid, bool cached = true)
: vertices_(grid.size(Grid::dimension))
......@@ -158,7 +154,6 @@ public:
, maxCorner_(std::numeric_limits<T>::min())
, cached_(cached)
{
std::cout << " ESP-ctor(grid)" << std::endl; /// \brief $debug
const auto& indexSet = grid.leafGridView().indexSet();
//collect vertices for kd-tree
......@@ -196,42 +191,38 @@ public:
}
}
ExplicitSurfaceProjection (const Self& other)
: vertices_(other.vertices_)
, adjacent_elements_(other.adjacent_elements_)
, elements_(other.elements_)
, minCorner_(other.minCorner_)
, maxCorner_(other.maxCorner_)
, cached_(other.cached_)
, cache_(other.cache_)
#if COLLECTOR_BENCHMARK != 0
, inputs_(other.inputs_)
#endif
{
std::cout << " ESP-ctor(copy)" << std::endl; /// \brief $debug
kdtree_.emplace(vertices_, minCorner_, maxCorner_);
kdtree_->update();
}
ExplicitSurfaceProjection (Self&& other)
: vertices_(std::move(other.vertices_))
, adjacent_elements_(std::move(other.adjacent_elements_))
, elements_(std::move(other.elements_))
, minCorner_(other.minCorner_)
, maxCorner_(other.maxCorner_)
/// \brief, kdtree_(std::move(other.kdtree_)) /// \brief $crash: does not work!
, cached_(other.cached_)
, cache_(std::move(other.cache_))
#if COLLECTOR_BENCHMARK != 0
, inputs_(std::move(other.inputs_))
#endif
{
std::cout << " ESP-ctor(move)" << std::endl; /// \brief $debug
//update pointer
/// \briefkdtree_->update(vertices_); /// \brief $crash: does not work!
kdtree_.emplace(vertices_, minCorner_, maxCorner_); /// \brief $crash: slow but works
kdtree_->update(); /// \brief $crash: slow but works
}
ExplicitSurfaceProjection (const Self& other) = delete;
// : vertices_(other.vertices_)
// , adjacent_elements_(other.adjacent_elements_)
// , elements_(other.elements_)
// , minCorner_(other.minCorner_)
// , maxCorner_(other.maxCorner_)
// , cached_(other.cached_)
// , cache_(other.cache_)
// #if COLLECTOR_BENCHMARK
// , inputs_(other.inputs_)
// #endif
// {
// kdtree_.emplace(vertices_, minCorner_, maxCorner_);
// kdtree_->update();
// }
ExplicitSurfaceProjection (Self&& other) = delete;
// : vertices_(std::move(other.vertices_))
// , adjacent_elements_(std::move(other.adjacent_elements_))
// , elements_(std::move(other.elements_))
// , minCorner_(other.minCorner_)
// , maxCorner_(other.maxCorner_)
// , cached_(other.cached_)
// , cache_(std::move(other.cache_))
// #if COLLECTOR_BENCHMARK
// , inputs_(std::move(other.inputs_))
// #endif
// {
// // update pointer
// kdtree_.emplace(vertices_, minCorner_, maxCorner_);
// kdtree_->update();
// }
Self& operator= (const Self&) = delete;
Self& operator= (Self&&) = delete;
......@@ -281,7 +272,7 @@ public:
return result;
}
#if COLLECTOR_BENCHMARK != 0
#if COLLECTOR_BENCHMARK
void collectorBenchmark (bool fresh_cache=true) const
{
if (cached_ && fresh_cache) cache_->clear();
......@@ -323,11 +314,16 @@ private:
#endif
};
// deduction guide
template <class Grid>
ExplicitSurfaceProjection(Grid const&, bool = false)
-> ExplicitSurfaceProjection<typename Grid::ctype>;
/// \brief construct a grid function representing an explicit surface parametrization
template <class Grid, class T>
auto explicitSurfaceGridFunction (Grid& grid, bool cached = true)
template <class Grid>
auto explicitSurfaceProjection (Grid& grid, bool cached = true)
{
return analyticGridFunction<Grid>(ExplicitSurfaceProjection<T>{grid, cached});
return ExplicitSurfaceProjection<typename Grid::ctype>{grid, cached};
}
} // end namespace Dune
......
......@@ -9,8 +9,8 @@
namespace Dune {
/// \brief Functor representing a sphere in dim-d
template <class T, int dim>
/// \brief Functor representing a sphere in dim
template <int dim, class T = double>
class SphereProjection
{
using Domain = FieldVector<T,dim>;
......@@ -67,7 +67,7 @@ public:
template <class Grid, class T>
auto sphereGridFunction (T radius)
{
return analyticGridFunction<Grid>(SphereProjection<T,Grid::dimensionworld>{radius});
return analyticGridFunction<Grid>(SphereProjection<Grid::dimensionworld,T>{radius});
}
} // end namespace Dune
......
......@@ -12,7 +12,7 @@
namespace Dune {
// torus functor
template <class T>
template <class T = double>
class TorusProjection
{
using Domain = FieldVector<T,3>;
......
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