User Manual: Code: Fluxon.pm

From FLUX

Jump to: navigation, search

(back to the User Manual or the code section)

Fluxon.pm (and its associated XS file, Fluxon.xs) implements the Flux::Fluxon object. It consists mostly of methods that act directly on each fluxon. New fluxons are produced primarily via Flux::World methods such as str2world or emerge, though there is a constructor if you want to build your own.

Flux::Fluxon objects are tied hash refs, so you can read and manipulate all of the data fields in the underlying FLUXON struct via hash keys in Perl.

Contents

Hash structure

The hash fields echo the underlying structure of the FLUXON struct declared in data.h.

FieldtypeRW?Description
fluxfloatrw The amount of magnetic flux contained in the fluxon. This is a placeholder -- all fluxons have the same amount of magnetic flux at the moment, and energy and field calculations are normalized to unit flux per fluxon.
labelintrw The unique integer label for this fluxon. Don't change this unless you really know what you are doing.
startFlux::Vertexro The beginning of the doubly-linked list of vertices for this fluxon
endFlux::Vertexro The end of the doubly-linked list of vertices for this fluxon
v_ctintrw The number of vertices in the vertex list (don't write to this unless you know what you are doing).
all_links_sumfloatrw The flux accumulator for the world fluxon tree
all_links_nintrw The count accumulator for the world fluxon tree
all_links_upFlux::Fluxonro The UP link for the world fluxon tree
all_links_leftFlux::FluxonroThe LEFT link for the world fluxon tree
all_links_rightFlux::FluxonroThe RIGHT link for the world fluxon tree
start_links_sumfloatrw The flux accumulator for the source flux concentration's fluxon tree
start_links_nintrw The count accumulator for the source flux concentration's fluxon tree
start_links_upFlux::Fluxonro The UP link for the source flux concentration's fluxon tree
start_links_leftFlux::Fluxonro The LEFT link for the source flux concentration's fluxon tree
start_links_rightFlux::Fluxonro The RIGHT link for the source flux concentration's fluxon tree
end_links_sumfloatrw The flux accumulator for the sink flux concentration's fluxon tree
end_links_nintrw The count accumulator for the sink flux concentration's fluxon tree
end_links_upFlux::Fluxonro The UP link for the sink flux concentration's fluxon tree
end_links_leftFlux::Fluxonro The LEFT link for the sink flux concentration's fluxon tree
end_links_rightFlux::Fluxonro The RIGHT link for the sink flux concentration's fluxon tree
fc_start Flux::Concentrationro The source flux concentration (note: in the C struct this field is called fc0.)
fc_end Flux::Concentrationro The sink flux concentration (note: in the C struct this field is called fc1.)
plasmoid intrw A flag indicating whether the current fluxon is a plasmoid. Don't write to this unless you really know what you are doing -- if it is TRUE, then fc_start should point to the WORLD's fc_pb field and fc_end should point to the WORLD's fc_pe.

Methods

Constructors & I/O

new

$fluxon = Flux::Fluxon->new($world, $fc0, $fc1, $flux, $label, $verts)

Generates a new fluxon connecting the flux concentrations $fc0 and $fc1, with $flux units of amgnetic flux, label $label (or an autogenerated label if $label is undef or 0), and intermediate vertices at the locations given in $verts, which should be a 3xN PDL. The fluxon ends up with (N+2) vertices.

stringify

print "$fluxon" $s = $fluxon->stringify

Generates a string summary of a fluxon object -- used for fluxon stringification in scalar string context.

polyline

$pdl = $fluxon->polyline;

Returns all the vertex locations in the fluxon, as a 3xN PDL.

bfield

$field = $fluxon->bfield();

Returns the stored B vector at each vertex location in the fluxon, in order, as a 3xN PDL. (This does not calculate the B field directly -- for that you need to add a magnetic field pseudoforce to the forces list in the fluxon's associated Flux::World, and run update_forces on the Flux::World.)


dump_vecs

$vecs = $fluxon->dump_vecs()

Returns a 17xN PDL containing most of the numeric information about the vertices in the fluxon, as follows:

cols 0-2
vertex location
cols 3-5
B field vector
cols 6-8
following segment partial force
cols 9-11
vertex partial force
col 12
following segment partial force sum-of-magnitudes
col 13
vertex partial force sum-of-magnitudes
col 14
projected neighborhood radius for segment forces (r_s)
col 15
projected neighborhood radius for vertex forces (r_v)
col 16
closest neighbor approach projected radius (r_cl)

Multiple-access & search methods

vertices

@v = $fl->vertices

Generates a list of all the vertices in a fluxon, in order of appearance from the north (start) flux concentration to the south (end) flux concentration.

vertex

$v = $fl->vertex($n)

Returns the nth vertex in the fluxon, starting with 0. Returns undef if $n is out of range.

Manipulation

reattach

$fluxon->reattach($fc)

Reattaches the fluxon to a new flux concentration. Depending on the sign of the flux concentration, either the beginning or the end of the fluxon is reattached. This is useful for clearing out existing fluxons from a concentration before deleting it, or for transferring flux in tracked data

Personal tools