This file contains 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
import OCC.gp as gp | |
import OCC.BRepPrimAPI as brep | |
import OCC.BRepAlgoAPI as brep_alg | |
import OCC.Utils.DataExchange.IGES as iges | |
import OCC.Utils.DataExchange.STEP as step | |
import OCC.Display.SimpleGui as gui | |
objs = [] | |
for x in [0, 21]: | |
ax = gp.gp_Ax2(gp.gp_Pnt(x,0,0), gp.gp_Dir(0,1,0)) |
This file contains 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
#define K ${k_group_size} | |
KERNEL | |
REQD_WG_SIZE(WG_SIZE, 1, 1) | |
void ${name_prefix}_scan_intervals( | |
${argument_signature}, | |
GLOBAL_MEM scan_type *partial_scan_buffer, | |
const index_type N, | |
const index_type interval_size |
This file contains 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
Please get your timing code from | |
https://github.com/hpc12/lec1-demo |
This file contains 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
import numpy as np | |
import numpy.linalg as la | |
import pyopencl as cl | |
import pyopencl.array as cl_array | |
from time import time | |
KERNEL = """ |
This file contains 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": "Quadrature playground" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains 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
import numpy as np | |
def running_trapz(f, mesh): | |
"""Return the 1D indefinite integral of the function *f* given | |
at the points in *mesh*. The integral is returned at the points | |
of *mesh*, and the leftmost value is always zero. The integral | |
is approximated using the trapezoidal rule. | |
""" |
This file contains 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 | |
def pretty_print_fp(x): | |
print "---------------------------------------------" | |
print "Floating point structure for %r" % x | |
print "---------------------------------------------" | |
import struct | |
s = struct.pack("d", x) | |
print "Hex pattern:", " ".join("%02x" % ord(i) for i in s[::-1]) |
This file contains 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 | |
from legendre_discr import CompositeLegendreDiscretization | |
import numpy as np | |
import matplotlib.pyplot as pt | |
def get_left_int_error(n, order): | |
a = 2 | |
b = 30 |
This file contains 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 | |
import numpy.linalg as la | |
import scipy.special as sp | |
class CompositeLegendreDiscretization: | |
"""A discrete function space on a 1D domain consisting of multiple | |
subintervals, each of which is discretized as a polynomial space of | |
maximum degree *order*. (see constructor arguments) |
This file contains 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 bvp import solve_bvp | |
a = -4 | |
b = 5 | |
def test_poisson(discr): | |
def u_true(x): |
OlderNewer