PetscTools.hpp File Reference

#include <string>
#include <vector>
#include <cstdlib>
#include <petsc.h>
#include <petscvec.h>
#include <petscmat.h>

Include dependency graph for PetscTools.hpp:

Go to the source code of this file.

Classes

class  PetscTools

Defines

#define EXIT_IF_PARALLEL   if(!PetscTools::IsSequential()){TS_TRACE("This test does not pass in parallel yet.");return;}
#define EXIT_IF_SEQUENTIAL   if(PetscTools::IsSequential()){TS_TRACE("This test is not meant to be executed in sequential.");return;}
#define TERMINATE(message)   PetscTools::Terminate(message, __FILE__, __LINE__)
#define NEVER_REACHED   PetscTools::Terminate("Should have been impossible to reach this line of code", __FILE__, __LINE__); exit(EXIT_FAILURE)


Detailed Description

Contains the PetscTools class, and the TERMINATE and NEVER_REACHED macros. The macros are defined here (rather than Exception.hpp) because they rely on MPI functionality to operate correctly when running in parallel.

Definition in file PetscTools.hpp.


Define Documentation

#define EXIT_IF_PARALLEL   if(!PetscTools::IsSequential()){TS_TRACE("This test does not pass in parallel yet.");return;}

For use in tests that do not work when run in parallel.

Definition at line 51 of file PetscTools.hpp.

#define EXIT_IF_SEQUENTIAL   if(PetscTools::IsSequential()){TS_TRACE("This test is not meant to be executed in sequential.");return;}

For use in tests that should ONLY be run in parallel.

Definition at line 53 of file PetscTools.hpp.

#define NEVER_REACHED   PetscTools::Terminate("Should have been impossible to reach this line of code", __FILE__, __LINE__); exit(EXIT_FAILURE)

Use for control paths that will never be executed, just to make sure they aren't.

The exit statement at the end of NEVER_REACHED is not really needed but prevents g++ from complaining about uninitialised variables when you have code that looks like:

   RelativeTo::Value relative_to;
   switch (rPath.relative_to())
   {
       case cp::relative_to_type::cwd:
           relative_to = RelativeTo::CWD;
           break;
       case cp::relative_to_type::chaste_test_output:
           relative_to = RelativeTo::ChasteTestOutput;
           break;
       case cp::relative_to_type::chaste_source_root:
           relative_to = RelativeTo::ChasteSourceRoot;
           break;
       case cp::relative_to_type::absolute:
           relative_to = RelativeTo::Absolute;
           break;
       default:
           NEVER_REACHED;
           break;
   }

relative_to is considered potentially uninitialised in the default branch unless the compiler finds a exit, assert or throw statement.

Definition at line 291 of file PetscTools.hpp.

