m3point

package
v0.0.0-...-a2bc2c8 Latest Latest
Warning

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

Go to latest
Published: May 3, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectionDetailsTable = "connection_details"
	TrioDetailsTable       = "trio_details"
)
View Source
const (
	NbTrioDsIndex = 7
	NilTrioIndex  = TrioIndex(255)
)
View Source
const DefaultMaxHashConflicts = 8
View Source
const (
	GrowthContextsTable = "growth_contexts"
)
View Source
const (
	PathBuildersTable = "path_builders"
)
View Source
const (
	// Where the number matters and appear. Remember that 3 is the number!
	THREE = 3
)
View Source
const (
	TotalNumberOfCubes = 5192
)
View Source
const (
	TrioCubesTable = "trio_cubes"
)

Variables

View Source
var AllMod4Permutations [12][4]TrioIndex
View Source
var AllMod8Permutations [12][8]TrioIndex
View Source
var EmptyConnDetails = ConnectionDetails{NilConnectionId, Origin, 0}
View Source
var Log = m3util.NewLogger("m3point", m3util.INFO)
View Source
var NegXFirst = XFirst.Neg()
View Source
var NegYFirst = YFirst.Neg()
View Source
var NegZFirst = ZFirst.Neg()
View Source
var NilConnectionId = ConnectionId(0)
View Source
var Origin = Point{0, 0, 0}
View Source
var XFirst = Point{THREE, 0, 0}
View Source
var YFirst = Point{0, THREE, 0}
View Source
var ZFirst = Point{0, 0, THREE}

Functions

func FillDbEnv

func FillDbEnv(env *m3db.QsmEnvironment)

func GenerateTextFilesEnv

func GenerateTextFilesEnv(env *m3db.QsmEnvironment)

func GetCleanTempDb

func GetCleanTempDb(envId m3db.QsmEnvID) *m3db.QsmEnvironment

Do not use this environment to load

func GetFullTestDb

func GetFullTestDb(envId m3db.QsmEnvID) *m3db.QsmEnvironment

func GetMiddleEdgeIndex

func GetMiddleEdgeIndex(ud1 UnitDirection, ud2 UnitDirection) int

func GetTrioConnType

func GetTrioConnType(conns [6]Point) string

Return the kind of connection between 2 trios depending of the distance square values A3 => All connections have a DS of 3 A5 => All connections have a DS of 5 X135 => All DS present 1, 3 and 5 G13 => 1 and 3 are present but no DS 5 (The type we use)

func GetTrioTransitionTableCsv

func GetTrioTransitionTableCsv() [][]string

func InitializeDBEnv

func InitializeDBEnv(env *m3db.QsmEnvironment, forced bool)

func IsLessConnId

func IsLessConnId(cd1, cd2 *ConnectionDetails) bool

func PosMod2

func PosMod2(i uint64) uint64

func PosMod4

func PosMod4(i uint64) uint64

func PosMod8

func PosMod8(i uint64) uint64

func ReFillDbEnv

func ReFillDbEnv(env *m3db.QsmEnvironment)

Types

type BaseGrowthContext

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

func (*BaseGrowthContext) GetBaseDivByThree

func (gowthCtx *BaseGrowthContext) GetBaseDivByThree(mainPoint Point) uint64

func (*BaseGrowthContext) GetBaseTrioIndex

func (gowthCtx *BaseGrowthContext) GetBaseTrioIndex(divByThree uint64, offset int) TrioIndex

func (*BaseGrowthContext) GetEnv

func (gowthCtx *BaseGrowthContext) GetEnv() *m3db.QsmEnvironment

func (*BaseGrowthContext) GetGrowthIndex

func (gowthCtx *BaseGrowthContext) GetGrowthIndex() int

func (*BaseGrowthContext) GetGrowthType

func (gowthCtx *BaseGrowthContext) GetGrowthType() GrowthType

func (*BaseGrowthContext) GetId

