Skip to content

CHeartFormat

Eric Kerfoot edited this page Oct 19, 2016 · 3 revisions

CHeart File Format

This is a brief overview on the CHeart file format used to load most mesh data into Eidolon. There's typically three different file types: .X for nodes, .T for topology, and .D or .X for fields. All files essentially represent matrices of numbers and are generally read into *Matrix data structures internally. Each row of values is separated by a new line, and each value in a row is separated by one or more spaces. Parsers should be generally forgiving of multiple spaces, empty lines, etc. No other syntax is used and there's no comment character.

.X Files

These files store nodes only. They begin with a header of two numbers: how many nodes there are and their dimension (which is usually 3). An example defining the points of the unit cube:

8 3
0.0 0.0 0.0
1.0 0.0 0.0
0.0 1.0 0.0
1.0 1.0 0.0
0.0 0.0 1.0
1.0 0.0 1.0
0.0 1.0 1.0
1.0 1.0 1.0

.T Files

These store indices for each element defining a mesh. The header states the number of nodes used and the number of elements. The indices must always be integer values and are 1-based (though they become 0-based internally in Eidolon). The topology file defining the unit cube using the above nodes will have only one row of values representing a single hexahedron:

8 1
1 2 3 4 5 6 7 8

A simple format like this raises the problem of specifying the type of elements used. In the above example T file the single element has 8 components, and any other elements in this file would have to have 8 as well. This is meant to be a linear hexahedron element using the nodal lagrange basis function, but nothing in the file specifies this. Consequently it is up to the user to specify the element type when a mesh is loaded, although Eidolon will attempt to guess when using the graphical user interface.

.D/.X Files

These store a sequence of float values for each node in an associated node file. The header states the number of values and the dimension of each value (ie. how many numbers per node). A data set providing a single dimension field for the above unit cube would be something like this:

8 1
1.0
3.0
0.0
3.2
1.23
2.0
2e-3
42.0

Grammar

The grammar definition for X/D and T files is quite simple, given by the following defined symbols X and T respectively:

INT ::= 0|[1-9][0-9]*
FLOAT ::= [+-]?([1-9][0-9]*('.'[0-9]*)?|'0'?'.'[0-9]+) ([eE][+-]?[0-9]+)?
X ::= INT+ '\n' (FLOAT+ '\n')+
T ::= INT+ '\n' (INT+ '\n')+
Clone this wiki locally