FEI Version of the Day
fei_NodeDescriptor.hpp
00001 #ifndef _NodeDescriptor_hpp_
00002 #define _NodeDescriptor_hpp_
00003 
00004 /*--------------------------------------------------------------------*/
00005 /*    Copyright 2005 Sandia Corporation.                              */
00006 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00007 /*    non-exclusive license for use of this work by or on behalf      */
00008 /*    of the U.S. Government.  Export of this program may require     */
00009 /*    a license from the United States Government.                    */
00010 /*--------------------------------------------------------------------*/
00011 
00012 #include <fei_macros.hpp>
00013 
00014 #include <fei_ArrayUtils.hpp>
00015 
00036 class NodeDescriptor {
00037  public:
00038    NodeDescriptor();
00039 
00040    NodeDescriptor(const NodeDescriptor& src)
00041     : nodeID_(src.nodeID_), nodeNumber_(src.nodeNumber_),
00042       numNodalDOF_(0), fieldIDList_(NULL),
00043       fieldEqnNumbers_(NULL), numFields_(0), blkEqnNumber_(0),
00044       ownerProc_(src.ownerProc_), blockList_(NULL), numBlocks_(0)
00045    {}
00046 
00047    virtual ~NodeDescriptor();
00048 
00049    GlobalID getGlobalNodeID() const {return(nodeID_);};
00050    void setGlobalNodeID(GlobalID node) {nodeID_ = node;};
00051 
00052    int getNodeNumber() const {return(nodeNumber_);};
00053    void setNodeNumber(int nn) {nodeNumber_ = nn;};
00054 
00055    int getBlkEqnNumber() const {return(blkEqnNumber_);}
00056    void setBlkEqnNumber(int blkEqn) {blkEqnNumber_ = blkEqn;}
00057 
00058    int getNumNodalDOF() const {return(numNodalDOF_);};
00059    void setNumNodalDOF(int dof) {numNodalDOF_ = dof;};
00060 
00061    void addField(int fieldID);
00062    void setFieldEqnNumber(int fieldID, int eqn);
00063 
00064    int getNumFields() const {return(numFields_);};
00065    const int* getFieldIDList() const {return(fieldIDList_);};
00066    const int* getFieldEqnNumbers() const {return(fieldEqnNumbers_);};
00067 
00074    bool getFieldEqnNumber(int fieldID, int& eqnNumber) const;
00075 
00079    void getFieldID(int eqnNumber, int& fieldID, int& offset_into_field) const;
00080 
00081    bool operator==(const NodeDescriptor& nd) const
00082      { return( nodeID_ == nd.nodeID_ ); }
00083 
00084    bool operator!=(const NodeDescriptor& nd) const
00085      { return( nodeID_ != nd.nodeID_ ); }
00086 
00087    bool operator<(const NodeDescriptor& nd) const
00088      { return( nodeID_ < nd.nodeID_ ); }
00089 
00090    bool operator>(const NodeDescriptor& nd) const
00091      { return( nodeID_ > nd.nodeID_ ); }
00092 
00093    int getOwnerProc() const {return(ownerProc_);};
00094    void setOwnerProc(int proc) {ownerProc_ = proc;};
00095 
00096    void addBlock(GlobalID blk)
00097      {
00098        int allocLen = numBlocks_;
00099        fei::sortedListInsert(blk, blockList_, numBlocks_, allocLen);
00100      }
00101 
00102    int getNumBlocks() const {return(numBlocks_);};
00103    const GlobalID* getBlockList() const {return(blockList_);};
00104    bool containedInBlock(GlobalID blk) const;
00105 
00106  private:
00107    NodeDescriptor& operator=(const NodeDescriptor& src);
00108 
00109    void allocFieldLists();
00110    void allocBlockList();
00111 
00112    GlobalID nodeID_;
00113 
00114    int nodeNumber_;
00115 
00116    int numNodalDOF_;      //total number of nodal degrees-of-freedom
00117 
00118    int* fieldIDList_;     //list of field identifiers
00119    int* fieldEqnNumbers_; //list of starting (global) equation numbers.
00120                           //fields can consist of more than one scalar (and
00121                           //have more than one associated equation), this
00122                           //is the first equation number
00123    int numFields_;
00124 
00125    int blkEqnNumber_;
00126 
00127    int ownerProc_;        //processor that owns the equations for this node
00128 
00129    GlobalID* blockList_;       //blocks that contain this node
00130    int numBlocks_;
00131 };
00132 
00133 #endif
00134 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends