| 95 | /***********************************************************************************/ |
| 96 | |
| 97 | void ObjIO::ReadModelPart(ModelPart& rThisModelPart) |
| 98 | { |
| 99 | // Check if the model part has properties |
| 100 | if(!rThisModelPart.RecursivelyHasProperties(0)) { |
| 101 | rThisModelPart.CreateNewProperties(0); |
| 102 | } |
| 103 | |
| 104 | // Get the next IDs for nodes, elements, and conditions |
| 105 | mNextNodeId = block_for_each<MaxReduction<std::size_t>>( |
| 106 | rThisModelPart.GetRootModelPart().Nodes(), |
| 107 | [](NodeType& rNode) { return rNode.Id();}) + 1; |
| 108 | mFirstNodeId = mNextNodeId; |
| 109 | |
| 110 | mNextElementId = block_for_each<MaxReduction<std::size_t>>( |
| 111 | rThisModelPart.GetRootModelPart().Elements(), |
| 112 | [](Element& rElement) { return rElement.Id();}) + 1; |
| 113 | mFirstElementId = mNextElementId; |
| 114 | |
| 115 | mNextConditionId = block_for_each<MaxReduction<std::size_t>>( |
| 116 | rThisModelPart.GetRootModelPart().Conditions(), |
| 117 | [](Condition& rCondition) { return rCondition.Id();}) + 1; |
| 118 | mFirstConditionId = mNextConditionId; |
| 119 | |
| 120 | // Read vertices, normals, and faces |
| 121 | const bool normal_as_historical = mParameters["normal_as_historical"].GetBool(); |
| 122 | const std::string entity_type = mParameters["entity_type"].GetString(); |
| 123 | const bool decompose_quads_into_triangles = mParameters["decompose_quads_into_triangles"].GetBool(); |
| 124 | ReadVerticesAndFaces(rThisModelPart, entity_type, normal_as_historical, decompose_quads_into_triangles); |
| 125 | } |
| 126 | |
| 127 | /***********************************************************************************/ |
| 128 | /***********************************************************************************/ |