Skip to content

Commit 2e394f0

Browse files
authored
Merge pull request #17 from pyansys/fix/cleanup-plotter
Plotter cleanup
2 parents aace2b2 + 18ace77 commit 2e394f0

File tree

7 files changed

+572
-265
lines changed

7 files changed

+572
-265
lines changed

ansys/dpf/core/errors.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
from grpc._channel import _InactiveRpcError, _MultiThreadedRendezvous
22

3+
_COMPLEX_PLOTTING_ERROR_MSG = """
4+
Complex fields can not be plotted. Use operators to get the amplitude
5+
or the result at a defined sweeping phase before plotting.
6+
"""
7+
8+
_FIELD_CONTAINER_PLOTTING_MSG = """"
9+
This fields_container contains multiple fields. Only one time-step
10+
result can be plotted at a time. Extract a field with
11+
``fields_container[index]``.
12+
"""
13+
14+
15+
class ComplexPlottingError(ValueError):
16+
"""Raised when attempting to plot a field with complex data"""
17+
18+
def __init__(self, msg=_COMPLEX_PLOTTING_ERROR_MSG):
19+
ValueError.__init__(self, msg)
20+
21+
22+
class FieldContainerPlottingError(ValueError):
23+
"""Raised when attempting to plot a fields_container containing
24+
multiple fields."""
25+
26+
def __init__(self, msg=_FIELD_CONTAINER_PLOTTING_MSG):
27+
ValueError.__init__(self, msg)
28+
329

430
class InvalidANSYSVersionError(RuntimeError):
531
"""Raised when ANSYS is an invalid version"""

0 commit comments

Comments
 (0)