TriUtils
Development
|
#include <Trilinos_Util_CrsMatrixGallery.h>
Public Member Functions | |
CrsMatrixGallery (const std::string name, const Epetra_Comm &comm, bool UseLongLong=false) | |
Triutils_Gallery Constructor. More... | |
CrsMatrixGallery (const std::string name, const Epetra_Map &map) | |
Creates an Triutils_Gallery object using a given map. More... | |
~CrsMatrixGallery () | |
Triutils_Gallery destructor. More... | |
int | Set (const std::string parameter, const int value) |
Sets a gallery options using an interger value. More... | |
int | Set (const std::string parameter, const std::string value) |
Sets a gallery options using a C++ string . More... | |
int | Set (const std::string parameter, const double value) |
Sets a gallery options using an double value. More... | |
int | Set (const std::string parameter, const Epetra_Vector &value) |
Sets a gallery options using an Epetra_Vector. More... | |
int | Set (Trilinos_Util::CommandLineParser &CLP) |
Sets gallery options using values passed from the shell. More... | |
Protected Member Functions | |
template<typename int_type > | |
int_type *& | MyGlobalElementsPtr () |
template<typename int_type > | |
std::vector< int_type > & | MapMapRef () |
template<> | |
long long *& | MyGlobalElementsPtr () |
template<> | |
std::vector< long long > & | MapMapRef () |
template<> | |
int *& | MyGlobalElementsPtr () |
template<> | |
std::vector< int > & | MapMapRef () |
void | CreateMap () |
Creates a map. More... | |
template<typename int_type > | |
void | TCreateMap () |
void | CreateMatrix () |
Creates the CrdMatrix. More... | |
template<typename int_type > | |
void | TCreateMatrix () |
template<typename int_type > | |
void | TCreateExactSolution () |
Creates the exact solution. More... | |
void | CreateExactSolution () |
void | CreateStartingSolution () |
Creates the starting solution. More... | |
template<typename int_type > | |
void | TCreateRHS () |
Create the RHS corresponding to the desired exact solution. More... | |
void | CreateRHS () |
template<typename int_type > | |
void | CreateEye () |
template<typename int_type > | |
void | CreateMatrixDiag () |
template<typename int_type > | |
void | CreateMatrixTriDiag () |
template<typename int_type > | |
void | CreateMatrixLaplace1d () |
template<typename int_type > | |
void | CreateMatrixLaplace1dNeumann () |
template<typename int_type > | |
void | CreateMatrixCrossStencil2d () |
template<typename int_type > | |
void | CreateMatrixCrossStencil2dVector () |
template<typename int_type > | |
void | CreateMatrixLaplace2d () |
template<typename int_type > | |
void | CreateMatrixLaplace2d_BC () |
template<typename int_type > | |
void | CreateMatrixLaplace2d_9pt () |
template<typename int_type > | |
void | CreateMatrixStretched2d () |
template<typename int_type > | |
void | CreateMatrixRecirc2d () |
template<typename int_type > | |
void | CreateMatrixRecirc2dDivFree () |
template<typename int_type > | |
void | CreateMatrixLaplace2dNeumann () |
template<typename int_type > | |
void | CreateMatrixUniFlow2d () |
template<typename int_type > | |
void | CreateMatrixLaplace3d () |
template<typename int_type > | |
void | CreateMatrixCrossStencil3d () |
template<typename int_type > | |
void | CreateMatrixCrossStencil3dVector () |
template<typename int_type > | |
void | CreateMatrixLehmer () |
template<typename int_type > | |
void | CreateMatrixMinij () |
template<typename int_type > | |
void | CreateMatrixRis () |
template<typename int_type > | |
void | CreateMatrixHilbert () |
template<typename int_type > | |
void | CreateMatrixJordblock () |
template<typename int_type > | |
void | CreateMatrixCauchy () |
template<typename int_type > | |
void | CreateMatrixFiedler () |
template<typename int_type > | |
void | CreateMatrixHanowa () |
template<typename int_type > | |
void | CreateMatrixKMS () |
template<typename int_type > | |
void | CreateMatrixParter () |
template<typename int_type > | |
void | CreateMatrixPei () |
template<typename int_type > | |
void | CreateMatrixOnes () |
template<typename int_type > | |
void | CreateMatrixVander () |
template<typename int_type > | |
void | TReadMatrix () |
void | GetNeighboursCartesian2d (const int i, const int nx, const int ny, int &left, int &right, int &lower, int &upper) |
void | GetNeighboursCartesian3d (const int i, const int nx, const int ny, const int nz, int &left, int &right, int &lower, int &upper, int &below, int &above) |
template<typename int_type > | |
void | TGetCartesianCoordinates (double *&x, double *&y, double *&z) |
void | ZeroOutData () |
void | SetupCartesianGrid2D () |
void | SetupCartesianGrid3D () |
void | ExactSolQuadXY (double x, double y, double &u) |
void | ExactSolQuadXY (double x, double y, double &u, double &ux, double &uy, double &uxx, double &uyy) |
Protected Attributes | |
const Epetra_Comm * | comm_ |
Epetra_CrsMatrix * | matrix_ |
Epetra_MultiVector * | ExactSolution_ |
Epetra_MultiVector * | StartingSolution_ |
Epetra_MultiVector * | rhs_ |
Epetra_Map * | map_ |
Epetra_LinearProblem * | LinearProblem_ |
std::string | name_ |
long long | NumGlobalElements_ |
int | NumMyElements_ |
int * | MyGlobalElements_int_ |
std::vector< int > | MapMap_int_ |
long long * | MyGlobalElements_LL_ |
std::vector< long long > | MapMap_LL_ |
std::string | MapType_ |
bool | ContiguousMap_ |
std::string | ExactSolutionType_ |
std::string | StartingSolutionType_ |
std::string | ExpandType_ |
std::string | RhsType_ |
int | nx_ |
int | ny_ |
int | nz_ |
int | mx_ |
int | my_ |
int | mz_ |
double | lx_ |
double | ly_ |
double | lz_ |
int | NumPDEEqns_ |
int | NumVectors_ |
Epetra_Vector * | VectorA_ |
Epetra_Vector * | VectorB_ |
Epetra_Vector * | VectorC_ |
Epetra_Vector * | VectorD_ |
Epetra_Vector * | VectorE_ |
Epetra_Vector * | VectorF_ |
Epetra_Vector * | VectorG_ |
double | a_ |
double | b_ |
double | c_ |
double | d_ |
double | e_ |
double | f_ |
double | g_ |
double | alpha_ |
double | beta_ |
double | gamma_ |
double | delta_ |
double | conv_ |
double | diff_ |
double | source_ |
double | epsilon_ |
std::string | FileName_ |
std::string | ErrorMsg |
std::string | OutputMsg |
bool | verbose_ |
bool | UseLongLong_ |
Epetra_CrsMatrix * | GetMatrix () |
Returns a pointer to the CrsMatrix. More... | |
Epetra_CrsMatrix & | GetMatrixRef () |
Epetra_MultiVector * | GetExactSolution () |
Returns a pointer to the exact solution. More... | |
Epetra_MultiVector * | GetStartingSolution () |
Returns a pointer to the starting solution (typically, for HB problems). More... | |
Epetra_MultiVector * | GetRHS () |
Returns a pointer to the rhs corresponding to the selected exact solution. More... | |
const Epetra_Map * | GetMap () |
Returns a pointer the internally stored Map. More... | |
const Epetra_Map & | GetMapRef () |
Epetra_LinearProblem * | GetLinearProblem () |
Returns a pointer to Epetra_LinearProblem. More... | |
void | ComputeResidual (double *residual) |
Computes the 2-norm of the residual. More... | |
void | ComputeDiffBetweenStartingAndExactSolutions (double *residual) |
Computes the 2-norm of the difference between the starting solution and the exact solution. More... | |
void | PrintMatrixAndVectors (std::ostream &os) |
Print out matrix and vectors. More... | |
void | PrintMatrixAndVectors () |
void | GetCartesianCoordinates (double *&x, double *&y, double *&z) |
Get pointers to double vectors containing coordinates of points. More... | |
int | WriteMatrix (const std::string &FileName, const bool UseSparse=true) |
Print matrix on file in MATLAB format. More... | |
std::ostream & | operator<< (std::ostream &os, const Trilinos_Util::CrsMatrixGallery &G) |
Print out detailed information about the problem at hand. More... | |
Trilinos_Util::CrsMatrixGallery::CrsMatrixGallery | ( | const std::string | name, |
const Epetra_Comm & | comm, | ||
bool | UseLongLong = false |
||
) |
Triutils_Gallery Constructor.
Creates a Triutils_Gallery instance.
The first parameter is the name of the matrix. We refer to the Trilinos Tutorial for a detailed description of available matrices.
An example of program using this class is reported below.
Class CommandLineParser can be used as well. In this case, one may decide to use the following:
In | comm - Epetra communicator |
Trilinos_Util::CrsMatrixGallery::CrsMatrixGallery | ( | const std::string | name, |
const Epetra_Map & | map | ||
) |
Creates an Triutils_Gallery object using a given map.
Create a Triutils_Gallery object using an Epetra_Map. Problem size must match the elements in map.
In | name - definition of the problem to be created. |
In | map - Epetra_Map |
Trilinos_Util::CrsMatrixGallery::~CrsMatrixGallery | ( | void | ) |
Triutils_Gallery destructor.
References ExactSolution_, LinearProblem_, map_, matrix_, rhs_, StartingSolution_, VectorA_, VectorB_, VectorC_, VectorD_, VectorE_, VectorF_, VectorG_, and ZeroOutData().
void Trilinos_Util::CrsMatrixGallery::ComputeDiffBetweenStartingAndExactSolutions | ( | double * | residual | ) |
Computes the 2-norm of the difference between the starting solution and the exact solution.
void Trilinos_Util::CrsMatrixGallery::ComputeResidual | ( | double * | residual | ) |
Computes the 2-norm of the residual.
|
protected |
|
protected |
|
protected |
Creates a map.
Creates an Epetra_Map. Before calling this function, the problem
size must have been specified.
CreateMap() allows some different maps. The type of map is set using Set("map",value). Value is a string, defined as:
|
protected |
Creates the CrdMatrix.
|
protected |
References Copy.
|
protected |
|
protected |
References Copy.
|
protected |
|
protected |
References Copy, and TEUCHOS_TEST_FOR_EXCEPT_MSG.
|
protected |
|
protected |
References Copy.
|
protected |
References Copy, TEUCHOS_TEST_FOR_EXCEPT_MSG, and UNDEF.
|
protected |
References Copy.
|
protected |
|
protected |
|
protected |
|
protected |
References Copy.
|
protected |
References Scaling.
|
protected |
References Copy.
|
protected |
References Copy.
|
protected |
References Copy.
|
protected |
|
protected |
References Copy.
|
protected |
References Copy.
|
protected |
|
protected |
References Copy.
|
protected |
References Copy.
|
protected |
References UNDEF.
|
protected |
References UNDEF.
|
protected |
References Copy.
|
protected |
|
protected |
|
protected |
References UNDEF.
|
protected |
References Copy.
|
protected |
|
protected |
Creates the starting solution.
References TEUCHOS_TEST_FOR_EXCEPT_MSG.
|
protected |
|
protected |
void Trilinos_Util::CrsMatrixGallery::GetCartesianCoordinates | ( | double *& | x, |
double *& | y, | ||
double *& | z | ||
) |
Get pointers to double vectors containing coordinates of points.
Epetra_MultiVector * Trilinos_Util::CrsMatrixGallery::GetExactSolution | ( | void | ) |
Returns a pointer to the exact solution.
Returns a pointer to the exact solution.
Some choices are available to define the exact solution, using Set("exact solution", value). value can be:
Epetra_LinearProblem * Trilinos_Util::CrsMatrixGallery::GetLinearProblem | ( | void | ) |
Returns a pointer to Epetra_LinearProblem.
const Epetra_Map * Trilinos_Util::CrsMatrixGallery::GetMap | ( | void | ) |
Returns a pointer the internally stored Map.
const Epetra_Map & Trilinos_Util::CrsMatrixGallery::GetMapRef | ( | void | ) |
Epetra_CrsMatrix * Trilinos_Util::CrsMatrixGallery::GetMatrix | ( | void | ) |
Returns a pointer to the CrsMatrix.
Epetra_CrsMatrix & Trilinos_Util::CrsMatrixGallery::GetMatrixRef | ( | void | ) |
|
protected |
|
protected |
Epetra_MultiVector * Trilinos_Util::CrsMatrixGallery::GetRHS | ( | void | ) |
Returns a pointer to the rhs corresponding to the selected exact solution.
Epetra_MultiVector * Trilinos_Util::CrsMatrixGallery::GetStartingSolution | ( | void | ) |
Returns a pointer to the starting solution (typically, for HB problems).
Returns a pointer to the starting solution. This is typically used while reading a HB problem. However, the user can set a starting solution using Set("starting solution", "value"). Value can be
|
protected |
|
inlineprotected |
|
inlineprotected |
|
protected |
|
inlineprotected |
|
inlineprotected |
void Trilinos_Util::CrsMatrixGallery::PrintMatrixAndVectors | ( | std::ostream & | os | ) |
Print out matrix and vectors.
void Trilinos_Util::CrsMatrixGallery::PrintMatrixAndVectors | ( | ) |
int Trilinos_Util::CrsMatrixGallery::Set | ( | const std::string | parameter, |
const int | value | ||
) |
Sets a gallery options using an interger value.
int Trilinos_Util::CrsMatrixGallery::Set | ( | const std::string | parameter, |
const std::string | value | ||
) |
Sets a gallery options using a C++ string .
int Trilinos_Util::CrsMatrixGallery::Set | ( | const std::string | parameter, |
const double | value | ||
) |
Sets a gallery options using an double value.
int Trilinos_Util::CrsMatrixGallery::Set | ( | const std::string | parameter, |
const Epetra_Vector & | value | ||
) |
Sets a gallery options using an Epetra_Vector.
Sets a gallery options using an Epetra_Vector. The Epetra_Vector
is copied into internal structures, and freed by the destructor.
int Trilinos_Util::CrsMatrixGallery::Set | ( | Trilinos_Util::CommandLineParser & | CLP | ) |
Sets gallery options using values passed from the shell.
References Trilinos_Util_Map::Get(), and Trilinos_Util_Map::Has().
|
protected |
References TEUCHOS_TEST_FOR_EXCEPT_MSG.
|
protected |
References TEUCHOS_TEST_FOR_EXCEPT_MSG.
|
protected |
Creates the exact solution.
References TEUCHOS_TEST_FOR_EXCEPT_MSG.
|
protected |
|
protected |
References Epetra_Time::ElapsedTime(), and TEUCHOS_TEST_FOR_EXCEPT_MSG.
|
protected |
Create the RHS corresponding to the desired exact solution.
References Epetra_Time::ElapsedTime(), TEUCHOS_TEST_FOR_EXCEPT_MSG, and UNDEF.
|
protected |
References TEUCHOS_TEST_FOR_EXCEPT_MSG.
|
protected |
References Add, Copy, Epetra_CrsMatrix::ExtractMyRowView(), Epetra_CrsMatrix::MaxNumEntries(), Epetra_BlockMap::NumMyElements(), TEUCHOS_ASSERT, TEUCHOS_TEST_FOR_EXCEPT_MSG, Trilinos_Util_ReadHb2Epetra(), Trilinos_Util_ReadHb2Epetra64(), Trilinos_Util_ReadMatrixMarket2Epetra(), Trilinos_Util_ReadMatrixMarket2Epetra64(), Trilinos_Util_ReadTriples2Epetra(), and Trilinos_Util_ReadTriples2Epetra64().
int Trilinos_Util::CrsMatrixGallery::WriteMatrix | ( | const std::string & | FileName, |
const bool | UseSparse = true |
||
) |
Print matrix on file in MATLAB format.
|
protected |
References UNDEF.
Referenced by ~CrsMatrixGallery().
|
friend |
Print out detailed information about the problem at hand.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by Trilinos_Util::operator<<().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by Trilinos_Util::operator<<(), and ~CrsMatrixGallery().
|
protected |
Referenced by Trilinos_Util::operator<<().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by ~CrsMatrixGallery().
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by ~CrsMatrixGallery().
|
protected |
|
protected |
|
protected |
Referenced by Trilinos_Util::operator<<().
|
protected |
Referenced by Trilinos_Util::operator<<(), and ~CrsMatrixGallery().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by Trilinos_Util::operator<<().
|
protected |
Referenced by Trilinos_Util::operator<<().
|
protected |
|
protected |
Referenced by Trilinos_Util::operator<<().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by Trilinos_Util::operator<<(), and ~CrsMatrixGallery().
|
protected |
|
protected |
|
protected |
Referenced by ~CrsMatrixGallery().
|
protected |
|
protected |
|
protected |
Referenced by ~CrsMatrixGallery().
|
protected |
Referenced by ~CrsMatrixGallery().
|
protected |
Referenced by ~CrsMatrixGallery().
|
protected |
Referenced by ~CrsMatrixGallery().
|
protected |
Referenced by ~CrsMatrixGallery().
|
protected |
Referenced by ~CrsMatrixGallery().
|
protected |
Referenced by ~CrsMatrixGallery().
|
protected |