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 
00165 class LinearSystemCore {
00166  public:
00170    LinearSystemCore(){};
00171 
00178    virtual ~LinearSystemCore() {};
00179 
00180 
00183    virtual LinearSystemCore* clone() = 0;
00184 
00185 
00192    virtual int parameters(int numParams, const char*const * params) = 0;
00193 
00194 
00201    virtual int setLookup(Lookup& lookup) = 0;
00202 
00203 
00212    virtual int getProperty(const char* /*name*/, double& /*value*/)
00213      {
00214        return(-1);
00215      }
00216 
00234    virtual int setGlobalOffsets(int len, int* nodeOffsets,
00235                                  int* eqnOffsets, int* blkEqnOffsets) = 0;
00236 
00237 
00248    virtual int setConnectivities(GlobalID elemBlock,
00249                                   int numElements,
00250                                   int numNodesPerElem,
00251                                   const GlobalID* elemIDs,
00252                                   const int* const* connNodes) = 0;
00253 
00254 
00268    virtual int setStiffnessMatrices(GlobalID elemBlock,
00269                                      int numElems,
00270                                      const GlobalID* elemIDs,
00271                                      const double *const *const *stiff,
00272                                      int numEqnsPerElem,
00273                                      const int *const * eqnIndices) = 0;
00274 
00275 
00288    virtual int setLoadVectors(GlobalID elemBlock,
00289                                int numElems,
00290                                const GlobalID* elemIDs,
00291                                const double *const * load,
00292                                int numEqnsPerElem,
00293                                const int *const * eqnIndices) = 0;
00294 
00295 
00313    virtual int setMatrixStructure(int** ptColIndices,
00314                                    int* ptRrowLengths,
00315                                    int** blkColIndices,
00316                                    int* blkRowLengths,
00317                                    int* ptRowsPerBlkRow) = 0;
00318 
00319 
00340    virtual int setMultCREqns(int multCRSetID,
00341                               int numCRs, int numNodesPerCR,
00342                               int** nodeNumbers, int** eqnNumbers,
00343                               int* fieldIDs,
00344                               int* multiplierEqnNumbers) = 0;
00345 
00351    virtual int setPenCREqns(int penCRSetID,
00352                               int numCRs, int numNodesPerCR,
00353                               int** nodeNumbers, int** eqnNumbers,
00354                               int* fieldIDs) = 0;
00355 
00356 
00361    virtual int sumIntoSystemMatrix(int numPtRows, const int* ptRows,
00362                                     int numPtCols, const int* ptCols,
00363                                     int numBlkRows, const int* blkRows,
00364                                     int numBlkCols, const int* blkCols,
00365                                     const double* const* values) = 0;
00366 
00373    virtual int sumIntoSystemMatrix(int numPtRows, const int* ptRows,
00374                                     int numPtCols, const int* ptCols,
00375                                     const double* const* values) = 0;
00376 
00381    virtual int putIntoSystemMatrix(int numPtRows, const int* ptRows,
00382                                     int numPtCols, const int* ptCols,
00383                                     const double* const* values) = 0;
00384 
00390    virtual int getMatrixRowLength(int row, int& length) = 0;
00391 
00403    virtual int getMatrixRow(int row, double* coefs, int* indices,
00404                             int len, int& rowLength) = 0;
00405 
00408    virtual int sumIntoRHSVector(int num, const double* values,
00409                                  const int* indices) = 0;
00411    virtual int putIntoRHSVector(int num, const double* values,
00412                                  const int* indices) = 0;
00414    virtual int getFromRHSVector(int num, double* values,
00415                                  const int* indices) = 0;
00416 
00420    virtual int matrixLoadComplete() = 0;
00421 
00433    virtual int putNodalFieldData(int fieldID, int fieldSize,
00434                                   int* nodeNumbers, int numNodes,
00435                                   const double* data) = 0;
00436 
00437 
00441    virtual int resetMatrixAndVector(double s) = 0;
00442 
00445    virtual int resetMatrix(double s) = 0;
00446 
00449    virtual int resetRHSVector(double s) = 0;
00450 
00467    virtual int enforceEssentialBC(int* globalEqn, double* alpha,
00468                                    double* gamma, int len) = 0;
00469 
00489    virtual int enforceRemoteEssBCs(int numEqns, int* globalEqns,
00490                                           int** colIndices, int* colIndLen,
00491                                           double** coefs) = 0;
00492 
00497    virtual int getMatrixPtr(Data& data) = 0;
00498 
00504    virtual int copyInMatrix(double scalar, const Data& data) = 0;
00505 
00514    virtual int copyOutMatrix(double scalar, Data& data) = 0;
00515 
00521    virtual int sumInMatrix(double scalar, const Data& data) = 0;
00522 
00524    virtual int getRHSVectorPtr(Data& data) = 0;
00525 
00527    virtual int copyInRHSVector(double scalar, const Data& data) = 0;
00528 
00530    virtual int copyOutRHSVector(double scalar, Data& data) = 0;
00531 
00533    virtual int sumInRHSVector(double scalar, const Data& data) = 0;
00534 
00541    virtual int destroyMatrixData(Data& data) = 0;
00542 
00549    virtual int destroyVectorData(Data& data) = 0;
00550 
00563    virtual int setNumRHSVectors(int numRHSs, const int* rhsIDs) = 0;
00564 
00571    virtual int setRHSID(int rhsID) = 0;
00572 
00581    virtual int putInitialGuess(const int* eqnNumbers, const double* values,
00582                                 int len) = 0;
00583 
00592    virtual int getSolution(double* answers, int len) = 0;
00593 
00599    virtual int getSolnEntry(int eqnNumber, double& answer) = 0;
00600 
00607    virtual int formResidual(double* values, int len) = 0;
00608 
00618    virtual int launchSolver(int& solveStatus, int& iterations) = 0;
00619 
00627    virtual int writeSystem(const char* name) = 0;
00628 };
00629 
00630 #endif
00631 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends