Skip to content

Commit

Permalink
Merge pull request #14 from compmech/python3.5_compatible
Browse files Browse the repository at this point in the history
Making this library compatible with Python 3.5
  • Loading branch information
compmech authored Jun 27, 2016
2 parents 347b32a + 7d570bd commit c9ebaa0
Show file tree
Hide file tree
Showing 74 changed files with 390 additions and 811 deletions.
12 changes: 4 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ language: python
cache: false
python:
# We don't actually use the Travis Python, but this keeps it organized.
#- "2.6"
- "2.7"
#- "3.2"
#- "3.3"
#- "3.4"
#- "3.5"
#- "3.5-dev" # 3.5 development branch
- "3.4"
- "3.5"

notifications:
email: false
Expand All @@ -35,9 +31,9 @@ before_install:
- sudo ln -s /run/shm /dev/shm

install:
- conda create --name TestEnv python=$TRAVIS_PYTHON_VERSION atlas numpy=1.10.4 scipy cython
- conda create --name TestEnv python=$TRAVIS_PYTHON_VERSION atlas numpy scipy cython
- source activate TestEnv
- python -c "import os;print('\n'.join(map(str, os.environ.items())))"
- python -c "import os; print('\n'.join(map(str, os.environ.items())))"
- python setup.py install
# removing local libraries to be sure the installation is correct
- rm -rf ./compmech/lib
Expand Down
46 changes: 0 additions & 46 deletions C/cython_test_lib/_cython_test_lib.pyx

This file was deleted.

6 changes: 0 additions & 6 deletions C/cython_test_lib/cython_test_lib.py

This file was deleted.

26 changes: 0 additions & 26 deletions C/cython_test_lib/setup.py

This file was deleted.

34 changes: 0 additions & 34 deletions MANIFEST.in

This file was deleted.

4 changes: 2 additions & 2 deletions ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Version 0.6.1
Version 0.7.0
-------------
- create a boundary class with w1tx etc
- pass the laminate class instead of plyt etc
Expand All @@ -10,7 +10,7 @@ Version 0.6.1
- check why plate lb with reduced_dof=True is not the same as plate_w
- reconsider reading bardell_12 from the C code and reuse in FORTRAN

Version 0.7.0
Version 0.8.0
-------------
- implement CI compilation and test for FORTRANs
- improve the numerical stability of FORTRAN's eigensolver (cpanelbay)
Expand Down
46 changes: 34 additions & 12 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,55 @@ environment:
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\continuous-integration\\appveyor\\cmd_in_env.cmd"

matrix:
- PYTHON_VERSION: 2.7
PYTHON_ARCH: 32
WINDOWS_SDK_VERSION: "v7.0"
MINICONDA: C:\Miniconda
#- PYTHON_VERSION: 2.7
# PYTHON_ARCH: 32
# MINICONDA: C:\Miniconda

#- PYTHON_VERSION: 2.7
# PYTHON_ARCH: 64
# MINICONDA: C:\Miniconda-x64

#- PYTHON_VERSION: 3.4
# PYTHON_ARCH: 32
# MINICONDA: C:\Miniconda3

- PYTHON_VERSION: 3.4
PYTHON_ARCH: 64
MINICONDA: C:\Miniconda3-x64

init:
- "ECHO %PYTHON_VERSION% %MINICONDA%"

install:
- "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%"
- echo Environment Variables:
- set
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
- conda create -q -n testenv python=%PYTHON_VERSION% numpy=1.10.4 scipy pytest cython libpython
- conda create -q -n testenv python=%PYTHON_VERSION% numpy scipy pytest cython libpython
- activate testenv
#FIXME next lines are a workaround due to a buggy environment in conda
- cd %CONDA_DEFAULT_ENV%
# fixing bug with environment
- cd ..
- cd ..
- set DEFAULT_ENV=%CD%
- dir
- cd MinGW
- cd *-mingw32
- cd lib
- copy libmsvcr90d.a %CONDA_DEFAULT_ENV%\libs
- dir
- dir lib
- cd mingw32
- dir
- dir lib
- set PATH=C:\MinGW\lib;C:\MinGW\mingw32\lib;C:\MinGW\mingw32\bin;%PATH%
- cd %APPVEYOR_BUILD_FOLDER%

- set
- "CALL %CMD_IN_ENV% python setup.py install"
# removing local libraries to be sure the installation is correct
# removing local libraries to be sure the installation was correct
- del /s *.dll
- del /s *.so
- del /s *.h

