gmsh

package
v0.0.0-...-8150578 Latest Latest
Warning

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

Go to latest
Published: May 14, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Example
package main

import (
	"fmt"
	"os"

	"github.com/Konstantin8105/Shell_generator/gmsh"
)

func main() {
	filename := "testModel.geo"

	var gh gmsh.Format
	gh.Points = append(gh.Points, gmsh.Point{
		Index:     1,
		X:         0.,
		Y:         0.,
		Z:         0.,
		Precision: 0.1,
	})
	gh.Points = append(gh.Points, gmsh.Point{
		Index:     2,
		X:         1.,
		Y:         0.,
		Z:         0.,
		Precision: 0.1,
	})
	gh.Points = append(gh.Points, gmsh.Point{
		Index:     3,
		X:         0.,
		Y:         1.,
		Z:         0.,
		Precision: 0.5,
	})
	gh.Points = append(gh.Points, gmsh.Point{
		Index:     4,
		X:         1.,
		Y:         -1.,
		Z:         0.,
		Precision: 0.3,
	})

	gh.Lines = append(gh.Lines, gmsh.Line{
		Index:           5,
		BeginPointIndex: 2,
		EndPointIndex:   4,
	})

	gh.Arcs = append(gh.Arcs, gmsh.Arc{
		Index:            6,
		BeginPointIndex:  2,
		CenterPointIndex: 1,
		EndPointIndex:    3,
	})

	gh.Extrudes = append(gh.Extrudes, gmsh.Extrude{
		Xextrude:     0,
		Yextrude:     0,
		Zextrude:     3,
		IndexElement: 5,
	})
	gh.Extrudes = append(gh.Extrudes, gmsh.Extrude{
		Xextrude:     0,
		Yextrude:     0,
		Zextrude:     3,
		IndexElement: 6,
	})

	err := gh.WriteGEO(filename)
	if err != nil {
		fmt.Println("Error in Gmsh format: ", err)
		return
	}

	_ = os.Remove(filename)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arc

type Arc struct {
	Index            int
	BeginPointIndex  int
	CenterPointIndex int
	EndPointIndex    int
}

Arc - arc circle in Gmsh format

func (Arc) String

func (a Arc) String() string

type Extrude

type Extrude struct {
	Xextrude     float64
	Yextrude     float64
	Zextrude     float64
	IndexElement int // index of line or circle arc
}

Extrude - extrude element in Gmsh format

func (Extrude) String

func (e Extrude) String() string

type Format

type Format struct {
	Points   []Point
	Lines    []Line
	Arcs     []Arc
	Extrudes []Extrude
}

Format - complete Gmsh format

func (*Format) AddArc

func (f *Format) AddArc(arch Arc)

AddArc - add arc

func (*Format) AddExtrude

func (f *Format) AddExtrude(e Extrude)

AddExtrude - add extrude

func (*Format) AddLine

func (f *Format) AddLine(line Line)

AddLine - add line

func (*Format) AddPoint

func (f *Format) AddPoint(point Point)

AddPoint - add point

func (*Format) ExtrudeAll

func (f *Format) ExtrudeAll(Xextrude float64, Yextrude float64, Zextrude float64)

ExtrudeAll - extrude all line and arc

func (Format) WriteGEO

func (f Format) WriteGEO(filename string) (err error)

WriteGEO - write Gmsh file

func (Format) WriteINP

func (f Format) WriteINP(filename string) (err error)

WriteINP - convertor to mesh format from *.geo GMSH

type Line

type Line struct {
	Index           int
	BeginPointIndex int
	EndPointIndex   int
}

Line - linr in Gmsh format

func (Line) String

func (l Line) String() string

type Point

type Point struct {
	Index     int
	X, Y, Z   float64
	Precision float64
}

Point - point in Gmsh format

func (Point) String

func (p Point) String() string

Jump to

Keyboard shortcuts

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