A Quick Introduction to Galeri
Marzio Sala
Use left and right arrows to move through the presentation, and when you are
finished click "Page
Back" to go back to the previous page. The Galeri web page
is here.
Who Should Use Galeri
Galeri gives tools to quickly define Epetra objects, so that you can use
them for testing and examples. You can define:
- Epetra_Map's
- Epetra_CrsMatrix's
- Epetra_VbrMatrix's
Let's see a few examples now.
Epetra_Map's
Let us suppose that your have a 2D Cartesian grid, composed by
nx x
ny vertices, and you want to divide them among the available
mx x my processors. Each processor will have a rectangle (or square).
You simply type:
#include "Galeri_Maps.h"
...
Epetra_Map* Map = 0; // the map to be created
Teuchos::ParameterList List;
List.set("nx", 10); // 10 nodes along the X-axis
List.set("ny", 10); // 10 nodes along the Y-axis
List.set("mx", 2); // 2 subdomains along the X-axis
List.set("my", 2); // 2 subdomains along the Y-axis
string MapType = "Cartesian2D";
Map = Galeri.CreateMap(MapType, Comm, List);
Equivalently, one can create a 3D Cartesian grid by using
Cartesian3D.
Epetra_CrsMatrix's
Once you have an
Epetra_Map, you can easily create a variety of
matrices. For example, a 5-pt stencil discretization of a Laplacian is:
#include "Galeri_CrsMatrices.h"
...
Epetra_CrsMatrix* Matrix; // the matrix to be created
// the grid has nx * ny nodes (matrix size = nx * ny);
int nx = 5 * Comm.NumProc();
int ny = 5 * Comm.NumProc();
GaleriList.set("nx", nx);
GaleriList.set("ny", ny);
Matrix = CreateCrsMatrix("Laplace2D", Map, GaleriList);
where
GaleriList and
Map are those created in the previous
slide.
Epetra_VbrMatrix's
Starting from an
Epetra_CrsMatrix, you can create an equivalent
Epetra_VbrMatrix matrix by replicating each row of the CRS matrix the
specified number of times:
int NumEquations = 2;
Epetra_VbrMatrix* VbrMatrix;
VbrMatrix = CreateVbrMatrix(CrsMatrix, NumEquations);
End of the Show!
This concludes our quick overview of Galeri. There is extensive documentation
on the Galeri web site; you can also contact the
developers if more help is needed.