fei_Aztec_BlockMap.cpp

00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2005 Sandia Corporation.                              */
00003 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00004 /*    non-exclusive license for use of this work by or on behalf      */
00005 /*    of the U.S. Government.  Export of this program may require     */
00006 /*    a license from the United States Government.                    */
00007 /*--------------------------------------------------------------------*/
00008 
00009 #include <fei_trilinos_macros.hpp>
00010 #include <fei_iostream.hpp>
00011 
00012 #ifdef HAVE_FEI_AZTECOO
00013 
00014 #include <assert.h>
00015 #include <stdio.h>
00016 #include <stdlib.h>
00017 
00018 #include <fei_mpi.h>
00019 
00020 #ifndef FEI_SER
00021 
00022 #define AZTEC_MPI AZTEC_MPI
00023 #define AZ_MPI AZ_MPI
00024 #ifndef MPI
00025 #define MPI MPI
00026 #endif
00027 
00028 #endif
00029 
00030 #include <az_aztec.h>
00031 #include <fei_Aztec_Map.hpp>
00032 #include <fei_Aztec_BlockMap.hpp>
00033 
00034 namespace fei_trilinos {
00035 
00036 //==============================================================================
00037 Aztec_BlockMap::Aztec_BlockMap(int globalSz, int localSz, int localOffs,
00038                           MPI_Comm comm,
00039                           int numGlobalBlocks, int numLocalBlocks,
00040                           int localBlockOffset, int* blockSizes)
00041 
00042   : Aztec_Map(globalSz, localSz, localOffs, comm),
00043     numGlobalBlocks_(numGlobalBlocks),
00044     numLocalBlocks_(numLocalBlocks),
00045     localBlockOffset_(localBlockOffset)
00046 {
00047     checkInput();
00048 
00049     blockSizes_ = new int[numLocalBlocks_];
00050 
00051     for(int i=0; i<numLocalBlocks_; i++) {
00052         blockSizes_[i] = blockSizes[i];
00053     }
00054 }
00055  
00056 //==============================================================================
00057 Aztec_BlockMap::Aztec_BlockMap(const Aztec_BlockMap& map)
00058   : Aztec_Map(map.globalSize(), map.localSize(), map.localOffset(),
00059               map.getCommunicator()),
00060     numGlobalBlocks_(map.numGlobalBlocks_),
00061     numLocalBlocks_(map.numLocalBlocks_),
00062     localBlockOffset_(map.localBlockOffset_)
00063 {
00064     blockSizes_ = new int[numLocalBlocks_];
00065 
00066     for(int i=0; i<numLocalBlocks_; i++) {
00067         blockSizes_[i] = map.blockSizes_[i];
00068     }
00069 }
00070 
00071 //==============================================================================
00072 Aztec_BlockMap::~Aztec_BlockMap(void)  {
00073 
00074     delete [] blockSizes_;
00075     blockSizes_ = NULL;
00076 
00077     numGlobalBlocks_ = 0;
00078     numLocalBlocks_ = 0;
00079     localBlockOffset_ = 0;
00080 }
00081 
00082 //==============================================================================
00083 void Aztec_BlockMap::checkInput() {
00084 
00085     if (numGlobalBlocks_ <= 0) {
00086        FEI_CERR << "Aztec_BlockMap: ERROR, numGlobalBlocks <= 0. Aborting."
00087             << FEI_ENDL;
00088        abort();
00089     }
00090 
00091     if (localBlockOffset_ < 0) {
00092        FEI_CERR << "Aztec_BlockMap: ERROR, negative localBlockOffset. Aborting."
00093             << FEI_ENDL;
00094        abort();
00095     }
00096 }
00097 
00098 }//namespace fei_trilinos
00099 
00100 #endif
00101 //HAVE_FEI_AZTECOO

Generated on Tue Jul 13 09:27:44 2010 for FEI by  doxygen 1.4.7