BlockIt and PyF95++

v1.7.1
BlockIt logo

What is BlockIt?

BlockIt is a fairly simple Python framework used to block parse your code (or any text file) into nested blocks. That doesn't sound terribly exciting, but each type of block is user defined, inheriting many useful methods from the parent Block class. The methods allow you to do such things as create dependencies between blocks, modify blocks based on state parameters; dynamically modifying the final realization of the block. In a nutshell, it allows you to create a fairly sophisticated pre-processor, more powerful than straight-up macros (we have the power of Python at our disposal here). The framework at its base defines a line scanner, a block parser and a symbol table used to globally store the blocks.

How has it been used?

PyF95++: Fortran templating and pre-processing

The BlockIt framework has already been used to create a templating capability for the Fortran 95/2003 language along with some language extensions. This is called PyF95++ and operates as a preprocessing tool. From this, it was straightforward to create a template library for the language, similar to the C++ STL. All of the containers in the library are reference counted as well. This extension is part of the BlockIt project so that a developer can quickly see how the framework was used to accomplish this extension. The library includes:

AList An array-based linked list
Buffer The buffer is used to store multi-dimensional vectors of a specified type. These can be changed to different shapes and are reference counted.
DLList A doubly linked list
Exception A set of exception types to be used similarly to C++ exceptions
HashTable --
Pair --
Queue --
Stack --
String A collection of functions for manipulating strings
VarPtrs
MultiVec

Also included with the library are some addons:

Plot3DFile
OptionParser An option parsing utility similar to the Python optparse package
Functions A set of functions used in conjunction with the STL. Includes zip, enumerate, string manipulations, etc.
UnitTest A simple-to-use Fortran unit testing framework built upon the templating. This Fortran unit-test framework is used to test all of the STL components of the PyF95++ project. It has support for testing of parallel components through the passing of appropriate MPI threads into all the tests of a given module.

All of the templated types that have been introduced are reference counted, similar to Python, and provide consistent interfaces to manipulate data. Please visit the wiki at http://sourceforge.net/apps/mediawiki/blockit for more information.

Current Requirements

1.5.3 and higher Currently we have been testing with Python 2.6.5 and GFortran 4.6 IS required.

1.5.0 and higher Currently we have been testing with Python 2.6.5 and GFortran 4.6 but we think 4.4 or 4.5 will work.

1.4.4 and lower We think Python 2.5 and GFortran 4.3.2 (if you are using PyF95++) are sufficient.

Where to get BlockIt and PyF95++

BlockIt is an open source Python package made available at sourceforge under GPL V2 license. Visit the BlockIt project here. and includes all of the blockit utility, PyF95++, a directory full of tests and examples, and unit-tests. We are also looking to continually add documentation regarding the programming patterns used.

The project was introduced originally on comp.lang.fortran. The BlockIt project was also made available on Softpedia in the developer tools and mentioned on the Fortran Wiki.

BlockIt Developer Practices

Users can always be assured of reasonably well tested software. The unit tests provide coverage of many basic aspects of the framework, and the number of examples (even many not included with the distribution) are built regularly and checked for memory errors with Valgrind. The developers seek always to provide a high-quality product with high quality documentation (see the wiki) as features become available and fully tested.

That said, no product is perfect. If you experience issues, please contact the developers for assistance. We love feedback!

Blockit Links
Site Map
Download BlockIt
BlockIt Add'l Files
Wiki
Changelog
Doxygen Output
Directory Tree
Unit Tests
Programming Tools
Doxygen
Graphviz
Valgrind
Page last updated on 3 Jul 2011