TSFRandomBlockMatrixBuilderImpl.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 /* ***********************************************************************
00003 // 
00004 //           TSFExtended: Trilinos Solver Framework Extended
00005 //                 Copyright (2004) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // **********************************************************************/
00027  /* @HEADER@ */
00028 
00029 
00030 #ifndef RANDOMBLOCKMATRIX_BUILDER_IMPL_HPP
00031 #define RANDOMBLOCKMATRIX_BUILDER_IMPL_HPP
00032 
00033 #include "TSFRandomBlockMatrixBuilderDecl.hpp"
00034 #include "TSFSimpleBlockOpDecl.hpp"
00035 #include "TSFRandomSparseMatrixBuilderDecl.hpp"
00036 
00037 
00038 
00039 #ifndef HAVE_TEUCHOS_EXPLICIT_INSTANTIATION
00040 #include "TSFSimpleBlockOpImpl.hpp"
00041 #include "TSFRandomSparseMatrixBuilderImpl.hpp"
00042 #endif
00043 
00044 using namespace TSFExtended;
00045 using namespace Teuchos;
00046 
00047 
00048 namespace TSFExtended
00049 {
00050 
00051 template <class Scalar> 
00052 inline RandomBlockMatrixBuilder<Scalar>
00053 ::RandomBlockMatrixBuilder(const VectorSpace<Scalar>& d,
00054   const VectorSpace<Scalar>& r,
00055   double blockDensity,
00056   double onProcDensity,
00057   double offProcDensity,
00058   const VectorType<double>& type)
00059   : OperatorBuilder<double>(d, r, type), op_()
00060 {
00061   RCP<SimpleBlockOp<Scalar> > b = 
00062     rcp(new SimpleBlockOp<Scalar>(this->domain(), this->range()));
00063   RCP<LinearOpBase<Scalar> > p = b;
00064   op_ = p;
00065 
00066   for (int i=0; i<this->range().numBlocks(); i++)
00067   {
00068     for (int j=0; j<this->domain().numBlocks(); j++)
00069     {
00070       RandomSparseMatrixBuilder<Scalar> builder(this->domain().getBlock(j),
00071         this->range().getBlock(i),
00072         onProcDensity,
00073         offProcDensity,
00074         this->vecType());
00075       op_.setBlock(i, j, builder.getOp());
00076     }
00077   }
00078   b->endBlockFill();
00079 }
00080 }
00081 
00082 #endif

Site Contact