FEI Version of the Day
fei_LinearSystemCore.hpp
00001 /*
00002 // @HEADER
00003 // ************************************************************************
00004 //             FEI: Finite Element Interface to Linear Solvers
00005 //                  Copyright (2005) Sandia Corporation.
00006 //
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the
00008 // U.S. Government retains certain rights in this software.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Alan Williams (william@sandia.gov) 
00038 //
00039 // ************************************************************************
00040 // @HEADER
00041 */
00042 
00043 #ifndef _fei_LinearSystemCore_hpp_
00044 #define _fei_LinearSystemCore_hpp_
00045 
00046 class Data;
00047 class Lookup;
00048 
00049 #include <fei_defs.h>
00050 #include <cstdlib>
00051 
00166 class LinearSystemCore {
00167  public:
00171    LinearSystemCore(){};
00172 
00179    virtual ~LinearSystemCore() {};
00180 
00181 
00184    virtual LinearSystemCore* clone() = 0;
00185 
00186 
00193    virtual int parameters(int numParams, const char*const * params) = 0;
00194 
00195 
00202    virtual int setLookup(Lookup& lookup) = 0;
00203 
00204 
00213    virtual int getProperty(const char* /*name*/, double& /*value*/)
00214      {
00215        return(-1);
00216      }
00217 
00235    virtual int setGlobalOffsets(int len, int* nodeOffsets,
00236                                  int* eqnOffsets, int* blkEqnOffsets) = 0;
00237 
00238 
00249    virtual int setConnectivities(GlobalID elemBlock,
00250                                   int numElements,
00251                                   int numNodesPerElem,
00252                                   const GlobalID* elemIDs,
00253                                   const int* const* connNodes) = 0;
00254 
00255 
00269    virtual int setStiffnessMatrices(GlobalID elemBlock,
00270                                      int numElems,
00271                                      const GlobalID* elemIDs,
00272                                      const double *const *const *stiff,
00273                                      int numEqnsPerElem,
00274                                      const int *const * eqnIndices) = 0;
00275 
00276 
00289    virtual int setLoadVectors(GlobalID elemBlock,
00290                                int numElems,
00291                                const GlobalID* elemIDs,
00292                                const double *const * load,
00293                                int numEqnsPerElem,
00294                                const int *const * eqnIndices) = 0;
00295 
00296 
00314    virtual int setMatrixStructure(int** ptColIndices,
00315                                    int* ptRrowLengths,
00316                                    int** blkColIndices,
00317                                    int* blkRowLengths,
00318                                    int* ptRowsPerBlkRow) = 0;
00319 
00320 
00341    virtual int setMultCREqns(int multCRSetID,
00342                               int numCRs, int numNodesPerCR,
00343                               int** nodeNumbers, int** eqnNumbers,
00344                               int* fieldIDs,
00345                               int* multiplierEqnNumbers) = 0;
00346 
00352    virtual int setPenCREqns(int penCRSetID,
00353                               int numCRs, int numNodesPerCR,
00354                               int** nodeNumbers, int** eqnNumbers,
00355                               int* fieldIDs) = 0;
00356 
00357 
00362    virtual int sumIntoSystemMatrix(int numPtRows, const int* ptRows,
00363                                     int numPtCols, const int* ptCols,
00364                                     int numBlkRows, const int* blkRows,
00365                                     int numBlkCols, const int* blkCols,
00366                                     const double* const* values) = 0;
00367 
00374    virtual int sumIntoSystemMatrix(int numPtRows, const int* ptRows,
00375                                     int numPtCols, const int* ptCols,
00376                                     const double* const* values) = 0;
00377 
00382    virtual int putIntoSystemMatrix(int numPtRows, const int* ptRows,
00383                                     int numPtCols, const int* ptCols,
00384                                     const double* const* values) = 0;
00385 
00391    virtual int getMatrixRowLength(int row, int& length) = 0;
00392 
00404    virtual int getMatrixRow(int row, double* coefs, int* indices,
00405                             int len, int& rowLength) = 0;
00406 
00409    virtual int sumIntoRHSVector(int num, const double* values,
00410                                  const int* indices) = 0;
00412    virtual int putIntoRHSVector(int num, const double* values,
00413                                  const int* indices) = 0;
00415    virtual int getFromRHSVector(int num, double* values,
00416                                  const int* indices) = 0;
00417 
00421    virtual int matrixLoadComplete() = 0;
00422 
00434    virtual int putNodalFieldData(int fieldID, int fieldSize,
00435                                   int* nodeNumbers, int numNodes,
00436                                   const double* data) = 0;
00437 
00438 
00442    virtual int resetMatrixAndVector(double s) = 0;
00443 
00446    virtual int resetMatrix(double s) = 0;
00447 
00450    virtual int resetRHSVector(double s) = 0;
00451 
00468    virtual int enforceEssentialBC(int* globalEqn, double* alpha,
00469                                    double* gamma, int len) = 0;
00470 
00490    virtual int enforceRemoteEssBCs(int numEqns, int* globalEqns,
00491                                           int** colIndices, int* colIndLen,
00492                                           double** coefs) = 0;
00493 
00498    virtual int getMatrixPtr(Data& data) = 0;
00499 
00505    virtual int copyInMatrix(double scalar, const Data& data) = 0;
00506 
00515    virtual int copyOutMatrix(double scalar, Data& data) = 0;
00516 
00522    virtual int sumInMatrix(double scalar, const Data& data) = 0;
00523 
00525    virtual int getRHSVectorPtr(Data& data) = 0;
00526 
00528    virtual int copyInRHSVector(double scalar, const Data& data) = 0;
00529 
00531    virtual int copyOutRHSVector(double scalar, Data& data) = 0;
00532 
00534    virtual int sumInRHSVector(double scalar, const Data& data) = 0;
00535 
00542    virtual int destroyMatrixData(Data& data) = 0;
00543 
00550    virtual int destroyVectorData(Data& data) = 0;
00551 
00564    virtual int setNumRHSVectors(int numRHSs, const int* rhsIDs) = 0;
00565 
00572    virtual int setRHSID(int rhsID) = 0;
00573 
00582    virtual int putInitialGuess(const int* eqnNumbers, const double* values,
00583                                 int len) = 0;
00584 
00593    virtual int getSolution(double* answers, int len) = 0;
00594 
00600    virtual int getSolnEntry(int eqnNumber, double& answer) = 0;
00601 
00608    virtual int formResidual(double* values, int len) = 0;
00609 
00619    virtual int launchSolver(int& solveStatus, int& iterations) = 0;
00620 
00628    virtual int writeSystem(const char* name) = 0;
00629 
00630    virtual double* getMatrixBeginPointer()
00631    { return NULL; }
00632 
00633    virtual int getMatrixOffset(int /*row*/, int /*col*/)
00634    { return -1; }
00635 
00636 };
00637 
00638 #endif
00639 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends