Ejemplo n.º 1
0
  def ravelRZForFortran(self):
    """
    This function is no longer in use
    Ravels the RZ fields into a convenient format for working
    with fortran.
    Args:
      self: Standard python object oriented notation. 
    Return value:
      None --- but rewrites the field numpy arrays.
    """
    for field_type, field in self.fields.iteritems():
      fr = fzeros((self.number_of_steps["r"]+1,
                   self.number_of_steps["z"]+1) ) 
      fz = fzeros((self.number_of_steps["r"]+1,
                   self.number_of_steps["z"]+1) ) 

      ir = get_index_of_point(self.coordinates["r"],self.stepsize["r"])
      iz = get_index_of_point(self.coordinates["z"],self.stepsize["z"])

      ii = ir + int(self.number_of_steps["r"]+1)*iz  

      fr.ravel(order='F').put(ii,field["r"]) 
      fz.ravel(order='F').put(ii,field["z"]) 
      
      self.fields[field_type]["r"] = fr
      self.fields[field_type]["z"] = fz
    def ravelRZForFortran(self):
        """
    This function is no longer in use
    Ravels the RZ fields into a convenient format for working
    with fortran.
    Args:
      self: Standard python object oriented notation. 
    Return value:
      None --- but rewrites the field numpy arrays.
    """
        for field_type, field in self.fields.iteritems():
            fr = fzeros(
                (self.number_of_steps["r"] + 1, self.number_of_steps["z"] + 1))
            fz = fzeros(
                (self.number_of_steps["r"] + 1, self.number_of_steps["z"] + 1))

            ir = get_index_of_point(self.coordinates["r"], self.stepsize["r"])
            iz = get_index_of_point(self.coordinates["z"], self.stepsize["z"])

            ii = ir + int(self.number_of_steps["r"] + 1) * iz

            fr.ravel(order='F').put(ii, field["r"])
            fz.ravel(order='F').put(ii, field["z"])

            self.fields[field_type]["r"] = fr
            self.fields[field_type]["z"] = fz
Ejemplo n.º 3
0
  def ravelXYZForFortran(self):
    """
    Ravels the XYZ fields into a convenient format for working
    with fortran.
    Args:
      self: Standard python object oriented notation. 
    Return value:
      None --- but rewrites the field numpy arrays.
    """
    for field_type, field in self.fields.iteritems():
      fx = fzeros((self.number_of_steps["x"]+1,
                   self.number_of_steps["y"]+1,
                   self.number_of_steps["z"]+1) ) 
      fy = fzeros((self.number_of_steps["x"]+1,
                   self.number_of_steps["y"]+1,
                   self.number_of_steps["z"]+1) ) 
      fz = fzeros((self.number_of_steps["x"]+1,
                   self.number_of_steps["y"]+1,
                   self.number_of_steps["z"]+1) ) 

      ix = get_index_of_point(self.coordinates["x"],self.stepsize["x"])
      iy = get_index_of_point(self.coordinates["y"],self.stepsize["y"])
      iz = get_index_of_point(self.coordinates["z"],self.stepsize["z"])

      ii = ix + int(self.number_of_steps["x"]+1)*iy + \
           int(self.number_of_steps["x"]+1)*int(self.number_of_steps["y"]+1)*iz 

      fx.ravel(order='F').put(ii,field["x"]) 
      fy.ravel(order='F').put(ii,field["y"]) 
      fz.ravel(order='F').put(ii,field["z"]) 
      
      self.fields[field_type]["x"] = fx
      self.fields[field_type]["y"] = fy
      self.fields[field_type]["z"] = fz
    def ravelXYZForFortran(self):
        """
    Ravels the XYZ fields into a convenient format for working
    with fortran.
    Args:
      self: Standard python object oriented notation. 
    Return value:
      None --- but rewrites the field numpy arrays.
    """
        for field_type, field in self.fields.iteritems():
            fx = fzeros(
                (self.number_of_steps["x"] + 1, self.number_of_steps["y"] + 1,
                 self.number_of_steps["z"] + 1))
            fy = fzeros(
                (self.number_of_steps["x"] + 1, self.number_of_steps["y"] + 1,
                 self.number_of_steps["z"] + 1))
            fz = fzeros(
                (self.number_of_steps["x"] + 1, self.number_of_steps["y"] + 1,
                 self.number_of_steps["z"] + 1))

            ix = get_index_of_point(self.coordinates["x"], self.stepsize["x"])
            iy = get_index_of_point(self.coordinates["y"], self.stepsize["y"])
            iz = get_index_of_point(self.coordinates["z"], self.stepsize["z"])

            ii = ix + int(self.number_of_steps["x"]+1)*iy + \
                 int(self.number_of_steps["x"]+1)*int(self.number_of_steps["y"]+1)*iz

            fx.ravel(order='F').put(ii, field["x"])
            fy.ravel(order='F').put(ii, field["y"])
            fz.ravel(order='F').put(ii, field["z"])

            self.fields[field_type]["x"] = fx
            self.fields[field_type]["y"] = fy
            self.fields[field_type]["z"] = fz