1 #include "stdafx.h"
2 #include "MASTER.h"
3
4 #define TECPLOTENGINEMODULE
5
6 /*
7 ******************************************************************
8 ******************************************************************
9 ******* ********
10 ****** (C) 1988-2010 Tecplot, Inc. *******
11 ******* ********
12 ******************************************************************
13 ******************************************************************
14 */
15 /* Source file revision $Revision: 24291 $ */
16
17 #include "GLOBAL.h"
18 #include "TASSERT.h"
19 #include "Q_UNICODE.h"
20 #include "SYSTEM.h"
21 #include "FILESTREAM.h"
22 #if defined TECPLOTKERNEL
23 /* CORE SOURCE CODE REMOVED */
24 #endif
25 #include "CHARTYPE.h"
26 #include "DATAIO4.h"
27 #include "DATASET0.h"
28 #include "TECXXX.h"
29 #include "DATAUTIL.h"
30 #include "ALLOC.h"
31 #include <vector>
32
33 #if !defined MAKEARCHIVE
34 #include "AUXDATA.h"
35 #endif /* MAKEARCHIVE */
36
37 #if defined MSWIN
38 #include <io.h>
39 #endif
40
41 #if defined UNIXX
42 #include <stdio.h>
43 #include <sys/types.h>
44 #include <sys/stat.h>
45 #endif
46
47 #if defined TECPLOTKERNEL
48 /* CORE SOURCE CODE REMOVED */
49 #endif
50 using namespace std;
51
52 #if defined MAKEARCHIVE
53 #if defined MSWIN && defined _DEBUG
54 /* For debug .dll builds, send debug info to debug window. */
55 #define PRINT0(s) do { OutputDebugString(s); } while (0)
56 #define PRINT1(s,a1) do { char buffer[512]; sprintf(buffer,s,a1); OutputDebugString(buffer); } while (0)
57 #define PRINT2(s,a1,a2) do { char buffer[512]; sprintf(buffer,s,a1,a2); OutputDebugString(buffer); } while (0)
58 #else
59 /* For all other builds (including release .dll), send debug info to stdout. */
60 #define PRINT0(s) printf(s)
61 #define PRINT1(s,a1) printf(s,a1)
62 #define PRINT2(s,a1,a2) printf(s,a1,a2)
63 #endif
64 #else
65 #if defined MSWIN
66 /* For nonarchive, Windows, don't send debug info. */
67 #define PRINT0(s) ((void)0)
68 #define PRINT1(s,a1) ((void)0)
69 #define PRINT2(s,a1,a2) ((void)0)
70 #else
71 /* For nonarchive, nonwindows, send debug info to stdout. */
72 #define PRINT0(s) printf(s)
73 #define PRINT1(s,a1) printf(s,a1)
74 #define PRINT2(s,a1,a2) printf(s,a1,a2)
75 #endif
76 #endif
77
78 typedef char *FNameType;
79 typedef FILE *FilePtr;
80
81 #define MaxNumFiles 10
82 #define MAX_DUPLIST_VARS 50 /* maybe crank up in the future */
83
84 #define BYTES_PER_CHUNK 4096
85 #define TECIO_NO_NEIGHBORING_ELEM 0
86 #define TECIO_NO_NEIGHBORING_ZONE 0
87
88 #if defined MAKEARCHIVE
89 static LgIndex_t DebugLevel[MaxNumFiles] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
90 #endif
91 static INTEGER4 IsOpen[MaxNumFiles] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
92 static INTEGER4 NumErrs[MaxNumFiles] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
93 static INTEGER4 NumVars[MaxNumFiles];
94 static FNameType DestFName[MaxNumFiles] = {NULL, NULL, NULL, NULL, NULL,
95 NULL, NULL, NULL, NULL, NULL
96 };
97 static FNameType BlckFName[MaxNumFiles] = {NULL, NULL, NULL, NULL, NULL,
98 NULL, NULL, NULL, NULL, NULL
99 };
100 static FileStream_s* BlckFile[MaxNumFiles];
101 static FileStream_s* HeadFile[MaxNumFiles];
102 static vector<FileOffset_t> MinMaxOffset[MaxNumFiles]; /* vector dimensioned by num zones */
103 static vector<double> VarMinValue[MaxNumFiles]; /* vector dimensioned by num vars */
104 static vector<double> VarMaxValue[MaxNumFiles]; /* vector dimensioned by num vars */
105 static INTEGER4 DoWriteForeign = FALSE; /* ...default is to write native */
106 static INTEGER4 IsWritingNative[MaxNumFiles];
107 static INTEGER4 IsBlock[MaxNumFiles];
108 static INTEGER4 ZoneType[MaxNumFiles];
109 static LgIndex_t IMax[MaxNumFiles]; /* ones based indices */
110 static LgIndex_t JMax[MaxNumFiles]; /* ones based indices */
111 static LgIndex_t KMax[MaxNumFiles]; /* ones based indices */
112 static vector<LgIndex_t> TotalNumFaceNodes[MaxNumFiles]; /* vector dimensioned by num zones */
113 static LgIndex_t TotalNumFaceBndryFaces[MaxNumFiles];
114 static LgIndex_t TotalNumFaceBndryConns[MaxNumFiles];
115 static LgIndex_t ICellMax[MaxNumFiles];
116 static LgIndex_t JCellMax[MaxNumFiles];
117 static LgIndex_t KCellMax[MaxNumFiles];
118 static vector<INTEGER4> NumFaceConnections[MaxNumFiles]; /* vector dimensioned by num zones */
119 static INTEGER4 FaceNeighborMode[MaxNumFiles];
120 static vector<INTEGER4> FaceNeighborsOrMapWritten[MaxNumFiles]; /* vector dimensioned by num zones */
121 static INTEGER4 NumIndices[MaxNumFiles];
122 static LgIndex_t NumDataValuesWritten[MaxNumFiles];
123 static LgIndex_t NumOrderedCCDataValuesWritten[MaxNumFiles]; /* CC data only */
124 static LgIndex_t NumDataValuesToWrite[MaxNumFiles];
125 static vector<LgIndex_t> NumRunningVarValues[MaxNumFiles]; /* vector dimensioned by num vars */
126 static vector<Boolean_t> IsSharedVar[MaxNumFiles]; /* vector dimensioned by num vars */
127 static vector<Boolean_t> IsPassiveVar[MaxNumFiles]; /* vector dimensioned by num vars */
128 static INTEGER4 CurZone[MaxNumFiles]; /* zero based zone numbers */
129 static INTEGER4 CurVar[MaxNumFiles]; /* zero based var numbers */
130 static INTEGER4 FieldDataType[MaxNumFiles];
131 static INTEGER4 CurFile = -1;
132 static vector<Boolean_t> IsCellCentered[MaxNumFiles]; /* vector dimensioned by num vars */
133 static Boolean_t HasFECONNECT[MaxNumFiles];
134 static INTEGER4 FileTypes[MaxNumFiles];
135 static vector<INTEGER4> NumConnectivityNodes[MaxNumFiles]; /* vector dimensioned by num zones */
136 static vector<INTEGER4> NumConnectivityNodesWritten[MaxNumFiles]; /* vector dimensioned by num zones */
137 static vector<Boolean_t> ConnectivityWritten[MaxNumFiles]; /* vector dimensioned by num zones */
138
139 /*
140 * From preplot.cpp:
141 *
142 * ZoneType 0=ORDERED,1=FELINESEG,2=FETRIANGLE,
143 * 3=FEQUADRILATERAL,4=FETETRAHEDRON,5=FEBRICK,
144 * 6=FEPOLYGON,7=FEPOLYHEDRON
145 */
146 #define ORDERED 0
147 #define FELINESEG 1
148 #define FETRIANGLE 2
149 #define FEQUADRILATERAL 3
150 #define FETETRAHEDRON 4
151 #define FEBRICK 5
152 #define FEPOLYGON 6
153 #define FEPOLYHEDRON 7
154 /*
155 * FileType 0=FULLFILE,1=GRIDFILE,2=SOLUTIONFILE
156 */
157 #define FULLFILE 0
158 #define GRIDFILE 1
159 #define SOLUTIONFILE 2
160
161 #if defined MAKEARCHIVE
162 static char const* ZoneTypes[] =
163 {
164 "ORDERED",
165 "FELINESEG",
166 "FETRIANGLE",
167 "FEQUADRILATERAL",
168 "FETETRAHEDRON",
169 "FEBRICK",
170 "FEPOLYGON",
171 "FEPOLYHEDRON"
172 };
173 #endif /* MAKEARCHIVE */
174
175
WriteErr(const char * routine_name)176 static void WriteErr(const char *routine_name)
177 {
178 #if defined MAKEARCHIVE
179 {
180 PRINT2("Err: (%s) Write failure on file %d.\n", routine_name, CurFile + 1);
181 }
182 #else
183 {
184 UNUSED(routine_name);
185 }
186 #endif
187 NumErrs[CurFile]++;
188 }
189
190 static LgIndex_t TecXXXZoneNum = 0;
191
ParseDupList(LgIndex_t ** ShareVarFromZone,LgIndex_t * ShareConnectivityFromZone,const char * DupList)192 Boolean_t ParseDupList(LgIndex_t **ShareVarFromZone,
193 LgIndex_t *ShareConnectivityFromZone,
194 const char *DupList)
195 {
196 Boolean_t IsOk = TRUE;
197
198 REQUIRE(VALID_REF(ShareVarFromZone) && *ShareVarFromZone == NULL);
199 REQUIRE(VALID_REF(ShareConnectivityFromZone));
200 REQUIRE(VALID_REF(DupList));
201
202 while (IsOk && *DupList)
203 {
204 /* skip leading spaces */
205 while (*DupList && *DupList == ' ')
206 DupList++;
207
208 /* is this the FECONNECT keyword? */
209 if (*DupList && !strncmp(DupList, "FECONNECT", 9))
210 *ShareConnectivityFromZone = TecXXXZoneNum;
211
212 else if (*DupList && !tecplot::isdigit(*DupList))
213 IsOk = FALSE; /* syntax error */
214
215 else if (*DupList)
216 {
217 char *NotUsed = NULL;
218 EntIndex_t WhichVar = strtol(DupList, &NotUsed, 10);
219 EntIndex_t numVarsForFile = NumVars[CurFile];
220
221 if (0 < WhichVar && WhichVar < numVarsForFile)
222 {
223 if (!(*ShareVarFromZone))
224 {
225 *ShareVarFromZone = ALLOC_ARRAY(numVarsForFile, LgIndex_t, "Variable sharing list");
226 if (*ShareVarFromZone)
227 memset(*ShareVarFromZone, (char)0, numVarsForFile * sizeof(LgIndex_t));
228 }
229
230 if (*ShareVarFromZone)
231 (*ShareVarFromZone)[WhichVar - 1] = TecXXXZoneNum;
232 else
233 IsOk = FALSE;
234 }
235 else
236 {
237 /* Invalid var num */
238 IsOk = FALSE;
239 }
240 }
241
242 /*
243 * Skip to the comma. This
244 * will also allow the syntax error
245 * of more than one consecutive comma
246 */
247
248 while (*DupList && *DupList != ',')
249 DupList++;
250
251 /* skip past the comma (can handle the syntax error of more than 1 comma) */
252 while (*DupList && *DupList == ',')
253 DupList++;
254 }
255
256 return IsOk;
257 }
258
259 /**
260 */
OpenFileStream(const char * FilePath,const char * AccessMode,Boolean_t IsByteOrderNative)261 static FileStream_s *OpenFileStream(const char *FilePath,
262 const char *AccessMode,
263 Boolean_t IsByteOrderNative)
264 {
265 REQUIRE(VALID_REF(FilePath));
266 REQUIRE(VALID_REF(AccessMode));
267
268 FileStream_s *Result = NULL;
269 FILE *File = TP_FOPEN(FilePath, AccessMode);
270 if (File != NULL)
271 {
272 Result = FileStreamAlloc(File, IsByteOrderNative);
273 if (Result == NULL)
274 TP_FCLOSE(File);
275 }
276
277 ENSURE((VALID_REF(Result) && VALID_REF(Result->File)) || Result == NULL);
278 return Result;
279 }
280
281 /**
282 */
CloseFileStream(FileStream_s ** FileStream)283 static void CloseFileStream(FileStream_s **FileStream)
284 {
285 REQUIRE(VALID_REF(FileStream));
286 REQUIRE(VALID_REF(*FileStream) || *FileStream == NULL);
287
288 if (*FileStream != NULL)
289 {
290 TP_FCLOSE((*FileStream)->File);
291 FileStreamDealloc(FileStream);
292 }
293
294 ENSURE(*FileStream == NULL);
295 }
296
297 /**
298 * Get the best terminator (separator) character to use for the string. First
299 * precedence goes to the new line then the command and finally by default the
300 * space. NOTE: We use a do loop to allow it to be used as a single statement.
301 */
302 #define GET_BEST_TERMINATOR_CHAR(CompoundStr, TerminatorChar) \
303 do \
304 { \
305 if (strchr((CompoundStr), '\n') != NULL) \
306 (TerminatorChar) = '\n'; \
307 else if (strchr((CompoundStr), ',') != NULL) \
308 (TerminatorChar) = ','; \
309 else \
310 (TerminatorChar) = ' '; \
311 } while (0)
312
313
314 /**
315 * TECINIXXX
316 */
TECINI112(char * Title,char * Variables,char * FName,char * ScratchDir,INTEGER4 * FileType,INTEGER4 * Debug,INTEGER4 * VIsDouble)317 INTEGER4 LIBCALL TECINI112(char *Title,
318 char *Variables,
319 char *FName,
320 char *ScratchDir,
321 INTEGER4 *FileType,
322 INTEGER4 *Debug,
323 INTEGER4 *VIsDouble)
324 {
325 size_t L;
326 int I;
327 char RName[80];
328 char *CPtr;
329 int NewFile = -1;
330
331 /*
332 * Note that users should not mix TECXXX, TEC100XXX, and TEC110XXX calls, but
333 * just in case, initialize the TecXXXZoneNum variable. It may not help, but
334 * it doesn't hurt...
335 */
336 TecXXXZoneNum = 0;
337
338 #if defined MAKEARCHIVE
339 InitInputSpecs();
340 #endif
341
342 for (I = 0; (I < MaxNumFiles) && (NewFile == -1); I++)
343 {
344 if (!IsOpen[I])
345 NewFile = I;
346 }
347
348 if (NewFile == -1)
349 {
350 #if defined MAKEARCHIVE
351 PRINT1("Err: (TECINI112) Too many files (%d) opened for printing.\n", NewFile);
352 #endif
353 return (-1);
354 }
355
356 if (CurFile == -1)
357 CurFile = 0;
358
359 #if defined MAKEARCHIVE
360 {
361 DebugLevel[NewFile] = *Debug;
362 }
363 #else
364 {
365 UNUSED(Debug);
366 }
367 #endif
368 /* check sizes for array sized by number of variables */
369 CHECK(VarMinValue[NewFile].empty());
370 CHECK(VarMaxValue[NewFile].empty());
371 CHECK(NumRunningVarValues[NewFile].empty());
372 CHECK(IsSharedVar[NewFile].empty());
373 CHECK(IsPassiveVar[NewFile].empty());
374 CHECK(IsCellCentered[NewFile].empty());
375
376 /* check sizes for array sized by number of zones */
377 CHECK(MinMaxOffset[NewFile].empty());
378 CHECK(TotalNumFaceNodes[NewFile].empty());
379 CHECK(NumFaceConnections[NewFile].empty());
380 CHECK(FaceNeighborsOrMapWritten[NewFile].empty());
381 CHECK(NumConnectivityNodes[NewFile].empty());
382 CHECK(NumConnectivityNodesWritten[NewFile].empty());
383 CHECK(ConnectivityWritten[NewFile].empty());
384
385 CurZone[NewFile] = -1;
386 L = 0;
387 if (FName != NULL)
388 L = strlen(FName);
389 if (L == 0)
390 {
391 #if defined MAKEARCHIVE
392 PRINT1("Err: (TECINI112) Bad file name for file %d.\n", NewFile);
393 #endif
394 return (-1);
395 }
396 DestFName[NewFile] = ALLOC_ARRAY(L + 1, char, "data set fname");
397 strcpy(DestFName[NewFile], FName);
398
399 #if defined (DOS)
400 {
401 sprintf(RName, "BLCKFILE.%03d", (int)(NewFile + 1));
402 }
403 #else
404 {
405 sprintf(RName, "tp%1dXXXXXX", NewFile + 1);
406 }
407 #endif
408
409 L = strlen(RName);
410 if (ScratchDir != NULL)
411 L += strlen(ScratchDir) + 1; /* +1 for the slash delimeter */
412 BlckFName[NewFile] = ALLOC_ARRAY(L + 1, char, "data set fname");
413 if (ScratchDir != NULL)
414 {
415 strcpy(BlckFName[NewFile], ScratchDir);
416 #if defined DOS || defined MSWIN
417 {
418 strcat(BlckFName[NewFile], "\\");
419 }
420 #else
421 {
422 strcat(BlckFName[NewFile], "/");
423 }
424 #endif
425 }
426 else
427 BlckFName[NewFile][0] = '\0';
428
429 strcat(BlckFName[NewFile], RName);
430 CHECK(strlen(BlckFName[NewFile]) <= L);
431
432 #if defined MSWIN
433 {
434 _mktemp(BlckFName[NewFile]);
435 }
436 #elif defined UNIXX
437 {
438 /*
439 * POSIX compiant behavior is to make
440 * sure umask is set correctly first.
441 */
442 mode_t OrigUmask = umask(0022); /* ...should produce rw------- */
443 int FileDesc = mkstemp(BlckFName[NewFile]);
444 if (FileDesc != -1)
445 close(FileDesc);
446 umask(OrigUmask);
447 }
448 #endif
449
450 #if defined MAKEARCHIVE
451 if (DebugLevel[NewFile])
452 {
453 PRINT2("Scratch File #%d: %s\n", NewFile + 1, BlckFName[NewFile]);
454 PRINT2("Dest File #%d: %s\n", NewFile + 1, DestFName[NewFile]);
455 }
456 #endif
457
458 IsWritingNative[NewFile] = !DoWriteForeign;
459
460 #if defined TECPLOTKERNEL
461 /* CORE SOURCE CODE REMOVED */
462 #endif
463
464 HeadFile[NewFile] = OpenFileStream(DestFName[NewFile], "wb", IsWritingNative[NewFile]);
465 BlckFile[NewFile] = OpenFileStream(BlckFName[NewFile], "wb", IsWritingNative[NewFile]);
466
467 if (BlckFile[NewFile] == NULL)
468 {
469 #if defined MAKEARCHIVE
470 PRINT0("Err: (TECINI112) Cannot open scratch file for output.\n");
471 PRINT0(" Check permissions in scratch directory.\n");
472 #endif
473 NumErrs[NewFile]++;
474 return (-1);
475 }
476 if (HeadFile[NewFile] == NULL)
477 {
478 #if defined MAKEARCHIVE
479 PRINT0("Err: (TECINI112) Cannot open plot file. Check permissions.\n");
480 #endif
481 NumErrs[NewFile]++;
482 return (-1);
483 }
484
485 writeBinaryVersionNumber(*HeadFile[NewFile],
486 TecplotBinaryFileVersion);
487 WriteBinaryMagic(HeadFile[NewFile]);
488
489 /* Write file type */
490 if (*FileType >= FULLFILE && *FileType <= SOLUTIONFILE)
491 FileTypes[NewFile] = *FileType;
492 else
493 {
494 #if defined MAKEARCHIVE
495 PRINT0("Err: (TECINI112) Bad filetype argument. Check documentation.\n");
496 #endif
497 NumErrs[NewFile]++;
498 return (-1);
499 }
500
501 CHECK(TecplotBinaryFileVersion == 112);
502 if (!WriteBinaryInt32(HeadFile[NewFile], (LgIndex_t)FileTypes[NewFile]))
503 {
504 WriteErr("TECINI112");
505 return (-1);
506 }
507
508 if (!DumpDatafileString(HeadFile[NewFile],
509 Title,
510 TRUE))
511 {
512 WriteErr("TECINI112");
513 return (-1);
514 }
515
516 NumVars[NewFile] = 0;
517 CPtr = Variables;
518
519
520 /*
521 * Three possible variable name separators are accepted with the following
522 * precidence: newline, comma, and space.
523 */
524 {
525 char terminator;
526
527 GET_BEST_TERMINATOR_CHAR(CPtr, terminator);
528 while (*CPtr)
529 {
530 /* strip leading spaces */
531 while (*CPtr && *CPtr == ' ')
532 CPtr++;
533
534 if (*CPtr)
535 {
536 NumVars[NewFile]++;
537 /* skip to terminating character */
538 while (*CPtr && *CPtr != terminator)
539 CPtr++;
540 /* skip past terminating character */
541 if (*CPtr)
542 CPtr++;
543 }
544 }
545 }
546
547 #if 0
548 /* A grid file can have no variables in it as long as there is a connectivity list */
549 if (NumVars[NewFile] == 0 && FileTypes[NewFile] != GRIDFILE)
550 {
551 #if defined MAKEARCHIVE
552 PRINT0("Err: (TECINI110) No variable names were defined.\n");
553 #endif
554 NumErrs[NewFile]++;
555 return (-1);
556 }
557 #endif
558
559 #if defined MAKEARCHIVE
560 if (DebugLevel[NewFile])
561 PRINT1("NumVars=%d\n", NumVars[NewFile]);
562 #endif
563 /* make sure var-sized arrays are big enough for all vars */
564 try
565 {
566 VarMinValue[NewFile].resize(NumVars[NewFile]);
567 VarMaxValue[NewFile].resize(NumVars[NewFile]);
568 NumRunningVarValues[NewFile].resize(NumVars[NewFile]);
569 IsSharedVar[NewFile].resize(NumVars[NewFile]);
570 IsPassiveVar[NewFile].resize(NumVars[NewFile]);
571 IsCellCentered[NewFile].resize(NumVars[NewFile]);
572 }
573 catch (std::bad_alloc const&)
574 {
575 #if defined MAKEARCHIVE
576 PRINT0("Err: (TECINI112) Memory allocation error.\n");
577 #endif
578 NumErrs[NewFile]++;
579 return (-1);
580 }
581
582 if (!WriteBinaryInt32(HeadFile[NewFile], (LgIndex_t)NumVars[NewFile]))
583 {
584 WriteErr("TECINI110");
585 return (-1);
586 }
587
588 CPtr = Variables;
589 {
590 char terminator;
591 char TString[MaxChrsVarName+1];
592 int I;
593
594 GET_BEST_TERMINATOR_CHAR(CPtr, terminator);
595 while (*CPtr)
596 {
597 /* skip leading space characters */
598 while (*CPtr && *CPtr == ' ')
599 CPtr++;
600 if (*CPtr)
601 {
602 I = 0;
603 /* skip to terminator */
604 while (*CPtr && *CPtr != terminator)
605 {
606 TString[I++] = *CPtr++;
607 }
608 /* skip past terminator */
609 if (*CPtr)
610 CPtr++;
611
612 /* strip trailing spaces */
613 I--;
614 while (I >= 0 && TString[I] == ' ')
615 I--;
616
617 TString[I+1] = '\0';
618
619 if (!DumpDatafileString(HeadFile[NewFile], TString, TRUE))
620 {
621 WriteErr("TECINI110");
622 return (-1);
623 }
624 }
625 }
626 }
627
628 IsOpen[NewFile] = 1;
629
630 if (*VIsDouble)
631 FieldDataType[NewFile] = FieldDataType_Double;
632 else
633 FieldDataType[NewFile] = FieldDataType_Float;
634
635 return (0);
636 }
637
TECINI111(char * Title,char * Variables,char * FName,char * ScratchDir,INTEGER4 * FileType,INTEGER4 * Debug,INTEGER4 * VIsDouble)638 INTEGER4 LIBCALL TECINI111(char *Title,
639 char *Variables,
640 char *FName,
641 char *ScratchDir,
642 INTEGER4 *FileType,
643 INTEGER4 *Debug,
644 INTEGER4 *VIsDouble)
645 {
646 return TECINI112(Title,
647 Variables,
648 FName,
649 ScratchDir,
650 FileType,
651 Debug,
652 VIsDouble);
653 }
654
TECINI110(char * Title,char * Variables,char * FName,char * ScratchDir,INTEGER4 * Debug,INTEGER4 * VIsDouble)655 INTEGER4 LIBCALL TECINI110(char *Title,
656 char *Variables,
657 char *FName,
658 char *ScratchDir,
659 INTEGER4 *Debug,
660 INTEGER4 *VIsDouble)
661 {
662 INTEGER4 FType = FULLFILE;
663
664 TecXXXZoneNum = 0;
665 return TECINI112(Title,
666 Variables,
667 FName,
668 ScratchDir,
669 &FType,
670 Debug,
671 VIsDouble);
672 }
673
TECINI100(char * Title,char * Variables,char * FName,char * ScratchDir,INTEGER4 * Debug,INTEGER4 * VIsDouble)674 INTEGER4 LIBCALL TECINI100(char *Title,
675 char *Variables,
676 char *FName,
677 char *ScratchDir,
678 INTEGER4 *Debug,
679 INTEGER4 *VIsDouble)
680 {
681 INTEGER4 FType = FULLFILE;
682
683 TecXXXZoneNum = 0;
684 return TECINI112(Title,
685 Variables,
686 FName,
687 ScratchDir,
688 &FType,
689 Debug,
690 VIsDouble);
691 }
692
TECINI(char * Title,char * Variables,char * FName,char * ScratchDir,INTEGER4 * Debug,INTEGER4 * VIsDouble)693 INTEGER4 LIBCALL TECINI(char *Title,
694 char *Variables,
695 char *FName,
696 char *ScratchDir,
697 INTEGER4 *Debug,
698 INTEGER4 *VIsDouble)
699 {
700 INTEGER4 FType = FULLFILE;
701
702 TecXXXZoneNum = 0;
703 return TECINI112(Title,
704 Variables,
705 FName,
706 ScratchDir,
707 &FType,
708 Debug,
709 VIsDouble);
710 }
711
712 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tecini112_(char * Title,char * Variables,char * FName,char * ScratchDir,INTEGER4 * FileType,INTEGER4 * Debug,INTEGER4 * VIsDouble)713 LIBFUNCTION INTEGER4 LIBCALL tecini112_(char *Title,
714 char *Variables,
715 char *FName,
716 char *ScratchDir,
717 INTEGER4 *FileType,
718 INTEGER4 *Debug,
719 INTEGER4 *VIsDouble)
720 {
721 return TECINI112(Title, Variables, FName, ScratchDir, FileType, Debug, VIsDouble);
722 }
723
tecini111_(char * Title,char * Variables,char * FName,char * ScratchDir,INTEGER4 * FileType,INTEGER4 * Debug,INTEGER4 * VIsDouble)724 LIBFUNCTION INTEGER4 LIBCALL tecini111_(char *Title,
725 char *Variables,
726 char *FName,
727 char *ScratchDir,
728 INTEGER4 *FileType,
729 INTEGER4 *Debug,
730 INTEGER4 *VIsDouble)
731 {
732 return TECINI112(Title, Variables, FName, ScratchDir, FileType, Debug, VIsDouble);
733 }
734
tecini110_(char * Title,char * Variables,char * FName,char * ScratchDir,INTEGER4 * Debug,INTEGER4 * VIsDouble)735 LIBFUNCTION INTEGER4 LIBCALL tecini110_(char *Title,
736 char *Variables,
737 char *FName,
738 char *ScratchDir,
739 INTEGER4 *Debug,
740 INTEGER4 *VIsDouble)
741 {
742 INTEGER4 FType = FULLFILE;
743 return TECINI112(Title, Variables, FName, ScratchDir, &FType, Debug, VIsDouble);
744 }
745
tecini100_(char * Title,char * Variables,char * FName,char * ScratchDir,INTEGER4 * Debug,INTEGER4 * VIsDouble)746 LIBFUNCTION INTEGER4 LIBCALL tecini100_(char *Title,
747 char *Variables,
748 char *FName,
749 char *ScratchDir,
750 INTEGER4 *Debug,
751 INTEGER4 *VIsDouble)
752 {
753 INTEGER4 FType = FULLFILE;
754 return TECINI112(Title, Variables, FName, ScratchDir, &FType, Debug, VIsDouble);
755 }
756
tecini_(char * Title,char * Variables,char * FName,char * ScratchDir,INTEGER4 * Debug,INTEGER4 * VIsDouble)757 LIBFUNCTION INTEGER4 LIBCALL tecini_(char *Title,
758 char *Variables,
759 char *FName,
760 char *ScratchDir,
761 INTEGER4 *Debug,
762 INTEGER4 *VIsDouble)
763 {
764 INTEGER4 FType = FULLFILE;
765 return TECINI112(Title,
766 Variables,
767 FName,
768 ScratchDir,
769 &FType,
770 Debug,
771 VIsDouble);
772 }
773 #endif
774
775
CheckData(const char * routine_name)776 static int CheckData(const char *routine_name)
777 {
778
779 if (NumDataValuesToWrite[CurFile] != NumDataValuesWritten[CurFile])
780 {
781 #if defined MAKEARCHIVE
782 {
783 PRINT2("Err: (%s) Wrong number of data values in file %d:\n", routine_name, CurFile + 1);
784 PRINT2(" %d data values for Zone %d were processed,\n", NumDataValuesWritten[CurFile], CurZone[CurFile] + 1);
785 PRINT1(" %d data values were expected.\n", NumDataValuesToWrite[CurFile]);
786 }
787 #else
788 {
789 UNUSED(routine_name);
790 }
791 #endif
792 NumErrs[CurFile]++;
793 return (-1);
794 }
795 return (0);
796 }
797
CheckFile(const char * routine_name)798 static int CheckFile(const char *routine_name)
799 {
800 if ((CurFile == -1) || (!IsOpen[CurFile]))
801 {
802 #if defined MAKEARCHIVE
803 {
804 PRINT2("Err: (%s) Attempt to use invalid file (%d).\n",
805 routine_name, CurFile + 1);
806 }
807 #else
808 {
809 UNUSED(routine_name);
810 }
811 #endif
812 return (-1);
813 }
814 return (0);
815 }
816
817 /**
818 * Advances CurVar[CurFile] to the next non-shared active variable. TECDATXXX
819 * clients should not supply values for shared or passive variables.
820 */
AdvanceToNextVarWithValues(void)821 static void AdvanceToNextVarWithValues(void)
822 {
823 /* search for the next variable with values */
824 do
825 {
826 CurVar[CurFile]++;
827 }
828 while (CurVar[CurFile] < NumVars[CurFile] &&
829 (IsSharedVar[CurFile][CurVar[CurFile]] ||
830 IsPassiveVar[CurFile][CurVar[CurFile]]));
831 }
832
833 /**
834 * TECZNEXXX
835 */
TECZNE112(char * ZnTitle,INTEGER4 * ZnType,INTEGER4 * IMxOrNumPts,INTEGER4 * JMxOrNumElements,INTEGER4 * KMxOrNumFaces,INTEGER4 * ICellMx,INTEGER4 * JCellMx,INTEGER4 * KCellMx,double * SolutionTime,INTEGER4 * StrandID,INTEGER4 * ParentZone,INTEGER4 * IsBlk,INTEGER4 * NumFaceConn,INTEGER4 * FNMode,INTEGER4 * NumFaceNodes,INTEGER4 * NumFaceBndryFaces,INTEGER4 * NumFaceBndryConns,INTEGER4 * PassiveVarList,INTEGER4 * ValueLocation,INTEGER4 * ShareVarFromZone,INTEGER4 * ShareConnectivityFromZone)836 INTEGER4 LIBCALL TECZNE112(char *ZnTitle,
837 INTEGER4 *ZnType,
838 INTEGER4 *IMxOrNumPts,
839 INTEGER4 *JMxOrNumElements,
840 INTEGER4 *KMxOrNumFaces,
841 INTEGER4 *ICellMx,
842 INTEGER4 *JCellMx,
843 INTEGER4 *KCellMx,
844 double *SolutionTime,
845 INTEGER4 *StrandID,
846 INTEGER4 *ParentZone,
847 INTEGER4 *IsBlk,
848 INTEGER4 *NumFaceConn,
849 INTEGER4 *FNMode,
850 INTEGER4 *NumFaceNodes,
851 INTEGER4 *NumFaceBndryFaces,
852 INTEGER4 *NumFaceBndryConns,
853 INTEGER4 *PassiveVarList,
854 INTEGER4 *ValueLocation,
855 INTEGER4 *ShareVarFromZone,
856 INTEGER4 *ShareConnectivityFromZone)
857 {
858 int I;
859 int IsOk = 1;
860
861 if (CheckFile("TECZNE112") < 0)
862 return (-1);
863
864 if (CurZone[CurFile] > -1)
865 {
866 if (CheckData("TECZNE112") < 0)
867 return (-1);
868 }
869
870 if (NumVars[CurFile] == 0)
871 {
872 WriteErr("TECZNE112");
873 #if defined MAKEARCHIVE
874 PRINT1("Err: (TECZNE112) Cannot write out zones if numvars is equal to zero (file %d).\n",
875 CurFile + 1);
876 #endif
877 return (-1);
878 }
879
880 if (CurZone[CurFile] > MaxNumZonesOrVars - 2) /* -1 based */
881 {
882 WriteErr("TECZNE112");
883 #if defined MAKEARCHIVE
884 PRINT2("Err: (TECZNE112) Exceeded max number of zones (%d) in file %d.\n",
885 MaxNumZonesOrVars, CurFile + 1);
886 #endif
887 return (-1);
888 }
889
890 if (*StrandID < -1)
891 {
892 #if defined MAKEARCHIVE
893 PRINT2("Err: (TECZNE112) Invalid StrandID supplied for file %d, zone %d.\n",
894 CurFile + 1, CurZone[CurFile] + 1 + 1);
895 #endif
896 return (-1);
897 }
898
899 if (*ParentZone < 0)
900 {
901 #if defined MAKEARCHIVE
902 PRINT2("Err: (TECZNE112) Invalid ParentZone supplied for file %d, zone %d.\n",
903 CurFile + 1, CurZone[CurFile] + 1 + 1);
904 #endif
905 return (-1);
906 }
907
908 /*
909 * This is a temporary error. Point format should no longer be written to the file
910 * and should instead be converted to block format before being written. Since the
911 * conversion has not yet been implemented, it is an error to use point data.
912 * TODO (JN): Remove this error when point to block conversion has been implemented.
913 */
914 if (*IsBlk != 1)
915 {
916 #if defined MAKEARCHIVE
917 PRINT2("Err: (TECZNE112) Point data is not currently allowed. "
918 " Please use block format for file %d, zone %d.\n",
919 CurFile + 1, CurZone[CurFile] + 1 + 1);
920 #endif
921 return (-1);
922 }
923
924 NumDataValuesWritten[CurFile] = 0;
925 NumOrderedCCDataValuesWritten[CurFile] = 0;
926 CurZone[CurFile]++;
927
928 /* Resize zone-dimensioned arrays (CurZone[] is 0-based) */
929 try
930 {
931 MinMaxOffset[CurFile].resize(CurZone[CurFile] + 1);
932 TotalNumFaceNodes[CurFile].resize(CurZone[CurFile] + 1);
933 NumFaceConnections[CurFile].resize(CurZone[CurFile] + 1);
934 FaceNeighborsOrMapWritten[CurFile].resize(CurZone[CurFile] + 1);
935 NumConnectivityNodes[CurFile].resize(CurZone[CurFile] + 1);
936 NumConnectivityNodesWritten[CurFile].resize(CurZone[CurFile] + 1);
937 ConnectivityWritten[CurFile].resize(CurZone[CurFile] + 1);
938 }
939 catch (std::bad_alloc const&)
940 {
941 #if defined MAKEARCHIVE
942 PRINT0("Err: (TECZNE112) Memory allocation error.\n");
943 #endif
944 NumErrs[CurFile]++;
945 return (-1);
946 }
947
948 ZoneType[CurFile] = *ZnType;
949 IMax[CurFile] = *IMxOrNumPts;
950 JMax[CurFile] = *JMxOrNumElements;
951 KMax[CurFile] = *KMxOrNumFaces;
952 ICellMax[CurFile] = *ICellMx;
953 JCellMax[CurFile] = *JCellMx;
954 KCellMax[CurFile] = *KCellMx;
955 /* Set the flags that connectivity, face neighbors or face map hasn't been written for the zone yet. */
956 FaceNeighborsOrMapWritten[CurFile][CurZone[CurFile]] = FALSE;
957 NumConnectivityNodesWritten[CurFile][CurZone[CurFile]] = 0;
958 ConnectivityWritten[CurFile][CurZone[CurFile]] = FALSE;
959
960 if (ZoneType[CurFile] == ZoneType_FEPolygon ||
961 ZoneType[CurFile] == ZoneType_FEPolyhedron)
962 {
963 NumFaceConnections[CurFile][CurZone[CurFile]] = 0; /* ...not used for polytope data */
964 FaceNeighborMode[CurFile] = 0; /* ...not used for polytope data */
965 NumConnectivityNodes[CurFile][CurZone[CurFile]] = 0; /* ...not used for polytope data */
966
967 IsBlock[CurFile] = TRUE; /* ...polytope data is always block */
968 TotalNumFaceNodes[CurFile][CurZone[CurFile]] = *NumFaceNodes;
969 TotalNumFaceBndryFaces[CurFile] = *NumFaceBndryFaces;
970 TotalNumFaceBndryConns[CurFile] = *NumFaceBndryConns;
971 }
972 else /* ...classic data */
973 {
974 IsBlock[CurFile] = *IsBlk;
975 NumFaceConnections[CurFile][CurZone[CurFile]] = *NumFaceConn;
976 FaceNeighborMode[CurFile] = *FNMode;
977
978 TotalNumFaceNodes[CurFile][CurZone[CurFile]] = 0; /* ...not used for classic data */
979 TotalNumFaceBndryFaces[CurFile] = 0; /* ...not used for classic data */
980 TotalNumFaceBndryConns[CurFile] = 0; /* ...not used for classic data */
981 }
982
983 WriteBinaryReal(HeadFile[CurFile],
984 (double)ZoneMarker,
985 FieldDataType_Float);
986 if (!DumpDatafileString(HeadFile[CurFile],
987 ZnTitle,
988 TRUE))
989 {
990 WriteErr("TECZNE112");
991 return (-1);
992 }
993
994 if ((ShareVarFromZone && *ShareConnectivityFromZone) &&
995 CurZone[CurFile] == 0)
996 {
997 /* can't have a duplist if there's nothing to duplicate */
998 IsOk = 0;
999 }
1000
1001 if (IsOk == 0)
1002 {
1003 #if defined MAKEARCHIVE
1004 PRINT1("Err: (TECZNE112) Bad zone format for file %d.\n", CurFile + 1);
1005 #endif
1006 NumErrs[CurFile]++;
1007 return (-1);
1008 }
1009
1010 switch (ZoneType[CurFile])
1011 {
1012 case ORDERED:
1013 NumIndices[CurFile] = 0;
1014 break;
1015 case FELINESEG:
1016 NumIndices[CurFile] = 2;
1017 break;
1018 case FETRIANGLE:
1019 NumIndices[CurFile] = 3;
1020 break;
1021 case FEQUADRILATERAL:
1022 NumIndices[CurFile] = 4;
1023 break;
1024 case FETETRAHEDRON:
1025 NumIndices[CurFile] = 4;
1026 break;
1027 case FEBRICK:
1028 NumIndices[CurFile] = 8;
1029 break;
1030 }
1031
1032 /* ...not used for poly or ordered data and don't count sharing or solution files. */
1033 if (ZoneType[CurFile] != ZoneType_FEPolygon &&
1034 ZoneType[CurFile] != ZoneType_FEPolyhedron &&
1035 *ShareConnectivityFromZone == 0 &&
1036 FileTypes[CurFile] != SOLUTIONFILE)
1037 NumConnectivityNodes[CurFile][CurZone[CurFile]] = NumIndices[CurFile] * JMax[CurFile];
1038
1039 /*
1040 * We do not check any return values until the end. If these calls fail,
1041 * WriteFieldDataType below should fail as well.
1042 */
1043 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)(*ParentZone) - 1); /* ...ParentZone is zero based for binary file */
1044 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)(*StrandID) - 1); /* ...StrandID is zero based for binary file */
1045 WriteBinaryReal(HeadFile[CurFile], *SolutionTime, FieldDataType_Double);
1046 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t) - 1); /* No Zone Color Assignment */
1047 WriteBinaryInt32(HeadFile[CurFile], ZoneType[CurFile]);
1048
1049 NumDataValuesToWrite[CurFile] = 0;
1050 for (I = 0; I < NumVars[CurFile]; I++)
1051 {
1052 IsSharedVar[CurFile][I] = (ShareVarFromZone != NULL && ShareVarFromZone[I] != 0); /* ...shared? */
1053 IsPassiveVar[CurFile][I] = (PassiveVarList != NULL && PassiveVarList[I] == 1); /* ...passive? */
1054 }
1055
1056 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)(ValueLocation != NULL ? 1 : 0)); /* ...are var locations specified? */
1057 if (ValueLocation)
1058 {
1059 for (I = 0; I < NumVars[CurFile]; I++)
1060 {
1061 LgIndex_t NumNodes;
1062 LgIndex_t NumCells;
1063
1064 if (ZoneType[CurFile] == ORDERED)
1065 {
1066 NumNodes = IMax[CurFile] * JMax[CurFile] * KMax[CurFile];
1067 NumCells = (MAX(IMax[CurFile] - 1, 1) *
1068 MAX(JMax[CurFile] - 1, 1) *
1069 MAX(KMax[CurFile] - 1, 1));
1070 }
1071 else
1072 {
1073 NumNodes = IMax[CurFile];
1074 NumCells = JMax[CurFile];
1075 }
1076
1077 if (I == 0)
1078 NumRunningVarValues[CurFile][I] = 0;
1079 else
1080 NumRunningVarValues[CurFile][I] = NumRunningVarValues[CurFile][I-1];
1081
1082 IsCellCentered[CurFile][I] = (ValueLocation[I] == ValueLocation_CellCentered);
1083 if (ValueLocation[I] == ValueLocation_CellCentered)
1084 {
1085 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)1);
1086 if (!IsSharedVar[CurFile][I] && !IsPassiveVar[CurFile][I])
1087 {
1088 NumDataValuesToWrite[CurFile] += NumCells;
1089 NumRunningVarValues[CurFile][I] += NumCells;
1090 }
1091 }
1092 else if (ValueLocation[I] == ValueLocation_Nodal)
1093 {
1094 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)0);
1095 if (!IsSharedVar[CurFile][I] && !IsPassiveVar[CurFile][I])
1096 {
1097 NumDataValuesToWrite[CurFile] += NumNodes;
1098 NumRunningVarValues[CurFile][I] += NumNodes;
1099 }
1100 }
1101 else
1102 {
1103 #if defined MAKEARCHIVE
1104 PRINT2("Err: (TECZNE112) Bad zone value location for file %d, variable %d.\n", CurFile + 1, I + 1);
1105 #endif
1106 NumErrs[CurFile]++;
1107 return(-1);
1108 }
1109 }
1110 }
1111 else
1112 {
1113 LgIndex_t NumNodes;
1114 if (ZoneType[CurFile] == ORDERED)
1115 {
1116 NumNodes = IMax[CurFile] * JMax[CurFile] * KMax[CurFile];
1117 }
1118 else
1119 {
1120 NumNodes = IMax[CurFile];
1121 }
1122
1123 for (I = 0; I < NumVars[CurFile]; I++)
1124 {
1125 if (I == 0)
1126 NumRunningVarValues[CurFile][I] = 0;
1127 else
1128 NumRunningVarValues[CurFile][I] = NumRunningVarValues[CurFile][I-1];
1129
1130 IsCellCentered[CurFile][I] = FALSE;
1131 if (!IsSharedVar[CurFile][I] && !IsPassiveVar[CurFile][I])
1132 {
1133 NumDataValuesToWrite[CurFile] += NumNodes;
1134 NumRunningVarValues[CurFile][I] += NumNodes;
1135 }
1136 }
1137 }
1138
1139 /*
1140 * As of binary version 108 Tecplot introduced
1141 * the ability to output its auto-generated face
1142 * neighbor array in its raw form. For now
1143 * TecIO will always decline to perform this
1144 * step and instead fall back to the delivering
1145 * one neighbor at a time.
1146 */
1147 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)0); /* IsRawFNAvailable */
1148
1149 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)NumFaceConnections[CurFile][CurZone[CurFile]]);
1150 if (NumFaceConnections[CurFile][CurZone[CurFile]] > 0)
1151 {
1152 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)FaceNeighborMode[CurFile]);
1153 if (ZoneType[CurFile] != ORDERED)
1154 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)0); /* FEFaceNeighborsComplete */
1155 }
1156
1157 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)IMax[CurFile]);
1158 if (ZoneType[CurFile] == FEPOLYGON ||
1159 ZoneType[CurFile] == FEPOLYHEDRON)
1160 {
1161 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)KMax[CurFile]);
1162
1163 /*
1164 * As of binary version 111 these items moved from the data section to
1165 * the header.
1166 */
1167 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)TotalNumFaceNodes[CurFile][CurZone[CurFile]]);
1168 if (TotalNumFaceBndryFaces[CurFile] > 0)
1169 {
1170 /* Each boundary face must have >= 1 boundary connection. */
1171 if (TotalNumFaceBndryConns[CurFile] < TotalNumFaceBndryFaces[CurFile])
1172 {
1173 #if defined MAKEARCHIVE
1174 PRINT1("Err: (TECZNE112) There must be at least 1 boundary connection for each boundary face in zone %d.\n",
1175 CurZone[CurFile] + 1);
1176 PRINT2(" %d boundary faces and %d boundary connections were specified.\n",
1177 TotalNumFaceBndryFaces[CurFile], TotalNumFaceBndryConns[CurFile]);
1178 #endif
1179 NumErrs[CurFile]++;
1180 return(-1);
1181 }
1182
1183 /*
1184 * As a convenience for the ASCII format, TecUtil, and TECIO layers if any
1185 * boundary connections exists we automatically add a no-neighboring
1186 * connection as the first item so that they can user 0 for no-neighboring
1187 * element in the element list regardless if they have boundary connections
1188 * or not.
1189 */
1190 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)TotalNumFaceBndryFaces[CurFile] + 1); /* ...add a boundary face for no neighboring element as a convenience */
1191 }
1192 else
1193 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)TotalNumFaceBndryFaces[CurFile]);
1194 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)TotalNumFaceBndryConns[CurFile]);
1195 }
1196 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)JMax[CurFile]);
1197
1198 if (ZoneType[CurFile] == ORDERED)
1199 {
1200 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)KMax[CurFile]);
1201 }
1202 else
1203 {
1204 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)ICellMax[CurFile]);
1205 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)JCellMax[CurFile]);
1206 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)KCellMax[CurFile]);
1207 }
1208
1209 /*
1210 * Aux data. This has to be over-written by the aux data writing routine.
1211 * Because it currently at the end of the header section we don't need to
1212 * keep track of the position for seeking back to it.
1213 */
1214 WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)0);
1215
1216 WriteBinaryReal(BlckFile[CurFile],
1217 (double)ZoneMarker,
1218 FieldDataType_Float);
1219
1220 for (I = 0; I < NumVars[CurFile]; I++)
1221 {
1222 if (!WriteFieldDataType(BlckFile[CurFile],
1223 (FieldDataType_e)FieldDataType[CurFile],
1224 TRUE))
1225 {
1226 WriteErr("TECZNE112");
1227 return (-1);
1228 }
1229 }
1230
1231 /* Passive variable identification */
1232 if (PassiveVarList)
1233 {
1234 WriteBinaryInt32(BlckFile[CurFile], 1);
1235 for (I = 0; I < NumVars[CurFile]; I++)
1236 WriteBinaryInt32(BlckFile[CurFile], PassiveVarList[I]);
1237 }
1238 else
1239 WriteBinaryInt32(BlckFile[CurFile], 0);
1240
1241 /* get the CurVar[CurFile] on the first active variable */
1242 CurVar[CurFile] = -1;
1243 AdvanceToNextVarWithValues();
1244
1245 /* Variable & Connectivity Sharing */
1246 if (ShareVarFromZone)
1247 {
1248 WriteBinaryInt32(BlckFile[CurFile], 1);
1249 for (I = 0; I < NumVars[CurFile]; I++)
1250 WriteBinaryInt32(BlckFile[CurFile], ShareVarFromZone[I] - 1);
1251 }
1252 else
1253 WriteBinaryInt32(BlckFile[CurFile], 0);
1254 WriteBinaryInt32(BlckFile[CurFile], *ShareConnectivityFromZone - 1);
1255
1256 /*
1257 * Create place holders or the variable min/max value. We will come back
1258 * later after writing the data portion with the real min/max values. In the
1259 * mean time, keep track of the starting point so we can seek back to this
1260 * place.
1261 */
1262 MinMaxOffset[CurFile][CurZone[CurFile]] = (FileOffset_t)TP_FTELL(BlckFile[CurFile]->File);
1263
1264 for (I = 0; I < NumVars[CurFile]; I++)
1265 {
1266 /* initialize to unset values */
1267 VarMinValue[CurFile][I] = LARGEDOUBLE;
1268 VarMaxValue[CurFile][I] = -LARGEDOUBLE;
1269
1270 if (!IsSharedVar[CurFile][I] && !IsPassiveVar[CurFile][I])
1271 {
1272 WriteBinaryReal(BlckFile[CurFile], 0.0, FieldDataType_Double);
1273 WriteBinaryReal(BlckFile[CurFile], 0.0, FieldDataType_Double);
1274 }
1275 }
1276
1277 #if defined MAKEARCHIVE
1278 if (DebugLevel[CurFile])
1279 {
1280 PRINT1("Writing Zone %d:\n", CurZone[CurFile] + 1);
1281 PRINT1(" Title = %s\n", ZnTitle);
1282 PRINT1(" Type = %s\n", ZoneTypes[ZoneType[CurFile]]);
1283 PRINT1(" IMax = %d\n", IMax[CurFile]);
1284 PRINT1(" JMax = %d\n", JMax[CurFile]);
1285 PRINT1(" KMax = %d\n", KMax[CurFile]);
1286 if (ShareVarFromZone)
1287 {
1288 char DupList[1024] = "";
1289
1290 for (I = 0; I < NumVars[CurFile]; I++)
1291 {
1292 if (I > 0)
1293 strcat(DupList, ",");
1294 sprintf(&DupList[strlen(DupList)], "%d", ShareVarFromZone[I]);
1295 }
1296 PRINT1(" DupList = %s\n", DupList);
1297 }
1298 }
1299 #endif
1300
1301 return (0);
1302 }
1303
TECZNE111(char * ZnTitle,INTEGER4 * ZnType,INTEGER4 * IMxOrNumPts,INTEGER4 * JMxOrNumElements,INTEGER4 * KMxOrNumFaces,INTEGER4 * ICellMx,INTEGER4 * JCellMx,INTEGER4 * KCellMx,double * SolutionTime,INTEGER4 * StrandID,INTEGER4 * ParentZone,INTEGER4 * IsBlk,INTEGER4 * NumFaceConn,INTEGER4 * FNMode,INTEGER4 * NumFaceNodes,INTEGER4 * NumFaceBndryFaces,INTEGER4 * NumFaceBndryConns,INTEGER4 * PassiveVarList,INTEGER4 * ValueLocation,INTEGER4 * ShareVarFromZone,INTEGER4 * ShareConnectivityFromZone)1304 INTEGER4 LIBCALL TECZNE111(char *ZnTitle,
1305 INTEGER4 *ZnType,
1306 INTEGER4 *IMxOrNumPts,
1307 INTEGER4 *JMxOrNumElements,
1308 INTEGER4 *KMxOrNumFaces,
1309 INTEGER4 *ICellMx,
1310 INTEGER4 *JCellMx,
1311 INTEGER4 *KCellMx,
1312 double *SolutionTime,
1313 INTEGER4 *StrandID,
1314 INTEGER4 *ParentZone,
1315 INTEGER4 *IsBlk,
1316 INTEGER4 *NumFaceConn,
1317 INTEGER4 *FNMode,
1318 INTEGER4 *NumFaceNodes,
1319 INTEGER4 *NumFaceBndryFaces,
1320 INTEGER4 *NumFaceBndryConns,
1321 INTEGER4 *PassiveVarList,
1322 INTEGER4 *ValueLocation,
1323 INTEGER4 *ShareVarFromZone,
1324 INTEGER4 *ShareConnectivityFromZone)
1325 {
1326 return TECZNE112(ZnTitle,
1327 ZnType,
1328 IMxOrNumPts,
1329 JMxOrNumElements,
1330 KMxOrNumFaces,
1331 ICellMx,
1332 JCellMx,
1333 KCellMx,
1334 SolutionTime,
1335 StrandID,
1336 ParentZone,
1337 IsBlk,
1338 NumFaceConn,
1339 FNMode,
1340 NumFaceNodes,
1341 NumFaceBndryFaces,
1342 NumFaceBndryConns,
1343 PassiveVarList,
1344 ValueLocation,
1345 ShareVarFromZone,
1346 ShareConnectivityFromZone);
1347 }
1348
TECZNE110(char * ZnTitle,INTEGER4 * ZnType,INTEGER4 * IMxOrNumPts,INTEGER4 * JMxOrNumElements,INTEGER4 * KMx,INTEGER4 * ICellMx,INTEGER4 * JCellMx,INTEGER4 * KCellMx,double * SolutionTime,INTEGER4 * StrandID,INTEGER4 * ParentZone,INTEGER4 * IsBlk,INTEGER4 * NumFaceConn,INTEGER4 * FNMode,INTEGER4 * PassiveVarList,INTEGER4 * ValueLocation,INTEGER4 * ShareVarFromZone,INTEGER4 * ShareConnectivityFromZone)1349 INTEGER4 LIBCALL TECZNE110(char *ZnTitle,
1350 INTEGER4 *ZnType,
1351 INTEGER4 *IMxOrNumPts,
1352 INTEGER4 *JMxOrNumElements,
1353 INTEGER4 *KMx,
1354 INTEGER4 *ICellMx,
1355 INTEGER4 *JCellMx,
1356 INTEGER4 *KCellMx,
1357 double *SolutionTime,
1358 INTEGER4 *StrandID,
1359 INTEGER4 *ParentZone,
1360 INTEGER4 *IsBlk,
1361 INTEGER4 *NumFaceConn,
1362 INTEGER4 *FNMode,
1363 INTEGER4 *PassiveVarList,
1364 INTEGER4 *ValueLocation,
1365 INTEGER4 *ShareVarFromZone,
1366 INTEGER4 *ShareConnectivityFromZone)
1367 {
1368 INTEGER4 NumFaceNodes = 0;
1369 INTEGER4 NumFaceBndryFaces = 0;
1370 INTEGER4 NumFaceBndryConns = 0;
1371
1372 return TECZNE112(ZnTitle,
1373 ZnType,
1374 IMxOrNumPts,
1375 JMxOrNumElements,
1376 KMx,
1377 ICellMx,
1378 JCellMx,
1379 KCellMx,
1380 SolutionTime,
1381 StrandID,
1382 ParentZone,
1383 IsBlk,
1384 NumFaceConn,
1385 FNMode,
1386 &NumFaceNodes,
1387 &NumFaceBndryFaces,
1388 &NumFaceBndryConns,
1389 PassiveVarList,
1390 ValueLocation,
1391 ShareVarFromZone,
1392 ShareConnectivityFromZone);
1393 }
1394
TECZNE100(char * ZnTitle,INTEGER4 * ZnType,INTEGER4 * IMxOrNumPts,INTEGER4 * JMxOrNumElements,INTEGER4 * KMx,INTEGER4 * ICellMx,INTEGER4 * JCellMx,INTEGER4 * KCellMx,INTEGER4 * IsBlk,INTEGER4 * NumFaceConn,INTEGER4 * FNMode,INTEGER4 * ValueLocation,INTEGER4 * ShareVarFromZone,INTEGER4 * ShareConnectivityFromZone)1395 INTEGER4 LIBCALL TECZNE100(char *ZnTitle,
1396 INTEGER4 *ZnType,
1397 INTEGER4 *IMxOrNumPts,
1398 INTEGER4 *JMxOrNumElements,
1399 INTEGER4 *KMx,
1400 INTEGER4 *ICellMx,
1401 INTEGER4 *JCellMx,
1402 INTEGER4 *KCellMx,
1403 INTEGER4 *IsBlk,
1404 INTEGER4 *NumFaceConn,
1405 INTEGER4 *FNMode,
1406 INTEGER4 *ValueLocation,
1407 INTEGER4 *ShareVarFromZone,
1408 INTEGER4 *ShareConnectivityFromZone)
1409 {
1410 double SolutionTime = 0.0;
1411 INTEGER4 StrandID = STRAND_ID_STATIC + 1; /* TECXXX is ones based for StrandID */
1412 INTEGER4 ParentZone = BAD_SET_VALUE + 1; /* TECXXX is ones based for ParentZone */
1413 INTEGER4 NumFaceNodes = 0;
1414 INTEGER4 NumFaceBndryFaces = 0;
1415 INTEGER4 NumFaceBndryConns = 0;
1416
1417 return TECZNE112(ZnTitle,
1418 ZnType,
1419 IMxOrNumPts,
1420 JMxOrNumElements,
1421 KMx,
1422 ICellMx,
1423 JCellMx,
1424 KCellMx,
1425 &SolutionTime,
1426 &StrandID,
1427 &ParentZone,
1428 IsBlk,
1429 NumFaceConn,
1430 FNMode,
1431 &NumFaceNodes,
1432 &NumFaceBndryFaces,
1433 &NumFaceBndryConns,
1434 NULL, /* PassiveVarList */
1435 ValueLocation,
1436 ShareVarFromZone,
1437 ShareConnectivityFromZone);
1438 }
1439
1440 #if !defined INDEX_16_BIT // not supported in this test-only mode
TECZNE(char * ZoneTitle,INTEGER4 * IMx,INTEGER4 * JMx,INTEGER4 * KMx,char * ZFormat,char * DupList)1441 INTEGER4 LIBCALL TECZNE(char *ZoneTitle,
1442 INTEGER4 *IMx,
1443 INTEGER4 *JMx,
1444 INTEGER4 *KMx,
1445 char *ZFormat,
1446 char *DupList)
1447 {
1448
1449 LgIndex_t ZoneType;
1450 LgIndex_t IsBlock;
1451 LgIndex_t *ShareVarFromZone = NULL;
1452 LgIndex_t ShareConnectivityFromZone;
1453 LgIndex_t Result = 0;
1454
1455
1456 if (ZFormat == NULL)
1457 Result = -1;
1458 else if (!strcmp(ZFormat, "BLOCK"))
1459 {
1460 IsBlock = 1;
1461 ZoneType = ZoneType_Ordered;
1462 }
1463 else if (!strcmp(ZFormat, "FEBLOCK"))
1464 {
1465 IsBlock = 1;
1466 switch (*KMx)
1467 {
1468 /*
1469 * From preplot.c:
1470 *
1471 * ZoneType 0=ORDERED,1=FELINESEG,2=FETRIANGLE,
1472 * 3=FEQUADRILATERAL,4=FETETRAHEDRON,5=FEBRICK
1473 */
1474 case 0: /* Triangular. */
1475 ZoneType = 2;
1476 break;
1477 case 1: /* Quadrilateral */
1478 ZoneType = 3;
1479 break;
1480 case 2: /* Tetrahedral */
1481 ZoneType = 4;
1482 break;
1483 case 3: /* Brick. */
1484 ZoneType = 5;
1485 break;
1486 }
1487 }
1488 else if (!strcmp(ZFormat, "POINT"))
1489 {
1490 IsBlock = 0;
1491 ZoneType = ZoneType_Ordered;
1492 }
1493 else if (!strcmp(ZFormat, "FEPOINT"))
1494 {
1495 IsBlock = 0;
1496 switch (*KMx)
1497 {
1498 case 0: /* Triangular. */
1499 ZoneType = 2;
1500 break;
1501 case 1: /* Quadrilateral */
1502 ZoneType = 3;
1503 break;
1504 case 2: /* Tetrahedral */
1505 ZoneType = 4;
1506 break;
1507 case 3: /* Brick. */
1508 ZoneType = 5;
1509 break;
1510 }
1511 }
1512 else
1513 Result = -1;
1514
1515 ShareConnectivityFromZone = 0;
1516
1517
1518 if (Result == 0 &&
1519 DupList &&
1520 !ParseDupList(&ShareVarFromZone, &ShareConnectivityFromZone, DupList))
1521 {
1522 Result = -1;
1523 }
1524
1525 /*Result = TECZNE((char *)ZoneTitle, IMx, JMx, KMx, (char *)ZFormat,(char*)DupList);*/
1526 if (Result == 0)
1527 {
1528 INTEGER4 ICellMx = 0;
1529 INTEGER4 JCellMx = 0;
1530 INTEGER4 KCellMx = 0;
1531 INTEGER4 NumFaceConnections = 0;
1532 INTEGER4 FaceNeighborMode = FaceNeighborMode_LocalOneToOne;
1533 double SolutionTime = 0.0;
1534 INTEGER4 StrandID = STRAND_ID_STATIC + 1; /* TECXXX is ones based for StrandID */
1535 INTEGER4 ParentZone = BAD_SET_VALUE + 1; /* TECXXX is ones based for ParentZone */
1536 INTEGER4 NumFaceNodes = 0;
1537 INTEGER4 NumFaceBndryFaces = 0;
1538 INTEGER4 NumFaceBndryConns = 0;
1539
1540 Result = TECZNE112((char *)ZoneTitle,
1541 &ZoneType,
1542 IMx,
1543 JMx,
1544 KMx,
1545 &ICellMx,
1546 &JCellMx,
1547 &KCellMx,
1548 &SolutionTime,
1549 &StrandID,
1550 &ParentZone,
1551 &IsBlock,
1552 &NumFaceConnections,
1553 &FaceNeighborMode,
1554 &NumFaceNodes,
1555 &NumFaceBndryFaces,
1556 &NumFaceBndryConns,
1557 NULL, /* PassiveVarList */
1558 NULL, /* ValueLocation */
1559 DupList ? ShareVarFromZone : NULL,
1560 &ShareConnectivityFromZone);
1561 TecXXXZoneNum++;
1562 }
1563
1564 if (ShareVarFromZone)
1565 FREE_ARRAY(ShareVarFromZone, "Variable sharing list");
1566
1567 return (INTEGER4) Result;
1568 }
1569 #endif // INDEX_16_BIT -- not supported in this test-only mode
1570
1571 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
teczne112_(char * ZoneTitle,INTEGER4 * ZnType,INTEGER4 * IMxOrNumPts,INTEGER4 * JMxOrNumElements,INTEGER4 * KMx,INTEGER4 * ICellMx,INTEGER4 * JCellMx,INTEGER4 * KCellMx,double * SolutionTime,INTEGER4 * StrandID,INTEGER4 * ParentZone,INTEGER4 * IsBlk,INTEGER4 * NumFaceConn,INTEGER4 * FNMode,INTEGER4 * NumFaceNodes,INTEGER4 * NumFaceBndryFaces,INTEGER4 * NumFaceBndryConns,INTEGER4 * PassiveVarList,INTEGER4 * ValueLocation,INTEGER4 * ShareVarFromZone,INTEGER4 * ShareConnectivityFromZone)1572 LIBFUNCTION INTEGER4 LIBCALL teczne112_(char *ZoneTitle,
1573 INTEGER4 *ZnType,
1574 INTEGER4 *IMxOrNumPts,
1575 INTEGER4 *JMxOrNumElements,
1576 INTEGER4 *KMx,
1577 INTEGER4 *ICellMx,
1578 INTEGER4 *JCellMx,
1579 INTEGER4 *KCellMx,
1580 double *SolutionTime,
1581 INTEGER4 *StrandID,
1582 INTEGER4 *ParentZone,
1583 INTEGER4 *IsBlk,
1584 INTEGER4 *NumFaceConn,
1585 INTEGER4 *FNMode,
1586 INTEGER4 *NumFaceNodes,
1587 INTEGER4 *NumFaceBndryFaces,
1588 INTEGER4 *NumFaceBndryConns,
1589 INTEGER4 *PassiveVarList,
1590 INTEGER4 *ValueLocation,
1591 INTEGER4 *ShareVarFromZone,
1592 INTEGER4 *ShareConnectivityFromZone)
1593 {
1594 return TECZNE112(ZoneTitle,
1595 ZnType,
1596 IMxOrNumPts,
1597 JMxOrNumElements,
1598 KMx,
1599 ICellMx,
1600 JCellMx,
1601 KCellMx,
1602 SolutionTime,
1603 StrandID,
1604 ParentZone,
1605 IsBlk,
1606 NumFaceConn,
1607 FNMode,
1608 NumFaceNodes,
1609 NumFaceBndryFaces,
1610 NumFaceBndryConns,
1611 PassiveVarList,
1612 ValueLocation,
1613 ShareVarFromZone,
1614 ShareConnectivityFromZone);
1615 }
1616
teczne111_(char * ZoneTitle,INTEGER4 * ZnType,INTEGER4 * IMxOrNumPts,INTEGER4 * JMxOrNumElements,INTEGER4 * KMx,INTEGER4 * ICellMx,INTEGER4 * JCellMx,INTEGER4 * KCellMx,double * SolutionTime,INTEGER4 * StrandID,INTEGER4 * ParentZone,INTEGER4 * IsBlk,INTEGER4 * NumFaceConn,INTEGER4 * FNMode,INTEGER4 * NumFaceNodes,INTEGER4 * NumFaceBndryFaces,INTEGER4 * NumFaceBndryConns,INTEGER4 * PassiveVarList,INTEGER4 * ValueLocation,INTEGER4 * ShareVarFromZone,INTEGER4 * ShareConnectivityFromZone)1617 LIBFUNCTION INTEGER4 LIBCALL teczne111_(char *ZoneTitle,
1618 INTEGER4 *ZnType,
1619 INTEGER4 *IMxOrNumPts,
1620 INTEGER4 *JMxOrNumElements,
1621 INTEGER4 *KMx,
1622 INTEGER4 *ICellMx,
1623 INTEGER4 *JCellMx,
1624 INTEGER4 *KCellMx,
1625 double *SolutionTime,
1626 INTEGER4 *StrandID,
1627 INTEGER4 *ParentZone,
1628 INTEGER4 *IsBlk,
1629 INTEGER4 *NumFaceConn,
1630 INTEGER4 *FNMode,
1631 INTEGER4 *NumFaceNodes,
1632 INTEGER4 *NumFaceBndryFaces,
1633 INTEGER4 *NumFaceBndryConns,
1634 INTEGER4 *PassiveVarList,
1635 INTEGER4 *ValueLocation,
1636 INTEGER4 *ShareVarFromZone,
1637 INTEGER4 *ShareConnectivityFromZone)
1638 {
1639 return TECZNE112(ZoneTitle,
1640 ZnType,
1641 IMxOrNumPts,
1642 JMxOrNumElements,
1643 KMx,
1644 ICellMx,
1645 JCellMx,
1646 KCellMx,
1647 SolutionTime,
1648 StrandID,
1649 ParentZone,
1650 IsBlk,
1651 NumFaceConn,
1652 FNMode,
1653 NumFaceNodes,
1654 NumFaceBndryFaces,
1655 NumFaceBndryConns,
1656 PassiveVarList,
1657 ValueLocation,
1658 ShareVarFromZone,
1659 ShareConnectivityFromZone);
1660 }
1661
teczne110_(char * ZoneTitle,INTEGER4 * ZnType,INTEGER4 * IMxOrNumPts,INTEGER4 * JMxOrNumElements,INTEGER4 * KMx,INTEGER4 * ICellMx,INTEGER4 * JCellMx,INTEGER4 * KCellMx,double * SolutionTime,INTEGER4 * StrandID,INTEGER4 * ParentZone,INTEGER4 * IsBlk,INTEGER4 * NumFaceConn,INTEGER4 * FNMode,INTEGER4 * PassiveVarList,INTEGER4 * ValueLocation,INTEGER4 * ShareVarFromZone,INTEGER4 * ShareConnectivityFromZone)1662 LIBFUNCTION INTEGER4 LIBCALL teczne110_(char *ZoneTitle,
1663 INTEGER4 *ZnType,
1664 INTEGER4 *IMxOrNumPts,
1665 INTEGER4 *JMxOrNumElements,
1666 INTEGER4 *KMx,
1667 INTEGER4 *ICellMx,
1668 INTEGER4 *JCellMx,
1669 INTEGER4 *KCellMx,
1670 double *SolutionTime,
1671 INTEGER4 *StrandID,
1672 INTEGER4 *ParentZone,
1673 INTEGER4 *IsBlk,
1674 INTEGER4 *NumFaceConn,
1675 INTEGER4 *FNMode,
1676 INTEGER4 *PassiveVarList,
1677 INTEGER4 *ValueLocation,
1678 INTEGER4 *ShareVarFromZone,
1679 INTEGER4 *ShareConnectivityFromZone)
1680 {
1681 INTEGER4 NumFaceNodes = 0;
1682 INTEGER4 NumFaceBndryFaces = 0;
1683 INTEGER4 NumFaceBndryConns = 0;
1684
1685 return TECZNE112(ZoneTitle,
1686 ZnType,
1687 IMxOrNumPts,
1688 JMxOrNumElements,
1689 KMx,
1690 ICellMx,
1691 JCellMx,
1692 KCellMx,
1693 SolutionTime,
1694 StrandID,
1695 ParentZone,
1696 IsBlk,
1697 NumFaceConn,
1698 FNMode,
1699 &NumFaceNodes,
1700 &NumFaceBndryFaces,
1701 &NumFaceBndryConns,
1702 PassiveVarList,
1703 ValueLocation,
1704 ShareVarFromZone,
1705 ShareConnectivityFromZone);
1706 }
1707
teczne100_(char * ZoneTitle,INTEGER4 * ZnType,INTEGER4 * IMxOrNumPts,INTEGER4 * JMxOrNumElements,INTEGER4 * KMx,INTEGER4 * ICellMx,INTEGER4 * JCellMx,INTEGER4 * KCellMx,INTEGER4 * IsBlk,INTEGER4 * NumFaceConn,INTEGER4 * FNMode,INTEGER4 * ValueLocation,INTEGER4 * ShareVarFromZone,INTEGER4 * ShareConnectivityFromZone)1708 LIBFUNCTION INTEGER4 LIBCALL teczne100_(char *ZoneTitle,
1709 INTEGER4 *ZnType,
1710 INTEGER4 *IMxOrNumPts,
1711 INTEGER4 *JMxOrNumElements,
1712 INTEGER4 *KMx,
1713 INTEGER4 *ICellMx,
1714 INTEGER4 *JCellMx,
1715 INTEGER4 *KCellMx,
1716 INTEGER4 *IsBlk,
1717 INTEGER4 *NumFaceConn,
1718 INTEGER4 *FNMode,
1719 INTEGER4 *ValueLocation,
1720 INTEGER4 *ShareVarFromZone,
1721 INTEGER4 *ShareConnectivityFromZone)
1722 {
1723 return TECZNE100(ZoneTitle,
1724 ZnType,
1725 IMxOrNumPts,
1726 JMxOrNumElements,
1727 KMx,
1728 ICellMx,
1729 JCellMx,
1730 KCellMx,
1731 IsBlk,
1732 NumFaceConn,
1733 FNMode,
1734 ValueLocation,
1735 ShareVarFromZone,
1736 ShareConnectivityFromZone);
1737 }
1738
teczne_(char * ZoneTitle,INTEGER4 * IMx,INTEGER4 * JMx,INTEGER4 * KMx,char * ZFormat,char * DupList)1739 LIBFUNCTION INTEGER4 LIBCALL teczne_(char *ZoneTitle,
1740 INTEGER4 *IMx,
1741 INTEGER4 *JMx,
1742 INTEGER4 *KMx,
1743 char *ZFormat,
1744 char *DupList)
1745 {
1746 return TECZNE(ZoneTitle,
1747 IMx,
1748 JMx,
1749 KMx,
1750 ZFormat,
1751 DupList);
1752 }
1753 #endif
1754
1755 /**
1756 * Rewrite the var min/max place holders which currently have zero in them.
1757 */
RewritePendingMinMaxValues(void)1758 static void RewritePendingMinMaxValues(void)
1759 {
1760 FileOffset_t CurrentOffset = (FileOffset_t)TP_FTELL(BlckFile[CurFile]->File);
1761
1762 TP_FSEEK(BlckFile[CurFile]->File, MinMaxOffset[CurFile][CurZone[CurFile]], SEEK_SET);
1763 int I;
1764 for (I = 0; I < NumVars[CurFile]; I++)
1765 {
1766 if (!IsSharedVar[CurFile][I] && !IsPassiveVar[CurFile][I])
1767 {
1768 WriteBinaryReal(BlckFile[CurFile], VarMinValue[CurFile][I], FieldDataType_Double);
1769 WriteBinaryReal(BlckFile[CurFile], VarMaxValue[CurFile][I], FieldDataType_Double);
1770 }
1771 }
1772
1773 /* return the original position */
1774 TP_FSEEK(BlckFile[CurFile]->File, CurrentOffset, SEEK_SET);
1775 }
1776
1777 /**
1778 * TECDATXXX
1779 */
TECDAT112(INTEGER4 * N,void * Data,INTEGER4 * IsDouble)1780 INTEGER4 LIBCALL TECDAT112(INTEGER4 *N,
1781 void *Data,
1782 INTEGER4 *IsDouble)
1783 {
1784 LgIndex_t I;
1785 double *dptr = (double *)Data;
1786 float *fptr = (float *)Data;
1787
1788 if (CheckFile("TECDAT112") < 0)
1789 return (-1);
1790
1791 #if defined MAKEARCHIVE
1792 if (DebugLevel[CurFile] && (*N > 1))
1793 PRINT2("Writing %d values to file %d.\n", *N, CurFile + 1);
1794 #endif
1795
1796 for (I = 0; I < *N; I++)
1797 {
1798 double Value = (*IsDouble == 1 ? dptr[I] : fptr[I]);
1799
1800 /* keep track of var min/max */
1801 if (Value < VarMinValue[CurFile][CurVar[CurFile]])
1802 VarMinValue[CurFile][CurVar[CurFile]] = Value;
1803 if (Value > VarMaxValue[CurFile][CurVar[CurFile]])
1804 VarMaxValue[CurFile][CurVar[CurFile]] = Value;
1805
1806 if (!WriteBinaryReal(BlckFile[CurFile], Value, (FieldDataType_e)FieldDataType[CurFile]))
1807 {
1808 WriteErr("TECDAT112");
1809 return (-1);
1810 }
1811
1812 /*
1813 * As of version 103 Tecplot writes binary data files so that the ordered
1814 * cell centered field data includes the ghost cells. This makes it much
1815 * easier for Tecplot to map the data when reading by simply writing out
1816 * field data's as a block. As of version 104 the ghost cells of the
1817 * slowest moving index are not included.
1818 */
1819 if (IsCellCentered[CurFile][CurVar[CurFile]] && ZoneType[CurFile] == ORDERED)
1820 {
1821 CHECK(IsBlock[CurFile]); /* ...ordered CC data must be block format */
1822 LgIndex_t PIndex = (NumOrderedCCDataValuesWritten[CurFile]);
1823 LgIndex_t FinalIMax = MAX(IMax[CurFile] - 1, 1);
1824 LgIndex_t FinalJMax = MAX(JMax[CurFile] - 1, 1);
1825 LgIndex_t FinalKMax = MAX(KMax[CurFile] - 1, 1);
1826 LgIndex_t IIndex = (PIndex % IMax[CurFile]);
1827 LgIndex_t JIndex = ((PIndex % (IMax[CurFile] * JMax[CurFile])) / IMax[CurFile]);
1828 LgIndex_t KIndex = (PIndex / (IMax[CurFile] * JMax[CurFile]));
1829 LgIndex_t IMaxAdjust = 0;
1830 LgIndex_t JMaxAdjust = 0;
1831 LgIndex_t KMaxAdjust = 0;
1832 if (KMax[CurFile] > 1)
1833 KMaxAdjust = 1; /* ...K is slowest */
1834 else if (JMax[CurFile] > 1)
1835 JMaxAdjust = 1; /* ...J is slowest */
1836 else if (IMax[CurFile] > 1)
1837 IMaxAdjust = 1; /* ...I is slowest */
1838
1839 if (IIndex + 1 == FinalIMax && FinalIMax < IMax[CurFile] - IMaxAdjust)
1840 {
1841 NumOrderedCCDataValuesWritten[CurFile]++;
1842 if (!WriteBinaryReal(BlckFile[CurFile], 0.0, (FieldDataType_e)FieldDataType[CurFile]))
1843 {
1844 WriteErr("TECDAT112");
1845 return (-1);
1846 }
1847 }
1848 if (IIndex + 1 == FinalIMax &&
1849 (JIndex + 1 == FinalJMax && FinalJMax < JMax[CurFile] - JMaxAdjust))
1850 {
1851 LgIndex_t II;
1852 for (II = 1; II <= IMax[CurFile] - IMaxAdjust; II++)
1853 {
1854 NumOrderedCCDataValuesWritten[CurFile]++;
1855 if (!WriteBinaryReal(BlckFile[CurFile], 0.0, (FieldDataType_e)FieldDataType[CurFile]))
1856 {
1857 WriteErr("TECDAT112");
1858 return (-1);
1859 }
1860 }
1861 }
1862 if (IIndex + 1 == FinalIMax &&
1863 JIndex + 1 == FinalJMax &&
1864 (KIndex + 1 == FinalKMax && FinalKMax < KMax[CurFile] - KMaxAdjust))
1865 {
1866 LgIndex_t JJ, II;
1867 for (JJ = 1; JJ <= JMax[CurFile] - JMaxAdjust; JJ++)
1868 for (II = 1; II <= IMax[CurFile] - IMaxAdjust; II++)
1869 {
1870 NumOrderedCCDataValuesWritten[CurFile]++;
1871 if (!WriteBinaryReal(BlckFile[CurFile], 0.0, (FieldDataType_e)FieldDataType[CurFile]))
1872 {
1873 WriteErr("TECDAT112");
1874 return (-1);
1875 }
1876 }
1877 }
1878
1879 /* increment for the original cell value */
1880 NumOrderedCCDataValuesWritten[CurFile]++;
1881 }
1882
1883 /* update the number of data points written */
1884 NumDataValuesWritten[CurFile]++;
1885
1886 if (IsBlock[CurFile])
1887 {
1888 /* for block format update the variable when all values have been given */
1889 if (NumRunningVarValues[CurFile][CurVar[CurFile]] == NumDataValuesWritten[CurFile])
1890 {
1891 AdvanceToNextVarWithValues(); /* ...move on to the next variable */
1892 if (CurVar[CurFile] < NumVars[CurFile] &&
1893 IsCellCentered[CurFile][CurVar[CurFile]] &&
1894 ZoneType[CurFile] == ORDERED)
1895 NumOrderedCCDataValuesWritten[CurFile] = 0; /* reset for next CC variable */
1896 }
1897 }
1898 else
1899 {
1900 /* for point format update the variable after each value */
1901 AdvanceToNextVarWithValues();
1902 if (CurVar[CurFile] >= NumVars[CurFile])
1903 {
1904 /* reset to the first active variable */
1905 CurVar[CurFile] = -1;
1906 AdvanceToNextVarWithValues();
1907 }
1908 }
1909
1910 #if defined MAKEARCHIVE
1911 if (DebugLevel[CurFile] > 1)
1912 PRINT2("%d %G\n", NumDataValuesWritten[CurFile] + I + 1, Value);
1913 #endif
1914 }
1915
1916 /*
1917 * If this is the last call to TECDAT112,
1918 * then we may have to set the 'repeat adjacency list'
1919 * flag in the file.
1920 */
1921 if (HasFECONNECT[CurFile] &&
1922
1923 /* (essentialy this is CheckData() but we don't want to print
1924 an error message) */
1925 (NumDataValuesToWrite[CurFile] == NumDataValuesWritten[CurFile]))
1926 {
1927 if (!WriteBinaryInt32(BlckFile[CurFile], (LgIndex_t)1))
1928 {
1929 WriteErr("TECDAT112");
1930 return (-1);
1931 }
1932 }
1933
1934 /* re-write min/max values when all data has been delivered */
1935 if (NumDataValuesToWrite[CurFile] == NumDataValuesWritten[CurFile])
1936 RewritePendingMinMaxValues();
1937
1938 return (0);
1939 }
1940
TECDAT111(INTEGER4 * N,void * Data,INTEGER4 * IsDouble)1941 INTEGER4 LIBCALL TECDAT111(INTEGER4 *N,
1942 void *Data,
1943 INTEGER4 *IsDouble)
1944 {
1945 return TECDAT112(N,
1946 Data,
1947 IsDouble);
1948 }
1949
TECDAT110(INTEGER4 * N,void * FieldData,INTEGER4 * IsDouble)1950 INTEGER4 LIBCALL TECDAT110(INTEGER4 *N,
1951 void *FieldData,
1952 INTEGER4 *IsDouble)
1953 {
1954 return TECDAT112(N,
1955 FieldData,
1956 IsDouble);
1957 }
1958
TECDAT100(INTEGER4 * N,void * FieldData,INTEGER4 * IsDouble)1959 INTEGER4 LIBCALL TECDAT100(INTEGER4 *N,
1960 void *FieldData,
1961 INTEGER4 *IsDouble)
1962 {
1963 return TECDAT112(N,
1964 FieldData,
1965 IsDouble);
1966 }
1967
TECDAT(INTEGER4 * N,void * FieldData,INTEGER4 * IsDouble)1968 INTEGER4 LIBCALL TECDAT(INTEGER4 *N,
1969 void *FieldData,
1970 INTEGER4 *IsDouble)
1971 {
1972 return TECDAT112(N,
1973 FieldData,
1974 IsDouble);
1975 }
1976
1977 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tecdat112_(INTEGER4 * N,void * Data,INTEGER4 * IsDouble)1978 LIBFUNCTION INTEGER4 LIBCALL tecdat112_(INTEGER4 *N,
1979 void *Data,
1980 INTEGER4 *IsDouble)
1981 {
1982 return TECDAT112(N, Data, IsDouble);
1983 }
1984
tecdat111_(INTEGER4 * N,void * Data,INTEGER4 * IsDouble)1985 LIBFUNCTION INTEGER4 LIBCALL tecdat111_(INTEGER4 *N,
1986 void *Data,
1987 INTEGER4 *IsDouble)
1988 {
1989 return TECDAT112(N, Data, IsDouble);
1990 }
1991
tecdat110_(INTEGER4 * N,void * Data,INTEGER4 * IsDouble)1992 LIBFUNCTION INTEGER4 LIBCALL tecdat110_(INTEGER4 *N,
1993 void *Data,
1994 INTEGER4 *IsDouble)
1995 {
1996 return TECDAT112(N, Data, IsDouble);
1997 }
1998
tecdat100_(INTEGER4 * N,void * Data,INTEGER4 * IsDouble)1999 LIBFUNCTION INTEGER4 LIBCALL tecdat100_(INTEGER4 *N,
2000 void *Data,
2001 INTEGER4 *IsDouble)
2002 {
2003 return TECDAT112(N, Data, IsDouble);
2004 }
2005
tecdat_(INTEGER4 * N,void * FieldData,INTEGER4 * IsDouble)2006 LIBFUNCTION INTEGER4 LIBCALL tecdat_(INTEGER4 *N,
2007 void *FieldData,
2008 INTEGER4 *IsDouble)
2009 {
2010 return TECDAT112(N,
2011 FieldData,
2012 IsDouble);
2013 }
2014 #endif
2015
2016 /**
2017 * TECNODXXX
2018 */
TECNOD112(INTEGER4 * NData)2019 INTEGER4 LIBCALL TECNOD112(INTEGER4 *NData)
2020 {
2021 LgIndex_t L = NumConnectivityNodes[CurFile][CurZone[CurFile]];
2022 LgIndex_t I;
2023
2024 ConnectivityWritten[CurFile][CurZone[CurFile]] = TRUE;
2025
2026 if (CheckFile("TECNOD112") < 0)
2027 return (-1);
2028
2029 if (ZoneType[CurFile] == FEPOLYGON ||
2030 ZoneType[CurFile] == FEPOLYHEDRON)
2031 {
2032 /* Wrong way to specify connectivity for polygons and polyhedrons */
2033 #if defined MAKEARCHIVE
2034 PRINT0("Err: (TECNOD112) Cannot call TECNOD112 for polygonal or polyhedral zones.\n");
2035 #endif
2036 NumErrs[CurFile]++;
2037 return (-1);
2038 }
2039
2040 if (HasFECONNECT[CurFile])
2041 {
2042 /*
2043 * The connectivity list is duplicated,
2044 * so we shouldn't be calling TECNOD112()
2045 */
2046 return (-1);
2047 }
2048
2049 if (FileTypes[CurFile] == SOLUTIONFILE)
2050 {
2051 #if defined MAKEARCHIVE
2052 PRINT0("Err: (TECNOD112) Cannot call TECNOD112 if file type is SOLUTIONFILE.\n");
2053 #endif
2054 NumErrs[CurFile]++;
2055 return (-1);
2056 }
2057
2058 if (ZoneType[CurFile] == ORDERED)
2059 {
2060 #if defined MAKEARCHIVE
2061 PRINT0("Err: (TECNOD112) Cannot call TECNOD110 if zone type is ORDERED.\n");
2062 #endif
2063 NumErrs[CurFile]++;
2064 return (-1);
2065 }
2066
2067 if (CheckData("TECNOD112") < 0)
2068 return (-1);
2069
2070 for (I = 0; I < L; I++)
2071 {
2072 if ((NData[I] > IMax[CurFile]) ||
2073 (NData[I] < 1))
2074 {
2075 #if defined MAKEARCHIVE
2076 PRINT1("Err: (TECNOD112) Invalid node map value at position %d:\n", I);
2077 PRINT2(" node map value = %d, max value = %d.\n", NData[I], IMax[CurFile]);
2078 #endif
2079 NumErrs[CurFile]++;
2080 return (-1);
2081 }
2082 /*
2083 * As of version 103 Tecplot assumes that node maps are zero based
2084 * instead of ones based. Since we have to maintain the contract we
2085 * subtract 1 for the caller.
2086 */
2087 if (!WriteBinaryInt32(BlckFile[CurFile], NData[I] - 1)) /* zero based */
2088 {
2089 WriteErr("TECNOD112");
2090 return (-1);
2091 }
2092 }
2093 return (0);
2094 }
2095
TECNOD111(INTEGER4 * NData)2096 INTEGER4 LIBCALL TECNOD111(INTEGER4 *NData)
2097 {
2098 return TECNOD112(NData);
2099 }
2100
TECNOD110(INTEGER4 * NData)2101 INTEGER4 LIBCALL TECNOD110(INTEGER4 *NData)
2102 {
2103 return TECNOD112(NData);
2104 }
2105
TECNOD100(INTEGER4 * NData)2106 INTEGER4 LIBCALL TECNOD100(INTEGER4 *NData)
2107 {
2108 return TECNOD112(NData);
2109 }
2110
TECNOD(INTEGER4 * NData)2111 INTEGER4 LIBCALL TECNOD(INTEGER4 *NData)
2112 {
2113 return TECNOD112(NData);
2114 }
2115
2116 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tecnod112_(INTEGER4 * NData)2117 LIBFUNCTION INTEGER4 LIBCALL tecnod112_(INTEGER4 *NData)
2118 {
2119 return TECNOD112(NData);
2120 }
2121
tecnod111_(INTEGER4 * NData)2122 LIBFUNCTION INTEGER4 LIBCALL tecnod111_(INTEGER4 *NData)
2123 {
2124 return TECNOD112(NData);
2125 }
2126
tecnod110_(INTEGER4 * NData)2127 LIBFUNCTION INTEGER4 LIBCALL tecnod110_(INTEGER4 *NData)
2128 {
2129 return TECNOD112(NData);
2130 }
2131
tecnod100_(INTEGER4 * NData)2132 LIBFUNCTION INTEGER4 LIBCALL tecnod100_(INTEGER4 *NData)
2133 {
2134 return TECNOD112(NData);
2135 }
2136
tecnod_(INTEGER4 * NData)2137 LIBFUNCTION INTEGER4 LIBCALL tecnod_(INTEGER4 *NData)
2138 {
2139 return TECNOD112(NData);
2140 }
2141 #endif
2142
2143 /**
2144 * TECNODEXXX
2145 */
TECNODE112(INTEGER4 * N,INTEGER4 * NData)2146 INTEGER4 LIBCALL TECNODE112(
2147 INTEGER4 *N,
2148 INTEGER4 *NData)
2149 {
2150 LgIndex_t I;
2151
2152
2153 if (CheckFile("TECNODE112") < 0)
2154 return (-1);
2155
2156 if (ZoneType[CurFile] == FEPOLYGON ||
2157 ZoneType[CurFile] == FEPOLYHEDRON)
2158 {
2159 /* Wrong way to specify connectivity for polygons and polyhedrons */
2160 #if defined MAKEARCHIVE
2161 PRINT0("Err: (TECNODE112) Cannot call TECNODE112 for polygonal or polyhedral zones.\n");
2162 #endif
2163 NumErrs[CurFile]++;
2164 return (-1);
2165 }
2166
2167 if (HasFECONNECT[CurFile])
2168 {
2169 /*
2170 * The connectivity list is duplicated,
2171 * so we shouldn't be calling TECNODE112()
2172 */
2173 return (-1);
2174 }
2175
2176 if (FileTypes[CurFile] == SOLUTIONFILE)
2177 {
2178 #if defined MAKEARCHIVE
2179 PRINT0("Err: (TECNODE112) Cannot call TECNODE112 if file type is SOLUTIONFILE.\n");
2180 #endif
2181 NumErrs[CurFile]++;
2182 return (-1);
2183 }
2184
2185 if (ZoneType[CurFile] == ORDERED)
2186 {
2187 #if defined MAKEARCHIVE
2188 PRINT0("Err: (TECNODE112) Cannot call TECNODE112 if zone type is ORDERED.\n");
2189 #endif
2190 NumErrs[CurFile]++;
2191 return (-1);
2192 }
2193
2194 if (CheckData("TECNODE112") < 0)
2195 return (-1);
2196
2197 if (NumConnectivityNodesWritten[CurFile][CurZone[CurFile]] + *N > NumConnectivityNodes[CurFile][CurZone[CurFile]])
2198 {
2199 #if defined MAKEARCHIVE
2200 PRINT0("Err: (TECNODE112) Connectivity Nodes chunk exceeds the total number of Connectivity Nodes:\n");
2201 PRINT2(" Nodes written = %d, Current chunk size = %d, ", NumConnectivityNodesWritten[CurFile][CurZone[CurFile]], *N);
2202 PRINT1("total connectivity nodes = %d.\n", NumConnectivityNodes[CurFile][CurZone[CurFile]]);
2203 #endif
2204 NumErrs[CurFile]++;
2205 return (-1);
2206 }
2207
2208 for (I = 0; I < *N; I++)
2209 {
2210 if ((NData[I] > IMax[CurFile]) ||
2211 (NData[I] < 1))
2212 {
2213 #if defined MAKEARCHIVE
2214 PRINT1("Err: (TECNODE112) Invalid node map value at position %d:\n", I);
2215 PRINT2(" node map value = %d, max value = %d.\n", NData[I], IMax[CurFile]);
2216 #endif
2217 NumErrs[CurFile]++;
2218 return (-1);
2219 }
2220 /*
2221 * As of version 103 Tecplot assumes that node maps are zero based
2222 * instead of ones based. Since we have to maintain the contract we
2223 * subtract 1 for the caller.
2224 */
2225 if (!WriteBinaryInt32(BlckFile[CurFile], NData[I] - 1)) /* zero based */
2226 {
2227 WriteErr("TECNODE112");
2228 return (-1);
2229 }
2230
2231 NumConnectivityNodesWritten[CurFile][CurZone[CurFile]]++;
2232 }
2233
2234 if (NumConnectivityNodesWritten[CurFile][CurZone[CurFile]] == NumConnectivityNodes[CurFile][CurZone[CurFile]])
2235 {
2236 ConnectivityWritten[CurFile][CurZone[CurFile]] = TRUE;
2237 }
2238
2239 return (0);
2240 }
2241
2242 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tecnode112_(INTEGER4 * N,INTEGER4 * NData)2243 LIBFUNCTION INTEGER4 LIBCALL tecnode112_(INTEGER4 *N,
2244 INTEGER4 *NData)
2245 {
2246 return TECNODE112(N, NData);
2247 }
2248 #endif
2249
2250 /**
2251 * TECENDXXX
2252 */
TECEND112(void)2253 INTEGER4 LIBCALL TECEND112(void)
2254 {
2255 int RetVal = 0;
2256
2257 /**
2258 * Validate that all zone data was given for the file since there are no
2259 * more chances to give it. Note that solution files don't define the
2260 * connectivity again.
2261 */
2262 if (FileTypes[CurFile] != SOLUTIONFILE)
2263 {
2264 for (int ZoneIndex = 0; (RetVal == 0) && (ZoneIndex <= CurZone[CurFile]); ZoneIndex++)
2265 {
2266 if (((NumConnectivityNodes[CurFile][ZoneIndex] > 0) &&
2267 (ConnectivityWritten[CurFile][ZoneIndex] == FALSE)))
2268 {
2269 #if defined MAKEARCHIVE
2270 PRINT1("Err: (TECEND112) File %d is being closed without writing connectivity data.\n", CurFile + 1);
2271 if (NumConnectivityNodesWritten[CurFile][ZoneIndex] == 0)
2272 PRINT1(" Zone %d was defined with a Classic FE zone type but TECNOD112() was not called.\n", ZoneIndex + 1);
2273 else
2274 PRINT1(" Zone %d was defined with a Classic FE zone type but TECNODE112() was not called for all node chunks.\n", ZoneIndex + 1);
2275 #endif
2276 NumErrs[CurFile]++;
2277 RetVal = -1;
2278 }
2279 if (((NumFaceConnections[CurFile][ZoneIndex] > 0) &&
2280 (FaceNeighborsOrMapWritten[CurFile][ZoneIndex] == FALSE)))
2281 {
2282 #if defined MAKEARCHIVE
2283 PRINT1("Err: (TECEND112) File %d is being closed without writing face neighbor data.\n", CurFile + 1);
2284 PRINT2(" %d connections were specified for zone %d but TECFACE112() was not called.\n",
2285 NumFaceConnections[CurFile][ZoneIndex], ZoneIndex + 1);
2286 #endif
2287 NumErrs[CurFile]++;
2288 RetVal = -1;
2289 }
2290 else if (((TotalNumFaceNodes[CurFile][ZoneIndex] > 0) &&
2291 (FaceNeighborsOrMapWritten[CurFile][ZoneIndex] == FALSE)))
2292 {
2293 #if defined MAKEARCHIVE
2294 PRINT1("Err: (TECEND112) File %d is being closed without writing face map data.\n", CurFile + 1);
2295 PRINT2(" %d face nodes were specified for zone %d but TECPOLY112() was not called.\n",
2296 TotalNumFaceNodes[CurFile][ZoneIndex], ZoneIndex + 1);
2297 #endif
2298 NumErrs[CurFile]++;
2299 RetVal = -1;
2300 }
2301 }
2302 }
2303
2304 if (RetVal == 0)
2305 {
2306 if (CheckFile("TECEND112") < 0)
2307 RetVal = -1;
2308 }
2309
2310 if (RetVal == 0)
2311 {
2312 if (CheckData("TECEND112") < 0)
2313 RetVal = -1;
2314 }
2315
2316 if (RetVal == 0)
2317 if (!WriteBinaryReal(HeadFile[CurFile], EndHeaderMarker, FieldDataType_Float))
2318 {
2319 WriteErr("TECEND112");
2320 RetVal = -1;
2321 }
2322
2323 CloseFileStream(&BlckFile[CurFile]);
2324
2325 if (RetVal == 0)
2326 {
2327 BlckFile[CurFile] = OpenFileStream(BlckFName[CurFile], "rb", IsWritingNative[CurFile]);
2328
2329 /* Append data from BlckFile to HeadFile... */
2330 char buffer[BYTES_PER_CHUNK];
2331 size_t bytesRead = 0;
2332 while ((RetVal == 0) &&
2333 (feof(BlckFile[CurFile]->File) == 0))
2334 {
2335 bytesRead = fread((void*)buffer, 1, BYTES_PER_CHUNK, BlckFile[CurFile]->File);
2336 if (ferror(BlckFile[CurFile]->File) == 0)
2337 {
2338 if (bytesRead != fwrite((void*)buffer, 1, bytesRead, HeadFile[CurFile]->File))
2339 {
2340 /* do not call WriteErr, use custom message instead */
2341 #if defined MAKEARCHIVE
2342 PRINT1("Err: (TECEND112) Write failure during repack on file %d.\n", CurFile + 1);
2343 #endif
2344 NumErrs[CurFile]++;
2345 RetVal = -1;
2346 }
2347 }
2348 else
2349 {
2350 /* do not call WriteErr, use custom message instead */
2351 #if defined MAKEARCHIVE
2352 PRINT1("Err: (TECEND112) Write failure during repack on file %d.\n", CurFile + 1);
2353 #endif
2354 NumErrs[CurFile]++;
2355 RetVal = -1;
2356 }
2357 }
2358 CloseFileStream(&BlckFile[CurFile]);
2359 }
2360
2361 TP_UNLINK(BlckFName[CurFile]);
2362
2363 CloseFileStream(&HeadFile[CurFile]);
2364
2365 #if defined MAKEARCHIVE
2366 if (DebugLevel[CurFile])
2367 {
2368 PRINT1("File %d closed.\n", CurFile + 1);
2369 if (NumErrs[CurFile])
2370 {
2371 PRINT0("********************************************\n");
2372 PRINT1(" %d Errors occurred on this file\n", NumErrs[CurFile]);
2373 PRINT0("********************************************\n");
2374 }
2375 }
2376 #endif
2377
2378 NumErrs[CurFile] = 0;
2379 IsOpen[CurFile] = 0;
2380 if (DestFName[CurFile])
2381 FREE_ARRAY(DestFName[CurFile], "data set fname");
2382 if (BlckFName[CurFile])
2383 FREE_ARRAY(BlckFName[CurFile], "data set fname");
2384 BlckFName[CurFile] = NULL;
2385 DestFName[CurFile] = NULL;
2386
2387 /* reset arrays sized by number of variables */
2388 VarMinValue[CurFile].clear();
2389 VarMaxValue[CurFile].clear();
2390 NumRunningVarValues[CurFile].clear();
2391 IsSharedVar[CurFile].clear();
2392 IsPassiveVar[CurFile].clear();
2393 IsCellCentered[CurFile].clear();
2394
2395 /* reset arrays sized by number of zones */
2396 MinMaxOffset[CurFile].clear();
2397 TotalNumFaceNodes[CurFile].clear();
2398 NumFaceConnections[CurFile].clear();
2399 FaceNeighborsOrMapWritten[CurFile].clear();
2400 NumConnectivityNodes[CurFile].clear();
2401 NumConnectivityNodesWritten[CurFile].clear();
2402 ConnectivityWritten[CurFile].clear();
2403
2404 CurFile = 0;
2405 while ((CurFile < MaxNumFiles) && !IsOpen[CurFile])
2406 CurFile++;
2407
2408 if (CurFile == MaxNumFiles)
2409 CurFile = -1;
2410
2411 return RetVal;
2412 }
2413
TECEND111(void)2414 INTEGER4 LIBCALL TECEND111(void)
2415 {
2416 return TECEND112();
2417 }
2418
TECEND110(void)2419 INTEGER4 LIBCALL TECEND110(void)
2420 {
2421 return TECEND112();
2422 }
2423
TECEND100(void)2424 INTEGER4 LIBCALL TECEND100(void)
2425 {
2426 return TECEND112();
2427 }
2428
TECEND(void)2429 INTEGER4 LIBCALL TECEND(void)
2430 {
2431 return TECEND112();
2432 }
2433
2434 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tecend112_(void)2435 LIBFUNCTION INTEGER4 LIBCALL tecend112_(void)
2436 {
2437 return TECEND112();
2438 }
2439
tecend111_(void)2440 LIBFUNCTION INTEGER4 LIBCALL tecend111_(void)
2441 {
2442 return TECEND112();
2443 }
2444
tecend110_(void)2445 LIBFUNCTION INTEGER4 LIBCALL tecend110_(void)
2446 {
2447 return TECEND112();
2448 }
2449
tecend100_(void)2450 LIBFUNCTION INTEGER4 LIBCALL tecend100_(void)
2451 {
2452 return TECEND112();
2453 }
2454
tecend_(void)2455 LIBFUNCTION INTEGER4 LIBCALL tecend_(void)
2456 {
2457 return TECEND112();
2458 }
2459 #endif
2460
2461
2462
2463
GetNextLabel(const char ** CPtr,char * NextLabel)2464 static void GetNextLabel(const char **CPtr,
2465 char *NextLabel)
2466 {
2467 int N = 0;
2468 char *NPtr = NextLabel;
2469 *NPtr = '\0';
2470 /* Find label start */
2471 while ((**CPtr) && (**CPtr != '"'))
2472 (*CPtr)++;
2473 if (**CPtr)
2474 (*CPtr)++;
2475 while ((N < 60) && (**CPtr) && (**CPtr != '"'))
2476 {
2477 if (**CPtr == '\\')
2478 {
2479 (*CPtr)++;
2480 }
2481 *NPtr++ = **CPtr;
2482 N++;
2483 (*CPtr)++;
2484 }
2485 if (**CPtr)
2486 (*CPtr)++;
2487 *NPtr = '\0';
2488 }
2489
2490
2491 /**
2492 * TECLABXXX
2493 */
TECLAB112(char * S)2494 INTEGER4 LIBCALL TECLAB112(char *S)
2495 {
2496 const char *CPtr = (const char *)S;
2497 LgIndex_t N = 0;
2498 char Label[60];
2499
2500 if (CheckFile("TECLAB112") < 0)
2501 return (-1);
2502
2503 #if defined MAKEARCHIVE
2504 if (DebugLevel[CurFile])
2505 PRINT0("\nInserting Custom Labels:\n");
2506 #endif
2507
2508 do
2509 {
2510 GetNextLabel(&CPtr, Label);
2511 if (*Label)
2512 N++;
2513 }
2514 while (*Label);
2515
2516 if (N == 0)
2517 {
2518 #if defined MAKEARCHIVE
2519 PRINT1("Err: (TECLAB112) Invalid custom label string: %s\n",
2520 (S ? S : " "));
2521 #endif
2522 NumErrs[CurFile]++;
2523 return (-1);
2524 }
2525
2526 WriteBinaryReal(HeadFile[CurFile], CustomLabelMarker, FieldDataType_Float);
2527 if (!WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)N))
2528 {
2529 WriteErr("TECLAB112");
2530 return (-1);
2531 }
2532
2533 CPtr = (const char *)S;
2534 do
2535 {
2536 GetNextLabel(&CPtr, Label);
2537 if (*Label)
2538 {
2539 if (!DumpDatafileString(HeadFile[CurFile], Label, TRUE))
2540 {
2541 WriteErr("TECLAB112");
2542 return (-1);
2543 }
2544 #if defined MAKEARCHIVE
2545 if (DebugLevel[CurFile])
2546 printf(" %s\n", Label);
2547 #endif
2548 }
2549 }
2550 while (*Label);
2551
2552 return (0);
2553 }
2554
TECLAB111(char * S)2555 INTEGER4 LIBCALL TECLAB111(char *S)
2556 {
2557 return TECLAB112(S);
2558 }
2559
TECLAB110(char * S)2560 INTEGER4 LIBCALL TECLAB110(char *S)
2561 {
2562 return TECLAB112(S);
2563 }
2564
TECLAB100(char * S)2565 INTEGER4 LIBCALL TECLAB100(char *S)
2566 {
2567 return TECLAB112(S);
2568 }
2569
TECLAB(char * S)2570 INTEGER4 LIBCALL TECLAB(char *S)
2571 {
2572 return TECLAB112(S);
2573 }
2574
2575 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
teclab112_(char * S)2576 LIBFUNCTION INTEGER4 LIBCALL teclab112_(char *S)
2577 {
2578 return TECLAB112(S);
2579 }
2580
teclab111_(char * S)2581 LIBFUNCTION INTEGER4 LIBCALL teclab111_(char *S)
2582 {
2583 return TECLAB112(S);
2584 }
2585
teclab110_(char * S)2586 LIBFUNCTION INTEGER4 LIBCALL teclab110_(char *S)
2587 {
2588 return TECLAB112(S);
2589 }
2590
teclab100_(char * S)2591 LIBFUNCTION INTEGER4 LIBCALL teclab100_(char *S)
2592 {
2593 return TECLAB112(S);
2594 }
2595
teclab_(char * S)2596 LIBFUNCTION INTEGER4 LIBCALL teclab_(char *S)
2597 {
2598 return TECLAB112(S);
2599 }
2600 #endif
2601
2602
2603 /**
2604 * TECUSRXXX
2605 */
TECUSR112(char * S)2606 INTEGER4 LIBCALL TECUSR112(char *S)
2607 {
2608 if (CheckFile("TECUSR112") < 0)
2609 return (-1);
2610
2611 #if defined MAKEARCHIVE
2612 if (DebugLevel[CurFile])
2613 PRINT1("\nInserting UserRec: %s\n", S);
2614 #endif
2615
2616 if ((S == NULL) || (*S == '\0'))
2617 {
2618 #if defined MAKEARCHIVE
2619 PRINT0("Err: (TECUSR112) Invalid TECUSR110 string\n");
2620 #endif
2621 NumErrs[CurFile]++;
2622 return (-1);
2623 }
2624
2625 WriteBinaryReal(HeadFile[CurFile], UserRecMarker, FieldDataType_Float);
2626 if (!DumpDatafileString(HeadFile[CurFile], S, TRUE))
2627 {
2628 #if defined MAKEARCHIVE
2629 if (DebugLevel[CurFile])
2630 printf("Err: (TECUSR112) Write failure for file %d\n", CurFile + 1);
2631 #endif
2632 NumErrs[CurFile]++;
2633 return (-1);
2634 }
2635 return (0);
2636 }
2637
TECUSR111(char * S)2638 INTEGER4 LIBCALL TECUSR111(char *S)
2639 {
2640 return TECUSR112(S);
2641 }
2642
TECUSR110(char * S)2643 INTEGER4 LIBCALL TECUSR110(char *S)
2644 {
2645 return TECUSR112(S);
2646 }
2647
TECUSR100(char * S)2648 INTEGER4 LIBCALL TECUSR100(char *S)
2649 {
2650 return TECUSR112(S);
2651 }
2652
TECUSR(char * S)2653 INTEGER4 LIBCALL TECUSR(char *S)
2654 {
2655 return TECUSR112(S);
2656 }
2657
2658 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tecusr112_(char * S)2659 LIBFUNCTION INTEGER4 LIBCALL tecusr112_(char *S)
2660 {
2661 return TECUSR112(S);
2662 }
2663
tecusr111_(char * S)2664 LIBFUNCTION INTEGER4 LIBCALL tecusr111_(char *S)
2665 {
2666 return TECUSR112(S);
2667 }
2668
tecusr110_(char * S)2669 LIBFUNCTION INTEGER4 LIBCALL tecusr110_(char *S)
2670 {
2671 return TECUSR112(S);
2672 }
2673
tecusr100_(char * S)2674 LIBFUNCTION INTEGER4 LIBCALL tecusr100_(char *S)
2675 {
2676 return TECUSR112(S);
2677 }
2678
tecusr_(char * S)2679 LIBFUNCTION INTEGER4 LIBCALL tecusr_(char *S)
2680 {
2681 return TECUSR112(S);
2682 }
2683 #endif
2684
2685 #if 0 // NOT_CURRENTLY_USED
2686 static int WriteGeomDataBlock(float *Data,
2687 LgIndex_t NumPts)
2688 {
2689 LgIndex_t I;
2690
2691 for (I = 0; I < NumPts; I++)
2692 {
2693 if (!WriteBinaryReal(HeadFile[CurFile], Data[I], FieldDataType_Float))
2694 {
2695 return (-1);
2696 }
2697 }
2698 return (0);
2699 }
2700
2701
2702 static void ShowDebugColor(LgIndex_t Color)
2703 {
2704 #if defined MAKEARCHIVE
2705 switch (Color)
2706 {
2707 case 0 : PRINT0("BLACK\n"); break;
2708 case 1 : PRINT0("RED\n"); break;
2709 case 2 : PRINT0("GREEN\n"); break;
2710 case 3 : PRINT0("BLUE\n"); break;
2711 case 4 : PRINT0("CYAN\n"); break;
2712 case 5 : PRINT0("YELLOW\n"); break;
2713 case 6 : PRINT0("PURPLE\n"); break;
2714 case 7 : PRINT0("WHITE\n"); break;
2715 case 8 :
2716 case 9 :
2717 case 10:
2718 case 11:
2719 case 12:
2720 case 13:
2721 case 14:
2722 case 15: PRINT1("CUSTOM%1d\n", Color-7); break;
2723 default : PRINT0("INVALID\n");
2724 }
2725 #endif
2726 }
2727 #endif /* NOT_CURRENTLY_USED */
2728
2729
2730 /**
2731 * TECGEOXXX
2732 */
TECGEO112(double * XOrThetaPos,double * YOrRPos,double * ZPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * Color,INTEGER4 * FillColor,INTEGER4 * IsFilled,INTEGER4 * GeomType,INTEGER4 * LinePattern,double * PatternLength,double * LineThickness,INTEGER4 * NumEllipsePts,INTEGER4 * ArrowheadStyle,INTEGER4 * ArrowheadAttachment,double * ArrowheadSize,double * ArrowheadAngle,INTEGER4 * Scope,INTEGER4 * Clipping,INTEGER4 * NumSegments,INTEGER4 * NumSegPts,float * XOrThetaGeomData,float * YOrRGeomData,float * ZGeomData,char * mfc)2733 INTEGER4 LIBCALL TECGEO112(double *XOrThetaPos,
2734 double *YOrRPos,
2735 double *ZPos,
2736 INTEGER4 *PosCoordMode, /* 0=Grid, 1=Frame, 3=Grid3D */
2737 INTEGER4 *AttachToZone,
2738 INTEGER4 *Zone,
2739 INTEGER4 *Color,
2740 INTEGER4 *FillColor,
2741 INTEGER4 *IsFilled,
2742 INTEGER4 *GeomType,
2743 INTEGER4 *LinePattern,
2744 double *PatternLength,
2745 double *LineThickness,
2746 INTEGER4 *NumEllipsePts,
2747 INTEGER4 *ArrowheadStyle,
2748 INTEGER4 *ArrowheadAttachment,
2749 double *ArrowheadSize,
2750 double *ArrowheadAngle,
2751 INTEGER4 *Scope,
2752 INTEGER4 *Clipping,
2753 INTEGER4 *NumSegments,
2754 INTEGER4 *NumSegPts,
2755 float *XOrThetaGeomData,
2756 float *YOrRGeomData,
2757 float *ZGeomData,
2758 char *mfc)
2759 {
2760 int I, RetVal;
2761 int RawDataSize = 0;
2762 double Fract;
2763
2764 Geom_s Geom;
2765
2766 if (CheckFile("TECGEO112") < 0)
2767 return (-1);
2768
2769 Geom.PositionCoordSys = (CoordSys_e) * PosCoordMode;
2770 if (Geom.PositionCoordSys == CoordSys_Frame)
2771 Fract = 0.01;
2772 else
2773 Fract = 1.0;
2774
2775 Geom.AnchorPos.Generic.V1 = (*XOrThetaPos) * Fract;
2776 Geom.AnchorPos.Generic.V2 = (*YOrRPos) * Fract;
2777 Geom.AnchorPos.Generic.V3 = (*ZPos) * Fract;
2778 Geom.AttachToZone = *AttachToZone != 0;
2779 Geom.Zone = *Zone - 1;
2780 Geom.BColor = (ColorIndex_t) * Color;
2781 Geom.FillBColor = (ColorIndex_t) * FillColor;
2782 Geom.IsFilled = *IsFilled;
2783 Geom.GeomType = (GeomType_e) * GeomType;
2784 Geom.LinePattern = (LinePattern_e) * LinePattern;
2785 Geom.PatternLength = *PatternLength / 100.0;
2786 Geom.LineThickness = *LineThickness / 100.0;
2787 Geom.NumEllipsePts = *NumEllipsePts;
2788 Geom.ArrowheadStyle = (ArrowheadStyle_e) * ArrowheadStyle;
2789 Geom.ArrowheadAttachment = (ArrowheadAttachment_e) * ArrowheadAttachment;
2790 Geom.ArrowheadSize = *ArrowheadSize / 100.0;
2791 Geom.ArrowheadAngle = *ArrowheadAngle / DEGPERRADIANS;
2792 Geom.Scope = (Scope_e) * Scope;
2793 Geom.DrawOrder = DrawOrder_AfterData;
2794 Geom.Clipping = (Clipping_e) * Clipping;
2795 Geom.NumSegments = *NumSegments;
2796 Geom.MacroFunctionCommand = mfc;
2797 Geom.ImageFileName = NULL;
2798 Geom.ImageNumber = 0;
2799 Geom.MaintainAspectRatio = TRUE;
2800 Geom.PixelAspectRatio = 1.0;
2801 Geom.ImageResizeFilter = ImageResizeFilter_Texture;
2802
2803 if (Geom.GeomType == GeomType_LineSegs3D)
2804 {
2805 Geom.GeomType = GeomType_LineSegs;
2806 Geom.PositionCoordSys = CoordSys_Grid3D;
2807 }
2808
2809 #if defined MAKEARCHIVE
2810 if (DebugLevel[CurFile])
2811 PRINT0("\nInserting Geometry\n");
2812 #endif
2813
2814 switch (Geom.GeomType)
2815 {
2816 case GeomType_LineSegs :
2817 {
2818 int I;
2819 RawDataSize = 0;
2820 for (I = 0; I < *NumSegments; I++)
2821 {
2822 Geom.NumSegPts[I] = NumSegPts[I];
2823 RawDataSize += NumSegPts[I];
2824 }
2825 } break;
2826 case GeomType_Rectangle :
2827 case GeomType_Square :
2828 case GeomType_Circle :
2829 case GeomType_Ellipse :
2830 {
2831 RawDataSize = 1;
2832 } break;
2833 case GeomType_Image :
2834 {
2835 CHECK(FALSE); /* Images not allowed in data files. */
2836 } break;
2837 default :
2838 {
2839 CHECK(FALSE);
2840 } break;
2841 }
2842
2843 Geom.DataType = FieldDataType_Float;
2844 Geom.GeomData.Generic.V1Base = AllocScratchNodalFieldDataPtr(RawDataSize, FieldDataType_Float, TRUE);
2845 Geom.GeomData.Generic.V2Base = AllocScratchNodalFieldDataPtr(RawDataSize, FieldDataType_Float, TRUE);
2846 Geom.GeomData.Generic.V3Base = AllocScratchNodalFieldDataPtr(RawDataSize, FieldDataType_Float, TRUE);
2847
2848 for (I = 0; I < RawDataSize; I++)
2849 {
2850 SetFieldValue(Geom.GeomData.Generic.V1Base, I, (double)XOrThetaGeomData[I]*Fract);
2851 SetFieldValue(Geom.GeomData.Generic.V2Base, I, (double)YOrRGeomData[I]*Fract);
2852 SetFieldValue(Geom.GeomData.Generic.V3Base, I, (double)ZGeomData[I]*Fract);
2853 }
2854
2855 if (DumpGeometry(HeadFile[CurFile], &Geom, TRUE, FALSE))
2856 RetVal = 0;
2857 else
2858 RetVal = -1;
2859
2860 DeallocScratchNodalFieldDataPtr(&Geom.GeomData.Generic.V1Base);
2861 DeallocScratchNodalFieldDataPtr(&Geom.GeomData.Generic.V2Base);
2862 DeallocScratchNodalFieldDataPtr(&Geom.GeomData.Generic.V3Base);
2863
2864 return RetVal;
2865 }
2866
TECGEO111(double * XOrThetaPos,double * YOrRPos,double * ZPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * Color,INTEGER4 * FillColor,INTEGER4 * IsFilled,INTEGER4 * GeomType,INTEGER4 * LinePattern,double * PatternLength,double * LineThickness,INTEGER4 * NumEllipsePts,INTEGER4 * ArrowheadStyle,INTEGER4 * ArrowheadAttachment,double * ArrowheadSize,double * ArrowheadAngle,INTEGER4 * Scope,INTEGER4 * Clipping,INTEGER4 * NumSegments,INTEGER4 * NumSegPts,float * XOrThetaGeomData,float * YOrRGeomData,float * ZGeomData,char * mfc)2867 INTEGER4 LIBCALL TECGEO111(double *XOrThetaPos,
2868 double *YOrRPos,
2869 double *ZPos,
2870 INTEGER4 *PosCoordMode, /* 0=Grid, 1=Frame, 3=Grid3D */
2871 INTEGER4 *AttachToZone,
2872 INTEGER4 *Zone,
2873 INTEGER4 *Color,
2874 INTEGER4 *FillColor,
2875 INTEGER4 *IsFilled,
2876 INTEGER4 *GeomType,
2877 INTEGER4 *LinePattern,
2878 double *PatternLength,
2879 double *LineThickness,
2880 INTEGER4 *NumEllipsePts,
2881 INTEGER4 *ArrowheadStyle,
2882 INTEGER4 *ArrowheadAttachment,
2883 double *ArrowheadSize,
2884 double *ArrowheadAngle,
2885 INTEGER4 *Scope,
2886 INTEGER4 *Clipping,
2887 INTEGER4 *NumSegments,
2888 INTEGER4 *NumSegPts,
2889 float *XOrThetaGeomData,
2890 float *YOrRGeomData,
2891 float *ZGeomData,
2892 char *mfc)
2893 {
2894 return TECGEO112(XOrThetaPos,
2895 YOrRPos,
2896 ZPos,
2897 PosCoordMode,
2898 AttachToZone,
2899 Zone,
2900 Color,
2901 FillColor,
2902 IsFilled,
2903 GeomType,
2904 LinePattern,
2905 PatternLength,
2906 LineThickness,
2907 NumEllipsePts,
2908 ArrowheadStyle,
2909 ArrowheadAttachment,
2910 ArrowheadSize,
2911 ArrowheadAngle,
2912 Scope,
2913 Clipping,
2914 NumSegments,
2915 NumSegPts,
2916 XOrThetaGeomData,
2917 YOrRGeomData,
2918 ZGeomData,
2919 mfc);
2920 }
2921
TECGEO110(double * XOrThetaPos,double * YOrRPos,double * ZPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * Color,INTEGER4 * FillColor,INTEGER4 * IsFilled,INTEGER4 * GeomType,INTEGER4 * LinePattern,double * PatternLength,double * LineThickness,INTEGER4 * NumEllipsePts,INTEGER4 * ArrowheadStyle,INTEGER4 * ArrowheadAttachment,double * ArrowheadSize,double * ArrowheadAngle,INTEGER4 * Scope,INTEGER4 * Clipping,INTEGER4 * NumSegments,INTEGER4 * NumSegPts,float * XOrThetaGeomData,float * YOrRGeomData,float * ZGeomData,char * mfc)2922 INTEGER4 LIBCALL TECGEO110(double *XOrThetaPos,
2923 double *YOrRPos,
2924 double *ZPos,
2925 INTEGER4 *PosCoordMode, /* 0=Grid, 1=Frame, 3=Grid3D */
2926 INTEGER4 *AttachToZone,
2927 INTEGER4 *Zone,
2928 INTEGER4 *Color,
2929 INTEGER4 *FillColor,
2930 INTEGER4 *IsFilled,
2931 INTEGER4 *GeomType,
2932 INTEGER4 *LinePattern,
2933 double *PatternLength,
2934 double *LineThickness,
2935 INTEGER4 *NumEllipsePts,
2936 INTEGER4 *ArrowheadStyle,
2937 INTEGER4 *ArrowheadAttachment,
2938 double *ArrowheadSize,
2939 double *ArrowheadAngle,
2940 INTEGER4 *Scope,
2941 INTEGER4 *Clipping,
2942 INTEGER4 *NumSegments,
2943 INTEGER4 *NumSegPts,
2944 float *XOrThetaGeomData,
2945 float *YOrRGeomData,
2946 float *ZGeomData,
2947 char *mfc)
2948 {
2949 return TECGEO112(XOrThetaPos,
2950 YOrRPos,
2951 ZPos,
2952 PosCoordMode,
2953 AttachToZone,
2954 Zone,
2955 Color,
2956 FillColor,
2957 IsFilled,
2958 GeomType,
2959 LinePattern,
2960 PatternLength,
2961 LineThickness,
2962 NumEllipsePts,
2963 ArrowheadStyle,
2964 ArrowheadAttachment,
2965 ArrowheadSize,
2966 ArrowheadAngle,
2967 Scope,
2968 Clipping,
2969 NumSegments,
2970 NumSegPts,
2971 XOrThetaGeomData,
2972 YOrRGeomData,
2973 ZGeomData,
2974 mfc);
2975 }
2976
TECGEO100(double * XOrThetaPos,double * YOrRPos,double * ZPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * Color,INTEGER4 * FillColor,INTEGER4 * IsFilled,INTEGER4 * GeomType,INTEGER4 * LinePattern,double * PatternLength,double * LineThickness,INTEGER4 * NumEllipsePts,INTEGER4 * ArrowheadStyle,INTEGER4 * ArrowheadAttachment,double * ArrowheadSize,double * ArrowheadAngle,INTEGER4 * Scope,INTEGER4 * Clipping,INTEGER4 * NumSegments,INTEGER4 * NumSegPts,float * XOrThetaGeomData,float * YOrRGeomData,float * ZGeomData,char * mfc)2977 INTEGER4 LIBCALL TECGEO100(double *XOrThetaPos,
2978 double *YOrRPos,
2979 double *ZPos,
2980 INTEGER4 *PosCoordMode, /* 0=Grid, 1=Frame, 3=Grid3D */
2981 INTEGER4 *AttachToZone,
2982 INTEGER4 *Zone,
2983 INTEGER4 *Color,
2984 INTEGER4 *FillColor,
2985 INTEGER4 *IsFilled,
2986 INTEGER4 *GeomType,
2987 INTEGER4 *LinePattern,
2988 double *PatternLength,
2989 double *LineThickness,
2990 INTEGER4 *NumEllipsePts,
2991 INTEGER4 *ArrowheadStyle,
2992 INTEGER4 *ArrowheadAttachment,
2993 double *ArrowheadSize,
2994 double *ArrowheadAngle,
2995 INTEGER4 *Scope,
2996 INTEGER4 *Clipping,
2997 INTEGER4 *NumSegments,
2998 INTEGER4 *NumSegPts,
2999 float *XOrThetaGeomData,
3000 float *YOrRGeomData,
3001 float *ZGeomData,
3002 char *mfc)
3003 {
3004 return TECGEO112(XOrThetaPos,
3005 YOrRPos,
3006 ZPos,
3007 PosCoordMode,
3008 AttachToZone,
3009 Zone,
3010 Color,
3011 FillColor,
3012 IsFilled,
3013 GeomType,
3014 LinePattern,
3015 PatternLength,
3016 LineThickness,
3017 NumEllipsePts,
3018 ArrowheadStyle,
3019 ArrowheadAttachment,
3020 ArrowheadSize,
3021 ArrowheadAngle,
3022 Scope,
3023 Clipping,
3024 NumSegments,
3025 NumSegPts,
3026 XOrThetaGeomData,
3027 YOrRGeomData,
3028 ZGeomData,
3029 mfc);
3030 }
3031
TECGEO(double * XPos,double * YPos,double * ZPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * Color,INTEGER4 * FillColor,INTEGER4 * IsFilled,INTEGER4 * GeomType,INTEGER4 * LinePattern,double * PatternLength,double * LineThickness,INTEGER4 * NumEllipsePts,INTEGER4 * ArrowheadStyle,INTEGER4 * ArrowheadAttachment,double * ArrowheadSize,double * ArrowheadAngle,INTEGER4 * Scope,INTEGER4 * NumSegments,INTEGER4 * NumSegPts,float * XGeomData,float * YGeomData,float * ZGeomData,char * mfc)3032 INTEGER4 LIBCALL TECGEO(double *XPos,
3033 double *YPos,
3034 double *ZPos,
3035 INTEGER4 *PosCoordMode,
3036 INTEGER4 *AttachToZone,
3037 INTEGER4 *Zone,
3038 INTEGER4 *Color,
3039 INTEGER4 *FillColor,
3040 INTEGER4 *IsFilled,
3041 INTEGER4 *GeomType,
3042 INTEGER4 *LinePattern,
3043 double *PatternLength,
3044 double *LineThickness,
3045 INTEGER4 *NumEllipsePts,
3046 INTEGER4 *ArrowheadStyle,
3047 INTEGER4 *ArrowheadAttachment,
3048 double *ArrowheadSize,
3049 double *ArrowheadAngle,
3050 INTEGER4 *Scope,
3051 INTEGER4 *NumSegments,
3052 INTEGER4 *NumSegPts,
3053 float *XGeomData,
3054 float *YGeomData,
3055 float *ZGeomData,
3056 char *mfc)
3057 {
3058 int Clipping = (int)Clipping_ClipToViewport;
3059 return TECGEO112(XPos,
3060 YPos,
3061 ZPos,
3062 PosCoordMode,
3063 AttachToZone,
3064 Zone,
3065 Color,
3066 FillColor,
3067 IsFilled,
3068 GeomType,
3069 LinePattern,
3070 PatternLength,
3071 LineThickness,
3072 NumEllipsePts,
3073 ArrowheadStyle,
3074 ArrowheadAttachment,
3075 ArrowheadSize,
3076 ArrowheadAngle,
3077 Scope,
3078 &Clipping,
3079 NumSegments,
3080 NumSegPts,
3081 XGeomData,
3082 YGeomData,
3083 ZGeomData,
3084 mfc);
3085 }
3086
3087 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tecgeo112_(double * XPos,double * YPos,double * ZPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * Color,INTEGER4 * FillColor,INTEGER4 * IsFilled,INTEGER4 * GeomType,INTEGER4 * LinePattern,double * PatternLength,double * LineThickness,INTEGER4 * NumEllipsePts,INTEGER4 * ArrowheadStyle,INTEGER4 * ArrowheadAttachment,double * ArrowheadSize,double * ArrowheadAngle,INTEGER4 * Scope,INTEGER4 * Clipping,INTEGER4 * NumSegments,INTEGER4 * NumSegPts,float * XGeomData,float * YGeomData,float * ZGeomData,char * mfc)3088 LIBFUNCTION INTEGER4 LIBCALL tecgeo112_(double *XPos,
3089 double *YPos,
3090 double *ZPos,
3091 INTEGER4 *PosCoordMode,
3092 INTEGER4 *AttachToZone,
3093 INTEGER4 *Zone,
3094 INTEGER4 *Color,
3095 INTEGER4 *FillColor,
3096 INTEGER4 *IsFilled,
3097 INTEGER4 *GeomType,
3098 INTEGER4 *LinePattern,
3099 double *PatternLength,
3100 double *LineThickness,
3101 INTEGER4 *NumEllipsePts,
3102 INTEGER4 *ArrowheadStyle,
3103 INTEGER4 *ArrowheadAttachment,
3104 double *ArrowheadSize,
3105 double *ArrowheadAngle,
3106 INTEGER4 *Scope,
3107 INTEGER4 *Clipping,
3108 INTEGER4 *NumSegments,
3109 INTEGER4 *NumSegPts,
3110 float *XGeomData,
3111 float *YGeomData,
3112 float *ZGeomData,
3113 char *mfc)
3114 {
3115 return TECGEO112(XPos,
3116 YPos,
3117 ZPos,
3118 PosCoordMode,
3119 AttachToZone,
3120 Zone,
3121 Color,
3122 FillColor,
3123 IsFilled,
3124 GeomType,
3125 LinePattern,
3126 PatternLength,
3127 LineThickness,
3128 NumEllipsePts,
3129 ArrowheadStyle,
3130 ArrowheadAttachment,
3131 ArrowheadSize,
3132 ArrowheadAngle,
3133 Scope,
3134 Clipping,
3135 NumSegments,
3136 NumSegPts,
3137 XGeomData,
3138 YGeomData,
3139 ZGeomData,
3140 mfc);
3141 }
3142
tecgeo111_(double * XPos,double * YPos,double * ZPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * Color,INTEGER4 * FillColor,INTEGER4 * IsFilled,INTEGER4 * GeomType,INTEGER4 * LinePattern,double * PatternLength,double * LineThickness,INTEGER4 * NumEllipsePts,INTEGER4 * ArrowheadStyle,INTEGER4 * ArrowheadAttachment,double * ArrowheadSize,double * ArrowheadAngle,INTEGER4 * Scope,INTEGER4 * Clipping,INTEGER4 * NumSegments,INTEGER4 * NumSegPts,float * XGeomData,float * YGeomData,float * ZGeomData,char * mfc)3143 LIBFUNCTION INTEGER4 LIBCALL tecgeo111_(double *XPos,
3144 double *YPos,
3145 double *ZPos,
3146 INTEGER4 *PosCoordMode,
3147 INTEGER4 *AttachToZone,
3148 INTEGER4 *Zone,
3149 INTEGER4 *Color,
3150 INTEGER4 *FillColor,
3151 INTEGER4 *IsFilled,
3152 INTEGER4 *GeomType,
3153 INTEGER4 *LinePattern,
3154 double *PatternLength,
3155 double *LineThickness,
3156 INTEGER4 *NumEllipsePts,
3157 INTEGER4 *ArrowheadStyle,
3158 INTEGER4 *ArrowheadAttachment,
3159 double *ArrowheadSize,
3160 double *ArrowheadAngle,
3161 INTEGER4 *Scope,
3162 INTEGER4 *Clipping,
3163 INTEGER4 *NumSegments,
3164 INTEGER4 *NumSegPts,
3165 float *XGeomData,
3166 float *YGeomData,
3167 float *ZGeomData,
3168 char *mfc)
3169 {
3170 return TECGEO112(XPos,
3171 YPos,
3172 ZPos,
3173 PosCoordMode,
3174 AttachToZone,
3175 Zone,
3176 Color,
3177 FillColor,
3178 IsFilled,
3179 GeomType,
3180 LinePattern,
3181 PatternLength,
3182 LineThickness,
3183 NumEllipsePts,
3184 ArrowheadStyle,
3185 ArrowheadAttachment,
3186 ArrowheadSize,
3187 ArrowheadAngle,
3188 Scope,
3189 Clipping,
3190 NumSegments,
3191 NumSegPts,
3192 XGeomData,
3193 YGeomData,
3194 ZGeomData,
3195 mfc);
3196 }
3197
tecgeo110_(double * XPos,double * YPos,double * ZPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * Color,INTEGER4 * FillColor,INTEGER4 * IsFilled,INTEGER4 * GeomType,INTEGER4 * LinePattern,double * PatternLength,double * LineThickness,INTEGER4 * NumEllipsePts,INTEGER4 * ArrowheadStyle,INTEGER4 * ArrowheadAttachment,double * ArrowheadSize,double * ArrowheadAngle,INTEGER4 * Scope,INTEGER4 * Clipping,INTEGER4 * NumSegments,INTEGER4 * NumSegPts,float * XGeomData,float * YGeomData,float * ZGeomData,char * mfc)3198 LIBFUNCTION INTEGER4 LIBCALL tecgeo110_(double *XPos,
3199 double *YPos,
3200 double *ZPos,
3201 INTEGER4 *PosCoordMode,
3202 INTEGER4 *AttachToZone,
3203 INTEGER4 *Zone,
3204 INTEGER4 *Color,
3205 INTEGER4 *FillColor,
3206 INTEGER4 *IsFilled,
3207 INTEGER4 *GeomType,
3208 INTEGER4 *LinePattern,
3209 double *PatternLength,
3210 double *LineThickness,
3211 INTEGER4 *NumEllipsePts,
3212 INTEGER4 *ArrowheadStyle,
3213 INTEGER4 *ArrowheadAttachment,
3214 double *ArrowheadSize,
3215 double *ArrowheadAngle,
3216 INTEGER4 *Scope,
3217 INTEGER4 *Clipping,
3218 INTEGER4 *NumSegments,
3219 INTEGER4 *NumSegPts,
3220 float *XGeomData,
3221 float *YGeomData,
3222 float *ZGeomData,
3223 char *mfc)
3224 {
3225 return TECGEO112(XPos,
3226 YPos,
3227 ZPos,
3228 PosCoordMode,
3229 AttachToZone,
3230 Zone,
3231 Color,
3232 FillColor,
3233 IsFilled,
3234 GeomType,
3235 LinePattern,
3236 PatternLength,
3237 LineThickness,
3238 NumEllipsePts,
3239 ArrowheadStyle,
3240 ArrowheadAttachment,
3241 ArrowheadSize,
3242 ArrowheadAngle,
3243 Scope,
3244 Clipping,
3245 NumSegments,
3246 NumSegPts,
3247 XGeomData,
3248 YGeomData,
3249 ZGeomData,
3250 mfc);
3251 }
3252
tecgeo100_(double * XPos,double * YPos,double * ZPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * Color,INTEGER4 * FillColor,INTEGER4 * IsFilled,INTEGER4 * GeomType,INTEGER4 * LinePattern,double * PatternLength,double * LineThickness,INTEGER4 * NumEllipsePts,INTEGER4 * ArrowheadStyle,INTEGER4 * ArrowheadAttachment,double * ArrowheadSize,double * ArrowheadAngle,INTEGER4 * Scope,INTEGER4 * Clipping,INTEGER4 * NumSegments,INTEGER4 * NumSegPts,float * XGeomData,float * YGeomData,float * ZGeomData,char * mfc)3253 LIBFUNCTION INTEGER4 LIBCALL tecgeo100_(double *XPos,
3254 double *YPos,
3255 double *ZPos,
3256 INTEGER4 *PosCoordMode,
3257 INTEGER4 *AttachToZone,
3258 INTEGER4 *Zone,
3259 INTEGER4 *Color,
3260 INTEGER4 *FillColor,
3261 INTEGER4 *IsFilled,
3262 INTEGER4 *GeomType,
3263 INTEGER4 *LinePattern,
3264 double *PatternLength,
3265 double *LineThickness,
3266 INTEGER4 *NumEllipsePts,
3267 INTEGER4 *ArrowheadStyle,
3268 INTEGER4 *ArrowheadAttachment,
3269 double *ArrowheadSize,
3270 double *ArrowheadAngle,
3271 INTEGER4 *Scope,
3272 INTEGER4 *Clipping,
3273 INTEGER4 *NumSegments,
3274 INTEGER4 *NumSegPts,
3275 float *XGeomData,
3276 float *YGeomData,
3277 float *ZGeomData,
3278 char *mfc)
3279 {
3280 return TECGEO112(XPos,
3281 YPos,
3282 ZPos,
3283 PosCoordMode,
3284 AttachToZone,
3285 Zone,
3286 Color,
3287 FillColor,
3288 IsFilled,
3289 GeomType,
3290 LinePattern,
3291 PatternLength,
3292 LineThickness,
3293 NumEllipsePts,
3294 ArrowheadStyle,
3295 ArrowheadAttachment,
3296 ArrowheadSize,
3297 ArrowheadAngle,
3298 Scope,
3299 Clipping,
3300 NumSegments,
3301 NumSegPts,
3302 XGeomData,
3303 YGeomData,
3304 ZGeomData,
3305 mfc);
3306 }
3307
tecgeo_(double * XPos,double * YPos,double * ZPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * Color,INTEGER4 * FillColor,INTEGER4 * IsFilled,INTEGER4 * GeomType,INTEGER4 * LinePattern,double * PatternLength,double * LineThickness,INTEGER4 * NumEllipsePts,INTEGER4 * ArrowheadStyle,INTEGER4 * ArrowheadAttachment,double * ArrowheadSize,double * ArrowheadAngle,INTEGER4 * Scope,INTEGER4 * NumSegments,INTEGER4 * NumSegPts,float * XGeomData,float * YGeomData,float * ZGeomData,char * mfc)3308 LIBFUNCTION INTEGER4 LIBCALL tecgeo_(double *XPos,
3309 double *YPos,
3310 double *ZPos,
3311 INTEGER4 *PosCoordMode,
3312 INTEGER4 *AttachToZone,
3313 INTEGER4 *Zone,
3314 INTEGER4 *Color,
3315 INTEGER4 *FillColor,
3316 INTEGER4 *IsFilled,
3317 INTEGER4 *GeomType,
3318 INTEGER4 *LinePattern,
3319 double *PatternLength,
3320 double *LineThickness,
3321 INTEGER4 *NumEllipsePts,
3322 INTEGER4 *ArrowheadStyle,
3323 INTEGER4 *ArrowheadAttachment,
3324 double *ArrowheadSize,
3325 double *ArrowheadAngle,
3326 INTEGER4 *Scope,
3327 INTEGER4 *NumSegments,
3328 INTEGER4 *NumSegPts,
3329 float *XGeomData,
3330 float *YGeomData,
3331 float *ZGeomData,
3332 char *mfc)
3333 {
3334 return TECGEO(XPos,
3335 YPos,
3336 ZPos,
3337 PosCoordMode,
3338 AttachToZone,
3339 Zone,
3340 Color,
3341 FillColor,
3342 IsFilled,
3343 GeomType,
3344 LinePattern,
3345 PatternLength,
3346 LineThickness,
3347 NumEllipsePts,
3348 ArrowheadStyle,
3349 ArrowheadAttachment,
3350 ArrowheadSize,
3351 ArrowheadAngle,
3352 Scope,
3353 NumSegments,
3354 NumSegPts,
3355 XGeomData,
3356 YGeomData,
3357 ZGeomData,
3358 mfc);
3359 }
3360 #endif
3361
3362 /**
3363 * TECTXTXXX
3364 */
TECTXT112(double * XOrThetaPos,double * YOrRPos,double * ZOrUnusedPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * BFont,INTEGER4 * FontHeightUnits,double * FontHeight,INTEGER4 * BoxType,double * BoxMargin,double * BoxLineThickness,INTEGER4 * BoxColor,INTEGER4 * BoxFillColor,double * Angle,INTEGER4 * Anchor,double * LineSpacing,INTEGER4 * TextColor,INTEGER4 * Scope,INTEGER4 * Clipping,char * String,char * mfc)3365 INTEGER4 LIBCALL TECTXT112(double *XOrThetaPos,
3366 double *YOrRPos,
3367 double *ZOrUnusedPos,
3368 INTEGER4 *PosCoordMode,
3369 INTEGER4 *AttachToZone,
3370 INTEGER4 *Zone,
3371 INTEGER4 *BFont,
3372 INTEGER4 *FontHeightUnits,
3373 double *FontHeight,
3374 INTEGER4 *BoxType,
3375 double *BoxMargin,
3376 double *BoxLineThickness,
3377 INTEGER4 *BoxColor,
3378 INTEGER4 *BoxFillColor,
3379 double *Angle,
3380 INTEGER4 *Anchor,
3381 double *LineSpacing,
3382 INTEGER4 *TextColor,
3383 INTEGER4 *Scope,
3384 INTEGER4 *Clipping,
3385 char *String,
3386 char *mfc)
3387 {
3388 int RetVal;
3389 Text_s Text;
3390 double Fract;
3391 if (CheckFile("TECTXT112") < 0)
3392 return (-1);
3393
3394 Text.PositionCoordSys = (CoordSys_e) * PosCoordMode;
3395 if (Text.PositionCoordSys == CoordSys_Frame)
3396 Fract = 0.01;
3397 else
3398 Fract = 1.0;
3399
3400 Text.AnchorPos.Generic.V1 = (*XOrThetaPos) * Fract;
3401 Text.AnchorPos.Generic.V2 = (*YOrRPos) * Fract;
3402 Text.AnchorPos.Generic.V3 = (*ZOrUnusedPos) * Fract;
3403 Text.AttachToZone = *AttachToZone != 0;
3404 Text.Zone = *Zone - 1;
3405 Text.BColor = static_cast<ColorIndex_t>(*TextColor);
3406 #if defined TECPLOTKERNEL
3407 /* CORE SOURCE CODE REMOVED */
3408 #else
3409 Text.TextShape.Font = static_cast<Font_e>(*BFont);
3410 #endif
3411 Text.TextShape.SizeUnits = static_cast<Units_e>(*FontHeightUnits);
3412 if (Text.TextShape.SizeUnits == Units_Frame)
3413 Text.TextShape.Height = (*FontHeight) / 100.0;
3414 else
3415 Text.TextShape.Height = *FontHeight;
3416 Text.Box.BoxType = static_cast<TextBox_e>(*BoxType);
3417 Text.Box.Margin = *BoxMargin / 100.0;
3418 Text.Box.LineThickness = *BoxLineThickness / 100.0;
3419 Text.Box.BColor = static_cast<ColorIndex_t>(*BoxColor);
3420 Text.Box.FillBColor = static_cast<ColorIndex_t>(*BoxFillColor);
3421 Text.Anchor = static_cast<TextAnchor_e>(*Anchor);
3422 Text.LineSpacing = *LineSpacing;
3423 Text.Angle = *Angle / DEGPERRADIANS;
3424 Text.Scope = static_cast<Scope_e>(*Scope);
3425 Text.Text = String;
3426 Text.MacroFunctionCommand = mfc;
3427 Text.Clipping = static_cast<Clipping_e>(*Clipping);
3428
3429 #if defined MAKEARCHIVE
3430 if (DebugLevel[CurFile])
3431 PRINT1("\nInserting Text: %s\n", String);
3432 #endif
3433
3434 if (DumpText(HeadFile[CurFile], &Text, TRUE, FALSE))
3435 RetVal = 0;
3436 else
3437 RetVal = -1;
3438
3439 return RetVal;
3440 }
3441
TECTXT111(double * XOrThetaPos,double * YOrRPos,double * ZOrUnusedPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * BFont,INTEGER4 * FontHeightUnits,double * FontHeight,INTEGER4 * BoxType,double * BoxMargin,double * BoxLineThickness,INTEGER4 * BoxColor,INTEGER4 * BoxFillColor,double * Angle,INTEGER4 * Anchor,double * LineSpacing,INTEGER4 * TextColor,INTEGER4 * Scope,INTEGER4 * Clipping,char * String,char * mfc)3442 INTEGER4 LIBCALL TECTXT111(double *XOrThetaPos,
3443 double *YOrRPos,
3444 double *ZOrUnusedPos,
3445 INTEGER4 *PosCoordMode,
3446 INTEGER4 *AttachToZone,
3447 INTEGER4 *Zone,
3448 INTEGER4 *BFont,
3449 INTEGER4 *FontHeightUnits,
3450 double *FontHeight,
3451 INTEGER4 *BoxType,
3452 double *BoxMargin,
3453 double *BoxLineThickness,
3454 INTEGER4 *BoxColor,
3455 INTEGER4 *BoxFillColor,
3456 double *Angle,
3457 INTEGER4 *Anchor,
3458 double *LineSpacing,
3459 INTEGER4 *TextColor,
3460 INTEGER4 *Scope,
3461 INTEGER4 *Clipping,
3462 char *String,
3463 char *mfc)
3464 {
3465 return TECTXT112(XOrThetaPos,
3466 YOrRPos,
3467 ZOrUnusedPos,
3468 PosCoordMode,
3469 AttachToZone,
3470 Zone,
3471 BFont,
3472 FontHeightUnits,
3473 FontHeight,
3474 BoxType,
3475 BoxMargin,
3476 BoxLineThickness,
3477 BoxColor,
3478 BoxFillColor,
3479 Angle,
3480 Anchor,
3481 LineSpacing,
3482 TextColor,
3483 Scope,
3484 Clipping,
3485 String,
3486 mfc);
3487 }
3488
TECTXT110(double * XOrThetaPos,double * YOrRPos,double * ZOrUnusedPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * BFont,INTEGER4 * FontHeightUnits,double * FontHeight,INTEGER4 * BoxType,double * BoxMargin,double * BoxLineThickness,INTEGER4 * BoxColor,INTEGER4 * BoxFillColor,double * Angle,INTEGER4 * Anchor,double * LineSpacing,INTEGER4 * TextColor,INTEGER4 * Scope,INTEGER4 * Clipping,char * String,char * mfc)3489 INTEGER4 LIBCALL TECTXT110(double *XOrThetaPos,
3490 double *YOrRPos,
3491 double *ZOrUnusedPos,
3492 INTEGER4 *PosCoordMode,
3493 INTEGER4 *AttachToZone,
3494 INTEGER4 *Zone,
3495 INTEGER4 *BFont,
3496 INTEGER4 *FontHeightUnits,
3497 double *FontHeight,
3498 INTEGER4 *BoxType,
3499 double *BoxMargin,
3500 double *BoxLineThickness,
3501 INTEGER4 *BoxColor,
3502 INTEGER4 *BoxFillColor,
3503 double *Angle,
3504 INTEGER4 *Anchor,
3505 double *LineSpacing,
3506 INTEGER4 *TextColor,
3507 INTEGER4 *Scope,
3508 INTEGER4 *Clipping,
3509 char *String,
3510 char *mfc)
3511 {
3512 return TECTXT112(XOrThetaPos,
3513 YOrRPos,
3514 ZOrUnusedPos,
3515 PosCoordMode,
3516 AttachToZone,
3517 Zone,
3518 BFont,
3519 FontHeightUnits,
3520 FontHeight,
3521 BoxType,
3522 BoxMargin,
3523 BoxLineThickness,
3524 BoxColor,
3525 BoxFillColor,
3526 Angle,
3527 Anchor,
3528 LineSpacing,
3529 TextColor,
3530 Scope,
3531 Clipping,
3532 String,
3533 mfc);
3534 }
3535
TECTXT100(double * XOrThetaPos,double * YOrRPos,double * ZOrUnusedPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * BFont,INTEGER4 * FontHeightUnits,double * FontHeight,INTEGER4 * BoxType,double * BoxMargin,double * BoxLineThickness,INTEGER4 * BoxColor,INTEGER4 * BoxFillColor,double * Angle,INTEGER4 * Anchor,double * LineSpacing,INTEGER4 * TextColor,INTEGER4 * Scope,INTEGER4 * Clipping,char * String,char * mfc)3536 INTEGER4 LIBCALL TECTXT100(double *XOrThetaPos,
3537 double *YOrRPos,
3538 double *ZOrUnusedPos,
3539 INTEGER4 *PosCoordMode,
3540 INTEGER4 *AttachToZone,
3541 INTEGER4 *Zone,
3542 INTEGER4 *BFont,
3543 INTEGER4 *FontHeightUnits,
3544 double *FontHeight,
3545 INTEGER4 *BoxType,
3546 double *BoxMargin,
3547 double *BoxLineThickness,
3548 INTEGER4 *BoxColor,
3549 INTEGER4 *BoxFillColor,
3550 double *Angle,
3551 INTEGER4 *Anchor,
3552 double *LineSpacing,
3553 INTEGER4 *TextColor,
3554 INTEGER4 *Scope,
3555 INTEGER4 *Clipping,
3556 char *String,
3557 char *mfc)
3558 {
3559 return TECTXT112(XOrThetaPos,
3560 YOrRPos,
3561 ZOrUnusedPos,
3562 PosCoordMode,
3563 AttachToZone,
3564 Zone,
3565 BFont,
3566 FontHeightUnits,
3567 FontHeight,
3568 BoxType,
3569 BoxMargin,
3570 BoxLineThickness,
3571 BoxColor,
3572 BoxFillColor,
3573 Angle,
3574 Anchor,
3575 LineSpacing,
3576 TextColor,
3577 Scope,
3578 Clipping,
3579 String,
3580 mfc);
3581 }
3582
TECTXT(double * XPos,double * YPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * BFont,INTEGER4 * FontHeightUnits,double * FontHeight,INTEGER4 * BoxType,double * BoxMargin,double * BoxLineThickness,INTEGER4 * BoxColor,INTEGER4 * BoxFillColor,double * Angle,INTEGER4 * Anchor,double * LineSpacing,INTEGER4 * TextColor,INTEGER4 * Scope,char * Text,char * mfc)3583 INTEGER4 LIBCALL TECTXT(double *XPos,
3584 double *YPos,
3585 INTEGER4 *PosCoordMode,
3586 INTEGER4 *AttachToZone,
3587 INTEGER4 *Zone,
3588 INTEGER4 *BFont,
3589 INTEGER4 *FontHeightUnits,
3590 double *FontHeight,
3591 INTEGER4 *BoxType,
3592 double *BoxMargin,
3593 double *BoxLineThickness,
3594 INTEGER4 *BoxColor,
3595 INTEGER4 *BoxFillColor,
3596 double *Angle,
3597 INTEGER4 *Anchor,
3598 double *LineSpacing,
3599 INTEGER4 *TextColor,
3600 INTEGER4 *Scope,
3601 char *Text,
3602 char *mfc)
3603 {
3604 double ZPos = 0.0;
3605 int Clipping = (int)Clipping_ClipToViewport;
3606 return TECTXT112(XPos,
3607 YPos,
3608 &ZPos,
3609 PosCoordMode,
3610 AttachToZone,
3611 Zone,
3612 BFont,
3613 FontHeightUnits,
3614 FontHeight,
3615 BoxType,
3616 BoxMargin,
3617 BoxLineThickness,
3618 BoxColor,
3619 BoxFillColor,
3620 Angle,
3621 Anchor,
3622 LineSpacing,
3623 TextColor,
3624 Scope,
3625 &Clipping,
3626 Text,
3627 mfc);
3628 }
3629
3630 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tectxt112_(double * XOrThetaPos,double * YOrRPos,double * ZOrUnusedPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * BFont,INTEGER4 * FontHeightUnits,double * FontHeight,INTEGER4 * BoxType,double * BoxMargin,double * BoxLineThickness,INTEGER4 * BoxColor,INTEGER4 * BoxFillColor,double * Angle,INTEGER4 * Anchor,double * LineSpacing,INTEGER4 * TextColor,INTEGER4 * Scope,INTEGER4 * Clipping,char * String,char * mfc)3631 LIBFUNCTION INTEGER4 LIBCALL tectxt112_(double *XOrThetaPos,
3632 double *YOrRPos,
3633 double *ZOrUnusedPos,
3634 INTEGER4 *PosCoordMode,
3635 INTEGER4 *AttachToZone,
3636 INTEGER4 *Zone,
3637 INTEGER4 *BFont,
3638 INTEGER4 *FontHeightUnits,
3639 double *FontHeight,
3640 INTEGER4 *BoxType,
3641 double *BoxMargin,
3642 double *BoxLineThickness,
3643 INTEGER4 *BoxColor,
3644 INTEGER4 *BoxFillColor,
3645 double *Angle,
3646 INTEGER4 *Anchor,
3647 double *LineSpacing,
3648 INTEGER4 *TextColor,
3649 INTEGER4 *Scope,
3650 INTEGER4 *Clipping,
3651 char *String,
3652 char *mfc)
3653 {
3654 return TECTXT112(XOrThetaPos,
3655 YOrRPos,
3656 ZOrUnusedPos,
3657 PosCoordMode,
3658 AttachToZone,
3659 Zone,
3660 BFont,
3661 FontHeightUnits,
3662 FontHeight,
3663 BoxType,
3664 BoxMargin,
3665 BoxLineThickness,
3666 BoxColor,
3667 BoxFillColor,
3668 Angle,
3669 Anchor,
3670 LineSpacing,
3671 TextColor,
3672 Scope,
3673 Clipping,
3674 String,
3675 mfc);
3676 }
3677
tectxt111_(double * XOrThetaPos,double * YOrRPos,double * ZOrUnusedPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * BFont,INTEGER4 * FontHeightUnits,double * FontHeight,INTEGER4 * BoxType,double * BoxMargin,double * BoxLineThickness,INTEGER4 * BoxColor,INTEGER4 * BoxFillColor,double * Angle,INTEGER4 * Anchor,double * LineSpacing,INTEGER4 * TextColor,INTEGER4 * Scope,INTEGER4 * Clipping,char * String,char * mfc)3678 LIBFUNCTION INTEGER4 LIBCALL tectxt111_(double *XOrThetaPos,
3679 double *YOrRPos,
3680 double *ZOrUnusedPos,
3681 INTEGER4 *PosCoordMode,
3682 INTEGER4 *AttachToZone,
3683 INTEGER4 *Zone,
3684 INTEGER4 *BFont,
3685 INTEGER4 *FontHeightUnits,
3686 double *FontHeight,
3687 INTEGER4 *BoxType,
3688 double *BoxMargin,
3689 double *BoxLineThickness,
3690 INTEGER4 *BoxColor,
3691 INTEGER4 *BoxFillColor,
3692 double *Angle,
3693 INTEGER4 *Anchor,
3694 double *LineSpacing,
3695 INTEGER4 *TextColor,
3696 INTEGER4 *Scope,
3697 INTEGER4 *Clipping,
3698 char *String,
3699 char *mfc)
3700 {
3701 return TECTXT112(XOrThetaPos,
3702 YOrRPos,
3703 ZOrUnusedPos,
3704 PosCoordMode,
3705 AttachToZone,
3706 Zone,
3707 BFont,
3708 FontHeightUnits,
3709 FontHeight,
3710 BoxType,
3711 BoxMargin,
3712 BoxLineThickness,
3713 BoxColor,
3714 BoxFillColor,
3715 Angle,
3716 Anchor,
3717 LineSpacing,
3718 TextColor,
3719 Scope,
3720 Clipping,
3721 String,
3722 mfc);
3723 }
3724
tectxt110_(double * XOrThetaPos,double * YOrRPos,double * ZOrUnusedPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * BFont,INTEGER4 * FontHeightUnits,double * FontHeight,INTEGER4 * BoxType,double * BoxMargin,double * BoxLineThickness,INTEGER4 * BoxColor,INTEGER4 * BoxFillColor,double * Angle,INTEGER4 * Anchor,double * LineSpacing,INTEGER4 * TextColor,INTEGER4 * Scope,INTEGER4 * Clipping,char * String,char * mfc)3725 LIBFUNCTION INTEGER4 LIBCALL tectxt110_(double *XOrThetaPos,
3726 double *YOrRPos,
3727 double *ZOrUnusedPos,
3728 INTEGER4 *PosCoordMode,
3729 INTEGER4 *AttachToZone,
3730 INTEGER4 *Zone,
3731 INTEGER4 *BFont,
3732 INTEGER4 *FontHeightUnits,
3733 double *FontHeight,
3734 INTEGER4 *BoxType,
3735 double *BoxMargin,
3736 double *BoxLineThickness,
3737 INTEGER4 *BoxColor,
3738 INTEGER4 *BoxFillColor,
3739 double *Angle,
3740 INTEGER4 *Anchor,
3741 double *LineSpacing,
3742 INTEGER4 *TextColor,
3743 INTEGER4 *Scope,
3744 INTEGER4 *Clipping,
3745 char *String,
3746 char *mfc)
3747 {
3748 return TECTXT112(XOrThetaPos,
3749 YOrRPos,
3750 ZOrUnusedPos,
3751 PosCoordMode,
3752 AttachToZone,
3753 Zone,
3754 BFont,
3755 FontHeightUnits,
3756 FontHeight,
3757 BoxType,
3758 BoxMargin,
3759 BoxLineThickness,
3760 BoxColor,
3761 BoxFillColor,
3762 Angle,
3763 Anchor,
3764 LineSpacing,
3765 TextColor,
3766 Scope,
3767 Clipping,
3768 String,
3769 mfc);
3770 }
3771
tectxt100_(double * XOrThetaPos,double * YOrRPos,double * ZOrUnusedPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * BFont,INTEGER4 * FontHeightUnits,double * FontHeight,INTEGER4 * BoxType,double * BoxMargin,double * BoxLineThickness,INTEGER4 * BoxColor,INTEGER4 * BoxFillColor,double * Angle,INTEGER4 * Anchor,double * LineSpacing,INTEGER4 * TextColor,INTEGER4 * Scope,INTEGER4 * Clipping,char * String,char * mfc)3772 LIBFUNCTION INTEGER4 LIBCALL tectxt100_(double *XOrThetaPos,
3773 double *YOrRPos,
3774 double *ZOrUnusedPos,
3775 INTEGER4 *PosCoordMode,
3776 INTEGER4 *AttachToZone,
3777 INTEGER4 *Zone,
3778 INTEGER4 *BFont,
3779 INTEGER4 *FontHeightUnits,
3780 double *FontHeight,
3781 INTEGER4 *BoxType,
3782 double *BoxMargin,
3783 double *BoxLineThickness,
3784 INTEGER4 *BoxColor,
3785 INTEGER4 *BoxFillColor,
3786 double *Angle,
3787 INTEGER4 *Anchor,
3788 double *LineSpacing,
3789 INTEGER4 *TextColor,
3790 INTEGER4 *Scope,
3791 INTEGER4 *Clipping,
3792 char *String,
3793 char *mfc)
3794 {
3795 return TECTXT112(XOrThetaPos,
3796 YOrRPos,
3797 ZOrUnusedPos,
3798 PosCoordMode,
3799 AttachToZone,
3800 Zone,
3801 BFont,
3802 FontHeightUnits,
3803 FontHeight,
3804 BoxType,
3805 BoxMargin,
3806 BoxLineThickness,
3807 BoxColor,
3808 BoxFillColor,
3809 Angle,
3810 Anchor,
3811 LineSpacing,
3812 TextColor,
3813 Scope,
3814 Clipping,
3815 String,
3816 mfc);
3817 }
3818
tectxt_(double * XPos,double * YPos,INTEGER4 * PosCoordMode,INTEGER4 * AttachToZone,INTEGER4 * Zone,INTEGER4 * BFont,INTEGER4 * FontHeightUnits,double * FontHeight,INTEGER4 * BoxType,double * BoxMargin,double * BoxLineThickness,INTEGER4 * BoxColor,INTEGER4 * BoxFillColor,double * Angle,INTEGER4 * Anchor,double * LineSpacing,INTEGER4 * TextColor,INTEGER4 * Scope,char * Text,char * mfc)3819 LIBFUNCTION INTEGER4 LIBCALL tectxt_(double *XPos,
3820 double *YPos,
3821 INTEGER4 *PosCoordMode,
3822 INTEGER4 *AttachToZone,
3823 INTEGER4 *Zone,
3824 INTEGER4 *BFont,
3825 INTEGER4 *FontHeightUnits,
3826 double *FontHeight,
3827 INTEGER4 *BoxType,
3828 double *BoxMargin,
3829 double *BoxLineThickness,
3830 INTEGER4 *BoxColor,
3831 INTEGER4 *BoxFillColor,
3832 double *Angle,
3833 INTEGER4 *Anchor,
3834 double *LineSpacing,
3835 INTEGER4 *TextColor,
3836 INTEGER4 *Scope,
3837 char *Text,
3838 char *mfc)
3839 {
3840 return TECTXT(XPos,
3841 YPos,
3842 PosCoordMode,
3843 AttachToZone,
3844 Zone,
3845 BFont,
3846 FontHeightUnits,
3847 FontHeight,
3848 BoxType,
3849 BoxMargin,
3850 BoxLineThickness,
3851 BoxColor,
3852 BoxFillColor,
3853 Angle,
3854 Anchor,
3855 LineSpacing,
3856 TextColor,
3857 Scope,
3858 Text,
3859 mfc);
3860 }
3861 #endif
3862
3863
3864 /**
3865 * TECFILXXX
3866 */
TECFIL112(INTEGER4 * F)3867 INTEGER4 LIBCALL TECFIL112(INTEGER4 *F)
3868 {
3869 if ((*F < 1) || (*F > MaxNumFiles))
3870 {
3871 #if defined MAKEARCHIVE
3872 PRINT1("Err: (TECFIL112) Invalid file number requested (%d). File not changed.\n", *F);
3873 #endif
3874 return (-1);
3875 }
3876
3877 if (!IsOpen[*F-1])
3878 {
3879 #if defined MAKEARCHIVE
3880 int I;
3881 PRINT1("Err: (TECFIL112) file %d is not open. File not changed.\n", *F);
3882 PRINT0("\n\nFile states are:\n");
3883 for (I = 0; I < MaxNumFiles; I++)
3884 PRINT2("file %d, IsOpen=%d\n", I + 1, IsOpen[I]);
3885 PRINT1("Current File is: %d\n", CurFile + 1);
3886 #endif
3887 return (-1);
3888 }
3889 CurFile = *F - 1;
3890 #if defined MAKEARCHIVE
3891 if (DebugLevel[CurFile])
3892 {
3893 PRINT1("Switching to file #%d\n\n", CurFile + 1);
3894 PRINT0("Current State is:\n");
3895 PRINT1(" Debug = %d\n", DebugLevel[CurFile]);
3896 PRINT1(" NumVars = %d\n", NumVars[CurFile]);
3897 PRINT1(" DestFName = %s\n", DestFName[CurFile]);
3898 PRINT1(" BlckFName = %s\n", BlckFName[CurFile]);
3899 PRINT1(" ZoneType = %s\n", ZoneTypes[ZoneType[CurFile]]);
3900
3901 if (ZoneType[CurFile] == ORDERED)
3902 {
3903 PRINT1(" IMax = %d\n", IMax[CurFile]);
3904 PRINT1(" JMax = %d\n", JMax[CurFile]);
3905 PRINT1(" KMax = %d\n", KMax[CurFile]);
3906 }
3907 else
3908 {
3909 PRINT1(" NumPoints = %d\n", IMax[CurFile]);
3910 PRINT1(" NumElmnts = %d\n", JMax[CurFile]);
3911 }
3912 PRINT1(" NumDataValuesWritten = %d\n", NumDataValuesWritten[CurFile]);
3913 PRINT1(" CurZone = %d\n", CurZone[CurFile] + 1);
3914 }
3915 #endif /* MAKEARCHIVE */
3916 return (0);
3917 }
3918
TECFIL111(INTEGER4 * F)3919 INTEGER4 LIBCALL TECFIL111(INTEGER4 *F)
3920 {
3921 return TECFIL112(F);
3922 }
3923
TECFIL110(INTEGER4 * F)3924 INTEGER4 LIBCALL TECFIL110(INTEGER4 *F)
3925 {
3926 return TECFIL112(F);
3927 }
3928
TECFIL100(INTEGER4 * F)3929 INTEGER4 LIBCALL TECFIL100(INTEGER4 *F)
3930 {
3931 return TECFIL112(F);
3932 }
3933
TECFIL(INTEGER4 * F)3934 INTEGER4 LIBCALL TECFIL(INTEGER4 *F)
3935 {
3936 return TECFIL112(F);
3937 }
3938
3939 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tecfil112_(INTEGER4 * F)3940 LIBFUNCTION INTEGER4 LIBCALL tecfil112_(INTEGER4 *F)
3941 {
3942 return TECFIL112(F);
3943 }
3944
tecfil111_(INTEGER4 * F)3945 LIBFUNCTION INTEGER4 LIBCALL tecfil111_(INTEGER4 *F)
3946 {
3947 return TECFIL112(F);
3948 }
3949
tecfil110_(INTEGER4 * F)3950 LIBFUNCTION INTEGER4 LIBCALL tecfil110_(INTEGER4 *F)
3951 {
3952 return TECFIL112(F);
3953 }
3954
tecfil100_(INTEGER4 * F)3955 LIBFUNCTION INTEGER4 LIBCALL tecfil100_(INTEGER4 *F)
3956 {
3957 return TECFIL112(F);
3958 }
3959
tecfil_(INTEGER4 * F)3960 LIBFUNCTION INTEGER4 LIBCALL tecfil_(INTEGER4 *F)
3961 {
3962 return TECFIL112(F);
3963 }
3964 #endif
3965
3966 /**
3967 * TECFOREIGNXXX
3968 */
TECFOREIGN112(INTEGER4 * OutputForeignByteOrder)3969 void LIBCALL TECFOREIGN112(INTEGER4 *OutputForeignByteOrder)
3970 {
3971 REQUIRE(VALID_REF(OutputForeignByteOrder));
3972
3973 DoWriteForeign = (*OutputForeignByteOrder != 0);
3974 }
3975
TECFOREIGN111(INTEGER4 * OutputForeignByteOrder)3976 void LIBCALL TECFOREIGN111(INTEGER4 *OutputForeignByteOrder)
3977 {
3978 TECFOREIGN112(OutputForeignByteOrder);
3979 }
3980
TECFOREIGN110(INTEGER4 * OutputForeignByteOrder)3981 void LIBCALL TECFOREIGN110(INTEGER4 *OutputForeignByteOrder)
3982 {
3983 TECFOREIGN112(OutputForeignByteOrder);
3984 }
3985
TECFOREIGN100(INTEGER4 * OutputForeignByteOrder)3986 void LIBCALL TECFOREIGN100(INTEGER4 *OutputForeignByteOrder)
3987 {
3988 TECFOREIGN112(OutputForeignByteOrder);
3989 }
3990
3991 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tecforeign112_(INTEGER4 * OutputForeignByteOrder)3992 LIBFUNCTION void LIBCALL tecforeign112_(INTEGER4 *OutputForeignByteOrder)
3993 {
3994 TECFOREIGN112(OutputForeignByteOrder);
3995 }
3996
tecforeign111_(INTEGER4 * OutputForeignByteOrder)3997 LIBFUNCTION void LIBCALL tecforeign111_(INTEGER4 *OutputForeignByteOrder)
3998 {
3999 TECFOREIGN112(OutputForeignByteOrder);
4000 }
4001
tecforeign110_(INTEGER4 * OutputForeignByteOrder)4002 LIBFUNCTION void LIBCALL tecforeign110_(INTEGER4 *OutputForeignByteOrder)
4003 {
4004 TECFOREIGN112(OutputForeignByteOrder);
4005 }
4006
tecforeign100_(INTEGER4 * OutputForeignByteOrder)4007 LIBFUNCTION void LIBCALL tecforeign100_(INTEGER4 *OutputForeignByteOrder)
4008 {
4009 TECFOREIGN112(OutputForeignByteOrder);
4010 }
4011 #endif
4012
4013 #if defined MAKEARCHIVE
4014
4015 /**
4016 * A valid auxiliary data name character must begin with a '_' or alpha
4017 * character and may be followed by one or more '_', '.', alpha or digit
4018 * characters.
4019 */
AuxDataIsValidNameChar(char Char,Boolean_t IsLeadChar)4020 static Boolean_t AuxDataIsValidNameChar(char Char,
4021 Boolean_t IsLeadChar)
4022 {
4023 Boolean_t IsValidNameChar;
4024
4025 REQUIRE(0 <= Char && "Char <= 127");
4026 REQUIRE(VALID_BOOLEAN(IsLeadChar));
4027
4028 IsValidNameChar = (Char == '_' ||
4029 tecplot::isalpha(Char));
4030 if (!IsLeadChar)
4031 IsValidNameChar = (IsValidNameChar ||
4032 Char == '.' ||
4033 tecplot::isdigit(Char));
4034
4035 ENSURE(VALID_BOOLEAN(IsValidNameChar));
4036 return IsValidNameChar;
4037 }
4038
4039 /**
4040 * Indicates if the auxiliary data name is valid. A valid auxiliary data name
4041 * must begin with a '_' or alpha character and may be followed by one or
4042 * more '_', '.', alpha or digit characters.
4043 */
AuxDataIsValidName(const char * Name)4044 static Boolean_t AuxDataIsValidName(const char *Name)
4045 {
4046 Boolean_t IsValidName;
4047 const char *NPtr;
4048 REQUIRE(VALID_REF(Name));
4049
4050 for (NPtr = Name, IsValidName = AuxDataIsValidNameChar(*NPtr, TRUE);
4051 IsValidName && *NPtr != '\0';
4052 NPtr++)
4053 {
4054 IsValidName = AuxDataIsValidNameChar(*NPtr, FALSE);
4055 }
4056
4057 ENSURE(VALID_BOOLEAN(IsValidName));
4058 return IsValidName;
4059 }
4060
4061 #endif /* MAKEARCHIVE */
4062
4063 /**
4064 * TECAUXSTRXXX
4065 */
TECAUXSTR112(char * Name,char * Value)4066 LIBFUNCTION INTEGER4 LIBCALL TECAUXSTR112(char *Name,
4067 char *Value)
4068 {
4069 if (CheckFile("TECAUXSTR112") < 0)
4070 return (-1);
4071
4072 #if defined MAKEARCHIVE
4073 if (DebugLevel[CurFile])
4074 PRINT2("\nInserting data set aux data: '%s' = '%s'\n", Name, Value);
4075 #endif
4076
4077 if ((Name == NULL) || !AuxDataIsValidName(Name))
4078 {
4079 #if defined MAKEARCHIVE
4080 PRINT0("Err: (TECAUXSTR112) Invalid Name string\n");
4081 #endif
4082 NumErrs[CurFile]++;
4083 return (-1);
4084 }
4085
4086 if ((Value == NULL) || (*Value == '\0'))
4087 {
4088 #if defined MAKEARCHIVE
4089 if (DebugLevel[CurFile])
4090 PRINT0("Err: (TECAUXSTR112) Invalid Value string\n");
4091 #endif
4092 NumErrs[CurFile]++;
4093 return (-1);
4094 }
4095
4096 /*
4097 * Because the auxiliary data is at the end of the header section we don't
4098 * need to seek back to it.
4099 */
4100 if (!WriteBinaryReal(HeadFile[CurFile], DataSetAuxMarker, FieldDataType_Float) ||
4101 !DumpDatafileString(HeadFile[CurFile], Name, TRUE /* WriteBinary */) ||
4102 !WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)AuxDataType_String) ||
4103 !DumpDatafileString(HeadFile[CurFile], (const char *)Value, TRUE /* WriteBinary */))
4104 {
4105 #if defined MAKEARCHIVE
4106 if (DebugLevel[CurFile])
4107 printf("Err: (TECAUXSTR112) Write failure for file %d\n", CurFile + 1);
4108 #endif
4109 NumErrs[CurFile]++;
4110 return (-1);
4111 }
4112 return (0);
4113 }
4114
TECAUXSTR111(char * Name,char * Value)4115 LIBFUNCTION INTEGER4 LIBCALL TECAUXSTR111(char *Name,
4116 char *Value)
4117 {
4118 return TECAUXSTR112(Name, Value);
4119 }
4120
TECAUXSTR110(char * Name,char * Value)4121 LIBFUNCTION INTEGER4 LIBCALL TECAUXSTR110(char *Name,
4122 char *Value)
4123 {
4124 return TECAUXSTR112(Name, Value);
4125 }
4126
TECAUXSTR100(char * Name,char * Value)4127 LIBFUNCTION INTEGER4 LIBCALL TECAUXSTR100(char *Name,
4128 char *Value)
4129 {
4130 return TECAUXSTR112(Name, Value);
4131 }
4132
4133 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tecauxstr112_(char * Name,char * Value)4134 LIBFUNCTION INTEGER4 LIBCALL tecauxstr112_(char *Name,
4135 char *Value)
4136 {
4137 return TECAUXSTR112(Name, Value);
4138 }
4139
tecauxstr111_(char * Name,char * Value)4140 LIBFUNCTION INTEGER4 LIBCALL tecauxstr111_(char *Name,
4141 char *Value)
4142 {
4143 return TECAUXSTR112(Name, Value);
4144 }
4145
tecauxstr110_(char * Name,char * Value)4146 LIBFUNCTION INTEGER4 LIBCALL tecauxstr110_(char *Name,
4147 char *Value)
4148 {
4149 return TECAUXSTR112(Name, Value);
4150 }
4151
tecauxstr100_(char * Name,char * Value)4152 LIBFUNCTION INTEGER4 LIBCALL tecauxstr100_(char *Name,
4153 char *Value)
4154 {
4155 return TECAUXSTR112(Name, Value);
4156 }
4157 #endif
4158
4159
4160 /**
4161 * TECZAUXSTRXXX
4162 */
TECZAUXSTR112(char * Name,char * Value)4163 LIBFUNCTION INTEGER4 LIBCALL TECZAUXSTR112(char *Name,
4164 char *Value)
4165 {
4166 if (CheckFile("TECZAUXSTR112") < 0)
4167 return (-1);
4168
4169 if (CurZone[CurFile] == -1)
4170 {
4171 #if defined MAKEARCHIVE
4172 PRINT0("Err: (TECZAUXSTR112) Must call TECZNE112 prior to TECZAUXSTR112\n");
4173 #endif
4174 NumErrs[CurFile]++;
4175 return (-1);
4176 }
4177
4178
4179 #if defined MAKEARCHIVE
4180 if (DebugLevel[CurFile])
4181 PRINT2("\nInserting zone aux data: '%s' = '%s'\n", Name, Value);
4182 #endif
4183
4184 if ((Name == NULL) || !AuxDataIsValidName(Name))
4185 {
4186 #if defined MAKEARCHIVE
4187 PRINT0("Err: (TECZAUXSTR112) Invalid Name string\n");
4188 #endif
4189 NumErrs[CurFile]++;
4190 return (-1);
4191 }
4192
4193 if ((Value == NULL) || (*Value == '\0'))
4194 {
4195 #if defined MAKEARCHIVE
4196 if (DebugLevel[CurFile])
4197 PRINT0("Err: (TECZAUXSTR112) Invalid Value string\n");
4198 #endif
4199 NumErrs[CurFile]++;
4200 return (-1);
4201 }
4202
4203 /*
4204 * Have to back over the 0 already written, then write another one afterward.
4205 */
4206 if (TP_FSEEK(HeadFile[CurFile]->File, -4, SEEK_CUR) ||
4207 !WriteBinaryInt32(HeadFile[CurFile], 1) ||
4208 !DumpDatafileString(HeadFile[CurFile], Name, TRUE /* WriteBinary */) ||
4209 !WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)AuxDataType_String) ||
4210 !DumpDatafileString(HeadFile[CurFile], (const char *)Value, TRUE /* WriteBinary */) ||
4211 !WriteBinaryInt32(HeadFile[CurFile], 0))
4212 {
4213 #if defined MAKEARCHIVE
4214 if (DebugLevel[CurFile])
4215 printf("Err: (TECZAUXSTR112) Write failure for file %d\n", CurFile + 1);
4216 #endif
4217 NumErrs[CurFile]++;
4218 return (-1);
4219 }
4220
4221 return (0);
4222 }
4223
TECZAUXSTR111(char * Name,char * Value)4224 LIBFUNCTION INTEGER4 LIBCALL TECZAUXSTR111(char *Name,
4225 char *Value)
4226 {
4227 return TECZAUXSTR112(Name, Value);
4228 }
4229
TECZAUXSTR110(char * Name,char * Value)4230 LIBFUNCTION INTEGER4 LIBCALL TECZAUXSTR110(char *Name,
4231 char *Value)
4232 {
4233 return TECZAUXSTR112(Name, Value);
4234 }
4235
TECZAUXSTR100(char * Name,char * Value)4236 LIBFUNCTION INTEGER4 LIBCALL TECZAUXSTR100(char *Name,
4237 char *Value)
4238 {
4239 return TECZAUXSTR112(Name, Value);
4240 }
4241
4242 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
teczauxstr112_(char * Name,char * Value)4243 LIBFUNCTION INTEGER4 LIBCALL teczauxstr112_(char *Name,
4244 char *Value)
4245 {
4246 return TECZAUXSTR112(Name, Value);
4247 }
4248
teczauxstr111_(char * Name,char * Value)4249 LIBFUNCTION INTEGER4 LIBCALL teczauxstr111_(char *Name,
4250 char *Value)
4251 {
4252 return TECZAUXSTR112(Name, Value);
4253 }
4254
teczauxstr110_(char * Name,char * Value)4255 LIBFUNCTION INTEGER4 LIBCALL teczauxstr110_(char *Name,
4256 char *Value)
4257 {
4258 return TECZAUXSTR112(Name, Value);
4259 }
4260
teczauxstr100_(char * Name,char * Value)4261 LIBFUNCTION INTEGER4 LIBCALL teczauxstr100_(char *Name,
4262 char *Value)
4263 {
4264 return TECZAUXSTR112(Name, Value);
4265 }
4266 #endif
4267
4268
4269 /**
4270 * TECVAUXSTRXXX
4271 */
TECVAUXSTR112(INTEGER4 * Var,char * Name,char * Value)4272 LIBFUNCTION INTEGER4 LIBCALL TECVAUXSTR112(INTEGER4 *Var,
4273 char *Name,
4274 char *Value)
4275 {
4276 if (CheckFile("TECVAUXSTR112") < 0)
4277 return (-1);
4278
4279 #if defined MAKEARCHIVE
4280 if (DebugLevel[CurFile])
4281 PRINT2("\nInserting variable aux data: '%s' = '%s'\n", Name, Value);
4282 #endif
4283
4284 if ((Name == NULL) || !AuxDataIsValidName(Name))
4285 {
4286 #if defined MAKEARCHIVE
4287 PRINT0("Err: (TECVAUXSTR112) Invalid Name string\n");
4288 #endif
4289 NumErrs[CurFile]++;
4290 return (-1);
4291 }
4292
4293 if ((Value == NULL) || (*Value == '\0'))
4294 {
4295 #if defined MAKEARCHIVE
4296 if (DebugLevel[CurFile])
4297 PRINT0("Err: (TECVAUXSTR112) Invalid Value string\n");
4298 #endif
4299 NumErrs[CurFile]++;
4300 return (-1);
4301 }
4302
4303 if (!WriteBinaryReal(HeadFile[CurFile], VarAuxMarker, FieldDataType_Float) ||
4304 !WriteBinaryInt32(HeadFile[CurFile], *Var - 1) ||
4305 !DumpDatafileString(HeadFile[CurFile], Name, TRUE /* WriteBinary */) ||
4306 !WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)AuxDataType_String) ||
4307 !DumpDatafileString(HeadFile[CurFile], (const char *)Value, TRUE /* WriteBinary */))
4308 {
4309 #if defined MAKEARCHIVE
4310 if (DebugLevel[CurFile])
4311 printf("Err: (TECVAUXSTR112) Write failure for file %d\n", CurFile + 1);
4312 #endif
4313 NumErrs[CurFile]++;
4314 return (-1);
4315 }
4316
4317 return (0);
4318 }
4319
TECVAUXSTR111(INTEGER4 * Var,char * Name,char * Value)4320 LIBFUNCTION INTEGER4 LIBCALL TECVAUXSTR111(INTEGER4 *Var,
4321 char *Name,
4322 char *Value)
4323 {
4324 return TECVAUXSTR112(Var, Name, Value);
4325 }
4326
TECVAUXSTR110(INTEGER4 * Var,char * Name,char * Value)4327 LIBFUNCTION INTEGER4 LIBCALL TECVAUXSTR110(INTEGER4 *Var,
4328 char *Name,
4329 char *Value)
4330 {
4331 return TECVAUXSTR112(Var, Name, Value);
4332 }
4333
TECVAUXSTR100(INTEGER4 * Var,char * Name,char * Value)4334 LIBFUNCTION INTEGER4 LIBCALL TECVAUXSTR100(INTEGER4 *Var,
4335 char *Name,
4336 char *Value)
4337 {
4338 return TECVAUXSTR112(Var, Name, Value);
4339 }
4340
4341 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tecvauxstr112_(INTEGER4 * Var,char * Name,char * Value)4342 LIBFUNCTION INTEGER4 LIBCALL tecvauxstr112_(INTEGER4 *Var,
4343 char *Name,
4344 char *Value)
4345 {
4346 return TECVAUXSTR112(Var, Name, Value);
4347 }
4348
tecvauxstr111_(INTEGER4 * Var,char * Name,char * Value)4349 LIBFUNCTION INTEGER4 LIBCALL tecvauxstr111_(INTEGER4 *Var,
4350 char *Name,
4351 char *Value)
4352 {
4353 return TECVAUXSTR112(Var, Name, Value);
4354 }
4355
tecvauxstr110_(INTEGER4 * Var,char * Name,char * Value)4356 LIBFUNCTION INTEGER4 LIBCALL tecvauxstr110_(INTEGER4 *Var,
4357 char *Name,
4358 char *Value)
4359 {
4360 return TECVAUXSTR112(Var, Name, Value);
4361 }
4362
tecvauxstr100_(INTEGER4 * Var,char * Name,char * Value)4363 LIBFUNCTION INTEGER4 LIBCALL tecvauxstr100_(INTEGER4 *Var,
4364 char *Name,
4365 char *Value)
4366 {
4367 return TECVAUXSTR112(Var, Name, Value);
4368 }
4369 #endif
4370
4371
4372 /**
4373 * TECFACEXXX
4374 */
TECFACE112(INTEGER4 * FaceConnections)4375 LIBFUNCTION INTEGER4 LIBCALL TECFACE112(INTEGER4 *FaceConnections)
4376 {
4377 INTEGER4 i, *Ptr;
4378
4379 /* Mark that the face neighbors have been written for the zone even if it fails so as not to add extra error messages. */
4380 FaceNeighborsOrMapWritten[CurFile][CurZone[CurFile]] = TRUE;
4381
4382 if (CheckFile("TECFACE112") < 0)
4383 return (-1);
4384
4385 if (ZoneType[CurFile] == FEPOLYGON ||
4386 ZoneType[CurFile] == FEPOLYHEDRON)
4387 {
4388 /* Wrong way to specify face neighbors for polygons and polyhedrons */
4389 #if defined MAKEARCHIVE
4390 PRINT0("Err: (TECFACE112) Cannot call TECFACE112 for polygonal or polyhedral zones.\n");
4391 #endif
4392 NumErrs[CurFile]++;
4393 return (-1);
4394 }
4395
4396 if (FileTypes[CurFile] == SOLUTIONFILE)
4397 {
4398 #if defined MAKEARCHIVE
4399 PRINT0("Err: (TECFACE112) Cannot call TECFACE112 if the file type is SOLUTIONFILE.\n");
4400 #endif
4401 NumErrs[CurFile]++;
4402 return (-1);
4403 }
4404
4405 #if defined MAKEARCHIVE
4406 if (DebugLevel[CurFile])
4407 PRINT0("\nInserting face neighbor data\n");
4408 #endif
4409
4410 if (FaceConnections == NULL)
4411 {
4412 #if defined MAKEARCHIVE
4413 PRINT0("Err: (TECFACE112) Invalid array\n");
4414 #endif
4415 NumErrs[CurFile]++;
4416 return (-1);
4417 }
4418
4419 /*
4420 * Face neighbor connection have the following format for both
4421 * binary:
4422 *
4423 * LOCALONETOONE 3 cz,fz,cz
4424 * LOCALONETOMANY nz+4 cz,fz,oz,nz,cz1,cz2,...,czn
4425 * GLOBALONETOONE 4 cz,fz,ZZ,CZ
4426 * GLOBALONETOMANY 2*nz+4 cz,fz,oz,nz,ZZ1,CZ1,ZZ2,CZ2,...,ZZn,CZn
4427 *
4428 * Where:
4429 * cz = cell in current zone
4430 * fz = face of cell in current zone
4431 * oz = face obsuration flag (only applies to one-to-many):
4432 * 0 = face partially obscured
4433 * 1 = face entirely obscured
4434 * nz = number of cell or zone/cell associations (only applies to one-to-many)
4435 * ZZ = remote Zone
4436 * CZ = cell in remote zone
4437 *
4438 * NOTE:
4439 * As of version 103 Tecplot assumes that face neighbors are zero based
4440 * instead of ones based. Since we have to maintain the contract we
4441 * subtract 1 for the caller.
4442 */
4443 Ptr = FaceConnections;
4444 i = 0;
4445 while (i < NumFaceConnections[CurFile][CurZone[CurFile]])
4446 {
4447 INTEGER4 n;
4448 INTEGER4 NumNum = 0;
4449
4450 switch (FaceNeighborMode[CurFile])
4451 {
4452 case FaceNeighborMode_LocalOneToOne:
4453 NumNum = 3;
4454 i++;
4455 break;
4456 case FaceNeighborMode_LocalOneToMany:
4457 NumNum = 4 + Ptr[3];
4458 i += Ptr[3];
4459 break;
4460 case FaceNeighborMode_GlobalOneToOne:
4461 NumNum = 4;
4462 i++;
4463 break;
4464 case FaceNeighborMode_GlobalOneToMany:
4465 NumNum = 4 + 2 * Ptr[3];
4466 i += Ptr[3];
4467 break;
4468 default:
4469 CHECK(FALSE);
4470 break;
4471 }
4472
4473 n = 0;
4474 if (FaceNeighborMode[CurFile] == FaceNeighborMode_LocalOneToMany ||
4475 FaceNeighborMode[CurFile] == FaceNeighborMode_GlobalOneToMany)
4476 {
4477 /*
4478 * Write cz,fz,oz,nz: we do this by hand because the oz and nz values
4479 * are not zero based values.
4480 */
4481 if (!WriteBinaryInt32(BlckFile[CurFile], Ptr[n++] - 1) || /* zero based as of version 103 */
4482 !WriteBinaryInt32(BlckFile[CurFile], Ptr[n++] - 1) || /* zero based as of version 103 */
4483 !WriteBinaryInt32(BlckFile[CurFile], Ptr[n++]) || /* ones based */
4484 !WriteBinaryInt32(BlckFile[CurFile], Ptr[n++])) /* ones based */
4485 {
4486 #if defined MAKEARCHIVE
4487 if (DebugLevel[CurFile])
4488 printf("Err: (TECFACE112) Write failure for file %d\n", CurFile + 1);
4489 #endif
4490 NumErrs[CurFile]++;
4491 return (-1);
4492 }
4493
4494 }
4495 /* starting from where we left off, output the remaining values */
4496 for (; n < NumNum; n++)
4497 if (!WriteBinaryInt32(BlckFile[CurFile], Ptr[n] - 1)) /* zero based as of version 103 */
4498 {
4499 #if defined MAKEARCHIVE
4500 if (DebugLevel[CurFile])
4501 printf("Err: (TECFACE112) Write failure for file %d\n", CurFile + 1);
4502 #endif
4503 NumErrs[CurFile]++;
4504 return (-1);
4505 }
4506 Ptr += NumNum;
4507 }
4508
4509 return (0);
4510 }
4511
TECFACE111(INTEGER4 * FaceConnections)4512 LIBFUNCTION INTEGER4 LIBCALL TECFACE111(INTEGER4 *FaceConnections)
4513 {
4514 return TECFACE112(FaceConnections);
4515 }
4516
TECFACE110(INTEGER4 * FaceConnections)4517 LIBFUNCTION INTEGER4 LIBCALL TECFACE110(INTEGER4 *FaceConnections)
4518 {
4519 return TECFACE112(FaceConnections);
4520 }
4521
TECFACE100(INTEGER4 * FaceConnections)4522 LIBFUNCTION INTEGER4 LIBCALL TECFACE100(INTEGER4 *FaceConnections)
4523 {
4524 return TECFACE112(FaceConnections);
4525 }
4526
4527 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tecface112_(INTEGER4 * FaceConnections)4528 LIBFUNCTION INTEGER4 LIBCALL tecface112_(INTEGER4 *FaceConnections)
4529 {
4530 return TECFACE112(FaceConnections);
4531 }
4532
tecface111_(INTEGER4 * FaceConnections)4533 LIBFUNCTION INTEGER4 LIBCALL tecface111_(INTEGER4 *FaceConnections)
4534 {
4535 return TECFACE112(FaceConnections);
4536 }
4537
tecface110_(INTEGER4 * FaceConnections)4538 LIBFUNCTION INTEGER4 LIBCALL tecface110_(INTEGER4 *FaceConnections)
4539 {
4540 return TECFACE112(FaceConnections);
4541 }
4542
tecface100_(INTEGER4 * FaceConnections)4543 LIBFUNCTION INTEGER4 LIBCALL tecface100_(INTEGER4 *FaceConnections)
4544 {
4545 return TECFACE112(FaceConnections);
4546 }
4547 #endif
4548
4549
4550 /**
4551 * TECPOLYXXX
4552 */
TECPOLY112(INTEGER4 * FaceNodeCounts,INTEGER4 * FaceNodes,INTEGER4 * FaceLeftElems,INTEGER4 * FaceRightElems,INTEGER4 * FaceBndryConnectionCounts,INTEGER4 * FaceBndryConnectionElems,INTEGER4 * FaceBndryConnectionZones)4553 LIBFUNCTION INTEGER4 LIBCALL TECPOLY112(INTEGER4 *FaceNodeCounts,
4554 INTEGER4 *FaceNodes,
4555 INTEGER4 *FaceLeftElems,
4556 INTEGER4 *FaceRightElems,
4557 INTEGER4 *FaceBndryConnectionCounts,
4558 INTEGER4 *FaceBndryConnectionElems,
4559 INTEGER4 *FaceBndryConnectionZones)
4560 {
4561 INTEGER4 NumFaces = KMax[CurFile];
4562 INTEGER4 Result = 0;
4563 LgIndex_t Index;
4564 LgIndex_t MinNeighborValue = TECIO_NO_NEIGHBORING_ELEM;
4565
4566 /* Mark that the face map has been written for the zone even if it fails so as not to add extra error messages. */
4567 FaceNeighborsOrMapWritten[CurFile][CurZone[CurFile]] = TRUE;
4568
4569 if (NumFaces == 0 ||
4570 (ZoneType[CurFile] != FEPOLYGON &&
4571 ZoneType[CurFile] != FEPOLYHEDRON))
4572 {
4573 #if defined MAKEARCHIVE
4574 PRINT0("Err: (TECPOLY112) The zone type must be FEPOLYGON or FEPOLYHEDRON and have NumFaces (KMax) > 0.\n");
4575 PRINT1(" NumFaces = %d\n", NumFaces);
4576 #endif
4577 NumErrs[CurFile]++;
4578 return (-1);
4579 }
4580
4581 if (ZoneType[CurFile] == FEPOLYHEDRON) /* FEPOLYGON doesn't need TotalNumFaceNodes since this is 2*NumFaces */
4582 {
4583 if (TotalNumFaceNodes[CurFile][CurZone[CurFile]] <= 0)
4584 {
4585 #if defined MAKEARCHIVE
4586 PRINT0("Err: (TECPOLY112) TotalNumFaceNodes MUST be specified for polyhedral zones.\n");
4587 PRINT1(" TotalNumFaceNodes = %d\n", TotalNumFaceNodes[CurFile][CurZone[CurFile]]);
4588 #endif
4589 NumErrs[CurFile]++;
4590 return (-1);
4591 }
4592 }
4593 else
4594 {
4595 if (TotalNumFaceNodes[CurFile][CurZone[CurFile]] != (2 * NumFaces))
4596 {
4597 #if defined MAKEARCHIVE
4598 PRINT0("Err: (TECPOLY112) TotalNumFaceNodes is specified for the polygonal zone but is not equal to 2 * NumFaces.\n");
4599 PRINT2(" TotalNumFaceNodes = %d. If specified, it must be 2 * %d.", TotalNumFaceNodes[CurFile][CurZone[CurFile]], NumFaces);
4600 #endif
4601 NumErrs[CurFile]++;
4602 return (-1);
4603 }
4604 }
4605
4606 if ((TotalNumFaceBndryFaces[CurFile] > 0 &&
4607 TotalNumFaceBndryConns[CurFile] > 0) ||
4608 (TotalNumFaceBndryFaces[CurFile] == 0 &&
4609 TotalNumFaceBndryConns[CurFile] == 0))
4610 {
4611 if (TotalNumFaceBndryFaces[CurFile] > 0)
4612 MinNeighborValue = -TotalNumFaceBndryFaces[CurFile];
4613 }
4614 else
4615 {
4616 #if defined MAKEARCHIVE
4617 PRINT0("Err: (TECPOLY112) TotalNumFaceBndryFaces and TotalNumFaceBndryConns must both be 0 or both be > 0.\n");
4618 PRINT2(" TotalNumFaceBndryFaces = %d, TotalNumFaceBndryConns = %d\n", TotalNumFaceBndryFaces[CurFile], TotalNumFaceBndryConns[CurFile]);
4619 #endif
4620 NumErrs[CurFile]++;
4621 return (-1);
4622 }
4623
4624 /* Write the facenodesoffsets array from the facenodecounts array. */
4625 if (Result == 0)
4626 {
4627 if (ZoneType[CurFile] == FEPOLYHEDRON) /* FEPOLYGON doesn't need to specify facenodesoffsets */
4628 {
4629 Int32_t FaceNodeSum = 0;
4630 if (!WriteBinaryInt32(BlckFile[CurFile], 0))
4631 Result = -1;
4632 for (Index = 0; (Result == 0) && (Index < NumFaces); Index++)
4633 {
4634 FaceNodeSum += FaceNodeCounts[Index];
4635 if (FaceNodeCounts[Index] < 3)
4636 {
4637 #if defined MAKEARCHIVE
4638 PRINT1("Err: (TECPOLY112) Invalid face node count value at face %d. There must be at least 3 nodes in a face.\n", Index + 1);
4639 PRINT1(" Face node count value = %d.\n", FaceNodeCounts[Index]);
4640 #endif
4641 NumErrs[CurFile]++;
4642 return (-1);
4643 }
4644 else if (FaceNodeSum > TotalNumFaceNodes[CurFile][CurZone[CurFile]])
4645 {
4646 #if defined MAKEARCHIVE
4647 PRINT1("Err: (TECPOLY112) The running face node count exceeds the TotalNumFaceNodes (%d) specified.\n", TotalNumFaceNodes[CurFile][CurZone[CurFile]]);
4648 PRINT1(" Face node count value = %d.\n", FaceNodeCounts[Index]);
4649 #endif
4650 NumErrs[CurFile]++;
4651 return (-1);
4652 }
4653 else if (!WriteBinaryInt32(BlckFile[CurFile], FaceNodeSum))
4654 Result = -1;
4655 }
4656 }
4657 }
4658
4659 /* Write the facenodes array but convert 1-based to 0-based. */
4660 for (Index = 0; (Result == 0) && (Index < TotalNumFaceNodes[CurFile][CurZone[CurFile]]); Index++)
4661 {
4662 if (FaceNodes[Index] < 1 ||
4663 FaceNodes[Index] > IMax[CurFile])
4664 {
4665 #if defined MAKEARCHIVE
4666 PRINT1("Err: (TECPOLY112) Invalid face node value at node %d:\n", Index + 1);
4667 PRINT2(" face node value = %d, valid values are are 1 to %d (inclusive).\n", FaceNodes[Index], IMax[CurFile]);
4668 #endif
4669 NumErrs[CurFile]++;
4670 return (-1);
4671 }
4672 else if (!WriteBinaryInt32(BlckFile[CurFile], FaceNodes[Index] - 1))
4673 Result = -1;
4674 }
4675
4676 /* Write the left elements array but convert 1-based to 0-based. */
4677 for (Index = 0; (Result == 0) && (Index < NumFaces); Index++)
4678 {
4679 if (FaceLeftElems[Index] < MinNeighborValue ||
4680 FaceLeftElems[Index] > JMax[CurFile])
4681 {
4682 #if defined MAKEARCHIVE
4683 PRINT1("Err: (TECPOLY112) Invalid left neighbor value at face %d:\n", Index);
4684 PRINT2(" left neighbor value = %d, min value = %d,", FaceLeftElems[Index], MinNeighborValue);
4685 PRINT1(" max value = %d.\n", JMax[CurFile]);
4686 #endif
4687 NumErrs[CurFile]++;
4688 return (-1);
4689 }
4690 else if (!WriteBinaryInt32(BlckFile[CurFile], FaceLeftElems[Index] - 1))
4691 Result = -1;
4692 }
4693 /* Write the right elements array but convert 1-based to 0-based. */
4694 for (Index = 0; (Result == 0) && (Index < NumFaces); Index++)
4695 {
4696 if (FaceRightElems[Index] < MinNeighborValue ||
4697 FaceRightElems[Index] > JMax[CurFile])
4698 {
4699 #if defined MAKEARCHIVE
4700 PRINT1("Err: (TECPOLY112) Invalid right neighbor value at face %d:\n", Index);
4701 PRINT2(" right neighbor value = %d, min value = %d,", FaceRightElems[Index], MinNeighborValue);
4702 PRINT1(" max value = %d.\n", JMax[CurFile]);
4703 #endif
4704 NumErrs[CurFile]++;
4705 return (-1);
4706 }
4707 else if (!WriteBinaryInt32(BlckFile[CurFile], FaceRightElems[Index] - 1))
4708 Result = -1;
4709
4710 if (Result == 0 &&
4711 (FaceLeftElems[Index] == TECIO_NO_NEIGHBORING_ELEM &&
4712 FaceRightElems[Index] == TECIO_NO_NEIGHBORING_ELEM))
4713 {
4714 #if defined MAKEARCHIVE
4715 PRINT1("Err: (TECPOLY112) Both left and right neighbors are set to no neighboring element at face %d.\n", Index);
4716 #endif
4717 NumErrs[CurFile]++;
4718 return (-1);
4719 }
4720 }
4721
4722 /* Write the boundary arrays. */
4723 if (Result == 0 && TotalNumFaceBndryFaces[CurFile] > 0)
4724 {
4725 /* Write the boundaryconnectionoffsets array from the boundaryconnectioncounts array. */
4726
4727 /*
4728 * As a convenience for the ASCII format, TecUtil, and TECIO layers if any
4729 * boundary connections exists we automatically add a no-neighboring
4730 * connection as the first item so that they can user 0 for no-neighboring
4731 * element in the element list regardless if they have boundary connections
4732 * or not.
4733 *
4734 * The first 2 offsets are always 0 so that -1 in the left/right element
4735 * arrays always indicates "no neighboring element".
4736 */
4737 if (!(WriteBinaryInt32(BlckFile[CurFile], 0) &&
4738 WriteBinaryInt32(BlckFile[CurFile], 0)))
4739 Result = -1;
4740
4741 Int32_t BndryConnCount = 0;
4742 for (Index = 0; (Result == 0) && (Index < TotalNumFaceBndryFaces[CurFile]); Index++)
4743 {
4744 BndryConnCount += FaceBndryConnectionCounts[Index];
4745 if (FaceBndryConnectionCounts[Index] < 0 ||
4746 BndryConnCount > TotalNumFaceBndryConns[CurFile])
4747 {
4748 #if defined MAKEARCHIVE
4749 PRINT1("Err: (TECPOLY112) Invalid boundary connection count at boundary face %d:\n", Index + 1);
4750 PRINT1(" boundary connection count = %d.\n", FaceBndryConnectionCounts[Index]);
4751 #endif
4752 NumErrs[CurFile]++;
4753 return (-1);
4754 }
4755 else if (!WriteBinaryInt32(BlckFile[CurFile], BndryConnCount))
4756 Result = -1;
4757 }
4758 if (BndryConnCount != TotalNumFaceBndryConns[CurFile])
4759 {
4760 #if defined MAKEARCHIVE
4761 PRINT0("Err: (TECPOLY112) Invalid number of boundary connections:\n");
4762 PRINT2(" number of boundary connections written = %d, total number of boundary connections = %d.",
4763 BndryConnCount, TotalNumFaceBndryConns[CurFile]);
4764 #endif
4765 NumErrs[CurFile]++;
4766 return (-1);
4767 }
4768
4769 /* Write the boundary connection elements but convert 1-based to 0-based. */
4770 BndryConnCount = 0;
4771 for (Index = 0; (Result == 0) && (Index < TotalNumFaceBndryFaces[CurFile]); Index++)
4772 {
4773 for (LgIndex_t BIndex = 0; (Result == 0) && (BIndex < FaceBndryConnectionCounts[Index]); BIndex++)
4774 {
4775 if (BIndex > 0 &&
4776 FaceBndryConnectionElems[BndryConnCount] == TECIO_NO_NEIGHBORING_ELEM)
4777 {
4778 #if defined MAKEARCHIVE
4779 PRINT1("Err: (TECPOLY112) Partially obscured faces must specify no neighboring element first. See boundary connections for face %d.\n", Index + 1);
4780 #endif
4781 NumErrs[CurFile]++;
4782 return (-1);
4783 }
4784 if (FaceBndryConnectionElems[BndryConnCount] < TECIO_NO_NEIGHBORING_ELEM)
4785 {
4786 #if defined MAKEARCHIVE
4787 PRINT1("Err: (TECPOLY112) Invalid boundary element value at boundary connections for face %d:\n", Index + 1);
4788 #endif
4789 NumErrs[CurFile]++;
4790 return (-1);
4791 }
4792 if (FaceBndryConnectionElems[BndryConnCount] == TECIO_NO_NEIGHBORING_ELEM &&
4793 FaceBndryConnectionZones[BndryConnCount] != TECIO_NO_NEIGHBORING_ZONE)
4794 {
4795 #if defined MAKEARCHIVE
4796 PRINT1("Err: (TECPOLY112) Invalid boundary element/zone pair at boundary connections for face %d:\n", Index + 1);
4797 PRINT0(" Boundary elements specified as no neighboring element must also specify no neighboring zone.\n");
4798 #endif
4799 NumErrs[CurFile]++;
4800 return (-1);
4801 }
4802 else if (!WriteBinaryInt32(BlckFile[CurFile], FaceBndryConnectionElems[BndryConnCount] - 1))
4803 Result = -1;
4804 BndryConnCount++;
4805 }
4806 }
4807
4808 /* Write the boundary connection zones but convert 1-based to 0-based. */
4809 BndryConnCount = 0;
4810 for (Index = 0; (Result == 0) && (Index < TotalNumFaceBndryFaces[CurFile]); Index++)
4811 {
4812 for (LgIndex_t BIndex = 0; (Result == 0) && (BIndex < FaceBndryConnectionCounts[Index]); BIndex++)
4813 {
4814 if (FaceBndryConnectionZones[BndryConnCount] < TECIO_NO_NEIGHBORING_ZONE)
4815 {
4816 #if defined MAKEARCHIVE
4817 PRINT1("Err: (TECPOLY112) Invalid boundary zone value at boundary connections for face %d:\n", Index + 1);
4818 #endif
4819 NumErrs[CurFile]++;
4820 return (-1);
4821 }
4822 else if (!WriteBinaryInt32(BlckFile[CurFile], FaceBndryConnectionZones[BndryConnCount] - 1))
4823 Result = -1;
4824 BndryConnCount++;
4825 }
4826 }
4827 }
4828 if (Result != 0)
4829 {
4830 Result = -1;
4831 WriteErr("TECPOLY112");
4832 }
4833
4834 return Result;
4835 }
4836
4837 #if !defined INDEX_16_BIT // not supported in this test-only mode
TECPOLY111(INTEGER4 * FaceNodeCounts,INTEGER4 * FaceNodes,INTEGER4 * FaceLeftElems,INTEGER4 * FaceRightElems,INTEGER4 * FaceBndryConnectionCounts,INTEGER4 * FaceBndryConnectionElems,INTEGER2 * FaceBndryConnectionZones)4838 LIBFUNCTION INTEGER4 LIBCALL TECPOLY111(INTEGER4 *FaceNodeCounts,
4839 INTEGER4 *FaceNodes,
4840 INTEGER4 *FaceLeftElems,
4841 INTEGER4 *FaceRightElems,
4842 INTEGER4 *FaceBndryConnectionCounts,
4843 INTEGER4 *FaceBndryConnectionElems,
4844 INTEGER2 *FaceBndryConnectionZones)
4845 {
4846 INTEGER4 Result = 0;
4847 EntIndex_t *FBCZones = NULL;
4848
4849 if (TotalNumFaceBndryConns[CurFile] > 0)
4850 {
4851 ALLOC_ARRAY(TotalNumFaceBndryConns[CurFile], EntIndex_t, "32-bit FaceBndryConnectionZones");
4852
4853 if (FBCZones != NULL)
4854 {
4855 for (LgIndex_t ZoneI = 0; ZoneI < TotalNumFaceBndryFaces[CurFile]; ZoneI++)
4856 FBCZones[ZoneI] = (EntIndex_t)FaceBndryConnectionZones[ZoneI];
4857 }
4858 else
4859 {
4860 #if defined MAKEARCHIVE
4861 PRINT0("Err: (TECPOLY111) Out of memory allocating temporary data.\n");
4862 #endif
4863 NumErrs[CurFile]++;
4864 return (-1);
4865 }
4866 }
4867
4868 Result = TECPOLY112(FaceNodeCounts,
4869 FaceNodes,
4870 FaceLeftElems,
4871 FaceRightElems,
4872 FaceBndryConnectionCounts,
4873 FaceBndryConnectionElems,
4874 FBCZones);
4875
4876 if (FBCZones != NULL)
4877 FREE_ARRAY(FBCZones, "32-bit FaceBndryConnectionZones");
4878
4879 return Result;
4880 }
4881 #endif // INDEX_16_BIT -- not supported in this test-only mode
4882
4883 #if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */
tecpoly112_(INTEGER4 * FaceNodeCounts,INTEGER4 * FaceNodes,INTEGER4 * FaceLeftElems,INTEGER4 * FaceRightElems,INTEGER4 * FaceBndryConnectionOffsets,INTEGER4 * FaceBndryConnectionElems,INTEGER4 * FaceBndryConnectionZones)4884 LIBFUNCTION INTEGER4 LIBCALL tecpoly112_(INTEGER4 *FaceNodeCounts,
4885 INTEGER4 *FaceNodes,
4886 INTEGER4 *FaceLeftElems,
4887 INTEGER4 *FaceRightElems,
4888 INTEGER4 *FaceBndryConnectionOffsets,
4889 INTEGER4 *FaceBndryConnectionElems,
4890 INTEGER4 *FaceBndryConnectionZones)
4891 {
4892 return TECPOLY112(FaceNodeCounts,
4893 FaceNodes,
4894 FaceLeftElems,
4895 FaceRightElems,
4896 FaceBndryConnectionOffsets,
4897 FaceBndryConnectionElems,
4898 FaceBndryConnectionZones);
4899 }
4900
tecpoly111_(INTEGER4 * FaceNodeCounts,INTEGER4 * FaceNodes,INTEGER4 * FaceLeftElems,INTEGER4 * FaceRightElems,INTEGER4 * FaceBndryConnectionOffsets,INTEGER4 * FaceBndryConnectionElems,INTEGER2 * FaceBndryConnectionZones)4901 LIBFUNCTION INTEGER4 LIBCALL tecpoly111_(INTEGER4 *FaceNodeCounts,
4902 INTEGER4 *FaceNodes,
4903 INTEGER4 *FaceLeftElems,
4904 INTEGER4 *FaceRightElems,
4905 INTEGER4 *FaceBndryConnectionOffsets,
4906 INTEGER4 *FaceBndryConnectionElems,
4907 INTEGER2 *FaceBndryConnectionZones)
4908 {
4909 return TECPOLY111(FaceNodeCounts,
4910 FaceNodes,
4911 FaceLeftElems,
4912 FaceRightElems,
4913 FaceBndryConnectionOffsets,
4914 FaceBndryConnectionElems,
4915 FaceBndryConnectionZones);
4916 }
4917 #endif
4918
4919 #if defined TECPLOTKERNEL
4920 /* CORE SOURCE CODE REMOVED */
4921 #endif
4922