This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* http://stackoverflow.com/questions/2520978/how-to-tile-the-contents-of-a-calayer */ | |
// callback for CreateImagePattern. | |
static void DrawPatternImage (void *info, CGContextRef ctx) { | |
CGImageRef image = (CGImageRef) info; | |
CGContextDrawImage(ctx, | |
CGRectMake(0,0, CGImageGetWidth(image),CGImageGetHeight(image)), | |
image); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "Cell centered finite volumes" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division | |
import numpy as np | |
from scipy.integrate import simps | |
from scipy.sparse import spdiags, coo_matrix, csc_matrix, dia_matrix, dok_matrix, identity | |
from scipy.sparse.linalg import spsolve | |
from itertools import chain | |
import pylab | |
import scipy | |
print "scipy", scipy.__version__ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instantiation. | |
# Make a solver object, created automatically with default options. The solve is instantiated | |
# only with the variables that are common to all of the solvers. This means 1) the r.h.s. of | |
# function to solve, 2) a start time, 3) initial conditions, 4) Jacobian function. Strictly | |
# speaking the Jacobian is optional here because only some solvers will require it. As a | |
# compromise lets pass it as a keyword argument, this also gets around any awkward 'use_jac' | |
# options because the solver either has a Jacobian function at init time or it does not. | |
solver = odesolver("cvodes", ode_function, time_start, initial_conditions, jacobian_function=None) | |
# Solver options. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fipy import * | |
import numpy as np | |
""" | |
This script illustrates a failure with the finite volume method for an elliptical problem on a non-uniform mesh. | |
For more information see the question and answer here, | |
http://scicomp.stackexchange.com/questions/8577/peculiar-error-when-solving-the-poisson-equation-on-a-non-uniform-mesh-1d-only | |
""" | |
def fipy_step_charge(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
daniel@DJF2:~/dev/git/odes*development$ rm -rf build/ | |
daniel@DJF2:~/dev/git/odes*development$ python setup.py install | |
============================================= | |
parent package is scikits | |
top path is /Users/daniel/dev/git/odes | |
============================================= | |
lapack_opt_info: | |
FOUND: | |
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate'] | |
define_macros = [('NO_ATLAS_INFO', 3)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Array { | |
mutating func removeObject<U: Equatable>(object: U) { | |
var index: Int? | |
for (idx, objectToCompare) in enumerate(self) { | |
if let to = objectToCompare as? U { | |
if object == to { | |
index = idx | |
} | |
} | |
} |