lanl / LaGriT

Los Alamos Grid Toolbox (LaGriT) is a library of user callable tools that provide mesh generation, mesh optimization and dynamic mesh maintenance in two and three dimensions.
https://lanl.github.io/LaGriT/
Other
116 stars 48 forks source link

GOCAD TSurf .ts surface has 0 index in connectivity #271

Closed millerta closed 1 day ago

millerta commented 4 days ago

This does not happen all the time, the file is read but when AVS is written there is 0 indexing.

/project/meshing/CO2_IBDP/grid_gen/horizon_surfaces

% head -50 input.ts
GOCAD TSurf 1
HEADER {
name:Argenta
*border:on
*border*bstone:on
}
GOCAD_ORIGINAL_COORDINATE_SYSTEM
NAME Default
AXIS_NAME "X" "Y" "Z"
AXIS_UNIT "m" "m" "m"
ZPOSITIVE Elevation
END_ORIGINAL_COORDINATE_SYSTEM
TFACE
VRTX 0 104519.197004474 357059.760011219 -1909.20262410391
VRTX 1 104508.957594779 357061.706623896 -1908.72380908372

% grep VRTX input.ts | wc
  15290   76450  947084
% grep TRGL input.ts | wc
  29073  116292  597394

% lagrit
read gocad input.ts motri
Reading GOCAD file: input.ts
...................................................
SET VRTX properties:
There are no VRTX properties.
READ VRTX data with word count:     5
READ VRTX property with index:      0
...................................................
SET CELL properties:
There are no Cell properties.
READ CELL data with word count:     4
READ CELL property with index:      0
geniee
finish
--- READ GOCAD FINISHED --------
 Mesh Type:    TSurf
 ZPOSITIVE:    Elev Up
 Nodes:            15290
 Triangles:        29073
 Cells:            29073
 LINES read:              44377

cmo/status/brief

The current-mesh-object(CMO) is: motri

  1 Mesh Object name: motri
    number of nodes =         15290        number of elements =        29073
    dimensions geometry =         3        element type =                tri
    dimensions topology =         2        3 nodes      3 faces      3 edges
    boundary flag =        16000000        status =                   active

 Enter a command
dump avs output.inp

 Enter a command
resetpts itp
geniee
finish
 MMVERIFY: Array prolog overwritten
   Array itp1                             in motri
   Length=                15290 , Address=       93945774266688
--------
MEMORY SIZES :
 Sizeof char    (type 3) =  1 bytes      Sizeof long        =   8 bytes
 Sizeof real*8  (type 2) =  8 bytes      Sizeof pointer     =   8 bytes
 Sizeof integer (type 1) =  4 bytes      Sizeof INT_PTRSIZE =   8 bytes

% awk '{ if ($4 == 0 || $5 == 0 || $6 == 0) { print $0; }}' tri.txt
007075        1   tri  4490     8     0
007325        1   tri  4425     0     1
007472        1   tri  4425  4490     0
millerta commented 3 days ago

Here is a small petrel style format that produces the error in lagrit.

GOCAD TSurf 1
HEADER {
name:Argenta
*border:on
*border*bstone:on
}
GOCAD_ORIGINAL_COORDINATE_SYSTEM
NAME Default
AXIS_NAME "X" "Y" "Z"
AXIS_UNIT "m" "m" "m"
ZPOSITIVE Elevation
END_ORIGINAL_COORDINATE_SYSTEM
TFACE
VRTX 0 465534.6194 5931401.282 -129.3047898
VRTX 1 465538.213  5931392.781 -129.3047898
VRTX 2 465539.8068 5931392.781 -131.7332567
VRTX 3 465570.9632 5931423.783 -198.6034981
VRTX 4 465525.1194 5931423.783 -129.3047898
VRTX 5 465570.9632 5931423.783 -198.6034981
TRGL 0 1 2
TRGL 2 3 0
TRGL 4 0 5
END
millerta commented 1 day ago

fixed by checking for 0 based VRTX numbering and adding 1 to their ID numbers