def Initialize(self): print("::[Meshing Contact Domain]:: -START-") self.domain_size = self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] self.mesh_id = 0 # Set MeshingParameters self.SetMeshingParameters() # Create contact domain model_part if( not self.main_model_part.HasSubModelPart(self.settings["model_part_name"].GetString()) ): self.main_model_part.CreateSubModelPart(self.settings["model_part_name"].GetString()) contact_model_part_names = self.settings["contact_sub_model_part_list"] self.contact_parts = KratosContact.StringVector() for i in range(contact_model_part_names.size()): self.contact_parts.PushBack(contact_model_part_names[i].GetString()) # transforms list to a std vector self.build_contact_model_part = KratosContact.BuildContactModelPart(self.main_model_part, self.MeshingParameters, self.contact_parts, self.echo_level) self.build_contact_model_part.Execute() # Meshing Stratety self.MeshingStrategy.Initialize(self.MeshingParameters, self.domain_size) print("::[Meshing Contact Domain]:: -END- ")
def Initialize(self): contact_model_part_names = self.settings["contact_bodies_list"] if contact_model_part_names.size(): self.contact_parts = [] for i in range(contact_model_part_names.size()): self.contact_parts.append( contact_model_part_names[i].GetString()) model_part = self.model[self.contact_parts[0]] else: print(self._class_prefix() + " ERROR, contact model parts not supplied ") self.main_model_part = model_part.GetRootModelPart() self.dimension = self.main_model_part.ProcessInfo[ KratosMultiphysics.SPACE_DIMENSION] # Create contact search strategy meshing_module = __import__( self.settings["meshing_strategy"]["python_module"].GetString()) self.MeshingStrategy = meshing_module.CreateMeshingStrategy( self.main_model_part, self.settings["meshing_strategy"]) # Set MeshingParameters self.SetMeshingParameters() # Create contact domain model_part if not self.main_model_part.HasSubModelPart( self.settings["model_part_name"].GetString()): self.main_model_part.CreateSubModelPart( self.settings["model_part_name"].GetString()) self.build_contact_model_part = KratosContact.BuildContactModelPart( self.main_model_part, self.MeshingParameters, self.contact_parts, self.echo_level) self.build_contact_model_part.Execute() # Meshing Stratety self.MeshingStrategy.Initialize(self.MeshingParameters, self.dimension) print(self._class_prefix() + " (" + self.settings["model_part_name"].GetString() + ") Ready")