Galeri  Development
 All Classes Files Functions Variables Pages
List of all members
Galeri::grid::Loadable Class Reference

A flexible grid data structure container for distributed problems. More...

#include <Galeri_grid_Loadable.h>

Inheritance diagram for Galeri::grid::Loadable:
Inheritance graph
[legend]
Collaboration diagram for Galeri::grid::Loadable:
Collaboration graph
[legend]

Public Member Functions

 Loadable ()
 Empty constructor.
 
 Loadable (const Epetra_Comm &comm, const int numGlobalElements, const int numMyElements, const std::string &elementType, const int *myGlobalElements=0, const int numElementData=0, const int numVertexData=0)
 Constructor with specified Epetra_Comm, number of global elements, etc. More...
 
 ~Loadable ()
 Destructor.
 
void initialize (const Epetra_Comm &comm, const int numGlobalElements, const int numMyElements, const Galeri::grid::Element &element, const int *myGlobalElements=0, const int numElementData=0, const int numVertexData=0)
 Initialization method. More...
 
const Epetra_Comm & getComm () const
 Returns the communicator of this object.
 
int getNumGlobalElements () const
 Returns the global number of grid elements in this object.
 
int getNumMyElements () const
 Returns the local number of grid elements in this object.
 
int getNumGlobalVertices () const
 Returns the global number of grid vertices in this object.
 
int getNumMyVertices () const
 Returns the local number of grid vertices in this object.
 
int getNumVerticesPerElement () const
 Returns the number of vertices per element, which is constant value across all grid elements.
 
const Epetra_Map getElementMap () const
 Returns the Epetra_Map associated to the element distribution.
 
const Epetra_Map getVertexMap () const
 Returns the Epetra_Map associated to the vertex distribution.
 
int getGEID (const int LEID) const
 Returns the global grid element ID for the specified local (and locally owned) grid element ID.
 
int getGVID (const int LVID) const
 Returns the global grid vertex ID for the specified (and locally owned) local grid vertex ID.
 
int getLEID (const int GEID) const
 Returns the local grid element ID for the specified (and locally owned) global grid element ID.
 
int getLVID (const int GVID) const
 Returns the local grid vertex ID for the specified (and locally owned) global grid vertex ID.
 
const grid::Element getElement () const
 Returns the Galeri::grid::Element object of this object.
 
int getNumVertexData () const
 Returns the number of optional double-typed data associated to each grid vertex.
 
int getNumElementData () const
 Returns the number of optional double-typed data associated to each grid element.
 
double getElementData (const int GEID, const int which) const
 Returns the optional data associated to the specified (and locally owned) global grid element ID, stored in position which in the data array.
 
void setElementData (const int GEID, const int which, const double val)
 Sets the optional data associated to the specified (and locally owned) global grid element ID, are stores it in position which in the data array.
 
double getVertexData (const int GVID, const int which) const
 Returns the optional data associated to the specified (and locally owned) global grid vertex ID, stored in position which in the data array.
 
void setVertexData (const int GVID, const int which, const double val)
 Sets the optional data associated to the specified (and locally owned) global grid vertex ID, are stores it in position which in the data array.
 
void setGlobalCoordinates (const int GID, const int index, const double value)
 Sets the index coordinate of the specified (and locally owned) global grid vertex ID to value.
 
double & getGlobalCoordinates (const int GID, const int index)
 Sets the coordinates of the specified (and locally owned) global grid vertex ID to value.
 
double & getMyCoordinates (const int LID, const int index)
 Sets the index coordinate of the specified (and locally owned) local grid vertex ID to value.
 
const double & getMyCoordinates (const int LID, const int index) const
 Sets the index coordinate of the specified (and locally owned) local grid vertex ID to value. (const version)
 
void setGlobalConnectivity (const int GID, const int index, const int what)
 Sets the index coordinate of the specified (and locally owned) local grid vertex ID to value.
 
int & getGlobalConnectivity (const int GID, const int index)
 Sets the index-th component of the specified (and locally owned) global grid element ID to value.
 
int & getMyConnectivity (const int LID, const int index)
 Sets the index-th component of the specified (and locally owned) local grid element ID to value.
 
const int & getMyConnectivity (const int LID, const int index) const
 Sets the index-th component of the specified (and locally owned) local grid element ID to value. (const version)
 
virtual void freezeConnectivity ()
 Freezes the grid connectivity, which cannot be modified any longer. More...
 
