1- """Module containing the methode to instantiate the result object. Initialization of post objects."""
1+ """Module containing the method to instantiate the result
2+ object. Initialization of post objects.
3+ """
24
3- from ansys .dpf .core .model import Model
5+ from ansys .dpf .core .model import Model
46
57from ansys .dpf .post .common import _AnalysisType , _AvailableKeywords , _PhysicsType
6- from ansys .dpf .post .static_analysis import StaticAnalysisSolution , ThermalStaticAnalysisSolution
8+ from ansys .dpf .post .static_analysis import (StaticAnalysisSolution ,
9+ ThermalStaticAnalysisSolution )
710from ansys .dpf .post .modal_analysis import ModalAnalysisSolution
811from ansys .dpf .post .harmonic_analysis import HarmonicAnalysisSolution
9- from ansys .dpf .post .transient_analysis import TransientAnalysisSolution , ThermalTransientAnalysisSolution
10-
12+ from ansys .dpf .post .transient_analysis import (TransientAnalysisSolution ,
13+ ThermalTransientAnalysisSolution )
14+
1115
1216def load_solution (data_sources ):
13- """Return a Result object which can provide information on a given set, on a given scoping...
14-
17+ """Return a ``Result`` object which can provide information on a given
18+ set, on a given scoping.
19+
1520 Parameters
1621 ----------
17- str
18- Can be a filepath to the file you want to open, or a dpf.core.DataSources().
19-
22+ data_sources : str or dpf.core.DataSources
23+ filepath to the file you want to open, or a dpf.core.DataSources().
24+
2025 Examples
2126 --------
22- solution = post.solution("file.rst")
27+ >>> solution = post.solution("file.rst")
2328 """
2429 _model = Model (data_sources )
2530 data_sources = _model .metadata .data_sources
26-
31+
2732 analysis_type = _model .metadata .result_info .analysis_type
2833 physics_type = _model .metadata .result_info .physics_type
29- if ( physics_type == _PhysicsType .thermal ) :
30- if ( analysis_type == _AnalysisType .static ) :
31- return ThermalStaticAnalysisSolution (data_sources , _model )
32- elif ( analysis_type == _AnalysisType .transient ) :
34+ if physics_type == _PhysicsType .thermal :
35+ if analysis_type == _AnalysisType .static :
36+ return ThermalStaticAnalysisSolution (data_sources , _model )
37+ elif analysis_type == _AnalysisType .transient :
3338 return ThermalTransientAnalysisSolution (data_sources , _model )
3439 else :
35- raise Exception ("Unknown analysis type." )
36- elif ( physics_type == _PhysicsType .mecanic ) :
37- if ( analysis_type == _AnalysisType .static ) :
40+ raise Exception (f "Unknown analysis type ' { analysis_type } ' for thermal ." )
41+ elif physics_type == _PhysicsType .mecanic :
42+ if analysis_type == _AnalysisType .static :
3843 return StaticAnalysisSolution (data_sources , _model )
39- elif ( analysis_type == _AnalysisType .modal ) :
44+ elif analysis_type == _AnalysisType .modal :
4045 return ModalAnalysisSolution (data_sources , _model )
41- elif ( analysis_type == _AnalysisType .harmonic ) :
46+ elif analysis_type == _AnalysisType .harmonic :
4247 return HarmonicAnalysisSolution (data_sources , _model )
43- elif ( analysis_type == _AnalysisType .transient ) :
48+ elif analysis_type == _AnalysisType .transient :
4449 return TransientAnalysisSolution (data_sources , _model )
4550 else :
46- raise Exception ("Unknown analysis type." )
51+ raise Exception (f "Unknown analysis type ' { analysis_type } ' for mechanical ." )
4752 else :
48- raise Exception ("Unknown physics type." )
49-
50-
53+ raise Exception (f "Unknown physics type ' { physics_type } ." )
54+
55+
5156def print_available_keywords ():
5257 """Print the keywords that can be used into the result object.
53-
58+
5459 Examples
5560 --------
5661 >>> from ansys.dpf import post
@@ -59,4 +64,3 @@ def print_available_keywords():
5964 """
6065 txt = _AvailableKeywords ().__str__ ()
6166 print (txt )
62-
0 commit comments