File tree Expand file tree Collapse file tree 2 files changed +13
-16
lines changed
examples/00-mapdl-examples Expand file tree Collapse file tree 2 files changed +13
-16
lines changed Original file line number Diff line number Diff line change 62
62
###############################################################################
63
63
# If you are working with a remote server, you might need to upload the ``RST``
64
64
# file before working with it.
65
+ # Then you can create the :class:`DPF Model <ansys.dpf.core.model.Model>`.
65
66
66
- server_file_path = dpf .upload_file_in_tmp_folder ( rst_path )
67
+ dpf .core . make_tmp_dir_server ( dpf . SERVER )
67
68
68
- ###############################################################################
69
- # Then you can create the :class:`DPF Model <ansys.dpf.core.model.Model>`.
70
- #
69
+ if dpf .SERVER .local_server :
70
+ model = dpf .Model (rst_path )
71
+ else :
72
+ server_file_path = dpf .upload_file_in_tmp_folder (rst_path )
73
+ model = dpf .Model (server_file_path )
71
74
72
- model = dpf .Model (rst_path )
73
75
print (model )
74
76
75
77
###############################################################################
Original file line number Diff line number Diff line change 49
49
import tempfile
50
50
51
51
from ansys .dpf import core as dpf
52
- from ansys .dpf .core import Model
53
52
import matplotlib .pyplot as plt
54
53
import numpy as np
55
54
import pyvista as pv
313
312
temp_directory = tempfile .gettempdir ()
314
313
rst_path = mapdl .download_result (temp_directory )
315
314
316
- try :
317
- # ONLY IF DPF SERVER DEPLOYED WITH gRPC COMMUNICATION
318
- # Upload file to DPF server
319
- server_file_path = dpf .upload_file_in_tmp_folder (rst_path )
320
- data_src = dpf .DataSources (server_file_path )
321
- except :
322
- # Using DPF locally
323
- data_src = dpf .DataSources (rst_path )
315
+ dpf .core .make_tmp_dir_server (dpf .SERVER )
324
316
325
- # Generate the DPF model
326
- model = Model (data_src )
317
+ if dpf .SERVER .local_server :
318
+ model = dpf .Model (rst_path )
319
+ else :
320
+ server_file_path = dpf .upload_file_in_tmp_folder (rst_path )
321
+ model = dpf .Model (server_file_path )
327
322
328
323
# Get the mesh of the whole model
329
324
meshed_region = model .metadata .meshed_region
You can’t perform that action at this time.
0 commit comments