| 1 |
//@HEADER |
| 2 |
//************************************************************************ |
| 3 |
// |
| 4 |
// Isorropia: Partitioning and Load Balancing Package |
| 5 |
// Copyright (2006) Sandia Corporation |
| 6 |
// |
| 7 |
//Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive |
| 8 |
//license for use of this work by or on behalf of the U.S. Government. |
| 9 |
// |
| 10 |
// Redistribution and use in source and binary forms, with or without |
| 11 |
// modification, are permitted provided that the following conditions are |
| 12 |
// met: |
| 13 |
// |
| 14 |
// 1. Redistributions of source code must retain the above copyright |
| 15 |
// notice, this list of conditions and the following disclaimer. |
| 16 |
// |
| 17 |
// 2. Redistributions in binary form must reproduce the above copyright |
| 18 |
// notice, this list of conditions and the following disclaimer in the |
| 19 |
// documentation and/or other materials provided with the distribution. |
| 20 |
// |
| 21 |
// 3. Neither the name of the Corporation nor the names of the |
| 22 |
// contributors may be used to endorse or promote products derived from |
| 23 |
// this software without specific prior written permission. |
| 24 |
// |
| 25 |
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY |
| 26 |
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 27 |
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 28 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE |
| 29 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 30 |
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 31 |
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 32 |
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 33 |
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 34 |
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 35 |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 36 |
// |
| 37 |
//************************************************************************ |
| 38 |
//@HEADER |
| 39 |
|
| 40 |
#ifndef _Isorropia_EpetraProber_hpp_ |
| 41 |
#define _Isorropia_EpetraProber_hpp_ |
| 42 |
|
| 43 |
#include <Isorropia_ConfigDefs.hpp> |
| 44 |
#include <Teuchos_ParameterList.hpp> |
| 45 |
|
| 46 |
#include <Isorropia_Colorer.hpp> |
| 47 |
#include <Isorropia_EpetraColorer.hpp> |
| 48 |
|
| 49 |
#ifdef HAVE_EPETRA |
| 50 |
#include <Epetra_CrsGraph.h> |
| 51 |
#include <Teuchos_RCP.hpp> |
| 52 |
class Epetra_MultiVector; |
| 53 |
class Epetra_CrsMatrix; |
| 54 |
class Epetra_Operator; |
| 55 |
|
| 56 |
namespace Isorropia { |
| 57 |
|
| 58 |
namespace Epetra { |
| 59 |
|
| 60 |
/** An implementation of the Prober interface that operates on |
| 61 |
Epetra matrices and linear systems. The Prober currently works only on structurally |
| 62 |
symmetric problems. Support for structually non-symmetric problems is under development. |
| 63 |
|
| 64 |
\ingroup probing_grp |
| 65 |
*/ |
| 66 |
|
| 67 |
class Prober { |
| 68 |
public: |
| 69 |
|
| 70 |
/** Constructor |
| 71 |
|
| 72 |
\param[in] input_graph the graph whose sparsity pattern is to guide the probing. |
| 73 |
\param[in] paramlist this parameter list may be used to pass parameters to the colorer. |
| 74 |
\param[in] compute_now if @c true, the coloring is computed in the constructor, otherwise call Isorropia::Epetra::Prober::color when you want to compute the coloring, defaults to @c false |
| 75 |
|
| 76 |
\ingroup probing_grp |
| 77 |
*/ |
| 78 |
|
| 79 |
Prober(Teuchos::RCP<const Epetra_CrsGraph> input_graph, |
| 80 |
const Teuchos::ParameterList& paramlist, |
| 81 |
bool compute_now=true); |
| 82 |
|
| 83 |
|
| 84 |
/** Constructor |
| 85 |
|
| 86 |
\param[in] input_graph the graph whose sparsity pattern is to guide the probing. |
| 87 |
\param[in] paramlist this parameter list may be used to pass parameters to the colorer. |
| 88 |
\param[in] compute_now if @c true, the coloring is computed in the constructor, otherwise call Isorropia::Epetra::Prober::color when you want to compute the coloring, defaults to @c false |
| 89 |
|
| 90 |
\ingroup probing_grp |
| 91 |
*/ |
| 92 |
|
| 93 |
Prober(const Epetra_CrsGraph * input_graph, |
| 94 |
const Teuchos::ParameterList& paramlist, |
| 95 |
bool compute_now=true); |
| 96 |
|
| 97 |
/** Constructor |
| 98 |
|
| 99 |
\param[in] input_matrix the matrix whose sparsity pattern is to guide the probing. |
| 100 |
\param[in] paramlist this parameter list may be used to pass parameters to the colorer. |
| 101 |
\param[in] compute_now if @c true, the coloring is computed in the constructor, otherwise call Isorropia::Epetra::Prober::color when you want to compute the coloring, defaults to @c true |
| 102 |
|
| 103 |
\ingroup probing_grp |
| 104 |
*/ |
| 105 |
|
| 106 |
Prober(Teuchos::RCP<const Epetra_CrsMatrix> input_matrix, |
| 107 |
const Teuchos::ParameterList & paramlist, |
| 108 |
bool compute_now=true); |
| 109 |
|
| 110 |
|
| 111 |
/** Constructor |
| 112 |
|
| 113 |
\param[in] input_matrix the matrix whose sparsity pattern is to guide the probing. |
| 114 |
\param[in] paramlist this parameter list may be used to pass parameters to the colorer. |
| 115 |
\param[in] compute_now if @c true, the coloring is computed in the constructor, otherwise call Isorropia::Epetra::Prober::color when you want to compute the coloring, defaults to @c true |
| 116 |
|
| 117 |
\ingroup probing_grp |
| 118 |
*/ |
| 119 |
|
| 120 |
Prober(const Epetra_CrsMatrix * input_matrix, |
| 121 |
const Teuchos::ParameterList & paramlist, |
| 122 |
bool compute_now=true); |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
/** Default Constructor |
| 127 |
*/ |
| 128 |
|
| 129 |
Prober(); |
| 130 |
|
| 131 |
|
| 132 |
/** Destructor */ |
| 133 |
~Prober(){delete colorer_;} |
| 134 |
|
| 135 |
|
| 136 |
/** Sets the parameter list */ |
| 137 |
void setList(const Teuchos::ParameterList& paramlist); |
| 138 |
|
| 139 |
/** Sets the graph */ |
| 140 |
void setGraph(Teuchos::RCP<const Epetra_CrsGraph> input_graph){input_graph_=input_graph; has_colored=false;} |
| 141 |
|
| 142 |
/** Compute the coloring. |
| 143 |
\ingroup probing_grp |
| 144 |
*/ |
| 145 |
void color(); |
| 146 |
|
| 147 |
/** Get the number of orthogonal vectors (or the number of colors from |
| 148 |
coloring) |
| 149 |
\return number of orthogonal vectors |
| 150 |
\ingroup probing_grp |
| 151 |
*/ |
| 152 |
int getNumOrthogonalVectors(); |
| 153 |
|
| 154 |
/** @ingroup probing_grp |
| 155 |
Perform the actual probing. |
| 156 |
\param[in] op is the operator we are probing |
| 157 |
\param[in,out] out_matrix is the matrix |
| 158 |
*/ |
| 159 |
int probe(const Epetra_Operator & op, Epetra_CrsMatrix & out_matrix); |
| 160 |
|
| 161 |
/** @ingroup probing_grp |
| 162 |
Perform the actual probing. |
| 163 |
\param[in] op is the operator we are probing |
| 164 |
\return RCP to the matrix |
| 165 |
*/ |
| 166 |
Teuchos::RCP<Epetra_CrsMatrix> probe(const Epetra_Operator & op); |
| 167 |
|
| 168 |
private: |
| 169 |
Teuchos::RCP<const Epetra_CrsGraph> input_graph_; |
| 170 |
Colorer *colorer_; |
| 171 |
Teuchos::ParameterList List_; |
| 172 |
bool has_colored; |
| 173 |
};//class Prober |
| 174 |
|
| 175 |
}//namespace Epetra |
| 176 |
}//namespace Isorropia |
| 177 |
|
| 178 |
#endif //HAVE_EPETRA |
| 179 |
|
| 180 |
#endif |
| 181 |
|
| 182 |
|
| 183 |
#if defined(Isorropia_SHOW_DEPRECATED_WARNINGS) |
| 184 |
#ifdef __GNUC__ |
| 185 |
#warning "The Isorropia package is deprecated" |
| 186 |
#endif |
| 187 |
#endif |
| 188 |
|