Epetra Package Browser (Single Doxygen Collection)
Development
Toggle main menu visibility
Loading...
Searching...
No Matches
test
Bugs
Bug_5988_FECrs_buildNonlocalGraph
test/Bugs/Bug_5988_FECrs_buildNonlocalGraph/cxx_main.cpp
Go to the documentation of this file.
1
#include <
Epetra_FECrsGraph.h
>
2
#include <
Epetra_FECrsMatrix.h
>
3
#include <
Epetra_MpiComm.h
>
4
5
6
int
main
(
int
argc,
char
**argv)
7
{
8
MPI_Init(&argc,&argv);
9
int
rank;
// My process ID
10
11
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
12
Epetra_MpiComm
Comm( MPI_COMM_WORLD );
13
14
int
NumMyEquations = 2;
15
Epetra_Map
Map(-1, NumMyEquations, 0, Comm);
16
17
Epetra_FECrsGraph
graph(
Copy
, Map, 0,
false
,
true
);
18
for
(
int
i=0; i<NumMyEquations; ++i)
19
{
20
int
entry = i+rank*2;
21
graph.
InsertGlobalIndices
(i+rank*2, 1, &entry);
22
}
23
{
24
int
row = 0;
25
int
col = 1;
26
if
(rank == 1)
27
graph.
InsertGlobalIndices
(1, &row, 1, &col);
28
}
29
graph.
GlobalAssemble
();
30
graph.
FillComplete
();
31
graph.
OptimizeStorage
();
32
33
Epetra_FECrsMatrix
matrix(
Copy
, graph);
34
{
35
int
row = 0;
36
int
col = 1;
37
double
value = 1;
38
if
(rank == 1)
39
matrix.
SumIntoGlobalValues
(1, &row, 1, &col, &value);
40
}
41
matrix.
GlobalAssemble
();
42
matrix.
FillComplete
();
43
double
norm = matrix.
NormFrobenius
();
44
if
(rank == 0) {
45
std::cout <<
"Frobenius norm (should be 1 with 2 or more processors): "
46
<< norm << std::endl;
47
if
(norm != 1)
48
std::cout <<
"tests FAILED"
<< std::endl;
49
}
50
MPI_Finalize();
51
}
52
Copy
@ Copy
Definition
Epetra_DataAccess.h:55
Epetra_FECrsGraph.h
Epetra_FECrsMatrix.h
Epetra_MpiComm.h
Epetra_CrsGraph::FillComplete
int FillComplete()
Tranform to local index space. Perform other operations to allow optimal matrix operations.
Definition
Epetra_CrsGraph.cpp:963
Epetra_CrsGraph::OptimizeStorage
int OptimizeStorage()
Make consecutive row index sections contiguous, minimize internal storage used for constructing graph...
Definition
Epetra_CrsGraph.cpp:1876
Epetra_CrsMatrix::FillComplete
int FillComplete(bool OptimizeDataStorage=true)
Signal that data entry is complete. Perform transformations to local index space.
Definition
Epetra_CrsMatrix.cpp:1140
Epetra_CrsMatrix::NormFrobenius
double NormFrobenius() const
Returns the frobenius norm of the global matrix.
Definition
Epetra_CrsMatrix.cpp:2113
Epetra_FECrsGraph
Epetra Finite-Element CrsGraph.
Definition
Epetra_FECrsGraph.h:65
Epetra_FECrsGraph::InsertGlobalIndices
int InsertGlobalIndices(int numRows, const int *rows, int numCols, const int *cols)
Insert a rectangular, dense 'submatrix' of entries (matrix nonzero positions) into the graph.
Definition
Epetra_FECrsGraph.cpp:169
Epetra_FECrsGraph::GlobalAssemble
int GlobalAssemble(bool callFillComplete=true)
Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was ...
Definition
Epetra_FECrsGraph.cpp:188
Epetra_FECrsMatrix
Epetra Finite-Element CrsMatrix.
Definition
Epetra_FECrsMatrix.h:120
Epetra_FECrsMatrix::SumIntoGlobalValues
int SumIntoGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
override base-class Epetra_CrsMatrix::SumIntoGlobalValues method
Definition
Epetra_FECrsMatrix.cpp:798
Epetra_FECrsMatrix::GlobalAssemble
int GlobalAssemble(bool callFillComplete=true, Epetra_CombineMode combineMode=Add, bool save_off_and_reuse_map_exporter=false)
Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was ...
Definition
Epetra_FECrsMatrix.cpp:966
Epetra_Map
Epetra_Map: A class for partitioning vectors and matrices.
Definition
Epetra_Map.h:119
Epetra_MpiComm
Epetra_MpiComm: The Epetra MPI Communication Class.
Definition
Epetra_MpiComm.h:64
main
int main(int argc, char **argv)
Definition
test/Bugs/Bug_5988_FECrs_buildNonlocalGraph/cxx_main.cpp:6
Generated by
1.17.0