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
29 ******************************************************************
30 ******************************************************************
32 ****** (C) 1988-2008 Tecplot, Inc. *******
34 ******************************************************************
35 ******************************************************************
41 #include "Q_UNICODE.h"
49 #include "FILESTREAM.h"
51 #if defined TECPLOTKERNEL
52 /* CORE SOURCE CODE REMOVED */
59 #if defined TECPLOTKERNEL
60 /* CORE SOURCE CODE REMOVED */
63 #if defined TECPLOTKERNEL
64 /* CORE SOURCE CODE REMOVED */
65 #if !defined ENGINE /* TODO(RMS)-H 12/12/2005: ENGINE: refactor to use just the Interrupted flag as-is */
70 #if defined TECPLOTKERNEL
71 /* CORE SOURCE CODE REMOVED */
72 #if !defined USE_MACROS_FOR_FUNCTIONS
74 #if !defined USE_MACROS_FOR_FUNCTIONS
76 #endif /* TECPLOTKERNEL */
79 * Cleanout the contents of the zone spec item but leaves the zone spec item.
80 * This effectively leaves the zone spec structure in the same state as calling
81 * ZoneSpecAlloc initially.
84 * Zone spec item to cleanup.
86 void CleanoutZoneSpec(ZoneSpec_s
*ZoneSpec
)
88 REQUIRE(VALID_REF(ZoneSpec
));
90 if (ZoneSpec
->Name
!= NULL
)
91 FREE_ARRAY(ZoneSpec
->Name
, "ZoneSpec name");
92 if (ZoneSpec
->AuxData
!= NULL
)
93 AuxDataDealloc(&ZoneSpec
->AuxData
);
94 SetZoneSpecDefaults(ZoneSpec
);
100 void ZoneSpecDealloc(ZoneSpec_s
**ZoneSpec
)
102 REQUIRE(VALID_REF(ZoneSpec
));
103 REQUIRE(VALID_REF(*ZoneSpec
) || *ZoneSpec
== NULL
);
105 if (*ZoneSpec
!= NULL
)
107 CleanoutZoneSpec(*ZoneSpec
);
109 FREE_ITEM(*ZoneSpec
, "ZoneSpec structure");
113 ENSURE(*ZoneSpec
== NULL
);
118 Boolean_t
ZoneSpecItemDestructor(void *ItemRef
,
119 ArbParam_t ClientData
)
121 ZoneSpec_s
**ZoneSpecRef
= (ZoneSpec_s
**)ItemRef
;
123 REQUIRE(VALID_REF(ZoneSpecRef
));
124 REQUIRE(VALID_REF(*ZoneSpecRef
) || *ZoneSpecRef
== NULL
);
126 if (*ZoneSpecRef
!= NULL
)
127 ZoneSpecDealloc(ZoneSpecRef
);
129 ENSURE(*ZoneSpecRef
== NULL
);
135 void SetZoneSpecDefaults(ZoneSpec_s
*ZoneSpec
)
137 REQUIRE(VALID_REF(ZoneSpec
));
138 ZoneSpec
->Name
= NULL
;
139 ZoneSpec
->UniqueID
= INVALID_UNIQUE_ID
;
140 ZoneSpec
->ParentZone
= BAD_SET_VALUE
;
141 ZoneSpec
->StrandID
= STRAND_ID_STATIC
;
142 ZoneSpec
->SolutionTime
= 0.0;
143 ZoneSpec
->NumPtsI
= 0;
144 ZoneSpec
->NumPtsJ
= 0;
145 ZoneSpec
->NumPtsK
= 0;
146 ZoneSpec
->ICellDim
= 0; // ...currently not used
147 ZoneSpec
->JCellDim
= 0; // ...currently not used
148 ZoneSpec
->KCellDim
= 0; // ...currently not used
149 ZoneSpec
->Type
= ZoneType_Ordered
;
150 ZoneSpec
->ZoneLoadInfo
.PresetZoneColor
= NoColor_C
;
151 ZoneSpec
->ZoneLoadInfo
.IsInBlockFormat
= TRUE
;
152 ZoneSpec
->AuxData
= NULL
;
153 ZoneSpec
->BuildZoneOptInfo
= TRUE
;
155 /* classic data only */
156 ZoneSpec
->FNMode
= FaceNeighborMode_LocalOneToOne
;
157 ZoneSpec
->FNAreCellFaceNbrsSupplied
= FALSE
;
159 /* polytope data only */
160 ZoneSpec
->NumFaceNodes
= 0;
161 ZoneSpec
->NumFaceBndryFaces
= 0;
162 ZoneSpec
->NumFaceBndryItems
= 0;
166 #if defined TECPLOTKERNEL
167 /* CORE SOURCE CODE REMOVED */
168 #endif /* TECPLOTKERNEL */
172 void ZoneSpecExcludeBndryConnsFromMetrics(ZoneSpec_s
* ZoneSpec
)
174 REQUIRE(VALID_REF(ZoneSpec
));
176 /* classic data face connectivity fixup (leave FNMode as-is) */
177 ZoneSpec
->FNAreCellFaceNbrsSupplied
= FALSE
; // ...if we invalidate boundary connections CellFaceNbrs must now be auto-generated
179 /* polytope data face connectivity fixup */
180 ZoneSpec
->NumFaceBndryFaces
= 0;
181 ZoneSpec
->NumFaceBndryItems
= 0;
186 ZoneSpec_s
*ZoneSpecAlloc(void)
190 Result
= (ZoneSpec_s
*)ALLOC_ITEM(ZoneSpec_s
, "ZoneSpec structure");
192 SetZoneSpecDefaults(Result
);
194 ENSURE(Result
== NULL
|| VALID_REF(Result
));
198 #if defined TECPLOTKERNEL
199 /* CORE SOURCE CODE REMOVED */
202 #if defined TECPLOTKERNEL
203 /* CORE SOURCE CODE REMOVED */
206 #if defined TECPLOTKERNEL
207 /* CORE SOURCE CODE REMOVED */
212 #if defined TECPLOTKERNEL
213 /* CORE SOURCE CODE REMOVED */
217 * Adjusts the capacity request as necessary to minimize memory reallocations
218 * for large lists. The adjusted capacity will be at least as big as requested
219 * however it may be larger if it is determined that the space requirement is
222 * param ZoneOrVarArrayList
223 * Array list requesting the change in capacity.
224 * param CurrentCapacity
225 * Current capacity of the array list.
226 * param RequestedCapacity
227 * Capacity request or zero for default size.
229 * Any client data needed for the adjustment.
232 * Adjusted capacity that is at least as large as the request or zero if
233 * unable to satisfy the requested capacity.
235 LgIndex_t
ZoneOrVarListAdjustCapacityRequest(ArrayList_pa ZoneOrVarArrayList
,
236 LgIndex_t CurrentCapacity
,
237 LgIndex_t RequestedCapacity
,
238 ArbParam_t ClientData
)
242 REQUIRE(ArrayListIsValid(ZoneOrVarArrayList
));
243 REQUIRE((RequestedCapacity
== 0 && CurrentCapacity
== 0) ||
244 RequestedCapacity
> CurrentCapacity
);
245 REQUIRE(CurrentCapacity
<= MaxNumZonesOrVars
);
247 if (RequestedCapacity
<= MaxNumZonesOrVars
)
249 if (RequestedCapacity
!= 0 && CurrentCapacity
== 0)
251 /* first allocation; assume the request is the desired capacityy */
252 Result
= RequestedCapacity
;
256 const LgIndex_t DEFAULT_CAPACITY
= 32;
257 LgIndex_t BlockSize
= MAX(DEFAULT_CAPACITY
, CurrentCapacity
/ 2);
258 if (RequestedCapacity
== 0)
259 Result
= DEFAULT_CAPACITY
;
261 Result
= ((RequestedCapacity
- 1) / BlockSize
+ 1) * BlockSize
;
263 /* put a cap on the maximum */
264 if (Result
> MaxNumZonesOrVars
)
265 Result
= MaxNumZonesOrVars
;
269 Result
= 0; /* request exceeded maximum; unable to satisfy request */
271 ENSURE(Result
== 0 || Result
>= RequestedCapacity
);
272 ENSURE(Result
<= MaxNumZonesOrVars
);
277 #if defined TECPLOTKERNEL
278 /* CORE SOURCE CODE REMOVED */
279 #if !defined USE_MACROS_FOR_FUNCTIONS
281 # if defined DEBUGUNIQUE
283 #endif /* TECPLOTKERNEL */