XC Open source finite element analysis program
Graph.h
1 //----------------------------------------------------------------------------
2 // XC program; finite element analysis code
3 // for structural analysis and design.
4 //
5 // Copyright (C) Luis Claudio Pérez Tato
6 //
7 // This program derives from OpenSees <http://opensees.berkeley.edu>
8 // developed by the «Pacific earthquake engineering research center».
9 //
10 // Except for the restrictions that may arise from the copyright
11 // of the original program (see copyright_opensees.txt)
12 // XC is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // This software is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program.
25 // If not, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------------
27 /* ****************************************************************** **
28 ** OpenSees - Open System for Earthquake Engineering Simulation **
29 ** Pacific Earthquake Engineering Research Center **
30 ** **
31 ** **
32 ** (C) Copyright 1999, The Regents of the University of California **
33 ** All Rights Reserved. **
34 ** **
35 ** Commercial use of this program without express permission of the **
36 ** University of California, Berkeley, is strictly prohibited. See **
37 ** file 'COPYRIGHT' in main directory for information on usage and **
38 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
39 ** **
40 ** Developed by: **
41 ** Frank McKenna (fmckenna@ce.berkeley.edu) **
42 ** Gregory L. Fenves (fenves@ce.berkeley.edu) **
43 ** Filip C. Filippou (filippou@ce.berkeley.edu) **
44 ** **
45 ** ****************************************************************** */
46 
47 // $Revision: 1.3 $
48 // $Date: 2005/11/03 23:11:55 $
49 // $Source: /usr/local/cvs/OpenSees/SRC/graph/graph/Graph.h,v $
50 
51 
52 #ifndef Graph_h
53 #define Graph_h
54 
55 // Written: fmk
56 // Revision: A
57 //
58 // Description: This file contains the class definition for Graph.
59 // The Graph class provides the abstraction of a graph, a collection of
60 // vertices and edges. The Graph class is a container class which stores
61 // and provides access to Vertex objects. The Vertices contain information
62 // about the edges in this design.
63 //
64 // What: "@(#) Graph.h, revA"
65 
66 #include <iostream>
67 #include "utility/actor/actor/MovableObject.h"
68 #include "utility/tagged/storage/ArrayOfTaggedObjects.h"
69 #include "solution/graph/graph/VertexIter.h"
70 
71 namespace XC {
72 class Vertex;
73 class VertexIter;
74 class TaggedObjectStorage;
75 class Channel;
76 class FEM_ObjectBroker;
77 
79 //
84 class Graph: public MovableObject
85  {
86  protected:
87  ArrayOfTaggedObjects myVertices;
88  VertexIter theVertexIter;
89  int numEdge;
90  int nextFreeTag;
91 
92  void inic(const size_t &);
93  void copia(const Graph &other);
94  int sendData(CommParameters &);
95  int recvData(const CommParameters &);
96 
97  public:
98  Graph(void);
99  Graph(int numVertices);
100  Graph(const Graph &other);
101  Graph &operator=(const Graph &other);
102 
103  virtual bool addVertex(const Vertex &vertexPtr, bool checkAdjacency = true);
104  virtual int addEdge(int vertexTag, int otherVertexTag);
105 
106  virtual Vertex *getVertexPtr(int vertexTag);
107  virtual const Vertex *getVertexPtr(int vertexTag) const;
108  virtual VertexIter &getVertices(void);
109  virtual int getNumVertex(void) const;
110  virtual int getNumEdge(void) const;
111  virtual int getFreeTag(void);
112  virtual bool removeVertex(int tag, bool removeEdgeFlag = true);
113  const Vertex *BuscaRef(int ref) const;
114  void getBand(int &,int &) const;
115  int getVertexDiffMaxima(void) const;
116  int getVertexDiffExtrema(void) const;
117 
118 
119  virtual int merge(Graph &other);
120 
121  virtual void Print(std::ostream &os, int flag =0);
122  int sendSelf(CommParameters &);
123  int recvSelf(const CommParameters &);
124 
125  friend std::ostream &operator<<(std::ostream &s, Graph &M);
126  };
127 } // end of XC namespace
128 
129 #endif
130 
Graph & operator=(const Graph &other)
Assignment operator.
Definition: Graph.cpp:129
virtual bool addVertex(const Vertex &vertexPtr, bool checkAdjacency=true)
Appends a vertex to the graph. If the adjacency list of the vertex is not empty, we check before that...
Definition: Graph.cpp:140
virtual bool removeVertex(int tag, bool removeEdgeFlag=true)
Removes from the graph the vertex identified by the tag being passed as parameter.
Definition: Graph.cpp:277
int recvData(const CommParameters &)
Receives object members through the channel being passed as parameter.
Definition: Graph.cpp:443
ArrayOfTaggedObjects is a storage class. The class is responsible for holding and providing access to...
Definition: ArrayOfTaggedObjects.h:81
int getVertexDiffMaxima(void) const
Returns the maximum (positive) of the difference between vertices indexes.
Definition: Graph.cpp:370
virtual VertexIter & getVertices(void)
Returns an iterator to the vertices of the graph.
Definition: Graph.cpp:257
virtual int getNumEdge(void) const
Returns the número de aristas del grafo.
Definition: Graph.cpp:269
virtual int getFreeTag(void)
Returns the siguiente identificador (tag) libre.
Definition: Graph.cpp:273
Iterator over the vertices of the graph.
Definition: VertexIter.h:75
int sendSelf(CommParameters &)
Sends object through the channel being passed as parameter.
Definition: Graph.cpp:452
void getBand(int &, int &) const
Returns the extremos del ancho de banda.
Definition: Graph.cpp:340
Object that can move between processes.
Definition: MovableObject.h:91
Vertex of a graph.
Definition: Vertex.h:73
int sendData(CommParameters &)
Send object members through the channel being passed as parameter.
Definition: Graph.cpp:434
virtual Vertex * getVertexPtr(int vertexTag)
Returns a pointer to the vertex identified by the tag being passed as parameter.
Definition: Graph.cpp:237
int getVertexDiffExtrema(void) const
Returns the extreme (positive or negative) of the difference between vertices indexes.
Definition: Graph.cpp:394
virtual int getNumVertex(void) const
Returns the number of vertices del grafo.
Definition: Graph.cpp:265
virtual int merge(Graph &other)
Mezcla los dos grafos.
Definition: Graph.cpp:297
virtual int addEdge(int vertexTag, int otherVertexTag)
Adds an edge to the graph. Previously we check that its vertices are already defined in the graph...
Definition: Graph.cpp:189
Graph(void)
Constructor.
Definition: Graph.cpp:116
The Graph class provides the abstraction of a graph, a collection of vertices and edges...
Definition: Graph.h:84
int recvSelf(const CommParameters &)
Receives object through the channel being passed as parameter.
Definition: Graph.cpp:467
virtual void Print(std::ostream &os, int flag=0)
Imprime.
Definition: Graph.cpp:423
Communication parameters between processes.
Definition: CommParameters.h:65
================================================================================
Definition: ContinuaReprComponent.h:34