Skip to content

Instantly share code, notes, and snippets.

@mlohry
mlohry / testpgf.tex
Created October 30, 2014 18:34
Matplotlib/PGF/LaTeX example TeX
\documentclass[12pt]{article}
\usepackage{pgf}
\begin{document}
\begin{figure}[h]
\begin{center}
\input{testpgf.pgf}
\caption{A figure generated by PGF input.}
\end{center}
\end{figure}
@mlohry
mlohry / testpgf.py
Created October 30, 2014 18:35
Matplotlib/PGF/LaTeX example py
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
fig_size=(4.5,2.5)
params = {'backend': 'pgf',
'axes.labelsize': 12,
'text.fontsize': 12,
'legend.fontsize': 12,
'xtick.labelsize': 12,
@mlohry
mlohry / teststiffjfnk.cpp
Created April 24, 2015 21:30
Solving an Eigen::Matrix system type RHS with PETSc implicit timestepping + JFNK
#include <iostream>
#include <math.h>
#include <Eigen/Dense>
#include <petscts.h>
typedef struct {
// Vec solution; /* global exact solution vector */
Eigen::MatrixXd soln,rhs;
const double y0 = 1.0e-3; // epsilon in original ODE
} AppCtx;
@mlohry
mlohry / eigenvecmap.cpp
Created January 23, 2017 19:42
eigen map
#include <iostream>
#include <Eigen/Dense>
int main(){
Eigen::MatrixXd A(3,2); // 3x2 dynamically sized matrix
A << 0,1,2,
3,4,5;
std::cout << "A=\n" << A << "\n";
// this one *copies* the values into a column vector
@mlohry
mlohry / ExternalCGNS.cmake
Last active October 23, 2017 23:49
CGNS external project
ExternalProject_Add(
cgns_external
URL "https://github.com/CGNS/CGNS/archive/v3.3.1.zip"
URL_MD5 d5798e5904ac1029ae324d47fad08efe
SOURCE_DIR ${CMAKE_BINARY_DIR}/external/cgns/
BINARY_DIR ${CMAKE_BINARY_DIR}/external/cgns-build/
INSTALL_DIR ${EXTERNAL_INSTALL_DIR}
CMAKE_ARGS