FEI Version of the Day
fei_NodeDescriptor.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 _NodeDescriptor_hpp_
00044 #define _NodeDescriptor_hpp_
00045 
00046 
00047 #include <fei_macros.hpp>
00048 
00049 #include <fei_ArrayUtils.hpp>
00050 #include <iostream>
00071 class NodeDescriptor {
00072  public:
00073    NodeDescriptor();
00074 
00075    NodeDescriptor(const NodeDescriptor& src)
00076     : nodeID_(src.nodeID_), nodeNumber_(src.nodeNumber_),
00077       numNodalDOF_(0), fieldIDList_(NULL),
00078       fieldEqnNumbers_(NULL), numFields_(0), blkEqnNumber_(0),
00079       ownerProc_(src.ownerProc_), blockList_()
00080    {}
00081 
00082    virtual ~NodeDescriptor();
00083 
00084    GlobalID getGlobalNodeID() const {return(nodeID_);}
00085    void setGlobalNodeID(GlobalID node) {nodeID_ = node;}
00086 
00087    int getNodeNumber() const {return(nodeNumber_);}
00088    void setNodeNumber(int nn) {nodeNumber_ = nn;};
00089 
00090    int getBlkEqnNumber() const {return(blkEqnNumber_);}
00091    void setBlkEqnNumber(int blkEqn) {blkEqnNumber_ = blkEqn;}
00092 
00093    int getNumNodalDOF() const {return(numNodalDOF_);}
00094    void setNumNodalDOF(int dof) {numNodalDOF_ = dof;}
00095 
00096    void addField(int fieldID);
00097    void setFieldEqnNumber(int fieldID, int eqn);
00098 
00099    int getNumFields() const {return(numFields_);}
00100    const int* getFieldIDList() const {return(fieldIDList_);}
00101    const int* getFieldEqnNumbers() const {return(fieldEqnNumbers_);}
00102 
00109    bool getFieldEqnNumber(int fieldID, int& eqnNumber) const;
00110 
00114    void getFieldID(int eqnNumber, int& fieldID, int& offset_into_field) const;
00115 
00116    bool operator==(const NodeDescriptor& nd) const
00117      { return( nodeID_ == nd.nodeID_ ); }
00118 
00119    bool operator!=(const NodeDescriptor& nd) const
00120      { return( nodeID_ != nd.nodeID_ ); }
00121 
00122    bool operator<(const NodeDescriptor& nd) const
00123      { return( nodeID_ < nd.nodeID_ ); }
00124 
00125    bool operator>(const NodeDescriptor& nd) const
00126      { return( nodeID_ > nd.nodeID_ ); }
00127 
00128    int getOwnerProc() const {return(ownerProc_);}
00129    void setOwnerProc(int proc) {ownerProc_ = proc;}
00130 
00131    void addBlockIndex(unsigned blk_idx)
00132      { fei::sortedListInsert(blk_idx, blockList_); }
00133 
00134    size_t getNumBlocks() const {return blockList_.size();}
00135    const std::vector<unsigned>& getBlockIndexList() const {return(blockList_);}
00136    bool hasBlockIndex(unsigned blk_idx) const;
00137 
00138  private:
00139    NodeDescriptor& operator=(const NodeDescriptor& src);
00140 
00141    void allocFieldLists();
00142    void allocBlockList();
00143 
00144    GlobalID nodeID_;
00145 
00146    int nodeNumber_;
00147 
00148    int numNodalDOF_;      //total number of nodal degrees-of-freedom
00149 
00150    int* fieldIDList_;     //list of field identifiers
00151    int* fieldEqnNumbers_; //list of starting (global) equation numbers.
00152                           //fields can consist of more than one scalar (and
00153                           //have more than one associated equation), this
00154                           //is the first equation number
00155    int numFields_;
00156 
00157    int blkEqnNumber_;
00158 
00159    int ownerProc_;        //processor that owns the equations for this node
00160 
00161    std::vector<unsigned> blockList_;  //indexes of blocks that contain this node
00162 };
00163 
00164 #endif
00165 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends