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::GatherAll(double * MyVals, double * AllVals, int Count) const {
00071   for (int i=0; i<Count; ++i) AllVals[i] = MyVals[i];
00072   return(0);
00073 }
00074 //=============================================================================
00075 int Epetra_SerialComm::GatherAll(int * MyVals, int * AllVals, int Count) const {
00076   for (int i=0; i<Count; ++i) AllVals[i] = MyVals[i];
00077   return(0);
00078 }
00079 //=============================================================================
00080 int Epetra_SerialComm::GatherAll(long * MyVals, long * AllVals, int Count) const {
00081   for (int i=0; i<Count; ++i) AllVals[i] = MyVals[i];
00082   return(0);
00083 }
00084 //=============================================================================
00085 int Epetra_SerialComm::SumAll(double * PartialSums, double * GlobalSums, int Count) const {
00086   for (int i=0; i<Count; i++) GlobalSums[i] = PartialSums[i];
00087   return(0);
00088 }
00089 //=============================================================================
00090 int Epetra_SerialComm::SumAll(int * PartialSums, int * GlobalSums, int Count) const {
00091   for (int i=0; i<Count; i++) GlobalSums[i] = PartialSums[i];
00092   return(0);
00093 }
00094 //=============================================================================
00095 int Epetra_SerialComm::SumAll(long * PartialSums, long * GlobalSums, int Count) const {
00096   for (int i=0; i<Count; i++) GlobalSums[i] = PartialSums[i];
00097   return(0);
00098 }
00099 //=============================================================================
00100 int Epetra_SerialComm::MaxAll(double * PartialMaxs, double * GlobalMaxs, int Count) const {
00101   for (int i=0; i<Count; i++) GlobalMaxs[i] = PartialMaxs[i];
00102   return(0);
00103 }
00104 //=============================================================================
00105 int Epetra_SerialComm::MaxAll(int * PartialMaxs, int * GlobalMaxs, int Count) const {
00106   for (int i=0; i<Count; i++) GlobalMaxs[i] = PartialMaxs[i];
00107   return(0);
00108 }
00109 //=============================================================================
00110 int Epetra_SerialComm::MaxAll(long * PartialMaxs, long * GlobalMaxs, int Count) const {
00111   for (int i=0; i<Count; i++) GlobalMaxs[i] = PartialMaxs[i];
00112   return(0);
00113 }
00114 //=============================================================================
00115 int Epetra_SerialComm::MinAll(double * PartialMins, double * GlobalMins, int Count) const {
00116   for (int i=0; i<Count; i++) GlobalMins[i] = PartialMins[i];
00117   return(0);
00118 }
00119 //=============================================================================
00120 int Epetra_SerialComm::MinAll(int * PartialMins, int * GlobalMins, int Count) const {
00121   for (int i=0; i<Count; i++) GlobalMins[i] = PartialMins[i];
00122   return(0);
00123 }
00124 //=============================================================================
00125 int Epetra_SerialComm::MinAll(long * PartialMins, long * GlobalMins, int Count) const {
00126   for (int i=0; i<Count; i++) GlobalMins[i] = PartialMins[i];
00127   return(0);
00128 }
00129 //=============================================================================
00130 int Epetra_SerialComm::ScanSum(double * MyVals, double * ScanSums, int Count) const {
00131   for (int i=0; i<Count; i++) ScanSums[i] = MyVals[i];
00132   return(0);
00133 }
00134 //=============================================================================
00135 int Epetra_SerialComm::ScanSum(int * MyVals, int * ScanSums, int Count) const {
00136   for (int i=0; i<Count; i++) ScanSums[i] = MyVals[i];
00137   return(0);
00138 }
00139 //=============================================================================
00140 int Epetra_SerialComm::ScanSum(long * MyVals, long * ScanSums, int Count) const {
00141   for (int i=0; i<Count; i++) ScanSums[i] = MyVals[i];
00142   return(0);
00143 }
00144 //=============================================================================
00145 Epetra_Distributor * Epetra_SerialComm::CreateDistributor() const {
00146 
00147   Epetra_Distributor * dist = dynamic_cast<Epetra_Distributor *>(new Epetra_SerialDistributor(*this));
00148   return(dist);
00149 }
00150 //=============================================================================
00151 Epetra_Directory * Epetra_SerialComm::CreateDirectory(const Epetra_BlockMap & map) const {
00152 
00153   Epetra_Directory * dir = dynamic_cast<Epetra_Directory *>(new Epetra_BasicDirectory(map));
00154   return(dir);
00155 }
00156 //=============================================================================
00157 Epetra_SerialComm::~Epetra_SerialComm()  {
00158   CleanupData();
00159 }
00160 //=============================================================================
00161 Epetra_SerialComm& Epetra_SerialComm::operator= (const Epetra_SerialComm & Comm) {
00162   if((this != &Comm) && (SerialCommData_ != Comm.SerialCommData_)) {
00163     CleanupData();
00164     SerialCommData_ = Comm.SerialCommData_;
00165     SerialCommData_->IncrementReferenceCount();
00166   }
00167   return(*this);
00168 }
00169 //=============================================================================
00170 void Epetra_SerialComm::CleanupData() {
00171   if(SerialCommData_ != 0) {
00172     SerialCommData_->DecrementReferenceCount();
00173     if(SerialCommData_->ReferenceCount() == 0) {
00174       delete SerialCommData_;
00175       SerialCommData_ = 0;
00176     }
00177   }
00178 }
00179 //=============================================================================
00180 int Epetra_SerialComm::ReferenceCount() const {
00181   return(SerialCommData_->ReferenceCount());
00182 }

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