# esys.escript.splitworld Package

## Classes

- `FunctionJob`
- `Job`
- `SplitWorld`

class `esys.escript.splitworld.``FunctionJob`(fn, *args, **kwargs)

  Bases: `esys.escriptcore.splitworld.Job`

  Takes a python function (with only self and keyword params) to be called as the work method

  `__init__`(fn, *args, **kwargs)

    It ignores all of its parameters, except that, it requires the following as keyword arguments

    Variables:

    - domain – Domain to be used as the basis for all `Data` and PDEs in this Job.
    - jobid – sequence number of this job. The first job has id=1

  `clearExports`()

    Remove exported values from the map

  `clearImports`()

    Remove imported values from their map

  `declareImport`(name)

    Adds name to the list of imports

  `exportValue`(name, v)

    Make value v available to other Jobs under the label name. name must have already been registered with the SplitWorld instance. For use inside the work() method.

    Variables:

    - name – registered label for exported value
    - v – value to be imported

  `importValue`(name)

    For use inside the work() method.

    Variables: | name – label for imported value.

  `setImportValue`(name, v)

    Use to make a value available to the job (ie called from outside the job)

    Variables:

    - name – label used to identify this import
    - v – value to be imported

  `work`()

    Need to be overloaded for the job to actually do anthing. A return value of True indicates this job thinks it is done. A return value of False indicates work still to be done

class `esys.escript.splitworld.``Job`(*args, **kwargs)

  Bases: `object`

  Describes a sequence of work to be carried out in a subworld. The instances of this class used in the subworlds will be constructed by the system. To do specific work, this class should be subclassed and the work() (and possibly __init__ methods overloaded). The majority of the work done by the job will be in the overloaded work() method. The work() method should retrieve values from the outside using importValue() and pass values to the rest of the system using exportValue(). The rest of the methods should be considered off limits.

  `__init__`(*args, **kwargs)

    It ignores all of its parameters, except that, it requires the following as keyword arguments

    Variables:

    - domain – Domain to be used as the basis for all `Data` and PDEs in this Job.
    - jobid – sequence number of this job. The first job has id=1

  `clearExports`()

    Remove exported values from the map

  `clearImports`()

    Remove imported values from their map

  `declareImport`(name)

    Adds name to the list of imports

  `exportValue`(name, v)

    Make value v available to other Jobs under the label name. name must have already been registered with the SplitWorld instance. For use inside the work() method.

    Variables:

    - name – registered label for exported value
    - v – value to be imported

  `importValue`(name)

    For use inside the work() method.

    Variables: | name – label for imported value.

  `setImportValue`(name, v)

    Use to make a value available to the job (ie called from outside the job)

    Variables:

    - name – label used to identify this import
    - v – value to be imported

  `work`()

    Need to be overloaded for the job to actually do anthing. A return value of True indicates this job thinks it is done. A return value of False indicates work still to be done

class `esys.escript.splitworld.``SplitWorld`(count)

  Bases: `object`

  Wrapper for the C++ class exposed as __SplitWorld. This is a namespace consideration, it allows us to make boost::python::raw_functions into members of a class.

  `__init__`(count)

    Variables: | count – How many equally sized subworlds should our compute resources be partitioned into?

  `addJob`(jobctr, *vec, **kwargs)

    Submit a job to be run later on an available subworld.

    Variables: | jobctr – class or function to be called to create a job

    The remaining parameters are for the arguments of the function.

  `addJobPerWorld`(jobctr, *vec, **kwargs)

    Submit one job per subworld to run later.

    Variables: | jobctr – class or function to be called to create a job

    The remaining parameters are for the arguments of the function.

  `addVariable`(vname, vartype, *vec, **kwargs)

    Create a variable on all subworlds.

    Variables: | vartype – the type of variable to be created

    The remaining parameters are for optional arguments depending on the variable type.

  `buildDomains`(fn, *vec, **kwargs)

    Instruct subworlds how to build the domain.

    Variables: | fn – The function/class to call to create a domain.

    The remaining parameters are for the arguments of the function.

  `clearVariable`(vname)

    Clears the value of the named variable. The variable itself still exists.

    Variables: | vname – variable to clear

  `copyVariable`(src, dest)

    copy the contents of one splitworld variable into another

    Variables:

    - src – name of variable to copy from
    - dest – name of variable to copy to

  `getFloatVariable`(vname)

    Return the value of a floating point variable

  `getLocalObjectVariable`(vname)

    Return the value of a local object variable - that is, an object (eg tuple) which does not need to be reduced/shared between worlds

  `getSubWorldCount`()

    Return the number of subworlds in this splitworld

  `getSubWorldID`()

    Return the id of the subworld which _this_ MPI process belongs to.

  `getVarInfo`()

    Returns the names of all declared variables and a description of type. The details of the output are not fixed and may change without notice

  `getVarList`()

    Returns the names of all declared variables and a boolean for each indicating whether they have values.

  `removeVariable`(vname)

    Removes the named variable from all subworlds.

    Variables: | vname – What to remove

  `runJobs`()

    Executes pending jobs.

## Functions

## Others

## Packages