Skip to content

Instantly share code, notes, and snippets.

View wence-'s full-sized avatar

Lawrence Mitchell wence-

View GitHub Profile
from firedrake import *
from firedrake.petsc import PETSc
m = UnitSquareMesh(1, 1)
V = FunctionSpace(m, 'CG', 1)
u = TrialFunction(V)
v = TestFunction(V)
A = assemble(u*v*dx)
bzr_branch=''
function find_bzr_branch {
local dir=. dirty head nick
# Parse all the bzr config stuff by hand, rather than calling out
# to the binary, cos it's so damn slow.
until [ "$dir" -ef / ]; do
if [ -d "$dir/.bzr/checkout" ]; then
head=$(readlink -f $dir)
dirty=''
bzr_branch=" ${red}b${green}"
from ufl import HDiv
from firedrake.fiat_utils import *
class CellIndirection(object):
def __init__(self, fs):
ufl_ele = fs.ufl_element()
# Unwrap non HDiv'd element if necessary
if isinstance(ufl_ele, HDiv):
ele = ufl_ele._element
...
from slepc4py import SLEPc
A = assemble(a).M.handle
eps = SLEPc.EPS().create()
# eps.setDimensions(nev=10, ncv=100)
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#define PI_32 "3.14159265358979323846264338327950"
#define PI_16 3.1415926535897932
char *pi(double pi, double remainder)
{
char *ret, spi[37], srem[37];
Point (1) = {9.000000000000e-01, 0.000000000000e+00, 0, 0.01};
Point (2) = {-5.078426679081e-02, 3.967631009135e-01, 0, 0.01};
Point (3) = {-9.000000000000e-01, 1.102182119233e-16, 0, 0.01};
Point (4) = {-2.299312842587e-01, -3.273096462360e-01, 0, 0.01};
Line (1) = {1, 2};
Line (2) = {2, 3};
Line (3) = {3, 4};
Line (4) = {4, 1};
Line Loop (7) = {1, 2, 3, 4};
Physical Line (9) = {1, 2, 3, 4};
diff --git a/pyop2/compilation.py b/pyop2/compilation.py
index 1a9db26..7e7036a 100644
--- a/pyop2/compilation.py
+++ b/pyop2/compilation.py
@@ -102,6 +102,8 @@ class Compiler(object):
logfile = os.path.join(cachedir, "%s.log" % basename)
errfile = os.path.join(cachedir, "%s.err" % basename)
with progress(INFO, 'Compiling wrapper'):
+ import traceback
+ traceback.print_stack()
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int ierr;
MPI_Datatype unit, mine[2], remote[2];
int rcount[2];
int roffset[2];
int rmine[8];
Point(1) = {0, 0, 0};
Point(2) = {1, 0, 0};
Point(3) = {1, 1, 0};
Point(4) = {0, 1, 0};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Line Loop(1) = {1, 2, 3, 4};
Plane Surface(1) = {1};
def make_projection(v, target, solver_parameters=None):
V = target.function_space()
p = ufl_expr.TestFunction(V)
q = ufl_expr.TrialFunction(V)
a = ufl.inner(p, q) * V.mesh()._dx
L = ufl.inner(p, v) * V.mesh()._dx
prob = LinearVariationalProblem(a, L, target)
parameters = solver_parameters.copy() if solver_parameters else {}