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 #include <iostream>
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_()
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 addBlockIndex(unsigned blk_idx)
00097      { fei::sortedListInsert(blk_idx, blockList_); }
00098 
00099    size_t getNumBlocks() const {return blockList_.size();}
00100    const std::vector<unsigned>& getBlockIndexList() const {return(blockList_);}
00101    bool hasBlockIndex(unsigned blk_idx) const;
00102 
00103  private:
00104    NodeDescriptor& operator=(const NodeDescriptor& src);
00105 
00106    void allocFieldLists();
00107    void allocBlockList();
00108 
00109    GlobalID nodeID_;
00110 
00111    int nodeNumber_;
00112 
00113    int numNodalDOF_;      //total number of nodal degrees-of-freedom
00114 
00115    int* fieldIDList_;     //list of field identifiers
00116    int* fieldEqnNumbers_; //list of starting (global) equation numbers.
00117                           //fields can consist of more than one scalar (and
00118                           //have more than one associated equation), this
00119                           //is the first equation number
00120    int numFields_;
00121 
00122    int blkEqnNumber_;
00123 
00124    int ownerProc_;        //processor that owns the equations for this node
00125 
00126    std::vector<unsigned> blockList_;  //indexes of blocks that contain this node
00127 };
00128 
00129 #endif
00130 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends