73 this->
nodes.reserve(nnodes);
74 this->
dmans.reserve(nnodes);
75 std :: map< DofManager*, int > dman2map;
80 nodes.emplace_back(
this, ++count);
81 dmans.push_back(dman.get());
82 dman2map.insert({dman.get(), count});
86 this->
nodes.reserve(
nodes.size() + elem->giveNumberOfInternalDofManagers() );
87 this->
dmans.reserve(
dmans.size() + elem->giveNumberOfInternalDofManagers() );
88 for (
int j = 1; j <= elem->giveNumberOfInternalDofManagers(); ++j ) {
89 nodes.emplace_back(
this, ++count);
90 dmans.push_back( elem->giveInternalDofManager(j) );
91 dman2map.insert({elem->giveInternalDofManager(j), count});
96 this->
nodes.reserve(
nodes.size() + bc->giveNumberOfInternalDofManagers() );
97 this->
dmans.reserve(
dmans.size() + bc->giveNumberOfInternalDofManagers() );
98 for (
int j = 1; j <= bc->giveNumberOfInternalDofManagers(); ++j ) {
99 nodes.emplace_back(
this, ++count);
100 dmans.push_back( bc->giveInternalDofManager(j) );
101 dman2map.insert({bc->giveInternalDofManager(j), count});
107 int ielemnodes = elem->giveNumberOfDofManagers();
108 int ielemintdmans = elem->giveNumberOfInternalDofManagers();
109 int ndofmans = ielemnodes + ielemintdmans;
110 connections.
resize(ndofmans);
111 for (
int j = 1; j <= ielemnodes; j++ ) {
112 connections.
at(j) = dman2map[ elem->giveDofManager(j) ];
114 for (
int j = 1; j <= ielemintdmans; j++ ) {
115 connections.
at(ielemnodes + j) = dman2map[ elem->giveInternalDofManager(j) ];
117 for (
int j = 1; j <= ndofmans; j++ ) {
118 for (
int k = j + 1; k <= ndofmans; k++ ) {
120 this->
giveNode( connections.
at(j) ).addNeighbor( connections.
at(k) );
121 this->
giveNode( connections.
at(k) ).addNeighbor( connections.
at(j) );
128 for (
auto &dman :
dmans ) {
132 if ( dman->hasAnySlaveDofs() ) {
133 std :: set< int >masters;
136 for (
Dof *dof: *dman ) {
137 if ( !dof->isPrimaryDof() ) {
140 dof->giveMasterDofManArray(dofMasters);
141 for (
int m : dofMasters ) {
147 for (
int connection: masters ) {
165 int nnodes = (int)
nodes.size();
167 int min = nnodes + 1;
169 for (
int i = 1; i <= nnodes; i++ ) {
171 if ( deg < min && deg > 0 && ( this->
giveNode(i).giveNewNumber() == 0 ) ) {
186 std :: unique_ptr< SloanLevelStructure > Spine;
194 OOFEM_WARNING(
"Unsupported value of SpineQuality, using (Good)");
202 int CurrentDiameter = Spine->giveDepth();
203 int TrialDepth, TrialWidth;
204 std :: list< int >candidates;
205 int newStartNode = 1;
207 while ( newStartNode ) {
213 for (
int Root: candidates ) {
214 std :: unique_ptr< SloanLevelStructure > TrialSpine(
new SloanLevelStructure(
this, Root) );
216 if ( TrialSpine->formYourself(MinimumWidth) == 0 ) {
220 TrialDepth = TrialSpine->giveDepth();
221 TrialWidth = TrialSpine->giveWidth();
222 if ( TrialWidth < MinimumWidth && TrialDepth > CurrentDiameter ) {
223 Spine = std :: move( TrialSpine );
225 CurrentDiameter = Spine->giveDepth();
230 if ( TrialWidth < MinimumWidth ) {
231 MinimumWidth = TrialWidth;
253 for (
int node: LastLevel ) {
254 if ( lastDegree != this->
giveNode(
node ).giveDegree() ) {
256 candidates.push_back(
node );
275 int nnodes = (int)
nodes.size();
276 clock_t time_1, time_0 = :: clock();
277 for (
int i = 1; i <= nnodes; i++ ) {
280 if ( Depth > Diameter ) {
288 OOFEM_LOG_INFO(
"%d roots (%5.1f per cent) checked: largest pseudo-diameter = %d\n", i,
float ( 100 * i ) / nnodes, Diameter);
302 int nnodes = (int)
nodes.size();
306 d /= ( nnodes * ( nnodes + 1 ) );
321 int Distance =
node->giveDistance();
322 int Degree =
node->giveDegree();
324 node->setPriority(Priority);
332 int Distance, Degree, Priority;
337 for (
int i = 1; i <= NumLevels; i++ ) {
338 for (
int nodeNum: BackSpine.
giveLevel(i) ) {
365 for (
int i = 1; i <= NumLevels; i++ ) {
366 for (
int nodeNum: BackSpine.
giveLevel(i) ) {
378 node.assignOldNumber();
387 if (
node.giveDegree() == 0 ) {
388 node.setNewNumber(++NextNumber);
398 int Start, inext, NextNumber = 0;
399 int labeledNodes = 0;
402 node.setNewNumber(0);
414 this->
queue.push_back(Start);
420 while ( !this->
queue.empty() ) {
444 this->
queue.push_back(Start);
449 OOFEM_ERROR(
"Internal error:\n%s",
"Isolated nodes or separated sub-domains exist");
464 this->
queue.push_front(nodeNum);
487 this->
queue.push_front(nnodeNum);
499 std :: list< int > :: iterator toDel;
501 for (
auto pos =
queue.begin(); pos !=
queue.end(); ++pos ) {
503 if ( pmax < priority ) {
511 this->
queue.erase(toDel);
531 ProfSize +=
node.computeProfileHeight();
545 dmans[ dmanNum - 1 ]->askNewEquationNumbers(tStep);
553 int nnodes = (int)
nodes.size();
555 for (
int i = 1; i <= nnodes; i++ ) {
557 fprintf(file,
"%8i %8i\n", i, inew);
569 for (
int i = 1; i <= nnodes; i++ ) {
580 printf(
"\nCurrent parameter values:\n");
612 int nnodes = (int)
nodes.size();
617 for (
int i = 1; i <= nnodes; i++ ) {
627 int n = (int)
nodes.size();
628 return n * ( n + 1 );
double giveOptimalProfileDensity()
Returns the optimal density of mesh.
void setPriority(int p)
Sets the receiver priority to given value.
void initialize()
Initialize graph from domain description.
void setParameters(int wdeg, int wdis)
Sets weight degee and weight dist to given values.
int giveDepth()
Returns the depth of receiver.
void askNewOptimalNumbering(TimeStep *tStep)
Numbers all the DOFs according to the optimal renumbering found.
int startNode
Start peripheral node.
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
bool isEmpty() const
Checks if receiver is empty (i.e., zero sized).
void numberIsolatedNodes(int &NextNumber, int &labeledNodes)
Numbers isolated nodes (those with degree equal to 0).
int giveNewNumber()
Returns new number of receiver.
void setWeightDegree(int w)
Sets weight degree to given value.
Class representing level structure for Sloan profile optimizer.
int giveDegree()
Return the receiver's degree.
int giveNodeWithMinDegree()
Returns graph node number with minimal degree.
Class representing node in undirected graph, used by Sloan profile optimizer.
int givePriority()
Returns priority of receiver.
std::vector< std::unique_ptr< DofManager > > & giveDofManagers()
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
void printParameters()
Prints actual parameters.
void sort(IntArray &arry, operation op)
Sorts the receiver using quicksort algorithm.
int nodeDistancesFlag
Flag indicating that node distances from endNode were already computed.
int endNode
End peripheral node.
int MinimalProfileSize
Minimal profile size obtained.
void extractCandidates(std::list< int > &candidates, SloanLevelStructure &Spine)
Extract candidates from given level structure.
std::vector< std::unique_ptr< GeneralBoundaryCondition > > & giveBcs()
SloanGraphNode_StatusType giveStatus()
Returns receiver status.
void findPeripheralNodes()
Finds the peripheral nodes (rooted in optimal start node) according to receiver quality and current w...
Domain * domain
Domain asoociated to graph.
#define OOFEM_LOG_INFO(...)
int WeightDistance
Integer distance weight.
void setStatus(SloanGraphNode_StatusType s)
Sets the status of receiver to given value.
int computeTrueDiameter()
IntArray OptimalRenumberingTable
Inverse renumbering table.
std::list< int > queue
Priority queue of active or preactive nodes.
int WeightDegree
Integer degree weight.
void modifyPriorityAround(int)
Modifies the priority around node with max priority.
SpineQualityType SpineQuality
std::vector< DofManager * > dmans
List of dof managers corresponding to nodes.
void resize(int n)
Checks size of receiver towards requested bounds.
std::vector< SloanGraphNode > nodes
List of graph nodes.
void setWeightDistance(int w)
Sets weight distance to given value.
void evaluateNodeDistances()
Evaluates the nodal distances from backSpine. The backSpine is generated if not available.
void addNeighbor(int neighbor)
Add neighbouring node to corresponding list.
void insertNeigborsOf(int)
Inserts inactive neighbours of given node as preactive ones.
void assignNewNumbers()
Implementation of node labeling algorithm.
void writeRenumberingTable(FILE *file)
IntArray & giveLevel(int num)
Returns the i-th level of receiver.
int OptimalWeightDistance
Optimal distance weight.
void setDistance(int d)
Sets the receiver distance to given number.
std::list< int > & giveNeighborList()
Returns the neighbor list of receiver.
int findTopPriorityInQueue()
Finds node with highest priority in queue, removes its entry and returns its number.
int OptimalWeightDegree
Optimal degree weight.
int writeOptimalRenumberingTable(FILE *file)
SloanGraphNode_StatusType
Status type definition.
int min(int i, int j)
Returns smaller value from two given decimals.
std::vector< std::unique_ptr< Element > > & giveElements()
SloanGraph(Domain *d)
Constructor. Creates the graph associated to given domain.
void increasePriorityBy(int p)
Increases the priority of receiver by given value.
void setNewNumber(int n)
Sets the new number of receiver.
the oofem namespace is to define a context or scope in which all oofem names are defined.
Abstract class Dof represents Degree Of Freedom in finite element mesh.
int giveFullProfileSize()
int computeProfileSize()
Assigns the New numbers by node labeling algorithm (old numbers are used when both weights are zero) ...
SloanGraphNode & giveNode(int num)
Return graph node.
#define OOFEM_WARNING(...)
void assignOldNumbers()
Assigns old node numbers as new ones. Used to compute the profile of existing old numbering...
Class representing solution step.
void tryParameters(int wdeg, int wdis)
Generates the new nodal numbering based on given parameters.
void initStatusAndPriority()
Initializes statuses and priority of nodes of receiver.