driver

package
v0.0.0-...-a63885c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2014 License: BSD-3-Clause Imports: 9 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver struct {
	Name       string                 // Identifier for the case
	Options    *config.Options        // OptionList for the case
	Config     string                 // Name of the config filename (relative to working directory)
	Wd         string                 // Working directory of SU2
	Stdout     string                 // Where to redict Stdout (relative to working directory). Will be set to Stdout if ==""
	Stderr     string                 // Where to redirct Stderr (relative to working directory). Will be set to Stderr if ==""
	OptionList map[config.Option]bool // Which options to print to the config file
	FancyName  string                 // Longer name (can be used for plot legends or something)
}

Driver specifies a case for running SU2.

func (*Driver) CopyRestartToSolution

func (d *Driver) CopyRestartToSolution() error

CopyRestartToSolution copies the restart file to the solution file

func (*Driver) EraseDoneFiles

func (d *Driver) EraseDoneFiles() error

EraseDoneFiles deletes the solution file and crash file

func (*Driver) IsComputed

func (d *Driver) IsComputed(stat Status) bool

IsComputed returns true if the status indicates that the solution has been computed

func (*Driver) Load

func (d *Driver) Load() error

Load reads in the config file from the config file listed in the driver structure. Sets the Options and the OptionList.

func (*Driver) LoadFrom

func (d *Driver) LoadFrom(reader io.Reader) error

LoadFrom reads a config file from the reader and sets the Options and OptionList fields.

func (*Driver) MoveSolutionToOld

func (d *Driver) MoveSolutionToOld() error

MoveSolutionToOld moves the solution file to d.Options.SolutionFlowFilename + This can be useful for automated tools. (In case of error, the old solution file) is not lost

func (*Driver) Run

func (d *Driver) Run(su2call Syscaller) error

Run executes SU2 with the given Syscaller. Run writes the config file (as specified by driver.Config and driver.Wd), uses the Syscaller to get the arguments to exec.Command, and calls exec.Cmd.Run with the provided working directory, stdout, and stderr. If run has an error, an error file will be written.

func (*Driver) Status

func (d *Driver) Status() Status

Status returns the status of the computation. If this particular set of options has been computed before (defined by the config file and the working directory) it returns Computed, otherwise it returns one of the other status constants.

type Parallel

type Parallel struct {
	Cores int
}

Parallel runs SU2 in parallel with the specified number of cores. SU2 must be compiled with MPI

func (Parallel) NumCores

func (p Parallel) NumCores() int

func (Parallel) Syscall

func (p Parallel) Syscall(d *Driver) (execname string, args []string)

type Serial

type Serial struct{}

Serial runs SU2 on one processor.

func (Serial) NumCores

func (s Serial) NumCores() int

func (Serial) Syscall

func (s Serial) Syscall(d *Driver) (execname string, args []string)

type Slurm

type Slurm struct {
	Cores int
}

Slurm runs SU2 via a call to Slurm. This does not work at present.

func (Slurm) NumCores

func (c Slurm) NumCores() int

func (Slurm) Syscall

func (c Slurm) Syscall(d *Driver) (execname string, args []string)

type Status

type Status int

Status is a type that represents if the computation specified by the driver has been computed, and if not, why not. Note that this is not the status during a call to Driver.Run, but rather used for checking if this config file has already been successfully been completed

const (
	Error Status = iota
	ComputedSuccessfully
	ComputedWithError
	NoConfigFile
	ErrorParsingConfig
	UnequalOptions
	NoSolutionFile
	HasErrorFile
)

func (Status) String

func (s Status) String() string

type Syscaller

type Syscaller interface {
	Syscall(d *Driver) (string, []string) // Returns the exec name and the arguments to be called by exec.Command
	NumCores() int                        // How many cores does it want
}

Syscaller is a provides the system call to execute a Driver. The returned arguments will be passed directly to exec.Cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL