-
Notifications
You must be signed in to change notification settings - Fork 707
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
476 changed files
with
36,750 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// --------------------------------------------------------------------- | ||
// | ||
// Copyright (C) 2004 - 2018 by the deal.II authors | ||
// | ||
// This file is part of the deal.II library. | ||
// | ||
// The deal.II library is free software; you can use it, redistribute | ||
// it, and/or modify it under the terms of the GNU Lesser General | ||
// Public License as published by the Free Software Foundation; either | ||
// version 2.1 of the License, or (at your option) any later version. | ||
// The full text of the license can be found in the file LICENSE.md at | ||
// the top level directory of deal.II. | ||
// | ||
// --------------------------------------------------------------------- | ||
|
||
|
||
|
||
// check setting elements in a trilinos matrix using | ||
// LinearAlgebra::TpetraWrappers::SparseMatrix<double>::set() | ||
|
||
#include <deal.II/base/utilities.h> | ||
|
||
#include <deal.II/lac/trilinos_tpetra_sparse_matrix.h> | ||
|
||
#include <iostream> | ||
|
||
#include "../tests.h" | ||
|
||
|
||
void | ||
test(LinearAlgebra::TpetraWrappers::SparseMatrix<double> &m) | ||
{ | ||
// first set a few entries | ||
for (unsigned int i = 0; i < m.m(); ++i) | ||
for (unsigned int j = 0; j < m.m(); ++j) | ||
if ((i + 2 * j + 1) % 3 == 0) | ||
m.set(i, j, i * j * .5 + .5); | ||
|
||
m.compress(VectorOperation::insert); | ||
|
||
// then make sure we retrieve the same ones | ||
for (unsigned int i = 0; i < m.m(); ++i) | ||
for (unsigned int j = 0; j < m.m(); ++j) | ||
if ((i + 2 * j + 1) % 3 == 0) | ||
{ | ||
AssertThrow(m(i, j) == i * j * .5 + .5, ExcInternalError()); | ||
AssertThrow(m.el(i, j) == i * j * .5 + .5, ExcInternalError()); | ||
} | ||
else | ||
{ | ||
AssertThrow(m.el(i, j) == 0, ExcInternalError()); | ||
} | ||
|
||
deallog << "OK" << std::endl; | ||
} | ||
|
||
|
||
|
||
int | ||
main(int argc, char **argv) | ||
{ | ||
initlog(); | ||
|
||
Utilities::MPI::MPI_InitFinalize mpi_initialization( | ||
argc, argv, testing_max_num_threads()); | ||
|
||
try | ||
{ | ||
{ | ||
LinearAlgebra::TpetraWrappers::SparseMatrix<double> m(5U, 5U, 3U); | ||
test(m); | ||
} | ||
} | ||
catch (const std::exception &exc) | ||
{ | ||
std::cerr << std::endl | ||
<< std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
std::cerr << "Exception on processing: " << std::endl | ||
<< exc.what() << std::endl | ||
<< "Aborting!" << std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
|
||
return 1; | ||
} | ||
catch (...) | ||
{ | ||
std::cerr << std::endl | ||
<< std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
std::cerr << "Unknown exception!" << std::endl | ||
<< "Aborting!" << std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
return 1; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
DEAL::OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// --------------------------------------------------------------------- | ||
// | ||
// Copyright (C) 2004 - 2018 by the deal.II authors | ||
// | ||
// This file is part of the deal.II library. | ||
// | ||
// The deal.II library is free software; you can use it, redistribute | ||
// it, and/or modify it under the terms of the GNU Lesser General | ||
// Public License as published by the Free Software Foundation; either | ||
// version 2.1 of the License, or (at your option) any later version. | ||
// The full text of the license can be found in the file LICENSE.md at | ||
// the top level directory of deal.II. | ||
// | ||
// --------------------------------------------------------------------- | ||
|
||
|
||
|
||
// check setting elements in a petsc matrix using | ||
// LinearAlgebra::TpetraWrappers::SparseMatrix<double>::add() | ||
|
||
#include <deal.II/base/utilities.h> | ||
|
||
#include <deal.II/lac/trilinos_tpetra_sparse_matrix.h> | ||
|
||
#include <iostream> | ||
|
||
#include "../tests.h" | ||
|
||
|
||
void | ||
test(LinearAlgebra::TpetraWrappers::SparseMatrix<double> &m) | ||
{ | ||
// first set a few entries | ||
for (unsigned int i = 0; i < m.m(); ++i) | ||
for (unsigned int j = 0; j < m.m(); ++j) | ||
if ((i + 2 * j + 1) % 3 == 0) | ||
m.set(i, j, 0.); | ||
|
||
// then add values to these entries | ||
for (unsigned int i = 0; i < m.m(); ++i) | ||
for (unsigned int j = 0; j < m.m(); ++j) | ||
if ((i + 2 * j + 1) % 3 == 0) | ||
m.add(i, j, i * j * .5 + .5); | ||
|
||
m.compress(VectorOperation::add); | ||
|
||
// then make sure we retrieve the same ones | ||
for (unsigned int i = 0; i < m.m(); ++i) | ||
for (unsigned int j = 0; j < m.m(); ++j) | ||
if ((i + 2 * j + 1) % 3 == 0) | ||
{ | ||
AssertThrow(m(i, j) == i * j * .5 + .5, ExcInternalError()); | ||
AssertThrow(m.el(i, j) == i * j * .5 + .5, ExcInternalError()); | ||
} | ||
else | ||
{ | ||
AssertThrow(m.el(i, j) == 0, ExcInternalError()); | ||
} | ||
|
||
deallog << "OK" << std::endl; | ||
} | ||
|
||
|
||
|
||
int | ||
main(int argc, char **argv) | ||
{ | ||
initlog(); | ||
|
||
Utilities::MPI::MPI_InitFinalize mpi_initialization( | ||
argc, argv, testing_max_num_threads()); | ||
|
||
try | ||
{ | ||
{ | ||
LinearAlgebra::TpetraWrappers::SparseMatrix<double> m(5U, 5U, 3U); | ||
test(m); | ||
} | ||
} | ||
catch (const std::exception &exc) | ||
{ | ||
std::cerr << std::endl | ||
<< std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
std::cerr << "Exception on processing: " << std::endl | ||
<< exc.what() << std::endl | ||
<< "Aborting!" << std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
|
||
return 1; | ||
} | ||
catch (...) | ||
{ | ||
std::cerr << std::endl | ||
<< std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
std::cerr << "Unknown exception!" << std::endl | ||
<< "Aborting!" << std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
return 1; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
DEAL::OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// --------------------------------------------------------------------- | ||
// | ||
// Copyright (C) 2004 - 2018 by the deal.II authors | ||
// | ||
// This file is part of the deal.II library. | ||
// | ||
// The deal.II library is free software; you can use it, redistribute | ||
// it, and/or modify it under the terms of the GNU Lesser General | ||
// Public License as published by the Free Software Foundation; either | ||
// version 2.1 of the License, or (at your option) any later version. | ||
// The full text of the license can be found in the file LICENSE.md at | ||
// the top level directory of deal.II. | ||
// | ||
// --------------------------------------------------------------------- | ||
|
||
|
||
|
||
// check setting elements in a petsc matrix using set() and add() | ||
// intermixed. this poses PETSc some problems, since one has to flush some | ||
// buffer in between these two types of operations | ||
// | ||
// in contrast to trilinos_03, we set and add the same elements here twice, to | ||
// get double the original value | ||
|
||
#include <deal.II/base/utilities.h> | ||
|
||
#include <deal.II/lac/trilinos_tpetra_sparse_matrix.h> | ||
|
||
#include <iostream> | ||
|
||
#include "../tests.h" | ||
|
||
|
||
void | ||
test(LinearAlgebra::TpetraWrappers::SparseMatrix<double> &m) | ||
{ | ||
// first set a few entries | ||
for (unsigned int i = 0; i < m.m(); ++i) | ||
for (unsigned int j = 0; j < m.m(); ++j) | ||
if ((i + 2 * j + 1) % 3 == 0) | ||
m.set(i, j, i * j * .5 + .5); | ||
|
||
// then add the same elements again | ||
for (unsigned int i = 0; i < m.m(); ++i) | ||
for (unsigned int j = 0; j < m.m(); ++j) | ||
if ((i + 2 * j + 1) % 3 == 0) | ||
m.add(i, j, i * j * .5 + .5); | ||
|
||
m.compress(VectorOperation::add); | ||
|
||
// then make sure we retrieve the same ones | ||
for (unsigned int i = 0; i < m.m(); ++i) | ||
for (unsigned int j = 0; j < m.m(); ++j) | ||
if ((i + 2 * j + 1) % 3 == 0) | ||
{ | ||
AssertThrow(m(i, j) == 2 * (i * j * .5 + .5), ExcInternalError()); | ||
AssertThrow(m.el(i, j) == 2 * (i * j * .5 + .5), ExcInternalError()); | ||
} | ||
else | ||
{ | ||
AssertThrow(m.el(i, j) == 0, ExcInternalError()); | ||
} | ||
|
||
deallog << "OK" << std::endl; | ||
} | ||
|
||
|
||
|
||
int | ||
main(int argc, char **argv) | ||
{ | ||
initlog(); | ||
|
||
Utilities::MPI::MPI_InitFinalize mpi_initialization( | ||
argc, argv, testing_max_num_threads()); | ||
|
||
try | ||
{ | ||
{ | ||
LinearAlgebra::TpetraWrappers::SparseMatrix<double> m(5U, 5U, 3U); | ||
test(m); | ||
} | ||
} | ||
catch (const std::exception &exc) | ||
{ | ||
std::cerr << std::endl | ||
<< std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
std::cerr << "Exception on processing: " << std::endl | ||
<< exc.what() << std::endl | ||
<< "Aborting!" << std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
|
||
return 1; | ||
} | ||
catch (...) | ||
{ | ||
std::cerr << std::endl | ||
<< std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
std::cerr << "Unknown exception!" << std::endl | ||
<< "Aborting!" << std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
return 1; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
DEAL::OK |
Oops, something went wrong.