petsc_01.exe : petsc_01.g.$(OBJEXT) $(libraries)
petsc_02.exe : petsc_02.g.$(OBJEXT) $(libraries)
petsc_03.exe : petsc_03.g.$(OBJEXT) $(libraries)
+petsc_03a.exe : petsc_03a.g.$(OBJEXT) $(libraries)
+petsc_03b.exe : petsc_03b.g.$(OBJEXT) $(libraries)
petsc_04.exe : petsc_04.g.$(OBJEXT) $(libraries)
petsc_05.exe : petsc_05.g.$(OBJEXT) $(libraries)
petsc_06.exe : petsc_06.g.$(OBJEXT) $(libraries)
petsc_10.exe : petsc_10.g.$(OBJEXT) $(libraries)
petsc_11.exe : petsc_11.g.$(OBJEXT) $(libraries)
petsc_12.exe : petsc_12.g.$(OBJEXT) $(libraries)
+petsc_13.exe : petsc_13.g.$(OBJEXT) $(libraries)
+petsc_14.exe : petsc_14.g.$(OBJEXT) $(libraries)
+petsc_15.exe : petsc_15.g.$(OBJEXT) $(libraries)
+petsc_16.exe : petsc_16.g.$(OBJEXT) $(libraries)
+petsc_17.exe : petsc_17.g.$(OBJEXT) $(libraries)
+petsc_18.exe : petsc_18.g.$(OBJEXT) $(libraries)
tests = anna_1 anna_2 anna_3 anna_4 anna_5 anna_6 \
geometry_info_1 point_inside_1 point_inside_2 \
sparse_matrix_10
ifeq ($(USE_CONTRIB_HSL),yes)
- tests += petsc_01 petsc_02 petsc_03 petsc_04 petsc_05 petsc_06 \
- petsc_07 petsc_08 petsc_09 petsc_10 petsc_11 petsc_12
+ tests += petsc_01 petsc_02 petsc_03 petsc_03a petsc_03b \
+ petsc_04 petsc_05 petsc_06 \
+ petsc_07 petsc_08 petsc_09 petsc_10 petsc_11 petsc_12 \
+ petsc_13 petsc_14 petsc_15 petsc_16 petsc_17 petsc_18
endif
############################################################
--- /dev/null
+//---------------------------- petsc_03a.cc ---------------------------
+// petsc_03a.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+// Version:
+//
+// Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- petsc_03a.cc ---------------------------
+
+
+// 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 petsc_03, we set and add the same elements here twice, to
+// get double the original value
+
+#include "../tests.h"
+#include <lac/petsc_sparse_matrix.h>
+#include <fstream>
+#include <iostream>
+
+
+void test (petsc_wrappers::SparseMatrix &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 ();
+
+ // 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)
+ {
+ Assert (m(i,j) == 2*(i*j*.5+.5), ExcInternalError());
+ Assert (m.el(i,j) == 2*(i*j*.5+.5), ExcInternalError());
+ }
+ else
+ {
+ Assert (m(i,j) == 0, ExcInternalError());
+ Assert (m.el(i,j) == 0, ExcInternalError());
+ }
+
+ deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+ std::ofstream logfile("petsc_03a.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ try
+ {
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ petsc_wrappers::SparseMatrix m (5,5,3);
+ test (m);
+ }
+ PetscFinalize();
+ }
+ catch (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;
+ };
+}
--- /dev/null
+//---------------------------- petsc_03b.cc ---------------------------
+// petsc_03b.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+// Version:
+//
+// Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- petsc_03b.cc ---------------------------
+
+
+// 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 petsc_03a, we set and add the same elements here twice, then
+// overwrite them again to get the original value back
+
+#include "../tests.h"
+#include <lac/petsc_sparse_matrix.h>
+#include <fstream>
+#include <iostream>
+
+
+void test (petsc_wrappers::SparseMatrix &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);
+ // and overwrite everything 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.set (i,j, i*j*.5+.5);
+
+ m.compress ();
+
+ // 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)
+ {
+ Assert (m(i,j) == i*j*.5+.5, ExcInternalError());
+ Assert (m.el(i,j) == i*j*.5+.5, ExcInternalError());
+ }
+ else
+ {
+ Assert (m(i,j) == 0, ExcInternalError());
+ Assert (m.el(i,j) == 0, ExcInternalError());
+ }
+
+ deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+ std::ofstream logfile("petsc_03b.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ try
+ {
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ petsc_wrappers::SparseMatrix m (5,5,3);
+ test (m);
+ }
+ PetscFinalize();
+ }
+ catch (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;
+ };
+}
--- /dev/null
+//---------------------------- petsc_11.cc ---------------------------
+// petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+// Version:
+//
+// Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- petsc_11.cc ---------------------------
+
+
+// check petsc_wrapper::Vector::size()
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>
+#include <fstream>
+#include <iostream>
+
+
+void test (petsc_wrappers::Vector &v)
+{
+ // set only certain elements of the vector
+ for (unsigned int i=0; i<v.size(); i+=1+i)
+ v(i) = i;
+
+ v.compress ();
+
+ Assert (v.size() == 100, ExcInternalError());
+
+ deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+ std::ofstream logfile("petsc_11.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ try
+ {
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ petsc_wrappers::Vector v (100);
+ test (v);
+ }
+ PetscFinalize();
+ }
+ catch (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;
+ };
+}
--- /dev/null
+//---------------------------- petsc_12.cc ---------------------------
+// petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+// Version:
+//
+// Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- petsc_12.cc ---------------------------
+
+
+// check petsc_wrapper::Vector::operator() in set-mode
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v)
+{
+ // set only certain elements of the
+ // vector. have a bit pattern of where we
+ // actually wrote elements to
+ std::vector<bool> pattern (v.size(), false);
+ for (unsigned int i=0; i<v.size(); i+=1+i)
+ {
+ v(i) = i;
+ pattern[i] = true;
+ }
+
+ v.compress ();
+
+ // check that they are ok, and this time
+ // all of them
+ for (unsigned int i=0; i<v.size(); ++i)
+ Assert (((pattern[i] == true) && (v(i) == i)
+ ||
+ (pattern[i] == false) && (v(i) == 0)),
+ ExcInternalError());
+
+ deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+ std::ofstream logfile("petsc_12.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ try
+ {
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ petsc_wrappers::Vector v (100);
+ test (v);
+ }
+ PetscFinalize();
+ }
+ catch (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;
+ };
+}
--- /dev/null
+//---------------------------- petsc_13.cc ---------------------------
+// petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+// Version:
+//
+// Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- petsc_13.cc ---------------------------
+
+
+// check petsc_wrapper::Vector::operator() in add-mode
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v)
+{
+ // set only certain elements of the
+ // vector. have a bit pattern of where we
+ // actually wrote elements to
+ std::vector<bool> pattern (v.size(), false);
+ for (unsigned int i=0; i<v.size(); i+=1+i)
+ {
+ v(i) += i;
+ pattern[i] = true;
+ }
+
+ v.compress ();
+
+ // check that they are ok, and this time
+ // all of them
+ for (unsigned int i=0; i<v.size(); ++i)
+ Assert (((pattern[i] == true) && (v(i) == i)
+ ||
+ (pattern[i] == false) && (v(i) == 0)),
+ ExcInternalError());
+
+ deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+ std::ofstream logfile("petsc_13.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ try
+ {
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ petsc_wrappers::Vector v (100);
+ test (v);
+ }
+ PetscFinalize();
+ }
+ catch (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;
+ };
+}
--- /dev/null
+//---------------------------- petsc_14.cc ---------------------------
+// petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+// Version:
+//
+// Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- petsc_14.cc ---------------------------
+
+
+// check petsc_wrapper::Vector::operator() in set/add-mode alternatingly
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v)
+{
+ // set only certain elements of the
+ // vector. have a bit pattern of where we
+ // actually wrote elements to
+ std::vector<bool> pattern (v.size(), false);
+ bool flag = false;
+ for (unsigned int i=0; i<v.size(); i+=1+i)
+ {
+ if (flag == true)
+ v(i) += i;
+ else
+ v(i) = i;
+ flag = !flag;
+
+ pattern[i] = true;
+ }
+
+ v.compress ();
+
+ // check that they are ok, and this time
+ // all of them
+ for (unsigned int i=0; i<v.size(); ++i)
+ Assert (((pattern[i] == true) && (v(i) == i)
+ ||
+ (pattern[i] == false) && (v(i) == 0)),
+ ExcInternalError());
+
+ deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+ std::ofstream logfile("petsc_14.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ try
+ {
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ petsc_wrappers::Vector v (100);
+ test (v);
+ }
+ PetscFinalize();
+ }
+ catch (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;
+ };
+}
--- /dev/null
+//---------------------------- petsc_15.cc ---------------------------
+// petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+// Version:
+//
+// Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- petsc_15.cc ---------------------------
+
+
+// check petsc_wrapper::Vector::operator() in set/add-mode alternatingly, but
+// writing to the same elements
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v)
+{
+ // set only certain elements of the
+ // vector. have a bit pattern of where we
+ // actually wrote elements to
+ std::vector<bool> pattern (v.size(), false);
+ for (unsigned int i=0; i<v.size(); i+=1+i)
+ {
+ v(i) = i;
+ pattern[i] = true;
+ }
+ for (unsigned int i=0; i<v.size(); i+=1+i)
+ v(i) += i;
+
+ v.compress ();
+
+ // check that they are ok, and this time
+ // all of them
+ for (unsigned int i=0; i<v.size(); ++i)
+ Assert (((pattern[i] == true) && (v(i) == 2*i)
+ ||
+ (pattern[i] == false) && (v(i) == 0)),
+ ExcInternalError());
+
+ deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+ std::ofstream logfile("petsc_15.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ try
+ {
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ petsc_wrappers::Vector v (100);
+ test (v);
+ }
+ PetscFinalize();
+ }
+ catch (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;
+ };
+}
--- /dev/null
+//---------------------------- petsc_16.cc ---------------------------
+// petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+// Version:
+//
+// Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- petsc_16.cc ---------------------------
+
+
+// check petsc_wrapper::Vector::operator() in set/add-mode alternatingly, but
+// writing and overwriting the same elements
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v)
+{
+ // set only certain elements of the
+ // vector. have a bit pattern of where we
+ // actually wrote elements to
+ std::vector<bool> pattern (v.size(), false);
+ for (unsigned int i=0; i<v.size(); i+=1+i)
+ {
+ v(i) = i;
+ pattern[i] = true;
+ }
+ for (unsigned int i=0; i<v.size(); i+=1+i)
+ v(i) += i;
+ for (unsigned int i=0; i<v.size(); i+=1+i)
+ v(i) = i;
+
+ v.compress ();
+
+ // check that they are ok, and this time
+ // all of them
+ for (unsigned int i=0; i<v.size(); ++i)
+ Assert (((pattern[i] == true) && (v(i) == i)
+ ||
+ (pattern[i] == false) && (v(i) == 0)),
+ ExcInternalError());
+
+ deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+ std::ofstream logfile("petsc_16.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ try
+ {
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ petsc_wrappers::Vector v (100);
+ test (v);
+ }
+ PetscFinalize();
+ }
+ catch (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;
+ };
+}