/usr/include/trilinos/Galeri_AbstractGrid.h is in libtrilinos-galeri-dev 12.10.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | // @HEADER
// ************************************************************************
//
// Galeri: Finite Element and Matrix Generation Package
// Copyright (2006) ETHZ/Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions about Galeri? Contact Marzio Sala (marzio.sala _AT_ gmail.com)
//
// ************************************************************************
// @HEADER
#ifndef GALERI_ABSTRACTGRID_H
#define GALERI_ABSTRACTGRID_H
/*
* \file Galeri_AbstractGrid.h
*/
class Epetra_Map;
class Epetra_DistObject;
class Epetra_Comm;
namespace Galeri {
namespace FiniteElements {
/*!
* \class AbstractGrid
*
* \brief Abstract interface to access finite element grids.
*
AbstractGrid is a pure virtual function, that specifies the interface
methods that a grid class must implement. Following an approach similar to
getrow() for matrices, there is no grid format; instead, the user
must implement a set of getelement() and similar methods. Therefore, it is
possible to define grids that are built on-the-fly, a feature that is
particularly convenient in testing phase.
This format is based on the following assumptions:
- All grid elements are of the same type (for examples, all triangles).
It is not possible to have mixed grids (i.e., with some triangles and
some quadrilateral).
- All grid elements are 3D. For 2D problems, the user must specify a
z-coordinate, for example 0.0.
- Elements, vertices and faces are numbered locally. The local-to-global
mapping is required for vertices only, and must be defined using
Epetra_Map's.
Two Epetra_Map's must be created:
- The VertexMap() locally contains all the vertices that belong to the
local finite elements. A global vertex can be replicated over more
than one process.
- The RowMap() globally contains all the global vertices. A global vertex
is assigned to exactly one process.
We require two maps for the following reason:
In parallel runs, vertices corresponding to internal boundary
faces can are replicated over processors. This makes the contruction
of the finite element matrix easier, since it is possible to
work on local quantities only. However, such a distribution
is not compatible with AztecOO and ML (and several other Trilinos
packages), since these libraries require each row to belong to
exactly one processor. Methods ExportToVertexMap() and ExportToRowMap()
export objects from one map to the other. Typically, ExportToRowMap() is
used in the assembly phase, whese local stiffness matrix and right-hand
side are built using VertexMap(), then exported to RowMap().
ExportToVertexMap(), instead, is used after the solution of the
linear system is computed, to update the values of the solution on
the local vertices, so that norms can be computed, and the solution
visualized. These methods are trivial in the serial case.
*
* \author Marzio Sala, SNL 9214
*
* \date Last updated on 12-Apr-05.
*/
class AbstractGrid {
public:
// @{ Constructors and destructors
//
//! Destructor.
virtual ~AbstractGrid() {}
// @}
// @{ Query methods
//! Returns the number of dimensions of the grid.
virtual int NumDimensions() const = 0;
//! Returns the number of vertices contained in each element.
virtual int NumVerticesPerElement() const = 0;
//! Returns the number of faces contained in each element.
virtual int NumFacesPerElement() const = 0;
//! Returns the number of vertices contained in each face.
virtual int NumVerticesPerFace() const = 0;
//! Returns a string containing the element type.
/*!
* Returns a string containing the type of element. This
* string is used in the quadrature class.
* Currently supported options are:
* - "GALERI_TRIANGLE"
* - "GALERI_QUAD"
* - "GALERI_HEX"
* - "GALERI_TET"
*/
virtual std::string ElementType() const = 0;
//! Returns the number of neighboring elements.
virtual int NumNeighborsPerElement() const = 0;
//! Returns the number of finite elements on the calling process.
virtual int NumMyElements() const = 0;
//! Returns the global number of finite elements.
virtual int NumGlobalElements() const = 0;
//! Returns the number of vertices on the calling process.
virtual int NumMyVertices() const = 0;
//! Returns the global number of vertices.
virtual int NumGlobalVertices() const = 0;
//! Returns the number of boundary faces on the calling process.
virtual int NumMyBoundaryFaces() const = 0;
//! Returns the global number of boundary faces.
virtual int NumGlobalBoundaryFaces() const = 0;
//! Returns the volume of all local elements.
virtual double MyVolume() const = 0;
//! Returns the global volume of the grid.
virtual double GlobalVolume() const = 0;
//! Returns the coordinates of local vertex \c LocalVertex in vector \c coord.
/*!
* \param LocalVertex - (In) Local ID of the vertex for whic
* coordinates are required. Must be
* contained in the interval [0, NumMyVertices())
*
* \param coord - (Out) double array of size 3. In output, contains
* the x-, y- and z-coordinate of the specified vertex.
*
* \note Parameter \c coord must be allocated of size 3 for both
* 2D and 3D problems.
*/
virtual void VertexCoord(const int LocalVertex, double* coord) const = 0;
//! Returns the coordinates of specified local vertices.
/*!
* \param Length - (In) Length of array \c IDs.
*
* \param IDs - (In) Contains the list of vertices of which coordinates
* are required.
*
* \param x - (Out) double array of size \c Length. In output, contains
* the x-coordinates of the specified vertices.
*
* \param y - (Out) double array of size \c Length. In output, contains
* the y-coordinates of the specified vertices.
*
* \param z - (Out) double array of size \c Length. In output, contains
* the z-coordinates of the specified vertices.
*
* \note The \c z array must be allocated for both 2D and 3D problems.
*/
virtual void VertexCoord(const int Length, const int* IDs, double* x,
double* y, double* z) const = 0;
//! Returns the local vertex IDs of the specified local finite element.
/*!
* \param LocalElement - (In) ID of the required local element.
*
* \param elements - (Out) array of length NumElementVertices(), in
* output will contain the local ID of the
* vertices of the specified element.
*/
virtual void ElementVertices(const int LocalElement, int* elements) const = 0;
//! Returns the local IDs of neighboring elements.
virtual void ElementNeighbors(const int LocalElement, int* elements) const = 0;
//! Returns the local vertex IDs of vertices contained in the specified boundary face.
virtual void FaceVertices(const int LocalFace, int& tag, int* IDs) const = 0;
//! Returns the patch ID of the specified face.
/*! Returns an integer ID that identifies the given boundary face
* as belonging to a given part of the domain. It can be used by the
* user to specify the value and the type of the boundary condition.
*/
virtual int FacePatch(const int LocalFace) const = 0;
//! Returns the volume of the specified local finite element.
virtual double ElementMinLength(const int LocalElement) const = 0;
//! Returns the volume of the specified local finite element.
virtual double ElementMaxLength(const int LocalElement) const = 0;
//! Returns the volume of the specified local finite element.
/*! Returns the area (in 2D) or the volume (in 3D) of the specified
* local element
*/
virtual double ElementVolume(const int LocalElement) const = 0;
//! Returns the area of the specified local face.
/*! Returns the length (in 2D) or the area (in 3D) of the
* specified boundary face
*/
virtual double FaceArea(const int LocalFace) const = 0;
// @}
// @{ Maps and import/export
//! Returns a reference to the map representing the vertex distribution.
virtual const Epetra_Map& VertexMap() const = 0;
//! Returns a reference to the map representing the distribution of rows.
virtual const Epetra_Map& RowMap() const = 0;
//! Exports distributed object from RowMap() to VertexMap().
virtual void ExportToVertexMap(const Epetra_DistObject& RowObject,
Epetra_DistObject& VertexObject) const = 0;
//! Exports distributed object from VertexMap() to RowMap().
virtual void ExportToRowMap(const Epetra_DistObject& RowObject,
Epetra_DistObject& VertexObject) const = 0;
//! Returns a reference to the communicator object.
virtual const Epetra_Comm& Comm() const = 0;
// @}
};
} // namespace FiniteElements
} // namespace Galeri
#endif
|