2 * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM
4 * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide.
6 * Tecplot hereby grants OpenCFD limited authority to distribute without
7 * alteration the source code to the Tecplot Input/Output library, known
8 * as TecIO, as part of its distribution of OpenFOAM and the
9 * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby
10 * granted access to the TecIO source code, and may redistribute it for the
11 * purpose of maintaining the converter. However, no authority is granted
12 * to alter the TecIO source code in any form or manner.
14 * This limited grant of distribution does not supersede Tecplot, Inc.'s
15 * copyright in TecIO. Contact Tecplot, Inc. for further information.
18 * 3535 Factoria Blvd, Ste. 550
19 * Bellevue, WA 98006, USA
20 * Phone: +1 425 653 1200
21 * http://www.tecplot.com/
26 #define TECPLOTENGINEMODULE
28 ******************************************************************
29 ******************************************************************
31 ****** (C) 1988-2008 Tecplot, Inc. *******
33 ******************************************************************
34 ******************************************************************
40 * version 1.00 : 12/10/91 (cm) changes made for manual
41 * version 1.01 : 12/30/91 Get and ReturnHugeBlock are now ptr to function
42 * version 6.00 : 04/21/92 updated to match version 6 of tecplot.
43 * version 6.30 : 10/15/92 updated to match binary file version 6.3
44 * version 6.30a: 05/04/93 (cm) minor changes to prototypes
45 * version : 11/01/93 (cm) put in D4GW stuff
46 * version 6.30b: 12/27/93 (cm) fixed missing NumKPts in DumpZone
47 * version 6.30c: 12/27/93 (cm) put back in D4GW stuff
53 C Added code to main tecplot source. Now can
54 C be built stand alone or added so TecUtil_ functions
57 C v75 coding. Also removed Array of ZoneSpec_s
58 C structs in favor of zonenames, i,j,and k dimensions
67 #include "Q_UNICODE.h"
74 #include "FILESTREAM.h"
75 #if defined TECPLOTKERNEL
76 /* CORE SOURCE CODE REMOVED */
83 #if defined MAKEARCHIVE
88 using namespace tecplot::strutil
;
90 #if defined MAKEARCHIVE
91 #define ANGLEEPSILON 1.0e-10
93 void InitInputSpecs(void)
95 LineThicknessInputSpec
.Type
= Input_Double
;
96 LineThicknessInputSpec
.Min
= 0.000001;
97 LineThicknessInputSpec
.Max
= 1.0;
98 LineThicknessInputSpec
.InterfaceAdjust
.ScaleFact
= 100.0;
99 LineThicknessInputSpec
.SuffixModifier
= NULL
;
101 PatternLengthInputSpec
.Type
= Input_Double
;
102 PatternLengthInputSpec
.Min
= 0.0001;
103 PatternLengthInputSpec
.Max
= 1.0;
104 PatternLengthInputSpec
.InterfaceAdjust
.ScaleFact
= 100.0;
105 PatternLengthInputSpec
.SuffixModifier
= NULL
;
107 TextBoxMarginInputSpec
.Type
= Input_Double
;
108 TextBoxMarginInputSpec
.Min
= 0.0;
109 TextBoxMarginInputSpec
.Max
= 20.0;
110 TextBoxMarginInputSpec
.InterfaceAdjust
.ScaleFact
= 100.0;
111 TextBoxMarginInputSpec
.SuffixModifier
= NULL
;
113 TextLineSpacingInputSpec
.Type
= Input_Double
;
114 TextLineSpacingInputSpec
.Min
= 0.0;
115 TextLineSpacingInputSpec
.Max
= 5.0;
116 TextLineSpacingInputSpec
.InterfaceAdjust
.ScaleFact
= 1.0;
117 TextLineSpacingInputSpec
.SuffixModifier
= NULL
;
120 ArrowheadSizeInputSpec
.Type
= Input_Double
;
121 ArrowheadSizeInputSpec
.Min
= 0.0;
122 ArrowheadSizeInputSpec
.Max
= 0.5;
123 ArrowheadSizeInputSpec
.InterfaceAdjust
.ScaleFact
= 100.0;
124 ArrowheadSizeInputSpec
.SuffixModifier
= NULL
;
126 TextAngleInputSpec
.Type
= Input_Double
;
127 TextAngleInputSpec
.Min
= -PI
- ANGLEEPSILON
;
128 TextAngleInputSpec
.Max
= PI
+ ANGLEEPSILON
;
129 TextAngleInputSpec
.InterfaceAdjust
.ScaleFact
= DEGPERRADIANS
;
130 TextAngleInputSpec
.SuffixModifier
= NULL
;
132 ArrowheadAngleInputSpec
.Type
= Input_Double
;
133 ArrowheadAngleInputSpec
.Min
= 1.0 / DEGPERRADIANS
- ANGLEEPSILON
;
134 ArrowheadAngleInputSpec
.Max
= PIOVER2
+ ANGLEEPSILON
;
135 ArrowheadAngleInputSpec
.InterfaceAdjust
.ScaleFact
= DEGPERRADIANS
;
136 ArrowheadAngleInputSpec
.SuffixModifier
= NULL
;
143 void LocalReadBlock(FileStream_s
*FileStream
,
145 FieldDataType_e FieldDataTypeInFile
,
149 REQUIRE(VALID_REF(IsOk
) && VALID_BOOLEAN(*IsOk
));
150 REQUIRE(!(*IsOk
) || VALID_REF(FileStream
));
151 REQUIRE(!(*IsOk
) || VALID_FIELD_DATA_TYPE(FieldDataTypeInFile
));
155 Boolean_t DoRead
= (CurVPtr
!= NULL
);
156 Boolean_t ReadByBlock
= (FieldDataType_Double
== FieldDataTypeInFile
) || !DoRead
;
159 ReadPureBlock(FileStream
,
170 for (N
= 0; *IsOk
&& (N
< NumValues
); N
++)
172 double D
= GetNextValue(FileStream
, FieldDataTypeInFile
, -LARGEDOUBLE
, LARGEDOUBLE
, IsOk
);
185 * NOTE: ReadTec only allocates space for NodeMap and VDataBase
186 * if RawDataSpaceAllocated == FALSE and GetHeaderInfoOnly
189 * Also note that all data read in by ReadTec is currently
190 * limited to be in double precision.
195 Boolean_t STDCALL
ReadTec(Boolean_t GetHeaderInfoOnly
,
199 EntIndex_t
*NumZones
,
201 StringList_pa
*VarNames
,
202 StringList_pa
*ZoneNames
,
206 ZoneType_e
**ZoneType
,
207 StringList_pa
*UserRec
,
208 Boolean_t RawDataSpaceAllocated
,
209 NodeMap_t
***NodeMap
,
212 Boolean_t InputIsOk
= FALSE
;
213 ArrayList_pa ZoneSpecList
= NULL
;
214 LgIndex_t
*FNNumBndryConns
= NULL
; /* [NumZones] */
215 FileStream_s
*ReadTecFileStream
= NULL
;
216 Set_pa
*IsVarCellCentered
= NULL
; /* [NumZones] */
218 REQUIRE(VALID_BOOLEAN(GetHeaderInfoOnly
));
219 REQUIRE(VALID_NON_ZERO_LEN_STR(FName
));
220 REQUIRE(VALID_REF(IVersion
));
221 REQUIRE(VALID_REF(DataSetTitle
) || DataSetTitle
== NULL
);
222 REQUIRE(VALID_REF(NumZones
));
223 REQUIRE(VALID_REF(NumVars
));
224 REQUIRE(VarNames
== NULL
|| VALID_REF(VarNames
));
225 REQUIRE(ZoneNames
== NULL
|| VALID_REF(ZoneNames
));
226 REQUIRE(NumPtsI
== NULL
|| VALID_REF(NumPtsI
));
227 REQUIRE(NumPtsJ
== NULL
|| VALID_REF(NumPtsJ
));
228 REQUIRE(NumPtsK
== NULL
|| VALID_REF(NumPtsK
));
229 REQUIRE(ZoneType
== NULL
|| VALID_REF(ZoneType
));
230 REQUIRE(UserRec
== NULL
|| VALID_REF(UserRec
));
231 REQUIRE(VALID_BOOLEAN(RawDataSpaceAllocated
));
232 REQUIRE(IMPLICATION(!GetHeaderInfoOnly
&& RawDataSpaceAllocated
,
233 VALID_REF(NodeMap
) && VALID_REF(VDataBase
)));
235 #if defined MAKEARCHIVE
239 InputIsOk
= OpenBinaryFileAndCheckMagicNumber(&ReadTecFileStream
,
245 InputIsOk
= ReadDataFileHeader(ReadTecFileStream
,
254 (StringList_pa
**)NULL
,
262 (ArrayList_pa
*)NULL
,
265 (DataFileType_e
*)NULL
);
273 else if (*IVersion
> 112)
276 * This may not be true but we put it hear to remind us to make
277 * updates to this code when we change the version number.
279 ErrMsg(translate("ReadTec does not yet support version %d "
280 "Tecplot binary data files."), *IVersion
);
283 else if (!GetHeaderInfoOnly
)
286 for (Z
= 0; Z
< *NumZones
&& InputIsOk
; Z
++)
288 InputIsOk
= (MemberCount(IsVarCellCentered
[Z
]) == 0);
290 ErrMsg(translate("Cell centered data not supported by ReadTec."));
295 if (IsVarCellCentered
!= NULL
)
298 for (Z
= 0; Z
< *NumZones
; Z
++)
299 DeallocSet(&IsVarCellCentered
[Z
]);
300 FREE_ARRAY(IsVarCellCentered
, "Array of IsVarCellCentered sets");
307 * Allocate space for the zone info pieces.
310 *ZoneNames
= StringListAlloc();
312 *NumPtsI
= ALLOC_ARRAY(*NumZones
, LgIndex_t
, "numptsi");
314 *NumPtsJ
= ALLOC_ARRAY(*NumZones
, LgIndex_t
, "numptsj");
316 *NumPtsK
= ALLOC_ARRAY(*NumZones
, LgIndex_t
, "numptsk");
318 *ZoneType
= ALLOC_ARRAY(*NumZones
, ZoneType_e
, "zonetype");
319 for (Z
= 0; Z
< *NumZones
; Z
++)
321 ZoneSpec_s
*ZoneSpec
= GetZoneSpec(ZoneSpecList
, Z
);
322 if (ZoneSpec
!= NULL
)
324 if (ZoneNames
&& *ZoneNames
)
325 StringListAppendString(*ZoneNames
, ZoneSpec
->Name
);
327 if (NumPtsI
&& *NumPtsI
)
328 (*NumPtsI
)[Z
] = ZoneSpec
->NumPtsI
;
330 if (NumPtsJ
&& *NumPtsJ
)
331 (*NumPtsJ
)[Z
] = ZoneSpec
->NumPtsJ
;
333 if (NumPtsK
&& *NumPtsK
)
334 (*NumPtsK
)[Z
] = ZoneSpec
->NumPtsK
;
336 if (ZoneType
&& *ZoneType
)
337 (*ZoneType
)[Z
] = ZoneSpec
->Type
;
341 if (ZoneNames
&& *ZoneNames
)
342 StringListAppendString(*ZoneNames
, NULL
);
344 if (NumPtsI
&& *NumPtsI
)
347 if (NumPtsJ
&& *NumPtsJ
)
350 if (NumPtsK
&& *NumPtsK
)
353 if (ZoneType
&& *ZoneType
)
354 (*ZoneType
)[Z
] = ZoneType_Invalid
;
358 if (!GetHeaderInfoOnly
&& InputIsOk
&& (*NumZones
> 0))
360 EntIndex_t
*VarSharesFromZone
= NULL
; /* [NumVars] */
361 Boolean_t
*IsVarPassive
= NULL
; /* [NumVars] */
362 EntIndex_t
*ConnectivitySharesFromZone
= NULL
; /* [NumZones] */
363 FieldDataType_e
*VarType
= NULL
;
366 LgIndex_t NumIPts
= 0;
367 LgIndex_t NumJPts
= 0;
368 LgIndex_t NumKPts
= 0;
369 LgIndex_t TotalNumPts
;
372 if ((*NumZones
> 0) && !RawDataSpaceAllocated
)
374 *VDataBase
= ALLOC_ARRAY(*NumZones
* (*NumVars
), double *, "vdatabase array");
375 if (*VDataBase
== NULL
)
377 ErrMsg(translate("Cannot allocate space for field data"));
383 for (I
= 0; I
< *NumZones
*(*NumVars
); I
++)
384 (*VDataBase
)[I
] = NULL
;
389 *NodeMap
= ALLOC_ARRAY(*NumZones
, NodeMap_t
*, "nodemap array");
390 if (*NodeMap
== NULL
)
392 ErrMsg(translate("Cannot allocate space for nodemap"));
398 for (I
= 0; I
< *NumZones
; I
++)
399 (*NodeMap
)[I
] = NULL
;
406 VarType
= ALLOC_ARRAY(*NumVars
+ 1, FieldDataType_e
, "Var Type");
407 VarSharesFromZone
= ALLOC_ARRAY(*NumVars
+ 1, EntIndex_t
, "VarSharesFromZone");
408 IsVarPassive
= ALLOC_ARRAY(*NumVars
+ 1, Boolean_t
, "IsVarPassive");
410 ConnectivitySharesFromZone
= ALLOC_ARRAY(*NumZones
, EntIndex_t
, "ConnectivitySharesFromZone");
411 InputIsOk
= (VarType
!= NULL
&&
412 VarSharesFromZone
!= NULL
&&
413 IsVarPassive
!= NULL
&&
414 ConnectivitySharesFromZone
!= NULL
);
418 for (CurZone
= 0; CurZone
< *NumZones
&& InputIsOk
; CurZone
++)
420 double X1
= GetNextValue(ReadTecFileStream
, FieldDataType_Float
, 0.0, 1000.0, &InputIsOk
);
421 if (InputIsOk
&& (X1
== ZoneMarker
))
423 ZoneSpec_s
*CurZoneSpec
= GetZoneSpec(ZoneSpecList
, CurZone
);
424 Boolean_t ZoneIsFinite
= (CurZoneSpec
->Type
!= ZoneType_Ordered
);
425 Boolean_t ZoneIsFEPoly
= (CurZoneSpec
->Type
== ZoneType_FEPolygon
||
426 CurZoneSpec
->Type
== ZoneType_FEPolyhedron
);
427 Boolean_t InBlockFormat
= CurZoneSpec
->ZoneLoadInfo
.IsInBlockFormat
;
428 for (J
= 0; J
< *NumVars
; J
++)
430 VarSharesFromZone
[J
] = -1; /* eumulate DupVar: no DupVar */
431 VarType
[J
] = FieldDataType_Float
;
432 IsVarPassive
[J
] = FALSE
;
436 if (*IVersion
> 45 && *IVersion
< 101 && InputIsOk
)
438 EntIndex_t NumDupVars
, ZZ
;
440 NumDupVars
= (EntIndex_t
)GetIoFileInt(ReadTecFileStream
, *IVersion
, 0, (LgIndex_t
) * NumVars
, &InputIsOk
);
441 for (J
= 0; J
< NumDupVars
; J
++)
443 ZZ
= (EntIndex_t
)GetIoFileInt(ReadTecFileStream
, *IVersion
, 0, *NumVars
, &InputIsOk
) - 1;
444 VarSharesFromZone
[ZZ
] = CurZone
- 1; /* emulate DupVar: share from previous zone */
446 /* Can't duplicate from the first zone */
447 if ((NumDupVars
> 0) && (CurZone
== 0))
449 ErrMsg(translate("Cannot duplicate variables from the first zone since there are "
450 "no previous zones to duplicate from."));
455 /* get the data type for each variable */
456 if (*IVersion
>= 70 && InputIsOk
)
458 for (J
= 0; J
< *NumVars
; J
++)
460 VarType
[J
] = (FieldDataType_e
)GetIoFileInt(ReadTecFileStream
, *IVersion
,
462 (LgIndex_t
)FieldDataType_Bit
,
466 ErrMsg(translate("Invalid data type - binary input file corrupted"));
474 NumIPts
= CurZoneSpec
->NumPtsI
;
475 NumJPts
= CurZoneSpec
->NumPtsJ
;
476 NumKPts
= CurZoneSpec
->NumPtsK
;
480 TotalNumPts
= NumIPts
;
482 TotalNumPts
= (NumIPts
* NumJPts
* NumKPts
);
484 for (CurVar
= 0; CurVar
< *NumVars
&& InputIsOk
; CurVar
++)
486 if (!RawDataSpaceAllocated
&& TotalNumPts
>= 1)
489 * The calling program did not allocate space for the
490 * data so do it here.
492 (*VDataBase
)[CurVar
+CurZone
*(*NumVars
)] =
493 ALLOC_ARRAY(TotalNumPts
, double, "raw data");
497 if (*IVersion
>= 105 && InputIsOk
)
499 /* passive variables */
500 if ((Boolean_t
)GetIoFileInt(ReadTecFileStream
, *IVersion
, 0, 1, &InputIsOk
) && InputIsOk
)
502 for (CurVar
= 0; CurVar
< *NumVars
&& InputIsOk
; CurVar
++)
504 IsVarPassive
[CurVar
] = (Boolean_t
)GetIoFileInt(ReadTecFileStream
,
511 if (*IVersion
>= 101 && InputIsOk
)
513 /* variable sharing: equivalent to DupVar for ReadTec */
514 if ((Boolean_t
)GetIoFileInt(ReadTecFileStream
, *IVersion
, 0, 1, &InputIsOk
) && InputIsOk
)
516 for (CurVar
= 0; CurVar
< *NumVars
&& InputIsOk
; CurVar
++)
518 EntIndex_t SharedZone
= GetIoFileInt(ReadTecFileStream
, *IVersion
,
519 -1, MaxNumZonesOrVars
- 1,
521 if (SharedZone
!= -1 && InputIsOk
)
522 VarSharesFromZone
[CurVar
] = SharedZone
;
526 /* face neighbor or FE node connectivity sharing */
529 EntIndex_t SharedZone
= GetIoFileInt(ReadTecFileStream
, *IVersion
,
530 -1, MaxNumZonesOrVars
- 1,
533 ConnectivitySharesFromZone
[CurZone
] = SharedZone
;
538 * Non-shared variable min/max (but not for Zombie zones).
540 if (*IVersion
>= 103 && InputIsOk
)
542 for (CurVar
= 0; CurVar
< *NumVars
&& InputIsOk
; CurVar
++)
544 if (VarSharesFromZone
[CurVar
] == -1 && !IsVarPassive
[CurVar
])
547 * Currently ReadTec doesn't do anything with the
550 GetNextValue(ReadTecFileStream
, FieldDataType_Double
,
551 -LARGEDOUBLE
, LARGEDOUBLE
,
553 GetNextValue(ReadTecFileStream
, FieldDataType_Double
,
554 -LARGEDOUBLE
, LARGEDOUBLE
,
563 while (InputIsOk
&& ((CurVar
+ 1) < *NumVars
))
566 if ((CurVar
< *NumVars
) && (TotalNumPts
> 0))
568 double *CurVPtr
= (*VDataBase
)[CurVar
+CurZone
*(*NumVars
)];
570 if (VarSharesFromZone
[CurVar
] != -1)
573 EntIndex_t SourceZone
= VarSharesFromZone
[CurVar
];
574 double *SourceVPtr
= (*VDataBase
)[CurVar
+SourceZone
*(*NumVars
)];
575 for (M
= 0; M
< TotalNumPts
; M
++)
576 CurVPtr
[M
] = SourceVPtr
[M
];
578 else if (!IsVarPassive
[CurVar
])
580 LocalReadBlock(ReadTecFileStream
,
589 ErrMsg(translate("Invalid raw data section of binary file"));
591 else if (TotalNumPts
> 0)
594 * Zone is not empty and is in POINT format
601 while (InputIsOk
&& (N
< TotalNumPts
))
604 for (CurVar
= 0; InputIsOk
&& (CurVar
< *NumVars
); CurVar
++)
606 double *CurVPtr
= (*VDataBase
)[CurVar
+CurZone
*(*NumVars
)];
607 if (VarSharesFromZone
[CurVar
] != -1)
609 EntIndex_t SourceZone
= VarSharesFromZone
[CurVar
];
610 double *SourceVPtr
= (*VDataBase
)[CurVar
+SourceZone
*(*NumVars
)];
611 CurVPtr
[N
] = SourceVPtr
[N
];
613 else if (!IsVarPassive
[CurVar
])
615 double D
= GetNextValue(ReadTecFileStream
,
621 if (InputIsOk
&& CurVPtr
)
627 ErrMsg(translate("Binary datafile corrupted!"));
633 if (InputIsOk
&& *IVersion
< 101)
638 * Pre-version 101 had FE connectivity sharing,
639 * FECONNECT, information here.
641 Boolean_t DupConnectivity
;
643 DupConnectivity
= GetIoFileInt(ReadTecFileStream
, *IVersion
, 0, 1, &InputIsOk
);
645 DupConnectivity
= FALSE
;
648 ConnectivitySharesFromZone
[CurZone
] = CurZone
- 1; /* previous zone */
650 ConnectivitySharesFromZone
[CurZone
] = -1;
653 ConnectivitySharesFromZone
[CurZone
] = -1;
656 if (InputIsOk
&& ZoneIsFinite
&& !ZoneIsFEPoly
)
658 Boolean_t SkipNodemap
;
659 NodeMap_t
*NM
= NULL
;
660 NodeMap_t
*ONM
= NULL
;
662 * Allocate the nodemap ptr if necessary Note that if
663 * RawDataSpaceAllocated is TRUE then (*NodeMap)[CurZone]
664 * can either contain a valid address (read the connectivity
665 * list) or be NULL (skip the list).
667 if (!RawDataSpaceAllocated
&& NumKPts
*NumJPts
>= 1)
669 (*NodeMap
)[CurZone
] = ALLOC_ARRAY(NumKPts
* NumJPts
, NodeMap_t
, "node map");
670 if ((*NodeMap
)[CurZone
] == NULL
)
671 ErrMsg(translate("Cannot allocate space for connectivity list",
672 "See the Tecplot User's Manual for a definition of 'connectivity list'"));
676 NM
= (*NodeMap
)[CurZone
];
678 SkipNodemap
= (NM
== NULL
);
680 if (InputIsOk
&& ConnectivitySharesFromZone
[CurZone
] != -1)
682 EntIndex_t SourceZone
= ConnectivitySharesFromZone
[CurZone
];
683 if (SourceZone
>= CurZone
)
685 ErrMsg(translate("Zone %d is attempting to share connectivity "
686 "with a zone that has not yet been loaded."),
692 ONM
= (*NodeMap
)[SourceZone
];
695 ErrMsg(translate("Zone %d is attempting to share connectivity "
696 "with a zone that is not finite element."),
705 /* load the FE node connectivity */
706 for (J
= 0; J
< NumJPts
; J
++)
707 for (I
= 0; I
< NumKPts
; I
++)
710 LgIndex_t L
= J
* NumKPts
+ I
;
711 if (ConnectivitySharesFromZone
[CurZone
] != -1)
714 M
= GetNextI(ReadTecFileStream
, &InputIsOk
) - 1;
721 /* skip over the face neighbor connectivity */
722 if (*IVersion
>= 101 && InputIsOk
)
724 EntIndex_t SharedZone
= ConnectivitySharesFromZone
[CurZone
];
725 if (SharedZone
== -1 && FNNumBndryConns
[CurZone
] != 0)
727 LgIndex_t Connection
= 0;
728 while (Connection
< FNNumBndryConns
[CurZone
] && InputIsOk
)
731 * Face neighbor connection have the following format for both
734 * FaceNeighborMode_LocalOneToOne 3 cz,fz,cz
735 * FaceNeighborMode_LocalOneToMany nz+4 cz,fz,oz,nz,cz1,cz2,...,czn
736 * FaceNeighborMode_GlobalOneToOne 4 cz,fz,ZZ,CZ
737 * FaceNeighborMode_GlobalOneToMany 2*nz+4 cz,fz,oz,nz,ZZ1,CZ1,ZZ2,CZ2,...,ZZn,CZn
740 * cz = cell in current zone
741 * fz = face of cell in current zone
742 * oz = face obsuration flag (only applies to one-to-many):
743 * 0 = face partially obscured
744 * 1 = face entirely obscured
745 * nz = number of cell or zone/cell associations (only applies to one-to-many)
747 * CZ = cell in remote zone
749 (void)GetNextI(ReadTecFileStream
, &InputIsOk
); /* read cz */
751 ErrMsg(translate("Unexpected end-of-file while reading face neighbor data."));
753 (void)GetNextI(ReadTecFileStream
, &InputIsOk
); /* read fz */
758 * read FaceNeighborMode_LocalOneToOne: cz ||
759 * FaceNeighborMode_LocalOneToMany: oz ||
760 * FaceNeighborMode_GlobalOneToOne: ZZ ||
761 * FaceNeighborMode_GlobalOneToMany: oz
763 if (CurZoneSpec
->FNMode
== FaceNeighborMode_LocalOneToOne
)
764 (void)GetNextI(ReadTecFileStream
, &InputIsOk
);
765 else if (CurZoneSpec
->FNMode
== FaceNeighborMode_LocalOneToMany
)
766 (void)GetNextI(ReadTecFileStream
, &InputIsOk
);
767 else if (CurZoneSpec
->FNMode
== FaceNeighborMode_GlobalOneToOne
)
768 (void)GetNextI(ReadTecFileStream
, &InputIsOk
);
769 else if (CurZoneSpec
->FNMode
== FaceNeighborMode_GlobalOneToMany
)
770 (void)GetNextI(ReadTecFileStream
, &InputIsOk
);
774 if (CurZoneSpec
->FNMode
!= FaceNeighborMode_LocalOneToOne
&& InputIsOk
)
776 LgIndex_t NumAssociations
= 0;
778 * read FaceNeighborMode_LocalOneToMany: nz ||
779 * FaceNeighborMode_GlobalOneToOne: CZ ||
780 * FaceNeighborMode_GlobalOneToMany: nz
782 if (CurZoneSpec
->FNMode
== FaceNeighborMode_LocalOneToMany
)
783 NumAssociations
= GetNextI(ReadTecFileStream
, &InputIsOk
);
784 else if (CurZoneSpec
->FNMode
== FaceNeighborMode_GlobalOneToOne
)
785 (void)GetNextI(ReadTecFileStream
, &InputIsOk
);
786 else if (CurZoneSpec
->FNMode
== FaceNeighborMode_GlobalOneToMany
)
787 NumAssociations
= GetNextI(ReadTecFileStream
, &InputIsOk
);
791 if (CurZoneSpec
->FNMode
!= FaceNeighborMode_GlobalOneToOne
&& InputIsOk
)
794 if (CurZoneSpec
->FNMode
== FaceNeighborMode_LocalOneToMany
)
795 for (Assoc
= 0; Assoc
< NumAssociations
&& InputIsOk
; Assoc
++)
796 (void)GetNextI(ReadTecFileStream
, &InputIsOk
); /* read czn */
797 else if (CurZoneSpec
->FNMode
== FaceNeighborMode_GlobalOneToMany
)
798 for (Assoc
= 0; Assoc
< NumAssociations
&& InputIsOk
; Assoc
++)
800 (void)GetNextI(ReadTecFileStream
, &InputIsOk
); /* read ZZn */
801 (void)GetNextI(ReadTecFileStream
, &InputIsOk
); /* read CZn */
807 Connection
+= NumAssociations
;
809 else if (InputIsOk
) /* CurZoneSpec->FNMode == FaceNeighborMode_GlobalOneToOne */
812 else if (InputIsOk
) /* CurZoneSpec->FNMode == FaceNeighborMode_LocalOneToOne */
816 ErrMsg(translate("Corrupt input file: invalid face neighbors."));
820 }/* face neighbor connectivity */
821 /* skip over face map section */
824 ConnectivitySharesFromZone
[CurZone
] != -1 &&
829 ErrMsg(translate("Poly zones must be in block format"));
834 HgIndex_t NumFaces
= CurZoneSpec
->NumPtsK
;
835 if (*IVersion
== 110) // ...version 111 moved these to the zone header
837 CurZoneSpec
->NumFaceNodes
= GetNextI(ReadTecFileStream
, &InputIsOk
);
838 CurZoneSpec
->NumFaceBndryFaces
= GetNextI(ReadTecFileStream
, &InputIsOk
);
839 CurZoneSpec
->NumFaceBndryItems
= GetNextI(ReadTecFileStream
, &InputIsOk
);
841 HgIndex_t TotalNumFaceNodes
= CurZoneSpec
->NumFaceNodes
;
842 HgIndex_t TotalNumBndryFaces
= CurZoneSpec
->NumFaceBndryFaces
;
843 HgIndex_t TotalNumBndryItems
= CurZoneSpec
->NumFaceBndryItems
;
844 if (CurZoneSpec
->Type
== ZoneType_FEPolyhedron
)
845 ReadInt32Block(ReadTecFileStream
, FALSE
, NULL
, 0, NumFaces
+ 1, &InputIsOk
);
847 ReadInt32Block(ReadTecFileStream
, FALSE
, NULL
, 0, TotalNumFaceNodes
, &InputIsOk
);
849 ReadInt32Block(ReadTecFileStream
, FALSE
, NULL
, 0, NumFaces
, &InputIsOk
);
851 ReadInt32Block(ReadTecFileStream
, FALSE
, NULL
, 0, NumFaces
, &InputIsOk
);
852 if (TotalNumBndryFaces
> 0)
855 ReadInt32Block(ReadTecFileStream
, FALSE
, NULL
, 0, TotalNumBndryFaces
+ 1, &InputIsOk
);
857 ReadInt32Block(ReadTecFileStream
, FALSE
, NULL
, 0, TotalNumBndryItems
, &InputIsOk
);
860 if (*IVersion
>= 112)
861 ReadInt32Block(ReadTecFileStream
, FALSE
, NULL
, 0, TotalNumBndryItems
, &InputIsOk
);
863 ReadInt16Block(ReadTecFileStream
, FALSE
, NULL
, 0, TotalNumBndryItems
, &InputIsOk
);
867 }/* face map section */
871 ErrMsg(translate("Corrupt input file"));
876 if (VarSharesFromZone
)
877 FREE_ARRAY(VarSharesFromZone
, "VarSharesFromZone");
879 FREE_ARRAY(IsVarPassive
, "IsVarPassive");
880 if (ConnectivitySharesFromZone
)
881 FREE_ARRAY(ConnectivitySharesFromZone
, "ConnectivitySharesFromZone");
883 FREE_ARRAY(VarType
, "VarType");
885 if (!InputIsOk
&& !RawDataSpaceAllocated
)
890 for (I
= 0; I
< *NumZones
*(*NumVars
); I
++)
893 FREE_ARRAY((*VDataBase
)[I
], "vdatabase array");
895 FREE_ARRAY(*VDataBase
, "vdatabase pointer array");
901 for (I
= 0; I
< *NumZones
; I
++)
904 FREE_ARRAY((*NodeMap
)[I
], "connectivity list");
906 FREE_ARRAY(*NodeMap
, "connectivity pointer array");
909 } /*Reading Raw Data*/
911 if (FNNumBndryConns
!= NULL
)
912 FREE_ARRAY(FNNumBndryConns
, "FNNumBndryConns");
914 ArrayListDealloc(&ZoneSpecList
, ZoneSpecItemDestructor
, 0);
916 if (ReadTecFileStream
)
918 #if defined TECPLOTKERNEL
919 /* CORE SOURCE CODE REMOVED */
921 TP_FCLOSE(ReadTecFileStream
->File
);
922 free(ReadTecFileStream
);
929 void * STDCALL
TecAlloc(size_t size
)
931 return (void *)ALLOC_ARRAY(size
, char, "TecAlloc");
934 void STDCALL
TecFree(void *ptr
)
936 /* Hack to remove delete warning... */
937 char *Tmp
= (char *)ptr
;
938 FREE_ARRAY(Tmp
, "TecAlloc");