From ba87c9a243798cf328f84d9f8c164ca852db91c7 Mon Sep 17 00:00:00 2001 From: young Date: Mon, 28 Jan 2013 16:16:36 +0000 Subject: [PATCH] Skeleton SLEPC import. git-svn-id: https://svn.dealii.org/trunk@28185 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/Makefile | 1 + tests/slepc/00.cc | 93 ++++++++++++++++++++++++++++++++++++++ tests/slepc/00/cmp/generic | 8 ++++ tests/slepc/Makefile | 10 ++++ 4 files changed, 112 insertions(+) create mode 100644 tests/slepc/00.cc create mode 100644 tests/slepc/00/cmp/generic create mode 100644 tests/slepc/Makefile diff --git a/tests/Makefile b/tests/Makefile index cdcf4d72af..f5d0503d22 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -23,6 +23,7 @@ nofail-dirs = a-framework \ $(if $(DEAL_II_USE_MPI:no=), $(if $(USE_CONTRIB_P4EST:no=),mpi,),) \ $(if $(USE_CONTRIB_P4EST:no=), distributed_grids,) \ $(if $(USE_CONTRIB_PETSC:no=), petsc,) \ + $(if $(USE_CONTRIB_SLEPC:no=), slepc,) \ $(if $(USE_CONTRIB_TRILINOS:no=), trilinos,) \ $(if $(USE_CONTRIB_UMFPACK:no=), umfpack,) \ $(if $(USE_CONTRIB_METIS:no=), metis,) \ diff --git a/tests/slepc/00.cc b/tests/slepc/00.cc new file mode 100644 index 0000000000..8265474c6b --- /dev/null +++ b/tests/slepc/00.cc @@ -0,0 +1,93 @@ +//------------------------------------------------------- +// $Id: 01.cc 24924 2013-01-28 young $ +// Version: $Name$ +// +// Copyright (C) 2013 by the deal.II authors +// +// 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. +// +//------------------------------------------------------- + + +// just check initialising SLEPc can be done and that it initialises +// PETSc in the way we expect, ie. *a* PETSc object exist. + +#include "../tests.h" +#include +#include +#include +#include +#include + +std::ofstream logfile ("00/output"); + +int main (int argc,char **argv) +{ + deallog.attach (logfile); + deallog.depth_console (1); + + try + { + + logfile << "Initializing SLEPc (PETSc): " + << std::flush; + + SlepcInitialize (&argc, &argv, 0, 0); + { + logfile << "ok" + << std::endl; + + // Do something simple with PETSc + logfile << "Using PetscScalar:" + << std::endl; + + const PetscScalar pi = numbers::PI; + const PetscScalar two = 2.; + + logfile << " pi: " << pi + << std::endl + << " two: " << two + << std::endl + << " two times pi: " << two*pi + << std::endl; + + + logfile << "Finalizing SLEPc (PETSc): " + << std::flush; + + } + SlepcFinalize (); + + logfile << "ok" + << std::endl << std::endl; + } + + 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; + }; +} diff --git a/tests/slepc/00/cmp/generic b/tests/slepc/00/cmp/generic new file mode 100644 index 0000000000..d96846cb73 --- /dev/null +++ b/tests/slepc/00/cmp/generic @@ -0,0 +1,8 @@ + +Initializing SLEPc (PETSc): ok +Using PetscScalar: + pi: 3.14159 + two: 2.00000 + two times pi: 6.28319 +Finalizing SLEPc (PETSc): ok + diff --git a/tests/slepc/Makefile b/tests/slepc/Makefile new file mode 100644 index 0000000000..a722f76008 --- /dev/null +++ b/tests/slepc/Makefile @@ -0,0 +1,10 @@ +############################################################ +# Makefile,v 1.15 2002/06/13 12:51:13 hartmann Exp +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +############################################################ + +include ../Makefile.paths +include $D/common/Make.global_options +include ../Makefile.rules +include Makefile.depend +include Makefile.tests -- 2.39.5