Welvet examples

55. stub/grafting

Open original example β†—Recorded results Β· not a live execution

Part: VIII Β· Stubs
Package: github.com/openfluke/welvet/stub/grafting
Status: partial β€” 🚧

When

Scaffold / experimental stub stub/grafting (may be partial).

Where

import "github.com/openfluke/welvet/stub/grafting"

cd 55-stub-grafting && source ../env.sh && go run .

Why

Merge grids into Parallel/Residual structures for topology experiments.

What

GraftGrids, ResidualGraft, GraftToGrid β€” Dense branches in v0.

Sample output (captured)

false grafting: no valid branches

Live capture from go run ./cmd/runall on local ../../welvet (exit 0).

Source

Copied from the Welvet feature book examples (openfluke.github.io/welvet/examples/55-stub-grafting).

main.go

Download source ↓
package main

import (
	"fmt"

	"github.com/openfluke/welvet/architecture"
	"github.com/openfluke/welvet/layers/parallel"
	"github.com/openfluke/welvet/stub/grafting"
)

func main() {
	a, b := architecture.NewGrid(1, 1, 1, 1), architecture.NewGrid(1, 1, 1, 1)
	out, err := grafting.GraftGrids([]*architecture.Grid{a, b}, parallel.CombineConcat)
	fmt.Println(out != nil, err)
}