# Author: Tony Saad

## Copying Lists in Python

make sure you don’t fall into the trap of copying pointers in Python: import numpy as np a = np.zeros(2) print(“a = “, a) b = np.zeros(2) print(“b = “, b) b = a # this assignment is simply a pointer copy – b points to the same data pointed to by a a[0]=33.33 # …

## How to Highlight Code in Keynote

First install a utility called highlight. It is available through macports and homebrew. sudo port install highlight Now that highlight is installed, you can “apply” it to a file and pipe it to the clipboard: highlight -O rtf MyCode.cpp | pbcopy Now go to Kenote and simply paste from clipboard (or command + v). Highlight …

## C++ – Calling Overloaded Operator () from Pointer

Here are three ways to call a C++ classes’ operator () using a pointer: Say you have a C++ class name MyClass that overloads the operator “()”, something along the lines: I use method 2.

## Convert Movie or Animation to Animated Gif

mkdir frames ffmpeg -i input -vf scale=320:-1:flags=lanczos,fps=10 frames/ffout%03d.png convert -loop 0 frames/ffout*.png -fuzz 20% -layers OptimizePlus output.gif Thanks to: http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality

## Unbounded Kinetic Energy in Forward-Euler Inviscid Flows

Observation When using a forward-Euler method for the time integration of the momentum equation for an inviscid-flow, it appears that the kinetic energy of the flow grows unbounded in time, regardless of the timestep size. Problem Statement Estimate the change in total kinetic energy when using forward-Euler to integrate the Euler momentum equations in a periodic box. Approach To …

## List and Sort Files by Size

Find and sort all files > 1Mb in size, in current directory and subdirectories find . -size +1M -exec du -h {} \; | sort -nr

## Some Regex Notes

I happened to be dealing with a bunch of mallocs that look like this double* f =  (double*)malloc(sizeof(double)*nx*ny*nz); double* g = (double*)malloc(sizeof(double)*nx); double* h = (double*)malloc(sizeof(double)*nx*nz); I wanted to convert all of those those to use new, i.e. double* f = new double[nx*ny*nz] Using regex made all this possible search for: \(double\*\)malloc\(sizeof\(double\)\*(.*)\) replace with: new …

## A Note on the Vector Form of the Navier-Stokes Equations

Here’s how I mix vector and tensor notation to avoid diadics in the Navier-Stokes equations

## How to Sync Zotero with a Box Sync Enterprise Account

So the University of Utah provides us with 50 GB of storage with Box Sync. Box Sync supports webdav natively. On another note I use Zotero for my citation management. The great thing about Zotero is that it allows your to store your library on your own webdav. Combining the above I am able to …

## Poster Presented at PSAAPII TST Site Review

Tony Saad, Christopher Earl, Abhishek Bagusetty, Matthew Might, and James C. Sutherland, Architecture-Proof Multiphysics using a Domain Specific Language, Presented at the TST Site Review of the Utah PSAPPII Center, Salt Lake City, Utah, April 2015.

## Poster Presented at SIAM CSE2015 Conference!

Tony Saad, Abhishek Bagusetty, and James C. Sutherland, Wasatch: A CPU/GPU-Ready Multiphysics Code Using a Domain Specific Language, University of Utah, USA