Skip to content

Instantly share code, notes, and snippets.

View mikeando's full-sized avatar

Mike Anderson mikeando

  • DownUnder GeoSolutions
  • Perth
View GitHub Profile
@mikeando
mikeando / README.md
Last active February 4, 2023 01:02
Fraction approximation in C++
#include <cerrno>
#include <iostream>
#include <typeinfo>
//Here's a simple function that does exactly what we might expect
void testx( int * errnox ) {
std::cout<<"in testx type of errno = "<<typeid(errnox).name() <<std::endl;
if(errnox) {
*errnox = 7;
std::cout<<"errnox is "<<errnox<<std::endl;
pub struct CircularQueue<T> {
queue: Vec<Option<T>>,
head: usize,
tail: usize,
max_capacity: usize,
count: usize,
}
impl<T> CircularQueue<T> {
pub fn new(size: usize) -> CircularQueue<T> {
@mikeando
mikeando / mpi_heat_test.py
Created November 8, 2019 07:24
Example bad devito MPI operator
import numpy as np
import cloudpickle
from mpi4py import MPI
from devito import Function, TimeFunction, Grid, Eq, Operator, configuration
configuration["mpi"] = True
configuration["openmp"] = True
@mikeando
mikeando / demo.py
Last active November 15, 2019 07:57
Devito comm mismatch
import numpy as np
from dugwave.devitowrap import Function, TimeFunction, Grid, Eq, Operator, configuration, Constant, SpaceDimension, SubDimension, solve
from sympy import Symbol
from mpi4py import MPI
bc_thickness = 4
nx=10
ny=10
dx=0.1
@mikeando
mikeando / thiserror_backtrace.rs
Created May 12, 2020 23:51
Example of backtrace usage in thiserror
#![feature(backtrace)]
extern crate thiserror;
use thiserror::Error;
use std::backtrace::Backtrace;
#[derive(Error, Debug)]
pub enum DataStoreError {
//#[error("data store disconnected")]