Referenced by AbstractCellMutationState::AbstractCellMutationState(), Alarcon2004OxygenBasedCellCycleModel::AdjustOdeParameters(), AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::AppendLocalDataToFiles(), CellBasedSimulation< DIM >::CalculateCellDivisionVector(), AbstractTetrahedralElement< ELEMENT_DIM, SPACE_DIM >::CalculateWeightedDirection(), AbstractStimulusFunction::Clear(), CmguiDeformedSolutionsWriter< DIM >::CmguiDeformedSolutionsWriter(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CmguiMeshWriter(), QuadraticBasisFunction< ELEMENT_DIM >::ComputeBasisFunction(), QuadraticBasisFunction< ELEMENT_DIM >::ComputeBasisFunctionDerivative(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), CellwiseSourcePde< DIM >::ComputeLinearInUCoeffInSourceTerm(), AbstractFeObjectAssembler< DIM, DIM, 2, false, true, CARDIAC >::ComputeMatrixTerm(), AbstractFeObjectAssembler< DIM, DIM, 2, false, true, CARDIAC >::ComputeVectorSurfaceTerm(), AbstractFeObjectAssembler< DIM, DIM, 2, false, true, CARDIAC >::ComputeVectorTerm(), AbstractConvergenceTester< CELL, CARDIAC_PROBLEM, DIM, PROBLEM_DIM >::Converge(), CellMLToSharedLibraryConverter::ConvertCellmlToSo(), Cylindrical2dMesh::CorrectNonPeriodicMesh(), Alarcon2004OxygenBasedCellCycleModel::CreateCellCycleModel(), HeartConfigRelatedCellFactory< SPACE_DIM >::CreateCellWithIntracellularStimulus(), BidomainTissue< SPACE_DIM >::CreateExtracellularConductivityTensors(), AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::CreateFilesWithHeaders(), AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::CreateIntracellularConductivityTensor(), MeshBasedCellPopulation< 1 >::CreateVoronoiTessellation(), Determinant(), CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), AbstractBackwardEulerCardiacCell< SIZE >::EvaluateYDerivatives(), HeartConfigRelatedCellFactory< SPACE_DIM >::FillInCellularTransmuralAreas(), CryptCellsGenerator< CELL_CYCLE_MODEL >::Generate(), AbstractCellPopulation< DIM >::GenerateCellResults(), StreeterFibreGenerator< SPACE_DIM >::GenerateOrthotropicFibreOrientation(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetCentroidOfElement(), HeartGeometryInformation< SPACE_DIM >::GetDistanceToEndo(), StreeterFibreGenerator< SPACE_DIM >::GetFibreMaxAngle(), HeartConfig::GetInterNodeSpace(), HeartConfig::GetIonicModelRegions(), HeartConfig::GetStimuli(), SimpleWntCellCycleModel::GetWntLevel(), AbstractWntOdeBasedCellCycleModel::GetWntLevel(), SimpleWntCellCycleModel::GetWntType(), SpaceConvergenceTester< CELL, CARDIAC_PROBLEM, DIM, PROBLEM_DIM >::GiveUpConvergence(), HeartFileFinder::HeartFileFinder(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::IdentifySwapType(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Initialise(), Alarcon2004OxygenBasedCellCycleModel::Initialise(), AbstractCardiacTissue< SPACE_DIM >::LoadCardiacCells(), DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::MetisLibraryNodePartitioning(), CardiacSimulationArchiver< PROBLEM_CLASS >::Migrate(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT3Swap(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::PermuteNodes(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::ReadNodesPerProcessorFile(), AbstractCardiacTissue< SPACE_DIM >::save(), AbstractCardiacTissue< SPACE_DIM >::SaveCardiacCells(), SimpleWntCellCycleModel::SetG1Duration(), StochasticDurationGenerationBasedCellCycleModel::SetG1Duration(), AbstractSimpleCellCycleModel::SetG1Duration(), FileFinder::SetPath(), BoxCollection< DIM >::SetupAllLocalBoxes(), BoxCollection< DIM >::SetupLocalBoxesHalfOnly(), SubDeterminant(), SloughingCellKiller< DIM >::TestAndLabelCellsForApoptosisOrDeath(), SimpleWntCellCycleModel::UpdateCellCyclePhase(), SimpleOxygenBasedCellCycleModel::UpdateCellCyclePhase(), SimpleOxygenBasedCellCycleModel::UpdateHypoxicDuration(), AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesFooter(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteNodeFileHeader().

#define TERMINATE ( message   )     PetscTools::Terminate(message, __FILE__, __LINE__)

Terminate execution safely, even when running in parallel. Use for level 4 errors: execution cannot continue from this point and hence should be terminated (even when running with NDEBUG).

Parameters:
message explanatory message

Definition at line 258 of file PetscTools.hpp.

Referenced by AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve(), PCBlockDiagonal::PCBlockDiagonalCreate(), PCLDUFactorisation::PCLDUFactorisationCreate(), PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalCreate(), LinearSystem::SetPcType(), LinearSystem::Solve(), and CardiacNewtonSolver< SIZE >::Solve().


Generated on Mon Nov 1 12:35:25 2010 for Chaste by  doxygen 1.5.5