1.0.4 • Published 1 month ago

w-mesh-gms v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

w-mesh-gms

A tool for GMS data.

language npm version license gzip file size npm download npm download jsdelivr download

Documentation

To view documentation or get support, visit docs.

Installation

Using npm(ES6 module):

Note: w-mesh-gms is mainly dependent on lodash-es and wsemi.

npm i w-mesh-gms

Example for read:

Link: [dev source code]

import fs from 'fs'
import _ from 'lodash-es'
import wmg from './src/WMeshGms.mjs'

function ttc(name, nodes, eles) {

//head
let head = `TITLE = "Mesh" VARIABLES = "X", "Y", "Z", "M"`

//c
let c = head + '\n'

//h
let h = `ZONE T="${name}",N=${_.size(nodes)}, E=${_.size(eles)}, F=fepoint, ET=brick`
c += h + '\n'

_.each(nodes, (node) => {
    let vs = [
        node.x,
        node.y,
        node.z,
        node.mat,
        // v1,
        // v2,
        // v3,
    ]
    let t = _.join(vs, ' ')
    c += t + '\n'
})

_.each(eles, (ele) => {
    let vs = ele.nodes
    let t = _.join(vs, ' ')
    c += t + '\n'
})

return c

}

let fpXyz = './_mesh/YiLan_xyz.txt' let fpTop = './_mesh/YiLan_top.txt' let fpBot = './_mesh/YiLan_bot.txt' let fpMat = './_mesh/YiLan_mat.txt' let fpOut = './_mesh/cv2tecplot.dat' let name = 'cv2tecplot'

console.log('reading...') wmg.readGms(fpXyz, fpTop, fpBot, fpMat) .then((r) => {

    console.log('converting...')
    let tc = ttc(name, r.nodes, r.eles)

    console.log('writing...')
    fs.writeFileSync(fpOut, tc, 'utf8')

    console.log('finish.')
})
.catch((err) => {
    console.log(err)
})
#### Example for write:
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-mesh-gms/blob/master/g-write.mjs)]
```alias
尚待開發
1.0.4

1 month ago

1.0.3

2 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago