Skip to content

Instantly share code, notes, and snippets.

View MiroK's full-sized avatar
😃
Err and err and err

Miroslav Kuchta MiroK

😃
Err and err and err
View GitHub Profile
@MiroK
MiroK / MEK4300.3.14
Last active December 12, 2015 01:29
My fist ipython notebook
{
"metadata": {
"name": "pi-problem"
},
"nbformat": 2,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
@MiroK
MiroK / mem_func_pointer.cpp
Created July 18, 2013 19:25
C++ member-function function-pointer
#include <iostream>
class Calculator
{
public:
int operation(int a, int b) { return (this->*_operation)(a, b); }
void set_operation(int option)
{
switch(option)
@MiroK
MiroK / Stationary approx
Created October 10, 2013 21:30
Doodling on stationary approximation
{
"metadata": {
"name": "stationary_phase"
},
"name": "stationary_phase",
"nbformat": 2,
"worksheets": [
{
"cells": [
{
'''
This script investigates midpoint value of nodal basis functions of Lagrange
finite element on [0, 1].
'''
from numpy import zeros, linspace
from numpy.linalg import inv
import matplotlib.pyplot as plt
'Investigating higher-order CR like elements.'
from numpy import zeros, linspace, meshgrid, sqrt, where
from numpy.ma import masked_where
from numpy.linalg import inv
import matplotlib.pyplot as plt
def get_value(q, midpoint=(1./3, 1./3)):
assert 0 < q < 3
from dolfin import *
from numpy.random import random, choice
class RandomF(Expression):
def eval(self, values, x):
values[0] = random()
def make_random(n_cells, n_random):
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MiroK
MiroK / helmoholtz.py
Created February 20, 2017 18:26
Solving with FEniCS_ii
from dolfin import *
from trace_tools.trace_assembler import trace_assemble
from trace_tools.norms import inv_interpolation_norm_eig
from trace_tools.embedded_mesh import EmbeddedMesh
from block import block_mat, block_vec
from block.iterative import MinRes
from block.algebraic.petsc import AMG
gamma = ['near((x[0]-0.25)*(x[0]-0.75), 0) && (0.25-DOLFIN_EPS < x[1]) && (x[1] < 0.75+DOLFIN_EPS)',