func (gowthCtx *BaseGrowthContext) GetId() int

func (*BaseGrowthContext) String

func (gowthCtx *BaseGrowthContext) String() string

type BasePathNodeBuilder

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

func (*BasePathNodeBuilder) GetCubeId

func (pnb *BasePathNodeBuilder) GetCubeId() int

func (*BasePathNodeBuilder) GetEnv

func (pnb *BasePathNodeBuilder) GetEnv() *m3db.QsmEnvironment

func (*BasePathNodeBuilder) GetPointPackData

func (pnb *BasePathNodeBuilder) GetPointPackData() *PointPackData

func (*BasePathNodeBuilder) GetTrioIndex

func (pnb *BasePathNodeBuilder) GetTrioIndex() TrioIndex

type ByConnId

type ByConnId []*ConnectionDetails

func (ByConnId) Len

func (cds ByConnId) Len() int

func (ByConnId) Less

func (cds ByConnId) Less(i, j int) bool

func (ByConnId) Swap

func (cds ByConnId) Swap(i, j int)

type ByConnVector

type ByConnVector []*ConnectionDetails

func (ByConnVector) Len

func (cds ByConnVector) Len() int

func (ByConnVector) Less

func (cds ByConnVector) Less(i, j int) bool

func (ByConnVector) Swap

func (cds ByConnVector) Swap(i, j int)

type CInt

type CInt int32

func AbsCInt

func AbsCInt(i CInt) CInt

func GetRandomCInt

func GetRandomCInt(max CInt) CInt

type ConnectionDetails

type ConnectionDetails struct {
	Id     ConnectionId
	Vector Point
	ConnDS DInt
}

func (*ConnectionDetails) DistanceSquared

func (cd *ConnectionDetails) DistanceSquared() DInt

func (*ConnectionDetails) GetDirections

func (cd *ConnectionDetails) GetDirections() [2]UnitDirection

func (*ConnectionDetails) GetId

func (cd *ConnectionDetails) GetId() ConnectionId

func (*ConnectionDetails) GetNegId

func (cd *ConnectionDetails) GetNegId() ConnectionId

func (*ConnectionDetails) GetPosId

func (cd *ConnectionDetails) GetPosId() ConnectionId

func (*ConnectionDetails) IsBaseConnection

func (cd *ConnectionDetails) IsBaseConnection() bool

func (*ConnectionDetails) IsValid

func (cd *ConnectionDetails) IsValid() bool

func (*ConnectionDetails) String

func (cd *ConnectionDetails) String() string

type ConnectionId

type ConnectionId int8

func (ConnectionId) GetNegId

func (connId ConnectionId) GetNegId() ConnectionId

func (ConnectionId) GetPosConnectionId

func (connId ConnectionId) GetPosConnectionId() ConnectionId

func (ConnectionId) IsBaseConnection

func (connId ConnectionId) IsBaseConnection() bool

func (ConnectionId) IsValid

func (connId ConnectionId) IsValid() bool

************************************************************* ConnectionId Functions *************************************************************

func (ConnectionId) String

func (connId ConnectionId) String() string

type CubeKeyId

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

type CubeListBuilder

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

type CubeOfTrioIndex

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

func (CubeOfTrioIndex) GetCenterFaceTrio

func (cube CubeOfTrioIndex) GetCenterFaceTrio(ud UnitDirection) TrioIndex

func (CubeOfTrioIndex) GetCenterTrio

func (cube CubeOfTrioIndex) GetCenterTrio() TrioIndex

func (CubeOfTrioIndex) GetMiddleEdgeTrio

func (cube CubeOfTrioIndex) GetMiddleEdgeTrio(ud1 UnitDirection, ud2 UnitDirection) TrioIndex

func (CubeOfTrioIndex) String

func (cube CubeOfTrioIndex) String() string

type DInt

type DInt int64

func AbsDInt

func AbsDInt(i DInt) DInt

