FEI Version of the Day
fei_Trilinos_Helpers.cpp
00001 /*
00002 // @HEADER
00003 // ************************************************************************
00004 //             FEI: Finite Element Interface to Linear Solvers
00005 //                  Copyright (2005) Sandia Corporation.
00006 //
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the
00008 // U.S. Government retains certain rights in this software.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Alan Williams (william@sandia.gov) 
00038 //
00039 // ************************************************************************
00040 // @HEADER
00041 */
00042 
00043 #include <fei_macros.hpp>
00044 
00045 #include <fei_Include_Trilinos.hpp>
00046 
00047 #ifdef HAVE_FEI_EPETRA
00048 #include <fei_VectorTraits_Epetra.hpp>
00049 #include <fei_MatrixTraits_Epetra.hpp>
00050 #include <fei_LinProbMgr_EpetraBasic.hpp>
00051 #endif
00052 
00053 #include <fei_Trilinos_Helpers.hpp>
00054 #include <fei_ParameterSet.hpp>
00055 #include <fei_Vector_Impl.hpp>
00056 #include <fei_VectorReducer.hpp>
00057 #include <fei_Matrix_Impl.hpp>
00058 #include <fei_MatrixReducer.hpp>
00059 //#include <EpetraExt_BlockMapOut.h>
00060 
00061 namespace Trilinos_Helpers {
00062 
00063 #ifdef HAVE_FEI_EPETRA
00064 
00065 Epetra_Map
00066 create_Epetra_Map(MPI_Comm comm,
00067                   const std::vector<int>& local_eqns)
00068 {
00069 #ifndef FEI_SER
00070   Epetra_MpiComm EComm(comm);
00071 #else
00072   Epetra_SerialComm EComm;
00073 #endif
00074 
00075   int localSize = local_eqns.size();
00076   int globalSize = 0;
00077   EComm.SumAll(&localSize, &globalSize, 1);
00078 
00079   if (localSize < 0 || globalSize < 0) {
00080     throw std::runtime_error("Trilinos_Helpers::create_Epetra_Map: negative local or global size.");
00081   }
00082 
00083   Epetra_Map EMap(globalSize, localSize, 0, EComm);
00084   return(EMap);
00085 }
00086 
00087 Epetra_BlockMap
00088 create_Epetra_BlockMap(const fei::SharedPtr<fei::VectorSpace>& vecspace)
00089 {
00090   if (vecspace.get() == 0) {
00091     throw std::runtime_error("create_Epetra_Map needs non-null fei::VectorSpace");
00092   }
00093 
00094 #ifndef FEI_SER
00095   MPI_Comm comm = vecspace->getCommunicator();
00096   Epetra_MpiComm EComm(comm);
00097 #else
00098   Epetra_SerialComm EComm;
00099 #endif
00100 
00101   int localSizeBlk = vecspace->getNumBlkIndices_Owned();
00102   int globalSizeBlk = vecspace->getGlobalNumBlkIndices();
00103 
00104   if (localSizeBlk < 0 || globalSizeBlk < 0) {
00105     throw std::runtime_error("Trilinos_Helpers::create_Epetra_BlockMap: fei::VectorSpace has negative local or global size.");
00106   }
00107 
00108   std::vector<int> blkEqns(localSizeBlk*2);
00109   int* blkEqnsPtr = &(blkEqns[0]);
00110 
00111   int chkNum = 0;
00112   int errcode = vecspace->getBlkIndices_Owned(localSizeBlk,
00113                 blkEqnsPtr, blkEqnsPtr+localSizeBlk,
00114                 chkNum);
00115   if (errcode != 0) {
00116     FEI_OSTRINGSTREAM osstr;
00117     osstr << "create_Epetra_BlockMap ERROR, nonzero errcode="<<errcode
00118     << " returned by vecspace->getBlkIndices_Owned.";
00119     throw std::runtime_error(osstr.str());
00120   }
00121 
00122   Epetra_BlockMap EBMap(globalSizeBlk, localSizeBlk,
00123       blkEqnsPtr, blkEqnsPtr+localSizeBlk, 0, EComm);
00124 
00125   return(EBMap);
00126 }
00127 
00128 Epetra_CrsGraph
00129 create_Epetra_CrsGraph(const fei::SharedPtr<fei::MatrixGraph>& matgraph,
00130            bool blockEntries, bool orderRowsWithLocalColsFirst)
00131 {
00132   fei::SharedPtr<fei::SparseRowGraph> localSRGraph =
00133     matgraph->createGraph(blockEntries);
00134   if (localSRGraph.get() == NULL) {
00135     throw std::runtime_error("create_Epetra_CrsGraph ERROR in fei::MatrixGraph::createGraph");
00136   }
00137 
00138   int numLocallyOwnedRows = localSRGraph->rowNumbers.size();
00139   int* rowNumbers = &(localSRGraph->rowNumbers[0]);
00140   int* rowOffsets = &(localSRGraph->rowOffsets[0]);
00141   int* packedColumnIndices = &(localSRGraph->packedColumnIndices[0]);
00142 
00143   fei::SharedPtr<fei::VectorSpace> vecspace = matgraph->getRowSpace();
00144   MPI_Comm comm = vecspace->getCommunicator();
00145   std::vector<int>& local_eqns = localSRGraph->rowNumbers;
00146 
00147   Epetra_BlockMap emap = blockEntries ?
00148     create_Epetra_BlockMap(vecspace) : create_Epetra_Map(comm, local_eqns);
00149 
00150   if (orderRowsWithLocalColsFirst == true &&
00151       emap.Comm().NumProc() > 2 && !blockEntries) {
00152     bool* used_row = new bool[local_eqns.size()];
00153     for(unsigned ii=0; ii<local_eqns.size(); ++ii) used_row[ii] = false;
00154 
00155     int offset = 0;
00156     std::vector<int> ordered_local_eqns(local_eqns.size());
00157     for(unsigned ii=0; ii<local_eqns.size(); ++ii) {
00158       bool row_has_off_proc_cols = false;
00159       for(int j=rowOffsets[ii]; j<rowOffsets[ii+1]; ++j) {
00160         if (emap.MyGID(packedColumnIndices[j]) == false) {
00161           row_has_off_proc_cols = true;
00162           break;
00163         }
00164       }
00165 
00166       if (row_has_off_proc_cols == false) {
00167         ordered_local_eqns[offset++] = rowNumbers[ii];
00168         used_row[ii] = true;
00169       }
00170     }
00171 
00172     for(unsigned ii=0; ii<local_eqns.size(); ++ii) {
00173       if (used_row[ii] == true) continue;
00174       ordered_local_eqns[offset++] = rowNumbers[ii];
00175     }
00176 
00177     emap = create_Epetra_Map(comm, ordered_local_eqns);
00178     delete [] used_row;
00179   }
00180 
00181 //  EpetraExt::BlockMapToMatrixMarketFile("EBMap.np12.mm",emap,"AriaTest");
00182 
00183   std::vector<int> rowLengths; rowLengths.reserve(numLocallyOwnedRows);
00184   for(int ii=0; ii<numLocallyOwnedRows; ++ii) {
00185     rowLengths.push_back(rowOffsets[ii+1]-rowOffsets[ii]);
00186   }
00187 
00188   bool staticProfile = true;
00189   Epetra_CrsGraph egraph(Copy, emap, &(rowLengths[0]), staticProfile);
00190 
00191   const Epetra_Comm& ecomm = emap.Comm();
00192   int localProc = ecomm.MyPID();
00193 
00194   int firstLocalEqn = numLocallyOwnedRows > 0 ? rowNumbers[0] : -1;
00195 
00196   int offset = 0;
00197   for(int i=0; i<numLocallyOwnedRows; ++i) {
00198     int err = egraph.InsertGlobalIndices(firstLocalEqn+i,
00199            rowLengths[i],
00200            &(packedColumnIndices[offset]));
00201     if (err != 0) {
00202       fei::console_out() << "proc " << localProc << " err-return " << err
00203                << " inserting row " << firstLocalEqn+i<<", cols ";
00204       for(int ii=0; ii<rowLengths[i]; ++ii) {
00205   fei::console_out() << packedColumnIndices[offset+ii]<<",";
00206       }
00207       fei::console_out() << FEI_ENDL;
00208       throw std::runtime_error("... occurred in create_Epetra_CrsGraph");
00209     }
00210 
00211     offset += rowLengths[i];
00212   }
00213 
00214   //Epetra_BlockMap* domainmap = const_cast<Epetra_BlockMap*>(&(epetraGraph_->DomainMap()));
00215   //Epetra_BlockMap* rangemap = const_cast<Epetra_BlockMap*>(&(epetraGraph_->RangeMap()));
00216   egraph.FillComplete();
00217 
00218   return(egraph);
00219 }
00220 
00221 fei::SharedPtr<fei::Matrix>
00222 create_from_Epetra_Matrix(fei::SharedPtr<fei::MatrixGraph> matrixGraph,
00223                           bool blockEntryMatrix,
00224                           fei::SharedPtr<fei::Reducer> reducer,
00225                           bool orderRowsWithLocalColsFirst)
00226 {
00227   fei::SharedPtr<fei::VectorSpace> vecSpace = matrixGraph->getRowSpace();
00228   //localSize is in point-equations, because we will only use it for constructing
00229   //the fei::Matrix_Impl, and those always deal in point-equations.
00230   int localSize = vecSpace->getNumIndices_Owned();
00231 
00232   fei::SharedPtr<fei::Matrix> tmpmat;
00233   fei::SharedPtr<fei::Matrix> feimat;
00234   try {
00235     Epetra_CrsGraph egraph =
00236       Trilinos_Helpers::create_Epetra_CrsGraph(matrixGraph, blockEntryMatrix,
00237                                                orderRowsWithLocalColsFirst);
00238 
00239     if (blockEntryMatrix) {
00240       fei::SharedPtr<Epetra_VbrMatrix>
00241         epetraMatrix(new Epetra_VbrMatrix(Copy, egraph));
00242 
00243       tmpmat.reset(new fei::Matrix_Impl<Epetra_VbrMatrix>(epetraMatrix,
00244                                                    matrixGraph, localSize));
00245       zero_Epetra_VbrMatrix(epetraMatrix.get());
00246     }
00247     else {
00248       fei::SharedPtr<Epetra_CrsMatrix>
00249         epetraMatrix(new Epetra_CrsMatrix(Copy, egraph));
00250 
00251       tmpmat.reset(new fei::Matrix_Impl<Epetra_CrsMatrix>(epetraMatrix,
00252                                           matrixGraph, localSize));
00253     }
00254   }
00255   catch(std::runtime_error& exc) {
00256     fei::console_out() << "Trilinos_Helpers::create_from_Epetra_Matrix ERROR, "
00257            << "caught exception: '" << exc.what() << "', rethrowing..."
00258            << FEI_ENDL;
00259     throw exc;
00260   }
00261 
00262   if (reducer.get() != NULL) {
00263     feimat.reset(new fei::MatrixReducer(reducer, tmpmat));
00264   }
00265   else {
00266     feimat = tmpmat;
00267   }
00268 
00269   return(feimat);
00270 }
00271 
00272 fei::SharedPtr<fei::Matrix>
00273 create_from_LPM_EpetraBasic(fei::SharedPtr<fei::MatrixGraph> matrixGraph,
00274                             bool blockEntryMatrix,
00275                             fei::SharedPtr<fei::Reducer> reducer,
00276                             fei::SharedPtr<fei::LinearProblemManager>
00277                               lpm_epetrabasic)
00278 {
00279   fei::SharedPtr<fei::SparseRowGraph> srgraph =
00280     matrixGraph->createGraph(blockEntryMatrix);
00281   if (srgraph.get() == NULL) {
00282     throw std::runtime_error("create_LPM_EpetraBasic ERROR in fei::MatrixGraph::createGraph");
00283   }
00284 
00285   fei::SharedPtr<fei::SparseRowGraph> sharedsrg(srgraph);
00286   int localSize;
00287   if (reducer.get() != NULL) {
00288     std::vector<int>& reduced_eqns = reducer->getLocalReducedEqns();
00289     lpm_epetrabasic->setRowDistribution(reduced_eqns);
00290     lpm_epetrabasic->setMatrixGraph(sharedsrg);
00291     localSize = reduced_eqns.size();
00292   }
00293   else {
00294     fei::SharedPtr<fei::VectorSpace> vecSpace = matrixGraph->getRowSpace();
00295     int err = 0,chkNum;
00296     std::vector<int> indices;
00297     if (blockEntryMatrix) {
00298       localSize = vecSpace->getNumBlkIndices_Owned();
00299       indices.resize(localSize*2);
00300       err = vecSpace->getBlkIndices_Owned(localSize, &indices[0],
00301                                   &indices[localSize], chkNum);
00302     }
00303     else {
00304       localSize = vecSpace->getNumIndices_Owned();
00305       indices.resize(localSize);
00306       err = vecSpace->getIndices_Owned(indices);
00307     }
00308     if (err != 0) {
00309       throw std::runtime_error("Factory_Trilinos: createMatrix: error in vecSpace->getIndices_Owned");
00310     }
00311 
00312     lpm_epetrabasic->setRowDistribution(indices);
00313     lpm_epetrabasic->setMatrixGraph(sharedsrg);
00314   }
00315 
00316   fei::SharedPtr<fei::Matrix> tmpmat(new fei::Matrix_Impl<fei::LinearProblemManager>(lpm_epetrabasic, matrixGraph, localSize));
00317 
00318   fei::SharedPtr<fei::Matrix> feimat;
00319 
00320   if (reducer.get() != NULL) {
00321     feimat.reset(new fei::MatrixReducer(reducer, tmpmat));
00322   }
00323   else {
00324     feimat = tmpmat;
00325   }
00326 
00327   return(feimat);
00328 }
00329 #endif //HAVE_FEI_EPETRA
00330 
00331 void copy_parameterset(const fei::ParameterSet& paramset,
00332                        Teuchos::ParameterList& paramlist)
00333 {
00334   fei::ParameterSet::const_iterator
00335     iter = paramset.begin(),
00336     iter_end = paramset.end();
00337 
00338   for(; iter != iter_end; ++iter) {
00339     const fei::Param& param = *iter;
00340     fei::Param::ParamType ptype = param.getType();
00341     switch(ptype) {
00342     case fei::Param::STRING:
00343       paramlist.set(param.getName(), param.getStringValue());
00344       break;
00345     case fei::Param::DOUBLE:
00346       paramlist.set(param.getName(), param.getDoubleValue());
00347       break;
00348     case fei::Param::INT:
00349       paramlist.set(param.getName(), param.getIntValue());
00350       break;
00351     case fei::Param::BOOL:
00352       paramlist.set(param.getName(), param.getBoolValue());
00353       break;
00354     default:
00355       break;
00356     }
00357   }
00358 }
00359 
00360 void copy_parameterlist(const Teuchos::ParameterList& paramlist,
00361                         fei::ParameterSet& paramset)
00362 {
00363   Teuchos::ParameterList::ConstIterator
00364     iter = paramlist.begin(),
00365     iter_end = paramlist.end();
00366 
00367   for(; iter != iter_end; ++iter) {
00368     const Teuchos::ParameterEntry& param = paramlist.entry(iter);
00369     if (param.isType<std::string>()) {
00370       paramset.add(fei::Param(paramlist.name(iter).c_str(), Teuchos::getValue<std::string>(param).c_str()));
00371     }
00372     else if (param.isType<double>()) {
00373       paramset.add(fei::Param(paramlist.name(iter).c_str(), Teuchos::getValue<double>(param)));
00374     }
00375     else if (param.isType<int>()) {
00376       paramset.add(fei::Param(paramlist.name(iter).c_str(), Teuchos::getValue<int>(param)));
00377     }
00378     else if (param.isType<bool>()) {
00379       paramset.add(fei::Param(paramlist.name(iter).c_str(), Teuchos::getValue<bool>(param)));
00380     }
00381   }
00382 }
00383 
00384 #ifdef HAVE_FEI_EPETRA
00385 
00386 Epetra_MultiVector*
00387 get_Epetra_MultiVector(fei::Vector* feivec, bool soln_vec)
00388 {
00389   fei::Vector* vecptr = feivec;
00390   fei::VectorReducer* feireducer = dynamic_cast<fei::VectorReducer*>(feivec);
00391   if (feireducer != NULL) vecptr = feireducer->getTargetVector().get();
00392 
00393   fei::Vector_Impl<Epetra_MultiVector>* fei_epetra_vec =
00394     dynamic_cast<fei::Vector_Impl<Epetra_MultiVector>*>(vecptr);
00395   fei::Vector_Impl<fei::LinearProblemManager>* fei_lpm =
00396     dynamic_cast<fei::Vector_Impl<fei::LinearProblemManager>*>(vecptr);
00397 
00398   if (fei_epetra_vec == NULL && fei_lpm == NULL) {
00399     throw std::runtime_error("failed to obtain Epetra_MultiVector from fei::Vector.");
00400   }
00401 
00402   if (fei_epetra_vec != NULL) {
00403     return( fei_epetra_vec->getUnderlyingVector());
00404   }
00405 
00406   LinProbMgr_EpetraBasic* lpm_epetrabasic =
00407     dynamic_cast<LinProbMgr_EpetraBasic*>(fei_lpm->getUnderlyingVector());
00408   if (lpm_epetrabasic == 0) {
00409     throw std::runtime_error("fei Trilinos_Helpers: ERROR getting LinProbMgr_EpetraBasic");
00410   }
00411 
00412   if (soln_vec) {
00413     return(lpm_epetrabasic->get_solution_vector().get());
00414   }
00415 
00416   return(lpm_epetrabasic->get_rhs_vector().get());
00417 }
00418 
00419 Epetra_VbrMatrix* get_Epetra_VbrMatrix(fei::Matrix* feimat)
00420 {
00421   fei::Matrix_Impl<Epetra_VbrMatrix>* fei_epetra_vbr =
00422     dynamic_cast<fei::Matrix_Impl<Epetra_VbrMatrix>*>(feimat);
00423   fei::MatrixReducer* feireducer =
00424     dynamic_cast<fei::MatrixReducer*>(feimat);
00425 
00426   if (feireducer != NULL) {
00427     fei::SharedPtr<fei::Matrix> feimat2 = feireducer->getTargetMatrix();
00428     fei_epetra_vbr =
00429       dynamic_cast<fei::Matrix_Impl<Epetra_VbrMatrix>*>(feimat2.get());
00430   }
00431 
00432   if (fei_epetra_vbr == NULL) {
00433     throw std::runtime_error("failed to obtain Epetra_VbrMatrix from fei::Matrix.");
00434   }
00435 
00436   return(fei_epetra_vbr->getMatrix().get());
00437 }
00438 
00439 Epetra_CrsMatrix* get_Epetra_CrsMatrix(fei::Matrix* feimat)
00440 {
00441   fei::Matrix_Impl<Epetra_CrsMatrix>* fei_epetra_crs =
00442     dynamic_cast<fei::Matrix_Impl<Epetra_CrsMatrix>*>(feimat);
00443   fei::Matrix_Impl<fei::LinearProblemManager>* fei_lpm =
00444     dynamic_cast<fei::Matrix_Impl<fei::LinearProblemManager>*>(feimat);
00445   fei::MatrixReducer* feireducer =
00446     dynamic_cast<fei::MatrixReducer*>(feimat);
00447 
00448   if (feireducer != NULL) {
00449     fei::SharedPtr<fei::Matrix> feimat2 = feireducer->getTargetMatrix();
00450     fei_epetra_crs =
00451       dynamic_cast<fei::Matrix_Impl<Epetra_CrsMatrix>*>(feimat2.get());
00452     fei_lpm =
00453       dynamic_cast<fei::Matrix_Impl<fei::LinearProblemManager>*>(feimat2.get());
00454   }
00455 
00456   if (fei_epetra_crs == NULL && fei_lpm == NULL) {
00457     throw std::runtime_error("failed to obtain Epetra_CrsMatrix from fei::Matrix.");
00458   }
00459 
00460   if (fei_epetra_crs != NULL) {
00461     return(fei_epetra_crs->getMatrix().get());
00462   }
00463 
00464   LinProbMgr_EpetraBasic* lpm_epetrabasic =
00465     dynamic_cast<LinProbMgr_EpetraBasic*>(fei_lpm->getMatrix().get());
00466   if (lpm_epetrabasic == 0) {
00467     throw std::runtime_error("fei Trilinos_Helpers ERROR getting LinProbMgr_EpetraBasic");
00468   }
00469 
00470   return(lpm_epetrabasic->get_A_matrix().get());
00471 }
00472 
00473 
00474 void get_Epetra_pointers(fei::SharedPtr<fei::Matrix> feiA,
00475                          fei::SharedPtr<fei::Vector> feix,
00476                          fei::SharedPtr<fei::Vector> feib,
00477                          Epetra_CrsMatrix*& crsA,
00478                          Epetra_Operator*& opA,
00479                          Epetra_MultiVector*& x,
00480                          Epetra_MultiVector*& b)
00481 {
00482   x = get_Epetra_MultiVector(feix.get(), true);
00483   b = get_Epetra_MultiVector(feib.get(), false);
00484 
00485   const char* matname = feiA->typeName();
00486   if (!strcmp(matname, "Epetra_VbrMatrix")) {
00487     Epetra_VbrMatrix* A = get_Epetra_VbrMatrix(feiA.get());
00488     opA = A;
00489   }
00490   else {
00491     crsA = get_Epetra_CrsMatrix(feiA.get());
00492     opA = crsA;
00493   }
00494 }
00495 
00496 int zero_Epetra_VbrMatrix(Epetra_VbrMatrix* mat)
00497 {
00498   const Epetra_CrsGraph& crsgraph = mat->Graph();
00499   const Epetra_BlockMap& rowmap = crsgraph.RowMap();
00500   const Epetra_BlockMap& colmap = crsgraph.ColMap();
00501   mat->RowMatrixRowMap();//generate point objects
00502   int maxBlkRowSize = mat->GlobalMaxRowDim();
00503   int maxBlkColSize = mat->GlobalMaxColDim();
00504   std::vector<double> zeros(maxBlkRowSize*maxBlkColSize, 0);
00505   int numMyRows = rowmap.NumMyElements();
00506   int* myRows = rowmap.MyGlobalElements();
00507   for(int i=0; i<numMyRows; ++i) {
00508     int row = myRows[i];
00509     int rowlength = 0;
00510     int* colindicesView = NULL;
00511     int localrow = rowmap.LID(row);
00512     int err = crsgraph.ExtractMyRowView(localrow, rowlength, colindicesView);
00513     if (err != 0) {
00514       return err;
00515     }
00516     err = mat->BeginReplaceMyValues(localrow, rowlength, colindicesView);
00517     if (err != 0) {
00518       return err;
00519     }
00520     int blkRowSize = rowmap.ElementSize(localrow);
00521     for(int j=0; j<rowlength; ++j) {
00522       int blkColSize = colmap.ElementSize(colindicesView[j]);
00523       err = mat->SubmitBlockEntry(&zeros[0], maxBlkRowSize,
00524                             blkRowSize, blkColSize);
00525       if (err != 0) {
00526         return err;
00527       }
00528     }
00529     err = mat->EndSubmitEntries();
00530     if (err != 0) {
00531       return err;
00532     }
00533   }
00534 
00535   return 0;
00536 }
00537 
00538 #endif //HAVE_FEI_EPETRA
00539 
00540 }//namespace Trilinos_Helpers
00541 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends