New_Package Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Newp_Jambo.cpp
Go to the documentation of this file.
1
2//@HEADER
3// ***********************************************************************
4//
5// New_Package Example Package
6// Copyright (2004) Sandia Corporation
7//
8// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
9// license for use of this work by or on behalf of the U.S. Government.
10//
11// This library is free software; you can redistribute it and/or modify
12// it under the terms of the GNU Lesser General Public License as
13// published by the Free Software Foundation; either version 2.1 of the
14// License, or (at your option) any later version.
15//
16// This library is distributed in the hope that it will be useful, but
17// WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19// Lesser General Public License for more details.
20//
21// You should have received a copy of the GNU Lesser General Public
22// License along with this library; if not, write to the Free Software
23// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
24// USA
25// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
26//
27// ***********************************************************************
28//@HEADER
29
30#include "Newp_Jambo.h"
31#include "Epetra_Comm.h"
32//=============================================================================
33Newp_Jambo::Newp_Jambo(const Epetra_Comm& Comm):Comm_(Comm) {}
34
35//=============================================================================
36Newp_Jambo::Newp_Jambo(const Newp_Jambo& Source):Comm_(Source.Comm_) {}
37
38//=======================================================================
39void Newp_Jambo::Print(ostream& os) const {
40 int MyPID = Comm_.MyPID();
41 int NumProc = Comm_.NumProc();
42
43 for (int iproc=0; iproc < NumProc; iproc++) {
44 if (MyPID==iproc) {
45
46 if (MyPID==0) {
47 os << "This will print out one line for each of the " << NumProc << " processes " << endl ;
48 os << endl;
49 }
50 os << "Jambo. I am process " << MyPID << endl ;
51 os << flush;
52 }
53
54 // Do a few global ops to give I/O a chance to complete
55 Comm_.Barrier();
56 Comm_.Barrier();
57 Comm_.Barrier();
58 }
59 return; }
60
61
virtual int NumProc() const=0
virtual int MyPID() const=0
virtual void Barrier() const=0
Newp_Jambo: A sample class.
Definition Newp_Jambo.h:58
Newp_Jambo(const Epetra_Comm &Comm)
Basic Newp_Jambo constuctor.
virtual void Print(ostream &os) const
Print method.
const Epetra_Comm & Comm_
Definition Newp_Jambo.h:92