FEI Version of the Day
fei_BlockDescriptor.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_BlockDescriptor_hpp_
00044 #define _fei_BlockDescriptor_hpp_
00045 
00046 
00047 #include "fei_macros.hpp"
00048 #include "fei_defs.h"
00049 #include <vector>
00050 
00102 class BlockDescriptor {
00103  public:
00104    BlockDescriptor();
00105    virtual ~BlockDescriptor();
00106 
00107    GlobalID getGlobalBlockID() {return(blockID_);}
00108    void setGlobalBlockID(GlobalID blockID) {blockID_ = blockID;}
00109 
00112    int setNumNodesPerElement(int numNodes);
00113    int getNumNodesPerElement() const { return numNodesPerElement_; }
00114 
00115    int* fieldsPerNodePtr();  //length of this list = getNumNodesPerElement()
00116 
00117    int allocateFieldIDsTable();
00118 
00123    int** fieldIDsTablePtr() { return(nodalFieldIDs_); }
00124 
00125    bool containsField(int fieldID);
00126 
00127    int getNumDistinctFields() { return( numDistinctFields_ ); }
00128    void setNumDistinctFields(int nFields) { numDistinctFields_ = nFields; }
00129 
00130    int getInterleaveStrategy() const {return(interleaveStrategy_);}
00131    void setInterleaveStrategy(int strat) {interleaveStrategy_ = strat;}
00132    
00133    int getLumpingStrategy() const {return(lumpingStrategy_);}
00134    void setLumpingStrategy(int strat) {lumpingStrategy_ = strat;}
00135 
00136    int getNumElements() {return(numElements_);}
00137    void setNumElements(int numElems) {numElements_ = numElems;}
00138    
00139    size_t getNumElemDofFieldsPerElement() {return(elemDofFieldIDs_.size());}
00140    int setElemDofFieldIDs(int numFields, const int* fieldIDs);
00141    std::vector<int>& getElemDofFieldIDs() { return(elemDofFieldIDs_); }
00142 
00143    void setNumElemDOFPerElement(int ndof) { numElemDOFPerElement_ = ndof; }
00144    int getNumElemDOFPerElement() { return(numElemDOFPerElement_); }
00145 
00146    //elemDOFEqnNumbers is of length numElements.
00147    std::vector<int>& elemDOFEqnNumbers() {return(elemDOFEqnNumbers_);}
00148 
00149    int getNumEqnsPerElement() {return(numEqnsPerElement_);};
00150    void setNumEqnsPerElement(int numEqns) {numEqnsPerElement_ = numEqns;}
00151 
00152    int getNumBlkEqnsPerElement() {return(numBlkEqnsPerElement_);}
00153    void setNumBlkEqnsPerElement(int numBlkEqns) {numBlkEqnsPerElement_ = numBlkEqns;};
00154 
00155    int getNumActiveNodes() {return(numActiveNodes_);}
00156    void setNumActiveNodes(int num) {numActiveNodes_ = num;}
00157 
00158    int getTotalNumEqns() {return(totalNumEqns_);}
00159    void setTotalNumEqns(int numEqns) {totalNumEqns_ = numEqns;}
00160 
00161  private:
00162    BlockDescriptor(const BlockDescriptor& /*src*/)
00163      : blockID_(0), numNodesPerElement_(0), numFieldsPerNode_(NULL),
00164      nodalFieldIDs_(NULL), fieldIDsAllocated_(false),
00165      numDistinctFields_(0), elemDofFieldIDs_(), interleaveStrategy_(0),
00166      lumpingStrategy_(0), numElements_(0), numElemDOFPerElement_(0),
00167      elemDOFEqnNumbers_(), numEqnsPerElement_(0), numBlkEqnsPerElement_(0),
00168      numActiveNodes_(0), totalNumEqns_(0) {}
00169 
00170    BlockDescriptor& operator=(const BlockDescriptor& /*src*/)
00171      {
00172        return(*this);
00173      }
00174 
00175    void destroyFieldArrays();
00176 
00177    GlobalID blockID_;
00178 
00179    int numNodesPerElement_;
00180 
00181    int* numFieldsPerNode_; //list: length = numNodesPerElement_
00182 
00183    int** nodalFieldIDs_;   //table: number-of-rows = numNodesPerElement_
00184                            //       length-of-row[i] = numFieldsPerNode_[i]
00185    bool fieldIDsAllocated_;
00186 
00187    int numDistinctFields_;
00188 
00189    std::vector<int> elemDofFieldIDs_;
00190 
00191    int interleaveStrategy_;
00192    int lumpingStrategy_;
00193 
00194    int numElements_;
00195    int numElemDOFPerElement_; //number of elem-dof in each element (all
00196                               //elems in block have the same number)
00197 
00198    std::vector<int> elemDOFEqnNumbers_; //list -- length = numElements_
00199                             //holds eqn number of each element's first elemDOF
00200 
00201    int numEqnsPerElement_;
00202    int numBlkEqnsPerElement_;
00203 
00204    int numActiveNodes_;
00205    int totalNumEqns_;
00206 };
00207 
00208 #endif
00209 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends