00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef NOX_EPETRA_FINITEDIFFERENCECOLORING_H
00040 #define NOX_EPETRA_FINITEDIFFERENCECOLORING_H
00041
00042 #include "Epetra_RowMatrix.h"
00043 #include "NOX_Epetra_FiniteDifference.H"
00044
00045 #include "NOX_Common.H"
00046 #include "Teuchos_RCP.hpp"
00047
00048 #include "vector"
00049 #include "list"
00050 #include "map"
00051
00052
00053 class Epetra_Comm;
00054 class Epetra_Map;
00055 class Epetra_MapColoring;
00056 class Epetra_Import;
00057 class Epetra_Vector;
00058 class Epetra_IntVector;
00059 class Epetra_CrsGraph;
00060 class Epetra_CrsMatrix;
00061
00062 namespace NOX {
00063
00064 namespace Epetra {
00065
00144 class FiniteDifferenceColoring : public FiniteDifference {
00145
00146 protected:
00147
00148 enum ColoringType { NOX_SERIAL, NOX_PARALLEL };
00149
00150 public:
00151
00153 FiniteDifferenceColoring(
00154 Teuchos::ParameterList& printingParams,
00155 const Teuchos::RCP<Interface::Required>& i,
00156 const NOX::Epetra::Vector& initialGuess,
00157 const Teuchos::RCP<Epetra_MapColoring>& colorMap,
00158 const Teuchos::RCP< vector<Epetra_IntVector> >& columns,
00159 bool parallelColoring = false,
00160 bool distance1 = false,
00161 double beta = 1.0e-6, double alpha = 1.0e-4);
00162
00164 FiniteDifferenceColoring(
00165 Teuchos::ParameterList& printingParams,
00166 const Teuchos::RCP<Interface::Required>& i,
00167 const NOX::Epetra::Vector& initialGuess,
00168 const Teuchos::RCP<Epetra_CrsGraph>& rawGraph,
00169 const Teuchos::RCP<Epetra_MapColoring>& colorMap,
00170 const Teuchos::RCP< vector<Epetra_IntVector> >& columns,
00171 bool parallelColoring = false,
00172 bool distance1 = false,
00173 double beta = 1.0e-6, double alpha = 1.0e-4);
00174
00176 virtual ~FiniteDifferenceColoring();
00177
00179 virtual bool computeJacobian(const Epetra_Vector& x, Epetra_Operator& Jac);
00180
00182 virtual bool computeJacobian(const Epetra_Vector& x);
00183
00185
00186
00188 virtual void createColorContainers();
00189
00190 protected:
00191
00193 ColoringType coloringType;
00194
00196 bool distance1;
00197
00199 Teuchos::RCP<const Epetra_MapColoring> colorMap;
00200
00202 Teuchos::RCP< vector<Epetra_IntVector> > columns;
00203
00205 int numColors;
00206
00208 int maxNumColors;
00209
00211 int* colorList;
00212
00214 list<int> listOfAllColors;
00215
00217 std::map<int, int> colorToNumMap;
00218
00220 Epetra_Map* cMap;
00221
00223 Epetra_Import* Importer;
00224
00226 Epetra_Vector* colorVect;
00227
00229 Epetra_Vector* betaColorVect;
00230
00232 Epetra_Vector* mappedColorVect;
00233
00235 Epetra_Vector* xCol_perturb;
00236
00238 const Epetra_BlockMap* columnMap;
00239
00241 Epetra_Import* rowColImporter;
00242
00243 };
00244 }
00245 }
00246
00247 #endif