Skip to content

Instantly share code, notes, and snippets.

@cvr
cvr / README_install_of+v2012.md
Last active December 29, 2023 00:44
System-wide installation of OpenFOAM v2012 and related tools

Installation of OpenFOAM v2012

System

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cvr
cvr / README_install_of8.md
Last active August 2, 2023 05:31
System-wide installation of OpenFOAM 8 and related tools

Installation of OpenFOAM 8

Useful links

@cvr
cvr / dart_flutter_index_with_three_routes.dart
Last active May 8, 2020 09:11
A Dart/Flutter example of an Index page allowing navigation to three screens
// Run this in https://dartpad.dartlang.org/flutter
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
title: 'Navigation Basics',
home: MainRoute(),
));
}
@cvr
cvr / my_dft.py
Created February 3, 2012 19:50
Discrete Fourier Transform
#!/usr/bin/python
# vim: set fileencoding=utf-8 :
# -*- coding: utf-8 -*-
########################################################################
# Copyright (C) 2012 by Carlos Veiga Rodrigues. All rights reserved.
# author: Carlos Veiga Rodrigues <cvrodrigues@gmail.com>
# version: 1.0, date: January 2012
#
# This program can be redistribuited and modified
# under the terms of the GNU Lesser General Public License
@cvr
cvr / rectree_bisection2d.py
Created December 15, 2011 18:25
Recursive bisection method for 2d convex quadrilaterals
#!/usr/bin/python
# vim: set fileencoding=utf-8 :
# -*- coding: utf-8 -*-
########################################################################
# Copyright (C) 2011 by Carlos Veiga Rodrigues. All rights reserved.
# author: Carlos Veiga Rodrigues <cvrodrigues@gmail.com>
#
# This program can be redistribuited and modified
# under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation,
@cvr
cvr / colorbar_title2.py
Created October 21, 2011 14:33
Set a title on top of a colorbar with set_xlabel
...
## COLORBAR
cb=plt.colorbar(cf, cax=cx)
cx.set_xlabel(r"Variable Z", labelpad=10)
cx.xaxis.set_label_position('top')
...
@cvr
cvr / colorbat_title1.py
Created October 21, 2011 14:33
Set a title on top of a colorbar with set_title
...
## COLORBAR
cb=plt.colorbar(cf, cax=cx)
cx.set_title(r"Variable Z")
...
@cvr
cvr / colorbar_title0.py
Created October 21, 2011 14:32
Set a title on top of a colorbar
fig=plt.figure()
## AXES HANDLE
ax=fig.add_axes(mpltr.Bbox([[ .14 , .14 ],[ .90 , .92 ]]))
## COLORBAR AXES HANDLE
cx=fig.add_axes(mpltr.Bbox([[ .91 , .14 ],[ .93 , .92 ]]))
...
## PLOT THE STUFF YOU WANT
ax.contourf(X, Y, Z, etc... )
...
## COLORBAR
@cvr
cvr / gist:1277782
Created October 11, 2011 10:30
Avoid possible division by zero by limiting the divisor (FORTRAN)
REAL, PARAMETER :: SMALL = 1.E-18
!! for a divisor b>0
c = a/MAX(b, SMALL)
!! for a divisor b with an arbitrary sign
c = a/SIGN(MAX(ABS(b), SMALL), b)