00001 /* *********************************************************************** 00002 // 00003 // TSFExtended: Trilinos Solver Framework Extended 00004 // Copyright (2004) Sandia Corporation 00005 // 00006 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00007 // license for use of this work by or on behalf of the U.S. Government. 00008 // 00009 // This library is free software; you can redistribute it and/or modify 00010 // it under the terms of the GNU Lesser General Public License as 00011 // published by the Free Software Foundation; either version 2.1 of the 00012 // License, or (at your option) any later version. 00013 // 00014 // This library is distributed in the hope that it will be useful, but 00015 // WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 // Lesser General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU Lesser General Public 00020 // License along with this library; if not, write to the Free Software 00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00022 // USA 00023 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00024 // 00025 // **********************************************************************/ 00026 00027 #ifndef TSFGHOSTIMPORTER_HPP 00028 #define TSFGHOSTIMPORTER_HPP 00029 00030 #include "TSFVectorDecl.hpp" 00031 #include "TSFVectorSpaceDecl.hpp" 00032 #include "TSFGhostView.hpp" 00033 00034 namespace TSFExtended 00035 { 00036 using namespace Teuchos; 00037 00038 /** 00039 * In many applications it is necessary to view some subset of 00040 * off-processor, or "ghost", elements of a vector. In 00041 * matrix-vector multiplications, 00042 * access to off-processor elements is assumed to be handled internally 00043 * by the apply() method of LinearOp subtypes, so the TSF Vector type 00044 * does not need explicit accessors for ghost elements. However, in 00045 * application interfaces such as finite element assembly engines, 00046 * read-only access to ghost elements is sometimes required. The abstract 00047 * classes GhostImporter and GhostView define flexible interfaces 00048 * through which a set of required ghosts can be defined, ghost values 00049 * can be imported, and element values can be accessed through 00050 * global indices. 00051 * 00052 * Class GhostImporter is used to specify the set of ghost elements 00053 * that must be imported to this processor, and then to carry out the import. 00054 * It will often be the case that we do many imports with the same 00055 * set of ghost indices; for example, in a nonlinear problem the 00056 * import of the same set of ghost indices 00057 * will be repeated at each function evaluation. Therefore, it makes sense 00058 * to do the definition of the ghost index set and the import as 00059 * distinct methods. The definition of the ghost index set should be done 00060 * in the constructors of GhostImporter subclasses. 00061 */ 00062 template <class Scalar> 00063 class GhostImporter 00064 { 00065 public: 00066 /** virtual dtor */ 00067 virtual ~GhostImporter(){;} 00068 00069 /** 00070 * Import the ghost elements of the given vector 00071 * as specified during construction of this object. 00072 */ 00073 virtual void importView(const Vector<Scalar>& x, 00074 RCP<GhostView<Scalar> >& ghostView) const = 0 ; 00075 00076 }; 00077 00078 } 00079 00080 #endif