func AbsDIntFromC

func AbsDIntFromC(i CInt) DInt

func DS

func DS(p1, p2 Point) DInt

type GrowthContext

type GrowthContext interface {
	fmt.Stringer
	GetEnv() *m3db.QsmEnvironment
	GetId() int
	GetGrowthType() GrowthType
	GetGrowthIndex() int
	GetBaseDivByThree(mainPoint Point) uint64
	GetBaseTrioIndex(divByThree uint64, offset int) TrioIndex
}

type GrowthType

type GrowthType uint8

Define how outgrowth and path evolve from the center. There are 6 types of growth depending of the value of growthType: TODO: Create trio index for non nextMainPoint points base on growth type 1. type = 0 : Type not yet existing TODO: Main points will not be covered. In here trio index switch from trio to next that has neg conn 2. type = 1 : All nextMainPoint points have the same base trio index 3. type = 3 : Rotate between valid trios depending on starting index in modulo 3 4. type = 2 : Use the modulo 2 permutation => Specific index valid next trio back and forth 5. type = 4 : Use the modulo 4 permutation => Specific index line in AllMod4Permutations cycling through the 4 values 6. type = 8 : Use the modulo 8 permutation => Specific index line in AllMod8Permutations cycling through the 8 values

func GetAllContextTypes

func GetAllContextTypes() [5]GrowthType

func (GrowthType) GetMaxOffset

func (t GrowthType) GetMaxOffset() int

func (GrowthType) GetModulo

func (t GrowthType) GetModulo() int

func (GrowthType) GetNbIndexes

func (t GrowthType) GetNbIndexes() int

func (GrowthType) IsPermutation

func (t GrowthType) IsPermutation() bool

func (GrowthType) String

func (t GrowthType) String() string

type Int2

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

type IntermediatePathNodeBuilder

type IntermediatePathNodeBuilder struct {
	BasePathNodeBuilder
	// contains filtered or unexported fields
}

func (*IntermediatePathNodeBuilder) GetNextPathNodeBuilder

func (ipnb *IntermediatePathNodeBuilder) GetNextPathNodeBuilder(from Point, connId ConnectionId, offset int) (PathNodeBuilder, Point)

func (*IntermediatePathNodeBuilder) String

func (ipnb *IntermediatePathNodeBuilder) String() string

type LastIntermediatePathNodeBuilder

type LastIntermediatePathNodeBuilder struct {
	BasePathNodeBuilder
	// contains filtered or unexported fields
}

func (*LastIntermediatePathNodeBuilder) GetNextPathNodeBuilder

func (lipnb *LastIntermediatePathNodeBuilder) GetNextPathNodeBuilder(from Point, connId ConnectionId, offset int) (PathNodeBuilder, Point)

func (*LastIntermediatePathNodeBuilder) String

func (lipnb *LastIntermediatePathNodeBuilder) String() string

type NextMainPathNode

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

type PathBuilderContext

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

The ctx for each main point start point that gives in the global map the root path node builder

func (*PathBuilderContext) String

func (ctx *PathBuilderContext) String() string

type PathLinkBuilder

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

type PathNodeBuilder

type PathNodeBuilder interface {
	fmt.Stringer
	GetEnv() *m3db.QsmEnvironment
	GetCubeId() int
	GetTrioIndex() TrioIndex
	GetNextPathNodeBuilder(from Point, connId ConnectionId, offset int) (PathNodeBuilder, Point)
	// contains filtered or unexported methods
}

type Point

type Point [3]CInt

func CreateRandomPoint

func CreateRandomPoint(max CInt) Point

func GetNonBaseConnections

func GetNonBaseConnections(tA, tB trio) [6]Point

Return the 6 connections possible +X, -X, +Y, -Y, +Z, -Z vectors between 2 trio

func MakeVector

func MakeVector(p1, p2 Point) Point

func (Point) Add

func (p Point) Add(p2 Point) Point

