OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
sloangraphnode.C
Go to the documentation of this file.
1 /*
2  *
3  * ##### ##### ###### ###### ### ###
4  * ## ## ## ## ## ## ## ### ##
5  * ## ## ## ## #### #### ## # ##
6  * ## ## ## ## ## ## ## ##
7  * ## ## ## ## ## ## ## ##
8  * ##### ##### ## ###### ## ##
9  *
10  *
11  * OOFEM : Object Oriented Finite Element Code
12  *
13  * Copyright (C) 1993 - 2013 Borek Patzak
14  *
15  *
16  *
17  * Czech Technical University, Faculty of Civil Engineering,
18  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19  *
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33  */
34 
35 /* Modified and optimized by: Borek Patzak */
36 /* Author: Milan Jirasek */
37 
38 #include "sloangraphnode.h"
39 #include "sloangraph.h"
40 #include "mathfem.h"
41 
42 namespace oofem {
43 SloanGraphNode :: SloanGraphNode(SloanGraph *graph, int numOld) : neighborList()
44 {
45  this->graph = graph;
46  NumberOld = numOld;
47  NumberNew = 0;
49  Degree = 0;
50  Distance = -1;
51  Priority = -1;
52 }
53 
55 { }
56 
57 void SloanGraphNode :: addNeighbor(int newNeighbor)
58 {
59  // check if neighbor already in list
60  for ( int neighbor: this->neighborList ) {
61  if ( neighbor == newNeighbor ) {
62  return;
63  }
64  }
65 
66  Degree++;
67  this->neighborList.push_front(newNeighbor);
68 }
69 
71 {
72  int numberMin = NumberNew;
73  for ( int neighbor: this->neighborList ) {
74  numberMin = min( numberMin, this->graph->giveNode(neighbor).giveNewNumber() );
75  }
76 
77  return ( NumberNew - numberMin + 1 );
78 }
79 } // end namespace oofem
SloanGraphNode_StatusType nodeStatus
Status of node.
int giveNewNumber()
Returns new number of receiver.
std::list< int > neighborList
List of neighbouring nodes (represent graph edges).
SloanGraphNode(SloanGraph *graph, int numOld)
Creates node belonging to given graph with given old number.
int Priority
Node priority.
int Degree
Node degree (number of adjacent edges).
SloanGraph * graph
Associated graph structure, to which node belongs.
Graph representing the undirected graph used for Sloan algorithm for symmetric matrix profile reducti...
Definition: sloangraph.h:77
void addNeighbor(int neighbor)
Add neighbouring node to corresponding list.
int Distance
Node distance.
int NumberOld
Old (original) number.
int min(int i, int j)
Returns smaller value from two given decimals.
Definition: mathfem.h:59
~SloanGraphNode()
Destructor.
the oofem namespace is to define a context or scope in which all oofem names are defined.
int computeProfileHeight()
Computes the profile height corresponding to receiver from current new and old numbers.
SloanGraphNode & giveNode(int num)
Return graph node.
Definition: sloangraph.C:157
int NumberNew
New (optimized) number.

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:31 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011