Help us shape the future of Go! Take the 2026 Go Developer Survey

material

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2018 License: GPL-3.0, GPL-3.0-or-later Imports: 3 Imported by: 2

Documentation

Overview

Package material implement material model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compound

type Compound struct {
	Name string `json:"name"`

	// Density of the medium in g/cm³ - mandatory.
	Density float64 `json:"density"`

	// StateOfMatter - mandatory.
	StateOfMatter StateOfMatter `json:"stateOfMatter"`

	Elements []Element `json:"elements"`

	// Load stopping power from external file - optional. The file is selected
	// just like in case of Predefined material named by this string.
	ExternalStoppingPowerFromPredefined string `json:"externalStoppingPowerFromPredefined,omitempty"`
}

Compound material type - create material by defining isotope mixture.

func (Compound) MarshalJSON

func (c Compound) MarshalJSON() ([]byte, error)

MarshalJSON json.Marshaller implementation.

type Element

type Element struct {
	Isotope string `json:"isotope"`

	RelativeStoichiometricFraction int64 `json:"relativeStoichiometricFraction"`

	// Override atomic mass - optional.
	AtomicMass float64 `json:"atomicMass,omitempty"`

	// Mean excitation energy (I-value) in eV - optional.
	IValue float64 `json:"iValue,omitempty"`
}

Element is a basic building block of Compound.

type ID

type ID int64

ID is key type in Material map.

type IsotopeRecord

type IsotopeRecord struct {
	Value string `json:"value"`
	Name  string `json:"name"`
}

IsotopeRecord contains data needed on frontend related to Isotopes.

func Isotopes

func Isotopes() []IsotopeRecord

Isotopes return list of all available isotopes for material.Element.

type Material

type Material struct {
	ID    ID          `json:"id"`
	Color color.Color `json:"color"`
	Type  Type        `json:"materialInfo"`
}

Material defines the zone material that is used in the simulation.

func (*Material) UnmarshalJSON

func (m *Material) UnmarshalJSON(b []byte) error

UnmarshalJSON custom Unmarshal function. material.Type is recognized by material/type in json.

type Predefined

type Predefined struct {
	PredefinedID string `json:"predefinedId"`

	// Density of the medium in g/cm³ - optional.
	Density float64 `json:"density,omitempty"`

	// State of matter - optional
	StateOfMatter StateOfMatter `json:"stateOfMatter,omitempty"`

	// Load stopping power from external file.
	LoadExternalStoppingPower bool `json:"loadExternalStoppingPower,omitempty"`
}

Predefined material type - choose material definition from predefined material list by name.

func (Predefined) MarshalJSON

func (p Predefined) MarshalJSON() ([]byte, error)

MarshalJSON json.Marshaller implementation.

type PredefinedMaterialRecord

type PredefinedMaterialRecord struct {
	Value string      `json:"value"`
	Name  string      `json:"name"`
	Color color.Color `json:"color"`
}

PredefinedMaterialRecord contains data needed on frontend related to PredefinedMaterials.

func PredefinedMaterials

func PredefinedMaterials() []PredefinedMaterialRecord

PredefinedMaterials return list of all available material.Predefined and Colors assigned to them.

type StateOfMatter

type StateOfMatter int

StateOfMatter represent state of material.

const (

	// NonDefined - only allowed for Predifined
	NonDefined = iota

	// Solid state of matter.
	Solid StateOfMatter = iota
	// Gas state of matter.
	Gas
	// Liquid state of matter.
	Liquid
)

func (StateOfMatter) MarshalJSON

func (s StateOfMatter) MarshalJSON() ([]byte, error)

MarshalJSON json.Marshaller implementation.

func (*StateOfMatter) UnmarshalJSON

func (s *StateOfMatter) UnmarshalJSON(b []byte) error

UnmarshalJSON json.Unmarshaller implementation.

type Type

type Type interface {
	json.Marshaler
}

Type is interface for material type. It must implement json.Marshaler to marshal material Type dependant on material Type implementation type.

type Voxel

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

Voxel TODO

func (Voxel) MarshalJSON

func (v Voxel) MarshalJSON() ([]byte, error)

MarshalJSON json.Marshaller implementation.

Jump to

Keyboard shortcuts

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