Exemple #1
0
    def save_vtks(self):
        """
        Save vtk files in different folders, according to the
        simulation name and step.
        Files are saved as vtks/simname_simstep_vtk/image_00000x.vtk
        """

        # Create the directory
        directory = 'vtks/%s_%d' % (self.name, self.step)

        self.vtk = SaveVTK(self.sim.mesh, directory=directory)

        self.coords.shape = (self.total_image_num, -1)

        # We use Ms from the simulation assuming that all the
        # images are the same
        for i in range(self.total_image_num):
            # We will try to save for the micromagnetic simulation (Ms)
            # or an atomistic simulation (mu_s)
            # TODO: maybe this can be done with an: isinstance
            try:
                self.vtk.save_vtk(self.coords[i].reshape(-1, 3),
                                  self.sim.Ms,
                                  step=i,
                                  vtkname='m')
            except:
                self.vtk.save_vtk(self.coords[i].reshape(-1, 3),
                                  self.sim._mu_s,
                                  step=i,
                                  vtkname='m')

        self.coords.shape = (-1, )
Exemple #2
0
    def save_vtks(self):
        """
        Save vtk files in different folders, according to the
        simulation name and step.
        Files are saved as vtks/simname_simstep_vtk/image_00000x.vtk
        """

        # Create the directory
        directory = 'vtks/%s_%d' % (self.name, self.step)

        self.vtk = SaveVTK(self.sim.mesh, directory)

        self.coords.shape = (self.total_image_num, -1)

        for i in range(self.total_image_num):
            self.vtk.save_vtk(spherical2cartesian(self.coords[i]),
                              step=i,
                              vtkname='m')

        self.coords.shape = (-1, )