Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ponderomotion
ponderomotion / Makefile
Created March 7, 2013 00:02
Generic C++ Makefile for SDL on Mac OSX
SHELL = /bin/sh
CXX = g++
FFLAGS = -g
TARGET = my_executable
OBJDIR = obj
SRCDIR = src
BINDIR = bin
@ponderomotion
ponderomotion / Makefile
Created February 19, 2013 17:25
Generic FORTRAN Makefile
SHELL = /bin/sh
# FORTRAN compiler
FC = mpif90
# Check if we're using ifort or something else
COMPILER = $(shell $(FC) -show | cut -d' ' -f1)
FFLAGS = -Wall
@ponderomotion
ponderomotion / splitstring.f90
Created October 4, 2012 12:26
Split a string into 2 either side a delimiter in FORTRAN
! split a string into 2 either side of a delimiter token
SUBROUTINE split_string(instring, string1, string2, delim)
CHARACTER(30) :: instring,delim
CHARACTER(30),INTENT(OUT):: string1,string2
INTEGER :: index
instring = TRIM(instring)
index = SCAN(instring,delim)
string1 = instring(1:index-1)
@ponderomotion
ponderomotion / reallocate.f90
Created August 30, 2012 12:27
Fortran 95+ modules to increase array sizes dynamically
! Daniel Fletcher 2012
! module for increasing array sizes dynamically
! currently new indices must be larger than old
! TODO : extend to handle array size reduction
MODULE reallocate
IMPLICIT NONE
@ponderomotion
ponderomotion / resize.f90
Created August 29, 2012 18:38
Array resizing
PROGRAM test1
IMPLICIT NONE
INTEGER, DIMENSION(:,:), ALLOCATABLE :: a
INTEGER :: i,j,ni,nj
ni = 4
nj = 4