Epetra_SerialComm.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_SerialComm.h"
00031 #include "Epetra_BasicDirectory.h"
00032 #include "Epetra_SerialDistributor.h"
00033 
00034 //=============================================================================
00035 Epetra_SerialComm::Epetra_SerialComm()
00036   : Epetra_Object("Epetra::Comm"), 
00037     SerialCommData_(new Epetra_SerialCommData()) {}
00038  
00039 //=============================================================================
00040 Epetra_SerialComm::Epetra_SerialComm(const Epetra_SerialComm& Comm) 
00041   : Epetra_Object(Comm.Label()), 
00042     SerialCommData_(Comm.SerialCommData_) 
00043 {
00044   SerialCommData_->IncrementReferenceCount();
00045 }
00046 //=============================================================================
00047 void Epetra_SerialComm::Barrier() const {}
00048 //=============================================================================
00049 int Epetra_SerialComm::Broadcast(double * Values, int Count, int Root) const {
00050   (void)Values;
00051   (void)Count;
00052   (void)Root;
00053   return(0);
00054 }
00055 //=============================================================================
00056 int Epetra_SerialComm::Broadcast(int * Values, int Count, int Root) const {
00057   (void)Values;
00058   (void)Count;
00059   (void)Root;
00060   return(0);
00061 }
00062 //=============================================================================
00063 int Epetra_SerialComm::Broadcast(long * Values, int Count, int Root) const {
00064   (void)Values;
00065   (void)Count;
00066   (void)Root;
00067   return(0);
00068 }
00069 //=============================================================================
00070 int Epetra_SerialComm::Broadcast(char * Values, int Count, int Root) const {
00071   (void)Values;
00072   (void)Count;
00073   (void)Root;
00074   return(0);
00075 }
00076 //=============================================================================
00077 int Epetra_SerialComm::GatherAll(double * MyVals, double * AllVals, int Count) const {
00078   for (int i=0; i<Count; ++i) AllVals[i] = MyVals[i];
00079   return(0);
00080 }
00081 //=============================================================================
00082 int Epetra_SerialComm::GatherAll(int * MyVals, int * AllVals, int Count) const {
00083   for (int i=0; i<Count; ++i) AllVals[i] = MyVals[i];
00084   return(0);
00085 }
00086 //=============================================================================
00087 int Epetra_SerialComm::GatherAll(long * MyVals, long * AllVals, int Count) const {
00088   for (int i=0; i<Count; ++i) AllVals[i] = MyVals[i];
00089   return(0);
00090 }
00091 //=============================================================================
00092 int Epetra_SerialComm::SumAll(double * PartialSums, double * GlobalSums, int Count) const {
00093   for (int i=0; i<Count; i++) GlobalSums[i] = PartialSums[i];
00094   return(0);
00095 }
00096 //=============================================================================
00097 int Epetra_SerialComm::SumAll(int * PartialSums, int * GlobalSums, int Count) const {
00098   for (int i=0; i<Count; i++) GlobalSums[i] = PartialSums[i];
00099   return(0);
00100 }
00101 //=============================================================================
00102 int Epetra_SerialComm::SumAll(long * PartialSums, long * GlobalSums, int Count) const {
00103   for (int i=0; i<Count; i++) GlobalSums[i] = PartialSums[i];
00104   return(0);
00105 }
00106 //=============================================================================
00107 int Epetra_SerialComm::MaxAll(double * PartialMaxs, double * GlobalMaxs, int Count) const {
00108   for (int i=0; i<Count; i++) GlobalMaxs[i] = PartialMaxs[i];
00109   return(0);
00110 }
00111 //=============================================================================
00112 int Epetra_SerialComm::MaxAll(int * PartialMaxs, int * GlobalMaxs, int Count) const {
00113   for (int i=0; i<Count; i++) GlobalMaxs[i] = PartialMaxs[i];
00114   return(0);
00115 }
00116 //=============================================================================
00117 int Epetra_SerialComm::MaxAll(long * PartialMaxs, long * GlobalMaxs, int Count) const {
00118   for (int i=0; i<Count; i++) GlobalMaxs[i] = PartialMaxs[i];
00119   return(0);
00120 }
00121 //=============================================================================
00122 int Epetra_SerialComm::MinAll(double * PartialMins, double * GlobalMins, int Count) const {
00123   for (int i=0; i<Count; i++) GlobalMins[i] = PartialMins[i];
00124   return(0);
00125 }
00126 //=============================================================================
00127 int Epetra_SerialComm::MinAll(int * PartialMins, int * GlobalMins, int Count) const {
00128   for (int i=0; i<Count; i++) GlobalMins[i] = PartialMins[i];
00129   return(0);
00130 }
00131 //=============================================================================
00132 int Epetra_SerialComm::MinAll(long * PartialMins, long * GlobalMins, int Count) const {
00133   for (int i=0; i<Count; i++) GlobalMins[i] = PartialMins[i];
00134   return(0);
00135 }
00136 //=============================================================================
00137 int Epetra_SerialComm::ScanSum(double * MyVals, double * ScanSums, int Count) const {
00138   for (int i=0; i<Count; i++) ScanSums[i] = MyVals[i];
00139   return(0);
00140 }
00141 //=============================================================================
00142 int Epetra_SerialComm::ScanSum(int * MyVals, int * ScanSums, int Count) const {
00143   for (int i=0; i<Count; i++) ScanSums[i] = MyVals[i];
00144   return(0);
00145 }
00146 //=============================================================================
00147 int Epetra_SerialComm::ScanSum(long * MyVals, long * ScanSums, int Count) const {
00148   for (int i=0; i<Count; i++) ScanSums[i] = MyVals[i];
00149   return(0);
00150 }
00151 //=============================================================================
00152 Epetra_Distributor * Epetra_SerialComm::CreateDistributor() const {
00153 
00154   Epetra_Distributor * dist = dynamic_cast<Epetra_Distributor *>(new Epetra_SerialDistributor(*this));
00155   return(dist);
00156 }
00157 //=============================================================================
00158 Epetra_Directory * Epetra_SerialComm::CreateDirectory(const Epetra_BlockMap & map) const {
00159 
00160   Epetra_Directory * dir = dynamic_cast<Epetra_Directory *>(new Epetra_BasicDirectory(map));
00161   return(dir);
00162 }
00163 //=============================================================================
00164 Epetra_SerialComm::~Epetra_SerialComm()  {
00165   CleanupData();
00166 }
00167 //=============================================================================
00168 Epetra_SerialComm& Epetra_SerialComm::operator= (const Epetra_SerialComm & Comm) {
00169   if((this != &Comm) && (SerialCommData_ != Comm.SerialCommData_)) {
00170     CleanupData();
00171     SerialCommData_ = Comm.SerialCommData_;
00172     SerialCommData_->IncrementReferenceCount();
00173   }
00174   return(*this);
00175 }
00176 //=============================================================================
00177 void Epetra_SerialComm::CleanupData() {
00178   if(SerialCommData_ != 0) {
00179     SerialCommData_->DecrementReferenceCount();
00180     if(SerialCommData_->ReferenceCount() == 0) {
00181       delete SerialCommData_;
00182       SerialCommData_ = 0;
00183     }
00184   }
00185 }
00186 //=============================================================================
00187 int Epetra_SerialComm::ReferenceCount() const {
00188   return(SerialCommData_->ReferenceCount());
00189 }

Generated on Wed May 12 21:41:05 2010 for Epetra Package Browser (Single Doxygen Collection) by  doxygen 1.4.7