Skip to content
Snippets Groups Projects
Unverified Commit 08209a2f authored by Tobias Leibner's avatar Tobias Leibner Committed by GitHub
Browse files

Merge pull request #12 from dune-community/ftalbrecht-patch-1

[CONTRIBUTING] update
parents 04081b64 faebfa17
No related branches found
No related tags found
No related merge requests found
...@@ -59,13 +59,13 @@ dimensions, such as `static const size_t dim = 2;`). ...@@ -59,13 +59,13 @@ dimensions, such as `static const size_t dim = 2;`).
typos. typos.
* Include guards follow a pattern: file location `dune/xt/common/fvector.hh` turns into `DUNE_XT_COMMON_FVECTOR_HH` * Include guards follow a pattern: file location `dune/xt/common/fvector.hh` turns into `DUNE_XT_COMMON_FVECTOR_HH`
* Be careful to handle integers corretly, bad integer conversion is bad! Whenever possible, use `size_t` (even for * Be careful to handle integers corretly, bad integer conversion is bad! Whenever possible, use `size_t` (even for
`template<class Foo, size_t bar>`) and convert to the correct type using boost: `template<class Foo, size_t bar>`) and convert to the correct type using our `numeric_cast` from [dune/xt/common/numeric_cast.hh](https://github.com/dune-community/dune-xt/blob/master/dune/xt/common/numeric_cast.hh):
```c++ ```c++
#include <boost/numeric/conversion/cast.hpp> #include <dune/xt/common/numeric_cast.hh>
const auto unsigned_number = boost::numeric_cast<size_t>(some_vector_size_of_unknown_int_type); const auto unsigned_number = Dune::XT::Common::numeric_cast<size_t>(some_vector_size_of_unknown_int_type);
// work with unsigned_number as size_t // work with unsigned_number as size_t
Dune::function_that_requires_an_int_because_ints_are_cool(boost::numeric_cast<int>(unsigned_number); Dune::function_that_requires_an_int_because_ints_are_cool(Dune::XT::Common::numeric_cast<int>(unsigned_number);
``` ```
* Regarding whitespace, the only choice we have is the number of empty lines: one or two. * Regarding whitespace, the only choice we have is the number of empty lines: one or two.
Within functions and methods, only very rarely place an empty line! Within functions and methods, only very rarely place an empty line!
...@@ -142,14 +142,14 @@ For example: ...@@ -142,14 +142,14 @@ For example:
# Project layout # Project layout
Following the layout of the core modules, all headers are placed below `dune/xt/common`. Following the layout of the core modules, all headers are placed below `dune/xt/{common,grid,functions,la}`.
If extending some functionality from dune-common, the names of the headers should coincide, i.e. If extending some functionality from dune-common, the names of the headers should coincide, i.e.
`dune/xt/common/fvector.hh` for extensions of `dune/common/fvector.hh`. `dune/xt/common/fvector.hh` for extensions of `dune/common/fvector.hh`.
In such cases, the first header is expected to include the latter! In such cases, the first header is expected to include the latter!
Rather use a subdirectory and several headers than overly large headers. Rather use a subdirectory and several headers than overly large headers.
Tests can be found in `dune/xt/common/test`, where the name of a test source correspond to the full path of the Tests can be found in `dune/xt/test`, where the name of a test source correspond to the full path of the
corresponding header, e.g. `dune/xt/common/test/foo_bar.cc` contains tests for `dune/xt/common/foo/bar.hh`. corresponding header, e.g. `dune/xt/test/common/foo_bar.cc` contains tests for `dune/xt/common/foo/bar.hh`.
# clang-format # clang-format
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment