v_sim.ScalarField

g GObject.GInterface GObject.GInterface v_sim.Boxed v_sim.Boxed GObject.GInterface->v_sim.Boxed v_sim.Pointset v_sim.Pointset GObject.GInterface->v_sim.Pointset GObject.Object GObject.Object v_sim.ScalarField v_sim.ScalarField GObject.Object->v_sim.ScalarField v_sim.Boxed->v_sim.ScalarField v_sim.Pointset->v_sim.ScalarField

Subclasses:

v_sim.ScalarFieldBinaryOp, v_sim.ScalarFieldData

Methods

Inherited:

GObject.Object (37), v_sim.Boxed (2), v_sim.Pointset (9)

Structs:

GObject.ObjectClass (5)

class

new (label)

addOption (option)

getAllOptions ()

getAt (i, j, k)

getCommentary ()

getCoordInside (xyz, extension)

getGradAt (i, j, k, dir)

getGridSize ()

getLabel ()

getMesh (dir)

getMeshInside (i, j, k)

getMeshtype ()

getMinMax (minmax)

getValue (xyz, extension)

isEmpty ()

setCommentary (comment)

setGridSize (grid)

setMesh (mesh, dir)

setMeshtype (meshtype)

Virtual Methods

Inherited:

GObject.Object (7), v_sim.Boxed (1), v_sim.Pointset (5)

do_getAt (i, j, k)

do_getGridSize ()

do_getMinMax (minmax)

do_getValue (xyz, extension)

do_isEmpty ()

do_setGridSize (grid)

Properties

Inherited:

v_sim.Boxed (2), v_sim.Pointset (4)

Name

Type

Flags

Short Description

empty

bool

r

whether has data or not

label

str

r/w/co

description label

Signals

Inherited:

GObject.Object (1), v_sim.Boxed (1)

Name

Short Description

changed

Gets emitted when the values stored in this field are changed.

Fields

Inherited:

