diff --git a/INFOS.py b/INFOS.py index 0b9b760..28ba298 100755 --- a/INFOS.py +++ b/INFOS.py @@ -1,54 +1,55 @@ #!/usr/bin/env python3 """Defines the information to be used throughout the builds.""" # -*- mode:python; coding: utf-8 -*- from collections import namedtuple import versioneer TamaasInfo = namedtuple('TamaasInfo', ['version', 'authors', 'maintainer', 'email', 'copyright', 'description', 'license']) TAMAAS_INFOS = TamaasInfo( version=versioneer.get_version(), authors=([ u'Lucas Frérot', 'Guillaume Anciaux', 'Valentine Rey', 'Son Pham-Ba', u'Jean-François Molinari' ]), maintainer=u'Lucas Frérot', email='lucas.frerot@imtek.uni-freiburg.de', copyright=( - u"Copyright (©) 2016-2022 EPFL " - u"(École Polytechnique Fédérale de Lausanne), " - u"Laboratory (LSMS - Laboratoire de Simulation en " - u"Mécanique des Solides)" + "Copyright (©) 2016-2020 EPFL " + "(École Polytechnique Fédérale de Lausanne), " + "Laboratory (LSMS - Laboratoire de Simulation en " + "Mécanique des Solides)\\n" + "Copyright (©) 2020-2022 Lucas Frérot" ), description='A high-performance library for periodic rough surface contact', license="SPDX-License-Identifier: AGPL-3.0-or-later", ) def main(): import argparse parser = argparse.ArgumentParser(description="Print Tamaas info") parser.add_argument("--version", action="store_true") args = parser.parse_args() if args.version: print(TAMAAS_INFOS.version) if __name__ == "__main__": main() diff --git a/python/cast.hh b/python/cast.hh index e5cc85c..f99534c 100644 --- a/python/cast.hh +++ b/python/cast.hh @@ -1,196 +1,197 @@ /* * SPDX-License-Indentifier: AGPL-3.0-or-later * * Copyright (©) 2016-2022 EPFL (École Polytechnique Fédérale de Lausanne), * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) + * Copyright (©) 2020-2022 Lucas Frérot * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ /* -------------------------------------------------------------------------- */ #ifndef CAST_HH #define CAST_HH /* -------------------------------------------------------------------------- */ #include "grid.hh" #include "grid_base.hh" #include "numpy.hh" /* -------------------------------------------------------------------------- */ #include #include /* -------------------------------------------------------------------------- */ namespace pybind11 { // Format descriptor necessary for correct wrap of tamaas complex type template struct format_descriptor< tamaas::complex, detail::enable_if_t::value>> { static constexpr const char c = format_descriptor::c; static constexpr const char value[3] = {'Z', c, '\0'}; static std::string format() { return std::string(value); } }; #ifndef PYBIND11_CPP17 template constexpr const char format_descriptor< tamaas::complex, detail::enable_if_t::value>>::value[3]; #endif namespace detail { // declare tamaas complex as a complex type for pybind11 template struct is_complex> : std::true_type {}; template struct is_fmt_numeric, detail::enable_if_t::value>> : std::true_type { static constexpr int index = is_fmt_numeric::index + 3; }; static inline handle policy_switch(return_value_policy policy, handle parent) { switch (policy) { case return_value_policy::copy: case return_value_policy::move: return handle(); case return_value_policy::automatic_reference: // happens in python-derived // classes case return_value_policy::reference: return none(); case return_value_policy::reference_internal: return parent; default: TAMAAS_EXCEPTION("Policy is not handled"); } } template handle grid_to_python(const tamaas::Grid& grid, return_value_policy policy, handle parent) { parent = policy_switch(policy, parent); // reusing variable std::vector sizes(dim); std::copy(grid.sizes().begin(), grid.sizes().end(), sizes.begin()); if (grid.getNbComponents() != 1) sizes.push_back(grid.getNbComponents()); return array(sizes, grid.getInternalData(), parent).release(); } template handle grid_to_python(const tamaas::GridBase& grid, return_value_policy policy, handle parent) { parent = policy_switch(policy, parent); // reusing variable std::vector sizes = {grid.dataSize()}; return array(sizes, grid.getInternalData(), parent).release(); } /** * Type caster for grid classes * inspired by https://tinyurl.com/y8m47qh3 from T. De Geus * and pybind11/eigen.h */ template