test_script:
- cd %APPVEYOR_BUILD_FOLDER%
- set
- py.test --cache-clear
10 changes: 6 additions & 4 deletions compmech/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
.. autofunction:: static
"""
from analysis import Analysis
from freq import freq
from linear_buckling import lb
from static import static
from __future__ import absolute_import

from .analysis import Analysis
from .freq import freq
from .linear_buckling import lb
from .static import static
6 changes: 4 additions & 2 deletions compmech/analysis/analysis.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from __future__ import absolute_import

import numpy as np
from numpy import dot

from compmech.sparse import solve
from compmech.logger import msg
from newton_raphson import _solver_NR
from arc_length import _solver_arc_length
from .newton_raphson import _solver_NR
from .arc_length import _solver_arc_length

class Analysis(object):
r"""Class that embodies all data required for linear/non-linear analysis
Expand Down
2 changes: 1 addition & 1 deletion compmech/analysis/linear_buckling.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def lb(K, KG, tol=0, sparse_solver=True, silent=False,
eigvals, eigvecs = eigsh(A=KG, k=k,
which='SM', M=K, tol=tol, sigma=1., mode=mode)
msg('finished!', level=3, silent=silent)
except Exception, e:
except Exception as e:
warn(str(e), level=4, silent=silent)
msg('aborted!', level=3, silent=silent)
sizebkp = KG.shape[0]
Expand Down
4 changes: 3 additions & 1 deletion compmech/composite/lamina.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
.. currentmodule:: compmech.composite.lamina
"""
from __future__ import division, absolute_import

import numpy as np
from numpy import cos, sin

from compmech.constants import DOUBLE
from matlamina import MatLamina
from .matlamina import MatLamina

class Lamina(object):
"""
Expand Down
6 changes: 4 additions & 2 deletions compmech/composite/laminate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
.. currentmodule:: compmech.composite.laminate
"""
from __future__ import division, absolute_import

import numpy as np

from lamina import Lamina
from matlamina import read_laminaprop
from .lamina import Lamina
from .matlamina import read_laminaprop
from compmech.constants import DOUBLE
from compmech.logger import *

Expand Down
4 changes: 3 additions & 1 deletion compmech/conecyl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@
:members:
"""
from conecyl import load, ConeCyl
from __future__ import absolute_import

from .conecyl import load, ConeCyl
2 changes: 1 addition & 1 deletion compmech/conecyl/clpt/clpt_commons_include_header.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import numpy as np
from libc.stdlib cimport malloc, free
from cython.parallel import prange

from compmech.conecyl.imperfections.mgi cimport cfw0x, cfw0t
from ..imperfections.mgi cimport cfw0x, cfw0t

DOUBLE = np.float64
INT = np.int64
Expand Down
52 changes: 1 addition & 51 deletions compmech/conecyl/clpt/clpt_donnell_bc1_nonlinear.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@
#cython: infer_types=False
include 'clpt_nonlinear_header.pxi'

from compmech.conecyl.clpt.clpt_commons_bc1 cimport cfwx, cfwt, cfN


cdef extern from "clpt_donnell_bc1_nonlinear_clean.h":
void cfk0L_clean(double *wxs, double *wts, double *w0xs, double *w0ts,
int npts, double *xs, double *ts,
double *out, double *alphas, double *betas, void *args) nogil
from .clpt_commons_bc1 cimport cfwx, cfwt, cfN


cdef int NL_kinematics=0 # to use cfstrain_donnell in cfN
Expand Down Expand Up @@ -1050,50 +1044,6 @@ cdef void cfk0L(int npts, double *xs, double *ts, double *out,
free(k0Lq_2_q25)


cdef void cfk0L2(int npts, double *xs, double *ts, double *out,
double *alphas, double *betas, void *args) nogil:
cdef int i1, k1, i2, j2, k2, l2
cdef int c, i, pos

cdef double r, x, t, alpha, beta

cdef double *coeffs
cdef double *c0
cdef double L
cdef int m0, n0, m1, m2, n2
cdef double wx, wt, w0x, w0t

cdef cc_attributes *args_in=<cc_attributes *>args

L = args_in.L[0]
m1 = args_in.m1[0]
m2 = args_in.m2[0]
n2 = args_in.n2[0]
coeffs = args_in.coeffs
c0 = args_in.c0
m0 = args_in.m0[0]
n0 = args_in.n0[0]


cdef double *wxs = <double *>malloc(npts * sizeof(double))
cdef double *wts = <double *>malloc(npts * sizeof(double))
cdef double *w0xs = <double *>malloc(npts * sizeof(double))
cdef double *w0ts = <double *>malloc(npts * sizeof(double))

cfwx(coeffs, m1, m2, n2, xs, ts, npts, L, wxs)
cfwt(coeffs, m1, m2, n2, xs, ts, npts, L, wts)
cfw0x(xs, ts, npts, c0, L, m0, n0, w0xs, funcnum)
cfw0t(xs, ts, npts, c0, L, m0, n0, w0ts, funcnum)

cfk0L_clean(wxs, wts, w0xs, w0ts, npts, xs, ts, out,
alphas, betas, args)

free(wxs)
free(wts)
free(w0xs)
free(w0ts)


def calc_kG(np.ndarray[cDOUBLE, ndim=1] coeffs,
double alpharad, double r2, double L, double tLA,
np.ndarray[cDOUBLE, ndim=2] F,
Expand Down
Loading

0 comments on commit c9ebaa0

Please sign in to comment.