//@HEADER //************************************************************************ // // Isorropia: Partitioning and Load Balancing Package // Copyright (2006) Sandia Corporation // //Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive //license for use of this work by or on behalf of the U.S. Government. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // 3. Neither the name of the Corporation nor the names of the // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // //************************************************************************ //@HEADER #ifndef _Isorropia_EpetraPartitioner2D_hpp_ #define _Isorropia_EpetraPartitioner2D_hpp_ #include #include #include #include #include #ifdef HAVE_EPETRA class Epetra_Map; class Epetra_BlockMap; class Epetra_Import; class Epetra_Vector; class Epetra_MultiVector; class Epetra_CrsGraph; class Epetra_CrsMatrix; class Epetra_RowMatrix; class Epetra_LinearProblem; namespace Isorropia { namespace Epetra { /** An implementation of the Partitioner interface that operates on Epetra matrices and linear systems. */ class Partitioner2D : virtual public Isorropia::Partitioner2D, virtual public Isorropia::Epetra::Operator { public: /** Constructor that accepts an Epetra_CrsGraph object, called by API function create_partitioner(). \param input_graph Matrix-graph object for which a new partitioning is to be computed. A Teuchos::RefCountPtr is used here because a reference to the input object may be held by this object after this constructor completes and returns. \param paramlist Teuchos::ParameterList which will be copied to an internal ParameterList attribute. No reference to this input object is held after this constructor completes.
If the ParameterList object contains a sublist named "Zoltan", then the Zoltan library is used to perform the balancing. Also, any parameters in the "Zoltan" sublist will be relayed directly to Zoltan. Refer to the Zoltan users guide for specific parameters that Zoltan recognizes. A couple of important ones are "LB_METHOD" (valid values include "GRAPH", "HYPERGRAPH"), "DEBUG_LEVEL" (valid values are 0 to 10, default is 1), etc. \param compute_partitioning_now Optional argument defaults to true. If true, the method compute_partitioning() will be called before this constructor returns. */ Partitioner2D(Teuchos::RCP input_graph, const Teuchos::ParameterList& paramlist = Teuchos::ParameterList("EmptyParameterList"), bool compute_partitioning_now=true); /** Constructor that accepts an Epetra_RowMatrix object, called by API function create_partitioner(). \param input_matrix Matrix object for which a new partitioning is to be computed. A Teuchos::RefCountPtr is used here because a reference to the input object may be held by this object after this constructor completes and returns. \param paramlist Teuchos::ParameterList which will be copied to an internal ParameterList attribute. No reference to this input object is held after this constructor completes.
If the ParameterList object contains a sublist named "Zoltan", then the Zoltan library is used to perform the balancing. Also, any parameters in the "Zoltan" sublist will be relayed directly to Zoltan. Refer to the Zoltan users guide for specific parameters that Zoltan recognizes. A couple of important ones are "LB_METHOD" (valid values include "GRAPH", "HYPERGRAPH"), "DEBUG_LEVEL" (valid values are 0 to 10, default is 1), etc. \param compute_partitioning_now Optional argument defaults to true. If true, the method compute_partitioning() will be called before this constructor returns. */ Partitioner2D(Teuchos::RCP input_matrix, const Teuchos::ParameterList& paramlist = Teuchos::ParameterList("EmptyParameterList"), bool compute_partitioning_now=true); /** Destructor */ virtual ~Partitioner2D(); // MMW: Missing functions that are in EpetraPartioner, might need to implement //void setPartSizes(int len, int *global_part_id, float *part_size); //void clearPartSizes(); /** partition is a method that computes a rebalanced partitioning for the data in the object that this class was constructed with. \param force_repartitioning Optional argument defaults to false. By default, compute_partitioning() only does anything the first time it is called, and subsequent repeated calls are no-ops. If the user's intent is to re-compute the partitioning (e.g., if parameters or other inputs have been changed), then setting this flag to true will force a new partitioning to be computed. */ void partition(bool force_repartitioning=false); virtual void compute(bool forceRecomputing=false); /** */ int numElemsInPart(int part) const; /** */ int getNZIndx(int row, int column) const; /** global element ids to be located in the given partition. */ void elemsInPart(int part, int* elementList, int len) const; // Should add RCP versions of the below int createDomainAndRangeMaps(Epetra_Map *domainMap, Epetra_Map *rangeMap); // perhaps pass parameter lists to these? int createColumnMap(Epetra_Map* colMap); int createRowMap(Epetra_Map* rowMap); };//class Partitioner2D }//namespace Epetra }//namespace Isorropia #endif //HAVE_EPETRA #endif #if defined(Isorropia_SHOW_DEPRECATED_WARNINGS) #ifdef __GNUC__ #warning "The Isorropia package is deprecated" #endif #endif