New_Package Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
test
Jambo_Test
Jambo_Test.cpp
Go to the documentation of this file.
1
// ***********************************************************************
2
//
3
// New_Package Example Package
4
// Copyright (2004) Sandia Corporation
5
//
6
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
7
// license for use of this work by or on behalf of the U.S. Government.
8
//
9
// This library is free software; you can redistribute it and/or modify
10
// it under the terms of the GNU Lesser General Public License as
11
// published by the Free Software Foundation; either version 2.1 of the
12
// License, or (at your option) any later version.
13
//
14
// This library is distributed in the hope that it will be useful, but
15
// WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
// Lesser General Public License for more details.
18
//
19
// You should have received a copy of the GNU Lesser General Public
20
// License along with this library; if not, write to the Free Software
21
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22
// USA
23
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
24
//
25
// ***********************************************************************
26
//@HEADER
27
28
#include "
Epetra_SerialComm.h
"
29
#include "
Newp_Jambo.h
"
30
#include <sstream>
31
32
#ifdef HAVE_MPI
33
#include "mpi.h"
34
#endif
35
36
int
main
(
int
argc,
char
*argv[]){
37
38
#ifdef HAVE_MPI
39
MPI_Init(&argc, &argv);
40
#endif
41
42
using namespace
std;
43
44
// Get an Epetra_Comm
45
Epetra_SerialComm
epetra_serial_comm;
46
Epetra_Comm
* epetra_comm;
47
epetra_comm =
dynamic_cast<
Epetra_Comm
*
>
(&epetra_serial_comm);
48
49
//Create an ostream that Newp_Hello can write to and that we can read from
50
stringbuf string_buf;
51
streambuf * stream_buf;
52
stream_buf =
dynamic_cast<
streambuf*
>
(&string_buf);
53
iostream io_stream(stream_buf);
54
ostream * o_stream;
55
o_stream =
dynamic_cast<
ostream*
>
(&io_stream);
56
57
//Create a Newp_Jambo to test
58
Newp_Jambo
new_package_jambo(*epetra_comm);
59
new_package_jambo.
Print
(*o_stream);
60
61
//Read from the io_stream
62
char
temp[83];
63
io_stream.getline(temp, 83, 0);
64
65
char
* expected =
"This will print out one line for each of the 1 processes \n\nJambo. I am process 0\n"
;
66
67
if
(strcmp(temp, expected) != 0){
68
cout <<
"Test Failed!"
<< endl <<
" Got::"
<< strlen(temp) <<
"::"
<< temp <<
"::"
<< endl <<
"Expected::"
<< strlen(expected) <<
"::"
<< expected <<
"::"
<< endl;
69
return
1;
70
}
71
cout <<
"Test passed!"
<< endl;
72
#ifdef EPETRA_MPI
73
MPI_Finalize();
74
#endif
75
return
0;
76
}
Epetra_SerialComm.h
main
int main(int argc, char *argv[])
Definition
Jambo_Test.cpp:36
Newp_Jambo.h
Epetra_Comm
Epetra_SerialComm
Newp_Jambo
Newp_Jambo: A sample class.
Definition
Newp_Jambo.h:58
Newp_Jambo::Print
virtual void Print(ostream &os) const
Print method.
Definition
Newp_Jambo.cpp:39
Generated by
1.17.0