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

This trunk now compiles and links under windows.
It passes the FunctionSpace.__str__() test 50000 times on windows.
It fails scons run_tests and scons_py_tests as it always did, but I have an idea why.
Please remember to add the appropriate dll linkage info to declarations that are to be visible outside a .so or .dll. Terry (BTW, PGH here) spent a lot of hacks clearing out blocktimer from the rest of the code when these 5 or 6 lines would have done the trick.

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.

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.

Add the esys and lib directories to the repository.
Remove the IS_WINDOWS_PLATFORM from the SConscripts, and
do the logic once in SConstruct.
SConstruct now includes example options files if the hostname_options file is not present.
This needs some more work for the altix.
The tests now depend upon the build target. This is important it seems, as there appears to be the
possibility of calling linking different libraries
against incompatible versions of sub-libraries.
This addressed most of the exceptions we were getting on windows.
All the useNetCDF logic is now done by SConstruct.
Made the init_target part of the build alias so that __ini__.py is created on a fresh checkout.
py_tests mostly pass on windows, only need to track down the exception in run_tests.

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.

As the LinearPDE uses coefficients as reduced even if they are handed
over as full the projector runs into a problem when reduced and full
arguments are used in the same projector. Now the projector resets the
coefficients befor starting the projection.

The modification fixes a problem with the garbage collection in python.
The problem seems that a default value of a method argument is seen as
being dependend on the the instance of the class. This produces a
circular dependence and can stop the garbage collection to delete the
object. The situation becomes in particulary bad if the class provides a
__del__ method as it is not clear where to break the circle.
We need to revisit all python classes in escript & Co to remove this
possible problem.

In VC++ boost has problems with numarray arguments from python. This
fixes that problem by taking python::object arguments from the python
level and converting it into python::numeric::array on the C++ level.
This hasn't been tested with VC++ yet.
Moreover the two Data methods dealing with big numarrays as argument and
return value have been removed.

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.

the FinleyReade accepts now gmsh files (use format="gmsh")
and
Simulations are accepting Models only. Moreover, there is a test now
if a all Models targeted by a model in the simulation or a subsimulation
are included in simulation or a subsimulation.

I have done some clarification on functions that allow to access individual data point values in a Data object.
The term "data point number" is always local on a MPI process and referes to the value (data_point_in_sample, sample)
as a single identifyer (data_point_in_sample + sample * number_data_points_per_sample). a "global data point number"
referes to a tuple of a processour id and local data point number.
The function convertToNumArrayFromSampleNo has been removed now and convertToNumArrayFromDPNo renamed to getValueOfDataPoint.
There are two new functions:
getNumberOfDataPoints
setValueOfDataPoint
This allows you to do things like:
in=Data(..)
out=Data(..)
for i in xrange(in.getNumberOfDataPoints())
in_loc=in.getValueOfDataPoint(i)
out_loc=< some operations on in_loc>
out.setValueOfDataPoint(i,out_loc)
Also mindp is renamed to minGlobalDataPoint and there is a new function getValueOfGlobalDataPoint. While in MPI the functions getNumberOfDataPoints and getValueOfDataPoint are working locally on each process (so the code above is executed in parallel).
the latter allows getting a single value across all processors.

fixes on ESySXML to get runmodel going.
* object ids are now local for read and write of XML
* ParameterSets are now written with class name
* ParameterSets linked by other ParameterSets (previously only Models) are written now
* list are now lists of str (rather than bools), lists with bool, int or float are mapped to numarray
* numarray are writen with generic types Bool, Int, Float (portability!)

modellib.WriteVTK has been rewritten. Instead of only three data objects scalar,
vector, tensor it takes now up to 20 data objects data0 ... data19 and writes it into a
single VTK file. There is also the possibilty to define individiual name tags name0,..., name19.
If no name is given the corresponding attribute name of the Link target is used.
This simplifies the usage and increases efficiency.

DataSources added to modelframe/EsysXML, and tests to run_xml.py. Currently does not actually handle data
sources,
just references. Functionality is in progress.
EsysXML format (URI can be a local file reference, or a remote reference such as an ftp site, fileformat
is currently any string descriptor, such as finleyMesh or gmtdata):
<Parameter type="DataSource">
<Name>
uritest
</Name>
<Value>
<DataSource>
<URI>
somelocalfile.txt
</URI>
<FileFormat>
text
</FileFormat>
</DataSource>
</Value>
</Parameter>

Some modifications to the binary operations +,-,*/, pow.
The code is a bit simpler now and more efficient has there is
no reseising required now. the resizing method has been removed as
it is very, very inefficient. Even serial code should be faster now.
It is now forbidden to do an inplace update of scalar data object with an object
of rank >0 as this is very slow (and does not make much sense).

Tensor products for Data objects are now computed by a C++ method
C_GeneralTensorProduct, which calls C function matrix_matrix_product
to do the actual calculation.
Can perform product with either input transposed in place, meaning
without first computing the transpose in a separate step.

changes to escript/py_src/pdetools.py and /escript/src/Data.h/.cpp to
make the Locator work in MPI. escript::Data::mindp now returns a 3 tuple,
with the MPI rank of the process on which the minimum value occurs
included. escript::Data::convertToNumArrayFromDPNo also takes the ProcNo
to perform the MPI reduction.
This had to be implemented in both the MPI and non-MPI versions to allow
the necesary changes to the Python code in pdetools.py. In the non-MPI
version ProcNo is set to 0. This works for the explicit scripts tested
thus far, however if it causes problems in your scripts contact Ben or
Lutz, or revert the three files (pdetools.py, Data.h and Data.cpp) to
the previous version.

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.

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.

Some chnages required for oder numarray versions. mai problem is that
operations on array objects with rank 0 sometimes return float rather
than arrays. This problem seems to be fixed in newer releases.