Introducing the library version of the code

In this version three major modifications were performed:
1. The main file was splited in its main functional components.
2. These new functional components are available through a new library structure.
3. The code was splited in .h (headers and definitions) and .cpp (implementations) files.

Some of the most important files were splited, including EMfields3D.h and Particles3D.h.

Some of the previous modifications are turned off, in particular those related with the debugging and profiling. These will be turned on in the following commits.

This version of the code DOES NOT CONTAIN particle injection at the boundaries nor the related field boundary conditions.
Cleaning indentation

In Particles3Dcomm.cpp some automatic indentations were not done correctly.
Case selection and particle communication bug

A new flag in the input file "Case=" allows to initialize the field data with the corresponding fields without having (forgeting) to compile the code.

In addition a known bug in the particle communication was corrected. The problem causes infinite loops when using non-periodic boundaries. The file corrected was Particles3Dcomm.cpp.

The Poisson corrector has been turned off because it causes problems in some configurations, slow down the code and does not give any tangible improvement to the results of the simulations.
New Poisson correction and Case flags + Particle depopulation

The new flag 'PoissonCorrection' allows to select if the Poisson correction must be active.

The flag 'Case' will select the initialization of the simulation. It is stored in Collective->Case and can be recovered using Collective::getCase(). It can be
 used in other places in the code for specific case related procedures. To add a new case modify the if/else if/else section in iPic3Dlib : c_Solver::Init().

Particle depopulator for the planet case has been included. It removes the particles inside a sphere and imposes a constant charge equal to rhoINIT.
Particle injection

Particle repopulation (injection) at the boundaries has been included in this commit. Warning: particle injection works better with Andrei's OpenBC boundary conditions which will be included in the next commit.
Adding Andrey's OpenBC boundary conditions

These conditions impose B = B0 and E = - ve x B in the boundaries where bcEMface* = 2. This is currently the best boundary condition to use with particle injection boundaries.
Adding constant charge to OpenBC boundaries

This is used to help avoit the noise produced by the OpenBC boundary condition, by imposing a constant charge.
Perfect conductor update + 1st version of the parallel HDF5

A new flag 'PoissonCorrection' allows to activate or desactivate the Poisson correction from the input file.

The prefectConductor boundary condition for the fields has been updated to cover all the 6 faces of the simulation domain.

The first version of the parallel HDF5 output was coded. New flags were added to the input file to use this output:
'WriteMethod' : if equal to 'Parallel' the new parallel output is used, with any other value the classical output method is used.
'SimulationName' : Gives a name to the simulation that is going to be used in the file name.

In the current commit only the Bxc field is saved. More fields will be added in the next commit.
New parallel HDF5 output

In this commit the new parallel HDF5 output writes one file per output cycle. The file contains the B, E, rho_0, rho_1, J_0 and J_1 fields. The pressure tensor components are not yet included in this file. Particles are not currently being writen using the parallel HDF5 method.
Corrections based on issue #24 and opening question #25

Processor distribution seems to play a role in the final results of the simulation. The GEM case gives slightly different results depending on how the cartesian grid is distriuted between the processors.

A small correction of the for loop boundaries was performed in the perfect conductor subroutines.
Adding code for the coupling with BATSRUS

The files listed in this commit were modified to perform the coupling with the BATSRUS code.

The modifications are all encompased by a \#ifdef BATSRUS \#endif block.

To generate the makefiles for the BATSRUS version (activation of the -DBATSRUS flag) in your build directory type:
BATSRUS=1 cmake <src/directory>
where <src/directory> is the directory containing the CMakeLists.txt file.

In addition a new case 'BATSRUS' was included for this version. When running the code the 'Case' flag in the inputfile must be equal to 'BATSRUS' to activate the correct field and particle initializaion (see main/iPic3Dlib.cpp and the new initBATSRUS in fields/EMfields3D.cpp).
Imposing consistent BCface conditions on the B and E fields

Up until now the BCface boundary conditions were hardcoded and were only correctly defined in the Y faces. The new structure imposes consistent boundary conditions in all 6 faces of the simulation box for the E and B fields given the selection made in the input file.
Adding dipolar magnetic field for Earth computations

WARNING: The dipolar field can be imposed in two ways:
1. By adding a J_ext (rotational of B_ext) contribution to the Jhat term on the source.
2. By impossing the B_ext dipole field on the B field in the image side of the solver and on the particle mover.

The present commit uses the 1st method to impose the dipolar field. The second method does not work in its current state. Corrections will be performed in the following commits.
Updating deprecated HDF5 subroutine calls

In the newest versions of HDF5 the default deprecated subroutines point to the old versions. We're using the new versions of the subroutines (called "2").
Updating the restart function

Using restart for "Dipole" simulations was not working: the four geometrical parameters concerning the position and size of the dipole were missing from the settings.hdf file and causing an incorrect initialisation of the charge of the planet.
Deprecated HDF5 functions in Particles3Dcoom.cpp

There were still a few deprecated HDF5 functions in this file.
Deactivation of Parallel HDF5 options

By default the code now compiles using the sequential version of the HDF5 library. To use the parallel version make sure that the Parallel HDF5 version is available in the system and use the following command when configuring the code in the installation directory:

USE_PHDF5=1 cmake <src/dir>

where <src/dir> is the path to the source directory of the code.

NOTE: The same method is used to activate the BATSRUS portions of the code. So if you're planning to use the Parallel HDF5 and BATSRUS you must type:

USE_PHDF5=1 BATSRUS=1 cmake <src/dir>
Bug corrections:

1. Memory leak in EMfields3D.cpp has been patched.
2. Wrong 'if' tests on the constant charge boundary conditions were corrected.
3. B_ext was not applied correctly to the particle mover.
Adding a C post-processing tool. This is an 'old' tool that can be useful if you dont have python in your system.
Modifying the order of the indices when writing the fields in the parallel hdf5 file in order to read it directly in Paraview/Visit with the Xdmf format, wihtout using any postprocessing script.