Fixed building with boost < 1.40 by
- removing the saveVTK method from dudley's MeshAdapter completely
(no point introducing it now when we are trying to get rid of it soon)
- adding a helper function to weipa's python layer which can be called from C++
with older boost versions.

escript now supports out-of-tree builds.
All build and test files are now created under a user-definable build_dir
directory.
This also fixes issue 291.
Removed most svn:ignore props since they are no longer required.

Phew!
-escript, finley, and dudley now uses weipa's saveVTK implementation
-moved tests from finley to weipa accordingly; dudley still to do
-rebaselined all test files
-fixed a few issues in weipa.saveVTK, e.g. saving metadata without schema
-added a deprecation warning to esys.escript.util.saveVTK
-todo: change doco, tests and other places to use weipa.saveVTK

Fix the launcher so that it can give an environment even if buildvars is not present.
Environment now includes scons for standalone builds.
Fixes and cleanup for the install documentation.
scons TEMPLATES updated to define the optionfile version by default.
...mumble
finley no longer imports escript into the default namespace
...

The MPI and sequational GAUSS_SEIDEL have been merged.
The couring and main diagonal pointer is now manged by the patternm which means that they are calculated once only even if the preconditioner is deleted.

Merging changes from the lapack branch.
The inverse() operation has been moved into c++. [No lazy support for this operation yet.]
Optional Lapack support has been added for matrices larger than 3x3.
service0 is set to use mkl_lapack.

Fix bug in maxGlobalDataPoint and minGlobalDataPoint.
They now give the correct answers and the datapoint ids returned are globally
correct.
Removed some #defines from before COW
Removed hasNoSamples() - I don't trust myself to use that properly let alone anybody else.

A bunch of changes related to saveDataCSV.
[Not completed or unit tested yet]
Added saveDataCSV to util.py
AbstractDomain (and MeshAdapter) have a commonFunctionSpace method to
take a group of FunctionSpaces and return something they can all be interpolated to.
Added pointToStream() in DataTypes to help print points.
added actsConstant() to data - required because DataConstant doesn't store samples the same way other Data do.

size_t may be 64 bits which is incompatible to MPI_INT. This problem is fixed by inserting a cast in Mesh_read.c.
Moreover a fix has been added making sure that gmsh and triangle are executed on one processor only.

