Epetra_FEVbrMatrix.cpp

Go to the documentation of this file.
00001 
00002 //@HEADER
00003 // ************************************************************************
00004 // 
00005 //               Epetra: Linear Algebra Services Package 
00006 //                 Copyright (2001) Sandia Corporation
00007 // 
00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 // license for use of this work by or on behalf of the U.S. Government.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //  
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA
00025 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00026 // 
00027 // ************************************************************************
00028 //@HEADER
00029 
00030 #include <Epetra_FEVbrMatrix.h>
00031 #include <Epetra_BlockMap.h>
00032 #include <Epetra_Map.h>
00033 #include <Epetra_Import.h>
00034 #include <Epetra_Export.h>
00035 #include <Epetra_Vector.h>
00036 #include <Epetra_MultiVector.h>
00037 #include <Epetra_Comm.h>
00038 #include <Epetra_Distributor.h>
00039 #include <Epetra_Util.h>
00040 
00041 //----------------------------------------------------------------------------
00042 Epetra_FEVbrMatrix::Epetra_FEVbrMatrix(Epetra_DataAccess CV,
00043                const Epetra_BlockMap& RowMap,
00044                int *NumBlockEntriesPerRow,
00045                bool ignoreNonLocalEntries) 
00046   : Epetra_VbrMatrix(CV, RowMap, NumBlockEntriesPerRow),
00047     ignoreNonLocalEntries_(ignoreNonLocalEntries),
00048     numNonlocalBlockRows_(0),
00049     nonlocalBlockRows_(NULL),
00050     nonlocalBlockRowLengths_(NULL),
00051     nonlocalBlockRowAllocLengths_(NULL),
00052     nonlocalBlockCols_(NULL),
00053     nonlocalCoefs_(NULL),
00054     curRowOffset_(-1),
00055     curColOffset_(-1),
00056     curNumCols_(0),
00057     curCols_(NULL),
00058     curMode_(Add)
00059 {
00060 }
00061 
00062 //----------------------------------------------------------------------------
00063 Epetra_FEVbrMatrix::Epetra_FEVbrMatrix(Epetra_DataAccess CV,
00064                const Epetra_BlockMap& RowMap,
00065                int NumBlockEntriesPerRow,
00066                bool ignoreNonLocalEntries) 
00067   : Epetra_VbrMatrix(CV, RowMap, NumBlockEntriesPerRow),
00068     ignoreNonLocalEntries_(ignoreNonLocalEntries),
00069     numNonlocalBlockRows_(0),
00070     nonlocalBlockRows_(NULL),
00071     nonlocalBlockRowLengths_(NULL),
00072     nonlocalBlockRowAllocLengths_(NULL),
00073     nonlocalBlockCols_(NULL),
00074     nonlocalCoefs_(NULL),
00075     curRowOffset_(-1),
00076     curColOffset_(0),
00077     curNumCols_(0),
00078     curCols_(NULL),
00079     curMode_(Add)
00080 {
00081 }
00082 
00083 //----------------------------------------------------------------------------
00084 Epetra_FEVbrMatrix::Epetra_FEVbrMatrix(Epetra_DataAccess CV,
00085                const Epetra_BlockMap& RowMap,
00086                const Epetra_BlockMap& ColMap,
00087                int *NumBlockEntriesPerRow,
00088                bool ignoreNonLocalEntries) 
00089   : Epetra_VbrMatrix(CV, RowMap, ColMap, NumBlockEntriesPerRow),
00090     ignoreNonLocalEntries_(ignoreNonLocalEntries),
00091     numNonlocalBlockRows_(0),
00092     nonlocalBlockRows_(NULL),
00093     nonlocalBlockRowLengths_(NULL),
00094     nonlocalBlockRowAllocLengths_(NULL),
00095     nonlocalBlockCols_(NULL),
00096     nonlocalCoefs_(NULL),
00097     curRowOffset_(-1),
00098     curColOffset_(-1),
00099     curNumCols_(0),
00100     curCols_(NULL),
00101     curMode_(Add)
00102 {
00103 }
00104 
00105 //----------------------------------------------------------------------------
00106 Epetra_FEVbrMatrix::Epetra_FEVbrMatrix(Epetra_DataAccess CV,
00107                const Epetra_BlockMap& RowMap,
00108                const Epetra_BlockMap& ColMap,
00109                int NumBlockEntriesPerRow,
00110                bool ignoreNonLocalEntries) 
00111   : Epetra_VbrMatrix(CV, RowMap, ColMap, NumBlockEntriesPerRow),
00112     ignoreNonLocalEntries_(ignoreNonLocalEntries),
00113     numNonlocalBlockRows_(0),
00114     nonlocalBlockRows_(NULL),
00115     nonlocalBlockRowLengths_(NULL),
00116     nonlocalBlockRowAllocLengths_(NULL),
00117     nonlocalBlockCols_(NULL),
00118     nonlocalCoefs_(NULL),
00119     curRowOffset_(-1),
00120     curColOffset_(0),
00121     curNumCols_(0),
00122     curCols_(NULL),
00123     curMode_(Add)
00124 {
00125 }
00126 
00127 //----------------------------------------------------------------------------
00128 Epetra_FEVbrMatrix::Epetra_FEVbrMatrix(Epetra_DataAccess CV,
00129                const Epetra_CrsGraph& Graph,
00130                bool ignoreNonLocalEntries) 
00131   : Epetra_VbrMatrix(CV, Graph),
00132     ignoreNonLocalEntries_(ignoreNonLocalEntries),
00133     numNonlocalBlockRows_(0),
00134     nonlocalBlockRows_(NULL),
00135     nonlocalBlockRowLengths_(NULL),
00136     nonlocalBlockRowAllocLengths_(NULL),
00137     nonlocalBlockCols_(NULL),
00138     nonlocalCoefs_(NULL),
00139     curRowOffset_(-1),
00140     curColOffset_(0),
00141     curNumCols_(0),
00142     curCols_(NULL),
00143     curMode_(Add)
00144 {
00145 }
00146 
00147 //----------------------------------------------------------------------------
00148 Epetra_FEVbrMatrix::Epetra_FEVbrMatrix(const Epetra_FEVbrMatrix& src)
00149   : Epetra_VbrMatrix(src),
00150     ignoreNonLocalEntries_(src.ignoreNonLocalEntries_),
00151     numNonlocalBlockRows_(0),
00152     nonlocalBlockRows_(NULL),
00153     nonlocalBlockRowLengths_(NULL),
00154     nonlocalBlockRowAllocLengths_(NULL),
00155     nonlocalBlockCols_(NULL),
00156     nonlocalCoefs_(NULL),
00157     curRowOffset_(-1),
00158     curColOffset_(0),
00159     curNumCols_(0),
00160     curCols_(NULL),
00161     curMode_(Add)
00162 {
00163   operator=(src);
00164 }
00165 
00166 //----------------------------------------------------------------------------
00167 Epetra_FEVbrMatrix& Epetra_FEVbrMatrix::operator=(const Epetra_FEVbrMatrix& src)
00168 {
00169   if (this == &src) {
00170     return( *this );
00171   }
00172 
00173   Epetra_VbrMatrix::operator=(src);
00174 
00175   numNonlocalBlockRows_ = src.numNonlocalBlockRows_;
00176 
00177   nonlocalBlockRows_ = new int[numNonlocalBlockRows_];
00178   nonlocalBlockRowLengths_ = new int[numNonlocalBlockRows_];
00179   nonlocalBlockRowAllocLengths_ = new int[numNonlocalBlockRows_];
00180   nonlocalBlockCols_ = new int*[numNonlocalBlockRows_];
00181   nonlocalCoefs_ = new Epetra_SerialDenseMatrix**[numNonlocalBlockRows_];
00182 
00183   for(int i=0; i<numNonlocalBlockRows_; ++i) {
00184     nonlocalBlockRows_[i] = src.nonlocalBlockRows_[i];
00185     nonlocalBlockRowLengths_[i] = src.nonlocalBlockRowLengths_[i];
00186     nonlocalBlockRowAllocLengths_[i] = src.nonlocalBlockRowAllocLengths_[i];
00187 
00188     for(int j=0; j<nonlocalBlockRowLengths_[i]; ++j) {
00189       nonlocalBlockCols_[i][j] = src.nonlocalBlockCols_[i][j];
00190 
00191       nonlocalCoefs_[i][j] = new Epetra_SerialDenseMatrix(*(src.nonlocalCoefs_[i][j]));
00192     }
00193   }
00194 
00195   return( *this );
00196 }
00197 
00198 //----------------------------------------------------------------------------
00199 Epetra_FEVbrMatrix::~Epetra_FEVbrMatrix()
00200 {
00201   destroyNonlocalData();
00202 }
00203 
00204 //----------------------------------------------------------------------------
00205 void Epetra_FEVbrMatrix::destroyNonlocalData()
00206 {
00207   for(int i=0; i<numNonlocalBlockRows_; ++i) {
00208     delete [] nonlocalBlockCols_[i];
00209     for(int j=0; j<nonlocalBlockRowLengths_[i]; ++j) {
00210       delete nonlocalCoefs_[i][j];
00211     }
00212     delete [] nonlocalCoefs_[i];
00213   }
00214 
00215   delete [] nonlocalCoefs_;
00216   delete [] nonlocalBlockCols_;
00217   delete [] nonlocalBlockRowAllocLengths_;
00218   delete [] nonlocalBlockRowLengths_;
00219   delete [] nonlocalBlockRows_;
00220 
00221   numNonlocalBlockRows_ = 0;
00222   nonlocalBlockRows_ = NULL;
00223   nonlocalBlockRowLengths_ = NULL;
00224   nonlocalBlockRowAllocLengths_ = NULL;
00225   nonlocalBlockCols_ = NULL;
00226   nonlocalCoefs_ = NULL;
00227 }
00228 
00229 //----------------------------------------------------------------------------
00230 int Epetra_FEVbrMatrix::PutScalar(double ScalarConstant) 
00231 {
00232   for(int i=0; i<numNonlocalBlockRows_; ++i) {
00233     for(int j=0; j<nonlocalBlockRowLengths_[i]; ++j) {
00234       Epetra_SerialDenseMatrix& A = *(nonlocalCoefs_[i][j]);
00235       double* values = A.A();
00236       int lda = A.LDA();
00237       int n = A.N();
00238       for(int k=0; k<lda*n; ++k) {
00239   values[k] = ScalarConstant;
00240       }
00241     }
00242   }
00243 
00244   return( Epetra_VbrMatrix::PutScalar(ScalarConstant) );
00245 }
00246 
00247 //----------------------------------------------------------------------------
00248 int Epetra_FEVbrMatrix::GlobalAssemble(bool callFillComplete) 
00249 {
00250   if(Map().Comm().NumProc() < 2 || ignoreNonLocalEntries_) {
00251     if(callFillComplete) {
00252       EPETRA_CHK_ERR(FillComplete());
00253     }
00254 
00255     return(0);
00256   }
00257 
00258   int i;
00259 
00260   //In this method we need to gather all the non-local (overlapping) data
00261   //that's been input on each processor, into the
00262   //non-overlapping distribution defined by the map that 'this' matrix was
00263   //constructed with.
00264 
00265   //Need to build a map that describes our nonlocal data.
00266 
00267   //First, create a list of the sizes (point-rows per block-row) of the
00268   //nonlocal rows we're holding.
00269   int* pointRowsPerNonlocalBlockRow = numNonlocalBlockRows_>0 ?
00270     new int[numNonlocalBlockRows_] : NULL;
00271 
00272   for(i=0; i<numNonlocalBlockRows_; ++i) {
00273     pointRowsPerNonlocalBlockRow[i] = nonlocalCoefs_[i][0]->M();
00274   }
00275 
00276   //We'll use the arbitrary distribution constructor of BlockMap.
00277 
00278   Epetra_BlockMap sourceMap(-1, numNonlocalBlockRows_, nonlocalBlockRows_,
00279           pointRowsPerNonlocalBlockRow,
00280           RowMap().IndexBase(), RowMap().Comm());
00281 
00282   delete [] pointRowsPerNonlocalBlockRow;
00283 
00284   //If sourceMap has global size 0, then no nonlocal data exists and we can
00285   //skip most of this function.
00286   if(sourceMap.NumGlobalElements() < 1) {
00287     if(callFillComplete) {
00288       EPETRA_CHK_ERR(FillComplete());
00289     }
00290     return(0);
00291   }
00292 
00293   //We also need to build a column-map, containing the columns in our
00294   //nonlocal data. To do that, create a list of all column-indices that
00295   //occur in our nonlocal rows.
00296 
00297   int numCols = 0, allocLen = 0;
00298   int* cols = NULL;
00299   int* pointColsPerBlockCol = NULL;
00300   int ptColAllocLen = 0;
00301   int insertPoint = -1;
00302 
00303   for(i=0; i<numNonlocalBlockRows_; ++i) {
00304     for(int j=0; j<nonlocalBlockRowLengths_[i]; ++j) {
00305       int col = nonlocalBlockCols_[i][j];
00306       int offset = Epetra_Util_binary_search(col, cols, numCols, insertPoint);
00307       if (offset < 0) {
00308   EPETRA_CHK_ERR( Epetra_Util_insert(col, insertPoint, cols,
00309              numCols, allocLen) );
00310   int tmpNumCols = numCols-1;
00311   EPETRA_CHK_ERR( Epetra_Util_insert(nonlocalCoefs_[i][j]->N(),
00312              insertPoint,
00313              pointColsPerBlockCol,
00314              tmpNumCols, ptColAllocLen) );
00315       }
00316     }
00317   }
00318 
00319   Epetra_BlockMap colMap(-1, numCols, cols,
00320        pointColsPerBlockCol,
00321        RowMap().IndexBase(), RowMap().Comm());
00322 
00323   delete [] cols;
00324   delete [] pointColsPerBlockCol;
00325   numCols = 0;
00326   allocLen = 0;
00327 
00328   //now we need to create a matrix with sourceMap and colMap, and fill it with
00329   //our nonlocal data so we can then export it to the correct owning
00330   //processors.
00331 
00332   Epetra_VbrMatrix tempMat(Copy, sourceMap, colMap, nonlocalBlockRowLengths_);
00333 
00334 
00335   //Next we need to make sure the 'indices-are-global' attribute of tempMat's
00336   //graph is set to true, in case this processor doesn't end up calling the
00337   //InsertGlobalValues method...
00338 
00339   const Epetra_CrsGraph& graph = tempMat.Graph();
00340   Epetra_CrsGraph& nonconst_graph = const_cast<Epetra_CrsGraph&>(graph);
00341   nonconst_graph.SetIndicesAreGlobal(true);
00342 
00343   for(i=0; i<numNonlocalBlockRows_; ++i) {
00344     EPETRA_CHK_ERR( tempMat.BeginInsertGlobalValues(nonlocalBlockRows_[i],
00345                 nonlocalBlockRowLengths_[i],
00346                 nonlocalBlockCols_[i]) );
00347 
00348     for(int j=0; j<nonlocalBlockRowLengths_[i]; ++j) {
00349       Epetra_SerialDenseMatrix& subblock = *(nonlocalCoefs_[i][j]);
00350 
00351       EPETRA_CHK_ERR( tempMat.SubmitBlockEntry(subblock.A(),
00352                  subblock.LDA(),
00353                  subblock.M(),
00354                  subblock.N()) );
00355     }
00356 
00357     EPETRA_CHK_ERR( tempMat.EndSubmitEntries() );
00358   }
00359 
00360   //Now we need to call FillComplete on our temp matrix. We need to
00361   //pass a DomainMap and RangeMap, which are not the same as the RowMap
00362   //and ColMap that we constructed the matrix with.
00363   EPETRA_CHK_ERR(tempMat.FillComplete(RowMap(), sourceMap));
00364 
00365   //Finally, we're ready to create the exporter and export non-local data to
00366   //the appropriate owning processors.
00367 
00368   Epetra_Export exporter(sourceMap, RowMap());
00369 
00370   EPETRA_CHK_ERR( Export(tempMat, exporter, Add) );
00371 
00372   if(callFillComplete) {
00373     EPETRA_CHK_ERR(FillComplete());
00374   }
00375 
00376   destroyNonlocalData();
00377 
00378   return(0);
00379 }
00380 
00381 //----------------------------------------------------------------------------
00382 int Epetra_FEVbrMatrix::InputNonlocalBlockEntry(double *Values, int LDA,
00383             int NumRows, int NumCols)
00384 {
00385   if (curRowOffset_ < 0) {
00386     return(-1);
00387   }
00388 
00389   int insertPoint;
00390   int col = curCols_[curColOffset_++];
00391   int coloffset =
00392     Epetra_Util_binary_search(col, nonlocalBlockCols_[curRowOffset_],
00393             nonlocalBlockRowLengths_[curRowOffset_],
00394             insertPoint);
00395   if (coloffset < 0) return(-1);
00396 
00397   Epetra_SerialDenseMatrix*& subblock = nonlocalCoefs_[curRowOffset_][coloffset];
00398 
00399   if (subblock == NULL) {
00400     //For the construction of the serial dense matrix here, we choose Copy mode
00401     //in case the user deletes or reuses the Values array after this method is
00402     //called.
00403     subblock = new Epetra_SerialDenseMatrix(Copy, Values, LDA, NumRows, NumCols);
00404 
00405     if (subblock == NULL) {
00406       return(-1);
00407     }
00408   }
00409   else {
00410     int nrows = subblock->M();
00411     int ncols = subblock->N();
00412     int lda   = subblock->LDA();
00413     if (nrows != NumRows || ncols != NumCols || lda != LDA) {
00414       return(-1);
00415     }
00416 
00417     double* subblockvals = subblock->A();
00418     if (curMode_ == Add) {
00419       for(int i=0; i<lda*ncols; ++i) subblockvals[i] += Values[i];
00420     }
00421     else {
00422       for(int i=0; i<lda*ncols; ++i) subblockvals[i] = Values[i];
00423     }
00424   }
00425 
00426   return(0);
00427 }
00428 
00429 //----------------------------------------------------------------------------
00430 int Epetra_FEVbrMatrix::InsertNonlocalRow(int row, int offset, int numCols)
00431 {
00432   //insert a new row in our list of nonlocal rows.
00433   //also insert new arrays to hold block-column-index information
00434 
00435   int alloc_len = numNonlocalBlockRows_;
00436   EPETRA_CHK_ERR( Epetra_Util_insert(row, offset, nonlocalBlockRows_,
00437              numNonlocalBlockRows_, alloc_len, 1) );
00438 
00439   int tmp1 = numNonlocalBlockRows_ - 1;
00440   int tmp2 = alloc_len - 1;
00441 
00442   EPETRA_CHK_ERR( Epetra_Util_insert(0, offset, nonlocalBlockRowLengths_,
00443              tmp1, tmp2, 1) );
00444 
00445   --tmp1;
00446   --tmp2;
00447   int initialAllocLen = numCols*2;
00448   EPETRA_CHK_ERR( Epetra_Util_insert(initialAllocLen, offset,
00449              nonlocalBlockRowAllocLengths_,
00450              tmp1, tmp2, 1) );
00451 
00452   int** newCols = new int*[numNonlocalBlockRows_];
00453   Epetra_SerialDenseMatrix*** newCoefs =
00454     new Epetra_SerialDenseMatrix**[numNonlocalBlockRows_];
00455 
00456   if (newCols == NULL || newCoefs == NULL) {
00457     return(-1);
00458   }
00459 
00460   newCols[offset] = new int[initialAllocLen];
00461   newCoefs[offset] = new Epetra_SerialDenseMatrix*[initialAllocLen];
00462 
00463   for(int j=0; j<initialAllocLen; ++j) {
00464     newCols[offset][j] = 0;
00465     newCoefs[offset][j] = (Epetra_SerialDenseMatrix*)NULL;
00466   }
00467 
00468   int index = 0;
00469   for(int i=0; i<numNonlocalBlockRows_-1; ++i) {
00470     if (i == offset) {
00471       ++index;
00472     }
00473 
00474     newCols[index] = nonlocalBlockCols_[i];
00475     newCoefs[index++] = nonlocalCoefs_[i];
00476   }
00477 
00478   delete [] nonlocalBlockCols_;
00479   delete [] nonlocalCoefs_;
00480 
00481   nonlocalBlockCols_ = newCols;
00482   nonlocalCoefs_ = newCoefs;
00483 
00484   return(0);
00485 }
00486 
00487 //--------------------------------------------------------------------------
00488 int Epetra_FEVbrMatrix::BeginInsertGlobalValues(int BlockRow,
00489             int NumBlockEntries,
00490             int * BlockIndices)
00491 {
00492   int myRow = LRID(BlockRow);
00493 
00494   if (myRow > -1) {
00495     return( Epetra_VbrMatrix::BeginInsertGlobalValues(BlockRow,
00496                    NumBlockEntries,
00497                    BlockIndices) );
00498   }
00499 
00500   return( SetupForNonlocalSubmits(BlockRow, NumBlockEntries,
00501           BlockIndices, false, Add) );
00502 }
00503 
00504 //--------------------------------------------------------------------------
00505 int Epetra_FEVbrMatrix::BeginReplaceGlobalValues(int BlockRow,
00506              int NumBlockEntries,
00507              int *BlockIndices)
00508 {
00509   int myRow = LRID(BlockRow);
00510 
00511   if (myRow > -1) {
00512     return( Epetra_VbrMatrix::BeginReplaceGlobalValues(BlockRow,
00513                    NumBlockEntries,
00514                    BlockIndices) );
00515   }
00516 
00517   return( SetupForNonlocalSubmits(BlockRow, NumBlockEntries,
00518           BlockIndices, false, Insert) );
00519 }
00520 
00521 //--------------------------------------------------------------------------
00522 int Epetra_FEVbrMatrix::BeginSumIntoGlobalValues(int BlockRow,
00523              int NumBlockEntries,
00524              int *BlockIndices)
00525 {
00526   int myRow = LRID(BlockRow);
00527 
00528   if (myRow > -1) {
00529     return( Epetra_VbrMatrix::BeginSumIntoGlobalValues(BlockRow,
00530                    NumBlockEntries,
00531                    BlockIndices) );
00532   }
00533 
00534   return( SetupForNonlocalSubmits(BlockRow, NumBlockEntries,
00535           BlockIndices, false, Add) );
00536 }
00537 
00538 //--------------------------------------------------------------------------
00539 int Epetra_FEVbrMatrix::SetupForNonlocalSubmits(int BlockRow,
00540             int NumBlockEntries,
00541             int * BlockIndices, 
00542             bool IndicesAreLocal,
00543             Epetra_CombineMode SubmitMode)
00544 {
00545   (void)IndicesAreLocal;
00546   if (ignoreNonLocalEntries_) {
00547     curRowOffset_ = 0;
00548     return(0);
00549   }
00550 
00551   int insertPoint = -1;
00552 
00553   //find offset of this row in our list of nonlocal rows
00554   int rowoffset = Epetra_Util_binary_search(BlockRow, nonlocalBlockRows_,
00555               numNonlocalBlockRows_, insertPoint);
00556 
00557   //if this row is not already present, insert it
00558   if (rowoffset < 0) {
00559     EPETRA_CHK_ERR( InsertNonlocalRow(BlockRow, insertPoint, NumBlockEntries) );
00560     rowoffset = insertPoint;
00561   }
00562 
00563   //now insert each incoming block-column-index in this list of column-indices,
00564   //maintaining sortedness.
00565   for(int i=0; i<NumBlockEntries; ++i) {
00566     int col = BlockIndices[i];
00567     int coloffset = Epetra_Util_binary_search(col, nonlocalBlockCols_[rowoffset],
00568                nonlocalBlockRowLengths_[rowoffset],
00569                 insertPoint);
00570     if (coloffset < 0) {
00571       int tmp1 = nonlocalBlockRowLengths_[rowoffset];
00572       int tmp2 = nonlocalBlockRowAllocLengths_[rowoffset];
00573 
00574       EPETRA_CHK_ERR( Epetra_Util_insert(col, insertPoint,
00575            nonlocalBlockCols_[rowoffset],
00576           nonlocalBlockRowLengths_[rowoffset],
00577                nonlocalBlockRowAllocLengths_[rowoffset]));
00578 
00579       EPETRA_CHK_ERR( Epetra_Util_insert((Epetra_SerialDenseMatrix*)NULL,
00580            insertPoint,
00581            nonlocalCoefs_[rowoffset],
00582            tmp1, tmp2) );
00583     }
00584   }
00585 
00586   curRowOffset_ = rowoffset;
00587   curColOffset_ = 0;
00588   curNumCols_ = NumBlockEntries;
00589   curCols_ = new int[NumBlockEntries];
00590   for(int j=0; j<NumBlockEntries; ++j) {
00591     curCols_[j] = BlockIndices[j];
00592   }
00593 
00594   curMode_ = SubmitMode;
00595 
00596   return(0);
00597 }
00598 
00599 //--------------------------------------------------------------------------
00600 int Epetra_FEVbrMatrix::SubmitBlockEntry(double *Values,
00601            int LDA,
00602            int NumRows,
00603            int NumCols)
00604 {
00605   if (curRowOffset_ < 0) {
00606     EPETRA_CHK_ERR( Epetra_VbrMatrix::SubmitBlockEntry(Values, LDA,
00607               NumRows, NumCols) );
00608   }
00609   else {
00610     if (ignoreNonLocalEntries_) {
00611       return(0);
00612     }
00613 
00614     EPETRA_CHK_ERR( InputNonlocalBlockEntry(Values, LDA,
00615               NumRows, NumCols) );
00616   }
00617 
00618   return(0);
00619 }
00620 //--------------------------------------------------------------------------
00621 int Epetra_FEVbrMatrix::EndSubmitEntries()
00622 {
00623   if (curRowOffset_ < 0) {
00624     EPETRA_CHK_ERR( Epetra_VbrMatrix::EndSubmitEntries() );
00625   }
00626   else {
00627     curRowOffset_ = -1;
00628     curColOffset_ = -1;
00629     curNumCols_ = 0;
00630     delete [] curCols_;
00631   }
00632 
00633   return(0);
00634 }
00635 

Generated on Thu Sep 18 12:37:57 2008 for Epetra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1