ArrayGraph.hGo to the documentation of this file.00001 /* ****************************************************************** ** 00002 ** OpenSees - Open System for Earthquake Engineering Simulation ** 00003 ** Pacific Earthquake Engineering Research Center ** 00004 ** ** 00005 ** ** 00006 ** (C) Copyright 1999, The Regents of the University of California ** 00007 ** All Rights Reserved. ** 00008 ** ** 00009 ** Commercial use of this program without express permission of the ** 00010 ** University of California, Berkeley, is strictly prohibited. See ** 00011 ** file 'COPYRIGHT' in main directory for information on usage and ** 00012 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. ** 00013 ** ** 00014 ** Developed by: ** 00015 ** Frank McKenna (fmckenna@ce.berkeley.edu) ** 00016 ** Gregory L. Fenves (fenves@ce.berkeley.edu) ** 00017 ** Filip C. Filippou (filippou@ce.berkeley.edu) ** 00018 ** ** 00019 ** ****************************************************************** */ 00020 00021 // $Revision: 1.2 $ 00022 // $Date: 2003/02/14 23:01:22 $ 00023 // $Source: /usr/local/cvs/OpenSees/SRC/graph/graph/ArrayGraph.h,v $ 00024 00025 00026 // File: ~/graph/graph/ArrayGraph.h 00027 // 00028 // Written: fmk 00029 // Created: Sun Sept 15 11:47:47: 1996 00030 // Revision: A 00031 // 00032 // Description: This file contains the class definition for ArrayGraph. 00033 // The vertices in an ArrayGraph are held in an array. This is more efficient 00034 // than holding them in a List data structure, but problems can arise with 00035 // large Graphs in getting enough contiguous memory for the array. 00036 // 00037 // What: "@(#) ArrayGraph.h, revA" 00038 00039 #ifndef ArrayGraph_h 00040 #define ArrayGraph_h 00041 00042 #include <Graph.h> 00043 #include <ArrayVertexIter.h> 00044 00045 class ArrayGraph: public Graph 00046 { 00047 public: 00048 ArrayGraph(int arraySize); 00049 virtual ~ArrayGraph(); 00050 00051 virtual bool addVertex(Vertex *vertexPtr); 00052 virtual int addEdge(int vertexTag, int otherVertexTag); 00053 00054 virtual Vertex *getVertexPtr(int vertexTag); 00055 virtual VertexIter &getVertices(void); 00056 int getNumVertex(void) const; 00057 int getNumEdge(void) const; 00058 00059 virtual void Print(OPS_Stream &s) const; 00060 friend OPS_Stream &operator<<(OPS_Stream &s, const ArrayGraph &M); 00061 00062 friend class ArrayVertexIter; 00063 00064 protected: 00065 int getArraySize(void) const; 00066 00067 private: 00068 int numVertex; 00069 int numEdge; 00070 int sizeVertices; 00071 int lastEmpty; 00072 Vertex **theVertices; 00073 ArrayVertexIter myIter; 00074 00075 }; 00076 00077 #endif 00078 |