HyperHDG
compile_time_tricks.hxx
Go to the documentation of this file.
1 #pragma once // Ensure that file is included only once in a single compilation.
2 
3 #include <limits>
4 #include <type_traits>
5 #include <utility>
6 
7 /*!*************************************************************************************************
8  * \brief Unused parametes will neither result in g++, nor in doxygen warnings if wrapped by this.
9  **************************************************************************************************/
10 #define UNUSED(x) /* nothing */
11 
12 /*!*************************************************************************************************
13  * \brief Check if some class implements some function with some signature.
14  *
15  * This macro receives the name of the function that is checked to be implemented with a given
16  * signature (not handled to the macro itself) and the name of a struct (output) that can be used
17  * to check whether function func is implemented.
18  *
19  * Having invoked the macro, we are able to use the template struct \c name to check whether
20  * function \c fun is a (static or non-static) member function of an element of class \c C, where
21  * \c Ret(Args) is the supposed signature.
22  *
23  * \param[in] func The name of the function that is checked to be implemented.
24  * \param[out] name The resulting struct whose value is true if the function is implemented.
25  **************************************************************************************************/
26 #define HAS_MEMBER_FUNCTION(func, name) \
27  template <typename, typename T> \
28  struct name \
29  { \
30  static_assert(std::integral_constant<T, false>::value, \
31  "Second template parameter must be function signature."); \
32  }; \
33  template <typename C, typename Ret, typename... Args> \
34  struct name<C, Ret(Args...)> \
35  { \
36  private: \
37  template <typename T> \
38  static constexpr auto check(T*) -> \
39  typename std::is_same<decltype(std::declval<T>().func(std::declval<Args>()...)), Ret>::type; \
40  template <typename> \
41  static constexpr std::false_type check(...); \
42  typedef decltype(check<C>(0)) type; \
43  \
44  public: \
45  static constexpr bool value = type::value; \
46  }
HyperHDG.compile_prep.need_compile_check_hy_files
def need_compile_check_hy_files(dependent_files, time_so)
Check whether any dependent files have been changed.
Definition: compile_prep.py:46
HyperHDG.cmake.get_options
def get_options()
Read out parameters for Cython compilation provided by CMAKE.
Definition: cmake.py:20
HyperHDG.compile_prep.own_code
def own_code(conf, python_class)
Check whether own code differs from last iteration.
Definition: compile_prep.py:66
HyperHDG.hy_config.consistent
def consistent(conf)
Check that config is consistent.
Definition: hy_config.py:20
HyperHDG.names.files
def files(conf)
Generate names of auxiliary classes that will be constructed (internal use only).
Definition: names.py:9
HyperHDG.compile_prep.compile_commands
def compile_commands(python_class, opt)
Generate shell commands from CMAKE parameters.
Definition: compile_prep.py:7
HyperHDG.paths.this_dir
def this_dir()
Return path to directory of file.
Definition: paths.py:4
HyperHDG.cpp.find_definition
def find_definition(folder, classname)
Find file with definition of classname in directory folder.
Definition: cpp.py:10
HyperHDG.config.generate_cy_replace
def generate_cy_replace(conf)
Evaluate config file that needs to be present for all .pyx/.pxd files.
Definition: config.py:73
HyperHDG.cmake.options
Object that comprises all information for HyperHDG to create a problem.
Definition: cmake.py:5
HyperHDG.hy_config.extract_include
def extract_include(conf)
Add the files that need to be included for defining the problem to include list.
Definition: hy_config.py:51
HyperHDG.include.include
def include(conf)
Function to import classes of the HyperHDG package using Cython.
Definition: include.py:11
HyperHDG.hy_config.config
Object that comprises all information for HyperHDG to create a problem.
Definition: hy_config.py:7
HyperHDG.paths.main_dir
def main_dir()
Return path to main directory of HyperHDG.
Definition: paths.py:8
HyperHDG.hy_config.generate_cy_replace
def generate_cy_replace(conf)
Evaluate config file that needs to be present for all .pyx/.pxd files.
Definition: hy_config.py:73
HyperHDG.config.config
Object that comprises all information for HyperHDG to create a problem.
Definition: config.py:7
HyperHDG.cpp.extract_classname
def extract_classname(fullname)
Extract classname from name that might contain template arguemnts.
Definition: cpp.py:5
HyperHDG.config.extract_includes
def extract_includes(conf, cpp_inc="")
Add the files that need to be included for defining the problem to include list.
Definition: config.py:48
HyperHDG.names.cython_from_cpp
def cython_from_cpp(name)
Transform C++ class name to cython file name.
Definition: names.py:4
HyperHDG.compile_prep.need_compile
def need_compile(conf, python_class, opt)
Check whether recompilation of executable is necessary.
Definition: compile_prep.py:20
HyperHDG.config.consistent
def consistent(conf)
Check that config is consistent.
Definition: config.py:19