func (Point) DistanceSquared

func (p Point) DistanceSquared() DInt

func (Point) GetNearMainPoint

func (p Point) GetNearMainPoint() Point

func (Point) Hash

func (p Point) Hash(size int) int

func (Point) IsBaseConnectingVector

func (p Point) IsBaseConnectingVector() bool

func (Point) IsConnectionVector

func (p Point) IsConnectionVector() bool

func (Point) IsMainPoint

func (p Point) IsMainPoint() bool

func (Point) IsOnlyOneAndZero

func (p Point) IsOnlyOneAndZero() bool

func (Point) IsOnlyTwoOneAndZero

func (p Point) IsOnlyTwoOneAndZero() bool

func (Point) Mul

func (p Point) Mul(m CInt) Point

func (Point) Neg

func (p Point) Neg() Point

func (Point) RotNegX

func (p Point) RotNegX() Point

Negative PI/2 rotation on X

func (Point) RotNegY

func (p Point) RotNegY() Point

Negative PI/2 rotation on Y

func (Point) RotNegZ

func (p Point) RotNegZ() Point

Negative PI/2 rotation on X

func (Point) RotPlusX

func (p Point) RotPlusX() Point

Positive PI/2 rotation on X

func (Point) RotPlusY

func (p Point) RotPlusY() Point

Positive PI/2 rotation on Y

func (Point) RotPlusZ

func (p Point) RotPlusZ() Point

Positive PI/2 rotation on Z

func (Point) String

func (p Point) String() string

func (Point) Sub

func (p Point) Sub(p2 Point) Point

func (Point) SumOfPositiveCoord

func (p Point) SumOfPositiveCoord() DInt

func (Point) X

func (p Point) X() CInt

func (Point) Y

func (p Point) Y() CInt

func (Point) Z

func (p Point) Z() CInt

type PointMap

type PointMap interface {
	Size() int
	Get(p *Point) (interface{}, bool)
	Put(p *Point, val interface{}) (interface{}, bool)
	LoadOrStore(p *Point, val interface{}) (interface{}, bool)
	GetMaxConflictsAllowed() int
	GetCurrentMaxConflicts() int
	SetMaxConflictsAllowed(max int)
	Clear()
	Range(f func(point Point, value interface{}) bool, nbProc int)
}

func MakePointHashMap

func MakePointHashMap(mapSize int, segments int) PointMap

type PointPackData

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

func GetPointPackData

func GetPointPackData(env *m3db.QsmEnvironment) *PointPackData

func (*PointPackData) GetAllGrowthContexts

func (ppd *PointPackData) GetAllGrowthContexts() []GrowthContext

func (*PointPackData) GetConnDetailsById

func (ppd *PointPackData) GetConnDetailsById(id ConnectionId) *ConnectionDetails

func (*PointPackData) GetConnDetailsByPoints

func (ppd *PointPackData) GetConnDetailsByPoints(p1, p2 Point) *ConnectionDetails

func (*PointPackData) GetCubeById

func (ppd *PointPackData) GetCubeById(cubeId int) CubeKeyId

func (*PointPackData) GetCubeIdByKey

func (ppd *PointPackData) GetCubeIdByKey(cubeKey CubeKeyId) int

func (*PointPackData) GetGrowthContextById

func (ppd *PointPackData) GetGrowthContextById(id int) GrowthContext

func (*PointPackData) GetGrowthContextByTypeAndIndex

func (ppd *PointPackData) GetGrowthContextByTypeAndIndex(growthType GrowthType, index int) GrowthContext

func (*PointPackData) GetId

func (ppd *PointPackData) GetId() m3db.QsmEnvID

func (*PointPackData) GetMaxConnId

func (ppd *PointPackData) GetMaxConnId() ConnectionId

func (*PointPackData) GetPathNodeBuilder

func (ppd *PointPackData) GetPathNodeBuilder(growthCtx GrowthContext, offset int, c Point) PathNodeBuilder