GObject.Object (1), v_sim.Boxed (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class v_sim.ScalarField(**kwargs)
Bases:

GObject.Object, v_sim.Boxed, v_sim.Pointset

Abstract:

No

Structure:

v_sim.ScalarFieldClass

An opaque structure for the scalar field.

classmethod new(label)
Parameters:

label (str) – a label to identify the scalar field.

Returns:

a newly created v_sim.ScalarField object.

Return type:

v_sim.ScalarField

Create a new v_sim.ScalarField object that is empty (all internal pointers are set to None and no memory is allocated except for the object itself. The label argument is copied.

addOption(option)
Parameters:

option (v_sim.Option) – a newly allocated option.

This method adds an option to the list of #Option associated to the data. The given option will not be duplicated and should not be used elsewhere because it will be freed when the self will be freed.

getAllOptions()
Returns:

a newly created GLib.List that should be freed after use with g_list_free(). But data of the list are owned by V_Sim and should not be modified or freed.

Return type:

[v_sim.Option]

Some #Option can be stored in association to the values of the scalar field. These options are usually values associated to the read data, such as a spin direction when dealing with density of spin…

getAt(i, j, k)
Parameters:
  • i (int) – an integer.

  • j (int) – an integer.

  • k (int) – an integer.

Returns:

the value.

Return type:

float

Computes the scalarfield value at i, j and k.

New in version 3.8.

getCommentary()
Returns:

a pointer on the commentary (it should not be freed), can be None.

Return type:

str

If the file format support a commentary, this is a good method to get it.

getCoordInside(xyz, extension)
Parameters:
  • xyz ([float]) – some cartesian coordinates.

  • extension ([float]) – extension to consider.

Returns:

True if grid is valid.

grid:

a location to store grid coordinates.

dgrid:

a location to store grid coordinates.

factor:

a location to store factors in every directions.

Return type:

(bool, grid: [int], dgrid: [int], factor: [float])

From the coordinates xyz, compute the grid coordinate grid closest to xyz. Put also in dgrid the closest grid coordinate after xyz. On output, factor will contains three float in [0;1] defining where is xyz within the cube defined by grid and dgrid.

New in version 3.8.

getGradAt(i, j, k, dir)
Parameters:
  • i (int) – an integer.

  • j (int) – an integer.

  • k (int) – an integer.

  • dir (v_sim.XyzDir) – a direction.

Returns:

the gradient value.

Return type:

float

Computes the gradient along dir at i, j and k.

New in version 3.8.

getGridSize()
Returns:

3 integer locations.

Return type:

grid: v_sim.GridSize

This method is used to get the division in x, y, and z directions.

getLabel()
Returns:

a pointer on the filename (it should not be freed).

Return type:

str

The data are read from a file.

getMesh(dir)
Parameters:

dir (v_sim.XyzDir) – a direction.

Returns:

a pointer on the allocated meshx array (it should not be freed).

Return type:

float

The mesh along x is stored as an array in x increasing.

getMeshInside(i, j, k)
Parameters:
  • i (int) – an integer.

  • j (int) – an integer.

  • k (int) – an integer.

Returns:

a location to store the mesh coordinates.

Return type:

grid: [int]

Apply periodicity when required to convert a mesh coordinates (i,j,k) into a valid coordinate grid.

New in version 3.8.

getMeshtype()
Returns:

a v_sim.ScalarFieldMeshFlags (uniform or nonuniform).

Return type:

v_sim.ScalarFieldMeshFlags

The vertex may be distributed linearly along the different directions or customily distributed.

getMinMax(minmax)
Parameters:

minmax ([float]) – two double values.

Get the minimum and the maximum values of the given self.

getValue(xyz, extension)
Parameters:
  • xyz ([float]) – a point coordinate (in real space) ;

  • extension ([float]) – a possible extension in box coordinates.

Returns:

True if the value can be interpolate, False otherwise, for instance, when the point xyz is out of bounds.

value:

a location to store the value ;

Return type:

(bool, value: float)

Knowing the point coordinates, it interpolate a value from the scalar field. If the scalar field is periodic, then it allow the coordinates to extend inside the given extension.

isEmpty()
Returns:

True if self has not been populated yet.

Return type:

bool

Since loading of scalar fields is asynchronous, this method can be used to inquire if self has been populated yet or not.

New in version 3.8.

setCommentary(comment)
Parameters:

comment (str) – an UTF-8 string to store as a commentary.

A commentary can be associated to a v_sim.ScalarField, use this method to set it. The value of comment is NOT copied.

setGridSize(grid)
Parameters:

grid ([int]) – 3 integers.

Return type:

bool

This method is used to set the division in x, y, and z directions. If the size of internal array for data is changed, it is reallocated and previous data are erased. Use visu_scalar_field_getData() to get a pointer on this data array.

setMesh(mesh, dir)
Parameters:
  • mesh (float) – an array with the mesh description in one direction.

  • dir (v_sim.XyzDir) – a direction.

Define the mesh in case of non regular one.

New in version 3.8.

setMeshtype(meshtype)
Parameters:

meshtype (v_sim.ScalarFieldMeshFlags) – a v_sim.ScalarFieldMeshFlags object.

Change the distribution of the vertex of the scalarfield between regular or custom.

do_getAt(i, j, k) virtual
Parameters:
  • i (int) – an integer.

  • j (int) – an integer.

  • k (int) – an integer.

Returns:

the value.

Return type:

float

Computes the scalarfield value at i, j and k.

New in version 3.8.

do_getGridSize() virtual
Returns:

3 integer locations.

Return type:

grid: v_sim.GridSize

This method is used to get the division in x, y, and z directions.

do_getMinMax(minmax) virtual
Parameters:

minmax ([float]) – two double values.

Get the minimum and the maximum values of the given field.

do_getValue(xyz, extension) virtual
Parameters:
  • xyz ([float]) – a point coordinate (in real space) ;

  • extension ([float]) – a possible extension in box coordinates.

Returns:

True if the value can be interpolate, False otherwise, for instance, when the point xyz is out of bounds.

value:

a location to store the value ;

Return type:

(bool, value: float)

Knowing the point coordinates, it interpolate a value from the scalar field. If the scalar field is periodic, then it allow the coordinates to extend inside the given extension.

do_isEmpty() virtual
Returns:

True if field has not been populated yet.

Return type:

bool

Since loading of scalar fields is asynchronous, this method can be used to inquire if field has been populated yet or not.

New in version 3.8.

do_setGridSize(grid) virtual
Parameters:

grid ([int]) – 3 integers.

Return type:

bool

This method is used to set the division in x, y, and z directions. If the size of internal array for data is changed, it is reallocated and previous data are erased. Use visu_scalar_field_getData() to get a pointer on this data array.

Signal Details

v_sim.ScalarField.signals.changed(scalar_field)
Signal Name:

changed

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:

scalar_field (v_sim.ScalarField) – The object which received the signal

Gets emitted when the values stored in this field are changed.

New in version 3.8.

Property Details

v_sim.ScalarField.props.empty
Name:

empty

Type:

bool

Default Value:

True

Flags:

READABLE

whether has data or not

v_sim.ScalarField.props.label
Name:

label

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

description label