OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
sloangraph.h
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 #ifndef sloangraph_h
36 #define sloangraph_h
37 
38 #include "oofemcfg.h"
39 #include "sloangraphnode.h"
40 #include "sloanlevelstruct.h"
41 #include "dofmanager.h"
42 #include "intarray.h"
43 
44 #include <list>
45 
46 namespace oofem {
47 class TimeStep;
48 
49 #define SLOAN_TIME_CHUNK 60
50 
55 #define MDC
56 
57 class Domain;
58 
77 class OOFEM_EXPORT SloanGraph
78 {
79 public:
81  enum SpineQualityType { Good, Best };
82 private:
85 
87  std::vector< SloanGraphNode >nodes;
89  std::vector< DofManager* >dmans;
91  int startNode;
93  int endNode;
95  std :: list< int >queue;
109 
116 
117 public:
119  SloanGraph(Domain * d);
121  ~SloanGraph();
122 
124  Domain *giveDomain() { return this->domain; }
126  void initialize();
128  void resetAll() { startNode = endNode = nodeDistancesFlag = 0; }
129 
131  SloanGraphNode &giveNode(int num);
132 
134  void findPeripheralNodes();
135 
136  int computeTrueDiameter();
137  int findBestRoot();
138  int giveFullProfileSize();
140  int giveOptimalProfileSize() { return MinimalProfileSize; }
142  double giveOptimalProfileDensity();
143 
149  int computeProfileSize();
151  void askNewOptimalNumbering(TimeStep *tStep);
153  IntArray &giveOptimalRenumberingTable() { return OptimalRenumberingTable; }
154  void writeRenumberingTable(FILE *file);
155  int writeOptimalRenumberingTable(FILE *file);
156 
158  void setWeightDistance(int w) {
159  if ( w >= 0 ) {
160  WeightDistance = w;
161  }
162  }
164  void setWeightDegree(int w) {
165  if ( w >= 0 ) {
166  WeightDegree = w;
167  }
168  }
171  SpineQuality = q;
172  resetAll();
173  }
174 
176  void printParameters();
178  void setParameters(int wdeg, int wdis);
184  void tryParameters(int wdeg, int wdis);
185 
186 private:
188  int giveNodeWithMinDegree();
194  void extractCandidates(std :: list< int > &candidates, SloanLevelStructure &Spine);
196  void initStatusAndPriority();
198  void evaluateNodeDistances();
200  void assignOldNumbers();
202  void assignNewNumbers();
204  void insertNeigborsOf(int);
206  void modifyPriorityAround(int);
208  int findTopPriorityInQueue();
209 #ifdef MDC
210  void numberIsolatedNodes(int &NextNumber, int &labeledNodes);
212 #endif
213 };
214 
216 {
218 public:
220  graph = g;
221  }
222  int operator() (const int n1, const int n2) {
223  return graph->giveNode(n1).giveDegree() - graph->giveNode(n2).giveDegree();
224  }
225 };
226 } // end namespace oofem
227 #endif // sloangraph_h
Class and object Domain.
Definition: domain.h:115
int startNode
Start peripheral node.
Definition: sloangraph.h:91
void resetAll()
Resets the receiver state. Clears the startNode, endNode and nodeDistancesFlag values.
Definition: sloangraph.h:128
SloanNodalDegreeOrderingCrit(SloanGraph *g)
Definition: sloangraph.h:219
void setWeightDegree(int w)
Sets weight degree to given value.
Definition: sloangraph.h:164
Class representing level structure for Sloan profile optimizer.
int giveDegree()
Return the receiver&#39;s degree.
Class representing node in undirected graph, used by Sloan profile optimizer.
Class implementing an array of integers.
Definition: intarray.h:61
int nodeDistancesFlag
Flag indicating that node distances from endNode were already computed.
Definition: sloangraph.h:108
int endNode
End peripheral node.
Definition: sloangraph.h:93
int MinimalProfileSize
Minimal profile size obtained.
Definition: sloangraph.h:102
Domain * domain
Domain asoociated to graph.
Definition: sloangraph.h:84
int WeightDistance
Integer distance weight.
Definition: sloangraph.h:97
void setSpineQuality(SpineQualityType q)
Select spine quality generation.
Definition: sloangraph.h:170
IntArray OptimalRenumberingTable
Inverse renumbering table.
Definition: sloangraph.h:115
std::list< int > queue
Priority queue of active or preactive nodes.
Definition: sloangraph.h:95
int WeightDegree
Integer degree weight.
Definition: sloangraph.h:99
SpineQualityType SpineQuality
Definition: sloangraph.h:100
std::vector< DofManager * > dmans
List of dof managers corresponding to nodes.
Definition: sloangraph.h:89
std::vector< SloanGraphNode > nodes
List of graph nodes.
Definition: sloangraph.h:87
Graph representing the undirected graph used for Sloan algorithm for symmetric matrix profile reducti...
Definition: sloangraph.h:77
void setWeightDistance(int w)
Sets weight distance to given value.
Definition: sloangraph.h:158
int OptimalWeightDistance
Optimal distance weight.
Definition: sloangraph.h:106
SpineQualityType
Quality type definition.
Definition: sloangraph.h:81
int OptimalWeightDegree
Optimal degree weight.
Definition: sloangraph.h:104
Domain * giveDomain()
Returns associated domain.
Definition: sloangraph.h:124
the oofem namespace is to define a context or scope in which all oofem names are defined.
int giveOptimalProfileSize()
Returns the optimal profile found.
Definition: sloangraph.h:140
IntArray & giveOptimalRenumberingTable()
Returns the optimal reverse renumbering table.
Definition: sloangraph.h:153
SloanGraphNode & giveNode(int num)
Return graph node.
Definition: sloangraph.C:157
Class representing solution step.
Definition: timestep.h:80

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