Graph.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.3 $ 00022 // $Date: 2005/11/03 23:11:55 $ 00023 // $Source: /usr/local/cvs/OpenSees/SRC/graph/graph/Graph.h,v $ 00024 00025 00026 #ifndef Graph_h 00027 #define Graph_h 00028 00029 // Written: fmk 00030 // Revision: A 00031 // 00032 // Description: This file contains the class definition for Graph. 00033 // The Graph class provides the abstraction of a graph, a collection of 00034 // vertices and edges. The Graph class is a container class which stores 00035 // and provides access to Vertex objects. The Vertices contain information 00036 // about the edges in this design. 00037 // 00038 // What: "@(#) Graph.h, revA" 00039 00040 #ifndef _bool_h 00041 #include "bool.h" 00042 #endif 00043 00044 #include <OPS_Stream.h> 00045 00046 class Vertex; 00047 class VertexIter; 00048 class TaggedObjectStorage; 00049 class Channel; 00050 class FEM_ObjectBroker; 00051 00052 class Graph 00053 { 00054 public: 00055 Graph(); 00056 Graph(int numVertices); 00057 Graph(TaggedObjectStorage &theVerticesStorage); 00058 Graph(Graph &other); 00059 virtual ~Graph(); 00060 00061 virtual bool addVertex(Vertex *vertexPtr, bool checkAdjacency = true); 00062 virtual int addEdge(int vertexTag, int otherVertexTag); 00063 00064 virtual Vertex *getVertexPtr(int vertexTag); 00065 virtual VertexIter &getVertices(void); 00066 virtual int getNumVertex(void) const; 00067 virtual int getNumEdge(void) const; 00068 virtual int getFreeTag(void); 00069 virtual Vertex *removeVertex(int tag, bool removeEdgeFlag = true); 00070 00071 virtual int merge(Graph &other); 00072 00073 virtual void Print(OPS_Stream &s, int flag =0); 00074 int sendSelf(int commitTag, Channel &theChannel); 00075 int recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker); 00076 00077 friend OPS_Stream &operator<<(OPS_Stream &s, Graph &M); 00078 00079 protected: 00080 00081 private: 00082 TaggedObjectStorage *myVertices; 00083 VertexIter *theVertexIter; 00084 int numEdge; 00085 int nextFreeTag; 00086 }; 00087 00088 #endif 00089 |