w-mesh-gms
v1.0.7
Published
A tool for GMS data.
Downloads
79
Readme
w-mesh-gms
A tool for GMS data.
Documentation
To view documentation or get support, visit docs.
Installation
Using npm(ES6 module):
Note: w-mesh-gms is mainly dependent on
lodash-es
andwsemi
.
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]
尚待開發