ReleaseHeavierToLighterNeighbours.cpp

Go 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.2 $
00022 // $Date: 2003/02/14 23:00:58 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/domain/loadBalancer/ReleaseHeavierToLighterNeighbours.cpp,v $
00024                                                                         
00025                                                                         
00026  // File: ~/domain/loadBalancer/ReleaseHeavierToLighterNeighbours.C
00027 // 
00028 // Written: fmk 
00029 // Created: Fri Aug 29 17:43:25 1997
00030 // Revision: A
00031 //
00032 // Description: This file contains the class definition for ReleaseHeavierToLighterNeighbours.
00033 // A ReleaseHeavierToLighterNeighbours is an object used to partition a PartitionedDomain.
00034 //
00035 // What: "@(#) ReleaseHeavierToLighterNeighbours.C, revA"
00036 
00037 #include <ReleaseHeavierToLighterNeighbours.h>
00038 #include <Graph.h>
00039 #include <VertexIter.h>
00040 #include <Vertex.h>
00041  
00042 ReleaseHeavierToLighterNeighbours::ReleaseHeavierToLighterNeighbours()
00043  :numReleases(1), factorGreater(1.0), disallowDisconnectedGraphs(true)
00044 {
00045     
00046     
00047 }
00048 
00049 ReleaseHeavierToLighterNeighbours::
00050 ReleaseHeavierToLighterNeighbours(double factGreater, 
00051                                   int releases,
00052                                   bool disallowDisconnected)
00053  :numReleases(releases),factorGreater(factGreater),
00054   disallowDisconnectedGraphs(disallowDisconnected)  
00055 {
00056     if (releases < 0)
00057         numReleases = 0;
00058 }
00059 
00060 ReleaseHeavierToLighterNeighbours::~ReleaseHeavierToLighterNeighbours()
00061 {
00062     
00063 }
00064 
00065 int
00066 ReleaseHeavierToLighterNeighbours::balance(Graph &theWeightedGraph)
00067 {
00068     // check to see a domain partitioner has been set
00069     DomainPartitioner *thePartitioner = this->getDomainPartitioner();    
00070     if (thePartitioner == 0) {
00071         opserr << "ReleaseHeavierToLighterNeighbours::balance ";
00072         opserr << "- No DomainPartitioner has been set\n";
00073         return -1;
00074     }
00075 
00076     int res = 0;
00077     int numPartitions = theWeightedGraph.getNumVertex();
00078     for (int i=1; i<=numPartitions; i++) {
00079         res = thePartitioner->
00080             releaseBoundary(i,theWeightedGraph,
00081                             true,
00082                             factorGreater);  
00083         if (res < 0) {
00084             opserr << "WARNING ReleaseHeavierToLighterNeighbours";
00085             opserr << "::balance - DomainPartitioner returned ";
00086             opserr << res << endln;
00087             return res;    
00088         }
00089     }
00090     
00091     return res;
00092 }

Generated on Mon Oct 23 15:05:01 2006 for OpenSees by doxygen 1.5.0