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 ) = 0;
00212                                 
00234    virtual int initElemBlock( GlobalID elemBlockID,
00235                               int numElements,
00236                               int numNodesPerElement,
00237                               const int *numFieldsPerNode,
00238                               const int *const *nodalFieldIDs,
00239                               int numElemDofFieldsPerElement,
00240                               const int* elemDOFFieldIDs,
00241                               int interleaveStrategy ) = 0;
00242  
00251    virtual int initElem( GlobalID elemBlockID,
00252                          GlobalID elemID, 
00253                          const GlobalID *elemConn ) = 0; 
00254  
00270    virtual int initSharedNodes( int numSharedNodes,
00271                                 const GlobalID *sharedNodeIDs,  
00272                                 const int *numProcsPerNode,
00273                                 const int *const *sharingProcIDs ) = 0;
00274  
00283    virtual int initCRMult( int numCRNodes,
00284                            const GlobalID* CRNodeIDs,
00285                            const int *CRFieldIDs,
00286                            int& CRID ) = 0;
00287  
00296    virtual int initCRPen( int numCRNodes,
00297                           const GlobalID* CRNodeIDs, 
00298                           const int *CRFieldIDs,
00299                           int& CRID ) = 0; 
00300 
00348    virtual int initSlaveVariable(GlobalID slaveNodeID,
00349                                  int slaveFieldID,
00350                                  int offsetIntoSlaveField,
00351                                  int numMasterNodes,
00352                                  const GlobalID* masterNodeIDs,
00353                                  const int* masterFieldIDs,
00354                                  const double* weights,
00355                                  double rhsValue) = 0;
00356 
00363    virtual int initComplete() = 0;
00364 
00365      
00366 // Load Phase.......................................... 
00367 
00374    virtual int setCurrentMatrix(int matrixID) = 0;
00375 
00382    virtual int setCurrentRHS(int rhsID) = 0;
00383 
00387    virtual int resetSystem(double s=0.0) = 0;
00388 
00393    virtual int resetMatrix(double s=0.0) = 0;
00394 
00398    virtual int resetRHSVector(double s=0.0) = 0;
00399 
00405    virtual int resetInitialGuess(double s) = 0;
00406 
00411    virtual int deleteMultCRs() = 0;
00412 
00431     virtual int loadNodeBCs(int numNodes,
00432                             const GlobalID *nodeIDs,
00433                             int fieldID,
00434                             const int* offsetsIntoField,
00435                             const double* prescribedValues) = 0;
00436 
00459    virtual int loadElemBCs( int numElems,
00460                             const GlobalID *elemIDs,
00461                             int fieldID,
00462                             const double *const *alpha,  
00463                             const double *const *beta,  
00464                             const double *const *gamma ) = 0;
00465 
00481    virtual int sumInElem(GlobalID elemBlockID,
00482                             GlobalID elemID,  
00483                             const GlobalID* elemConn,
00484                             const double* const* elemStiffness,
00485                             const double* elemLoad,
00486                             int elemFormat) = 0;
00487      
00502    virtual int sumInElemMatrix(GlobalID elemBlockID,
00503                                GlobalID elemID,  
00504                                const GlobalID* elemConn,
00505                                const double* const* elemStiffness,
00506                                int elemFormat) = 0;
00507      
00516    virtual int sumInElemRHS(GlobalID elemBlockID,
00517                             GlobalID elemID,  
00518                             const GlobalID* elemConn,
00519                             const double* elemLoad) = 0;
00520      
00530    virtual int loadCRMult(int CRMultID, int numCRNodes,
00531                           const GlobalID* CRNodeIDs,
00532                           const int* CRFieldIDs,
00533                           const double* CRWeights,
00534                           double CRValue) = 0;
00535  
00546    virtual int loadCRPen(int CRPenID, int numCRNodes,
00547                          const GlobalID* CRNodeIDs,
00548                          const int* CRFieldIDs,
00549                          const double* CRWeights,
00550                          double CRValue,
00551                          double penValue) = 0;
00552 
00554    virtual int putIntoRHS(int IDType,
00555                           int fieldID,
00556                           int numIDs,
00557                           const GlobalID* IDs,
00558                           const double* coefficients) = 0;
00559 
00561    virtual int sumIntoRHS(int IDType,
00562                           int fieldID,
00563                           int numIDs,
00564                           const GlobalID* IDs,
00565                           const double* coefficients) = 0;
00566 
00567    virtual int sumIntoMatrixDiagonal(int /*IDType*/,
00568                                      int /*fieldID*/,
00569                                      int /*numIDs*/,
00570                                      const GlobalID* /*IDs*/,
00571                                      const double* /*coefficients*/)
00572     { return -1; }
00573 
00581    virtual int setMatScalars( int numScalars,
00582                               const int* IDs,
00583                               const double* scalars ) = 0;
00584 
00592    virtual int setRHSScalars( int numScalars,
00593                               const int* IDs,
00594                               const double* scalars) = 0;
00595 
00600    virtual int loadComplete(bool applyBCs=true,
00601                             bool globalAssemble=true) = 0;
00602 
00603 // Equation solution services..................................... 
00604  
00617    virtual int residualNorm(int whichNorm, int numFields,
00618                              int* fieldIDs, double* norms) = 0;
00619 
00630    virtual int solve(int& status) = 0;
00631 
00632  
00633 // Solution return services....................................... 
00634 
00638    virtual int iterations(int& itersTaken) const = 0;
00639  
00644    virtual int getFieldSize(int fieldID, int& numScalars) = 0;
00645 
00658    virtual int getEqnNumbers(GlobalID ID,
00659                              int idType, 
00660                              int fieldID,
00661                              int& numEqns,
00662                              int* eqnNumbers) = 0;
00663 
00676    virtual int getNodalFieldSolution(int fieldID,
00677                                      int numNodes,
00678                                      const GlobalID* nodeIDs,
00679                                      double* results) = 0;
00680 
00686    virtual int getNumLocalNodes(int& numNodes) = 0;
00687 
00699    virtual int getLocalNodeIDList(int& numNodes,
00700                                   GlobalID* nodeIDs,
00701                                   int lenNodeIDs) = 0;
00702 
00706    virtual int putNodalFieldData(int fieldID,
00707                                  int numNodes,
00708                                  const GlobalID* nodeIDs,
00709                                  const double* data) = 0;
00710 
00728    virtual int getBlockNodeSolution( GlobalID elemBlockID,  
00729                                      int numNodes,
00730                                      const GlobalID *nodeIDs, 
00731                                      int *offsets,  
00732                                      double *results ) = 0;
00733 
00748    virtual int getNodalSolution(int numNodes,
00749                                 const GlobalID* nodeIDs,
00750                                 int* offsets,
00751                                 double* results) = 0;
00752  
00763    virtual int getBlockFieldNodeSolution(GlobalID elemBlockID,
00764                                           int fieldID,
00765                                           int numNodes, 
00766                                           const GlobalID *nodeIDs, 
00767                                           double *results) = 0;
00768          
00778    virtual int getBlockElemSolution( GlobalID elemBlockID,  
00779                                      int numElems,
00780                                      const GlobalID *elemIDs,
00781                                      int& numElemDOFPerElement, 
00782                                      double *results ) = 0;
00783 
00788    virtual int getNumCRMultipliers(int& numMultCRs) = 0;
00789 
00796    virtual int getCRMultIDList(int numMultCRs, int* multIDs) = 0;
00797 
00805    virtual int getCRMultipliers(int numCRs, 
00806                                  const int *CRIDs,  
00807                                  double *results) = 0;
00808 
00809  
00810 // Some 'put' methods paralleling the solution 'get' functions.
00811 // the int sizing parameters are passed for error-checking purposes, so
00812 // that the interface implementation can tell if the passed estimate
00813 // vectors make sense -before- an attempt is made to utilize them as
00814 // initial guesses by unpacking them into the solver's native solution
00815 // vector format.
00816 
00827    virtual int putBlockNodeSolution(GlobalID elemBlockID, 
00828                                      int numNodes, 
00829                                      const GlobalID *nodeIDs, 
00830                                      const int *offsets,
00831                                      const double *estimates) = 0;
00832 
00841    virtual int putBlockFieldNodeSolution(GlobalID elemBlockID, 
00842                                           int fieldID, 
00843                                           int numNodes, 
00844                                           const GlobalID *nodeIDs, 
00845                                           const double *estimates) = 0;
00846          
00856    virtual int putBlockElemSolution( GlobalID elemBlockID,  
00857                                      int numElems, 
00858                                      const GlobalID *elemIDs, 
00859                                      int dofPerElem,
00860                                      const double *estimates) = 0;
00861   
00867    virtual int putCRMultipliers( int numMultCRs,
00868                                  const int* CRMultIDs,
00869                                  const double *multEstimates ) = 0;
00870 
00871 
00872 // utility query functions..............
00873 
00882    virtual int getBlockNodeIDList( GlobalID elemBlockID,
00883                                    int numNodes,
00884                                    GlobalID *nodeIDs ) = 0;
00885                                
00891    virtual int getBlockElemIDList(GlobalID elemBlockID, 
00892                                    int numElems,
00893                                    GlobalID *elemIDs ) = 0;
00894  
00895 // miscellaneous self-explanatory query functions............ 
00896 
00905    virtual int version(const char*& versionString) = 0;
00906 
00914    virtual int cumulative_cpu_times(double& initPhase,
00915                                     double& loadPhase,
00916                                     double& solve,
00917                                     double& solnReturn) = 0;
00918  
00925    virtual int getNumSolnParams( GlobalID globalNodeID,
00926                                  int& numSolnParams) const = 0;
00927 
00931    virtual int getNumElemBlocks(int& numElemBlocks) const = 0;
00932 
00937    virtual int getNumBlockActNodes( GlobalID elemBlockID,
00938                                     int& numNodes) const = 0;
00939 
00945    virtual int getNumBlockActEqns( GlobalID elemBlockID,
00946                                    int& numEqns) const = 0;
00947 
00953    virtual int getNumNodesPerElement( GlobalID elemBlockID,
00954                                       int& nodesPerElem) const = 0;
00955     
00961    virtual int getNumEqnsPerElement( GlobalID elemBlockID,
00962                                      int& eqnsPerElem) const = 0;
00963 
00968    virtual int getNumBlockElements( GlobalID blockID,
00969                                     int& numElems) const = 0;
00970 
00975    virtual int getNumBlockElemDOF( GlobalID blockID,
00976                                    int& DOFPerElem) const = 0;
00977 
00978 };
00979 
00980 #endif

Generated on Wed May 12 21:30:40 2010 for FEI by  doxygen 1.4.7