42 #include "Epetra_ConfigDefs.h" 
   44 #include "Trilinos_Util.h" 
   46 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 
   48   const std::string                               &fileName
 
   50   ,Teuchos::RCP<Epetra_CrsMatrix>         *A
 
   51   ,Teuchos::RCP<Epetra_Map>               *map
 
   52   ,Teuchos::RCP<Epetra_Vector>            *x
 
   53   ,Teuchos::RCP<Epetra_Vector>            *b
 
   54   ,Teuchos::RCP<Epetra_Vector>            *xExact
 
   64   const std::string::size_type ext_dot = fileName.rfind(
".");
 
   65   TEUCHOS_TEST_FOR_EXCEPT( ext_dot == std::string::npos );
 
   66   std::string ext = fileName.substr(ext_dot+1);
 
   69   char *hacked_file_str = 
const_cast<char*
>(fileName.c_str());
 
   71   if ( ext == 
"triU" ) {
 
   72     const bool NonContiguousMap = 
true;
 
   73     TEUCHOS_TEST_FOR_EXCEPT(
 
   74       0!=Trilinos_Util_ReadTriples2Epetra(
 
   75         hacked_file_str, 
false, comm, readMap, readA, readx,
 
   76         readb, readxexact, NonContiguousMap
 
   80   else if ( ext == 
"triS" ) {
 
   81     const bool NonContiguousMap = 
true;
 
   82     TEUCHOS_TEST_FOR_EXCEPT(
 
   83       0!=Trilinos_Util_ReadTriples2Epetra(
 
   84         hacked_file_str, 
true, comm, readMap, readA, readx,
 
   85         readb, readxexact, NonContiguousMap
 
   89   else if( ext == 
"mtx" ) {
 
   90     TEUCHOS_TEST_FOR_EXCEPT(
 
   91       0!=Trilinos_Util_ReadMatrixMarket2Epetra(
 
   92         hacked_file_str, comm, readMap,
 
   93         readA, readx, readb, readxexact
 
   97   else if ( ext == 
"hb" ) {
 
   98     Trilinos_Util_ReadHb2Epetra(
 
   99       hacked_file_str, comm, readMap, readA, readx,
 
  104     TEUCHOS_TEST_FOR_EXCEPTION(
 
  105       true, std::logic_error
 
  106       ,
"Error, the file = \'"<<hacked_file_str<<
"\' has the extension " 
  107       "\'*."<<ext<<
"\' is not \'*.triU\', \'*.triS\', \'*.mtx\', or \'*.hb\'!" 
  111   Teuchos::RCP<Epetra_CrsMatrix>    loc_A         = Teuchos::rcp(readA);
 
  112   Teuchos::RCP<Epetra_Map>          loc_map       = Teuchos::rcp(readMap);
 
  113   Teuchos::RCP<Epetra_Vector>       loc_x         = Teuchos::rcp(readx);
 
  114   Teuchos::RCP<Epetra_Vector>       loc_b         = Teuchos::rcp(readb);
 
  115   Teuchos::RCP<Epetra_Vector>       loc_xExact    = Teuchos::rcp(readxexact);
 
  118   if(map)     *map     = loc_map;
 
  121   if(xExact)  *xExact  = loc_xExact;
 
  126 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 
  128   const std::string                               &fileName
 
  130   ,Teuchos::RCP<Epetra_CrsMatrix>         *A
 
  131   ,Teuchos::RCP<Epetra_Map>               *map
 
  132   ,Teuchos::RCP<Epetra_Vector>            *x
 
  133   ,Teuchos::RCP<Epetra_Vector>            *b
 
  134   ,Teuchos::RCP<Epetra_Vector>            *xExact
 
  144   const std::string::size_type ext_dot = fileName.rfind(
".");
 
  145   TEUCHOS_TEST_FOR_EXCEPT( ext_dot == std::string::npos );
 
  146   std::string ext = fileName.substr(ext_dot+1);
 
  149   char *hacked_file_str = 
const_cast<char*
>(fileName.c_str());
 
  151   if ( ext == 
"triU" ) {
 
  152     const bool NonContiguousMap = 
true;
 
  153     TEUCHOS_TEST_FOR_EXCEPT(
 
  154       0!=Trilinos_Util_ReadTriples2Epetra64(
 
  155         hacked_file_str, 
false, comm, readMap, readA, readx,
 
  156         readb, readxexact, NonContiguousMap
 
  160   else if ( ext == 
"triS" ) {
 
  161     const bool NonContiguousMap = 
true;
 
  162     TEUCHOS_TEST_FOR_EXCEPT(
 
  163       0!=Trilinos_Util_ReadTriples2Epetra64(
 
  164         hacked_file_str, 
true, comm, readMap, readA, readx,
 
  165         readb, readxexact, NonContiguousMap
 
  169   else if( ext == 
"mtx" ) {
 
  170     TEUCHOS_TEST_FOR_EXCEPT(
 
  171       0!=Trilinos_Util_ReadMatrixMarket2Epetra64(
 
  172         hacked_file_str, comm, readMap,
 
  173         readA, readx, readb, readxexact
 
  177   else if ( ext == 
"hb" ) {
 
  178     Trilinos_Util_ReadHb2Epetra64(
 
  179       hacked_file_str, comm, readMap, readA, readx,
 
  184     TEUCHOS_TEST_FOR_EXCEPTION(
 
  185       true, std::logic_error
 
  186       ,
"Error, the file = \'"<<hacked_file_str<<
"\' has the extension " 
  187       "\'*."<<ext<<
"\' is not \'*.triU\', \'*.triS\', \'*.mtx\', or \'*.hb\'!" 
  191   Teuchos::RCP<Epetra_CrsMatrix>    loc_A         = Teuchos::rcp(readA);
 
  192   Teuchos::RCP<Epetra_Map>          loc_map       = Teuchos::rcp(readMap);
 
  193   Teuchos::RCP<Epetra_Vector>       loc_x         = Teuchos::rcp(readx);
 
  194   Teuchos::RCP<Epetra_Vector>       loc_b         = Teuchos::rcp(readb);
 
  195   Teuchos::RCP<Epetra_Vector>       loc_xExact    = Teuchos::rcp(readxexact);
 
  198   if(map)     *map     = loc_map;
 
  201   if(xExact)  *xExact  = loc_xExact;
 
void readEpetraLinearSystem(const std::string &fileName, const Epetra_Comm &comm, Teuchos::RCP< Epetra_CrsMatrix > *A=NULL, Teuchos::RCP< Epetra_Map > *map=NULL, Teuchos::RCP< Epetra_Vector > *x=NULL, Teuchos::RCP< Epetra_Vector > *b=NULL, Teuchos::RCP< Epetra_Vector > *xExact=NULL)
Read in an Epetra linear system from a file. 
void readEpetraLinearSystem64(const std::string &fileName, const Epetra_Comm &comm, Teuchos::RCP< Epetra_CrsMatrix > *A=NULL, Teuchos::RCP< Epetra_Map > *map=NULL, Teuchos::RCP< Epetra_Vector > *x=NULL, Teuchos::RCP< Epetra_Vector > *b=NULL, Teuchos::RCP< Epetra_Vector > *xExact=NULL)