-
Notifications
You must be signed in to change notification settings - Fork 25
/
setup.py
executable file
·107 lines (99 loc) · 4.06 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# Copyright (C) 2009-2019 Ovidio Peña Rodríguez <[email protected]>
# Copyright (C) 2013-2019 Konstantin Ladutenko <[email protected]>
#
# This file is part of scattnlay
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# The only additional remark is that we expect that all publications
# describing work using this software, or all commercial products
# using it, cite at least one of the following references:
# [1] O. Peña and U. Pal, "Scattering of electromagnetic radiation by
# a multilayered sphere," Computer Physics Communications,
# vol. 180, Nov. 2009, pp. 2348-2354.
# [2] K. Ladutenko, U. Pal, A. Rivera, and O. Peña-Rodríguez, "Mie
# calculation of electromagnetic near-field for a multilayered
# sphere," Computer Physics Communications, vol. 214, May 2017,
# pp. 225-230.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = "2.4"
__title__ = "Calculation of the scattering of EM radiation by a multilayered sphere"
__mod__ = "python-scattnlay"
__author__ = "Ovidio Peña Rodríguez"
__email__ = "[email protected]"
__url__ = "https://github.com/ovidiopr/scattnlay"
__download_url__ = (
"https://github.com/ovidiopr/scattnlay/archive/v" + __version__ + ".0.tar.gz"
)
from setuptools import setup
from setuptools.extension import Extension
import numpy as np
import pybind11 as pb
ext_dp = Extension(
"scattnlay_dp",
["src/pb11-wrapper.cc"],
language="c++",
include_dirs=[np.get_include(), pb.get_include()],
extra_compile_args=["-std=c++11"],
)
# extra_compile_args=['-std=c++11', '-O3',
# '-mavx2', '-mfma',
# '-finline-limit=1000000', '-ffp-contract=fast']),
ext_mp = Extension(
"scattnlay_mp",
[" src/pb11-wrapper.cc"],
language="c++",
include_dirs=[np.get_include(), pb.get_include()],
extra_compile_args=["-std=c++11", "-DMULTI_PRECISION=100"],
)
# extra_compile_args=['-std=c++11', '-O3',
# '-mavx2', '-mfma',
# '-finline-limit=1000000', '-ffp-contract=fast',
# '-DMULTI_PRECISION=100']),
def run_setup(extensions):
setup(
name=__mod__,
version=__version__,
description=__title__,
long_description="""The Python version of scattnlay, a computer implementation of the algorithm for the \
calculation of electromagnetic radiation scattering by a multilayered sphere developed by Yang. It has been \
shown that the program is effective, resulting in very accurate values of scattering efficiencies for a wide \
range of size parameters, which is a considerable improvement over previous implementations of similar algorithms. \
For details see: O. Pena, U. Pal, Comput. Phys. Commun. 180 (2009) 2348-2354.""",
author=__author__,
author_email=__email__,
maintainer=__author__,
maintainer_email=__email__,
keywords=[
"Mie scattering",
"Multilayered sphere",
"Efficiency factors",
"Cross-sections",
],
url=__url__,
download_url=__download_url__,
license="GPL",
platforms="any",
packages=["scattnlay"], # , 'scattnlay_dp', 'scattnlay_mp'],
test_suite="tests",
ext_modules=extensions,
install_requires=["numpy"],
)
try:
run_setup([ext_dp, ext_mp])
except:
print("Failed to build all extensions... Building only in double precision...")
run_setup([ext_dp])