Epetra Package Browser (Single Doxygen Collection)
Development
test
FECrsGraph
test/FECrsGraph/cxx_main.cpp
Go to the documentation of this file.
1
//@HEADER
2
// ************************************************************************
3
//
4
// Epetra: Linear Algebra Services Package
5
// Copyright 2011 Sandia Corporation
6
//
7
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8
// the U.S. Government retains certain rights in this software.
9
//
10
// Redistribution and use in source and binary forms, with or without
11
// modification, are permitted provided that the following conditions are
12
// met:
13
//
14
// 1. Redistributions of source code must retain the above copyright
15
// notice, this list of conditions and the following disclaimer.
16
//
17
// 2. Redistributions in binary form must reproduce the above copyright
18
// notice, this list of conditions and the following disclaimer in the
19
// documentation and/or other materials provided with the distribution.
20
//
21
// 3. Neither the name of the Corporation nor the names of the
22
// contributors may be used to endorse or promote products derived from
23
// this software without specific prior written permission.
24
//
25
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
//
37
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38
//
39
// ************************************************************************
40
//@HEADER
41
42
43
// Epetra_FECrsGraph Test routine
44
45
#include "
Epetra_Time.h
"
46
#include "
Epetra_Map.h
"
47
#include "
ExecuteTestProblems.h
"
48
#ifdef EPETRA_MPI
49
#include "
Epetra_MpiComm.h
"
50
#include <mpi.h>
51
#else
52
#include "
Epetra_SerialComm.h
"
53
#endif
54
#include "../epetra_test_err.h"
55
#include "
Epetra_Version.h
"
56
57
int
main
(
int
argc,
char
*argv[]) {
58
59
int
ierr = 0;
60
61
#ifdef EPETRA_MPI
62
MPI_Init(&argc,&argv);
63
Epetra_MpiComm
Comm(MPI_COMM_WORLD);
64
#else
65
Epetra_SerialComm
Comm;
66
#endif
67
68
// Comm.SetTracebackMode(0); // This should shut down any error tracing
69
bool
verbose =
false
;
70
71
// Check if we should print results to standard out
72
if
(argc>1)
if
(argv[1][0]==
'-'
&& argv[1][1]==
'v'
) verbose =
true
;
73
74
#ifdef EPETRA_MPI
75
int
localverbose = verbose ? 1 : 0;
76
int
globalverbose=0;
77
MPI_Allreduce(&localverbose, &globalverbose, 1, MPI_INT, MPI_SUM,
78
MPI_COMM_WORLD);
79
verbose = (globalverbose>0);
80
#endif
81
82
int
MyPID = Comm.
MyPID
();
83
int
NumProc = Comm.
NumProc
();
84
85
if
(verbose && MyPID==0)
86
cout <<
Epetra_Version
() << endl << endl;
87
88
if
(verbose) cout << Comm <<endl;
89
90
int
NumMyElements = 4;
91
int
NumGlobalElements = NumMyElements*NumProc;
92
int
IndexBase = 0;
93
94
Epetra_Map
Map(NumGlobalElements, NumMyElements, IndexBase, Comm);
95
96
EPETRA_TEST_ERR
(
Drumm1
(Map, verbose),ierr);
97
98
EPETRA_TEST_ERR
(
Drumm2
(Map, verbose),ierr);
99
100
101
bool
preconstruct_graph =
false
;
102
103
EPETRA_TEST_ERR
(
four_quads
(Comm, preconstruct_graph, verbose), ierr);
104
105
preconstruct_graph =
true
;
106
107
EPETRA_TEST_ERR
(
four_quads
(Comm, preconstruct_graph, verbose), ierr);
108
109
EPETRA_TEST_ERR
(
rectangular
(Comm, verbose), ierr);
110
111
EPETRA_TEST_ERR
(
Young1
(Comm, verbose), ierr);
112
113
#ifdef EPETRA_MPI
114
MPI_Finalize();
115
#endif
116
117
return
ierr;
118
}
119
Epetra_Version.h
Drumm2
int Drumm2(const Epetra_Map &map, bool verbose)
Definition:
FECrsGraph/ExecuteTestProblems.cpp:134
four_quads
int four_quads(const Epetra_Comm &Comm, bool preconstruct_graph, bool verbose)
Definition:
FECrsGraph/ExecuteTestProblems.cpp:206
EPETRA_TEST_ERR
#define EPETRA_TEST_ERR(a, b)
Definition:
epetra_test_err.h:55
Epetra_SerialComm::MyPID
int MyPID() const
Return my process ID.
Definition:
Epetra_SerialComm.h:432
Epetra_Version
std::string Epetra_Version()
Definition:
Epetra_Version.h:47
Epetra_SerialComm::NumProc
int NumProc() const
Returns total number of processes (always returns 1 for SerialComm).
Definition:
Epetra_SerialComm.h:435
Epetra_SerialComm.h
Epetra_MpiComm.h
Drumm1
int Drumm1(const Epetra_Map &map, bool verbose)
Definition:
FECrsGraph/ExecuteTestProblems.cpp:54
Epetra_MpiComm
Epetra_MpiComm: The Epetra MPI Communication Class.
Definition:
Epetra_MpiComm.h:64
Epetra_SerialComm
Epetra_SerialComm: The Epetra Serial Communication Class.
Definition:
Epetra_SerialComm.h:61
Young1
int Young1(const Epetra_Comm &Comm, bool verbose)
Definition:
FECrsGraph/ExecuteTestProblems.cpp:559
rectangular
int rectangular(const Epetra_Comm &Comm, bool verbose)
Definition:
FECrsGraph/ExecuteTestProblems.cpp:635
Epetra_Map.h
main
int main(int argc, char *argv[])
Definition:
test/FECrsGraph/cxx_main.cpp:57
Epetra_Map
Epetra_Map: A class for partitioning vectors and matrices.
Definition:
Epetra_Map.h:119
Epetra_Time.h
ExecuteTestProblems.h
Generated by
1.8.16