void freezeCoordinates ()
 Freezes the grid coordinates, which cannot be modified any longer.
 
virtual void print (ostream &os) const
 Prints the grid on os.
 
const Epetra_Map & getNonOverlappingVertexMap ()
 Returns the Epetra_Map associated with grid vertices; each vertex is owned by exactly one processor.
 
const Epetra_MultiVector & getNonOverlappingCoordinates ()
 Returns the Epetra_MultiVector containing the coordinates of vertices; each vertex is owned by exactly one processor.
 
const Epetra_Map & getLinearVertexMap ()
 Returns a linear Epetra_Map for grid vertices.
 
const Epetra_MultiVector & getLinearCoordinates ()
 Returns the coordinates as a vector based on linearVertexMap.
 
- Public Member Functions inherited from Galeri::core::Object
 Object (const std::string &Label="Galeri::core::Object", const int ID=0)
 
 Object (const Object &rhs)
 Copy constructor.
 
Objectoperator= (const Object &rhs)
 Copies the object from rhs.
 
virtual ~Object ()
 Virtual dtor.
 
virtual void setLabel (const std::string &label)
 Sets the label associated with this object. More...
 
virtual std::string getLabel () const
 Gets the label associated with this object.
 
virtual void setID (const int &ID)
 Sets the ID associated with this object.
 
virtual int getID () const
 Gets the ID associated with this object.
 

Detailed Description

A flexible grid data structure container for distributed problems.

Galeri::grid::Loadable is a loadable container for grid data structures. It allows the allocation, setting and getting of all grid objects.

A Galeri::grid::Loadable object is defined by the following entities:

Optionally, it is possible to assigned to each grid element and grid vertex an arbitrary number of (double type) data.

Warning
Only one element type is allowed. If you need more than one element type in your problem, you can simply create more than one grid object.
There is no concept of boundaries in galeri/pfem. Boundaries are indeed defined by independent grid objects.

Constructor & Destructor Documentation

Galeri::grid::Loadable::Loadable ( const Epetra_Comm &  comm,
const int  numGlobalElements,
const int  numMyElements,
const std::string &  elementType,
const int *  myGlobalElements = 0,
const int  numElementData = 0,
const int  numVertexData = 0 
)

Constructor with specified Epetra_Comm, number of global elements, etc.

Parameters
comm[In] communicator object
numGlobalElements[In] number of global elements in this grid object.
numMyElements[In] number of local elements in this grid object.
elementType[In] a string value which defines the element type. Valid values are: Point, Segment, Triangle, Quad, Tet and Hex.
myGlobalElements[In] array of integers, of size numMyElements, which contains the global ID of all local elements. By using this array, one can introduce global numbering to grid elements.
numElementData[In] number of additional double-typed data to be stored on each element.
numVertexData[In] number of additional double-typed data to be stored on each vertex.

References initialize().

Member Function Documentation

void Galeri::grid::Loadable::freezeConnectivity ( )
virtual

Freezes the grid connectivity, which cannot be modified any longer.

This method constructs the set of locally owned vertices, by looking over all local elements, and building the vertexMap of the grid. After having called this method, it is no longer possible to modify the grid connectivity, because this would change the vertexMap as well.

Warning
Performances to be improved for large problems.

References Galeri::core::Workspace::CONNECTIVITY_FREEZED, Galeri::core::Workspace::getNumDimensions(), and Galeri::core::Workspace::INITIALIZED.

void Galeri::grid::Loadable::initialize ( const Epetra_Comm &  comm,
const int  numGlobalElements,
const int  numMyElements,
const Galeri::grid::Element element,
const int *  myGlobalElements = 0,
const int  numElementData = 0,
const int  numVertexData = 0 
)

Initialization method.

Parameters
comm[In] communicator object
numGlobalElements[In] number of global elements in this grid object.
numMyElements[In] number of local elements in this grid object.
element[In] element to be used.
myGlobalElements[In] array of integers, of size numMyElements, which contains the global ID of all local elements. By using this array, one can introduce global numbering to grid elements.
numElementData[In] number of additional double-typed data to be stored on each element.
numVertexData[In] number of additional double-typed data to be stored on each vertex.
Warning
both vertexMap and elementMap are built with a base index of 0. The code may not work otherwise.

References Galeri::core::Workspace::INITIALIZED, and Galeri::core::Workspace::UNINITIALIZED.

Referenced by Loadable().


The documentation for this class was generated from the following files: