Exception.hpp File Reference

#include <string>
#include <sstream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <boost/preprocessor/stringize.hpp>
Include dependency graph for Exception.hpp:

Go to the source code of this file.

Classes

class  Exception

Defines

#define EXCEPTION(message)
#define EXCEPT_IF_NOT(test)   if (!(test)) EXCEPTION("Assertion tripped: " BOOST_PP_STRINGIZE(test))
#define TERMINATE(message)   Exception::Terminate(message, __FILE__, __LINE__)
#define NEVER_REACHED   TERMINATE("Should have been impossible to reach this line of code"); exit(EXIT_FAILURE)
#define UNUSED_OPT(var)
#define EXPECT0(cmd, arg)
#define ABORT_IF_NON0_WITH_MSG(retcode, msg)
#define ABORT_IF_NON0(cmd, arg)
#define EXPECT_NON0(cmd, arg)
#define IGNORE_RET(cmd, arg)

Variables

const unsigned UNSIGNED_UNSET = UINT_MAX
const int INT_UNSET = INT_MAX
const double DOUBLE_UNSET = DBL_MAX

Detailed Description

Contains the Exception class, along with some macros that are widely used throughout the code.

Definition in file Exception.hpp.


Define Documentation

#define ABORT_IF_NON0 ( cmd,
arg   ) 
Value:
{ \
    std::string _arg(arg);        \
    int ret = cmd(_arg.c_str());  \
    ABORT_IF_NON0_WITH_MSG(ret, "Error executing command: " #cmd "(" + _arg + ")") \
    }

Handy for calling functions like system which return non-zero on error. Terminate if an error occurs.

This macro should be used instead of EXPECT0 within blocks that are only executed by one process, but need to kill all processes if an error occurs.

Parameters:
cmd command to call
arg its argument (will be converted to std::string)

Definition at line 248 of file Exception.hpp.

Referenced by AbstractConvergenceTester< CELL, CARDIAC_PROBLEM, DIM, PROBLEM_DIM >::Converge(), OutputFileHandler::CopyFileTo(), HeartConfig::CopySchema(), CardiacSimulation::CreateAndRun(), OutputDirectoryFifoQueue::CreateNextDir(), OutputFileHandler::MakeFoldersAndReturnFullPath(), OutputFileHandler::OutputFileHandler(), AbstractTetrahedralMesh< SPACE_DIM, SPACE_DIM >::save(), and AbstractCardiacTissue< SPACE_DIM >::save().

#define ABORT_IF_NON0_WITH_MSG ( retcode,
msg   ) 
Value:
if (retcode != 0) {                          \
        TERMINATE(msg);                          \
    }

Handy for calling functions like system which return non-zero on error. Terminate if the return code is non-zero, printing a suitable message.

Parameters:
retcode command return code
msg error message to display

Definition at line 233 of file Exception.hpp.

#define EXCEPT_IF_NOT ( test   )     if (!(test)) EXCEPTION("Assertion tripped: " BOOST_PP_STRINGIZE(test))
#define EXCEPTION ( message   ) 
Value:
do {                                             \
        std::stringstream msg_stream;                \
        msg_stream << message;                       \
        throw Exception(msg_stream.str(), __FILE__, __LINE__); \
    } while (false)

Convenience macro for throwing an exception, in order to add file and line info.

Parameters:
message the error message to use, as a streamed expression

