This method is designed to read a ModelPart. The ModelPart is filled with respective nodes, conditions, elements from mdpa file using either MPI or Serial reading depending on run type. Args: mdpa_file_name (str): Name of the mdpa file (without ".mdpa" extension) model_
(mdpa_file_name, model_part, settings=None)
| 20 | |
| 21 | |
| 22 | def ReadModelPart(mdpa_file_name, model_part, settings=None): |
| 23 | """This method is designed to read a ModelPart. |
| 24 | |
| 25 | The ModelPart is filled with respective nodes, conditions, elements |
| 26 | from mdpa file using either MPI or Serial reading depending on run type. |
| 27 | |
| 28 | Args: |
| 29 | mdpa_file_name (str): Name of the mdpa file (without ".mdpa" extension) |
| 30 | model_part (Kratos.ModelPart): ModelPart to be filled |
| 31 | """ |
| 32 | if model_part.NumberOfNodes() > 0: |
| 33 | raise Exception("ModelPart must not contain Nodes!") |
| 34 | |
| 35 | communicator = Kratos.Testing.GetDefaultDataCommunicator() |
| 36 | if communicator.IsDistributed(): |
| 37 | ReadDistributedModelPart(mdpa_file_name, model_part, settings) |
| 38 | else: |
| 39 | ReadSerialModelPart(mdpa_file_name, model_part) |
| 40 | |
| 41 | |
| 42 | def ReadSerialModelPart(mdpa_file_name, model_part): |