Misc fixes:
Added some svn:ignore properties for output files that were cluttering things up.
Lazy fixes:
Fixed shape calculations for TRACE and TRANSPOSE for rank>2.
Adjusted unit test accordingly.
As a Temporary change to DataC.cpp to test for lazy data in DataC's expanded check.
This is wrong but would only affect people using lazy data.
The proper fix will come when the numarray removal code moves over from the branch.
Made tensor product AUTOLAZY capable.
Fixed some bugs resolving tensor products (incorrect offsets in buffers).
Macro'd some stray couts.
- It appears that AUTOLAZY now passes all unit tests.
- It will not be _really_ safe for general use until I can add COW.
- (Everything's better with COW)

saveVTK: Reviewed and changed parts of this function due to several issues.
Confirmed that it's still working using finley/test/python/generate_dumps.py
(manually inserted saveVTK) with and without MPI on 1 and 4 processors.
Changes include:
- removed unnecessary USE_VTK check - we are not using any VTK functions
- fixed writing of Rec9 & Hex27 connectivity data in MPI mode
- fixed some cases where the file was not closed and memory was not freed
- replaced many instances of fprintf by fputs (simple strings)
- some minor optimizations by moving or initializing variables and combining
if-clauses
- got rid of ~300 lines of code and switched to consistent indentation making
the file a bit better readable

saveVTK: Close the file even if error is set upon completion. Note that
in some places the function still returns without proper clean up but
this won't be fixed until the rewrite to avoid more mess in the code.

Addressing mantis issue #221.
Interpolation.. and probeInterpolation.. now "work" for the NullDomain.
Work means throw a descriptive exception if you try to move into or out
of the NullDomain.
The bad_cast exception related to this has been fixed.

Two changes.
1. Move blocktimer from escript to esysUtils.
2. Make it possible to link to paso as a DLL or .so.
Should have no effect on 'nix's
In respect of 1., blocktimer had begun to spring up everywhere, so
for the moment I thought it best to move it to the only other library that
pops up all over the place.
In respect of 2., paso needed to be a DLL in order to use the windows intelc /fast
option, which does aggressive multi-file optimisations. Even in its current form, it either
vectorises or parallelises hundreds more loops in the esys system than appear in the pragmas.
In achieving 2. I have not been too delicate in adding
PASO_DLL_API
declarations to the .h files in paso/src. Only toward the end of the process of
the conversion, when the number of linker errors dropped below 20, say, did I choosy about what
functions in a header I declared PASO_DLL_API. As a result, there are likely to be many routines
declared as external functions symbols that are in fact internal to the paso DLL.
Why is this an issue? It prevents the intelc compiler from getting aggressive on the paso module.
With pain there is sometimes gain. At least all the DLL rules in windows give good
(non-microsoft) compiler writers a chance to really shine.
So, if you should see a PASO_DLL_API on a function in a paso header file,
and think to yourself, "that function is only called in paso, why export it?", then feel free to
delete the PASO_DLL_API export declaration.
Here's hoping for no breakage.....

I may get into trouble for this.
boost-python 1.34 does have a docstring_options class,
but does not have a 3 argument constructor for
it. So the test has been modified to
#if ((BOOST_VERSION/100)%1000 > 34) || (BOOST_VERSION/100000 >1)
If you wish to make things more delicate, one can define a 2 argument construction
of docopt just for 1.34 (with an #elif). Probably not worth the effort frankly.
Hope that this has not broken anything for anyone else. The SVN logs suggest this is a
little fragile.....
Also, please be aware that much of our chemistry interface code, that we wish to use with
escript, makes extensive use of boost python.
Having two different boost versions mucking with the python interpreter sounds
like a really bad idea, I'm sure you'll agree.
The problem is that it is not a simple task for us to build new versions of boost-python
on all our platforms. Consequently, it would be nice to be informed when you guys
intend to upgrade a support library of this nature so that we can plan and allocate
resources to keep up.
Cheers.

Ensure ESCRIPT_EXPORTS is defined only while compiling escript on windows.
A similar comment applies to FINLEY_EXPORTS.
SConstruct:
Fixed a comment.
reformatted the Export() call, and added IS_WINDOWS_PLATFORM to the exports.

Changes to avoid compiler warnings
Finley files now pass -Wall on gcc 4.3.2
saveVTK.c: replaced printf(string) with printf("%s", string)
MeshAdapterFactory.cpp: moved a few lines to avoid possible use of uninitialized vars
MeshAdapter.cpp: initialized ncdims in mesh dump
There is still a warning from a boost include file

Created a mid-sized test suite 'scalable_tests' as an alternative to 'all_tests'.
These run on small-ish systems and also on all 512 cores of Savanna.
Most features are covered, but it's better to use 'all_tests'.

Finished wrapper script by setting PATH.
The wrapper script reproduces the environment of the person who built
the software + values specified in his hostname_options.py file. A
user can run a python script without setting any environment variables
or loading any SGI modules.

Mesh_read.c - remove a debug printout introduced by me (oops).
Pattern_coupling.c - remove declaration of naib where it was not used, and remove naib frpm
omp pragmas where it was not declared, and not used.
Apparently cognac.ivec.org did not like this??

convection.py checkpointing uses mkdir/rmdir, and under MPI there
was a race condition.
mkdir needs to be run on only one CPU and then a barrier to prevent
working processors from using the directory before it exists.
Added methods domain.MPIBarrier and domain.onMasterProcessor() to
implement this technique.
A more general solution might be possible in the future.

New method for unit testing to compare two saveVTK files.
Can detect same-ness even if the nodes are re-ordered.
To do: issue with contact elements in that identical
nodes confuses test for node re-ordering.

Repair to saveVTK similar to revision 1677 (there we got the number of offsets correct
and in this revision we got the number of types correct).
In case of MPI > 1 do not run saveDX tests since saveDX is not MPI parallel.

The new MPI parallel ReadMesh is now the default after having passed
all tests both with and without MPI.
If you have been using ReadMesh you should notice no difference.
If you were using ReadMeshMPI then change to ReadMesh.

Added canTag methods to FunctionSpace and AbstractDomain (and its
offspring).
This checks to see if the domain supports tags for the given type of
function space.
Constructors for DataTagged now throw exceptions if you attempt to make
a DataTagged with a FunctionSpace which does not support tags.
To allow the default constructor to work, NullDomain has a single
functioncode which "supports" tagging.
Fixed a bug in DataTagged::toString and DataTypes::pointToString.
Added FunctionSpace::getListOfTagsSTL.
algorithm(DataTagged, BinaryFunction) in DataAlgorithm now only
processes tags known to be in use.
This fixes mantis issue #0000186.
Added comment to Data.h intro warning about holding references if the
underlying DataAbstract changes.
_python_ unit tests have been updated to test TaggedData with invalid
FunctionSpaces and to give the correct answers to Lsup etc.

Added new test suite run_inputOutput.py to systematically test I/O.
Can determine if two domains are same with Fourier analysis.
Added new method getNumDataPointsGlobal to return number of DPs of a distributed mesh.
Reading of tags in ReadMeshMPI failed occasionally, should be more robust now.

Test suite fails due to missing arg in call to Finley_Mesh_createMappings.
Added NULL arg, but still need to find proper fix as loadMesh does not work.
Adjusted SConstruct to delete pythonMPI if not compiled for MPI.

This fixes a problem which is typically arising when using reduced order
with MPI and a "small" number of elements per processor. In this case it
can happen that the couple matrix is not using all entries sent to the
processor. The old implementations assumed that the indices will cover
the entire input. This assumption has been removed.

This fixes a bug in the callculation of communication tables in
particular for the data to be send away. The problem was that the
previously used method based on the idea to use the elements stored on a
processor to decide what to send away is not suitable for the reduced
DOF. Now each processor sends a list of the DOFs it is expecting to its
naighbours.

Fixed nightly tests for savanna (no longer running in PBS cause can't
compile on compute node).
Modified domain.print_mesh_info() to tell how many elements are owned by
a node and how many are in the overlap.
Instrumented the preconditioner step.

A problem with VTK writer and MPI is fixed: Apparently MPI_file_open does not "delete" the file which has the effect that
if less date are written into the file as the file contained when opened bits of the previous containt remains in the file. This problem is fixed
by deleting the file if it exists before open it with MPI. The additional function Paso_existFile needed to be added as there is no standart C
function to test the exists of a file.

Install() on Mac OS was naming shared libs file.dylib...not OK for our
libraries for python calling C++ (escriptcpp.so and finleycpp.so).
This is because python's dlopen() calls only look for .so files.

Make operator=() on exception non-virtual. Should silence the Altix compiler.
However, if an exception is cast to another parent type, and
operator=() is called when the exception so cast is an l-value in the assignment,
an "incomplete" assignment will occur, copying only the parent class members of the
l-value in the assignmnet.

linux_gcc_eg_options.py:
remove the std99 option, it is no longer needed as the code compiles without
C 1999 extension (need for these extensions elinminated in windows port).
Turn on all warnings except unknown pragmas. Should catch a lot of stuff.
SConstruct:
Impassioned plea
system_dep.h:
Add the standard incantation for dealing with const declarations
in C code called from C and C++
blocktimer:
Get the calling interface right for C code called from C and C++
and use __const as defined in system_dep.h
(Should be re-factored into compiler_dep.h file).
MeshAdapterFactory.cpp:
Since we have (effectively) no control over netCDF policy,
cast const char *'s to char *'s

Merge in /branches/windows_from_1456_trunk_1620_merged_in branch.
You will find a preserved pre-merge trunk in tags under tags/trunk_at_1625.
That will be useful for diffing & checking on my stupidity.
Here is a list of the conflicts and their resolution at this
point in time.
=================================================================================
(LLWS == looks like white space).
finley/src/Assemble_addToSystemMatrix.c - resolve to branch - unused var. may be wrong.....
finley/src/CPPAdapter/SystemMatrixAdapter.cpp - resolve to branch - LLWS
finley/src/CPPAdapter/MeshAdapter.cpp - resolve to branch - LLWS
paso/src/PCG.c - resolve to branch - unused var fixes.
paso/src/SolverFCT.c - resolve to branch - LLWS
paso/src/FGMRES.c - resolve to branch - LLWS
paso/src/Common.h - resolve to trunk version. It's omp.h's include... not sure it's needed,
but for the sake of saftey.....
paso/src/Functions.c - resolve to branch version, indentation/tab removal and return error
on bad unimplemented Paso_FunctionCall.
paso/src/SolverFCT_solve.c - resolve to branch version, unused vars
paso/src/SparseMatrix_MatrixVector.c - resolve to branch version, unused vars.
escript/src/Utils.cpp - resloved to branch, needs WinSock2.h
escript/src/DataExpanded.cpp - resolved to branch version - LLWS
escript/src/DataFactory.cpp - resolve to branch version
=================================================================================
This currently passes tests on linux (debian), but is not checked on windows or Altix yet.
This checkin is to make a trunk I can check out for windows to do tests on it.
Known outstanding problem is in the operator=() method of exceptions
causing warning messages on the intel compilers.
May the God of doughnuts have mercy on my soul.

Merge of branches/windows_from_1431_trunk.
Revamp of the exception system.
Fix unused vars and signed/unsigned comparisons.
defined a macro THROW(ARG) in the system_dep.h's to
deal with the expectations of declarations on different architectures.
Details in the logs of branches/windows_from_1431_trunk.
pre-merge snapshot of the trunk in tags/trunk_at_1452

inserted sys.exit(1) into the tests so scons can detect the failure of the test.
A similar statement has been removed from an earlier as it produces problems on 64bit Linux. Previously exit(0) was called in case of success but now this is not done in order to avoid a fatal end of the program. in the case of an error in the test there could be a fatal error so but I guess that this not really a problem.
PS: the fact that signal 0 was returned even for the case of an error lead to the illusion that all tests have been completed successfully.

Completed mesh.dump(file) and mesh=LoadMesh(file) by adding TagMap and
implementing MPI parallelism.
Now allocating ElementFile for ContactElements even if there are none.
Removed file Mesh_dump.c since dump/loadMesh are in CPPAdapter/MeshAdapter*.cpp.

Modified scons target release_src to include lib/ and include/ since
their presence is required for a build. Modified
mydomain.print_mesh_info(True) to include more useful info about a
distributed domain. Added mypde.getOperator().print_matrix_info(True)
to tell about a distributed matrix.

The MPI branch is hereby closed. All future work should be in trunk.
Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

Added new methods for integration of Tri's and Tet's For Order 2 and 3.
NB: There is a conflict in the testing of the getNormal() function. On consultation with Lutz, we have concluded this is an issue with the test rather than the new methods.

Some changes to make things run on windows. There is still a problem with netcdf an long file names on windows but there is the suspicion that this is a bigger problem related to boost (compiler options). In fact runs with large numbers of iteration/time steps tend to create seg faults.

Changes needed for windows. This still does not work on and has not run on linux and the altix.
There are a few changes in names in the scons script, in particular _libs is used rather than _lib and _libs is always a list. By default on windows MSVC is used. The location of python is at C:\Program Files\python<version>, boost at C:\Program Files\boost and netcdf at C:\Program Files\netcdf.

Added explicit destructors to all Exception classes.
Fixed an ifdef in TestCase.cpp
Made the conditional definition of M_PI in LocalOps.h
depend only on M_PI being undefined.
Replace dynamically dimensioned arrays in DataFactory & DataTagged with malloc.
sort() method of list does not take a named argument
(despite the manual's claims to the contary).

The set/getRefVal functions of Data objects have been removed (mainly to avoid later problems with MPI).
Moreover, a faster access to the reference id of samples has been introduced. I don't think that anybody will
profit form this at this stage but it will allow a faster dump of data objects.

escript data objects can now be saved to netCDF files, see http://www.unidata.ucar.edu/software/netcdf/.
Currently only constant data are implemented with expanded and tagged data to follow.
There are two new functions to dump a data object
s=Data(...)
s.dump(<filename>)
and to recover it
s=load(<filename>, domain)
Notice that the function space of s is recovered but domain is still need.
dump and load will replace archive and extract.
The installation needs now the netCDF installed.

coordinates, element size and normals returned by corresponding
FunctionSpace mesthods are now protected against updates. So
+=, -=, *=, /=, setTaggedValue, fillFromNumArray will through an
excpetion.
The FunctionSpace class does nut buffer the oordinates, element size and
normals yet.

Large number of changes to Finley for meshing in MPI.
- optimisation and neatening up of rectcanglular mesh generation code
- first and second order 1D, 2D and 3D rectangular meshes are now
available in finley and escript using MPI.
- reduced meshes now generated in MPI, and interpolation to and from
reduced data types now supported.

+ Updated compilation options for Cognac to squeeze out a bit more performance
+ Now compiles using the Intel Math headers (mathimf.h) rather than plain math.h on both Win32 and Linux platforms when using the Intel compiler. Gives a small boost to performance on Altix and is essential on Windows

The test for the contact normal has been modified to take in cosideration the fact that the normal is unique up to the factor +/-1.
Now the test checks the kllength of the normal for 1 and the angle to the reference normal.

- added directory pythonMPI to the source tree. this directory contains
the c++ wrapper that is used to run python scripts in parallel for the
MPI version of escript/finley
- updated the SConstruct and ./scons/ess_options.py for conditional MPI
compilation. To compile the MPI version on ESS uncomment the #define
PASO_MPI in ./paso/src/Paso.h and add the command line option
useMPI=yes when running scons.
- fixed a compile time error in the MPI build in
finley/src/CPPAdapter/MeshAdapterFactory.cpp

Changes relating to the MPI version of escript
The standard OpenMP version of escript is unchanged
- updated data types (Finley_Mesh, Finley_NodeFile, etc) to store meshes
over multiple MPI processes.
- added CommBuffer code in Paso for communication of Data associated
with distributed meshes
- updates in Finley and Escript to support distributed data and operations
on distributed data (such as interpolation).
- construction of RHS in MPI, so that simple explicit schemes (such as
/docs/examples/wave.py without IO and the Locator) can run in MPI.
- updated mesh generation for first order line, rectangle and brick
meshes and second order line meshes in MPI.
- small changes to trunk/SConstruct and trunk/scons/ess_options.py to
build the MPI version, these changes are turned off by default.

A few changes in the build mechanism and the file structure so scons can build release tar files:
* paso/src/Solver has been moved to paso/src
* all test_.py are now run_.py files and are assumed to be passing python tests. they can run by
scons py_tests and are part of the release test set
* escript/py_src/test_ are moved to escript/test/python and are installed in to the build directory
(rather then the PYTHONPATH).
* all py files in test/python which don't start with run_ or test_ are now 'local_py_tests'. they are installed i
by not run automatically.
* CppUnitTest is now treated as a escript module (against previous decisions).
* scons realse builds nor tar/zip files with relvant source code (src and tests in seperate files)
the python tests don't pass yet due to path problems.

+ NEW BUILD SYSTEM
This commit contains the new build system with cross-platform support.
Most things work are before though you can have more control.
ENVIRONMENT settings have changed:
+ You no longer require LD_LIBRARY_PATH or PYTHONPATH to point to the
esysroot for building and testing performed via scons
+ ACcESS altix users: It is recommended you change your modules to load
the latest intel compiler and other libraries required by boost to match
the setup in svn (you can override). The correct modules are as follows
module load intel_cc.9.0.026
export
MODULEPATH=${MODULEPATH}:/data/raid2/toolspp4/modulefiles/gcc-3.3.6
module load boost/1.33.0/python-2.4.1
module load python/2.4.1
module load numarray/1.3.3

The sparse solver can be called by paso now.
the building has been change to reduce some code redundancy:
now all scons SCscripts are importing scons/esys_options.py which
imports platform specific settings.