func (*PointPackData) GetPathNodeBuilderById

func (ppd *PointPackData) GetPathNodeBuilderById(cubeId int) PathNodeBuilder

func (*PointPackData) GetTrioDetails

func (ppd *PointPackData) GetTrioDetails(trIdx TrioIndex) *TrioDetails

func (*PointPackData) GetTrioTableCsv

func (ppd *PointPackData) GetTrioTableCsv() [][]string

func (*PointPackData) GetTrioTransitionTableTxt

func (ppd *PointPackData) GetTrioTransitionTableTxt() map[Int2][7]string

type RootPathNodeBuilder

type RootPathNodeBuilder struct {
	BasePathNodeBuilder
	// contains filtered or unexported fields
}

func (*RootPathNodeBuilder) GetNextPathNodeBuilder

func (rpnb *RootPathNodeBuilder) GetNextPathNodeBuilder(from Point, connId ConnectionId, offset int) (PathNodeBuilder, Point)

func (*RootPathNodeBuilder) String

func (rpnb *RootPathNodeBuilder) String() string

type TrioDetailList

type TrioDetailList []*TrioDetails

Defining a list type to manage uniqueness and ordering

func (*TrioDetailList) ExistsById

func (l *TrioDetailList) ExistsById(tr *TrioDetails) bool

func (*TrioDetailList) ExistsByTrio

func (l *TrioDetailList) ExistsByTrio(tr *TrioDetails) bool

func (*TrioDetailList) IdList

func (l *TrioDetailList) IdList() []TrioIndex

func (TrioDetailList) Len

func (l TrioDetailList) Len() int

func (TrioDetailList) Less

func (l TrioDetailList) Less(i, j int) bool

func (TrioDetailList) Swap

func (l TrioDetailList) Swap(i, j int)

type TrioDetails

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

A bigger struct than trio to keep more info on how points grow from a trio index

func (*TrioDetails) GetConnectionIdx

func (td *TrioDetails) GetConnectionIdx(connId ConnectionId) int

func (*TrioDetails) GetConnections

func (td *TrioDetails) GetConnections() [3]*ConnectionDetails

func (*TrioDetails) GetDSIndex

func (td *TrioDetails) GetDSIndex() int

func (*TrioDetails) GetId

func (td *TrioDetails) GetId() TrioIndex

func (*TrioDetails) HasConnection

func (td *TrioDetails) HasConnection(connId ConnectionId) bool

func (*TrioDetails) HasConnections

func (td *TrioDetails) HasConnections(cIds ...ConnectionId) bool

func (*TrioDetails) IsBaseTrio

func (td *TrioDetails) IsBaseTrio() bool

func (*TrioDetails) LastOtherConnection

func (td *TrioDetails) LastOtherConnection(cIds ...ConnectionId) *ConnectionDetails

func (*TrioDetails) OtherConnectionsFrom

func (td *TrioDetails) OtherConnectionsFrom(connId ConnectionId) [2]*ConnectionDetails

The passed connId is where come from so is neg in here

func (*TrioDetails) String

func (td *TrioDetails) String() string

type TrioIndex

type TrioIndex uint8

The unique well defined number of a Trio used on a connected point which we call later a Node

func (TrioIndex) IsBaseTrio

func (trIdx TrioIndex) IsBaseTrio() bool

func (TrioIndex) String

func (trIdx TrioIndex) String() string

type TrioIndexPermBuilder

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

type UnitDirection

type UnitDirection int
const (
	PlusX UnitDirection = iota
	MinusX
	PlusY
	MinusY
	PlusZ
	MinusZ
)

func (UnitDirection) GetFirstPoint

func (ud UnitDirection) GetFirstPoint() Point

func (UnitDirection) GetOpposite

func (ud UnitDirection) GetOpposite() UnitDirection

Jump to

Keyboard shortcuts

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