loop

package
v0.0.0-...-e3578a0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Cubic InterpolatorType = iota
	Linear

	Particle UnitType = iota
	Tetra
)

Variables

This section is empty.

Functions

func Loop

func Loop(snap int, objs []Object, buf *Buffer, skip int,
	it InterpolatorType, pts, workers int) error

Loop iterates over all the tetrahedra or all the points in the simulation box. A lot of tricks are used to minimize the number of operations done.

TODO: restructure so there are fewer function arguments here.

Types

type Box

type Box struct {
	// contains filtered or unexported fields
}

func (*Box) Contains

func (b *Box) Contains(x, y, z float64) bool

func (*Box) Init

func (b *Box) Init(origin, span [3]float64)

func (*Box) IntersectBox

func (b *Box) IntersectBox(origin, span [3]float64, tw float64) bool

func (*Box) Transform

func (b *Box) Transform(vecs []rgeom.Vec, totalWidth float64)

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

func NewBuffer

func NewBuffer() *Buffer

type InterpolatorType

type InterpolatorType int

InterpolatorType is the type of interpolation used during the iteration.

type Object

type Object interface {
	// Transform does a coordinate transformation on a slice of vectors such
	// that they are all .
	Transform(vecs []rgeom.Vec, tw float64)
	// Contains returns true if a point is contained inside the Object.
	Contains(x, y, z float64) bool
	// IntersectBox returns true if a box intersects the Object. This function
	// is allowed to be slow.
	IntersectBox(origin, span [3]float64, tw float64) bool

	// ThreadCopy copies enough of the object's internal state to a new instance
	// of that object so that both Objects can maintain calls to Use*foo*
	// simultaneously.
	ThreadCopy(id, threads int) Object
	// ThreadMerge combines the data from a group of objects into the reciever.
	// The reciever will _not_ be in the object list, but its initial data
	// should be combined likewise.
	ThreadMerge(objs []Object)

	// UsePoint supplies a point to the object.
	UsePoint(x, y, z float64)
	// UseTetra supplies a tetrahedron to the object.
	UseTetra(t *geom.Tetra)

	// Params returns miscellaneous parameters.
	Params() Params
}

An object which will be passed to Loop(). It must be less than half the size of the simulation box (because delaing with larger objects is a nightmare).

type Params

type Params struct {
	// UsesTetra is true if tetrahedra should be iterated over and false if
	// points should be iterated over.
	UsesTetra bool
}

Params

type Sphere

type Sphere struct {
	// contains filtered or unexported fields
}

func (*Sphere) Contains

func (s *Sphere) Contains(x, y, z float64) bool

func (*Sphere) Init

func (s *Sphere) Init(origin [3]float64, rMin, rMax float64)

func (*Sphere) IntersectBox

func (s *Sphere) IntersectBox(origin, span [3]float64, tw float64) bool

func (*Sphere) Transform

func (s *Sphere) Transform(vecs []rgeom.Vec, totalWidth float64)

type UnitType

type UnitType int

Jump to

Keyboard shortcuts

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