From d63595a6aef172bf1a0eaa33b2a5047ca3729b16 Mon Sep 17 00:00:00 2001 From: Stephen Mardson McQuay Date: Mon, 21 Mar 2011 11:22:51 -0600 Subject: [PATCH 1/4] added an ubuntu installer --- install.ubuntu.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 install.ubuntu.sh diff --git a/install.ubuntu.sh b/install.ubuntu.sh new file mode 100644 index 0000000..c64393c --- /dev/null +++ b/install.ubuntu.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +sudo aptitude install python-dev python-setuptools libblas-dev liblapack-dev gfortran build-essential qhull-bin libqhull-dev + +sudo easy_install pip +sudo pip install mercurial + + +sudo pip install virtualenv +sudo pip install virtualenvwrapper + +mkdir ~/.virtualenvs +echo 'source $(which virtualenvwrapper.sh)' >> .bashrc + +mkvirtualenv --no-site-packages research + +pip install numpy +pip install scipy + + +mkdir ~/src +cd ~/src && hg clone https://mcquay.me/hg/research +cd ~/src/research && python setup.py develop +cd ~/src/research && python test/all.py From 75806a1377624e44eb9c9a7218cb9f9e48077d04 Mon Sep 17 00:00:00 2001 From: Stephen Mardson McQuay Date: Mon, 21 Mar 2011 11:55:52 -0600 Subject: [PATCH 2/4] minor: made things more legible, and resolved a tiny bug --- install.ubuntu.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/install.ubuntu.sh b/install.ubuntu.sh index c64393c..94c414a 100644 --- a/install.ubuntu.sh +++ b/install.ubuntu.sh @@ -1,23 +1,37 @@ #!/bin/bash -sudo aptitude install python-dev python-setuptools libblas-dev liblapack-dev gfortran build-essential qhull-bin libqhull-dev +PACKAGES="\ +build-essential \ +gfortran \ +python-dev \ +python-setuptools \ +libblas-dev \ +liblapack-dev \ +libqhull-dev \ +qhull-bin \ +" + +echo "we'll ask for your password to install a few things:" +echo "like theses packages: $PACKAGES" + +sudo aptitude install -y $PACKAGES sudo easy_install pip sudo pip install mercurial - sudo pip install virtualenv sudo pip install virtualenvwrapper mkdir ~/.virtualenvs echo 'source $(which virtualenvwrapper.sh)' >> .bashrc +source $(which virtualenvwrapper.sh) mkvirtualenv --no-site-packages research +workon research pip install numpy pip install scipy - mkdir ~/src cd ~/src && hg clone https://mcquay.me/hg/research cd ~/src/research && python setup.py develop From 6234f8ffe82b8caec27c7f555e772671996cb2f8 Mon Sep 17 00:00:00 2001 From: Stephen Mardson McQuay Date: Mon, 21 Mar 2011 12:13:46 -0600 Subject: [PATCH 3/4] moderate: cleaned up file, used library funcs --- bin/parse_gmsh3D.py | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/bin/parse_gmsh3D.py b/bin/parse_gmsh3D.py index 22bf484..e14da90 100755 --- a/bin/parse_gmsh3D.py +++ b/bin/parse_gmsh3D.py @@ -7,29 +7,15 @@ import numpy as np import interp.bootstrap from interp.grid.gmsh import gmsh_grid3D -from interp.tools import improved_answer, log, exact +from interp.tools import improved_answer, exact -from interp.grid import grid - - -if __name__ == '__main__': - if len(sys.argv) != 2: - print >> sys.stderr, "usage: %s " % sys.argv[0] - sys.exit(1) - - g = gmsh_grid3D(sys.argv[1]) +def test_success(input_file, count): + g = gmsh_grid3D(input_file) g.q = np.array([exact(x) for x in g.verts]) - X = np.array([0.2, 0.5, 0.01]) - R = g.get_containing_simplex(X) - R, S = g.get_simplex_and_nearest_points(X, 10) - print R - print "r", R - print "s", S - results = {True:0, False:0} # import pdb; pdb.set_trace() - for i in xrange(1000): + for i in xrange(count): X = np.random.random((1,3))[0] a = g.run_baker(X, order = 3, extra_points = 32) @@ -37,8 +23,13 @@ if __name__ == '__main__': results[improved_answer(a, e)] += 1 - print results - # g.normalize_q() - # print g.toxml() + return results - igg = grid(g.verts, g.q) +if __name__ == '__main__': + if len(sys.argv) != 3: + print >> sys.stderr, "usage: %s " % sys.argv[0] + sys.exit(1) + + input_file, count = sys.argv[1:] + + print test_success(input_file, int(count)) From 8650a8a5415d9c8329042bf90d0d4442cd18cb5a Mon Sep 17 00:00:00 2001 From: Stephen Mardson McQuay Date: Mon, 21 Mar 2011 15:15:01 -0600 Subject: [PATCH 4/4] moved install script --HG-- rename : install.ubuntu.sh => tools/install.ubuntu.sh --- install.ubuntu.sh => tools/install.ubuntu.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename install.ubuntu.sh => tools/install.ubuntu.sh (100%) diff --git a/install.ubuntu.sh b/tools/install.ubuntu.sh similarity index 100% rename from install.ubuntu.sh rename to tools/install.ubuntu.sh