FEI Version of the Day
fei_MatrixGraph.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 
00044 #ifndef _fei_MatrixGraph_hpp_
00045 #define _fei_MatrixGraph_hpp_
00046 
00047 #include <fei_macros.hpp>
00048 #include <fei_SharedPtr.hpp>
00049 #include <fei_VectorSpace.hpp>
00050 #include <fei_Reducer.hpp>
00051 #include <snl_fei_Constraint.hpp>
00052 #include <fei_Record.hpp>
00053 #include <fei_SparseRowGraph.hpp>
00054 
00055 #include <vector>
00056 
00057 namespace fei {
00058   class ConnectivityBlock;
00059   class Pattern;
00060   class SparseRowGraph;
00062   typedef snl_fei::Constraint<fei::Record<int>*> ConstraintType;
00063 
00068 class MatrixGraph {
00069  public:
00071   class Factory {
00072   public:
00074     virtual ~Factory(){}
00075 
00080     virtual fei::SharedPtr<fei::MatrixGraph>
00081                  createMatrixGraph(fei::SharedPtr<fei::VectorSpace> rowSpace,
00082                                    fei::SharedPtr<fei::VectorSpace> columnSpace,
00083                                    const char* name) = 0;
00084   };
00085 
00086   enum { REDUCED_INDICES   = 0,
00087          UNREDUCED_INDICES = 1,
00088          BLOCK_ENTRY_GRAPH = 2,
00089          POINT_ENTRY_GRAPH = 3};
00090 
00092   virtual ~MatrixGraph(){}
00093 
00101   virtual void setParameters(const fei::ParameterSet& params) = 0;
00102 
00109   virtual void setRowSpace(fei::SharedPtr<fei::VectorSpace> rowSpace) = 0;
00110 
00114   virtual fei::SharedPtr<fei::VectorSpace> getRowSpace() = 0;
00115 
00122   virtual void setColumnSpace(fei::SharedPtr<fei::VectorSpace> columnSpace) = 0;
00123 
00127   virtual fei::SharedPtr<fei::VectorSpace> getColSpace() = 0;
00128 
00150   virtual int definePattern(int numIDs,
00151                      int idType) = 0;
00152 
00175   virtual int definePattern(int numIDs,
00176                     int idType,
00177                     int fieldID) = 0;
00178 
00203    virtual int definePattern(int numIDs,
00204                      int idType,
00205                      const int* numFieldsPerID,
00206                      const int* fieldIDs) = 0;
00207 
00231    virtual int definePattern(int numIDs,
00232                      const int* idTypes,
00233                      const int* numFieldsPerID,
00234                      const int* fieldIDs) = 0;
00235 
00258    virtual int initConnectivityBlock(int blockID,
00259                              int numConnectivityLists,
00260                              int patternID,
00261                              bool diagonal=false) = 0;
00262 
00285    virtual int initConnectivityBlock(int numConnectivityLists,
00286                                      int patternID,
00287                                      bool diagonal=false) = 0;
00288 
00309    virtual int initConnectivityBlock(int blockID,
00310                              int numConnectivityLists,
00311                              int rowPatternID,
00312                              int colPatternID) = 0;
00313 
00326    virtual int initConnectivity(int blockID,
00327                         int connectivityID,
00328                         const int* connectedIdentifiers) = 0;
00329 
00344    virtual int initConnectivity(int blockID,
00345                         int connectivityID,
00346                         const int* rowConnectedIdentifiers,
00347                         const int* colConnectedIdentifiers) = 0;
00348 
00361    virtual int initConnectivity(int patternID,
00362                         const int* connectedIdentifiers) = 0;
00363 
00378    virtual int initConnectivity(int rowPatternID,
00379                         const int* rowConnectedIdentifiers,
00380                         int colPatternID,
00381                         const int* colConnectedIdentifiers) = 0;
00382 
00398    virtual int initConnectivity(int idType,
00399                         int numRows,
00400                         const int* rowIDs,
00401                         const int* rowOffsets,
00402                         const int* packedColumnIDs) = 0;
00403 
00421    virtual int initConnectivity(int idType,
00422                         int fieldID,
00423                         int numRows,
00424                         const int* rowIDs,
00425                         const int* rowOffsets,
00426                         const int* packedColumnIDs) = 0;
00427 
00442    virtual int initConnectivity(int idType,
00443                         int numRows,
00444                         const int* rowIDs,
00445                         const int* rowLengths,
00446                         const int*const* columnIDs) = 0;
00447 
00450    virtual int initLagrangeConstraint(int constraintID,
00451                               int constraintIDType,
00452                               int numIDs,
00453                               const int* idTypes,
00454                               const int* IDs,
00455                               const int* fieldIDs) = 0;
00456 
00459    virtual int initPenaltyConstraint(int constraintID,
00460                              int constraintIDType,
00461                              int numIDs,
00462                              const int* idTypes,
00463                              const int* IDs,
00464                              const int* fieldIDs) = 0;
00465 
00468    virtual int initSlaveConstraint(int numIDs,
00469                            const int* idTypes,
00470                            const int* IDs,
00471                            const int* fieldIDs,
00472                            int offsetOfSlave,
00473                            int offsetIntoSlaveField,
00474                            const double* weights,
00475                            double rhsValue) = 0;
00476 
00477    virtual bool newSlaveData() = 0;
00478 
00481    virtual bool hasSlaveDof(int ID, int idType) = 0;
00482 
00487    virtual int initComplete() = 0;
00488 
00500    virtual fei::SharedPtr<fei::SparseRowGraph>
00501      createGraph(bool blockEntryGraph,
00502                  bool localRowGraph_includeSharedRows=false) = 0;
00503 
00507    virtual int compareStructure(const fei::MatrixGraph& matrixGraph,
00508                         bool& equivalent) const = 0;
00509 
00511    virtual int getNumConnectivityBlocks() const = 0;
00512 
00514    virtual std::map<int,fei::ConnectivityBlock*>& getConnectivityBlocks() = 0;
00516    virtual int getConnectivityBlockIDs(std::vector<int>& blockIDs) const = 0;
00517 
00520    virtual int getNumIDsPerConnectivityList(int blockID) const = 0;
00521 
00525    virtual int getConnectivityNumIndices(int blockID) const = 0;
00526 
00531    virtual int getConnectivityNumIndices(int blockID,
00532                                  int& numRowIndices,
00533                                  int& numColIndices) = 0;
00534 
00537    virtual int getConnectivityIndices(int blockID,
00538                               int connectivityID,
00539                               int indicesAllocLen,
00540                               int* indices,
00541                               int& numIndices) = 0;
00542 
00546    virtual int getConnectivityIndices(int blockID,
00547                               int connectivityID,
00548                               int rowIndicesAllocLen,
00549                               int* rowIndices,
00550                               int& numRowIndices,
00551                               int colIndicesAllocLen,
00552                               int* colIndices,
00553                               int& numColIndices) = 0;
00554 
00557    virtual int getPatternNumIndices(int patternID,
00558                             int& numIndices) = 0;
00559 
00562    virtual int getPatternIndices(int patternID,
00563                          const int* IDs,
00564                          std::vector<int>& indices) = 0;
00565 
00567    virtual int getLocalNumLagrangeConstraints() const = 0;
00568 
00571    virtual int getGlobalNumSlaveConstraints() const = 0;
00572 
00576    virtual ConstraintType* getLagrangeConstraint(int constraintID) = 0;
00577 
00581    virtual std::map<int, ConstraintType* >& getLagrangeConstraints() = 0;
00582 
00586    virtual ConstraintType* getPenaltyConstraint(int constraintID) = 0;
00587 
00591    virtual ConstraintType* getSlaveConstraint(int constraintID) = 0;
00592 
00596    virtual int getConstraintConnectivityIndices(ConstraintType* cr,
00597                                         std::vector<int>& globalIndices) = 0;
00598 
00602    virtual const fei::ConnectivityBlock* getConnectivityBlock(int blockID) const = 0;
00603 
00607    virtual fei::ConnectivityBlock* getConnectivityBlock(int blockID) = 0;
00608 
00610    virtual void setIndicesMode(int mode) = 0;
00611 
00613    virtual fei::SharedPtr<fei::FillableMat> getSlaveDependencyMatrix() = 0;
00614 
00618    virtual fei::Pattern* getPattern(int patternID) = 0;
00619 
00621    virtual int createSlaveMatrices() = 0;
00622 
00626    virtual fei::SharedPtr<fei::Reducer> getReducer() = 0;
00627 
00629    virtual fei::SharedPtr<fei::SparseRowGraph> getRemotelyOwnedGraphRows() = 0;
00630 
00632    virtual void getConstrainedIndices(std::vector<int>& crindices) const = 0;
00633 };//class MatrixGraph
00634 }//namespace fei
00635 
00636 #endif
00637 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends