def addRunConfig(self,name,runnerType, solverTypes=None): """ Creates and adds a new RunConfig with the specified name, runnerType and solverTypes to this MeshInstance """ #Check that name is not already in use if name in self.runConfigs: raise AcdOptiException_meshInstance_nameError("RunConfig name already in use") #Create the runConfig runConfigFolder = os.path.join(self.folder, "runConfigs", name) AcdOptiRunConfig.createNew(runConfigFolder, runnerType, solverTypes) #Load it self.runConfigs[name] = AcdOptiRunConfig(runConfigFolder, self)
def createNew_clone(folder, cloneFrom, newGeomInstance): """ Creates a new meshInstance in a not previously existing folder, which has identical settings as an already existing meshInstance, but is attached to newGeomInstance The newly created meshInstance is then returned. This is a deep copy, runConfigs etc. are also cloned. """ #Create the new meshInstance AcdOptiMeshInstance.createNew(folder, newGeomInstance.instName, cloneFrom.meshTemplate.instName) newInstance = AcdOptiMeshInstance(folder, newGeomInstance, cloneFrom.meshTemplateCollection) #Copy information for key in cloneFrom.templateOverrides_getKeys(): newInstance.templateOverrides_insert(key, cloneFrom.templateOverrides_get(key)) for (runConfigName, runConfig) in cloneFrom.runConfigs.iteritems(): newRC = AcdOptiRunConfig.createNew_clone(os.path.join(folder, "runConfigs", runConfig.instName), runConfig, newInstance) newInstance.runConfigs[runConfigName] = newRC newInstance.write() return newInstance