Ejemplo n.º 1
0
 def __init__(self, infile):
     SolutionBase.__init__(self, infile)
     self.__data = VMECData()
     self.__data.initialize(infile)
     return
Ejemplo n.º 2
0
class SolutionFusion (SolutionBase):
    def __init__(self, infile):
        SolutionBase.__init__(self, infile)
        self.__data = VMECData()
        self.__data.initialize(infile)
        return

    def initialize(self, data):
        self.__data = data
        return

    def prepare(self, filename):
        self.__data.create_input_file(filename)

    def getNumberofParams(self):
        return self.__data.getNumParams()

    def getMaxNumberofValues(self):
        return self.__data.getMaxRange()

    def getParameters(self):
        return self.__data.getParameters()

    def getParametersValues(self):
        return self.__data.getValsOfParameters()

    """
    Receives an array of floats and sets the values of the parameters
    """

    def setParametersValues(self, buff):
        u.logger.debug("SolutionFusion. Setting parameters")
        self.__data.setValsOfParameters(buff)

    #Receives a list of parameters with, at least, index and value
    #Updates the parameters of the object with the new values specified in
    #the list
    def setParameters(self, params):
        for p in params:
            self.__data.assign_parameter(p)

    def getData(self):
        return self.__data

    def checkPressureDerivative(self):
        values = self.getParametersValues()
        val = 0.0
        for v in range(-100, 100):
            for i in len(values):
                if (i == 0):
                    continue
                val += pow(v, i - 1) * values[i] * i
        if (val > 0.0):
            return False
        return True