00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _PETSCSETUPANDFINALIZE_HPP_
00031 #define _PETSCSETUPANDFINALIZE_HPP_
00032
00041 #include <cxxtest/GlobalFixture.h>
00042 #include <petsc.h>
00043 #include <cstdlib>
00044 #include <unistd.h>
00045 #include <iostream>
00046
00047 #include "Exception.hpp"
00048 #include "PetscException.hpp"
00049 #include "PetscArguments.hpp"
00050 #include "Version.hpp"
00051
00052 class PetscSetup : public CxxTest::GlobalFixture
00053 {
00054 public:
00056 bool setUpWorld()
00057 {
00062 PetscArguments* p_args = PetscArguments::Instance();
00063 PETSCEXCEPT(PetscInitialize(p_args->p_argc, p_args->p_argv,
00064 PETSC_NULL, PETSC_NULL) );
00065
00066 char buf[10000];
00067 std::cout << std::endl << "CWD: " << getcwd(buf, 10000) << std::endl;
00068 std::cout << "Root: " << GetChasteRoot() << std::endl;
00069 EXPECT0(chdir, GetChasteRoot());
00070 std::cout << "CWD: " << getcwd(buf, 10000) << std::endl;
00071
00072 return true;
00073 }
00075 bool tearDownWorld()
00076 {
00077
00078 PETSCEXCEPT(PetscFinalize());
00079 return true;
00080 }
00081 };
00082
00083 static PetscSetup thisSetup;
00084
00085
00086 #endif //_PETSCSETUPANDFINALIZE_HPP_