Read and Print Results
This example demonstrates how to read and print various types of finite element analysis results from an SDRC Universal file using the LMan (Library Manager) interface. We’ll explore how to access displacement data, temperature gradients, stress results, and other state data from finite element models.
Overview
The example performs the following main tasks:
- Parse command line arguments and validate license
- Open the file with sparse convention
- Load the finite element model and extract mesh information
- Print displacement or temperature results
- Print temperature gradient results
- Print stress results with coordinate system transformations
- Print comprehensive results data for all states
- Clean up resources
Let’s examine each step in detail.
Step 1: Initialize and Setup
First, we include necessary headers, forward-declare five analysis functions that will be called, and handle command line arguments:
#include <stdlib.h>
#include "sam/base/base.h"
#include "sam/vis/visdata.h"
#include "sam/vdm/vdm.h"
#include "sam/base/license.h"
#include "sam/hoops_license.h"
static void
print_displacement(vdm_LMan* lman, vis_Connect* connect);
static void
print_temperature_gradient(vdm_LMan* lman, vis_Connect* connect);
static void
print_stress(vdm_LMan* lman, vis_Connect* connect);
static void
print_result(vdm_LMan* lman, vis_Connect* connect);
static void
print_section(Vint position, Vint section);
int main(int argc, char** argv)
{
char inputFile[256];
/* check input arguments */
if (argc < 2) {
fprintf(stderr, "Usage: %s inputfile [appendfile]\n", argv[0]);
fprintf(stderr, " inputfile is blank, 'cantilever.unv' is assumed\n");
strcpy(inputFile, "cantilever.unv");
}
else {
strcpy(inputFile, argv[1]);
}
vsy_LicenseValidate(HOOPS_LICENSE);
The program provides access to results data in the “cantilever.unv” file provided along with the SDK.
Step 2: Open File with Options
Next, we create options and a Library Manager, then open the input file:
/* Open file */
vdm_Options* options = vdm_OptionsBegin();
vdm_OptionsAddConvention(options, VDM_CONVENTION_SPARSE);
vdm_LMan* lman = vdm_LManBegin();
vdm_LManOpenFile(lman, inputFile, options);
The VDM_CONVENTION_SPARSE option tells the Library Manager to use sparse format for the results data structures.
Step 3: Error Checking and Model Loading
After opening the file, we check for errors and load the finite element model. The finite element model might be split among several files. Multiple finds may be appended to build the complete model.
/* check for error */
Vint ierr = vdm_LManError(lman);
if (ierr) {
fprintf(stderr, "Error: opening file %s\n", inputFile);
vdm_LManCloseFile(lman);
vdm_LManEnd(lman);
exit(1);
}
/* look for appended file */
for (Vint i = 2; i < argc; i++) {
vdm_LManAppend(lman, argv[i]);
/* check for error */
ierr = vdm_LManError(lman);
if (ierr) {
fprintf(stderr, "Error: appending file %s to file %s\n", argv[i], argv[1]);
exit(1);
}
}
/* instance Model object for finite element model */
vis_Model* model = vis_ModelBegin();
vdm_LManLoadModel(lman, model);
/* get Connect object created in Model */
vis_Connect* connect;
vis_ModelGetObject(model, VIS_CONNECT, (Vobject**)&connect);
Vint nodesCount = 0;
Vint elementsCount = 0;
vis_ConnectNumber(connect, SYS_NODE, &nodesCount);
vis_ConnectNumber(connect, SYS_ELEM, &elementsCount);
printf("number of nodes= %d\n", nodesCount);
printf("number of elems= %d\n", elementsCount);
The vdm_LManLoadModel()
function loads the finite element model, and we query the Connect (Finite Element Mesh) object which contains information about nodes and elements.
Now the analysis functions will be called to print results contained in the file. The following sections highlight how to query different state results. The complete analysis functions can be consulted at the end of this document.
Step 4: Print Displacement Results
The first analysis function searches for and prints displacement or temperature data:
static void
print_displacement(vdm_LMan* lman, vis_Connect* connect)
{
/* allocate array for state indices */
Vint statesCount = vdm_LManGetNumStates(lman);
Vint* stateIds = (Vint*)malloc(statesCount * sizeof(Vint));
/* search for displacement results */
Vint thermalflag = 0;
Vint foundStates = 0;
vdm_LManSearchState(lman, (Vchar*)"D.*N:*", statesCount, stateIds, &foundStates);
/* if no displacement, search for temperature */
if (foundStates == 0) {
thermalflag = 1;
vdm_LManSearchState(lman, (Vchar*)"TEMP.*N:*", statesCount, stateIds, &foundStates);
}
The vdm_LManSearchState()
function uses pattern matching to find states. The pattern “D.*N:” searches for
displacement results at nodes, while “TEMP.*N:” searches for temperature results at nodes.
Step 5: Print Temperature Gradients
Temperature gradient results are accessed using element-based search patterns:
static void
print_temperature_gradient(vdm_LMan* lman, vis_Connect* connect)
{
/* allocate array for state ids */
Vint statesCount = vdm_LManGetNumStates(lman); /* Maximum number of states */
Vint foundStatesCount;
Vint* stateIds = (Vint*)malloc(statesCount * sizeof(Vint));
/* search for temp gradient results states */
vdm_LManSearchState(lman, (Vchar*)"TEMP_GRAD.*E:*", statesCount, stateIds, &foundStatesCount);
The pattern searches for temperature gradient results at elements.
Step 6: Print Stress Results
Stress results can exist either at element (“S.*E:”) or element nodes (“S.*EL:”)
static void
print_stress(vdm_LMan* lman, vis_Connect* connect)
{
/* determine maximum number of states */
Vint stateCount = vdm_LManGetNumStates(lman);
/* allocate array for state ids */
Vint* stateIds = (Vint*)malloc(stateCount * sizeof(Vint));
/* search for stress results */
Vint foundElementNodeStates, foundElementStates;
vdm_LManSearchState(lman, (Vchar*)"S.*EL:*", stateCount, stateIds, &foundElementNodeStates);
vdm_LManSearchState(lman, (Vchar*)"S.*E:*", stateCount, &stateIds[foundElementNodeStates], &foundElementStates);
foundElementStates += foundElementNodeStates;
The function handles coordinate system transformations from local to global and material coordinate systems, and demonstrates how to handle complex data.
Step 7: Coordinate System Transformations
The print_stress function handles coordinate system transformations from local to global and material coordinate systems. If rotation angle information is available in the file, it is accessed to transform the coordinates.
/* print global components if originally local components */
Vint systemType;
vis_StateGetSystem(state, &systemType);
if (systemType == STATE_LOCAL || systemType == STATE_ROTANG) {
vis_State* staterotang = NULL;
if (systemType == STATE_ROTANG) {
staterotang = vis_StateBegin();
Vchar rotangStateName[SYS_MAXNAME];
vis_ResultMetadataGetAttributeValueString(metadata, (Vchar*)"Link.RotAng", rotangStateName);
vdm_LManLoadStateFromName(lman, rotangStateName, staterotang);
vis_StateSetObject(state, VIS_STATE_ROTANG, staterotang);
}
vis_StateTransform(state, STATE_GLOBAL, NULL);
// Print results in global coordinates
}
/* print in material system */
vis_StateTransform(state, STATE_MATERIAL, NULL);
if (!vis_StateError(state)) {
printf("material system\n");
// Print results in material coordinates
}
Step 8: Comprehensive Results Output
The print_result function provides detailed information about all available states:
static void
print_result(vdm_LMan* lman, vis_Connect* connect)
{
/* loop over states */
vsy_List* stateNames;
Vint statesCount = vdm_LManGetNumStates(lman);
vdm_LManGetStateNames(lman, &stateNames);
for (Vint nameIndex = 0; nameIndex < statesCount; nameIndex++) {
// Access metadata and print comprehensive information
}
This function demonstrates how to access metadata attributes like DataType, Contents, and physical dimensions for each state. Sections handling is also demonstrated.
Step 9: Cleanup
Finally, we clean up all allocated resources:
vis_ModelDelete(model);
vis_ModelEnd(model);
vdm_OptionsEnd(options);
vdm_LManCloseFile(lman);
vdm_LManEnd(lman);
return 0;
Proper cleanup includes deleting the model, ending the options, closing the file, and ending the Library Manager.
Expected Output
When you run this example with a finite element results file, you’ll see output similar to:
inputfile is blank, 'cantilever.unv' is assumed
number of nodes= 54
number of elems= 16
State: D.N:1
Displacements
1 -9.230210e-06 1.306880e-05 -2.263050e-06 0.000000e+00 0.000000e+00 0.000000e+00 magnitudes= 1.615895e-05 0.000000e+00
27 1.542860e-03 0.000000e+00 2.042800e-04 0.000000e+00 0.000000e+00 0.000000e+00 magnitudes= 1.556325e-03 0.000000e+00
71 2.422690e-03 0.000000e+00 4.395600e-04 0.000000e+00 0.000000e+00 0.000000e+00 magnitudes= 2.462243e-03 0.000000e+00
Number of attributes: 8
Attribute: Contents
Displacement
Attribute: DataType
SixDof
Attribute: Title
Model Solution
Attribute: Subtitle
eal151
Attribute: Label
NONE
Attribute: Subtitle1
LOAD SET 1
Attribute: Subtitle2
The time of Analysis was 07-FEB-92 09:24:57
Attribute: DataSource
8
State: S.EL:1
Stresses
1, component stresses
-1.35003e+01 -8.38511e+00 1.12018e+03 -7.79565e+00 -2.52455e+00 1.44065e+02
-8.33268e+00 -1.07724e+00 2.55085e+00 -7.83698e+00 2.58379e+00 1.44024e+02
-8.79312e+00 -2.01625e+00 2.20099e+00 7.85502e-01 -1.72745e+00 1.30986e+02
-1.22480e+01 -7.61143e+00 1.12496e+03 8.26834e-01 1.78669e+00 1.30945e+02
1.33218e+01 2.09337e+01 1.12440e+03 3.35758e+00 -1.66821e+00 1.45778e+02
9.86690e+00 2.37418e+00 -1.84306e+00 3.39891e+00 1.72745e+00 1.45736e+02
9.90244e+00 1.60050e+00 -2.02759e+00 -5.22357e+00 -2.58379e+00 1.29274e+02
1.50700e+01 2.18728e+01 1.12936e+03 -5.26490e+00 2.64303e+00 1.29232e+02
8, component stresses
-1.33218e+01 -2.09338e+01 7.55958e+01 -3.35759e+00 -1.66821e+00 1.45778e+02
-9.86689e+00 -2.37417e+00 1.84306e+00 -3.39892e+00 1.72745e+00 1.45736e+02
-9.90243e+00 -1.60049e+00 2.02759e+00 5.22357e+00 -2.58379e+00 1.29274e+02
-1.50700e+01 -2.18728e+01 7.06423e+01 5.26490e+00 2.64303e+00 1.29232e+02
1.35003e+01 8.38512e+00 7.98244e+01 7.79566e+00 -2.52455e+00 1.44065e+02
8.33267e+00 1.07724e+00 -2.55084e+00 7.83699e+00 2.58379e+00 1.44024e+02
8.79308e+00 2.01624e+00 -2.20099e+00 -7.85498e-01 -1.72745e+00 1.30986e+02
1.22480e+01 7.61144e+00 7.50362e+01 -8.26827e-01 1.78670e+00 1.30945e+02
16, component stresses
-3.74542e+01 -4.61229e+01 1.50522e+02 -3.28346e+00 -4.59830e+00 6.63873e+01
-3.38178e+01 -2.54974e+01 7.89113e+01 -3.32260e+00 1.87741e+00 6.63482e+01
-3.46862e+01 -2.55704e+01 7.43942e+01 3.96054e+00 -1.76416e+00 5.86416e+01
-3.83330e+01 -4.62064e+01 1.45974e+02 3.99968e+00 -9.56736e-01 5.86024e+01
3.41201e+01 1.24256e+01 1.54085e+02 5.11281e+00 -4.60354e+00 6.63768e+01
3.04733e+01 1.12017e+01 7.51914e+01 5.15195e+00 1.88264e+00 6.63377e+01
3.00746e+01 1.12852e+01 7.08309e+01 -2.13119e+00 -1.75893e+00 5.86521e+01
3.37109e+01 1.24986e+01 1.49693e+02 -2.17033e+00 -9.61969e-01 5.86129e+01
1, mean stress
3.66098e+02
-2.28636e+00
-2.86946e+00
3.68367e+02
3.86219e+02
3.46601e+00
3.15845e+00
3.88768e+02
8, mean stress
1.37801e+01
-3.46600e+00
-3.15844e+00
1.12332e+01
3.39033e+01
2.28636e+00
2.86944e+00
3.16319e+01
16, mean stress
2.23150e+01
6.53203e+00
4.71253e+00
2.04782e+01
6.68769e+01
3.89555e+01
3.73969e+01
6.53008e+01
material system
1, component stresses
-1.35003e+01 -8.38511e+00 1.12018e+03 -7.79565e+00 -2.52455e+00 1.44065e+02
-8.33268e+00 -1.07724e+00 2.55085e+00 -7.83698e+00 2.58379e+00 1.44024e+02
-8.79312e+00 -2.01625e+00 2.20099e+00 7.85502e-01 -1.72745e+00 1.30986e+02
-1.22480e+01 -7.61143e+00 1.12496e+03 8.26834e-01 1.78669e+00 1.30945e+02
1.33218e+01 2.09337e+01 1.12440e+03 3.35758e+00 -1.66821e+00 1.45778e+02
9.86690e+00 2.37418e+00 -1.84306e+00 3.39891e+00 1.72745e+00 1.45736e+02
9.90244e+00 1.60050e+00 -2.02759e+00 -5.22357e+00 -2.58379e+00 1.29274e+02
1.50700e+01 2.18728e+01 1.12936e+03 -5.26490e+00 2.64303e+00 1.29232e+02
8, component stresses
-1.33218e+01 -2.09338e+01 7.55958e+01 -3.35759e+00 -1.66821e+00 1.45778e+02
-9.86689e+00 -2.37417e+00 1.84306e+00 -3.39892e+00 1.72745e+00 1.45736e+02
-9.90243e+00 -1.60049e+00 2.02759e+00 5.22357e+00 -2.58379e+00 1.29274e+02
-1.50700e+01 -2.18728e+01 7.06423e+01 5.26490e+00 2.64303e+00 1.29232e+02
1.35003e+01 8.38512e+00 7.98244e+01 7.79566e+00 -2.52455e+00 1.44065e+02
8.33267e+00 1.07724e+00 -2.55084e+00 7.83699e+00 2.58379e+00 1.44024e+02
8.79308e+00 2.01624e+00 -2.20099e+00 -7.85498e-01 -1.72745e+00 1.30986e+02
1.22480e+01 7.61144e+00 7.50362e+01 -8.26827e-01 1.78670e+00 1.30945e+02
16, component stresses
-3.74542e+01 -4.61229e+01 1.50522e+02 -3.28346e+00 -4.59830e+00 6.63873e+01
-3.38178e+01 -2.54974e+01 7.89113e+01 -3.32260e+00 1.87741e+00 6.63482e+01
-3.46862e+01 -2.55704e+01 7.43942e+01 3.96054e+00 -1.76416e+00 5.86416e+01
-3.83330e+01 -4.62064e+01 1.45974e+02 3.99968e+00 -9.56736e-01 5.86024e+01
3.41201e+01 1.24256e+01 1.54085e+02 5.11281e+00 -4.60354e+00 6.63768e+01
3.04733e+01 1.12017e+01 7.51914e+01 5.15195e+00 1.88264e+00 6.63377e+01
3.00746e+01 1.12852e+01 7.08309e+01 -2.13119e+00 -1.75893e+00 5.86521e+01
3.37109e+01 1.24986e+01 1.49693e+02 -2.17033e+00 -9.61969e-01 5.86129e+01
Number of attributes: 9
Attribute: Contents
Stress
Attribute: DataType
Tensor
Attribute: Structure
ElementNode
Attribute: Title
Model Solution
Attribute: Subtitle
eal151
Attribute: Label
NONE
Attribute: Subtitle1
LOAD SET 1
Attribute: Subtitle2
The time of Analysis was 07-FEB-92 09:24:59
Attribute: DataSource
2
State: D.N:1
DataType: SixDof
Contents: Displacement
Dimensions: L,Rad
system= Global
node= 1
-9.230210e-06 1.306880e-05 -2.263050e-06 0.000000e+00 0.000000e+00 0.000000e+00
Number of attributes: 8
Attribute: Contents
Displacement
Attribute: DataType
SixDof
Attribute: Title
Model Solution
Attribute: Subtitle
eal151
Attribute: Label
NONE
Attribute: Subtitle1
LOAD SET 1
Attribute: Subtitle2
The time of Analysis was 07-FEB-92 09:24:57
Attribute: DataSource
8
State: R.N:1
DataType: SixDof
Contents: Reaction Force
Dimensions: ML/T2,ML2/T2
system= Global
node= 1
no data
Number of attributes: 8
Attribute: Contents
Reaction Force
Attribute: DataType
SixDof
Attribute: Title
Model Solution
Attribute: Subtitle
eal151
Attribute: Label
NONE
Attribute: Subtitle1
LOAD SET 1
Attribute: Subtitle2
The time of Analysis was 07-FEB-92 09:24:58
Attribute: DataSource
9
State: S.EL:1
DataType: Tensor
Contents: Stress
Dimensions: M/LT2
system= Global
elem= 1
node= 1
-1.350030e+01 -8.385110e+00 1.120180e+03 -7.795650e+00 -2.524550e+00 1.440650e+02
node= 2
-8.332680e+00 -1.077240e+00 2.550850e+00 -7.836980e+00 2.583790e+00 1.440240e+02
node= 4
-8.793120e+00 -2.016250e+00 2.200990e+00 7.855020e-01 -1.727450e+00 1.309860e+02
node= 3
-1.224800e+01 -7.611430e+00 1.124960e+03 8.268340e-01 1.786690e+00 1.309450e+02
node= 5
1.332180e+01 2.093370e+01 1.124400e+03 3.357580e+00 -1.668210e+00 1.457780e+02
node= 6
9.866900e+00 2.374180e+00 -1.843060e+00 3.398910e+00 1.727450e+00 1.457360e+02
node= 8
9.902440e+00 1.600500e+00 -2.027590e+00 -5.223570e+00 -2.583790e+00 1.292740e+02
node= 7
1.507000e+01 2.187280e+01 1.129360e+03 -5.264900e+00 2.643030e+00 1.292320e+02
Number of attributes: 9
Attribute: Contents
Stress
Attribute: DataType
Tensor
Attribute: Structure
ElementNode
Attribute: Title
Model Solution
Attribute: Subtitle
eal151
Attribute: Label
NONE
Attribute: Subtitle1
LOAD SET 1
Attribute: Subtitle2
The time of Analysis was 07-FEB-92 09:24:59
Attribute: DataSource
2
Complete Source Code
The complete source code for this example can be found at: src/sam/vdm/exam/exam3.cpp
You can also view the full source here:
1#include <stdlib.h>
2#include "sam/base/base.h"
3#include "sam/vis/visdata.h"
4#include "sam/vdm/vdm.h"
5#include "sam/base/license.h"
6#include "sam/hoops_license.h"
7
8static void
9print_displacement(vdm_LMan* lman, vis_Connect* connect);
10static void
11print_temperature_gradient(vdm_LMan* lman, vis_Connect* connect);
12static void
13print_stress(vdm_LMan* lman, vis_Connect* connect);
14static void
15print_result(vdm_LMan* lman, vis_Connect* connect);
16static void
17print_section(Vint position, Vint section);
18
19/*----------------------------------------------------------------------
20 Read and Print Results State Data
21----------------------------------------------------------------------*/
22int
23main(int argc, char** argv)
24{
25 char inputFile[256];
26 /* check input arguments */
27 if (argc < 2) {
28 fprintf(stderr, "Usage: %s inputfile [appendfile]\n", argv[0]);
29 fprintf(stderr, " inputfile is blank, 'cantilever.unv' is assumed\n");
30 strcpy(inputFile, "cantilever.unv");
31 }
32 else {
33 strcpy(inputFile, argv[1]);
34 }
35
36 vsy_LicenseValidate(HOOPS_LICENSE);
37
38 /* Open file */
39 vdm_Options* options = vdm_OptionsBegin();
40 vdm_OptionsAddConvention(options, VDM_CONVENTION_SPARSE);
41 vdm_LMan* lman = vdm_LManBegin();
42 vdm_LManOpenFile(lman, inputFile, options);
43
44 /* check for error */
45 Vint ierr = vdm_LManError(lman);
46 if (ierr) {
47 fprintf(stderr, "Error: opening file %s\n", inputFile);
48 vdm_LManCloseFile(lman);
49 vdm_LManEnd(lman);
50 exit(1);
51 }
52 /* look for appended file */
53 for (Vint i = 2; i < argc; i++) {
54 vdm_LManAppend(lman, argv[i]);
55 /* check for error */
56 ierr = vdm_LManError(lman);
57 if (ierr) {
58 fprintf(stderr, "Error: appending file %s to file %s\n", argv[i], argv[1]);
59 exit(1);
60 }
61 }
62 /* instance Model object for finite element model */
63 vis_Model* model = vis_ModelBegin();
64 vdm_LManLoadModel(lman, model);
65
66 /* get Connect object created in Model */
67 vis_Connect* connect;
68 vis_ModelGetObject(model, VIS_CONNECT, (Vobject**)&connect);
69 Vint nodesCount = 0;
70 Vint elementsCount = 0;
71 vis_ConnectNumber(connect, SYS_NODE, &nodesCount);
72 vis_ConnectNumber(connect, SYS_ELEM, &elementsCount);
73 printf("number of nodes= %d\n", nodesCount);
74 printf("number of elems= %d\n", elementsCount);
75
76 /* access and print displacments */
77 print_displacement(lman, connect);
78 /* access and print temperature gradients */
79 print_temperature_gradient(lman, connect);
80
81 /* access and print stresses */
82 print_stress(lman, connect);
83 /* access and print all results */
84 print_result(lman, connect);
85
86 vis_ModelDelete(model);
87 vis_ModelEnd(model);
88
89 vdm_OptionsEnd(options);
90 vdm_LManCloseFile(lman);
91 vdm_LManEnd(lman);
92 return 0;
93}
94
95/*----------------------------------------------------------------------
96 print displacments
97----------------------------------------------------------------------*/
98static void
99print_displacement(vdm_LMan* lman, vis_Connect* connect)
100{
101 /* allocate array for state indices */
102 Vint statesCount = vdm_LManGetNumStates(lman); /* Maximum number of states */
103 Vint* stateIds = (Vint*)malloc(statesCount * sizeof(Vint));
104
105 /* search for displacement results */
106 Vint thermalflag = 0;
107 Vint foundStates = 0;
108 vdm_LManSearchState(lman, (Vchar*)"D.*N:*", statesCount, stateIds, &foundStates);
109 /* if no displacement, search for temperature */
110 if (foundStates == 0) {
111 thermalflag = 1;
112 vdm_LManSearchState(lman, (Vchar*)"TEMP.*N:*", statesCount, stateIds, &foundStates);
113 }
114
115 if (foundStates == 0) {
116 free(stateIds);
117 return;
118 }
119 Vint nodesCount = 0;
120 vis_ConnectNumber(connect, SYS_NODE, &nodesCount);
121
122 /* print first, middle and last node */
123 Vint requestedNodesCount = 3;
124 Vint requestedNodeIds[3] = {1, nodesCount / 2, nodesCount};
125
126 /* create state */
127 vis_State* state = vis_StateBegin();
128 Vchar stateName[SYS_MAXNAME];
129 /* loop over displacement states */
130 for (Vint i = 0; i < foundStates; i++) {
131 vis_ResultMetadata* metadata = vis_ResultMetadataBegin();
132 vdm_LManGetMetadata(lman, stateIds[i], metadata);
133 Vlong length;
134 Vint rowsCount, columnsCount, type;
135 vis_ResultMetadataInq(metadata, stateName, &length, &rowsCount, &columnsCount, &type);
136 /* print header */
137 printf("\n\nState: %s\n", stateName);
138 if (thermalflag == 0) {
139 printf("\nDisplacements\n");
140 }
141 else {
142 printf("\nTemperatures\n");
143 }
144
145 /* load state */
146 vdm_LManLoadStateFromName(lman, stateName, state);
147 Vint nument, enttype, subtype, datatype;
148 vis_StateInq(state, &nument, &enttype, &subtype, &datatype);
149
150 /* loop over requested nodes */
151 Vfloat values[6];
152 for (Vint n = 0; n < requestedNodesCount; n++) {
153 if (requestedNodeIds[n] == 0)
154 continue;
155 Vint nodeNumber;
156 vis_ConnectNodeAssoc(connect, VIS_USERID, 1, &requestedNodeIds[n], &nodeNumber);
157 printf("%8d", nodeNumber);
158 vis_StateSetDerive(state, datatype);
159
160 Vfloat magnitude;
161 if (datatype == VIS_SCALAR) {
162 vis_StateData(state, 1, &requestedNodeIds[n], values);
163 printf("%14e\n", values[0]);
164 /* vector type */
165 }
166 else if (datatype == VIS_VECTOR) {
167 /* print components */
168 vis_StateData(state, 1, &requestedNodeIds[n], values);
169 printf("%14e %14e %14e", values[0], values[1], values[2]);
170 /* print magnitude */
171 vis_StateSetDerive(state, VIS_VECTOR_MAG);
172 vis_StateData(state, 1, &requestedNodeIds[n], &magnitude);
173 printf(" magnitude= %14e\n", magnitude);
174 /* six dof vector type */
175 }
176 else if (datatype == VIS_SIXDOF) {
177 /* print components */
178 vis_StateData(state, 1, &requestedNodeIds[n], values);
179 printf("%14e %14e %14e %14e %14e %14e", values[0], values[1], values[2], values[3], values[4], values[5]);
180 /* print magnitudes */
181 vis_StateSetDerive(state, VIS_SIXDOF_TMAG);
182 vis_StateData(state, 1, &requestedNodeIds[n], &magnitude);
183 Vfloat rotationMagnitude;
184 vis_StateSetDerive(state, VIS_SIXDOF_RMAG);
185 vis_StateData(state, 1, &requestedNodeIds[n], &rotationMagnitude);
186 printf(" magnitudes= %14e %14e\n", magnitude, rotationMagnitude);
187 }
188 }
189 printf("\n");
190
191 /* print global components if originally local components */
192 Vint systemType;
193 vis_StateGetSystem(state, &systemType);
194 if (systemType == STATE_LOCAL) {
195 vis_StateTransform(state, STATE_GLOBAL, NULL);
196 /* loop over requested nodes */
197 vis_StateSetDerive(state, datatype);
198 printf("global system\n");
199 for (Vint n = 0; n < requestedNodesCount; n++) {
200 if (requestedNodeIds[n] == 0)
201 continue;
202 Vint nodenumber;
203 vis_ConnectNodeAssoc(connect, VIS_USERID, 1, &requestedNodeIds[n], &nodenumber);
204 printf("%8d", nodenumber);
205 /* vector type */
206 if (datatype == VIS_VECTOR) {
207 vis_StateData(state, 1, &requestedNodeIds[n], values);
208 printf("%14e %14e %14e\n", values[0], values[1], values[2]);
209 /* six dof vector type */
210 }
211 else if (datatype == VIS_SIXDOF) {
212 vis_StateData(state, 1, &requestedNodeIds[n], values);
213 printf("%14e %14e %14e %14e %14e %14e\n", values[0], values[1], values[2], values[3], values[4], values[5]);
214 }
215 }
216 printf("\n");
217 }
218 /* print attributes */
219 vis_ResultMetadataPrintAttributes(metadata);
220 vis_ResultMetadataEnd(metadata);
221 }
222
223 /* free memory */
224 vis_StateEnd(state);
225 free(stateIds);
226}
227
228/*----------------------------------------------------------------------
229 print temperature gradients
230----------------------------------------------------------------------*/
231static void
232print_temperature_gradient(vdm_LMan* lman, vis_Connect* connect)
233{
234 /* allocate array for state ids */
235 Vint statesCount = vdm_LManGetNumStates(lman); /* Maximum number of states */
236 Vint foundStatesCount;
237 Vint* stateIds = (Vint*)malloc(statesCount * sizeof(Vint));
238 /* search for temp gradient results states */
239 vdm_LManSearchState(lman, (Vchar*)"TEMP_GRAD.*E:*", statesCount, stateIds, &foundStatesCount);
240
241 if (foundStatesCount == 0) {
242 free(stateIds);
243 return;
244 }
245
246 Vint elementsCount;
247 vis_ConnectNumber(connect, SYS_ELEM, &elementsCount);
248
249 /* create state */
250 vis_State* state = vis_StateBegin();
251
252 /* print first, middle and last element */
253 Vint requestedElementsCount;
254 requestedElementsCount = 3;
255 Vint ids[3] = {1, elementsCount / 2, elementsCount};
256
257 /* loop over states */
258 for (Vint i = 0; i < foundStatesCount; i++) {
259 vis_ResultMetadata* metadata = vis_ResultMetadataBegin();
260 vdm_LManGetMetadata(lman, stateIds[i], metadata);
261 Vchar stateName[SYS_MAXNAME];
262 Vlong length;
263 Vint rowsCount, columnsCount, type;
264 vis_ResultMetadataInq(metadata, stateName, &length, &rowsCount, &columnsCount, &type);
265 vis_ResultMetadataEnd(metadata);
266
267 /* print header */
268 printf("\n\nState: %s\n", stateName);
269 printf("\nTemperature Gradients\n");
270
271 /* load state */
272 vdm_LManLoadStateFromName(lman, stateName, state);
273
274 /* loop over requested elements */
275 Vfloat values[3];
276 for (Vint n = 0; n < requestedElementsCount; n++) {
277 if (ids[n] == 0)
278 continue;
279 Vint elementNumber;
280 vis_ConnectElemAssoc(connect, VIS_USERID, 1, &ids[n], &elementNumber);
281 printf("%8d %8d", ids[n], elementNumber);
282 vis_StateSetDerive(state, VIS_VECTOR);
283 /* print components */
284 vis_StateData(state, 1, &ids[n], values);
285 printf("%14e %14e %14e", values[0], values[1], values[2]);
286 /* print magnitude */
287 vis_StateSetDerive(state, VIS_VECTOR_MAG);
288 Vfloat magnitude;
289 vis_StateData(state, 1, &ids[n], &magnitude);
290 printf(" magnitude= %14e\n", magnitude);
291 }
292 printf("\n");
293
294 /* print global components if originally local components */
295 Vint systemType;
296 vis_StateGetSystem(state, &systemType);
297 if (systemType == STATE_LOCAL) {
298 vis_StateTransform(state, STATE_GLOBAL, NULL);
299 /* loop over requested elements */
300 vis_StateSetDerive(state, VIS_VECTOR);
301 printf("global system\n");
302 for (Vint n = 0; n < requestedElementsCount; n++) {
303 if (ids[n] == 0)
304 continue;
305 Vint elementNumber;
306 vis_ConnectElemAssoc(connect, VIS_USERID, 1, &ids[n], &elementNumber);
307 printf("%8d %8d", ids[n], elementNumber);
308 vis_StateData(state, 1, &ids[n], values);
309 printf("%14e %14e %14e\n", values[0], values[1], values[2]);
310 }
311 printf("\n");
312 }
313 /* print attributes */
314 vis_ResultMetadataPrintAttributes(metadata);
315 }
316
317 /* free memory */
318 vis_StateEnd(state);
319 free(stateIds);
320}
321
322/*----------------------------------------------------------------------
323 print stresses
324----------------------------------------------------------------------*/
325static void
326print_stress(vdm_LMan* lman, vis_Connect* connect)
327{
328 /* determine maximum number of states */
329 Vint stateCount = vdm_LManGetNumStates(lman);
330
331 /* allocate array for state ids */
332 Vint* stateIds = (Vint*)malloc(stateCount * sizeof(Vint));
333
334 /* search for stress results */
335 Vint foundElementNodeStates, foundElementStates;
336 vdm_LManSearchState(lman, (Vchar*)"S.*EL:*", stateCount, stateIds, &foundElementNodeStates);
337 vdm_LManSearchState(lman, (Vchar*)"S.*E:*", stateCount, &stateIds[foundElementNodeStates], &foundElementStates);
338 foundElementStates += foundElementNodeStates;
339 if (foundElementStates == 0) {
340 free(stateIds);
341 return;
342 }
343 Vint elementCount;
344 vis_ConnectNumber(connect, SYS_ELEM, &elementCount);
345
346 /* find maximum number of element nodes */
347 Vint maxElementNodesCount;
348 vis_ConnectMaxElemNode(connect, &maxElementNodesCount);
349
350 /* allocate array to fit maximum element node data */
351 Vfloat(*values)[6] = (Vfloat(*)[6])malloc(2 * maxElementNodesCount * 6 * sizeof(Vfloat));
352
353 /* create state */
354 vis_State* state = vis_StateBegin();
355
356 /* print first, middle and last element */
357 Vint requestedElementsCount = 3;
358 Vint requestedElementIds[3] = {1, elementCount / 2, elementCount};
359 /* loop over stress results */
360 for (Vint i = 0; i < foundElementStates; i++) {
361 vis_ResultMetadata* metadata = vis_ResultMetadataBegin();
362 vdm_LManGetMetadata(lman, stateIds[i], metadata);
363 Vchar stateName[SYS_MAXNAME];
364 Vlong length;
365 Vint rowsCount, columnsCount, type;
366 vis_ResultMetadataInq(metadata, stateName, &length, &rowsCount, &columnsCount, &type);
367 if (rowsCount != 6)
368 continue;
369 Vint entityType, subEntityType;
370 vis_ResultMetadataEntType(metadata, &entityType, &subEntityType);
371
372 /* print header */
373 printf("\nState: %s\n", stateName);
374 printf("\nStresses\n");
375
376 /* load state */
377 vdm_LManLoadStateFromName(lman, stateName, state);
378 Vint complexMode;
379 vis_StateGetComplexMode(state, &complexMode);
380
381 /* print stress components first */
382 vis_StateSetDerive(state, VIS_TENSOR);
383
384 /* loop over requested elements */
385 Vint nodesInElement;
386 for (Vint n = 0; n < requestedElementsCount; n++) {
387 if (requestedElementIds[n] == 0)
388 continue;
389 Vint elementNumber;
390 vis_ConnectElemAssoc(connect, VIS_USERID, 1, &requestedElementIds[n], &elementNumber);
391 printf("%8d, component stresses\n", elementNumber);
392
393 nodesInElement = 1;
394 /* if element node get number of nodes */
395 if (subEntityType == SYS_NODE) {
396 vis_ConnectElemNum(connect, SYS_NODE, requestedElementIds[n], &nodesInElement);
397 }
398 vis_StateData(state, 1, &requestedElementIds[n], (Vfloat*)values);
399
400 /* loop over nodes in element */
401 for (Vint j = 0; j < nodesInElement; j++) {
402 if (complexMode == SYS_COMPLEX_REAL) {
403 printf(" %12.5e %12.5e %12.5e %12.5e %12.5e %12.5e\n", values[j][0], values[j][1], values[j][2], values[j][3],
404 values[j][4], values[j][5]);
405 }
406 else {
407 Vfloat(*complexValues)[12];
408 complexValues = (Vfloat(*)[12])values;
409 printf(" %12.5e %12.5e(i) %12.5e %12.5e(i) %12.5e %12.5e(i)\n", complexValues[j][0], complexValues[j][1],
410 complexValues[j][2], complexValues[j][3], complexValues[j][4], complexValues[j][5]);
411 printf(" %12.5e %12.5e(i) %12.5e %12.5e(i) %12.5e %12.5e(i)\n", complexValues[j][6], complexValues[j][7],
412 complexValues[j][8], complexValues[j][9], complexValues[j][10], complexValues[j][11]);
413 }
414 }
415 }
416 /* skip derived quantities if complex data */
417 if (complexMode != SYS_COMPLEX_REAL)
418 continue;
419 /* print mean stress second */
420 vis_StateSetDerive(state, VIS_TENSOR_MEAN);
421
422 /* loop over requested elements */
423 for (Vint n = 0; n < requestedElementsCount; n++) {
424 if (requestedElementIds[n] == 0)
425 continue;
426 Vint elementNumber;
427 vis_ConnectElemAssoc(connect, VIS_USERID, 1, &requestedElementIds[n], &elementNumber);
428 printf("%8d, mean stress\n", elementNumber);
429
430 nodesInElement = 1;
431 /* if element node get number of nodes */
432 if (subEntityType == SYS_NODE) {
433 vis_ConnectElemNum(connect, SYS_NODE, requestedElementIds[n], &nodesInElement);
434 }
435 Vfloat* meanValues = (Vfloat*)malloc(maxElementNodesCount * sizeof(Vfloat));
436 vis_StateData(state, 1, &requestedElementIds[n], meanValues);
437
438 /* loop over nodes in element */
439 for (Vint j = 0; j < nodesInElement; j++) {
440 printf(" %12.5e\n", meanValues[j]);
441 }
442 free(meanValues);
443 }
444 printf("\n");
445 vis_StateSetDerive(state, VIS_TENSOR);
446
447 /* print stress in global if originally in local */
448 Vint systemType;
449 vis_StateGetSystem(state, &systemType);
450 if (systemType == STATE_LOCAL || systemType == STATE_ROTANG) {
451 vis_State* staterotang = NULL;
452 if (systemType == STATE_ROTANG) {
453 staterotang = vis_StateBegin();
454 Vchar rotangStateName[SYS_MAXNAME];
455 vis_ResultMetadataGetAttributeValueString(metadata, (Vchar*)"Link.RotAng", rotangStateName);
456 vdm_LManLoadStateFromName(lman, rotangStateName, staterotang);
457 vis_StateSetObject(state, VIS_STATE_ROTANG, staterotang);
458 }
459 vis_StateTransform(state, STATE_GLOBAL, NULL);
460 printf("global system\n");
461
462 /* loop over requested elements */
463 for (Vint n = 0; n < requestedElementsCount; n++) {
464 if (requestedElementIds[n] == 0)
465 continue;
466 Vint elementNumber;
467 vis_ConnectElemAssoc(connect, VIS_USERID, 1, &requestedElementIds[n], &elementNumber);
468 printf("%8d, component stresses\n", elementNumber);
469
470 nodesInElement = 1;
471 /* if element node get number of nodes */
472 if (subEntityType == SYS_NODE) {
473 vis_ConnectElemNum(connect, SYS_NODE, requestedElementIds[n], &nodesInElement);
474 }
475 vis_StateData(state, 1, &requestedElementIds[n], (Vfloat*)values);
476
477 /* loop over nodes in element */
478 for (Vint j = 0; j < nodesInElement; j++) {
479 printf(" %12.5e %12.5e %12.5e %12.5e %12.5e %12.5e\n", values[j][0], values[j][1], values[j][2], values[j][3],
480 values[j][4], values[j][5]);
481 }
482 }
483 if (systemType == STATE_ROTANG) {
484 vis_StateEnd(staterotang);
485 }
486 }
487 printf("\n");
488 /* print in material system */
489 vis_StateTransform(state, STATE_MATERIAL, NULL);
490 if (vis_StateError(state))
491 continue;
492 /* loop over requested elements */
493 printf("material system\n");
494 for (Vint n = 0; n < requestedElementsCount; n++) {
495 if (requestedElementIds[n] == 0)
496 continue;
497 Vint elementNumber;
498 vis_ConnectElemAssoc(connect, VIS_USERID, 1, &requestedElementIds[n], &elementNumber);
499 printf("%8d, component stresses\n", elementNumber);
500
501 nodesInElement = 1;
502 /* if element node get number of nodes */
503 if (subEntityType == SYS_NODE) {
504 vis_ConnectElemNum(connect, SYS_NODE, requestedElementIds[n], &nodesInElement);
505 }
506 vis_StateData(state, 1, &requestedElementIds[n], (Vfloat*)values);
507
508 /* loop over nodes in element */
509 for (Vint j = 0; j < nodesInElement; j++) {
510 printf(" %12.5e %12.5e %12.5e %12.5e %12.5e %12.5e\n", values[j][0], values[j][1], values[j][2], values[j][3],
511 values[j][4], values[j][5]);
512 }
513 }
514 /* print attributes */
515 vis_ResultMetadataPrintAttributes(metadata);
516 vis_ResultMetadataEnd(metadata);
517 }
518 /* free memory */
519 vis_StateEnd(state);
520 free(stateIds);
521 free(values);
522}
523
524/*----------------------------------------------------------------------
525 print result
526----------------------------------------------------------------------*/
527static void
528print_result(vdm_LMan* lman, vis_Connect* connect)
529{
530 /* allocate connectivity array to fit maximum number */
531 Vint maxElementNodesCount;
532 vis_ConnectMaxElemNode(connect, &maxElementNodesCount);
533 Vint* connectivity = (Vint*)malloc(maxElementNodesCount * sizeof(Vint));
534
535 /* create state */
536 vis_State* state = vis_StateBegin();
537
538 /* pointer for returned results data */
539 Vfloat* resultData = NULL;
540 Vint* position = NULL;
541 Vint* layer = NULL;
542 Vint maxDataSize = 0;
543 Vint maxSectionSize = 0;
544 /* loop over states */
545 vsy_List* stateNames;
546 Vint statesCount = vdm_LManGetNumStates(lman);
547 vdm_LManGetStateNames(lman, &stateNames);
548 for (Vint nameIndex = 0; nameIndex < statesCount; nameIndex++) {
549 Vchar* name = nullptr;
550 vsy_ListRef(stateNames, nameIndex, (Vobject**)&name);
551
552 vis_ResultMetadata* metadata = vis_ResultMetadataBegin();
553 vdm_LManGetMetadataFromName(lman, name, metadata);
554
555 /* get DataType attribute */
556 Vchar dataType[ATTRIBUTE_MAXVALUE];
557 vis_ResultMetadataGetAttributeValueString(metadata, (Vchar*)"DataType", dataType);
558
559 /* get Contents attribute */
560 Vchar contents[ATTRIBUTE_MAXVALUE];
561 vis_ResultMetadataGetAttributeValueString(metadata, (Vchar*)"Contents", contents);
562
563 /* get result physical dimensions */
564 Vchar dimensions[SYS_MAXNAME];
565 vis_ResultMetadataGetDimensions(metadata, dimensions);
566
567 /* print name */
568 printf("\n\nState: %s\n", name);
569
570 /* print DataType, Contents and dimensions */
571 printf("DataType: %s\n", dataType);
572 printf("Contents: %s\n", contents);
573 printf("Dimensions: %s\n", dimensions);
574 Vint entityType, subentityType, datatype;
575 vis_ResultMetadataEntType(metadata, &entityType, &subentityType);
576 /* skip states with SYS_DOF entity type */
577 if (entityType == SYS_DOF) {
578 vis_ResultMetadataPrintAttributes(metadata);
579 continue;
580 }
581 /* load state */
582 vdm_LManLoadStateFromName(lman, name, state);
583
584 /* number of entities, datatype */
585 Vint entitiesCount;
586 vis_StateInq(state, &entitiesCount, &entityType, &subentityType, &datatype);
587
588 /* maximum data size, number of locations and sections */
589 Vint dataSize;
590 Vint sectionDataSize;
591 Vint maxLocationSize;
592 vis_StateDataMax(state, &dataSize, &maxLocationSize, §ionDataSize);
593 if (dataSize > maxDataSize) {
594 maxDataSize = dataSize;
595 resultData = (Vfloat*)realloc(resultData, maxDataSize * sizeof(Vfloat));
596 }
597 if (sectionDataSize > maxSectionSize) {
598 maxSectionSize = sectionDataSize;
599 position = (Vint*)realloc(position, maxSectionSize * sizeof(Vint));
600 layer = (Vint*)realloc(layer, maxSectionSize * sizeof(Vint));
601 }
602 /* query local or global system */
603 Vint systemType;
604 vis_StateGetSystem(state, &systemType);
605 if (systemType == STATE_GLOBAL) {
606 printf("system= Global\n");
607 }
608 else {
609 printf("system= Local\n");
610 }
611 Vint engineeringStrainFlag;
612 vis_StateGetEngineeringStrain(state, &engineeringStrainFlag);
613 if (engineeringStrainFlag) {
614 printf("strain= Engineering\n");
615 }
616
617 Vint numberOfComponents;
618 vis_StateNumDerive(state, &numberOfComponents);
619
620 /* return all sections */
621 vis_StateSetSection(state, 0);
622
623 /* loop through all entities */
624 for (Vint index = 1; index <= entitiesCount; index++) {
625 /* select entities to ignore for whatever reason */
626 if (index != 1)
627 continue;
628 /* print entity id */
629 Vint id = 0;
630 if (entityType == SYS_NODE) {
631 vis_ConnectNodeAssoc(connect, VIS_USERID, 1, &index, &id);
632 printf("node= %d\n", id);
633 }
634 else if (entityType == SYS_ELEM || entityType == SYS_FACE || entityType == SYS_EDGE) {
635 vis_ConnectElemAssoc(connect, VIS_USERID, 1, &index, &id);
636 printf("elem= %d\n", id);
637 }
638 else if (entityType == SYS_MODE) {
639 printf("mode= %d\n", id);
640 }
641 /* see if data defined */
642 Vint status;
643 vis_StateDataStat(state, 1, &index, &status);
644 if (status == 0) {
645 printf(" no data\n");
646 continue;
647 }
648 /* get results data for entity */
649 vis_StateData(state, 1, &index, resultData);
650 /* print data */
651 /* data at node */
652 if (entityType == SYS_NODE) {
653 for (Vint j = 0; j < numberOfComponents; j++) {
654 printf(" %e", resultData[j]);
655 }
656 printf("\n");
657 /* data at element face or edge */
658 }
659 else if (entityType == SYS_FACE || entityType == SYS_EDGE) {
660 Vint elementEntityCount;
661 Vint elementEntities[VIS_MAX_MAXJ];
662 vis_StateDataEnt(state, index, &elementEntityCount, elementEntities);
663 /* element face or edge */
664 if (subentityType == SYS_NONE) {
665 for (Vint k = 0; k < elementEntityCount; k++) {
666 printf("%4d", elementEntities[k]);
667 for (Vint j = 0; j < numberOfComponents; j++) {
668 printf(" %e", resultData[k * numberOfComponents + j]);
669 }
670 printf("\n");
671 }
672 /* element face or edge node */
673 }
674 else {
675 for (Vint k = 0; k < elementEntityCount; k++) {
676 printf("%4d", elementEntities[k]);
677 Vint nodesInElement;
678 vis_ConnectElemCon(connect, entityType, index, elementEntities[k], &nodesInElement, connectivity);
679 for (Vint n = 0; n < nodesInElement; n++) {
680 printf("%4d", n + 1);
681 for (Vint j = 0; j < numberOfComponents; j++) {
682 printf(" %e", resultData[k * numberOfComponents * nodesInElement + n * numberOfComponents + j]);
683 }
684 printf("\n");
685 }
686 }
687 }
688 /* data at element */
689 }
690 else if (entityType == SYS_ELEM) {
691 Vint numberOfSections;
692 vis_StateDataSect(state, 1, &index, &numberOfSections);
693 /* get layer position */
694 vis_StateDataLayers(state, index, position, layer);
695 /* element */
696 if (subentityType == SYS_NONE) {
697 for (Vint k = 0; k < numberOfSections; k++) {
698 if (numberOfSections > 1) {
699 print_section(position[k], layer[k]);
700 }
701 for (Vint j = 0; j < numberOfComponents; j++) {
702 printf(" %e", resultData[k * numberOfComponents + j]);
703 }
704 printf("\n");
705 }
706 /* element node */
707 }
708 else {
709 Vint nodesInElement;
710 vis_ConnectElemNode(connect, index, &nodesInElement, connectivity);
711 for (Vint k = 0; k < numberOfSections; k++) {
712 if (numberOfSections > 1) {
713 print_section(position[k], layer[k]);
714 }
715 for (Vint n = 0; n < nodesInElement; n++) {
716 Vint node;
717 vis_ConnectNodeAssoc(connect, VIS_USERID, 1, &connectivity[n], &node);
718 printf("node= %d\n", node);
719 for (Vint j = 0; j < numberOfComponents; j++) {
720 printf(" %e", resultData[k * numberOfComponents * nodesInElement + n * numberOfComponents + j]);
721 }
722 printf("\n");
723 }
724 }
725 }
726 /* data at mode */
727 }
728 else if (entityType == SYS_MODE) {
729 for (Vint j = 0; j < numberOfComponents; j++) {
730 printf(" %e", resultData[j]);
731 }
732 printf("\n");
733 }
734 }
735 /* print attributes */
736 vis_ResultMetadataPrintAttributes(metadata);
737 vis_ResultMetadataEnd(metadata);
738 }
739 /* free memory */
740 vis_StateEnd(state);
741 if (resultData) {
742 free(resultData);
743 }
744 if (position) {
745 free(position);
746 free(layer);
747 }
748 free(connectivity);
749}
750
751/*----------------------------------------------------------------------
752 print section and type
753----------------------------------------------------------------------*/
754static void
755print_section(Vint position, Vint section)
756{
757 printf("section= %d", section);
758 if (position == SYS_LAYERPOSITION_NONE) {
759 printf(" none");
760 }
761 else if (position == SYS_LAYERPOSITION_MID) {
762 printf(" middle");
763 }
764 else if (position == SYS_LAYERPOSITION_BOT) {
765 printf(" bottom");
766 }
767 else if (position == SYS_LAYERPOSITION_TOP) {
768 printf(" top");
769 }
770 else if (position == SYS_LAYERPOSITION_INTPNT) {
771 printf(" eip");
772 }
773 printf("\n");
774}