2 * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM
4 * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide.
6 * Tecplot hereby grants OpenCFD limited authority to distribute without
7 * alteration the source code to the Tecplot Input/Output library, known
8 * as TecIO, as part of its distribution of OpenFOAM and the
9 * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby
10 * granted access to the TecIO source code, and may redistribute it for the
11 * purpose of maintaining the converter. However, no authority is granted
12 * to alter the TecIO source code in any form or manner.
14 * This limited grant of distribution does not supersede Tecplot, Inc.'s
15 * copyright in TecIO. Contact Tecplot, Inc. for further information.
18 * 3535 Factoria Blvd, Ste. 550
19 * Bellevue, WA 98006, USA
20 * Phone: +1 425 653 1200
21 * http://www.tecplot.com/
27 #define TECPLOTENGINEMODULE
30 ******************************************************************
31 ******************************************************************
33 ****** (C) 1988-2008 Tecplot, Inc. *******
35 ******************************************************************
36 ******************************************************************
38 /* Source file revision $Revision: 7627 $ */
42 #include "Q_UNICODE.h"
44 #include "FILESTREAM.h"
45 #if defined TECPLOTKERNEL
46 /* CORE SOURCE CODE REMOVED */
55 #if !defined MAKEARCHIVE
57 #endif /* MAKEARCHIVE */
65 #include <sys/types.h>
69 #if defined TECPLOTKERNEL
70 /* CORE SOURCE CODE REMOVED */
74 #if defined MAKEARCHIVE
75 #if defined MSWIN && defined _DEBUG
76 /* For debug .dll builds, send debug info to debug window. */
77 #define PRINT0(s) do { OutputDebugString(s); } while (0)
78 #define PRINT1(s,a1) do { char buffer[512]; sprintf(buffer,s,a1); OutputDebugString(buffer); } while (0)
79 #define PRINT2(s,a1,a2) do { char buffer[512]; sprintf(buffer,s,a1,a2); OutputDebugString(buffer); } while (0)
81 /* For all other builds (including release .dll), send debug info to stdout. */
82 #define PRINT0(s) printf(s)
83 #define PRINT1(s,a1) printf(s,a1)
84 #define PRINT2(s,a1,a2) printf(s,a1,a2)
88 /* For nonarchive, Windows, don't send debug info. */
89 #define PRINT0(s) ((void)0)
90 #define PRINT1(s,a1) ((void)0)
91 #define PRINT2(s,a1,a2) ((void)0)
93 /* For nonarchive, nonwindows, send debug info to stdout. */
94 #define PRINT0(s) printf(s)
95 #define PRINT1(s,a1) printf(s,a1)
96 #define PRINT2(s,a1,a2) printf(s,a1,a2)
100 typedef char *FNameType
;
101 typedef FILE *FilePtr
;
103 #define MaxNumFiles 10
104 #define MAX_DUPLIST_VARS 50 /* maybe crank up in the future */
106 #define BYTES_PER_CHUNK 4096
107 #define TECIO_NO_NEIGHBORING_ELEM 0
108 #define TECIO_NO_NEIGHBORING_ZONE 0
110 #if defined MAKEARCHIVE
111 static LgIndex_t DebugLevel
[MaxNumFiles
] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
113 static INTEGER4 IsOpen
[MaxNumFiles
] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
114 static INTEGER4 NumErrs
[MaxNumFiles
] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
115 static INTEGER4 NumVars
[MaxNumFiles
];
116 static FNameType DestFName
[MaxNumFiles
] = {NULL
, NULL
, NULL
, NULL
, NULL
,
117 NULL
, NULL
, NULL
, NULL
, NULL
119 static FNameType BlckFName
[MaxNumFiles
] = {NULL
, NULL
, NULL
, NULL
, NULL
,
120 NULL
, NULL
, NULL
, NULL
, NULL
122 static FileStream_s
* BlckFile
[MaxNumFiles
];
123 static FileStream_s
* HeadFile
[MaxNumFiles
];
124 static vector
<FileOffset_t
> MinMaxOffset
[MaxNumFiles
]; /* vector dimensioned by num zones */
125 static vector
<double> VarMinValue
[MaxNumFiles
]; /* vector dimensioned by num vars */
126 static vector
<double> VarMaxValue
[MaxNumFiles
]; /* vector dimensioned by num vars */
127 static INTEGER4 DoWriteForeign
= FALSE
; /* ...default is to write native */
128 static INTEGER4 IsWritingNative
[MaxNumFiles
];
129 static INTEGER4 IsBlock
[MaxNumFiles
];
130 static INTEGER4 ZoneType
[MaxNumFiles
];
131 static LgIndex_t IMax
[MaxNumFiles
]; /* ones based indices */
132 static LgIndex_t JMax
[MaxNumFiles
]; /* ones based indices */
133 static LgIndex_t KMax
[MaxNumFiles
]; /* ones based indices */
134 static vector
<LgIndex_t
> TotalNumFaceNodes
[MaxNumFiles
]; /* vector dimensioned by num zones */
135 static LgIndex_t TotalNumFaceBndryFaces
[MaxNumFiles
];
136 static LgIndex_t TotalNumFaceBndryConns
[MaxNumFiles
];
137 static LgIndex_t ICellMax
[MaxNumFiles
];
138 static LgIndex_t JCellMax
[MaxNumFiles
];
139 static LgIndex_t KCellMax
[MaxNumFiles
];
140 static vector
<INTEGER4
> NumFaceConnections
[MaxNumFiles
]; /* vector dimensioned by num zones */
141 static INTEGER4 FaceNeighborMode
[MaxNumFiles
];
142 static vector
<INTEGER4
> FaceNeighborsOrMapWritten
[MaxNumFiles
]; /* vector dimensioned by num zones */
143 static INTEGER4 NumIndices
[MaxNumFiles
];
144 static LgIndex_t NumDataValuesWritten
[MaxNumFiles
];
145 static LgIndex_t NumOrderedCCDataValuesWritten
[MaxNumFiles
]; /* CC data only */
146 static LgIndex_t NumDataValuesToWrite
[MaxNumFiles
];
147 static vector
<LgIndex_t
> NumRunningVarValues
[MaxNumFiles
]; /* vector dimensioned by num vars */
148 static vector
<Boolean_t
> IsSharedVar
[MaxNumFiles
]; /* vector dimensioned by num vars */
149 static vector
<Boolean_t
> IsPassiveVar
[MaxNumFiles
]; /* vector dimensioned by num vars */
150 static INTEGER4 CurZone
[MaxNumFiles
]; /* zero based zone numbers */
151 static INTEGER4 CurVar
[MaxNumFiles
]; /* zero based var numbers */
152 static INTEGER4 FieldDataType
;
153 static INTEGER4 CurFile
= -1;
154 static vector
<Boolean_t
> IsCellCentered
[MaxNumFiles
]; /* vector dimensioned by num vars */
155 static Boolean_t HasFECONNECT
[MaxNumFiles
];
156 static INTEGER4 FileTypes
[MaxNumFiles
];
157 static vector
<INTEGER4
> NumConnectivityNodes
[MaxNumFiles
]; /* vector dimensioned by num zones */
158 static vector
<Boolean_t
> ConnectivityWritten
[MaxNumFiles
]; /* vector dimensioned by num zones */
163 * ZoneType 0=ORDERED,1=FELINESEG,2=FETRIANGLE,
164 * 3=FEQUADRILATERAL,4=FETETRAHEDRON,5=FEBRICK,
165 * 6=FEPOLYGON,7=FEPOLYHEDRON
170 #define FEQUADRILATERAL 3
171 #define FETETRAHEDRON 4
174 #define FEPOLYHEDRON 7
176 * FileType 0=FULLFILE,1=GRIDFILE,2=SOLUTIONFILE
180 #define SOLUTIONFILE 2
182 #if defined MAKEARCHIVE
183 static char const* ZoneTypes
[] =
194 #endif /* MAKEARCHIVE */
197 static void WriteErr(const char *routine_name
)
199 #if defined MAKEARCHIVE
200 PRINT2("Err: (%s) Write failure on file %d.\n", routine_name
, CurFile
+ 1);
205 static LgIndex_t TecXXXZoneNum
= 0;
207 Boolean_t
ParseDupList(LgIndex_t
**ShareVarFromZone
,
208 LgIndex_t
*ShareConnectivityFromZone
,
211 Boolean_t IsOk
= TRUE
;
213 REQUIRE(VALID_REF(ShareVarFromZone
) && *ShareVarFromZone
== NULL
);
214 REQUIRE(VALID_REF(ShareConnectivityFromZone
));
215 REQUIRE(VALID_REF(DupList
));
217 while (IsOk
&& *DupList
)
219 /* skip leading spaces */
220 while (*DupList
&& *DupList
== ' ')
223 /* is this the FECONNECT keyword? */
224 if (*DupList
&& !strncmp(DupList
, "FECONNECT", 9))
225 *ShareConnectivityFromZone
= TecXXXZoneNum
;
227 else if (*DupList
&& !isdigit(*DupList
))
228 IsOk
= FALSE
; /* syntax error */
232 char *NotUsed
= NULL
;
233 EntIndex_t WhichVar
= strtol(DupList
, &NotUsed
, 10);
234 EntIndex_t numVarsForFile
= NumVars
[CurFile
];
236 if (0 < WhichVar
&& WhichVar
< numVarsForFile
)
238 if (!(*ShareVarFromZone
))
240 *ShareVarFromZone
= ALLOC_ARRAY(numVarsForFile
, LgIndex_t
, "Variable sharing list");
241 if (*ShareVarFromZone
)
242 memset(*ShareVarFromZone
, (char)0, numVarsForFile
* sizeof(LgIndex_t
));
245 if (*ShareVarFromZone
)
246 (*ShareVarFromZone
)[WhichVar
- 1] = TecXXXZoneNum
;
252 /* Invalid var num */
258 * Skip to the comma. This
259 * will also allow the syntax error
260 * of more than one consecutive comma
263 while (*DupList
&& *DupList
!= ',')
266 /* skip past the comma (can handle the syntax error of more than 1 comma) */
267 while (*DupList
&& *DupList
== ',')
276 static FileStream_s
*OpenFileStream(const char *FilePath
,
277 const char *AccessMode
,
278 Boolean_t IsByteOrderNative
)
280 REQUIRE(VALID_REF(FilePath
));
281 REQUIRE(VALID_REF(AccessMode
));
283 FileStream_s
*Result
= NULL
;
284 FILE *File
= TP_FOPEN(FilePath
, AccessMode
);
287 Result
= FileStreamAlloc(File
, IsByteOrderNative
);
292 ENSURE((VALID_REF(Result
) && VALID_REF(Result
->File
)) || Result
== NULL
);
298 static void CloseFileStream(FileStream_s
**FileStream
)
300 REQUIRE(VALID_REF(FileStream
));
301 REQUIRE(VALID_REF(*FileStream
) || *FileStream
== NULL
);
303 if (*FileStream
!= NULL
)
305 TP_FCLOSE((*FileStream
)->File
);
306 FileStreamDealloc(FileStream
);
309 ENSURE(*FileStream
== NULL
);
313 * Get the best terminator (separator) character to use for the string. First
314 * precedence goes to the new line then the command and finally by default the
315 * space. NOTE: We use a do loop to allow it to be used as a single statement.
317 #define GET_BEST_TERMINATOR_CHAR(CompoundStr, TerminatorChar) \
320 if (strchr((CompoundStr), '\n') != NULL) \
321 (TerminatorChar) = '\n'; \
322 else if (strchr((CompoundStr), ',') != NULL) \
323 (TerminatorChar) = ','; \
325 (TerminatorChar) = ' '; \
332 INTEGER4 LIBCALL
TECINI112(char *Title
,
347 * Note that users should not mix TECXXX, TEC100XXX, and TEC110XXX calls, but
348 * just in case, initialize the TecXXXZoneNum variable. It may not help, but
353 #if defined MAKEARCHIVE
357 for (I
= 0; (I
< MaxNumFiles
) && (NewFile
== -1); I
++)
365 #if defined MAKEARCHIVE
366 PRINT1("Err: (TECINI112) Too many files (%d) opened for printing.\n", NewFile
);
374 #if defined MAKEARCHIVE
375 DebugLevel
[NewFile
] = *Debug
;
377 /* check sizes for array sized by number of variables */
378 CHECK(VarMinValue
[NewFile
].empty());
379 CHECK(VarMaxValue
[NewFile
].empty());
380 CHECK(NumRunningVarValues
[NewFile
].empty());
381 CHECK(IsSharedVar
[NewFile
].empty());
382 CHECK(IsPassiveVar
[NewFile
].empty());
383 CHECK(IsCellCentered
[NewFile
].empty());
385 /* check sizes for array sized by number of zones */
386 CHECK(MinMaxOffset
[NewFile
].empty());
387 CHECK(TotalNumFaceNodes
[NewFile
].empty());
388 CHECK(NumFaceConnections
[NewFile
].empty());
389 CHECK(FaceNeighborsOrMapWritten
[NewFile
].empty());
390 CHECK(NumConnectivityNodes
[NewFile
].empty());
391 CHECK(ConnectivityWritten
[NewFile
].empty());
393 CurZone
[NewFile
] = -1;
399 #if defined MAKEARCHIVE
400 PRINT1("Err: (TECINI112) Bad file name for file %d.\n", NewFile
);
404 DestFName
[NewFile
] = ALLOC_ARRAY(L
+ 1, char, "data set fname");
405 strcpy(DestFName
[NewFile
], FName
);
409 sprintf(RName
, "BLCKFILE.%03d", (int)(NewFile
+ 1));
413 sprintf(RName
, "tp%1dXXXXXX", NewFile
+ 1);
418 if (ScratchDir
!= NULL
)
419 L
+= strlen(ScratchDir
) + 1; /* +1 for the slash delimeter */
420 BlckFName
[NewFile
] = ALLOC_ARRAY(L
+ 1, char, "data set fname");
421 if (ScratchDir
!= NULL
)
423 strcpy(BlckFName
[NewFile
], ScratchDir
);
424 #if defined DOS || defined MSWIN
426 strcat(BlckFName
[NewFile
], "\\");
430 strcat(BlckFName
[NewFile
], "/");
435 BlckFName
[NewFile
][0] = '\0';
437 strcat(BlckFName
[NewFile
], RName
);
438 CHECK(strlen(BlckFName
[NewFile
]) <= L
);
442 _mktemp(BlckFName
[NewFile
]);
447 * POSIX compiant behavior is to make
448 * sure umask is set correctly first.
450 mode_t OrigUmask
= umask(0022); /* ...should produce rw------- */
451 int FileDesc
= mkstemp(BlckFName
[NewFile
]);
458 #if defined MAKEARCHIVE
459 if (DebugLevel
[NewFile
])
461 PRINT2("Scratch File #%d: %s\n", NewFile
+ 1, BlckFName
[NewFile
]);
462 PRINT2("Dest File #%d: %s\n", NewFile
+ 1, DestFName
[NewFile
]);
466 IsWritingNative
[NewFile
] = !DoWriteForeign
;
468 #if defined TECPLOTKERNEL
469 /* CORE SOURCE CODE REMOVED */
472 HeadFile
[NewFile
] = OpenFileStream(DestFName
[NewFile
], "wb", IsWritingNative
[NewFile
]);
473 BlckFile
[NewFile
] = OpenFileStream(BlckFName
[NewFile
], "wb", IsWritingNative
[NewFile
]);
475 if (BlckFile
[NewFile
] == NULL
)
477 #if defined MAKEARCHIVE
478 PRINT0("Err: (TECINI112) Cannot open scratch file for output.\n");
479 PRINT0(" Check permissions in scratch directory.\n");
484 if (HeadFile
[NewFile
] == NULL
)
486 #if defined MAKEARCHIVE
487 PRINT0("Err: (TECINI112) Cannot open plot file. Check permissions.\n");
493 writeBinaryVersionNumber(*HeadFile
[NewFile
],
494 TecplotBinaryFileVersion
);
495 WriteBinaryMagic(HeadFile
[NewFile
]);
497 /* Write file type */
498 if (*FileType
>= FULLFILE
&& *FileType
<= SOLUTIONFILE
)
499 FileTypes
[NewFile
] = *FileType
;
502 #if defined MAKEARCHIVE
503 PRINT0("Err: (TECINI112) Bad filetype argument. Check documentation.\n");
509 CHECK(TecplotBinaryFileVersion
== 112);
510 if (!WriteBinaryInt32(HeadFile
[NewFile
], (LgIndex_t
)FileTypes
[NewFile
]))
512 WriteErr("TECINI112");
516 if (!DumpDatafileString(HeadFile
[NewFile
],
520 WriteErr("TECINI112");
524 NumVars
[NewFile
] = 0;
529 * Three possible variable name separators are accepted with the following
530 * precidence: newline, comma, and space.
535 GET_BEST_TERMINATOR_CHAR(CPtr
, terminator
);
538 /* strip leading spaces */
539 while (*CPtr
&& *CPtr
== ' ')
545 /* skip to terminating character */
546 while (*CPtr
&& *CPtr
!= terminator
)
548 /* skip past terminating character */
556 /* A grid file can have no variables in it as long as there is a connectivity list */
557 if (NumVars
[NewFile
] == 0 && FileTypes
[NewFile
] != GRIDFILE
)
559 #if defined MAKEARCHIVE
560 PRINT0("Err: (TECINI110) No variable names were defined.\n");
567 #if defined MAKEARCHIVE
568 if (DebugLevel
[NewFile
])
569 PRINT1("NumVars=%d\n", NumVars
[NewFile
]);
571 /* make sure var-sized arrays are big enough for all vars */
574 VarMinValue
[NewFile
].resize(NumVars
[NewFile
]);
575 VarMaxValue
[NewFile
].resize(NumVars
[NewFile
]);
576 NumRunningVarValues
[NewFile
].resize(NumVars
[NewFile
]);
577 IsSharedVar
[NewFile
].resize(NumVars
[NewFile
]);
578 IsPassiveVar
[NewFile
].resize(NumVars
[NewFile
]);
579 IsCellCentered
[NewFile
].resize(NumVars
[NewFile
]);
581 catch (std::bad_alloc
const&)
583 #if defined MAKEARCHIVE
584 PRINT0("Err: (TECINI112) Memory allocation error.\n");
590 if (!WriteBinaryInt32(HeadFile
[NewFile
], (LgIndex_t
)NumVars
[NewFile
]))
592 WriteErr("TECINI110");
599 char TString
[MaxChrsVarName
+1];
602 GET_BEST_TERMINATOR_CHAR(CPtr
, terminator
);
605 /* skip leading space characters */
606 while (*CPtr
&& *CPtr
== ' ')
611 /* skip to terminator */
612 while (*CPtr
&& *CPtr
!= terminator
)
614 TString
[I
++] = *CPtr
++;
616 /* skip past terminator */
620 /* strip trailing spaces */
622 while (I
>= 0 && TString
[I
] == ' ')
627 if (!DumpDatafileString(HeadFile
[NewFile
], TString
, TRUE
))
629 WriteErr("TECINI110");
639 FieldDataType
= FieldDataType_Double
;
641 FieldDataType
= FieldDataType_Float
;
646 INTEGER4 LIBCALL
TECINI111(char *Title
,
654 return TECINI112(Title
,
663 INTEGER4 LIBCALL
TECINI110(char *Title
,
670 INTEGER4 FType
= FULLFILE
;
673 return TECINI112(Title
,
682 INTEGER4 LIBCALL
TECINI100(char *Title
,
689 INTEGER4 FType
= FULLFILE
;
692 return TECINI112(Title
,
701 INTEGER4 LIBCALL
TECINI(char *Title
,
708 INTEGER4 FType
= FULLFILE
;
711 return TECINI112(Title
,
720 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
721 LIBFUNCTION INTEGER4 LIBCALL
tecini112_(char *Title
,
729 return TECINI112(Title
, Variables
, FName
, ScratchDir
, FileType
, Debug
, VIsDouble
);
732 LIBFUNCTION INTEGER4 LIBCALL
tecini111_(char *Title
,
740 return TECINI112(Title
, Variables
, FName
, ScratchDir
, FileType
, Debug
, VIsDouble
);
743 LIBFUNCTION INTEGER4 LIBCALL
tecini110_(char *Title
,
750 INTEGER4 FType
= FULLFILE
;
751 return TECINI112(Title
, Variables
, FName
, ScratchDir
, &FType
, Debug
, VIsDouble
);
754 LIBFUNCTION INTEGER4 LIBCALL
tecini100_(char *Title
,
761 INTEGER4 FType
= FULLFILE
;
762 return TECINI112(Title
, Variables
, FName
, ScratchDir
, &FType
, Debug
, VIsDouble
);
765 LIBFUNCTION INTEGER4 LIBCALL
tecini_(char *Title
,
772 INTEGER4 FType
= FULLFILE
;
773 return TECINI112(Title
,
784 static int CheckData(const char *routine_name
)
787 if (NumDataValuesToWrite
[CurFile
] != NumDataValuesWritten
[CurFile
])
789 #if defined MAKEARCHIVE
790 PRINT2("Err: (%s) Wrong number of data values in file %d:\n", routine_name
, CurFile
+ 1);
791 PRINT2(" %d data values for Zone %d were processed,\n", NumDataValuesWritten
[CurFile
], CurZone
[CurFile
] + 1);
792 PRINT1(" %d data values were expected.\n", NumDataValuesToWrite
[CurFile
]);
800 static int CheckFile(const char *routine_name
)
802 if ((CurFile
== -1) || (!IsOpen
[CurFile
]))
804 #if defined MAKEARCHIVE
805 PRINT2("Err: (%s) Attempt to use invalid file (%d).\n",
806 routine_name
, CurFile
+ 1);
814 * Advances CurVar[CurFile] to the next non-shared active variable. TECDATXXX
815 * clients should not supply values for shared or passive variables.
817 static void AdvanceToNextVarWithValues(void)
819 /* search for the next variable with values */
824 while (CurVar
[CurFile
] < NumVars
[CurFile
] &&
825 (IsSharedVar
[CurFile
][CurVar
[CurFile
]] ||
826 IsPassiveVar
[CurFile
][CurVar
[CurFile
]]));
832 INTEGER4 LIBCALL
TECZNE112(char *ZnTitle
,
834 INTEGER4
*IMxOrNumPts
,
835 INTEGER4
*JMxOrNumElements
,
836 INTEGER4
*KMxOrNumFaces
,
840 double *SolutionTime
,
842 INTEGER4
*ParentZone
,
844 INTEGER4
*NumFaceConn
,
846 INTEGER4
*NumFaceNodes
,
847 INTEGER4
*NumFaceBndryFaces
,
848 INTEGER4
*NumFaceBndryConns
,
849 INTEGER4
*PassiveVarList
,
850 INTEGER4
*ValueLocation
,
851 INTEGER4
*ShareVarFromZone
,
852 INTEGER4
*ShareConnectivityFromZone
)
857 if (CheckFile("TECZNE112") < 0)
860 if (CurZone
[CurFile
] > -1)
862 if (CheckData("TECZNE112") < 0)
866 if (NumVars
[CurFile
] == 0)
868 WriteErr("TECZNE112");
869 #if defined MAKEARCHIVE
870 PRINT1("Err: (TECZNE112) Cannot write out zones if numvars is equal to zero (file %d).\n",
876 if (CurZone
[CurFile
] > MaxNumZonesOrVars
- 2) /* -1 based */
878 WriteErr("TECZNE112");
879 #if defined MAKEARCHIVE
880 PRINT2("Err: (TECZNE112) Exceeded max number of zones (%d) in file %d.\n",
881 MaxNumZonesOrVars
, CurFile
+ 1);
888 #if defined MAKEARCHIVE
889 PRINT2("Err: (TECZNE112) Invalid StrandID supplied for file %d, zone %d.\n",
890 CurFile
+ 1, CurZone
[CurFile
] + 1 + 1);
897 #if defined MAKEARCHIVE
898 PRINT2("Err: (TECZNE112) Invalid ParentZone supplied for file %d, zone %d.\n",
899 CurFile
+ 1, CurZone
[CurFile
] + 1 + 1);
905 * This is a temporary error. Point format should no longer be written to the file
906 * and should instead be converted to block format before being written. Since the
907 * conversion has not yet been implemented, it is an error to use point data.
908 * TODO (JN): Remove this error when point to block conversion has been implemented.
912 #if defined MAKEARCHIVE
913 PRINT2("Err: (TECZNE112) Point data is not currently allowed. "
914 " Please use block format for file %d, zone %d.\n",
915 CurFile
+ 1, CurZone
[CurFile
] + 1 + 1);
920 NumDataValuesWritten
[CurFile
] = 0;
921 NumOrderedCCDataValuesWritten
[CurFile
] = 0;
924 /* Resize zone-dimensioned arrays (CurZone[] is 0-based) */
927 MinMaxOffset
[CurFile
].resize(CurZone
[CurFile
] + 1);
928 TotalNumFaceNodes
[CurFile
].resize(CurZone
[CurFile
] + 1);
929 NumFaceConnections
[CurFile
].resize(CurZone
[CurFile
] + 1);
930 FaceNeighborsOrMapWritten
[CurFile
].resize(CurZone
[CurFile
] + 1);
931 NumConnectivityNodes
[CurFile
].resize(CurZone
[CurFile
] + 1);
932 ConnectivityWritten
[CurFile
].resize(CurZone
[CurFile
] + 1);
934 catch (std::bad_alloc
const&)
936 #if defined MAKEARCHIVE
937 PRINT0("Err: (TECZNE112) Memory allocation error.\n");
943 ZoneType
[CurFile
] = *ZnType
;
944 IMax
[CurFile
] = *IMxOrNumPts
;
945 JMax
[CurFile
] = *JMxOrNumElements
;
946 KMax
[CurFile
] = *KMxOrNumFaces
;
947 ICellMax
[CurFile
] = *ICellMx
;
948 JCellMax
[CurFile
] = *JCellMx
;
949 KCellMax
[CurFile
] = *KCellMx
;
950 /* Set the flags that connectivity, face neighbors or face map hasn't been written for the zone yet. */
951 FaceNeighborsOrMapWritten
[CurFile
][CurZone
[CurFile
]] = FALSE
;
952 ConnectivityWritten
[CurFile
][CurZone
[CurFile
]] = FALSE
;
954 if (ZoneType
[CurFile
] == ZoneType_FEPolygon
||
955 ZoneType
[CurFile
] == ZoneType_FEPolyhedron
)
957 NumFaceConnections
[CurFile
][CurZone
[CurFile
]] = 0; /* ...not used for polytope data */
958 FaceNeighborMode
[CurFile
] = 0; /* ...not used for polytope data */
959 NumConnectivityNodes
[CurFile
][CurZone
[CurFile
]] = 0; /* ...not used for polytope data */
961 IsBlock
[CurFile
] = TRUE
; /* ...polytope data is always block */
962 TotalNumFaceNodes
[CurFile
][CurZone
[CurFile
]] = *NumFaceNodes
;
963 TotalNumFaceBndryFaces
[CurFile
] = *NumFaceBndryFaces
;
964 TotalNumFaceBndryConns
[CurFile
] = *NumFaceBndryConns
;
966 else /* ...classic data */
968 IsBlock
[CurFile
] = *IsBlk
;
969 NumFaceConnections
[CurFile
][CurZone
[CurFile
]] = *NumFaceConn
;
970 FaceNeighborMode
[CurFile
] = *FNMode
;
972 TotalNumFaceNodes
[CurFile
][CurZone
[CurFile
]] = 0; /* ...not used for classic data */
973 TotalNumFaceBndryFaces
[CurFile
] = 0; /* ...not used for classic data */
974 TotalNumFaceBndryConns
[CurFile
] = 0; /* ...not used for classic data */
977 WriteBinaryReal(HeadFile
[CurFile
],
979 FieldDataType_Float
);
980 if (!DumpDatafileString(HeadFile
[CurFile
],
984 WriteErr("TECZNE112");
988 if ((ShareVarFromZone
&& *ShareConnectivityFromZone
) &&
989 CurZone
[CurFile
] == 0)
991 /* can't have a duplist if there's nothing to duplicate */
997 #if defined MAKEARCHIVE
998 PRINT1("Err: (TECZNE112) Bad zone format for file %d.\n", CurFile
+ 1);
1004 switch (ZoneType
[CurFile
])
1007 NumIndices
[CurFile
] = 0;
1010 NumIndices
[CurFile
] = 2;
1013 NumIndices
[CurFile
] = 3;
1015 case FEQUADRILATERAL
:
1016 NumIndices
[CurFile
] = 4;
1019 NumIndices
[CurFile
] = 4;
1022 NumIndices
[CurFile
] = 8;
1026 /* ...not used for poly or ordered data and don't count sharing or solution files. */
1027 if (ZoneType
[CurFile
] != ZoneType_FEPolygon
&&
1028 ZoneType
[CurFile
] != ZoneType_FEPolyhedron
&&
1029 *ShareConnectivityFromZone
== 0 &&
1030 FileTypes
[CurFile
] != SOLUTIONFILE
)
1031 NumConnectivityNodes
[CurFile
][CurZone
[CurFile
]] = NumIndices
[CurFile
] * JMax
[CurFile
];
1034 * We do not check any return values until the end. If these calls fail,
1035 * WriteFieldDataType below should fail as well.
1037 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)(*ParentZone
) - 1); /* ...ParentZone is zero based for binary file */
1038 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)(*StrandID
) - 1); /* ...StrandID is zero based for binary file */
1039 WriteBinaryReal(HeadFile
[CurFile
], *SolutionTime
, FieldDataType_Double
);
1040 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
) - 1); /* No Zone Color Assignment */
1041 WriteBinaryInt32(HeadFile
[CurFile
], ZoneType
[CurFile
]);
1043 NumDataValuesToWrite
[CurFile
] = 0;
1044 for (I
= 0; I
< NumVars
[CurFile
]; I
++)
1046 IsSharedVar
[CurFile
][I
] = (ShareVarFromZone
!= NULL
&& ShareVarFromZone
[I
] != 0); /* ...shared? */
1047 IsPassiveVar
[CurFile
][I
] = (PassiveVarList
!= NULL
&& PassiveVarList
[I
] == 1); /* ...passive? */
1050 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)(ValueLocation
!= NULL
? 1 : 0)); /* ...are var locations specified? */
1053 for (I
= 0; I
< NumVars
[CurFile
]; I
++)
1059 if (ZoneType
[CurFile
] == ORDERED
)
1061 NumNodes
= IMax
[CurFile
] * JMax
[CurFile
] * KMax
[CurFile
];
1062 NumCells
= (MAX(IMax
[CurFile
] - 1, 1) *
1063 MAX(JMax
[CurFile
] - 1, 1) *
1064 MAX(KMax
[CurFile
] - 1, 1));
1068 NumNodes
= IMax
[CurFile
];
1069 NumCells
= JMax
[CurFile
];
1072 if (IsSharedVar
[CurFile
][I
])
1073 VIndex
= ShareVarFromZone
[I
] - 1;
1078 NumRunningVarValues
[CurFile
][I
] = 0;
1080 NumRunningVarValues
[CurFile
][VIndex
] = NumRunningVarValues
[CurFile
][VIndex
-1];
1082 IsCellCentered
[CurFile
][VIndex
] = (ValueLocation
[I
] == ValueLocation_CellCentered
);
1083 if (ValueLocation
[I
] == ValueLocation_CellCentered
)
1085 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)1);
1086 if (!IsSharedVar
[CurFile
][I
] && !IsPassiveVar
[CurFile
][I
])
1088 NumDataValuesToWrite
[CurFile
] += NumCells
;
1089 NumRunningVarValues
[CurFile
][VIndex
] += NumCells
;
1092 else if (ValueLocation
[I
] == ValueLocation_Nodal
)
1094 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)0);
1095 if (!IsSharedVar
[CurFile
][I
] && !IsPassiveVar
[CurFile
][I
])
1097 NumDataValuesToWrite
[CurFile
] += NumNodes
;
1098 NumRunningVarValues
[CurFile
][VIndex
] += NumNodes
;
1103 #if defined MAKEARCHIVE
1104 PRINT2("Err: (TECZNE112) Bad zone value location for file %d, variable %d.\n", CurFile
+ 1, I
+ 1);
1114 if (ZoneType
[CurFile
] == ORDERED
)
1116 NumNodes
= IMax
[CurFile
] * JMax
[CurFile
] * KMax
[CurFile
];
1120 NumNodes
= IMax
[CurFile
];
1123 for (I
= 0; I
< NumVars
[CurFile
]; I
++)
1126 if (IsSharedVar
[CurFile
][I
])
1127 VIndex
= ShareVarFromZone
[I
] - 1;
1132 NumRunningVarValues
[CurFile
][I
] = 0;
1134 NumRunningVarValues
[CurFile
][VIndex
] = NumRunningVarValues
[CurFile
][VIndex
-1];
1136 IsCellCentered
[CurFile
][VIndex
] = FALSE
;
1137 if (!IsSharedVar
[CurFile
][I
] && !IsPassiveVar
[CurFile
][I
])
1139 NumDataValuesToWrite
[CurFile
] += NumNodes
;
1140 NumRunningVarValues
[CurFile
][VIndex
] += NumNodes
;
1146 * As of binary version 108 Tecplot introduced
1147 * the ability to output its auto-generated face
1148 * neighbor array in its raw form. For now
1149 * TecIO will always decline to perform this
1150 * step and instead fall back to the delivering
1151 * one neighbor at a time.
1153 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)0); /* IsRawFNAvailable */
1155 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)NumFaceConnections
[CurFile
][CurZone
[CurFile
]]);
1156 if (NumFaceConnections
[CurFile
][CurZone
[CurFile
]] > 0)
1158 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)FaceNeighborMode
[CurFile
]);
1159 if (ZoneType
[CurFile
] != ORDERED
)
1160 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)0); /* FEFaceNeighborsComplete */
1163 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)IMax
[CurFile
]);
1164 if (ZoneType
[CurFile
] == FEPOLYGON
||
1165 ZoneType
[CurFile
] == FEPOLYHEDRON
)
1167 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)KMax
[CurFile
]);
1170 * As of binary version 111 these items moved from the data section to
1173 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)TotalNumFaceNodes
[CurFile
][CurZone
[CurFile
]]);
1174 if (TotalNumFaceBndryFaces
[CurFile
] > 0)
1176 /* Each boundary face must have >= 1 boundary connection. */
1177 if (TotalNumFaceBndryConns
[CurFile
] < TotalNumFaceBndryFaces
[CurFile
])
1179 #if defined MAKEARCHIVE
1180 PRINT1("Err: (TECZNE112) There must be at least 1 boundary connection for each boundary face in zone %d.\n",
1181 CurZone
[CurFile
] + 1);
1182 PRINT2(" %d boundary faces and %d boundary connections were specified.\n",
1183 TotalNumFaceBndryFaces
[CurFile
], TotalNumFaceBndryConns
[CurFile
]);
1190 * As a convenience for the ASCII format, TecUtil, and TECIO layers if any
1191 * boundary connections exists we automatically add a no-neighboring
1192 * connection as the first item so that they can user 0 for no-neighboring
1193 * element in the element list regardless if they have boundary connections
1196 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)TotalNumFaceBndryFaces
[CurFile
] + 1); /* ...add a boundary face for no neighboring element as a convenience */
1199 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)TotalNumFaceBndryFaces
[CurFile
]);
1200 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)TotalNumFaceBndryConns
[CurFile
]);
1202 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)JMax
[CurFile
]);
1204 if (ZoneType
[CurFile
] == ORDERED
)
1206 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)KMax
[CurFile
]);
1210 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)ICellMax
[CurFile
]);
1211 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)JCellMax
[CurFile
]);
1212 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)KCellMax
[CurFile
]);
1216 * Aux data. This has to be over-written by the aux data writing routine.
1217 * Because it currently at the end of the header section we don't need to
1218 * keep track of the position for seeking back to it.
1220 WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)0);
1222 WriteBinaryReal(BlckFile
[CurFile
],
1224 FieldDataType_Float
);
1226 for (I
= 0; I
< NumVars
[CurFile
]; I
++)
1228 if (!WriteFieldDataType(BlckFile
[CurFile
],
1229 (FieldDataType_e
)FieldDataType
,
1232 WriteErr("TECZNE112");
1237 /* Passive variable identification */
1240 WriteBinaryInt32(BlckFile
[CurFile
], 1);
1241 for (I
= 0; I
< NumVars
[CurFile
]; I
++)
1242 WriteBinaryInt32(BlckFile
[CurFile
], PassiveVarList
[I
]);
1245 WriteBinaryInt32(BlckFile
[CurFile
], 0);
1247 /* get the CurVar[CurFile] on the first active variable */
1248 CurVar
[CurFile
] = -1;
1249 AdvanceToNextVarWithValues();
1251 /* Variable & Connectivity Sharing */
1252 if (ShareVarFromZone
)
1254 WriteBinaryInt32(BlckFile
[CurFile
], 1);
1255 for (I
= 0; I
< NumVars
[CurFile
]; I
++)
1256 WriteBinaryInt32(BlckFile
[CurFile
], ShareVarFromZone
[I
] - 1);
1259 WriteBinaryInt32(BlckFile
[CurFile
], 0);
1260 WriteBinaryInt32(BlckFile
[CurFile
], *ShareConnectivityFromZone
- 1);
1263 * Create place holders or the variable min/max value. We will come back
1264 * later after writing the data portion with the real min/max values. In the
1265 * mean time, keep track of the starting point so we can seek back to this
1268 MinMaxOffset
[CurFile
][CurZone
[CurFile
]] = (FileOffset_t
)TP_FTELL(BlckFile
[CurFile
]->File
);
1270 for (I
= 0; I
< NumVars
[CurFile
]; I
++)
1272 /* initialize to unset values */
1273 VarMinValue
[CurFile
][I
] = LARGEDOUBLE
;
1274 VarMaxValue
[CurFile
][I
] = -LARGEDOUBLE
;
1276 if (!IsSharedVar
[CurFile
][I
] && !IsPassiveVar
[CurFile
][I
])
1278 WriteBinaryReal(BlckFile
[CurFile
], 0.0, FieldDataType_Double
);
1279 WriteBinaryReal(BlckFile
[CurFile
], 0.0, FieldDataType_Double
);
1283 #if defined MAKEARCHIVE
1284 if (DebugLevel
[CurFile
])
1286 PRINT1("Writing Zone %d:\n", CurZone
[CurFile
] + 1);
1287 PRINT1(" Title = %s\n", ZnTitle
);
1288 PRINT1(" Type = %s\n", ZoneTypes
[ZoneType
[CurFile
]]);
1289 PRINT1(" IMax = %d\n", IMax
[CurFile
]);
1290 PRINT1(" JMax = %d\n", JMax
[CurFile
]);
1291 PRINT1(" KMax = %d\n", KMax
[CurFile
]);
1292 if (ShareVarFromZone
)
1294 char DupList
[1024] = "";
1296 for (I
= 0; I
< NumVars
[CurFile
]; I
++)
1299 strcat(DupList
, ",");
1300 sprintf(&DupList
[strlen(DupList
)], "%d", ShareVarFromZone
[I
]);
1302 PRINT1(" DupList = %s\n", DupList
);
1310 INTEGER4 LIBCALL
TECZNE111(char *ZnTitle
,
1312 INTEGER4
*IMxOrNumPts
,
1313 INTEGER4
*JMxOrNumElements
,
1314 INTEGER4
*KMxOrNumFaces
,
1318 double *SolutionTime
,
1320 INTEGER4
*ParentZone
,
1322 INTEGER4
*NumFaceConn
,
1324 INTEGER4
*NumFaceNodes
,
1325 INTEGER4
*NumFaceBndryFaces
,
1326 INTEGER4
*NumFaceBndryConns
,
1327 INTEGER4
*PassiveVarList
,
1328 INTEGER4
*ValueLocation
,
1329 INTEGER4
*ShareVarFromZone
,
1330 INTEGER4
*ShareConnectivityFromZone
)
1332 return TECZNE112(ZnTitle
,
1352 ShareConnectivityFromZone
);
1355 INTEGER4 LIBCALL
TECZNE110(char *ZnTitle
,
1357 INTEGER4
*IMxOrNumPts
,
1358 INTEGER4
*JMxOrNumElements
,
1363 double *SolutionTime
,
1365 INTEGER4
*ParentZone
,
1367 INTEGER4
*NumFaceConn
,
1369 INTEGER4
*PassiveVarList
,
1370 INTEGER4
*ValueLocation
,
1371 INTEGER4
*ShareVarFromZone
,
1372 INTEGER4
*ShareConnectivityFromZone
)
1374 INTEGER4 NumFaceNodes
= 0;
1375 INTEGER4 NumFaceBndryFaces
= 0;
1376 INTEGER4 NumFaceBndryConns
= 0;
1378 return TECZNE112(ZnTitle
,
1398 ShareConnectivityFromZone
);
1401 INTEGER4 LIBCALL
TECZNE100(char *ZnTitle
,
1403 INTEGER4
*IMxOrNumPts
,
1404 INTEGER4
*JMxOrNumElements
,
1410 INTEGER4
*NumFaceConn
,
1412 INTEGER4
*ValueLocation
,
1413 INTEGER4
*ShareVarFromZone
,
1414 INTEGER4
*ShareConnectivityFromZone
)
1416 double SolutionTime
= 0.0;
1417 INTEGER4 StrandID
= STRAND_ID_STATIC
+ 1; /* TECXXX is ones based for StrandID */
1418 INTEGER4 ParentZone
= BAD_SET_VALUE
+ 1; /* TECXXX is ones based for ParentZone */
1419 INTEGER4 NumFaceNodes
= 0;
1420 INTEGER4 NumFaceBndryFaces
= 0;
1421 INTEGER4 NumFaceBndryConns
= 0;
1423 return TECZNE112(ZnTitle
,
1440 NULL
, /* PassiveVarList */
1443 ShareConnectivityFromZone
);
1446 #if !defined INDEX_16_BIT // not supported in this test-only mode
1447 INTEGER4 LIBCALL
TECZNE(char *ZoneTitle
,
1457 LgIndex_t
*ShareVarFromZone
= NULL
;
1458 LgIndex_t ShareConnectivityFromZone
;
1459 LgIndex_t Result
= 0;
1462 if (ZFormat
== NULL
)
1464 else if (!strcmp(ZFormat
, "BLOCK"))
1467 ZoneType
= ZoneType_Ordered
;
1469 else if (!strcmp(ZFormat
, "FEBLOCK"))
1477 * ZoneType 0=ORDERED,1=FELINESEG,2=FETRIANGLE,
1478 * 3=FEQUADRILATERAL,4=FETETRAHEDRON,5=FEBRICK
1480 case 0: /* Triangular. */
1483 case 1: /* Quadrilateral */
1486 case 2: /* Tetrahedral */
1489 case 3: /* Brick. */
1494 else if (!strcmp(ZFormat
, "POINT"))
1497 ZoneType
= ZoneType_Ordered
;
1499 else if (!strcmp(ZFormat
, "FEPOINT"))
1504 case 0: /* Triangular. */
1507 case 1: /* Quadrilateral */
1510 case 2: /* Tetrahedral */
1513 case 3: /* Brick. */
1521 ShareConnectivityFromZone
= 0;
1526 !ParseDupList(&ShareVarFromZone
, &ShareConnectivityFromZone
, DupList
))
1531 /*Result = TECZNE((char *)ZoneTitle, IMx, JMx, KMx, (char *)ZFormat,(char*)DupList);*/
1534 INTEGER4 ICellMx
= 0;
1535 INTEGER4 JCellMx
= 0;
1536 INTEGER4 KCellMx
= 0;
1537 INTEGER4 NumFaceConnections
= 0;
1538 INTEGER4 FaceNeighborMode
= FaceNeighborMode_LocalOneToOne
;
1539 double SolutionTime
= 0.0;
1540 INTEGER4 StrandID
= STRAND_ID_STATIC
+ 1; /* TECXXX is ones based for StrandID */
1541 INTEGER4 ParentZone
= BAD_SET_VALUE
+ 1; /* TECXXX is ones based for ParentZone */
1542 INTEGER4 NumFaceNodes
= 0;
1543 INTEGER4 NumFaceBndryFaces
= 0;
1544 INTEGER4 NumFaceBndryConns
= 0;
1546 Result
= TECZNE112((char *)ZoneTitle
,
1558 &NumFaceConnections
,
1563 NULL
, /* PassiveVarList */
1564 NULL
, /* ValueLocation */
1565 DupList
? ShareVarFromZone
: NULL
,
1566 &ShareConnectivityFromZone
);
1570 if (ShareVarFromZone
)
1571 FREE_ARRAY(ShareVarFromZone
, "Variable sharing list");
1573 return (INTEGER4
) Result
;
1575 #endif // INDEX_16_BIT -- not supported in this test-only mode
1577 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
1578 LIBFUNCTION INTEGER4 LIBCALL
teczne112_(char *ZoneTitle
,
1580 INTEGER4
*IMxOrNumPts
,
1581 INTEGER4
*JMxOrNumElements
,
1586 double *SolutionTime
,
1588 INTEGER4
*ParentZone
,
1590 INTEGER4
*NumFaceConn
,
1592 INTEGER4
*NumFaceNodes
,
1593 INTEGER4
*NumFaceBndryFaces
,
1594 INTEGER4
*NumFaceBndryConns
,
1595 INTEGER4
*PassiveVarList
,
1596 INTEGER4
*ValueLocation
,
1597 INTEGER4
*ShareVarFromZone
,
1598 INTEGER4
*ShareConnectivityFromZone
)
1600 return TECZNE112(ZoneTitle
,
1620 ShareConnectivityFromZone
);
1623 LIBFUNCTION INTEGER4 LIBCALL
teczne111_(char *ZoneTitle
,
1625 INTEGER4
*IMxOrNumPts
,
1626 INTEGER4
*JMxOrNumElements
,
1631 double *SolutionTime
,
1633 INTEGER4
*ParentZone
,
1635 INTEGER4
*NumFaceConn
,
1637 INTEGER4
*NumFaceNodes
,
1638 INTEGER4
*NumFaceBndryFaces
,
1639 INTEGER4
*NumFaceBndryConns
,
1640 INTEGER4
*PassiveVarList
,
1641 INTEGER4
*ValueLocation
,
1642 INTEGER4
*ShareVarFromZone
,
1643 INTEGER4
*ShareConnectivityFromZone
)
1645 return TECZNE112(ZoneTitle
,
1665 ShareConnectivityFromZone
);
1668 LIBFUNCTION INTEGER4 LIBCALL
teczne110_(char *ZoneTitle
,
1670 INTEGER4
*IMxOrNumPts
,
1671 INTEGER4
*JMxOrNumElements
,
1676 double *SolutionTime
,
1678 INTEGER4
*ParentZone
,
1680 INTEGER4
*NumFaceConn
,
1682 INTEGER4
*PassiveVarList
,
1683 INTEGER4
*ValueLocation
,
1684 INTEGER4
*ShareVarFromZone
,
1685 INTEGER4
*ShareConnectivityFromZone
)
1687 INTEGER4 NumFaceNodes
= 0;
1688 INTEGER4 NumFaceBndryFaces
= 0;
1689 INTEGER4 NumFaceBndryConns
= 0;
1691 return TECZNE112(ZoneTitle
,
1711 ShareConnectivityFromZone
);
1714 LIBFUNCTION INTEGER4 LIBCALL
teczne100_(char *ZoneTitle
,
1716 INTEGER4
*IMxOrNumPts
,
1717 INTEGER4
*JMxOrNumElements
,
1723 INTEGER4
*NumFaceConn
,
1725 INTEGER4
*ValueLocation
,
1726 INTEGER4
*ShareVarFromZone
,
1727 INTEGER4
*ShareConnectivityFromZone
)
1729 return TECZNE100(ZoneTitle
,
1742 ShareConnectivityFromZone
);
1745 LIBFUNCTION INTEGER4 LIBCALL
teczne_(char *ZoneTitle
,
1752 return TECZNE(ZoneTitle
,
1762 * Rewrite the var min/max place holders which currently have zero in them.
1764 static void RewritePendingMinMaxValues(void)
1766 FileOffset_t CurrentOffset
= (FileOffset_t
)TP_FTELL(BlckFile
[CurFile
]->File
);
1768 TP_FSEEK(BlckFile
[CurFile
]->File
, MinMaxOffset
[CurFile
][CurZone
[CurFile
]], SEEK_SET
);
1770 for (I
= 0; I
< NumVars
[CurFile
]; I
++)
1772 if (!IsSharedVar
[CurFile
][I
] && !IsPassiveVar
[CurFile
][I
])
1774 WriteBinaryReal(BlckFile
[CurFile
], VarMinValue
[CurFile
][I
], FieldDataType_Double
);
1775 WriteBinaryReal(BlckFile
[CurFile
], VarMaxValue
[CurFile
][I
], FieldDataType_Double
);
1779 /* return the original position */
1780 TP_FSEEK(BlckFile
[CurFile
]->File
, CurrentOffset
, SEEK_SET
);
1786 INTEGER4 LIBCALL
TECDAT112(INTEGER4
*N
,
1791 double *dptr
= (double *)Data
;
1792 float *fptr
= (float *)Data
;
1794 if (CheckFile("TECDAT112") < 0)
1797 #if defined MAKEARCHIVE
1798 if (DebugLevel
[CurFile
] && (*N
> 1))
1799 PRINT2("Writing %d values to file %d.\n", *N
, CurFile
+ 1);
1802 for (I
= 0; I
< *N
; I
++)
1804 double Value
= (*IsDouble
== 1 ? dptr
[I
] : fptr
[I
]);
1806 /* keep track of var min/max */
1807 if (Value
< VarMinValue
[CurFile
][CurVar
[CurFile
]])
1808 VarMinValue
[CurFile
][CurVar
[CurFile
]] = Value
;
1809 if (Value
> VarMaxValue
[CurFile
][CurVar
[CurFile
]])
1810 VarMaxValue
[CurFile
][CurVar
[CurFile
]] = Value
;
1812 if (!WriteBinaryReal(BlckFile
[CurFile
], Value
, (FieldDataType_e
)FieldDataType
))
1814 WriteErr("TECDAT112");
1819 * As of version 103 Tecplot writes binary data files so that the ordered
1820 * cell centered field data includes the ghost cells. This makes it much
1821 * easier for Tecplot to map the data when reading by simply writing out
1822 * field data's as a block. As of version 104 the ghost cells of the
1823 * slowest moving index are not included.
1825 if (IsCellCentered
[CurFile
][CurVar
[CurFile
]] && ZoneType
[CurFile
] == ORDERED
)
1827 CHECK(IsBlock
[CurFile
]); /* ...ordered CC data must be block format */
1828 LgIndex_t PIndex
= (NumOrderedCCDataValuesWritten
[CurFile
]);
1829 LgIndex_t FinalIMax
= MAX(IMax
[CurFile
] - 1, 1);
1830 LgIndex_t FinalJMax
= MAX(JMax
[CurFile
] - 1, 1);
1831 LgIndex_t FinalKMax
= MAX(KMax
[CurFile
] - 1, 1);
1832 LgIndex_t IIndex
= (PIndex
% IMax
[CurFile
]);
1833 LgIndex_t JIndex
= ((PIndex
% (IMax
[CurFile
] * JMax
[CurFile
])) / IMax
[CurFile
]);
1834 LgIndex_t KIndex
= (PIndex
/ (IMax
[CurFile
] * JMax
[CurFile
]));
1835 LgIndex_t IMaxAdjust
= 0;
1836 LgIndex_t JMaxAdjust
= 0;
1837 LgIndex_t KMaxAdjust
= 0;
1838 if (KMax
[CurFile
] > 1)
1839 KMaxAdjust
= 1; /* ...K is slowest */
1840 else if (JMax
[CurFile
] > 1)
1841 JMaxAdjust
= 1; /* ...J is slowest */
1842 else if (IMax
[CurFile
] > 1)
1843 IMaxAdjust
= 1; /* ...I is slowest */
1845 if (IIndex
+ 1 == FinalIMax
&& FinalIMax
< IMax
[CurFile
] - IMaxAdjust
)
1847 NumOrderedCCDataValuesWritten
[CurFile
]++;
1848 if (!WriteBinaryReal(BlckFile
[CurFile
], 0.0, (FieldDataType_e
)FieldDataType
))
1850 WriteErr("TECDAT112");
1854 if (IIndex
+ 1 == FinalIMax
&&
1855 (JIndex
+ 1 == FinalJMax
&& FinalJMax
< JMax
[CurFile
] - JMaxAdjust
))
1858 for (II
= 1; II
<= IMax
[CurFile
] - IMaxAdjust
; II
++)
1860 NumOrderedCCDataValuesWritten
[CurFile
]++;
1861 if (!WriteBinaryReal(BlckFile
[CurFile
], 0.0, (FieldDataType_e
)FieldDataType
))
1863 WriteErr("TECDAT112");
1868 if (IIndex
+ 1 == FinalIMax
&&
1869 JIndex
+ 1 == FinalJMax
&&
1870 (KIndex
+ 1 == FinalKMax
&& FinalKMax
< KMax
[CurFile
] - KMaxAdjust
))
1873 for (JJ
= 1; JJ
<= JMax
[CurFile
] - JMaxAdjust
; JJ
++)
1874 for (II
= 1; II
<= IMax
[CurFile
] - IMaxAdjust
; II
++)
1876 NumOrderedCCDataValuesWritten
[CurFile
]++;
1877 if (!WriteBinaryReal(BlckFile
[CurFile
], 0.0, (FieldDataType_e
)FieldDataType
))
1879 WriteErr("TECDAT112");
1885 /* increment for the original cell value */
1886 NumOrderedCCDataValuesWritten
[CurFile
]++;
1889 /* update the number of data points written */
1890 NumDataValuesWritten
[CurFile
]++;
1892 if (IsBlock
[CurFile
])
1894 /* for block format update the variable when all values have been given */
1895 if (NumRunningVarValues
[CurFile
][CurVar
[CurFile
]] == NumDataValuesWritten
[CurFile
])
1897 AdvanceToNextVarWithValues(); /* ...move on to the next variable */
1898 if (CurVar
[CurFile
] < NumVars
[CurFile
] &&
1899 IsCellCentered
[CurFile
][CurVar
[CurFile
]] &&
1900 ZoneType
[CurFile
] == ORDERED
)
1901 NumOrderedCCDataValuesWritten
[CurFile
] = 0; /* reset for next CC variable */
1906 /* for point format update the variable after each value */
1907 AdvanceToNextVarWithValues();
1908 if (CurVar
[CurFile
] >= NumVars
[CurFile
])
1910 /* reset to the first active variable */
1911 CurVar
[CurFile
] = -1;
1912 AdvanceToNextVarWithValues();
1916 #if defined MAKEARCHIVE
1917 if (DebugLevel
[CurFile
] > 1)
1918 PRINT2("%d %G\n", NumDataValuesWritten
[CurFile
] + I
+ 1, Value
);
1923 * If this is the last call to TECDAT112,
1924 * then we may have to set the 'repeat adjacency list'
1927 if (HasFECONNECT
[CurFile
] &&
1929 /* (essentialy this is CheckData() but we don't want to print
1930 an error message) */
1931 (NumDataValuesToWrite
[CurFile
] == NumDataValuesWritten
[CurFile
]))
1933 if (!WriteBinaryInt32(BlckFile
[CurFile
], (LgIndex_t
)1))
1935 WriteErr("TECDAT112");
1940 /* re-write min/max values when all data has been delivered */
1941 if (NumDataValuesToWrite
[CurFile
] == NumDataValuesWritten
[CurFile
])
1942 RewritePendingMinMaxValues();
1947 INTEGER4 LIBCALL
TECDAT111(INTEGER4
*N
,
1956 INTEGER4 LIBCALL
TECDAT110(INTEGER4
*N
,
1965 INTEGER4 LIBCALL
TECDAT100(INTEGER4
*N
,
1974 INTEGER4 LIBCALL
TECDAT(INTEGER4
*N
,
1983 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
1984 LIBFUNCTION INTEGER4 LIBCALL
tecdat112_(INTEGER4
*N
,
1988 return TECDAT112(N
, Data
, IsDouble
);
1991 LIBFUNCTION INTEGER4 LIBCALL
tecdat111_(INTEGER4
*N
,
1995 return TECDAT112(N
, Data
, IsDouble
);
1998 LIBFUNCTION INTEGER4 LIBCALL
tecdat110_(INTEGER4
*N
,
2002 return TECDAT112(N
, Data
, IsDouble
);
2005 LIBFUNCTION INTEGER4 LIBCALL
tecdat100_(INTEGER4
*N
,
2009 return TECDAT112(N
, Data
, IsDouble
);
2012 LIBFUNCTION INTEGER4 LIBCALL
tecdat_(INTEGER4
*N
,
2025 INTEGER4 LIBCALL
TECNOD112(INTEGER4
*NData
)
2027 LgIndex_t L
= NumConnectivityNodes
[CurFile
][CurZone
[CurFile
]];
2030 ConnectivityWritten
[CurFile
][CurZone
[CurFile
]] = TRUE
;
2032 if (CheckFile("TECNOD112") < 0)
2035 if (ZoneType
[CurFile
] == FEPOLYGON
||
2036 ZoneType
[CurFile
] == FEPOLYHEDRON
)
2038 /* Wrong way to specify connectivity for polygons and polyhedrons */
2039 #if defined MAKEARCHIVE
2040 PRINT0("Err: (TECNOD112) Cannot call TECNOD112 for polygonal or polyhedral zones.\n");
2046 if (HasFECONNECT
[CurFile
])
2049 * The connectivity list is duplicated,
2050 * so we shouldn't be calling TECNOD112()
2055 if (FileTypes
[CurFile
] == SOLUTIONFILE
)
2057 #if defined MAKEARCHIVE
2058 PRINT0("Err: (TECNOD112) Cannot call TECNOD112 if file type is SOLUTIONFILE.\n");
2064 if (ZoneType
[CurFile
] == ORDERED
)
2066 #if defined MAKEARCHIVE
2067 PRINT0("Err: (TECNOD112) Cannot call TECNOD110 if zone type is ORDERED.\n");
2073 if (CheckData("TECNOD112") < 0)
2076 for (I
= 0; I
< L
; I
++)
2078 if ((NData
[I
] > IMax
[CurFile
]) ||
2081 #if defined MAKEARCHIVE
2082 PRINT1("Err: (TECNOD112) Invalid node map value at position %d:\n", I
);
2083 PRINT2(" node map value = %d, max value = %d.\n", NData
[I
], IMax
[CurFile
]);
2089 * As of version 103 Tecplot assumes that node maps are zero based
2090 * instead of ones based. Since we have to maintain the contract we
2091 * subtract 1 for the caller.
2093 if (!WriteBinaryInt32(BlckFile
[CurFile
], NData
[I
] - 1)) /* zero based */
2095 WriteErr("TECNOD112");
2102 INTEGER4 LIBCALL
TECNOD111(INTEGER4
*NData
)
2104 return TECNOD112(NData
);
2107 INTEGER4 LIBCALL
TECNOD110(INTEGER4
*NData
)
2109 return TECNOD112(NData
);
2112 INTEGER4 LIBCALL
TECNOD100(INTEGER4
*NData
)
2114 return TECNOD112(NData
);
2117 INTEGER4 LIBCALL
TECNOD(INTEGER4
*NData
)
2119 return TECNOD112(NData
);
2122 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
2123 LIBFUNCTION INTEGER4 LIBCALL
tecnod112_(INTEGER4
*NData
)
2125 return TECNOD112(NData
);
2128 LIBFUNCTION INTEGER4 LIBCALL
tecnod111_(INTEGER4
*NData
)
2130 return TECNOD112(NData
);
2133 LIBFUNCTION INTEGER4 LIBCALL
tecnod110_(INTEGER4
*NData
)
2135 return TECNOD112(NData
);
2138 LIBFUNCTION INTEGER4 LIBCALL
tecnod100_(INTEGER4
*NData
)
2140 return TECNOD112(NData
);
2143 LIBFUNCTION INTEGER4 LIBCALL
tecnod_(INTEGER4
*NData
)
2145 return TECNOD112(NData
);
2152 INTEGER4 LIBCALL
TECEND112(void)
2157 * Validate that all zone data was given for the file since there are no
2158 * more chances to give it. Note that solution files don't define the
2159 * connectivity again.
2161 if (FileTypes
[CurFile
] != SOLUTIONFILE
)
2163 for (int ZoneIndex
= 0; (RetVal
== 0) && (ZoneIndex
<= CurZone
[CurFile
]); ZoneIndex
++)
2165 if (((NumConnectivityNodes
[CurFile
][ZoneIndex
] > 0) &&
2166 (ConnectivityWritten
[CurFile
][ZoneIndex
] == FALSE
)))
2168 #if defined MAKEARCHIVE
2169 PRINT1("Err: (TECEND112) File %d is being closed without writing connectivity data.\n", CurFile
+ 1);
2170 PRINT1(" Zone %d was defined with a Classic FE zone type but TECNOD112() was not called.\n", ZoneIndex
+ 1);
2175 if (((NumFaceConnections
[CurFile
][ZoneIndex
] > 0) &&
2176 (FaceNeighborsOrMapWritten
[CurFile
][ZoneIndex
] == FALSE
)))
2178 #if defined MAKEARCHIVE
2179 PRINT1("Err: (TECEND112) File %d is being closed without writing face neighbor data.\n", CurFile
+ 1);
2180 PRINT2(" %d connections were specified for zone %d but TECFACE112() was not called.\n",
2181 NumFaceConnections
[CurFile
][ZoneIndex
], ZoneIndex
+ 1);
2186 else if (((TotalNumFaceNodes
[CurFile
][ZoneIndex
] > 0) &&
2187 (FaceNeighborsOrMapWritten
[CurFile
][ZoneIndex
] == FALSE
)))
2189 #if defined MAKEARCHIVE
2190 PRINT1("Err: (TECEND112) File %d is being closed without writing face map data.\n", CurFile
+ 1);
2191 PRINT2(" %d face nodes were specified for zone %d but TECPOLY112() was not called.\n",
2192 TotalNumFaceNodes
[CurFile
][ZoneIndex
], ZoneIndex
+ 1);
2202 if (CheckFile("TECEND112") < 0)
2208 if (CheckData("TECEND112") < 0)
2213 if (!WriteBinaryReal(HeadFile
[CurFile
], EndHeaderMarker
, FieldDataType_Float
))
2215 WriteErr("TECEND112");
2219 CloseFileStream(&BlckFile
[CurFile
]);
2223 BlckFile
[CurFile
] = OpenFileStream(BlckFName
[CurFile
], "rb", IsWritingNative
[CurFile
]);
2225 /* Append data from BlckFile to HeadFile... */
2226 char buffer
[BYTES_PER_CHUNK
];
2227 size_t bytesRead
= 0;
2228 while ((RetVal
== 0) &&
2229 (feof(BlckFile
[CurFile
]->File
) == 0))
2231 bytesRead
= fread((void*)buffer
, 1, BYTES_PER_CHUNK
, BlckFile
[CurFile
]->File
);
2232 if (ferror(BlckFile
[CurFile
]->File
) == 0)
2234 if (bytesRead
!= fwrite((void*)buffer
, 1, bytesRead
, HeadFile
[CurFile
]->File
))
2236 /* do not call WriteErr, use custom message instead */
2237 #if defined MAKEARCHIVE
2238 PRINT1("Err: (TECEND112) Write failure during repack on file %d.\n", CurFile
+ 1);
2246 /* do not call WriteErr, use custom message instead */
2247 #if defined MAKEARCHIVE
2248 PRINT1("Err: (TECEND112) Write failure during repack on file %d.\n", CurFile
+ 1);
2254 CloseFileStream(&BlckFile
[CurFile
]);
2257 TP_UNLINK(BlckFName
[CurFile
]);
2259 CloseFileStream(&HeadFile
[CurFile
]);
2261 #if defined MAKEARCHIVE
2262 if (DebugLevel
[CurFile
])
2264 PRINT1("File %d closed.\n", CurFile
+ 1);
2265 if (NumErrs
[CurFile
])
2267 PRINT0("********************************************\n");
2268 PRINT1(" %d Errors occurred on this file\n", NumErrs
[CurFile
]);
2269 PRINT0("********************************************\n");
2274 NumErrs
[CurFile
] = 0;
2275 IsOpen
[CurFile
] = 0;
2276 if (DestFName
[CurFile
])
2277 FREE_ARRAY(DestFName
[CurFile
], "data set fname");
2278 if (BlckFName
[CurFile
])
2279 FREE_ARRAY(BlckFName
[CurFile
], "data set fname");
2280 BlckFName
[CurFile
] = NULL
;
2281 DestFName
[CurFile
] = NULL
;
2283 /* reset arrays sized by number of variables */
2284 VarMinValue
[CurFile
].clear();
2285 VarMaxValue
[CurFile
].clear();
2286 NumRunningVarValues
[CurFile
].clear();
2287 IsSharedVar
[CurFile
].clear();
2288 IsPassiveVar
[CurFile
].clear();
2289 IsCellCentered
[CurFile
].clear();
2291 /* reset arrays sized by number of zones */
2292 MinMaxOffset
[CurFile
].clear();
2293 TotalNumFaceNodes
[CurFile
].clear();
2294 NumFaceConnections
[CurFile
].clear();
2295 FaceNeighborsOrMapWritten
[CurFile
].clear();
2296 NumConnectivityNodes
[CurFile
].clear();
2297 ConnectivityWritten
[CurFile
].clear();
2300 while ((CurFile
< MaxNumFiles
) && !IsOpen
[CurFile
])
2303 if (CurFile
== MaxNumFiles
)
2309 INTEGER4 LIBCALL
TECEND111(void)
2314 INTEGER4 LIBCALL
TECEND110(void)
2319 INTEGER4 LIBCALL
TECEND100(void)
2324 INTEGER4 LIBCALL
TECEND(void)
2329 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
2330 LIBFUNCTION INTEGER4 LIBCALL
tecend112_(void)
2335 LIBFUNCTION INTEGER4 LIBCALL
tecend111_(void)
2340 LIBFUNCTION INTEGER4 LIBCALL
tecend110_(void)
2345 LIBFUNCTION INTEGER4 LIBCALL
tecend100_(void)
2350 LIBFUNCTION INTEGER4 LIBCALL
tecend_(void)
2359 static void GetNextLabel(const char **CPtr
,
2363 char *NPtr
= NextLabel
;
2365 /* Find label start */
2366 while ((**CPtr
) && (**CPtr
!= '"'))
2370 while ((N
< 60) && (**CPtr
) && (**CPtr
!= '"'))
2389 INTEGER4 LIBCALL
TECLAB112(char *S
)
2391 const char *CPtr
= (const char *)S
;
2395 if (CheckFile("TECLAB112") < 0)
2398 #if defined MAKEARCHIVE
2399 if (DebugLevel
[CurFile
])
2400 PRINT0("\nInserting Custom Labels:\n");
2405 GetNextLabel(&CPtr
, Label
);
2413 #if defined MAKEARCHIVE
2414 PRINT1("Err: (TECLAB112) Invalid custom label string: %s\n",
2421 WriteBinaryReal(HeadFile
[CurFile
], CustomLabelMarker
, FieldDataType_Float
);
2422 if (!WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)N
))
2424 WriteErr("TECLAB112");
2428 CPtr
= (const char *)S
;
2431 GetNextLabel(&CPtr
, Label
);
2434 if (!DumpDatafileString(HeadFile
[CurFile
], Label
, TRUE
))
2436 WriteErr("TECLAB112");
2439 #if defined MAKEARCHIVE
2440 if (DebugLevel
[CurFile
])
2441 printf(" %s\n", Label
);
2450 INTEGER4 LIBCALL
TECLAB111(char *S
)
2452 return TECLAB112(S
);
2455 INTEGER4 LIBCALL
TECLAB110(char *S
)
2457 return TECLAB112(S
);
2460 INTEGER4 LIBCALL
TECLAB100(char *S
)
2462 return TECLAB112(S
);
2465 INTEGER4 LIBCALL
TECLAB(char *S
)
2467 return TECLAB112(S
);
2470 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
2471 LIBFUNCTION INTEGER4 LIBCALL
teclab112_(char *S
)
2473 return TECLAB112(S
);
2476 LIBFUNCTION INTEGER4 LIBCALL
teclab111_(char *S
)
2478 return TECLAB112(S
);
2481 LIBFUNCTION INTEGER4 LIBCALL
teclab110_(char *S
)
2483 return TECLAB112(S
);
2486 LIBFUNCTION INTEGER4 LIBCALL
teclab100_(char *S
)
2488 return TECLAB112(S
);
2491 LIBFUNCTION INTEGER4 LIBCALL
teclab_(char *S
)
2493 return TECLAB112(S
);
2501 INTEGER4 LIBCALL
TECUSR112(char *S
)
2503 if (CheckFile("TECUSR112") < 0)
2506 #if defined MAKEARCHIVE
2507 if (DebugLevel
[CurFile
])
2508 PRINT1("\nInserting UserRec: %s\n", S
);
2511 if ((S
== NULL
) || (*S
== '\0'))
2513 #if defined MAKEARCHIVE
2514 PRINT0("Err: (TECUSR112) Invalid TECUSR110 string\n");
2520 WriteBinaryReal(HeadFile
[CurFile
], UserRecMarker
, FieldDataType_Float
);
2521 if (!DumpDatafileString(HeadFile
[CurFile
], S
, TRUE
))
2523 #if defined MAKEARCHIVE
2524 if (DebugLevel
[CurFile
])
2525 printf("Err: (TECUSR112) Write failure for file %d\n", CurFile
+ 1);
2533 INTEGER4 LIBCALL
TECUSR111(char *S
)
2535 return TECUSR112(S
);
2538 INTEGER4 LIBCALL
TECUSR110(char *S
)
2540 return TECUSR112(S
);
2543 INTEGER4 LIBCALL
TECUSR100(char *S
)
2545 return TECUSR112(S
);
2548 INTEGER4 LIBCALL
TECUSR(char *S
)
2550 return TECUSR112(S
);
2553 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
2554 LIBFUNCTION INTEGER4 LIBCALL
tecusr112_(char *S
)
2556 return TECUSR112(S
);
2559 LIBFUNCTION INTEGER4 LIBCALL
tecusr111_(char *S
)
2561 return TECUSR112(S
);
2564 LIBFUNCTION INTEGER4 LIBCALL
tecusr110_(char *S
)
2566 return TECUSR112(S
);
2569 LIBFUNCTION INTEGER4 LIBCALL
tecusr100_(char *S
)
2571 return TECUSR112(S
);
2574 LIBFUNCTION INTEGER4 LIBCALL
tecusr_(char *S
)
2576 return TECUSR112(S
);
2580 #if 0 // NOT_CURRENTLY_USED
2581 static int WriteGeomDataBlock(float *Data
,
2586 for (I
= 0; I
< NumPts
; I
++)
2588 if (!WriteBinaryReal(HeadFile
[CurFile
], Data
[I
], FieldDataType_Float
))
2597 static void ShowDebugColor(LgIndex_t Color
)
2599 #if defined MAKEARCHIVE
2602 case 0 : PRINT0("BLACK\n"); break;
2603 case 1 : PRINT0("RED\n"); break;
2604 case 2 : PRINT0("GREEN\n"); break;
2605 case 3 : PRINT0("BLUE\n"); break;
2606 case 4 : PRINT0("CYAN\n"); break;
2607 case 5 : PRINT0("YELLOW\n"); break;
2608 case 6 : PRINT0("PURPLE\n"); break;
2609 case 7 : PRINT0("WHITE\n"); break;
2617 case 15: PRINT1("CUSTOM%1d\n", Color
-7); break;
2618 default : PRINT0("INVALID\n");
2622 #endif /* NOT_CURRENTLY_USED */
2628 INTEGER4 LIBCALL
TECGEO112(double *XOrThetaPos
,
2631 INTEGER4
*PosCoordMode
, /* 0=Grid, 1=Frame, 3=Grid3D */
2632 INTEGER4
*AttachToZone
,
2635 INTEGER4
*FillColor
,
2638 INTEGER4
*LinePattern
,
2639 double *PatternLength
,
2640 double *LineThickness
,
2641 INTEGER4
*NumEllipsePts
,
2642 INTEGER4
*ArrowheadStyle
,
2643 INTEGER4
*ArrowheadAttachment
,
2644 double *ArrowheadSize
,
2645 double *ArrowheadAngle
,
2648 INTEGER4
*NumSegments
,
2649 INTEGER4
*NumSegPts
,
2650 float *XOrThetaGeomData
,
2651 float *YOrRGeomData
,
2656 int RawDataSize
= 0;
2661 if (CheckFile("TECGEO112") < 0)
2664 Geom
.PositionCoordSys
= (CoordSys_e
) * PosCoordMode
;
2665 if (Geom
.PositionCoordSys
== CoordSys_Frame
)
2670 Geom
.AnchorPos
.Generic
.V1
= (*XOrThetaPos
) * Fract
;
2671 Geom
.AnchorPos
.Generic
.V2
= (*YOrRPos
) * Fract
;
2672 Geom
.AnchorPos
.Generic
.V3
= (*ZPos
) * Fract
;
2673 Geom
.AttachToZone
= *AttachToZone
!= 0;
2674 Geom
.Zone
= *Zone
- 1;
2675 Geom
.BColor
= (ColorIndex_t
) * Color
;
2676 Geom
.FillBColor
= (ColorIndex_t
) * FillColor
;
2677 Geom
.IsFilled
= *IsFilled
;
2678 Geom
.GeomType
= (GeomType_e
) * GeomType
;
2679 Geom
.LinePattern
= (LinePattern_e
) * LinePattern
;
2680 Geom
.PatternLength
= *PatternLength
/ 100.0;
2681 Geom
.LineThickness
= *LineThickness
/ 100.0;
2682 Geom
.NumEllipsePts
= *NumEllipsePts
;
2683 Geom
.ArrowheadStyle
= (ArrowheadStyle_e
) * ArrowheadStyle
;
2684 Geom
.ArrowheadAttachment
= (ArrowheadAttachment_e
) * ArrowheadAttachment
;
2685 Geom
.ArrowheadSize
= *ArrowheadSize
/ 100.0;
2686 Geom
.ArrowheadAngle
= *ArrowheadAngle
/ DEGPERRADIANS
;
2687 Geom
.Scope
= (Scope_e
) * Scope
;
2688 Geom
.DrawOrder
= DrawOrder_AfterData
;
2689 Geom
.Clipping
= (Clipping_e
) * Clipping
;
2690 Geom
.NumSegments
= *NumSegments
;
2691 Geom
.MacroFunctionCommand
= mfc
;
2692 Geom
.ImageFileName
= NULL
;
2693 Geom
.ImageNumber
= 0;
2694 Geom
.MaintainAspectRatio
= TRUE
;
2695 Geom
.PixelAspectRatio
= 1.0;
2696 Geom
.ImageResizeFilter
= ImageResizeFilter_Texture
;
2698 if (Geom
.GeomType
== GeomType_LineSegs3D
)
2700 Geom
.GeomType
= GeomType_LineSegs
;
2701 Geom
.PositionCoordSys
= CoordSys_Grid3D
;
2704 #if defined MAKEARCHIVE
2705 if (DebugLevel
[CurFile
])
2706 PRINT0("\nInserting Geometry\n");
2709 switch (Geom
.GeomType
)
2711 case GeomType_LineSegs
:
2715 for (I
= 0; I
< *NumSegments
; I
++)
2717 Geom
.NumSegPts
[I
] = NumSegPts
[I
];
2718 RawDataSize
+= NumSegPts
[I
];
2721 case GeomType_Rectangle
:
2722 case GeomType_Square
:
2723 case GeomType_Circle
:
2724 case GeomType_Ellipse
:
2728 case GeomType_Image
:
2730 CHECK(FALSE
); /* Images not allowed in data files. */
2738 Geom
.DataType
= FieldDataType_Float
;
2739 Geom
.GeomData
.Generic
.V1Base
= AllocScratchNodalFieldDataPtr(RawDataSize
, FieldDataType_Float
, TRUE
);
2740 Geom
.GeomData
.Generic
.V2Base
= AllocScratchNodalFieldDataPtr(RawDataSize
, FieldDataType_Float
, TRUE
);
2741 Geom
.GeomData
.Generic
.V3Base
= AllocScratchNodalFieldDataPtr(RawDataSize
, FieldDataType_Float
, TRUE
);
2743 for (I
= 0; I
< RawDataSize
; I
++)
2745 SetFieldValue(Geom
.GeomData
.Generic
.V1Base
, I
, (double)XOrThetaGeomData
[I
]*Fract
);
2746 SetFieldValue(Geom
.GeomData
.Generic
.V2Base
, I
, (double)YOrRGeomData
[I
]*Fract
);
2747 SetFieldValue(Geom
.GeomData
.Generic
.V3Base
, I
, (double)ZGeomData
[I
]*Fract
);
2750 if (DumpGeometry(HeadFile
[CurFile
], &Geom
, TRUE
, FALSE
))
2755 DeallocScratchNodalFieldDataPtr(&Geom
.GeomData
.Generic
.V1Base
);
2756 DeallocScratchNodalFieldDataPtr(&Geom
.GeomData
.Generic
.V2Base
);
2757 DeallocScratchNodalFieldDataPtr(&Geom
.GeomData
.Generic
.V3Base
);
2762 INTEGER4 LIBCALL
TECGEO111(double *XOrThetaPos
,
2765 INTEGER4
*PosCoordMode
, /* 0=Grid, 1=Frame, 3=Grid3D */
2766 INTEGER4
*AttachToZone
,
2769 INTEGER4
*FillColor
,
2772 INTEGER4
*LinePattern
,
2773 double *PatternLength
,
2774 double *LineThickness
,
2775 INTEGER4
*NumEllipsePts
,
2776 INTEGER4
*ArrowheadStyle
,
2777 INTEGER4
*ArrowheadAttachment
,
2778 double *ArrowheadSize
,
2779 double *ArrowheadAngle
,
2782 INTEGER4
*NumSegments
,
2783 INTEGER4
*NumSegPts
,
2784 float *XOrThetaGeomData
,
2785 float *YOrRGeomData
,
2789 return TECGEO112(XOrThetaPos
,
2804 ArrowheadAttachment
,
2817 INTEGER4 LIBCALL
TECGEO110(double *XOrThetaPos
,
2820 INTEGER4
*PosCoordMode
, /* 0=Grid, 1=Frame, 3=Grid3D */
2821 INTEGER4
*AttachToZone
,
2824 INTEGER4
*FillColor
,
2827 INTEGER4
*LinePattern
,
2828 double *PatternLength
,
2829 double *LineThickness
,
2830 INTEGER4
*NumEllipsePts
,
2831 INTEGER4
*ArrowheadStyle
,
2832 INTEGER4
*ArrowheadAttachment
,
2833 double *ArrowheadSize
,
2834 double *ArrowheadAngle
,
2837 INTEGER4
*NumSegments
,
2838 INTEGER4
*NumSegPts
,
2839 float *XOrThetaGeomData
,
2840 float *YOrRGeomData
,
2844 return TECGEO112(XOrThetaPos
,
2859 ArrowheadAttachment
,
2872 INTEGER4 LIBCALL
TECGEO100(double *XOrThetaPos
,
2875 INTEGER4
*PosCoordMode
, /* 0=Grid, 1=Frame, 3=Grid3D */
2876 INTEGER4
*AttachToZone
,
2879 INTEGER4
*FillColor
,
2882 INTEGER4
*LinePattern
,
2883 double *PatternLength
,
2884 double *LineThickness
,
2885 INTEGER4
*NumEllipsePts
,
2886 INTEGER4
*ArrowheadStyle
,
2887 INTEGER4
*ArrowheadAttachment
,
2888 double *ArrowheadSize
,
2889 double *ArrowheadAngle
,
2892 INTEGER4
*NumSegments
,
2893 INTEGER4
*NumSegPts
,
2894 float *XOrThetaGeomData
,
2895 float *YOrRGeomData
,
2899 return TECGEO112(XOrThetaPos
,
2914 ArrowheadAttachment
,
2927 INTEGER4 LIBCALL
TECGEO(double *XPos
,
2930 INTEGER4
*PosCoordMode
,
2931 INTEGER4
*AttachToZone
,
2934 INTEGER4
*FillColor
,
2937 INTEGER4
*LinePattern
,
2938 double *PatternLength
,
2939 double *LineThickness
,
2940 INTEGER4
*NumEllipsePts
,
2941 INTEGER4
*ArrowheadStyle
,
2942 INTEGER4
*ArrowheadAttachment
,
2943 double *ArrowheadSize
,
2944 double *ArrowheadAngle
,
2946 INTEGER4
*NumSegments
,
2947 INTEGER4
*NumSegPts
,
2953 int Clipping
= (int)Clipping_ClipToViewport
;
2954 return TECGEO112(XPos
,
2969 ArrowheadAttachment
,
2982 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
2983 LIBFUNCTION INTEGER4 LIBCALL
tecgeo112_(double *XPos
,
2986 INTEGER4
*PosCoordMode
,
2987 INTEGER4
*AttachToZone
,
2990 INTEGER4
*FillColor
,
2993 INTEGER4
*LinePattern
,
2994 double *PatternLength
,
2995 double *LineThickness
,
2996 INTEGER4
*NumEllipsePts
,
2997 INTEGER4
*ArrowheadStyle
,
2998 INTEGER4
*ArrowheadAttachment
,
2999 double *ArrowheadSize
,
3000 double *ArrowheadAngle
,
3003 INTEGER4
*NumSegments
,
3004 INTEGER4
*NumSegPts
,
3010 return TECGEO112(XPos
,
3025 ArrowheadAttachment
,
3038 LIBFUNCTION INTEGER4 LIBCALL
tecgeo111_(double *XPos
,
3041 INTEGER4
*PosCoordMode
,
3042 INTEGER4
*AttachToZone
,
3045 INTEGER4
*FillColor
,
3048 INTEGER4
*LinePattern
,
3049 double *PatternLength
,
3050 double *LineThickness
,
3051 INTEGER4
*NumEllipsePts
,
3052 INTEGER4
*ArrowheadStyle
,
3053 INTEGER4
*ArrowheadAttachment
,
3054 double *ArrowheadSize
,
3055 double *ArrowheadAngle
,
3058 INTEGER4
*NumSegments
,
3059 INTEGER4
*NumSegPts
,
3065 return TECGEO112(XPos
,
3080 ArrowheadAttachment
,
3093 LIBFUNCTION INTEGER4 LIBCALL
tecgeo110_(double *XPos
,
3096 INTEGER4
*PosCoordMode
,
3097 INTEGER4
*AttachToZone
,
3100 INTEGER4
*FillColor
,
3103 INTEGER4
*LinePattern
,
3104 double *PatternLength
,
3105 double *LineThickness
,
3106 INTEGER4
*NumEllipsePts
,
3107 INTEGER4
*ArrowheadStyle
,
3108 INTEGER4
*ArrowheadAttachment
,
3109 double *ArrowheadSize
,
3110 double *ArrowheadAngle
,
3113 INTEGER4
*NumSegments
,
3114 INTEGER4
*NumSegPts
,
3120 return TECGEO112(XPos
,
3135 ArrowheadAttachment
,
3148 LIBFUNCTION INTEGER4 LIBCALL
tecgeo100_(double *XPos
,
3151 INTEGER4
*PosCoordMode
,
3152 INTEGER4
*AttachToZone
,
3155 INTEGER4
*FillColor
,
3158 INTEGER4
*LinePattern
,
3159 double *PatternLength
,
3160 double *LineThickness
,
3161 INTEGER4
*NumEllipsePts
,
3162 INTEGER4
*ArrowheadStyle
,
3163 INTEGER4
*ArrowheadAttachment
,
3164 double *ArrowheadSize
,
3165 double *ArrowheadAngle
,
3168 INTEGER4
*NumSegments
,
3169 INTEGER4
*NumSegPts
,
3175 return TECGEO112(XPos
,
3190 ArrowheadAttachment
,
3203 LIBFUNCTION INTEGER4 LIBCALL
tecgeo_(double *XPos
,
3206 INTEGER4
*PosCoordMode
,
3207 INTEGER4
*AttachToZone
,
3210 INTEGER4
*FillColor
,
3213 INTEGER4
*LinePattern
,
3214 double *PatternLength
,
3215 double *LineThickness
,
3216 INTEGER4
*NumEllipsePts
,
3217 INTEGER4
*ArrowheadStyle
,
3218 INTEGER4
*ArrowheadAttachment
,
3219 double *ArrowheadSize
,
3220 double *ArrowheadAngle
,
3222 INTEGER4
*NumSegments
,
3223 INTEGER4
*NumSegPts
,
3244 ArrowheadAttachment
,
3260 INTEGER4 LIBCALL
TECTXT112(double *XOrThetaPos
,
3262 double *ZOrUnusedPos
,
3263 INTEGER4
*PosCoordMode
,
3264 INTEGER4
*AttachToZone
,
3267 INTEGER4
*FontHeightUnits
,
3271 double *BoxLineThickness
,
3273 INTEGER4
*BoxFillColor
,
3276 double *LineSpacing
,
3277 INTEGER4
*TextColor
,
3286 if (CheckFile("TECTXT112") < 0)
3289 Text
.PositionCoordSys
= (CoordSys_e
) * PosCoordMode
;
3290 if (Text
.PositionCoordSys
== CoordSys_Frame
)
3295 Text
.AnchorPos
.Generic
.V1
= (*XOrThetaPos
) * Fract
;
3296 Text
.AnchorPos
.Generic
.V2
= (*YOrRPos
) * Fract
;
3297 Text
.AnchorPos
.Generic
.V3
= (*ZOrUnusedPos
) * Fract
;
3298 Text
.AttachToZone
= *AttachToZone
!= 0;
3299 Text
.Zone
= *Zone
- 1;
3300 Text
.BColor
= (ColorIndex_t
) * TextColor
;
3301 Text
.TextShape
.Font
= (Font_e
) * BFont
;
3302 Text
.TextShape
.SizeUnits
= (Units_e
) * FontHeightUnits
;
3303 if (Text
.TextShape
.SizeUnits
== Units_Frame
)
3304 Text
.TextShape
.Height
= (*FontHeight
) / 100.0;
3306 Text
.TextShape
.Height
= *FontHeight
;
3307 Text
.Box
.BoxType
= (TextBox_e
) * BoxType
;
3308 Text
.Box
.Margin
= *BoxMargin
/ 100.0;
3309 Text
.Box
.LineThickness
= *BoxLineThickness
/ 100.0;
3310 Text
.Box
.BColor
= (ColorIndex_t
) * BoxColor
;
3311 Text
.Box
.FillBColor
= (ColorIndex_t
) * BoxFillColor
;
3312 Text
.Anchor
= (TextAnchor_e
) * Anchor
;
3313 Text
.LineSpacing
= *LineSpacing
;
3314 Text
.Angle
= *Angle
/ DEGPERRADIANS
;
3315 Text
.Scope
= (Scope_e
) * Scope
;
3317 Text
.MacroFunctionCommand
= mfc
;
3318 Text
.Clipping
= (Clipping_e
) * Clipping
;
3320 #if defined MAKEARCHIVE
3321 if (DebugLevel
[CurFile
])
3322 PRINT1("\nInserting Text: %s\n", String
);
3325 if (DumpText(HeadFile
[CurFile
], &Text
, TRUE
, FALSE
))
3333 INTEGER4 LIBCALL
TECTXT111(double *XOrThetaPos
,
3335 double *ZOrUnusedPos
,
3336 INTEGER4
*PosCoordMode
,
3337 INTEGER4
*AttachToZone
,
3340 INTEGER4
*FontHeightUnits
,
3344 double *BoxLineThickness
,
3346 INTEGER4
*BoxFillColor
,
3349 double *LineSpacing
,
3350 INTEGER4
*TextColor
,
3356 return TECTXT112(XOrThetaPos
,
3380 INTEGER4 LIBCALL
TECTXT110(double *XOrThetaPos
,
3382 double *ZOrUnusedPos
,
3383 INTEGER4
*PosCoordMode
,
3384 INTEGER4
*AttachToZone
,
3387 INTEGER4
*FontHeightUnits
,
3391 double *BoxLineThickness
,
3393 INTEGER4
*BoxFillColor
,
3396 double *LineSpacing
,
3397 INTEGER4
*TextColor
,
3403 return TECTXT112(XOrThetaPos
,
3427 INTEGER4 LIBCALL
TECTXT100(double *XOrThetaPos
,
3429 double *ZOrUnusedPos
,
3430 INTEGER4
*PosCoordMode
,
3431 INTEGER4
*AttachToZone
,
3434 INTEGER4
*FontHeightUnits
,
3438 double *BoxLineThickness
,
3440 INTEGER4
*BoxFillColor
,
3443 double *LineSpacing
,
3444 INTEGER4
*TextColor
,
3450 return TECTXT112(XOrThetaPos
,
3474 INTEGER4 LIBCALL
TECTXT(double *XPos
,
3476 INTEGER4
*PosCoordMode
,
3477 INTEGER4
*AttachToZone
,
3480 INTEGER4
*FontHeightUnits
,
3484 double *BoxLineThickness
,
3486 INTEGER4
*BoxFillColor
,
3489 double *LineSpacing
,
3490 INTEGER4
*TextColor
,
3496 int Clipping
= (int)Clipping_ClipToViewport
;
3497 return TECTXT112(XPos
,
3521 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
3522 LIBFUNCTION INTEGER4 LIBCALL
tectxt112_(double *XOrThetaPos
,
3524 double *ZOrUnusedPos
,
3525 INTEGER4
*PosCoordMode
,
3526 INTEGER4
*AttachToZone
,
3529 INTEGER4
*FontHeightUnits
,
3533 double *BoxLineThickness
,
3535 INTEGER4
*BoxFillColor
,
3538 double *LineSpacing
,
3539 INTEGER4
*TextColor
,
3545 return TECTXT112(XOrThetaPos
,
3569 LIBFUNCTION INTEGER4 LIBCALL
tectxt111_(double *XOrThetaPos
,
3571 double *ZOrUnusedPos
,
3572 INTEGER4
*PosCoordMode
,
3573 INTEGER4
*AttachToZone
,
3576 INTEGER4
*FontHeightUnits
,
3580 double *BoxLineThickness
,
3582 INTEGER4
*BoxFillColor
,
3585 double *LineSpacing
,
3586 INTEGER4
*TextColor
,
3592 return TECTXT112(XOrThetaPos
,
3616 LIBFUNCTION INTEGER4 LIBCALL
tectxt110_(double *XOrThetaPos
,
3618 double *ZOrUnusedPos
,
3619 INTEGER4
*PosCoordMode
,
3620 INTEGER4
*AttachToZone
,
3623 INTEGER4
*FontHeightUnits
,
3627 double *BoxLineThickness
,
3629 INTEGER4
*BoxFillColor
,
3632 double *LineSpacing
,
3633 INTEGER4
*TextColor
,
3639 return TECTXT112(XOrThetaPos
,
3663 LIBFUNCTION INTEGER4 LIBCALL
tectxt100_(double *XOrThetaPos
,
3665 double *ZOrUnusedPos
,
3666 INTEGER4
*PosCoordMode
,
3667 INTEGER4
*AttachToZone
,
3670 INTEGER4
*FontHeightUnits
,
3674 double *BoxLineThickness
,
3676 INTEGER4
*BoxFillColor
,
3679 double *LineSpacing
,
3680 INTEGER4
*TextColor
,
3686 return TECTXT112(XOrThetaPos
,
3710 LIBFUNCTION INTEGER4 LIBCALL
tectxt_(double *XPos
,
3712 INTEGER4
*PosCoordMode
,
3713 INTEGER4
*AttachToZone
,
3716 INTEGER4
*FontHeightUnits
,
3720 double *BoxLineThickness
,
3722 INTEGER4
*BoxFillColor
,
3725 double *LineSpacing
,
3726 INTEGER4
*TextColor
,
3758 INTEGER4 LIBCALL
TECFIL112(INTEGER4
*F
)
3760 if ((*F
< 1) || (*F
> MaxNumFiles
))
3762 #if defined MAKEARCHIVE
3763 PRINT1("Err: (TECFIL112) Invalid file number requested (%d). File not changed.\n", *F
);
3770 #if defined MAKEARCHIVE
3772 PRINT1("Err: (TECFIL112) file %d is not open. File not changed.\n", *F
);
3773 PRINT0("\n\nFile states are:\n");
3774 for (I
= 0; I
< MaxNumFiles
; I
++)
3775 PRINT2("file %d, IsOpen=%d\n", I
+ 1, IsOpen
[I
]);
3776 PRINT1("Current File is: %d\n", CurFile
+ 1);
3781 #if defined MAKEARCHIVE
3782 if (DebugLevel
[CurFile
])
3784 PRINT1("Switching to file #%d\n\n", CurFile
+ 1);
3785 PRINT0("Current State is:\n");
3786 PRINT1(" Debug = %d\n", DebugLevel
[CurFile
]);
3787 PRINT1(" NumVars = %d\n", NumVars
[CurFile
]);
3788 PRINT1(" DestFName = %s\n", DestFName
[CurFile
]);
3789 PRINT1(" BlckFName = %s\n", BlckFName
[CurFile
]);
3790 PRINT1(" ZoneType = %s\n", ZoneTypes
[ZoneType
[CurFile
]]);
3792 if (ZoneType
[CurFile
] == ORDERED
)
3794 PRINT1(" IMax = %d\n", IMax
[CurFile
]);
3795 PRINT1(" JMax = %d\n", JMax
[CurFile
]);
3796 PRINT1(" KMax = %d\n", KMax
[CurFile
]);
3800 PRINT1(" NumPoints = %d\n", IMax
[CurFile
]);
3801 PRINT1(" NumElmnts = %d\n", JMax
[CurFile
]);
3803 PRINT1(" NumDataValuesWritten = %d\n", NumDataValuesWritten
[CurFile
]);
3804 PRINT1(" CurZone = %d\n", CurZone
[CurFile
] + 1);
3806 #endif /* MAKEARCHIVE */
3810 INTEGER4 LIBCALL
TECFIL111(INTEGER4
*F
)
3812 return TECFIL112(F
);
3815 INTEGER4 LIBCALL
TECFIL110(INTEGER4
*F
)
3817 return TECFIL112(F
);
3820 INTEGER4 LIBCALL
TECFIL100(INTEGER4
*F
)
3822 return TECFIL112(F
);
3825 INTEGER4 LIBCALL
TECFIL(INTEGER4
*F
)
3827 return TECFIL112(F
);
3830 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
3831 LIBFUNCTION INTEGER4 LIBCALL
tecfil112_(INTEGER4
*F
)
3833 return TECFIL112(F
);
3836 LIBFUNCTION INTEGER4 LIBCALL
tecfil111_(INTEGER4
*F
)
3838 return TECFIL112(F
);
3841 LIBFUNCTION INTEGER4 LIBCALL
tecfil110_(INTEGER4
*F
)
3843 return TECFIL112(F
);
3846 LIBFUNCTION INTEGER4 LIBCALL
tecfil100_(INTEGER4
*F
)
3848 return TECFIL112(F
);
3851 LIBFUNCTION INTEGER4 LIBCALL
tecfil_(INTEGER4
*F
)
3853 return TECFIL112(F
);
3860 void LIBCALL
TECFOREIGN112(INTEGER4
*OutputForeignByteOrder
)
3862 REQUIRE(VALID_REF(OutputForeignByteOrder
));
3864 DoWriteForeign
= (*OutputForeignByteOrder
!= 0);
3867 void LIBCALL
TECFOREIGN111(INTEGER4
*OutputForeignByteOrder
)
3869 TECFOREIGN112(OutputForeignByteOrder
);
3872 void LIBCALL
TECFOREIGN110(INTEGER4
*OutputForeignByteOrder
)
3874 TECFOREIGN112(OutputForeignByteOrder
);
3877 void LIBCALL
TECFOREIGN100(INTEGER4
*OutputForeignByteOrder
)
3879 TECFOREIGN112(OutputForeignByteOrder
);
3882 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
3883 LIBFUNCTION
void LIBCALL
tecforeign112_(INTEGER4
*OutputForeignByteOrder
)
3885 TECFOREIGN112(OutputForeignByteOrder
);
3888 LIBFUNCTION
void LIBCALL
tecforeign111_(INTEGER4
*OutputForeignByteOrder
)
3890 TECFOREIGN112(OutputForeignByteOrder
);
3893 LIBFUNCTION
void LIBCALL
tecforeign110_(INTEGER4
*OutputForeignByteOrder
)
3895 TECFOREIGN112(OutputForeignByteOrder
);
3898 LIBFUNCTION
void LIBCALL
tecforeign100_(INTEGER4
*OutputForeignByteOrder
)
3900 TECFOREIGN112(OutputForeignByteOrder
);
3904 #if defined MAKEARCHIVE
3907 * A valid auxiliary data name character must begin with a '_' or alpha
3908 * character and may be followed by one or more '_', '.', alpha or digit
3911 static Boolean_t
AuxDataIsValidNameChar(char Char
,
3912 Boolean_t IsLeadChar
)
3914 Boolean_t IsValidNameChar
;
3916 REQUIRE(0 <= Char
&& "Char <= 127");
3917 REQUIRE(VALID_BOOLEAN(IsLeadChar
));
3919 IsValidNameChar
= (Char
== '_' ||
3922 IsValidNameChar
= (IsValidNameChar
||
3926 ENSURE(VALID_BOOLEAN(IsValidNameChar
));
3927 return IsValidNameChar
;
3931 * Indicates if the auxiliary data name is valid. A valid auxiliary data name
3932 * must begin with a '_' or alpha character and may be followed by one or
3933 * more '_', '.', alpha or digit characters.
3935 static Boolean_t
AuxDataIsValidName(const char *Name
)
3937 Boolean_t IsValidName
;
3939 REQUIRE(VALID_REF(Name
));
3941 for (NPtr
= Name
, IsValidName
= AuxDataIsValidNameChar(*NPtr
, TRUE
);
3942 IsValidName
&& *NPtr
!= '\0';
3945 IsValidName
= AuxDataIsValidNameChar(*NPtr
, FALSE
);
3948 ENSURE(VALID_BOOLEAN(IsValidName
));
3952 #endif /* MAKEARCHIVE */
3957 LIBFUNCTION INTEGER4 LIBCALL
TECAUXSTR112(char *Name
,
3960 if (CheckFile("TECAUXSTR112") < 0)
3963 #if defined MAKEARCHIVE
3964 if (DebugLevel
[CurFile
])
3965 PRINT2("\nInserting data set aux data: '%s' = '%s'\n", Name
, Value
);
3968 if ((Name
== NULL
) || !AuxDataIsValidName(Name
))
3970 #if defined MAKEARCHIVE
3971 PRINT0("Err: (TECAUXSTR112) Invalid Name string\n");
3977 if ((Value
== NULL
) || (*Value
== '\0'))
3979 #if defined MAKEARCHIVE
3980 if (DebugLevel
[CurFile
])
3981 PRINT0("Err: (TECAUXSTR112) Invalid Value string\n");
3988 * Because the auxiliary data is at the end of the header section we don't
3989 * need to seek back to it.
3991 if (!WriteBinaryReal(HeadFile
[CurFile
], DataSetAuxMarker
, FieldDataType_Float
) ||
3992 !DumpDatafileString(HeadFile
[CurFile
], Name
, TRUE
/* WriteBinary */) ||
3993 !WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)AuxDataType_String
) ||
3994 !DumpDatafileString(HeadFile
[CurFile
], (const char *)Value
, TRUE
/* WriteBinary */))
3996 #if defined MAKEARCHIVE
3997 if (DebugLevel
[CurFile
])
3998 printf("Err: (TECAUXSTR112) Write failure for file %d\n", CurFile
+ 1);
4006 LIBFUNCTION INTEGER4 LIBCALL
TECAUXSTR111(char *Name
,
4009 return TECAUXSTR112(Name
, Value
);
4012 LIBFUNCTION INTEGER4 LIBCALL
TECAUXSTR110(char *Name
,
4015 return TECAUXSTR112(Name
, Value
);
4018 LIBFUNCTION INTEGER4 LIBCALL
TECAUXSTR100(char *Name
,
4021 return TECAUXSTR112(Name
, Value
);
4024 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
4025 LIBFUNCTION INTEGER4 LIBCALL
tecauxstr112_(char *Name
,
4028 return TECAUXSTR112(Name
, Value
);
4031 LIBFUNCTION INTEGER4 LIBCALL
tecauxstr111_(char *Name
,
4034 return TECAUXSTR112(Name
, Value
);
4037 LIBFUNCTION INTEGER4 LIBCALL
tecauxstr110_(char *Name
,
4040 return TECAUXSTR112(Name
, Value
);
4043 LIBFUNCTION INTEGER4 LIBCALL
tecauxstr100_(char *Name
,
4046 return TECAUXSTR112(Name
, Value
);
4054 LIBFUNCTION INTEGER4 LIBCALL
TECZAUXSTR112(char *Name
,
4057 if (CheckFile("TECZAUXSTR112") < 0)
4060 if (CurZone
[CurFile
] == -1)
4062 #if defined MAKEARCHIVE
4063 PRINT0("Err: (TECZAUXSTR112) Must call TECZNE112 prior to TECZAUXSTR112\n");
4070 #if defined MAKEARCHIVE
4071 if (DebugLevel
[CurFile
])
4072 PRINT2("\nInserting zone aux data: '%s' = '%s'\n", Name
, Value
);
4075 if ((Name
== NULL
) || !AuxDataIsValidName(Name
))
4077 #if defined MAKEARCHIVE
4078 PRINT0("Err: (TECZAUXSTR112) Invalid Name string\n");
4084 if ((Value
== NULL
) || (*Value
== '\0'))
4086 #if defined MAKEARCHIVE
4087 if (DebugLevel
[CurFile
])
4088 PRINT0("Err: (TECZAUXSTR112) Invalid Value string\n");
4095 * Have to back over the 0 already written, then write another one afterward.
4097 if (TP_FSEEK(HeadFile
[CurFile
]->File
, -4, SEEK_CUR
) ||
4098 !WriteBinaryInt32(HeadFile
[CurFile
], 1) ||
4099 !DumpDatafileString(HeadFile
[CurFile
], Name
, TRUE
/* WriteBinary */) ||
4100 !WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)AuxDataType_String
) ||
4101 !DumpDatafileString(HeadFile
[CurFile
], (const char *)Value
, TRUE
/* WriteBinary */) ||
4102 !WriteBinaryInt32(HeadFile
[CurFile
], 0))
4104 #if defined MAKEARCHIVE
4105 if (DebugLevel
[CurFile
])
4106 printf("Err: (TECZAUXSTR112) Write failure for file %d\n", CurFile
+ 1);
4115 LIBFUNCTION INTEGER4 LIBCALL
TECZAUXSTR111(char *Name
,
4118 return TECZAUXSTR112(Name
, Value
);
4121 LIBFUNCTION INTEGER4 LIBCALL
TECZAUXSTR110(char *Name
,
4124 return TECZAUXSTR112(Name
, Value
);
4127 LIBFUNCTION INTEGER4 LIBCALL
TECZAUXSTR100(char *Name
,
4130 return TECZAUXSTR112(Name
, Value
);
4133 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
4134 LIBFUNCTION INTEGER4 LIBCALL
teczauxstr112_(char *Name
,
4137 return TECZAUXSTR112(Name
, Value
);
4140 LIBFUNCTION INTEGER4 LIBCALL
teczauxstr111_(char *Name
,
4143 return TECZAUXSTR112(Name
, Value
);
4146 LIBFUNCTION INTEGER4 LIBCALL
teczauxstr110_(char *Name
,
4149 return TECZAUXSTR112(Name
, Value
);
4152 LIBFUNCTION INTEGER4 LIBCALL
teczauxstr100_(char *Name
,
4155 return TECZAUXSTR112(Name
, Value
);
4163 LIBFUNCTION INTEGER4 LIBCALL
TECVAUXSTR112(INTEGER4
*Var
,
4167 if (CheckFile("TECVAUXSTR112") < 0)
4170 #if defined MAKEARCHIVE
4171 if (DebugLevel
[CurFile
])
4172 PRINT2("\nInserting variable aux data: '%s' = '%s'\n", Name
, Value
);
4175 if ((Name
== NULL
) || !AuxDataIsValidName(Name
))
4177 #if defined MAKEARCHIVE
4178 PRINT0("Err: (TECVAUXSTR112) Invalid Name string\n");
4184 if ((Value
== NULL
) || (*Value
== '\0'))
4186 #if defined MAKEARCHIVE
4187 if (DebugLevel
[CurFile
])
4188 PRINT0("Err: (TECVAUXSTR112) Invalid Value string\n");
4194 if (!WriteBinaryReal(HeadFile
[CurFile
], VarAuxMarker
, FieldDataType_Float
) ||
4195 !WriteBinaryInt32(HeadFile
[CurFile
], *Var
- 1) ||
4196 !DumpDatafileString(HeadFile
[CurFile
], Name
, TRUE
/* WriteBinary */) ||
4197 !WriteBinaryInt32(HeadFile
[CurFile
], (LgIndex_t
)AuxDataType_String
) ||
4198 !DumpDatafileString(HeadFile
[CurFile
], (const char *)Value
, TRUE
/* WriteBinary */))
4200 #if defined MAKEARCHIVE
4201 if (DebugLevel
[CurFile
])
4202 printf("Err: (TECVAUXSTR112) Write failure for file %d\n", CurFile
+ 1);
4211 LIBFUNCTION INTEGER4 LIBCALL
TECVAUXSTR111(INTEGER4
*Var
,
4215 return TECVAUXSTR112(Var
, Name
, Value
);
4218 LIBFUNCTION INTEGER4 LIBCALL
TECVAUXSTR110(INTEGER4
*Var
,
4222 return TECVAUXSTR112(Var
, Name
, Value
);
4225 LIBFUNCTION INTEGER4 LIBCALL
TECVAUXSTR100(INTEGER4
*Var
,
4229 return TECVAUXSTR112(Var
, Name
, Value
);
4232 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
4233 LIBFUNCTION INTEGER4 LIBCALL
tecvauxstr112_(INTEGER4
*Var
,
4237 return TECVAUXSTR112(Var
, Name
, Value
);
4240 LIBFUNCTION INTEGER4 LIBCALL
tecvauxstr111_(INTEGER4
*Var
,
4244 return TECVAUXSTR112(Var
, Name
, Value
);
4247 LIBFUNCTION INTEGER4 LIBCALL
tecvauxstr110_(INTEGER4
*Var
,
4251 return TECVAUXSTR112(Var
, Name
, Value
);
4254 LIBFUNCTION INTEGER4 LIBCALL
tecvauxstr100_(INTEGER4
*Var
,
4258 return TECVAUXSTR112(Var
, Name
, Value
);
4266 LIBFUNCTION INTEGER4 LIBCALL
TECFACE112(INTEGER4
*FaceConnections
)
4270 /* Mark that the face neighbors have been written for the zone even if it fails so as not to add extra error messages. */
4271 FaceNeighborsOrMapWritten
[CurFile
][CurZone
[CurFile
]] = TRUE
;
4273 if (CheckFile("TECFACE112") < 0)
4276 if (ZoneType
[CurFile
] == FEPOLYGON
||
4277 ZoneType
[CurFile
] == FEPOLYHEDRON
)
4279 /* Wrong way to specify face neighbors for polygons and polyhedrons */
4280 #if defined MAKEARCHIVE
4281 PRINT0("Err: (TECFACE112) Cannot call TECFACE112 for polygonal or polyhedral zones.\n");
4287 if (FileTypes
[CurFile
] == SOLUTIONFILE
)
4289 #if defined MAKEARCHIVE
4290 PRINT0("Err: (TECFACE112) Cannot call TECFACE112 if the file type is SOLUTIONFILE.\n");
4296 #if defined MAKEARCHIVE
4297 if (DebugLevel
[CurFile
])
4298 PRINT0("\nInserting face neighbor data\n");
4301 if (FaceConnections
== NULL
)
4303 #if defined MAKEARCHIVE
4304 PRINT0("Err: (TECFACE112) Invalid array\n");
4311 * Face neighbor connection have the following format for both
4314 * LOCALONETOONE 3 cz,fz,cz
4315 * LOCALONETOMANY nz+4 cz,fz,oz,nz,cz1,cz2,...,czn
4316 * GLOBALONETOONE 4 cz,fz,ZZ,CZ
4317 * GLOBALONETOMANY 2*nz+4 cz,fz,oz,nz,ZZ1,CZ1,ZZ2,CZ2,...,ZZn,CZn
4320 * cz = cell in current zone
4321 * fz = face of cell in current zone
4322 * oz = face obsuration flag (only applies to one-to-many):
4323 * 0 = face partially obscured
4324 * 1 = face entirely obscured
4325 * nz = number of cell or zone/cell associations (only applies to one-to-many)
4327 * CZ = cell in remote zone
4330 * As of version 103 Tecplot assumes that face neighbors are zero based
4331 * instead of ones based. Since we have to maintain the contract we
4332 * subtract 1 for the caller.
4334 Ptr
= FaceConnections
;
4336 while (i
< NumFaceConnections
[CurFile
][CurZone
[CurFile
]])
4339 INTEGER4 NumNum
= 0;
4341 switch (FaceNeighborMode
[CurFile
])
4343 case FaceNeighborMode_LocalOneToOne
:
4347 case FaceNeighborMode_LocalOneToMany
:
4348 NumNum
= 4 + Ptr
[3];
4351 case FaceNeighborMode_GlobalOneToOne
:
4355 case FaceNeighborMode_GlobalOneToMany
:
4356 NumNum
= 4 + 2 * Ptr
[3];
4365 if (FaceNeighborMode
[CurFile
] == FaceNeighborMode_LocalOneToMany
||
4366 FaceNeighborMode
[CurFile
] == FaceNeighborMode_GlobalOneToMany
)
4369 * Write cz,fz,oz,nz: we do this by hand because the oz and nz values
4370 * are not zero based values.
4372 if (!WriteBinaryInt32(BlckFile
[CurFile
], Ptr
[n
++] - 1) || /* zero based as of version 103 */
4373 !WriteBinaryInt32(BlckFile
[CurFile
], Ptr
[n
++] - 1) || /* zero based as of version 103 */
4374 !WriteBinaryInt32(BlckFile
[CurFile
], Ptr
[n
++]) || /* ones based */
4375 !WriteBinaryInt32(BlckFile
[CurFile
], Ptr
[n
++])) /* ones based */
4377 #if defined MAKEARCHIVE
4378 if (DebugLevel
[CurFile
])
4379 printf("Err: (TECFACE112) Write failure for file %d\n", CurFile
+ 1);
4386 /* starting from where we left off, output the remaining values */
4387 for (; n
< NumNum
; n
++)
4388 if (!WriteBinaryInt32(BlckFile
[CurFile
], Ptr
[n
] - 1)) /* zero based as of version 103 */
4390 #if defined MAKEARCHIVE
4391 if (DebugLevel
[CurFile
])
4392 printf("Err: (TECFACE112) Write failure for file %d\n", CurFile
+ 1);
4403 LIBFUNCTION INTEGER4 LIBCALL
TECFACE111(INTEGER4
*FaceConnections
)
4405 return TECFACE112(FaceConnections
);
4408 LIBFUNCTION INTEGER4 LIBCALL
TECFACE110(INTEGER4
*FaceConnections
)
4410 return TECFACE112(FaceConnections
);
4413 LIBFUNCTION INTEGER4 LIBCALL
TECFACE100(INTEGER4
*FaceConnections
)
4415 return TECFACE112(FaceConnections
);
4418 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
4419 LIBFUNCTION INTEGER4 LIBCALL
tecface112_(INTEGER4
*FaceConnections
)
4421 return TECFACE112(FaceConnections
);
4424 LIBFUNCTION INTEGER4 LIBCALL
tecface111_(INTEGER4
*FaceConnections
)
4426 return TECFACE112(FaceConnections
);
4429 LIBFUNCTION INTEGER4 LIBCALL
tecface110_(INTEGER4
*FaceConnections
)
4431 return TECFACE112(FaceConnections
);
4434 LIBFUNCTION INTEGER4 LIBCALL
tecface100_(INTEGER4
*FaceConnections
)
4436 return TECFACE112(FaceConnections
);
4444 LIBFUNCTION INTEGER4 LIBCALL
TECPOLY112(INTEGER4
*FaceNodeCounts
,
4445 INTEGER4
*FaceNodes
,
4446 INTEGER4
*FaceLeftElems
,
4447 INTEGER4
*FaceRightElems
,
4448 INTEGER4
*FaceBndryConnectionCounts
,
4449 INTEGER4
*FaceBndryConnectionElems
,
4450 INTEGER4
*FaceBndryConnectionZones
)
4452 INTEGER4 NumFaces
= KMax
[CurFile
];
4453 INTEGER4 Result
= 0;
4455 LgIndex_t MinNeighborValue
= TECIO_NO_NEIGHBORING_ELEM
;
4457 /* Mark that the face map has been written for the zone even if it fails so as not to add extra error messages. */
4458 FaceNeighborsOrMapWritten
[CurFile
][CurZone
[CurFile
]] = TRUE
;
4460 if (NumFaces
== 0 ||
4461 (ZoneType
[CurFile
] != FEPOLYGON
&&
4462 ZoneType
[CurFile
] != FEPOLYHEDRON
))
4464 #if defined MAKEARCHIVE
4465 PRINT0("Err: (TECPOLY112) The zone type must be FEPOLYGON or FEPOLYHEDRON and have NumFaces (KMax) > 0.\n");
4466 PRINT1(" NumFaces = %d\n", NumFaces
);
4472 if (ZoneType
[CurFile
] == FEPOLYHEDRON
) /* FEPOLYGON doesn't need TotalNumFaceNodes since this is 2*NumFaces */
4474 if (TotalNumFaceNodes
[CurFile
][CurZone
[CurFile
]] <= 0)
4476 #if defined MAKEARCHIVE
4477 PRINT0("Err: (TECPOLY112) TotalNumFaceNodes MUST be specified for polyhedral zones.\n");
4478 PRINT1(" TotalNumFaceNodes = %d\n", TotalNumFaceNodes
[CurFile
][CurZone
[CurFile
]]);
4486 if (TotalNumFaceNodes
[CurFile
][CurZone
[CurFile
]] != (2 * NumFaces
))
4488 #if defined MAKEARCHIVE
4489 PRINT0("Err: (TECPOLY112) TotalNumFaceNodes is specified for the polygonal zone but is not equal to 2 * NumFaces.\n");
4490 PRINT2(" TotalNumFaceNodes = %d. If specified, it must be 2 * %d.", TotalNumFaceNodes
[CurFile
][CurZone
[CurFile
]], NumFaces
);
4497 if ((TotalNumFaceBndryFaces
[CurFile
] > 0 &&
4498 TotalNumFaceBndryConns
[CurFile
] > 0) ||
4499 (TotalNumFaceBndryFaces
[CurFile
] == 0 &&
4500 TotalNumFaceBndryConns
[CurFile
] == 0))
4502 if (TotalNumFaceBndryFaces
[CurFile
] > 0)
4503 MinNeighborValue
= -TotalNumFaceBndryFaces
[CurFile
];
4507 #if defined MAKEARCHIVE
4508 PRINT0("Err: (TECPOLY112) TotalNumFaceBndryFaces and TotalNumFaceBndryConns must both be 0 or both be > 0.\n");
4509 PRINT2(" TotalNumFaceBndryFaces = %d, TotalNumFaceBndryConns = %d\n", TotalNumFaceBndryFaces
[CurFile
], TotalNumFaceBndryConns
[CurFile
]);
4515 /* Write the facenodesoffsets array from the facenodecounts array. */
4518 if (ZoneType
[CurFile
] == FEPOLYHEDRON
) /* FEPOLYGON doesn't need to specify facenodesoffsets */
4520 Int32_t FaceNodeSum
= 0;
4521 if (!WriteBinaryInt32(BlckFile
[CurFile
], 0))
4523 for (Index
= 0; (Result
== 0) && (Index
< NumFaces
); Index
++)
4525 FaceNodeSum
+= FaceNodeCounts
[Index
];
4526 if (FaceNodeCounts
[Index
] < 3)
4528 #if defined MAKEARCHIVE
4529 PRINT1("Err: (TECPOLY112) Invalid face node count value at face %d. There must be at least 3 nodes in a face.\n", Index
+ 1);
4530 PRINT1(" Face node count value = %d.\n", FaceNodeCounts
[Index
]);
4535 else if (FaceNodeSum
> TotalNumFaceNodes
[CurFile
][CurZone
[CurFile
]])
4537 #if defined MAKEARCHIVE
4538 PRINT1("Err: (TECPOLY112) The running face node count exceeds the TotalNumFaceNodes (%d) specified.\n", TotalNumFaceNodes
[CurFile
][CurZone
[CurFile
]]);
4539 PRINT1(" Face node count value = %d.\n", FaceNodeCounts
[Index
]);
4544 else if (!WriteBinaryInt32(BlckFile
[CurFile
], FaceNodeSum
))
4550 /* Write the facenodes array but convert 1-based to 0-based. */
4551 for (Index
= 0; (Result
== 0) && (Index
< TotalNumFaceNodes
[CurFile
][CurZone
[CurFile
]]); Index
++)
4553 if (FaceNodes
[Index
] < 1 ||
4554 FaceNodes
[Index
] > IMax
[CurFile
])
4556 #if defined MAKEARCHIVE
4557 PRINT1("Err: (TECPOLY112) Invalid face node value at node %d:\n", Index
+ 1);
4558 PRINT2(" face node value = %d, valid values are are 1 to %d (inclusive).\n", FaceNodes
[Index
], IMax
[CurFile
]);
4563 else if (!WriteBinaryInt32(BlckFile
[CurFile
], FaceNodes
[Index
] - 1))
4567 /* Write the left elements array but convert 1-based to 0-based. */
4568 for (Index
= 0; (Result
== 0) && (Index
< NumFaces
); Index
++)
4570 if (FaceLeftElems
[Index
] < MinNeighborValue
||
4571 FaceLeftElems
[Index
] > JMax
[CurFile
])
4573 #if defined MAKEARCHIVE
4574 PRINT1("Err: (TECPOLY112) Invalid left neighbor value at face %d:\n", Index
);
4575 PRINT2(" left neighbor value = %d, min value = %d,", FaceLeftElems
[Index
], MinNeighborValue
);
4576 PRINT1(" max value = %d.\n", JMax
[CurFile
]);
4581 else if (!WriteBinaryInt32(BlckFile
[CurFile
], FaceLeftElems
[Index
] - 1))
4584 /* Write the right elements array but convert 1-based to 0-based. */
4585 for (Index
= 0; (Result
== 0) && (Index
< NumFaces
); Index
++)
4587 if (FaceRightElems
[Index
] < MinNeighborValue
||
4588 FaceRightElems
[Index
] > JMax
[CurFile
])
4590 #if defined MAKEARCHIVE
4591 PRINT1("Err: (TECPOLY112) Invalid right neighbor value at face %d:\n", Index
);
4592 PRINT2(" right neighbor value = %d, min value = %d,", FaceRightElems
[Index
], MinNeighborValue
);
4593 PRINT1(" max value = %d.\n", JMax
[CurFile
]);
4598 else if (!WriteBinaryInt32(BlckFile
[CurFile
], FaceRightElems
[Index
] - 1))
4602 (FaceLeftElems
[Index
] == TECIO_NO_NEIGHBORING_ELEM
&&
4603 FaceRightElems
[Index
] == TECIO_NO_NEIGHBORING_ELEM
))
4605 #if defined MAKEARCHIVE
4606 PRINT1("Err: (TECPOLY112) Both left and right neighbors are set to no neighboring element at face %d.\n", Index
);
4613 /* Write the boundary arrays. */
4614 if (Result
== 0 && TotalNumFaceBndryFaces
[CurFile
] > 0)
4616 /* Write the boundaryconnectionoffsets array from the boundaryconnectioncounts array. */
4619 * As a convenience for the ASCII format, TecUtil, and TECIO layers if any
4620 * boundary connections exists we automatically add a no-neighboring
4621 * connection as the first item so that they can user 0 for no-neighboring
4622 * element in the element list regardless if they have boundary connections
4625 * The first 2 offsets are always 0 so that -1 in the left/right element
4626 * arrays always indicates "no neighboring element".
4628 if (!(WriteBinaryInt32(BlckFile
[CurFile
], 0) &&
4629 WriteBinaryInt32(BlckFile
[CurFile
], 0)))
4632 Int32_t BndryConnCount
= 0;
4633 for (Index
= 0; (Result
== 0) && (Index
< TotalNumFaceBndryFaces
[CurFile
]); Index
++)
4635 BndryConnCount
+= FaceBndryConnectionCounts
[Index
];
4636 if (FaceBndryConnectionCounts
[Index
] < 0 ||
4637 BndryConnCount
> TotalNumFaceBndryConns
[CurFile
])
4639 #if defined MAKEARCHIVE
4640 PRINT1("Err: (TECPOLY112) Invalid boundary connection count at boundary face %d:\n", Index
+ 1);
4641 PRINT1(" boundary connection count = %d.\n", FaceBndryConnectionCounts
[Index
]);
4646 else if (!WriteBinaryInt32(BlckFile
[CurFile
], BndryConnCount
))
4649 if (BndryConnCount
!= TotalNumFaceBndryConns
[CurFile
])
4651 #if defined MAKEARCHIVE
4652 PRINT0("Err: (TECPOLY112) Invalid number of boundary connections:\n");
4653 PRINT2(" number of boundary connections written = %d, total number of boundary connections = %d.",
4654 BndryConnCount
, TotalNumFaceBndryConns
[CurFile
]);
4660 /* Write the boundary connection elements but convert 1-based to 0-based. */
4662 for (Index
= 0; (Result
== 0) && (Index
< TotalNumFaceBndryFaces
[CurFile
]); Index
++)
4664 for (LgIndex_t BIndex
= 0; (Result
== 0) && (BIndex
< FaceBndryConnectionCounts
[Index
]); BIndex
++)
4667 FaceBndryConnectionElems
[BndryConnCount
] == TECIO_NO_NEIGHBORING_ELEM
)
4669 #if defined MAKEARCHIVE
4670 PRINT1("Err: (TECPOLY112) Partially obscured faces must specify no neighboring element first. See boundary connections for face %d.\n", Index
+ 1);
4675 if (FaceBndryConnectionElems
[BndryConnCount
] < TECIO_NO_NEIGHBORING_ELEM
)
4677 #if defined MAKEARCHIVE
4678 PRINT1("Err: (TECPOLY112) Invalid boundary element value at boundary connections for face %d:\n", Index
+ 1);
4683 if (FaceBndryConnectionElems
[BndryConnCount
] == TECIO_NO_NEIGHBORING_ELEM
&&
4684 FaceBndryConnectionZones
[BndryConnCount
] != TECIO_NO_NEIGHBORING_ZONE
)
4686 #if defined MAKEARCHIVE
4687 PRINT1("Err: (TECPOLY112) Invalid boundary element/zone pair at boundary connections for face %d:\n", Index
+ 1);
4688 PRINT0(" Boundary elements specified as no neighboring element must also specify no neighboring zone.\n");
4693 else if (!WriteBinaryInt32(BlckFile
[CurFile
], FaceBndryConnectionElems
[BndryConnCount
] - 1))
4699 /* Write the boundary connection zones but convert 1-based to 0-based. */
4701 for (Index
= 0; (Result
== 0) && (Index
< TotalNumFaceBndryFaces
[CurFile
]); Index
++)
4703 for (LgIndex_t BIndex
= 0; (Result
== 0) && (BIndex
< FaceBndryConnectionCounts
[Index
]); BIndex
++)
4705 if (FaceBndryConnectionZones
[BndryConnCount
] < TECIO_NO_NEIGHBORING_ZONE
)
4707 #if defined MAKEARCHIVE
4708 PRINT1("Err: (TECPOLY112) Invalid boundary zone value at boundary connections for face %d:\n", Index
+ 1);
4713 else if (!WriteBinaryInt32(BlckFile
[CurFile
], FaceBndryConnectionZones
[BndryConnCount
] - 1))
4722 WriteErr("TECPOLY112");
4728 #if !defined INDEX_16_BIT // not supported in this test-only mode
4729 LIBFUNCTION INTEGER4 LIBCALL
TECPOLY111(INTEGER4
*FaceNodeCounts
,
4730 INTEGER4
*FaceNodes
,
4731 INTEGER4
*FaceLeftElems
,
4732 INTEGER4
*FaceRightElems
,
4733 INTEGER4
*FaceBndryConnectionCounts
,
4734 INTEGER4
*FaceBndryConnectionElems
,
4735 INTEGER2
*FaceBndryConnectionZones
)
4737 INTEGER4 Result
= 0;
4738 EntIndex_t
*FBCZones
= NULL
;
4740 if (TotalNumFaceBndryConns
[CurFile
] > 0)
4742 ALLOC_ARRAY(TotalNumFaceBndryConns
[CurFile
], EntIndex_t
, "32-bit FaceBndryConnectionZones");
4744 if (FBCZones
!= NULL
)
4746 for (LgIndex_t ZoneI
= 0; ZoneI
< TotalNumFaceBndryFaces
[CurFile
]; ZoneI
++)
4747 FBCZones
[ZoneI
] = (EntIndex_t
)FaceBndryConnectionZones
[ZoneI
];
4751 #if defined MAKEARCHIVE
4752 PRINT0("Err: (TECPOLY111) Out of memory allocating temporary data.\n");
4759 Result
= TECPOLY112(FaceNodeCounts
,
4763 FaceBndryConnectionCounts
,
4764 FaceBndryConnectionElems
,
4767 if (FBCZones
!= NULL
)
4768 FREE_ARRAY(FBCZones
, "32-bit FaceBndryConnectionZones");
4772 #endif // INDEX_16_BIT -- not supported in this test-only mode
4774 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
4775 LIBFUNCTION INTEGER4 LIBCALL
tecpoly112_(INTEGER4
*FaceNodeCounts
,
4776 INTEGER4
*FaceNodes
,
4777 INTEGER4
*FaceLeftElems
,
4778 INTEGER4
*FaceRightElems
,
4779 INTEGER4
*FaceBndryConnectionOffsets
,
4780 INTEGER4
*FaceBndryConnectionElems
,
4781 INTEGER4
*FaceBndryConnectionZones
)
4783 return TECPOLY112(FaceNodeCounts
,
4787 FaceBndryConnectionOffsets
,
4788 FaceBndryConnectionElems
,
4789 FaceBndryConnectionZones
);
4792 LIBFUNCTION INTEGER4 LIBCALL
tecpoly111_(INTEGER4
*FaceNodeCounts
,
4793 INTEGER4
*FaceNodes
,
4794 INTEGER4
*FaceLeftElems
,
4795 INTEGER4
*FaceRightElems
,
4796 INTEGER4
*FaceBndryConnectionOffsets
,
4797 INTEGER4
*FaceBndryConnectionElems
,
4798 INTEGER2
*FaceBndryConnectionZones
)
4800 return TECPOLY111(FaceNodeCounts
,
4804 FaceBndryConnectionOffsets
,
4805 FaceBndryConnectionElems
,
4806 FaceBndryConnectionZones
);
4810 #if defined TECPLOTKERNEL
4811 /* CORE SOURCE CODE REMOVED */