Definition at line 136 of file Exception.hpp.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AbstractCardiacProblem(), AbstractCellPopulation< DIM >::AbstractCellPopulation(), AbstractHdf5Converter< ELEMENT_DIM, SPACE_DIM >::AbstractHdf5Converter(), CaBasedCellPopulation< DIM >::AddCell(), VertexCryptBoundaryForce< DIM >::AddForceContribution(), LinearSpringWithVariableSpringConstantsForce< DIM >::AddForceContribution(), CryptProjectionForce::AddForceContribution(), WelikyOsterForce< DIM >::AddForceContribution(), RepulsionForce< DIM >::AddForceContribution(), NagaiHondaForce< DIM >::AddForceContribution(), AbstractTwoBodyInteractionForce< DIM >::AddForceContribution(), QuadraticMesh< DIM >::AddNodesToBoundaryElements(), CellPropertyCollection::AddProperty(), AbstractCardiacCell::AdjustOutOfRangeSlowValues(), RungeKuttaFehlbergIvpOdeSolver::AdjustStepSize(), Hdf5DataWriter::AdvanceAlongUnlimitedDimension(), TimeStepper::AdvanceOneTimeStep(), BidomainProblem< DIM >::AnalyseMeshForBath(), Hdf5DataWriter::ApplyPermutation(), ArchiveOpener< Archive, Stream >::ArchiveOpener(), AxisymmetricConductivityTensors< ELEMENT_DIM, SPACE_DIM >::AxisymmetricConductivityTensors(), AbstractFunctionalCalculator< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Calculate(), PropagationPropertiesCalculator::CalculateActionPotentialDuration(), CellProperties::CalculateActionPotentialDurations(), NhsModelWithBackwardSolver::CalculateCaTropAndZDerivatives(), BoxCollection< DIM >::CalculateContainingBox(), AbstractTetrahedralElement< ELEMENT_DIM, SPACE_DIM >::CalculateJacobian(), AbstractTetrahedralElement< ELEMENT_DIM, SPACE_DIM >::CalculateNormal(), CellProperties::CalculateProperties(), AbstractTetrahedralElement< ELEMENT_DIM, SPACE_DIM >::CalculateWeightedDirection(), CardiacSimulation::CardiacSimulation(), Cell::Cell(), ChasteCuboid< SPACE_DIM >::ChasteCuboid(), ChasteEllipsoid< SPACE_DIM >::ChasteEllipsoid(), SolidMechanicsProblemDefinition< DIM >::CheckCastSuccess(), AbstractExtendedBidomainSolver< ELEMENT_DIM, SPACE_DIM >::CheckCompatibilityCondition(), AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::CheckCompatibilityCondition(), CellProperties::CheckExceededThreshold(), ColumnDataReader::CheckFiles(), ElectrodesStimulusFactory< DIM >::CheckForElectrodesIntersection(), XmlTransforms::CheckForIluPreconditioner(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::CheckOutwardNormals(), HeartConfig::CheckResumeSimulationIsDefined(), CellProperties::CheckReturnedToThreshold(), HeartConfig::CheckSimulationIsDefined(), HeartConfig::CheckTimeSteps(), Hdf5DataWriter::CheckUnitsName(), ColumnDataWriter::CheckUnitsName(), Hdf5DataWriter::CheckVariableName(), ColumnDataWriter::CheckVariableName(), ColumnDataReader::ColumnDataReader(), ColumnDataWriter::ColumnDataWriter(), Hdf5DataReader::CommonConstructor(), CompressibleNonlinearElasticitySolver< DIM >::CompressibleNonlinearElasticitySolver(), FineCoarseMeshPair< DIM >::ComputeCoarseElementsForFineElementCentroids(), FineCoarseMeshPair< DIM >::ComputeCoarseElementsForFineNodes(), AbstractParameterisedSystem< VECTOR >::ComputeDerivedQuantities(), Electrodes< DIM >::ComputeElectrodesAreasAndCheckEquality(), AbstractCvodeCell::ComputeExceptVoltage(), FineCoarseMeshPair< DIM >::ComputeFineElementsAndWeightsForCoarseNodes(), FineCoarseMeshPair< DIM >::ComputeFineElementsAndWeightsForCoarseQuadPoints(), PoleZeroMaterialLaw< DIM >::ComputeStressAndStressDerivative(), DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ConstructCuboid(), DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ConstructFromMeshReader(), DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ConstructLinearMesh(), DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ConstructRectangularMesh(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ConstructRegularSlabMesh(), CellMLToSharedLibraryConverter::Convert(), CellMLToSharedLibraryConverter::ConvertCellmlToSo(), CmguiDeformedSolutionsWriter< DIM >::ConvertOutput(), OutputFileHandler::CopyFileTo(), HeartConfigRelatedCellFactory< SPACE_DIM >::CreateCellWithIntracellularStimulus(), AbstractNonlinearElasticitySolver< DIM >::CreateCmguiOutput(), CryptSimulation2d::CryptSimulation2d(), CvodeAdaptor::CvodeError(), AbstractCvodeSystem::CvodeError(), CylindricalHoneycombMeshGenerator::CylindricalHoneycombMeshGenerator(), HeartConfig::DecideLocation(), AbstractCellProperty::DecrementCellCount(), Hdf5DataWriter::DefineFixedDimension(), ColumnDataWriter::DefineFixedDimension(), Hdf5DataWriter::DefineFixedDimensionUsingMatrix(), Hdf5DataWriter::DefineUnlimitedDimension(), ColumnDataWriter::DefineUnlimitedDimension(), Hdf5DataWriter::DefineVariable(), ColumnDataWriter::DefineVariable(), MutableMesh< ELEMENT_DIM, SPACE_DIM >::DeleteBoundaryNodeAt(), MutableMesh< ELEMENT_DIM, SPACE_DIM >::DeleteNode(), NodesOnlyMesh< SPACE_DIM >::DeleteNode(), HeartGeometryInformation< SPACE_DIM >::DetermineLayerForEachNode(), PottsMesh< DIM >::DivideElement(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DivideElementAlongGivenAxis(), ColumnDataWriter::DoAdvanceAlongUnlimitedDimension(), AbstractFeVolumeIntegralAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX, INTERPOLATION_LEVEL >::DoAssemble(), AbstractFeCableIntegralAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX, INTERPOLATION_LEVEL >::DoAssemble(), AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::DoAssemble(), DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::DumbNodePartitioning(), DynamicCellModelLoader::DynamicCellModelLoader(), ElectrodesStimulusFactory< DIM >::ElectrodesStimulusFactory(), Hdf5DataWriter::EndDefineMode(), ColumnDataWriter::EndDefineMode(), GenericEventHandler< 1, EventHandler >::EndEventImpl(), VolumeConstraintPottsUpdateRule< DIM >::EvaluateHamiltonianContribution(), SurfaceAreaConstraintPottsUpdateRule< DIM >::EvaluateHamiltonianContribution(), AdhesionPottsUpdateRule< DIM >::EvaluateHamiltonianContribution(), NhsContractionModel::EvaluateYDerivatives(), ExponentialMaterialLaw< DIM >::ExponentialMaterialLaw(), ExtendedBidomainSolver< ELEM_DIM, SPACE_DIM >::ExtendedBidomainSolver(), FibreReader< DIM >::FibreReader(), GaussianQuadratureRule< ELEMENT_DIM >::GaussianQuadratureRule(), GaussianQuadratureRule< 1 >::GaussianQuadratureRule(), CellsGenerator< CELL_CYCLE_MODEL, DIM >::GenerateBasic(), StreeterFibreGenerator< SPACE_DIM >::GenerateOrthotropicFibreOrientation(), ProcessSpecificArchive< Archive >::Get(), HeartConfig::GetAbsoluteTolerance(), ImplicitCardiacMechanicsSolver< ELASTICITY_SOLVER, DIM >::GetActiveTensionAndTensionDerivs(), FibreReader< DIM >::GetAllAxi(), FibreReader< DIM >::GetAllOrtho(), TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetAngleBetweenNodes(), AbstractParameterisedSystem< VECTOR >::GetAnyVariable(), AbstractOdeSystemInformation::GetAnyVariableIndex(), AbstractOdeSystemInformation::GetAnyVariableUnits(), ArchiveLocationInfo::GetArchiveDirectory(), AbstractOdeSystemInformation::GetAttribute(), MixedDimensionMesh< ELEMENT_DIM, SPACE_DIM >::GetCableElement(), AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::GetCardiacCellOrHaloCell(), VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetCellData(), HeartConfig::GetCellHeterogeneities(), AbstractCellPopulation< DIM >::GetCellMutationStateCount(), AbstractCellPopulation< DIM >::GetCellUsingLocationIndex(), HoneycombMeshGenerator::GetCircularMesh(), HeartConfig::GetConductivityHeterogeneities(), TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetContainingElementIndex(), TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetContainingElementIndexWithInitialGuess(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetContainingElementIndices(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetContainingElementIndices(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::GetDataReader(), AbstractOdeSystemInformation::GetDerivedQuantityIndex(), AbstractOdeSystemInformation::GetDerivedQuantityUnits(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetEdgeLength(), HeartConfig::GetElectrodeParameters(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetElementData(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetElementData(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetFaceData(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetFaceData(), HeartConfig::GetFibreLength(), HeartConfig::GetGradationForAdaptivity(), AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM >::GetHeartGeometryInformation(), PseudoEcgCalculator< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::GetIntegrand(), AbstractCardiacCell::GetIntracellularCalciumConcentration(), HeartConfig::GetIonicModelRegions(), NonCachedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetJacobianForElement(), HeartConfig::GetKSPPreconditioner(), HeartConfig::GetKSPSolver(), CellProperties::GetLastCompleteMaxUpstrokeVelocity(), CellProperties::GetLastCompletePeakPotential(), HeartConfig::GetMaxEdgeLengthForAdaptivity(), HeartConfig::GetMaxNodesForAdaptivity(), AbstractStimulusFactory< ELEMENT_DIM, SPACE_DIM >::GetMesh(), AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM >::GetMesh(), CylindricalHoneycombVertexMeshGenerator::GetMesh(), CylindricalHoneycombMeshGenerator::GetMesh(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetMeshFileBaseName(), ArchiveLocationInfo::GetMeshFilename(), HeartConfig::GetMeshPartitioning(), HeartConfig::GetMinEdgeLengthForAdaptivity(), AbstractPurkinjeCellFactory< ELEMENT_DIM, SPACE_DIM >::GetMixedDimensionMesh(), AbstractCardiacCellWithModifiers< CARDIAC_CELL >::GetModifier(), PottsBasedCellPopulation< DIM >::GetNeighbouringNodeIndices(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNeighbouringNodeNotAlsoInElement(), VertexElementMap::GetNewIndex(), NodeMap::GetNewIndex(), DiffusionCaUpdateRule< DIM >::GetNewLocationOfCell(), AdvectionCaUpdateRule< DIM >::GetNewLocationOfCell(), NhsContractionModel::GetNextActiveTension(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextCableElementData(), VertexMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextElementData(), VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextElementData(), AbstractCachedMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextElementData(), PottsMeshReader< SPACE_DIM >::GetNextElementData(), VertexMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextElementDataWithFaces(), VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextFaceData(), AbstractCachedMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextFaceData(), FibreReader< DIM >::GetNextFibreSheetAndNormalMatrix(), FibreReader< DIM >::GetNextFibreVector(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextItemFromStream(), VertexMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextLineFromStream(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextLineFromStream(), PottsMeshReader< SPACE_DIM >::GetNextLineFromStream(), VertexMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextNode(), VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextNode(), AbstractCachedMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextNode(), PottsMeshReader< SPACE_DIM >::GetNextNode(), Warnings::GetNextWarningMessage(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNode(), DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeOrHaloNode(), HeartGeometryInformation< SPACE_DIM >::GetNodesAtSurface(), NonlinearElasticityTools< DIM >::GetNodesByComponentValue(), HeartConfig::GetNumberOfAdaptiveSweeps(), CommandLineArguments::GetNumberOfArgumentsForOption(), AbstractCardiacCell::GetNumSlowValues(), AbstractParameterisedSystem< VECTOR >::GetParameter(), AbstractOdeSystemInformation::GetParameterIndex(), AbstractOdeSystemInformation::GetParameterUnits(), VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetPointData(), CellPropertyCollection::GetProperty(), AbstractCachedMeshReader< ELEMENT_DIM, SPACE_DIM >::GetRawDataFromFile(), HeartConfig::GetRelativeTolerance(), HeartConfig::GetSheetDimensions(), HeartConfig::GetSigmaForAdaptivity(), HeartConfig::GetSlabDimensions(), AbstractCardiacCell::GetSlowValues(), AbstractParameterisedSystem< VECTOR >::GetStateVariable(), AbstractOdeSystemInformation::GetStateVariableIndex(), AbstractOdeSystemInformation::GetStateVariableUnits(), HeartConfig::GetStimuli(), AbstractLookupTableCollection::GetTableIndex(), HeartConfig::GetTargetErrorForAdaptivity(), CellProperties::GetTimeAtLastCompleteMaxUpstrokeVelocity(), Cell::GetTimeUntilDeath(), FibreReader< DIM >::GetTokensAtNextLine(), ColumnDataReader::GetUnlimitedDimensionValues(), CommandLineArguments::GetUnsignedCorrespondingToOption(), CellwiseData< DIM >::GetValue(), ColumnDataReader::GetValues(), OdeSolution::GetVariableAtIndex(), Hdf5DataWriter::GetVariableByName(), Hdf5DataReader::GetVariableOverNodes(), Hdf5DataReader::GetVariableOverTime(), Hdf5DataReader::GetVariableOverTimeOverMultipleNodes(), HeartConfig::GetVersionFromNamespace(), StokesFlowProblemDefinition< DIM >::GetViscosity(), MeshBasedCellPopulation< DIM >::GetVoronoiEdgeLength(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetVoronoiElementIndexCorrespondingToDelaunayNodeIndex(), NonCachedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetWeightedDirectionForElement(), WntConcentration< DIM >::GetWntGradient(), Hdf5DataWriter::Hdf5DataWriter(), HeartConfigRelatedCellFactory< SPACE_DIM >::HeartConfigRelatedCellFactory(), HeartGeometryInformation< SPACE_DIM >::HeartGeometryInformation(), HoneycombMeshGenerator::HoneycombMeshGenerator(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::IdentifySwapType(), PlaneBoundaryCondition< DIM >::ImposeBoundaryCondition(), IncompressibleNonlinearElasticitySolver< DIM >::IncompressibleNonlinearElasticitySolver(), OrthotropicConductivityTensors< ELEMENT_DIM, SPACE_DIM >::Init(), AxisymmetricConductivityTensors< ELEMENT_DIM, SPACE_DIM >::Init(), CardiacElectroMechanicsProblem< DIM >::Initialise(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Initialise(), CellCycleModelOdeSolver< CELL_CYCLE_MODEL, BackwardEulerIvpOdeSolver >::Initialise(), CellBasedPdeHandler< DIM >::InitialiseCellPdeElementMap(), ImplicitCardiacMechanicsSolver< ELASTICITY_SOLVER, DIM >::InitialiseContractionModels(), ExplicitCardiacMechanicsSolver< ELASTICITY_SOLVER, DIM >::InitialiseContractionModels(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::InitialiseHdf5Writer(), AbstractCardiacCell::IsFastOnly(), LinearSystem::LinearSystem(), AbstractOdeSystem::load(), AbstractCardiacProblem< ELEMENT_DIM, ELEMENT_DIM, 1 >::load(), MemfemMeshReader< ELEMENT_DIM, SPACE_DIM >::MemfemMeshReader(), CardiacSimulationArchiver< PROBLEM_CLASS >::Migrate(), MooneyRivlinMaterialLaw< DIM >::MooneyRivlinMaterialLaw(), MutableMesh< ELEMENT_DIM, SPACE_DIM >::MoveMergeNode(), NumericFileComparison::NumericFileComparison(), OffLatticeSimulation< DIM >::OffLatticeSimulation(), OnLatticeSimulation< DIM >::OnLatticeSimulation(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenElementFiles(), VertexMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenElementsFile(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenElementsFile(), PottsMeshReader< SPACE_DIM >::OpenElementsFile(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenFacesFile(), VertexMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenNodeFile(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenNodeFile(), PottsMeshReader< SPACE_DIM >::OpenNodeFile(), OutputFileHandler::OpenOutputFile(), CellBasedPdeHandler< DIM >::OpenResultsFiles(), ChastePoint< 0 >::operator[](), OutputFileHandler::OutputFileHandler(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT1Swap(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT2Swap(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT3Swap(), PolynomialMaterialLaw3d::PolynomialMaterialLaw3d(), PottsMesh< DIM >::PottsMesh(), ExtendedBidomainProblem< DIM >::PreSolveChecks(), BidomainProblem< DIM >::PreSolveChecks(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::PreSolveChecks(), HeartGeometryInformation< SPACE_DIM >::ProcessLine(), Hdf5DataWriter::PutStripedVector(), Hdf5DataWriter::PutUnlimitedVariable(), ColumnDataWriter::PutVariable(), ParallelColumnDataWriter::PutVector(), Hdf5DataWriter::PutVector(), RandomCellKiller< DIM >::RandomCellKiller(), HeartConfig::ReadFile(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadHeaders(), TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ReadNodesPerProcessorFile(), FibreReader< DIM >::ReadNumLinesOfDataFromFile(), ColumnDataReader::ReadValueFromFile(), XmlTools::ReadXmlFile(), MutableMesh< ELEMENT_DIM, SPACE_DIM >::RefineElement(), AbstractTetrahedralElement< ELEMENT_DIM, SPACE_DIM >::RefreshJacobian(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::ReMesh(), MutableMesh< ELEMENT_DIM, SPACE_DIM >::ReMesh(), Node< SPACE_DIM >::RemoveBoundaryElement(), Node< SPACE_DIM >::RemoveElement(), CellPropertyCollection::RemoveProperty(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::ReplaceNode(), PetscTools::ReplicateException(), GenericEventHandler< 1, EventHandler >::ReportImpl(), AbstractCellPopulation< DIM >::rGetCellCyclePhaseCount(), AbstractCellPopulation< DIM >::rGetCellProliferativeTypeCount(), AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::rGetExtracellularConductivityTensor(), NodeBasedCellPopulation< DIM >::rGetNodePairs(), LinearSystem::rGetPrecondMatrix(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::RotateX(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::RotateY(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::RotateZ(), CardiacSimulation::Run(), CardiacSimulationArchiver< PROBLEM_CLASS >::Save(), AbstractMaterialLaw< DIM >::ScaleMaterialParameters(), LogFile::Set(), HeartConfig::SetAdaptivityParameters(), AbstractParameterisedSystem< VECTOR >::SetAnyVariable(), StreeterFibreGenerator< SPACE_DIM >::SetApexToBase(), CellwiseData< DIM >::SetCellPopulation(), AxisymmetricConductivityTensors< ELEMENT_DIM, SPACE_DIM >::SetConstantConductivities(), AbstractConductivityTensors< ELEMENT_DIM, SPACE_DIM >::SetConstantConductivities(), AbstractCardiacMechanicsSolver< ELASTICITY_SOLVER, DIM >::SetConstantFibreSheetDirections(), WntConcentration< DIM >::SetConstantWntValueForTesting(), WntConcentration< DIM >::SetCryptLength(), AbstractParameterisedSystem< VECTOR >::SetDefaultInitialCondition(), AbstractParameterisedSystem< VECTOR >::SetDefaultInitialConditions(), AbstractCellCycleModel::SetDimension(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::SetDistributedVectorFactory(), AbstractExtendedBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetFixedExtracellularPotentialNodes(), AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetFixedExtracellularPotentialNodes(), DistributedVectorFactory::SetFromFactory(), ExtendedBidomainProblem< DIM >::SetGgapHeterogeneities(), HeartConfig::SetKSPPreconditioner(), HeartConfig::SetKSPSolver(), AbstractPurkinjeCellFactory< ELEMENT_DIM, SPACE_DIM >::SetMesh(), HeartConfig::SetMeshPartitioning(), AbstractCardiacCellWithModifiers< CARDIAC_CELL >::SetModifier(), Cell::SetMutationState(), MutableMesh< ELEMENT_DIM, SPACE_DIM >::SetNode(), AbstractOnLatticeCellPopulation< DIM >::SetNode(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::SetNodePermutation(), LinearSystem::SetNullBasis(), CellwiseData< DIM >::SetNumCellsAndVars(), VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetParallelFiles(), AbstractParameterisedSystem< VECTOR >::SetParameter(), PoleZeroMaterialLaw< DIM >::SetParameters(), FileFinder::SetPath(), AbstractExtendedBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetRowForAverageOfPhiZeroed(), AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetRowForAverageOfPhiZeroed(), S1S2Stimulus::SetS2ExperimentPeriodIndex(), AbstractCardiacCell::SetSlowValues(), AbstractCardiacCell::SetState(), AbstractParameterisedSystem< VECTOR >::SetStateVariable(), AbstractParameterisedSystem< VECTOR >::SetStateVariables(), AbstractLookupTableCollection::SetTableProperties(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetTimes(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetTimeStep(), HeartConfig::SetTissueAndBathIdentifiers(), WntConcentration< DIM >::SetType(), CvodeAdaptor::SetupCvode(), AbstractCvodeSystem::SetupCvode(), CellwiseData< DIM >::SetValue(), AbstractCardiacMechanicsSolver< ELASTICITY_SOLVER, DIM >::SetVariableFibreSheetDirections(), AbstractNonlinearElasticitySolver< DIM >::SetWriteOutput(), SimpleDataWriter::SimpleDataWriter(), AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve(), RungeKuttaFehlbergIvpOdeSolver::Solve(), CvodeAdaptor::Solve(), AbstractOneStepIvpOdeSolver::Solve(), SimplePetscNonlinearSolver::Solve(), SimpleNewtonNonlinearSolver::Solve(), LinearSystem::Solve(), AbstractNonlinearElasticitySolver< DIM >::Solve(), AbstractCellBasedSimulation< DIM >::Solve(), AbstractIvpOdeSolver::SolveAndUpdateStateVariable(), LinearParabolicPdeSystemWithCoupledOdeSystemSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SolveAndWriteResultsToFile(), DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::SolveBoundaryElementMapping(), DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::SolveElementMapping(), DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::SolveNodeMapping(), CellBasedPdeHandler< DIM >::SolvePdeAndWriteResultsToFile(), CellPropertyRegistry::SpecifyOrdering(), SphereGeometryBoundaryCondition< DIM >::SphereGeometryBoundaryCondition(), Cell::StartApoptosis(), AbstractNonlinearElasticitySolver< DIM >::TakeNewtonStep(), SloughingCellKiller< DIM >::TestAndLabelCellsForApoptosisOrDeath(), CommandLineArguments::TestOptionFormat(), TimeStepper::TimeStepper(), FemlabMeshReader< ELEMENT_DIM, SPACE_DIM >::TokenizeStringsToDoubles(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::TrianglesMeshReader(), NodeBasedCellPopulation< DIM >::Update(), MeshBasedCellPopulation< DIM >::Update(), ContactInhibitionCellCycleModel::UpdateCellCyclePhase(), AbstractOdeBasedCellCycleModel::UpdateCellCyclePhase(), AbstractCellBasedSimulation< DIM >::UpdateCellPopulation(), OffLatticeSimulation< DIM >::UpdateNodePositions(), HeartConfig::UpdateParametersFromResumeSimulation(), AbstractCardiacCellInterface::UseCellMLDefaultStimulus(), CellBasedPdeHandler< DIM >::UseCoarsePdeMesh(), ElectroMechanicsProblemDefinition< DIM >::Validate(), SolidMechanicsProblemDefinition< DIM >::Validate(), ContinuumMechanicsProblemDefinition< DIM >::Validate(), VertexBasedCellPopulation< DIM >::Validate(), PottsBasedCellPopulation< DIM >::Validate(), NodeBasedCellPopulation< DIM >::Validate(), MeshBasedCellPopulationWithGhostNodes< DIM >::Validate(), MeshBasedCellPopulation< DIM >::Validate(), CaBasedCellPopulation< DIM >::Validate(), VanLeeuwen2009WntSwatCellCycleOdeSystem::VanLeeuwen2009WntSwatCellCycleOdeSystem(), PlaneBoundaryCondition< DIM >::VerifyBoundaryCondition(), VertexBasedCellPopulation< DIM >::VertexBasedCellPopulation(), VolumeTrackedOffLatticeSimulation< DIM >::VolumeTrackedOffLatticeSimulation(), VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::VtkMeshReader(), HeartConfig::Write(), CmguiDeformedSolutionsWriter< DIM >::WriteDeformationPositions(), and OdeSolution::WriteToFile().

#define EXPECT0 ( cmd,
arg   ) 
Value:
{      \
    std::string _arg(arg);       \
    int ret = cmd(_arg.c_str()); \
    if (ret != 0) {              \
        EXCEPTION("Error executing command: " #cmd "(" + _arg + ")"); \
    } }

Handy for calling functions like system which return non-zero on error. Throws if an error occurs.

Note:
DO NOT use this macro within an if (PetscTools::AmMaster) block, as then you'll get deadlock if an exception is thrown when running in parallel! (Unless the block is wrapped in a try-catch and exception replication handler.) Instead, use ABORT_IF_NON0.
Parameters:
cmd command to call
arg its argument (will be converted to std::string)

Definition at line 219 of file Exception.hpp.

Referenced by CellMLToSharedLibraryConverter::ConvertCellmlToSo(), AbstractConvergenceTester< CELL, CARDIAC_PROBLEM, DIM, PROBLEM_DIM >::DisplayRun(), and PetscSetup::setUpWorld().

#define EXPECT_NON0 ( cmd,
arg   ) 
Value:
{   \
    std::string _arg = (arg);     \
    int ret = cmd(_arg.c_str());  \
    if (ret == 0) {               \
        EXCEPTION("Command: " #cmd "(" + _arg + ") succeeded and it shouldn't have"); \
    } }

Handy for calling functions like system which return non-zero on error. This time we expect failure; throws if the command succeeds.

Parameters:
cmd command to call
arg its argument (will be converted to std::string)

Definition at line 260 of file Exception.hpp.

#define IGNORE_RET ( cmd,
arg   ) 
Value:
{   \
    std::string _arg = (arg);    \
    int ret = cmd(_arg.c_str()); \
    ret = ret;                   \
    }

Handy for calling functions like system which return non-zero on error. This version ignores the return code, in case you don't care about errors for some reason...

Parameters:
cmd command to call
arg its argument (will be converted to std::string)

Definition at line 273 of file Exception.hpp.

Referenced by CellMLToSharedLibraryConverter::ConvertCellmlToSo().

#define NEVER_REACHED   TERMINATE("Should have been impossible to reach this line of code"); 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 194 of file Exception.hpp.

Referenced by AbstractCellMutationState::AbstractCellMutationState(), AdaptiveBidomainProblem::AdaptMesh(), Alarcon2004OxygenBasedCellCycleModel::AdjustOdeParameters(), AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::AppendLocalDataToFiles(), IncompressibleNonlinearElasticitySolver< DIM >::AssembleOnBoundaryElement(), CompressibleNonlinearElasticitySolver< DIM >::AssembleOnBoundaryElement(), IncompressibleNonlinearElasticitySolver< DIM >::AssembleOnElement(), CompressibleNonlinearElasticitySolver< DIM >::AssembleOnElement(), AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::AssembleOnElement(), OffLatticeSimulation< 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(), AbstractFeCableIntegralAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX, INTERPOLATION_LEVEL >::ComputeCableMatrixTerm(), AbstractFeCableIntegralAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX, INTERPOLATION_LEVEL >::ComputeCableVectorTerm(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), CellwiseSourcePde< DIM >::ComputeLinearInUCoeffInSourceTerm(), AbstractFeVolumeIntegralAssembler< DIM, DIM, 2, false, true, CARDIAC >::ComputeMatrixTerm(), AbstractFeSurfaceIntegralAssembler< ELEMENT_DIM, SPACE_DIM, 2 >::ComputeVectorSurfaceTerm(), AbstractFeVolumeIntegralAssembler< DIM, DIM, 2, false, true, CARDIAC >::ComputeVectorTerm(), MixedDimensionMesh< ELEMENT_DIM, SPACE_DIM >::ConstructFromMeshReader(), AbstractConvergenceTester< CELL, CARDIAC_PROBLEM, DIM, PROBLEM_DIM >::Converge(), 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(), AbstractRushLarsenCardiacCell::EvaluateYDerivatives(), HeartConfigRelatedCellFactory< SPACE_DIM >::FillInCellularTransmuralAreas(), CryptCellsGenerator< CELL_CYCLE_MODEL >::Generate(), AbstractCellPopulation< DIM >::GenerateCellResults(), StreeterFibreGenerator< SPACE_DIM >::GenerateOrthotropicFibreOrientation(), ContinuumMechanicsProblemDefinition< DIM >::GetBodyForce(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetCentroidOfElement(), HeartGeometryInformation< SPACE_DIM >::GetDistanceToEndo(), StreeterFibreGenerator< SPACE_DIM >::GetFibreMaxAngle(), HeartConfig::GetInterNodeSpace(), HeartConfig::GetIonicModelRegions(), CaBasedCellPopulation< DIM >::GetNeighbouringNodeIndicesVector(), AdvectionCaUpdateRule< DIM >::GetNewLocationOfCell(), 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(), OperatorSplittingMonodomainSolver< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve(), AbstractCardiacTissue< SPACE_DIM >::LoadCardiacCells(), ExtendedBidomainTissue< DIM >::LoadExtendedBidomainCells(), DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::MetisLibraryNodePartitioning(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT3Swap(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::PermuteNodes(), PottsMeshGenerator< DIM >::PottsMeshGenerator(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::ReadNodesPerProcessorFile(), AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::ReplicateCaches(), AbstractCardiacTissue< SPACE_DIM >::save(), AbstractCardiacTissue< SPACE_DIM >::SaveCardiacCells(), ExtendedBidomainTissue< DIM >::SaveExtendedBidomainCells(), SimpleWntCellCycleModel::SetG1Duration(), StochasticDurationGenerationBasedCellCycleModel::SetG1Duration(), StochasticDurationCellCycleModel::SetG1Duration(), AbstractSimpleCellCycleModel::SetG1Duration(), FileFinder::SetPath(), LinearSystem::SetPrecondMatrixIsDifferentFromLhs(), BoxCollection< DIM >::SetupAllLocalBoxes(), CellwiseDataGradient< DIM >::SetupGradients(), BoxCollection< DIM >::SetupLocalBoxesHalfOnly(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve(), SubDeterminant(), SloughingCellKiller< DIM >::TestAndLabelCellsForApoptosisOrDeath(), AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::UpdateCaches(), SimpleWntCellCycleModel::UpdateCellCyclePhase(), SimpleOxygenBasedCellCycleModel::UpdateCellCyclePhase(), ContactInhibitionCellCycleModel::UpdateCellCyclePhase(), PottsBasedCellPopulation< DIM >::UpdateCellLocations(), DeltaNotchCellCycleModel::UpdateDeltaNotch(), SimpleOxygenBasedCellCycleModel::UpdateHypoxicDuration(), CellBasedPdeHandler< DIM >::UseCoarsePdeMesh(), AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesFooter(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteNodeFileHeader().

#define TERMINATE ( message   )     Exception::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 161 of file Exception.hpp.

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

#define UNUSED_OPT ( var   ) 

This is to cope with NDEBUG causing variables to not be used, when they are only used in assert()s.

Parameters:
var the "unused" variable

Definition at line 204 of file Exception.hpp.


Variable Documentation

const double DOUBLE_UNSET = DBL_MAX
const int INT_UNSET = INT_MAX

Use when initialising an int variable that doesn't have a sensible default value.

Definition at line 47 of file Exception.hpp.

const unsigned UNSIGNED_UNSET = UINT_MAX
Generated on Thu Dec 22 13:00:18 2011 for Chaste by  doxygen 1.6.3