Epetra Package Browser (Single Doxygen Collection)
Development
test
FECrsMatrix
test/FECrsMatrix/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_FECrsMatrix Test routine
44
45
#include "
Epetra_Time.h
"
46
#include "
Epetra_Map.h
"
47
#include "
Epetra_FECrsMatrix.h
"
48
#include "
ExecuteTestProblems.h
"
49
#ifdef EPETRA_MPI
50
#include "
Epetra_MpiComm.h
"
51
#include <mpi.h>
52
#else
53
#include "
Epetra_SerialComm.h
"
54
#endif
55
#include "../epetra_test_err.h"
56
#include "
Epetra_Version.h
"
57
58
int
main
(
int
argc,
char
*argv[]) {
59
60
int
ierr = 0;
61
62
#ifdef EPETRA_MPI
63
64
// Initialize MPI
65
66
MPI_Init(&argc,&argv);
67
Epetra_MpiComm
Comm(MPI_COMM_WORLD);
68
69
#else
70
71
Epetra_SerialComm
Comm;
72
73
#endif
74
75
// Comm.SetTracebackMode(0); // This should shut down any error tracing
76
bool
verbose =
false
;
77
78
// Check if we should print results to standard out
79
if
(argc>1)
if
(argv[1][0]==
'-'
&& argv[1][1]==
'v'
) verbose =
true
;
80
81
#ifdef EPETRA_MPI
82
int
localverbose = verbose ? 1 : 0;
83
int
globalverbose=0;
84
MPI_Allreduce(&localverbose, &globalverbose, 1, MPI_INT, MPI_SUM,
85
MPI_COMM_WORLD);
86
verbose = (globalverbose>0);
87
#endif
88
89
int
MyPID = Comm.
MyPID
();
90
int
NumProc = Comm.
NumProc
();
91
92
if
(verbose && MyPID==0)
93
cout <<
Epetra_Version
() << endl << endl;
94
95
if
(verbose) cout << Comm <<endl;
96
97
// Redefine verbose to only print on PE 0
98
//if (verbose && rank!=0) verbose = false;
99
100
int
NumMyElements = 4;
101
int
NumGlobalElements = NumMyElements*NumProc;
102
int
IndexBase = 0;
103
104
Epetra_Map
Map(NumGlobalElements, NumMyElements, IndexBase, Comm);
105
106
EPETRA_TEST_ERR
(
Drumm1
(Map, verbose),ierr);
107
108
EPETRA_TEST_ERR
(
Drumm2
(Map, verbose),ierr);
109
110
EPETRA_TEST_ERR
(
Drumm3
(Map, verbose),ierr);
111
112
113
bool
preconstruct_graph =
false
;
114
115
EPETRA_TEST_ERR
(
four_quads
(Comm, preconstruct_graph, verbose), ierr);
116
117
preconstruct_graph =
true
;
118
119
EPETRA_TEST_ERR
(
four_quads
(Comm, preconstruct_graph, verbose), ierr);
120
121
EPETRA_TEST_ERR
(
submatrix_formats
(Comm, verbose), ierr);
122
123
EPETRA_TEST_ERR
(
rectangular
(Comm, verbose), ierr);
124
125
#ifdef EPETRA_MPI
126
MPI_Finalize();
127
#endif
128
129
return
ierr;
130
}
131
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
submatrix_formats
int submatrix_formats(const Epetra_Comm &Comm, bool verbose)
Definition:
FECrsMatrix/ExecuteTestProblems.cpp:684
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_FECrsMatrix.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
rectangular
int rectangular(const Epetra_Comm &Comm, bool verbose)
Definition:
FECrsGraph/ExecuteTestProblems.cpp:635
main
int main(int argc, char *argv[])
Definition:
test/FECrsMatrix/cxx_main.cpp:58
ExecuteTestProblems.h
Epetra_Map.h
Drumm3
int Drumm3(const Epetra_Map &map, bool verbose)
Definition:
FECrsMatrix/ExecuteTestProblems.cpp:307
Epetra_Map
Epetra_Map: A class for partitioning vectors and matrices.
Definition:
Epetra_Map.h:119
Epetra_Time.h
Generated by
1.8.16