Skip to content

Commit 2a77225

Browse files
author
gamdow
committed
setup.py for local install\nrefactored vectorspace function into own file in order to test paths
1 parent 128a590 commit 2a77225

File tree

6 files changed

+44
-19
lines changed

6 files changed

+44
-19
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ __pycache__/
55
/dist/
66
/build/
77
/docs/_build/
8+
.DS_Store
9+
magnics.egg-info/

magnics/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33

44
__version__ = '0.1'
55

6+
from .vectorspace import vectorspace
67
import fenics

magnics/vectorspace.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import fenics as fe
2+
3+
def vectorspace(mesh):
4+
"""setup"""
5+
V = fe.VectorFunctionSpace(mesh, "CG", 1, dim=3)
6+
v = fe.TestFunction(V)
7+
u = fe.TrialFunction(V)
8+
m = fe.Function(V)
9+
Heff = fe.Function(V)
10+
return m, Heff, u, v, V

sandbox/minexample.ipynb

+9-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 13,
5+
"execution_count": 1,
66
"metadata": {
77
"collapsed": true
88
},
@@ -297,7 +297,9 @@
297297
{
298298
"cell_type": "code",
299299
"execution_count": 21,
300-
"metadata": {},
300+
"metadata": {
301+
"collapsed": true
302+
},
301303
"outputs": [],
302304
"source": [
303305
"# add quick test\n",
@@ -318,21 +320,21 @@
318320
],
319321
"metadata": {
320322
"kernelspec": {
321-
"display_name": "Python 2",
323+
"display_name": "Python 3",
322324
"language": "python",
323-
"name": "python2"
325+
"name": "python3"
324326
},
325327
"language_info": {
326328
"codemirror_mode": {
327329
"name": "ipython",
328-
"version": 2
330+
"version": 3
329331
},
330332
"file_extension": ".py",
331333
"mimetype": "text/x-python",
332334
"name": "python",
333335
"nbconvert_exporter": "python",
334-
"pygments_lexer": "ipython2",
335-
"version": "2.7.12"
336+
"pygments_lexer": "ipython3",
337+
"version": "3.6.1"
336338
}
337339
},
338340
"nbformat": 4,

sandbox/minexample.py

+2-12
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,7 @@
55
import fenics as fe
66
import numpy as np
77
import matplotlib.pyplot as plt
8-
9-
def setup_vectorspace(mesh):
10-
"""setup"""
11-
V = fe.VectorFunctionSpace(mesh, "CG", 1, dim=3)
12-
v = fe.TestFunction(V)
13-
u = fe.TrialFunction(V)
14-
m = fe.Function(V)
15-
Heff = fe.Function(V)
16-
return m, Heff, u, v, V
17-
18-
8+
import magnics
199

2010
# Material parameters
2111
Ms = 8.6e5 # saturation magnetisation (A/m)
@@ -47,7 +37,7 @@ def setup_vectorspace(mesh):
4737
mesh = fe.BoxMesh(p1, p2, nx, ny, nz)
4838

4939

50-
m, Heff, u, v, V = setup_vectorspace(mesh)
40+
m, Heff, u, v, V = magnics.vectorspace(mesh)
5141

5242
def effective_field(m, volume=None):
5343
w_Zeeman = - mu0 * Ms * fe.dot(m, H)

setup.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import setuptools
2+
3+
with open("README.rst") as f:
4+
readme = f.read()
5+
6+
setuptools.setup(
7+
name="magnics",
8+
version="0.1",
9+
description="Magnics is Python micromagnetics software using FEniCS.",
10+
long_description=readme,
11+
url="https://github.com/computationalmodelling/magnics",
12+
author="Leoni Breth, and Hans Fangohr",
13+
author_email="[email protected]",
14+
packages=setuptools.find_packages(),
15+
classifiers=["Development Status :: 3 - Alpha",
16+
"License :: OSI Approved :: BSD License",
17+
"Topic :: Scientific/Engineering :: Physics",
18+
"Intended Audience :: Science/Research",
19+
"Programming Language :: Python :: 3 :: Only"]
20+
)

0 commit comments

Comments
 (0)