Source code for edelweissfe.utils.exceptions

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#  ---------------------------------------------------------------------
#
#  _____    _      _              _         _____ _____
# | ____|__| | ___| |_      _____(_)___ ___|  ___| ____|
# |  _| / _` |/ _ \ \ \ /\ / / _ \ / __/ __| |_  |  _|
# | |__| (_| |  __/ |\ V  V /  __/ \__ \__ \  _| | |___
# |_____\__,_|\___|_| \_/\_/ \___|_|___/___/_|   |_____|
#
#
#  Unit of Strength of Materials and Structural Analysis
#  University of Innsbruck,
#  2017 - today
#
#  Matthias Neuner matthias.neuner@uibk.ac.at
#
#  This file is part of EdelweissFE.
#
#  This library is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation; either
#  version 2.1 of the License, or (at your option) any later version.
#
#  The full text of the license can be found in the file LICENSE.md at
#  the top level directory of EdelweissFE.
#  ---------------------------------------------------------------------
# Created on Fri May 12 11:02:12 2017

# @author: Matthias Neuner
"""
This module contains a collection of commonly used exceptions.
"""


[docs] class WrongDomain(Exception): """Is thrown when a required module does not fit the spatial domain."""
[docs] class StepFailed(Exception): """Is thrown when the computation of a step fails."""
[docs] class CutbackRequest(Exception): """The evaluation of the residuel fails due to a too large time increment.""" def __init__(self, message, cutbackSize): super().__init__(message) self.cutbackSize = float(cutbackSize)
[docs] class IncrementFailed(Exception): """An increment could not be solved; it is retried smaller by ``cutbackFactor``. Parameters ---------- message Why the increment failed. cutbackFactor The factor the time stepper scales the increment size by for the retry. """ def __init__(self, message, cutbackFactor): super().__init__(message) self.cutbackFactor = float(cutbackFactor)
[docs] class ReachedMaxIterations(Exception): """The maximum number of nonlinear iterations as attained."""
[docs] class ReachedMaxIncrements(Exception): """The maximum number of incremeents within a step as attained."""
[docs] class ReachedMinIncrementSize(Exception): """The minimum size of a incremeent within a step as attained."""
[docs] class DivergingSolution(Exception): """The solutions seems to be diverging within the nonlinear solving scheme."""
[docs] class RestartError(Exception): """A checkpoint cannot be restored into this model: an unsupported format version, or a replayed topology that does not match the one the checkpoint was written from."""
[docs] class MeshChangedSinceCheckpoint(RestartError): """The model's mesh has changed since the checkpoint was written, and a mesh change cannot be undone: the model cannot go back to the checkpoint. Parameters ---------- firstChange The first topology decision the model applied after the checkpoint was written, a :class:`~edelweissfe.models.modelchange.TopologyRecord`. """ def __init__(self, firstChange): super().__init__( "the mesh has changed since the checkpoint was written (model modifier {:} at time {:}), and a mesh " "change cannot be undone".format(firstChange.modifier, firstChange.time) ) self.firstChange = firstChange
[docs] class TopologyError(Exception): """An illegal attempt to change the model topology: creating or deleting an entity outside a :meth:`~edelweissfe.models.topologypipeline.TopologyPipeline.changes` window, or claiming an element number that is already in use."""
[docs] class ConditionalStop(Exception): """Simulation stops sucessfully."""
[docs] class InputExecption(Exception): """Invalid input file parameters."""