FEI.hpp

00001 #ifndef _FEI_hpp_
00002 #define _FEI_hpp_
00003 /*--------------------------------------------------------------------*/
00004 /*    Copyright 2005 Sandia Corporation.                              */
00005 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00006 /*    non-exclusive license for use of this work by or on behalf      */
00007 /*    of the U.S. Government.  Export of this program may require     */
00008 /*    a license from the United States Government.                    */
00009 /*--------------------------------------------------------------------*/
00010 
00011 //
00012 //=========================================================================
00013 // public C++ interface definition for FEI, version 2.1, Jan. 25, 2001
00014 //
00015 // This interface header is the C++ expression of the Finite Element
00016 // Interface to Linear Solvers.
00017 //
00018 //=========================================================================
00019 //
00020 // Below is a list of the functions in FEI 2.x, grouped roughly by
00021 // usage categories, with the initialization and load groups (1 and 2)
00022 // also reflecting common calling order.
00023 //
00024 //===================================================================
00025 //
00026 //  (0) Construction
00027 //  ----------------
00028 //
00029 //  <Implementation-dependent>
00030 //
00031 //
00032 //  (1) initialization
00033 //  ------------------
00034 //
00035 //      parameters
00036 //      setIDLists
00037 //      initSolveStep
00038 //
00039 //      initFields
00040 //      initElemBlock
00041 //
00042 //      initElem
00043 //
00044 //      initSharedNodes
00045 //
00046 //      initCRMult
00047 //      initCRPen
00048 //      initSlaveVariable
00049 //
00050 //      initComplete
00051 //
00052 //
00053 //  (2) load data
00054 //  -------------
00055 //
00056 //      setLHSID
00057 //      setRHSID
00058 //
00059 //      loadNodeBCs
00060 //      loadElemBCs
00061 //
00062 //      sumInElem
00063 //      sumInElemMatrix
00064 //      sumInElemRHS
00065 //
00066 //      loadCRMult
00067 //      loadCRPen
00068 //
00069 //      setMatScalars
00070 //      setRHSScalars
00071 //
00072 //      loadComplete
00073 //
00074 //  (3) equation solution
00075 //  ---------------------
00076 //
00077 //      residualNorm
00078 //      solve
00079 //
00080 //
00081 //  (4) return of solution data
00082 //  ---------------------------
00083 //
00084 //      getBlockNodeSolution
00085 //      getBlockFieldNodeSolution
00086 //      getBlockElemSolution
00087 //      getCRMultipliers
00088 //
00089 //  (5) initial guess 'put'ing
00090 //  --------------------------
00091 //
00092 //      putBlockNodeSolution
00093 //      putBlockFieldNodeSolution
00094 //      putBlockElemSolution
00095 //      putCRMultParam
00096 //      putNodalFieldData
00097 //
00098 //  (6) resetting functions
00099 //  -------------------------
00100 //
00101 //      resetSystem
00102 //      resetMatrix
00103 //      resetRHSVector
00104 //      resetInitialGuess
00105 //      deleteMultCRs
00106 //
00107 //  (7) query functions
00108 //  -------------------
00109 //
00110 //      version
00111 //      cumulative_cpu_times
00112 //
00113 //      iterations
00114 //      getNumSolnParams
00115 //      getNumElemBlocks
00116 //      getNumBlockActNodes
00117 //      getNumBlockActEqns
00118 //      getNumNodesPerElement
00119 //      getNumEqnsPerElement
00120 //      getNumBlockElements
00121 //      getNumBlockElemDOF
00122 //      getNumCRMultipliers
00123 //      getCRMultIDList
00124 //      getBlockNodeIDList
00125 //      getBlockElemIDList
00126 //      getFieldSize
00127 //      getEqnNumbers
00128 //      getNodalFieldSolution
00129 //      getNumLocalNodes
00130 //      getLocalNodeIDList
00131 //
00132  
00133 #include <fei_macros.hpp>
00134 #include <fei_defs.h>
00135 
00144 class FEI { 
00145  
00146   public: 
00147 
00150    virtual ~FEI() {} 
00151 
00160    virtual int parameters(int numParams, 
00161                           const char *const* paramStrings) = 0;
00162 
00179    virtual int setIDLists( int numMatrices,
00180                            const int* matrixIDs,
00181                            int numRHSs,
00182                            const int* rhsIDs ) = 0;
00183 
00184 
00193    virtual int setSolveType( int solveType ) = 0;    
00194 
00209    virtual int initFields( int numFields,
00210                            const int *fieldSizes, 
00211                            const int *fieldIDs,
00212                            const int *fieldTypes = NULL ) = 0;
00213                                 
00235    virtual int initElemBlock( GlobalID elemBlockID,
00236                               int numElements,
00237                               int numNodesPerElement,
00238                               const int *numFieldsPerNode,
00239                               const int *const *nodalFieldIDs,
00240                               int numElemDofFieldsPerElement,
00241                               const int* elemDOFFieldIDs,
00242                               int interleaveStrategy ) = 0;
00243  
00252    virtual int initElem( GlobalID elemBlockID,
00253                          GlobalID elemID, 
00254                          const GlobalID *elemConn ) = 0; 
00255  
00271    virtual int initSharedNodes( int numSharedNodes,
00272                                 const GlobalID *sharedNodeIDs,  
00273                                 const int *numProcsPerNode,
00274                                 const int *const *sharingProcIDs ) = 0;
00275  
00284    virtual int initCRMult( int numCRNodes,
00285                            const GlobalID* CRNodeIDs,
00286                            const int *CRFieldIDs,
00287                            int& CRID ) = 0;
00288  
00297    virtual int initCRPen( int numCRNodes,
00298                           const GlobalID* CRNodeIDs, 
00299                           const int *CRFieldIDs,
00300                           int& CRID ) = 0; 
00301 
00349    virtual int initSlaveVariable(GlobalID slaveNodeID,
00350                                  int slaveFieldID,
00351                                  int offsetIntoSlaveField,
00352                                  int numMasterNodes,
00353                                  const GlobalID* masterNodeIDs,
00354                                  const int* masterFieldIDs,
00355                                  const double* weights,
00356                                  double rhsValue) = 0;
00357 
00364    virtual int initComplete() = 0;
00365 
00366      
00367 // Load Phase.......................................... 
00368 
00375    virtual int setCurrentMatrix(int matrixID) = 0;
00376 
00383    virtual int setCurrentRHS(int rhsID) = 0;
00384 
00388    virtual int resetSystem(double s=0.0) = 0;
00389 
00394    virtual int resetMatrix(double s=0.0) = 0;
00395 
00399    virtual int resetRHSVector(double s=0.0) = 0;
00400 
00406    virtual int resetInitialGuess(double s) = 0;
00407 
00412    virtual int deleteMultCRs() = 0;
00413 
00432     virtual int loadNodeBCs(int numNodes,
00433                             const GlobalID *nodeIDs,
00434                             int fieldID,
00435                             const int* offsetsIntoField,
00436                             const double* prescribedValues) = 0;
00437 
00460    virtual int loadElemBCs( int numElems,
00461                             const GlobalID *elemIDs,
00462                             int fieldID,
00463                             const double *const *alpha,  
00464                             const double *const *beta,  
00465                             const double *const *gamma ) = 0;
00466 
00482    virtual int sumInElem(GlobalID elemBlockID,
00483                             GlobalID elemID,  
00484                             const GlobalID* elemConn,
00485                             const double* const* elemStiffness,
00486                             const double* elemLoad,
00487                             int elemFormat) = 0;
00488      
00503    virtual int sumInElemMatrix(GlobalID elemBlockID,
00504                                GlobalID elemID,  
00505                                const GlobalID* elemConn,
00506                                const double* const* elemStiffness,
00507                                int elemFormat) = 0;
00508      
00517    virtual int sumInElemRHS(GlobalID elemBlockID,
00518                             GlobalID elemID,  
00519                             const GlobalID* elemConn,
00520                             const double* elemLoad) = 0;
00521      
00531    virtual int loadCRMult(int CRMultID, int numCRNodes,
00532                           const GlobalID* CRNodeIDs,
00533                           const int* CRFieldIDs,
00534                           const double* CRWeights,
00535                           double CRValue) = 0;
00536  
00547    virtual int loadCRPen(int CRPenID, int numCRNodes,
00548                          const GlobalID* CRNodeIDs,
00549                          const int* CRFieldIDs,
00550                          const double* CRWeights,
00551                          double CRValue,
00552                          double penValue) = 0;
00553 
00555    virtual int putIntoRHS(int IDType,
00556                           int fieldID,
00557                           int numIDs,
00558                           const GlobalID* IDs,
00559                           const double* coefficients) = 0;
00560 
00562    virtual int sumIntoRHS(int IDType,
00563                           int fieldID,
00564                           int numIDs,
00565                           const GlobalID* IDs,
00566                           const double* coefficients) = 0;
00567 
00568    virtual int sumIntoMatrixDiagonal(int /*IDType*/,
00569                                      int /*fieldID*/,
00570                                      int /*numIDs*/,
00571                                      const GlobalID* /*IDs*/,
00572                                      const double* /*coefficients*/)
00573     { return -1; }
00574 
00582    virtual int setMatScalars( int numScalars,
00583                               const int* IDs,
00584                               const double* scalars ) = 0;
00585 
00593    virtual int setRHSScalars( int numScalars,
00594                               const int* IDs,
00595                               const double* scalars) = 0;
00596 
00601    virtual int loadComplete(bool applyBCs=true,
00602                             bool globalAssemble=true) = 0;
00603 
00604 // Equation solution services..................................... 
00605  
00618    virtual int residualNorm(int whichNorm, int numFields,
00619                              int* fieldIDs, double* norms) = 0;
00620 
00631    virtual int solve(int& status) = 0;
00632 
00633  
00634 // Solution return services....................................... 
00635 
00639    virtual int iterations(int& itersTaken) const = 0;
00640  
00645    virtual int getFieldSize(int fieldID, int& numScalars) = 0;
00646 
00659    virtual int getEqnNumbers(GlobalID ID,
00660                              int idType, 
00661                              int fieldID,
00662                              int& numEqns,
00663                              int* eqnNumbers) = 0;
00664 
00677    virtual int getNodalFieldSolution(int fieldID,
00678                                      int numNodes,
00679                                      const GlobalID* nodeIDs,
00680                                      double* results) = 0;
00681 
00687    virtual int getNumLocalNodes(int& numNodes) = 0;
00688 
00700    virtual int getLocalNodeIDList(int& numNodes,
00701                                   GlobalID* nodeIDs,
00702                                   int lenNodeIDs) = 0;
00703 
00707    virtual int putNodalFieldData(int fieldID,
00708                                  int numNodes,
00709                                  const GlobalID* nodeIDs,
00710                                  const double* data) = 0;
00711 
00729    virtual int getBlockNodeSolution( GlobalID elemBlockID,  
00730                                      int numNodes,
00731                                      const GlobalID *nodeIDs, 
00732                                      int *offsets,  
00733                                      double *results ) = 0;
00734 
00749    virtual int getNodalSolution(int numNodes,
00750                                 const GlobalID* nodeIDs,
00751                                 int* offsets,
00752                                 double* results) = 0;
00753  
00764    virtual int getBlockFieldNodeSolution(GlobalID elemBlockID,
00765                                           int fieldID,
00766                                           int numNodes, 
00767                                           const GlobalID *nodeIDs, 
00768                                           double *results) = 0;
00769          
00779    virtual int getBlockElemSolution( GlobalID elemBlockID,  
00780                                      int numElems,
00781                                      const GlobalID *elemIDs,
00782                                      int& numElemDOFPerElement, 
00783                                      double *results ) = 0;
00784 
00789    virtual int getNumCRMultipliers(int& numMultCRs) = 0;
00790 
00797    virtual int getCRMultIDList(int numMultCRs, int* multIDs) = 0;
00798 
00806    virtual int getCRMultipliers(int numCRs, 
00807                                  const int *CRIDs,  
00808                                  double *results) = 0;
00809 
00810  
00811 // Some 'put' methods paralleling the solution 'get' functions.
00812 // the int sizing parameters are passed for error-checking purposes, so
00813 // that the interface implementation can tell if the passed estimate
00814 // vectors make sense -before- an attempt is made to utilize them as
00815 // initial guesses by unpacking them into the solver's native solution
00816 // vector format.
00817 
00828    virtual int putBlockNodeSolution(GlobalID elemBlockID, 
00829                                      int numNodes, 
00830                                      const GlobalID *nodeIDs, 
00831                                      const int *offsets,
00832                                      const double *estimates) = 0;
00833 
00842    virtual int putBlockFieldNodeSolution(GlobalID elemBlockID, 
00843                                           int fieldID, 
00844                                           int numNodes, 
00845                                           const GlobalID *nodeIDs, 
00846                                           const double *estimates) = 0;
00847          
00857    virtual int putBlockElemSolution( GlobalID elemBlockID,  
00858                                      int numElems, 
00859                                      const GlobalID *elemIDs, 
00860                                      int dofPerElem,
00861                                      const double *estimates) = 0;
00862   
00868    virtual int putCRMultipliers( int numMultCRs,
00869                                  const int* CRMultIDs,
00870                                  const double *multEstimates ) = 0;
00871 
00872 
00873 // utility query functions..............
00874 
00883    virtual int getBlockNodeIDList( GlobalID elemBlockID,
00884                                    int numNodes,
00885                                    GlobalID *nodeIDs ) = 0;
00886                                
00892    virtual int getBlockElemIDList(GlobalID elemBlockID, 
00893                                    int numElems,
00894                                    GlobalID *elemIDs ) = 0;
00895  
00896 // miscellaneous self-explanatory query functions............ 
00897 
00906    virtual int version(const char*& versionString) = 0;
00907 
00915    virtual int cumulative_cpu_times(double& initPhase,
00916                                     double& loadPhase,
00917                                     double& solve,
00918                                     double& solnReturn) = 0;
00919  
00926    virtual int getNumSolnParams( GlobalID globalNodeID,
00927                                  int& numSolnParams) const = 0;
00928 
00932    virtual int getNumElemBlocks(int& numElemBlocks) const = 0;
00933 
00938    virtual int getNumBlockActNodes( GlobalID elemBlockID,
00939                                     int& numNodes) const = 0;
00940 
00946    virtual int getNumBlockActEqns( GlobalID elemBlockID,
00947                                    int& numEqns) const = 0;
00948 
00954    virtual int getNumNodesPerElement( GlobalID elemBlockID,
00955                                       int& nodesPerElem) const = 0;
00956     
00962    virtual int getNumEqnsPerElement( GlobalID elemBlockID,
00963                                      int& eqnsPerElem) const = 0;
00964 
00969    virtual int getNumBlockElements( GlobalID blockID,
00970                                     int& numElems) const = 0;
00971 
00976    virtual int getNumBlockElemDOF( GlobalID blockID,
00977                                    int& DOFPerElem) const = 0;
00978 
00979 };
00980 
00981 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
Generated on Wed Apr 13 10:08:23 2011 for FEI by  doxygen 1.6.3