00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <string.h>
00004 #include "cgnslib.h"
00005
00006
00007
00008 #if CGNS_VERSION < 2500
00009
00010 static char const *InvalidName = "<invalid>";
00011 static char const *NotImplemented = "<not implemented>";
00012
00013 char const *cg_MassUnitsName (int type)
00014 {
00015 if (type < 0 || type >= NofValidMassUnits)
00016 return InvalidName;
00017 return MassUnitsName[type];
00018 }
00019
00020 char const *cg_LengthUnitsName (int type)
00021 {
00022 if (type < 0 || type >= NofValidLengthUnits)
00023 return InvalidName;
00024 return LengthUnitsName[type];
00025 }
00026
00027 char const *cg_TimeUnitsName (int type)
00028 {
00029 if (type < 0 || type >= NofValidTimeUnits)
00030 return InvalidName;
00031 return TimeUnitsName[type];
00032 }
00033
00034 char const *cg_TemperatureUnitsName (int type)
00035 {
00036 if (type < 0 || type >= NofValidTemperatureUnits)
00037 return InvalidName;
00038 return TemperatureUnitsName[type];
00039 }
00040
00041 char const *cg_AngleUnitsName (int type)
00042 {
00043 if (type < 0 || type >= NofValidAngleUnits)
00044 return InvalidName;
00045 return AngleUnitsName[type];
00046 }
00047
00048 char const *cg_ElectricCurrentUnitsName (int type)
00049 {
00050 #ifdef NofValidElectricCurrentUnits
00051 if (type < 0 || type >= NofValidElectricCurrentUnits)
00052 return InvalidName;
00053 return ElectricCurrentUnitsName[type];
00054 #else
00055 return NotImplemented;
00056 #endif
00057 }
00058
00059 char const *cg_SubstanceAmountUnitsName (int type)
00060 {
00061 #ifdef NofValidSubstanceAmountUnits
00062 if (type < 0 || type >= NofValidSubstanceAmountUnits)
00063 return InvalidName;
00064 return SubstanceAmountUnitsName[type];
00065 #else
00066 return NotImplemented;
00067 #endif
00068 }
00069
00070 char const *cg_LuminousIntensityUnitsName (int type)
00071 {
00072 #ifdef NofValidLuminousIntensityUnits
00073 if (type < 0 || type >= NofValidLuminousIntensityUnits)
00074 return InvalidName;
00075 return LuminousIntensityUnitsName[type];
00076 #else
00077 return NotImplemented;
00078 #endif
00079 }
00080
00081 char const *cg_DataClassName (int type)
00082 {
00083 if (type < 0 || type >= NofValidDataClass)
00084 return InvalidName;
00085 return DataClassName[type];
00086 }
00087
00088 char const *cg_GridLocationName (int type)
00089 {
00090 if (type < 0 || type >= NofValidGridLocation)
00091 return InvalidName;
00092 return GridLocationName[type];
00093 }
00094
00095 char const *cg_BCDataTypeName (int type)
00096 {
00097 if (type < 0 || type >= NofValidBCDataTypes)
00098 return InvalidName;
00099 return BCDataTypeName[type];
00100 }
00101
00102 char const *cg_GridConnectivityTypeName (int type)
00103 {
00104 if (type < 0 || type >= NofValidGridConnectivityTypes)
00105 return InvalidName;
00106 return GridConnectivityTypeName[type];
00107 }
00108
00109 char const *cg_PointSetTypeName (int type)
00110 {
00111 if (type < 0 || type >= NofValidPointSetTypes)
00112 return InvalidName;
00113 return PointSetTypeName[type];
00114 }
00115
00116 char const *cg_GoverningEquationsTypeName (int type)
00117 {
00118 if (type < 0 || type >= NofValidGoverningEquationsTypes)
00119 return InvalidName;
00120 return GoverningEquationsTypeName[type];
00121 }
00122
00123 char const *cg_ModelTypeName (int type)
00124 {
00125 if (type < 0 || type >= NofValidModelTypes)
00126 return InvalidName;
00127 return ModelTypeName[type];
00128 }
00129
00130 char const *cg_BCTypeName (int type)
00131 {
00132 if (type < 0 || type >= NofValidBCTypes)
00133 return InvalidName;
00134 return BCTypeName[type];
00135 }
00136
00137 char const *cg_DataTypeName (int type)
00138 {
00139 if (type < 0 || type >= NofValidDataTypes)
00140 return InvalidName;
00141 return DataTypeName[type];
00142 }
00143
00144 char const *cg_ElementTypeName (int type)
00145 {
00146 if (type < 0 || type >= NofValidElementTypes)
00147 return InvalidName;
00148 return ElementTypeName[type];
00149 }
00150
00151 char const *cg_ZoneTypeName (int type)
00152 {
00153 if (type < 0 || type >= NofValidZoneTypes)
00154 return InvalidName;
00155 return ZoneTypeName[type];
00156 }
00157
00158 char const *cg_RigidGridMotionTypeName (int type)
00159 {
00160 #ifdef NofValidRigidGridMotionTypes
00161 if (type < 0 || type >= NofValidRigidGridMotionTypes)
00162 return InvalidName;
00163 return RigidGridMotionTypeName[type];
00164 #else
00165 return NotImplemented;
00166 #endif
00167 }
00168
00169 char const *cg_ArbitraryGridMotionTypeName (int type)
00170 {
00171 #ifdef NofValidArbitraryGridMotionTypes
00172 if (type < 0 || type >= NofValidArbitraryGridMotionTypes)
00173 return InvalidName;
00174 return ArbitraryGridMotionTypeName[type];
00175 #else
00176 return NotImplemented;
00177 #endif
00178 }
00179
00180 char const *cg_SimulationTypeName (int type)
00181 {
00182 #ifdef NofValidSimulationTypes
00183 if (type < 0 || type >= NofValidSimulationTypes)
00184 return InvalidName;
00185 return SimulationTypeName[type];
00186 #else
00187 return NotImplemented;
00188 #endif
00189 }
00190
00191 char const *cg_WallFunctionTypeName (int type)
00192 {
00193 #ifdef NofValidWallFunctionTypes
00194 if (type < 0 || type >= NofValidWallFunctionTypes)
00195 return InvalidName;
00196 return WallFunctionTypeName[type];
00197 #else
00198 return NotImplemented;
00199 #endif
00200 }
00201
00202 char const *cg_AreaTypeName (int type)
00203 {
00204 #ifdef NofValidAreaTypes
00205 if (type < 0 || type >= NofValidAreaTypes)
00206 return InvalidName;
00207 return AreaTypeName[type];
00208 #else
00209 return NotImplemented;
00210 #endif
00211 }
00212
00213 char const *cg_AverageInterfaceTypeName (int type)
00214 {
00215 #ifdef NofValidAverageInterfaceTypes
00216 if (type < 0 || type >= NofValidAverageInterfaceTypes)
00217 return InvalidName;
00218 return AverageInterfaceTypeName[type];
00219 #else
00220 return NotImplemented;
00221 #endif
00222 }
00223
00224 #endif
00225
00226
00227
00228 typedef struct {
00229 char *name;
00230 int flags;
00231 int nexps;
00232 int exps[8];
00233 } IDENTIFIER;
00234
00235
00236
00237
00238 static IDENTIFIER Identifier[] = {
00239 {"AxisymmetryAngle", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00240 {"AxisymmetryAxisVector", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00241 {"AxisymmetryReferencePoint", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00242 {"CharacteristicAcousticMinus", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00243 {"CharacteristicAcousticPlus", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00244 {"CharacteristicEntropy", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00245 {"CharacteristicVorticity1", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00246 {"CharacteristicVorticity2", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00247 {"CoefDrag", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00248 {"CoefLift", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00249 {"CoefMomentEta", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00250 {"CoefMomentMagnitude", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00251 {"CoefMomentNormal", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00252 {"CoefMomentPhi", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00253 {"CoefMomentR", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00254 {"CoefMomentTangential", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00255 {"CoefMomentTheta", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00256 {"CoefMomentX", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00257 {"CoefMomentXi", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00258 {"CoefMomentY", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00259 {"CoefMomentZ", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00260 {"CoefMomentZeta", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00261 {"CoefPressure", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00262 {"CoefSkinFrictionMagnitude", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00263 {"CoefSkinFrictionNormal", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00264 {"CoefSkinFrictionPhi", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00265 {"CoefSkinFrictionR", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00266 {"CoefSkinFrictionTangential", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00267 {"CoefSkinFrictionTheta", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00268 {"CoefSkinFrictionX", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00269 {"CoefSkinFrictionY", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00270 {"CoefSkinFrictionZ", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00271 {"Coef_Area", 0, 5, { 0, 2, 0, 0, 0, 0, 0, 0}},
00272 {"Coef_Length", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00273 {"Coef_PressureDynamic", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00274 {"Coef_PressureReference", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00275 {"CompressibilityFactor", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00276 {"CoordinateEta", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00277 {"CoordinateNormal", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00278 {"CoordinatePhi", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00279 {"CoordinateR", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00280 {"CoordinateTangential", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00281 {"CoordinateTheta", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00282 {"CoordinateX", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00283 {"CoordinateXi", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00284 {"CoordinateY", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00285 {"CoordinateZ", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00286 {"CoordinateZeta", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00287 {"CurrentDensityX", 0, 8, { 0, -2, 0, 0, 0, 1, 0, 0}},
00288 {"CurrentDensityY", 0, 8, { 0, -2, 0, 0, 0, 1, 0, 0}},
00289 {"CurrentDensityZ", 0, 8, { 0, -2, 0, 0, 0, 1, 0, 0}},
00290 {"Density", 0, 5, { 1, -3, 0, 0, 0, 0, 0, 0}},
00291 {"DensityStagnation", 0, 5, { 1, -3, 0, 0, 0, 0, 0, 0}},
00292 {"Drag", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00293 {"ElectricConductivity", 0, 8, { 1, 1, -3, 0, 0, -2, 0, 0}},
00294
00295 {"ElectricFieldX", 0, 8, { 1, 1, -1, 0, 0, -1, 0, 0}},
00296 {"ElectricFieldY", 0, 8, { 1, 1, -1, 0, 0, -1, 0, 0}},
00297 {"ElectricFieldZ", 0, 8, { 1, 1, -1, 0, 0, -1, 0, 0}},
00298 {"EnergyInternal", 0, 5, { 0, 2, -2, 0, 0, 0, 0, 0}},
00299 {"EnergyKinetic", 0, 5, { 0, 2, -2, 0, 0, 0, 0, 0}},
00300 {"EnergyStagnation", 0, 5, { 0, 2, -2, 0, 0, 0, 0, 0}},
00301 {"EnergyStagnationDensity", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00302 {"Enthalpy", 0, 5, { 0, 2, -2, 0, 0, 0, 0, 0}},
00303 {"EnthalpyEnergyRatio", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00304 {"EnthalpyStagnation", 0, 5, { 0, 2, -2, 0, 0, 0, 0, 0}},
00305 {"Entropy", 0, 5, { 1, 2, -2, -1, 0, 0, 0, 0}},
00306
00307 {"EntropyApprox", 0,-5, {-1, 1, -2, 0, 0, 0, 0, 0}},
00308 {"ForceMagnitude", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00309 {"ForceNormal", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00310 {"ForcePhi", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00311 {"ForceR", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00312 {"ForceTangential", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00313 {"ForceTheta", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00314 {"ForceX", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00315 {"ForceY", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00316 {"ForceZ", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00317 {"FuelAirRatio", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00318 {"GravityVector", 0, 5, { 0, 1, -2, 0, 0, 0, 0, 0}},
00319 {"GridVelocityEta", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00320 {"GridVelocityMagnitude", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00321 {"GridVelocityNormal", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00322 {"GridVelocityPhi", 0, 5, { 0, 0, -1, 0, 1, 0, 0, 0}},
00323 {"GridVelocityR", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00324 {"GridVelocityTangential", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00325 {"GridVelocityTheta", 0, 5, { 0, 0, -1, 0, 1, 0, 0, 0}},
00326 {"GridVelocityX", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00327 {"GridVelocityXi", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00328 {"GridVelocityY", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00329 {"GridVelocityZ", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00330 {"GridVelocityZeta", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00331 {"HeatOfFormation", 1, 5, { 0, 2, -2, 0, 0, 0, 0, 0}},
00332 {"IdealGasConstant", 0, 5, { 0, 2, -2, -1, 0, 0, 0, 0}},
00333 {"JouleHeating", 0, 5, { 1, 2, -2, 0, 0, 0, 0, 0}},
00334 {"LaminarViscosity", 1, 5, { 1, -1, -1, 0, 0, 0, 0, 0}},
00335 {"LengthReference", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00336 {"Lift", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00337 {"LorenzForceX", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00338 {"LorenzForceY", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00339 {"LorenzForceZ", 0, 5, { 1, 1, -2, 0, 0, 0, 0, 0}},
00340 {"Mach", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00341 {"Mach_Velocity", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00342 {"Mach_VelocitySound", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00343
00344
00345
00346
00347
00348 {"MagneticFieldX", 0, 8, { 0, -1, 0, 0, 0, 1, 0, 0}},
00349 {"MagneticFieldY", 0, 8, { 0, -1, 0, 0, 0, 1, 0, 0}},
00350 {"MagneticFieldZ", 0, 8, { 0, -1, 0, 0, 0, 1, 0, 0}},
00351 {"MassFlow", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00352 {"MassFraction", 1, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00353 {"MoleFraction", 1, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00354 {"MolecularWeight", 1, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00355 {"MomentEta", 0, 5, { 1, 2, -2, 0, 0, 0, 0, 0}},
00356 {"MomentMagnitude", 0, 5, { 1, 2, -2, 0, 0, 0, 0, 0}},
00357 {"MomentNormal", 0, 5, { 1, 2, -2, 0, 0, 0, 0, 0}},
00358 {"MomentPhi", 0, 5, { 1, 2, -2, 0, 0, 0, 0, 0}},
00359 {"MomentR", 0, 5, { 1, 2, -2, 0, 0, 0, 0, 0}},
00360 {"MomentTangential", 0, 5, { 1, 2, -2, 0, 0, 0, 0, 0}},
00361 {"MomentTheta", 0, 5, { 1, 2, -2, 0, 0, 0, 0, 0}},
00362 {"MomentX", 0, 5, { 1, 2, -2, 0, 0, 0, 0, 0}},
00363 {"MomentXi", 0, 5, { 1, 2, -2, 0, 0, 0, 0, 0}},
00364 {"MomentY", 0, 5, { 1, 2, -2, 0, 0, 0, 0, 0}},
00365 {"MomentZ", 0, 5, { 1, 2, -2, 0, 0, 0, 0, 0}},
00366 {"MomentZeta", 0, 5, { 1, 2, -2, 0, 0, 0, 0, 0}},
00367 {"Moment_CenterNormal", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00368 {"Moment_CenterPhi", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00369 {"Moment_CenterR", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00370 {"Moment_CenterTangential", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00371 {"Moment_CenterTheta", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00372 {"Moment_CenterX", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00373 {"Moment_CenterY", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00374 {"Moment_CenterZ", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00375 {"MomentumMagnitude", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00376 {"MomentumNormal", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00377 {"MomentumPhi", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00378 {"MomentumR", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00379 {"MomentumTangential", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00380 {"MomentumTheta", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00381 {"MomentumX", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00382 {"MomentumY", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00383 {"MomentumZ", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00384 {"OriginLocation", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00385 {"Potential", 0, 5, { 0, 2, -1, 0, 0, 0, 0, 0}},
00386 {"PowerLawExponent", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00387 {"Prandtl", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00388 {"PrandtlTurbulent", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00389 {"Prandtl_SpecificHeatPressure", 0, 5, { 0, 2, -2, -1, 0, 0, 0, 0}},
00390 {"Prandtl_ThermalConductivity", 0, 5, { 1, 1, -3, -1, 0, 0, 0, 0}},
00391 {"Prandtl_ViscosityMolecular", 0, 5, { 1, -1, -1, 0, 0, 0, 0, 0}},
00392 {"Pressure", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00393 {"PressureDynamic", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00394 {"PressureStagnation", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00395 {"ReferenceTemperatureHOF", 0, 5, { 0, 0, 0, 1, 0, 0, 0, 0}},
00396 {"Reynolds", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00397 {"ReynoldsStressXX", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00398 {"ReynoldsStressXY", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00399 {"ReynoldsStressXZ", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00400 {"ReynoldsStressYY", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00401 {"ReynoldsStressYZ", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00402 {"ReynoldsStressZZ", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00403 {"Reynolds_Length", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00404 {"Reynolds_Velocity", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00405 {"Reynolds_ViscosityKinematic", 0, 5, { 0, 2, -1, 0, 0, 0, 0, 0}},
00406 {"RiemannInvariantMinus", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00407 {"RiemannInvariantPlus", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00408 {"RigidRotationAngle", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00409 {"RigidRotationRate", 0, 5, { 0, 0, -1, 0, 1, 0, 0, 0}},
00410 {"RigidVelocity", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00411 {"RotatingEnergyStagnation", 0, 5, { 0, 2, -2, 0, 0, 0, 0, 0}},
00412 {"RotatingEnergyStagnationDensity", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00413 {"RotatingEnthalpyStagnation", 0, 5, { 0, 2, -2, 0, 0, 0, 0, 0}},
00414 {"RotatingMach", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00415 {"RotatingMomentumMagnitude", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00416 {"RotatingMomentumNormal", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00417 {"RotatingMomentumPhi", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00418 {"RotatingMomentumR", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00419 {"RotatingMomentumTangential", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00420 {"RotatingMomentumTheta", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00421 {"RotatingMomentumX", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00422 {"RotatingMomentumY", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00423 {"RotatingMomentumZ", 0, 5, { 1, -2, -1, 0, 0, 0, 0, 0}},
00424 {"RotatingPressureStagnation", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00425 {"RotatingVelocityMagnitude", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00426 {"RotatingVelocityNormal", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00427 {"RotatingVelocityPhi", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00428 {"RotatingVelocityR", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00429 {"RotatingVelocityTangential", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00430 {"RotatingVelocityTheta", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00431 {"RotatingVelocityX", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00432 {"RotatingVelocityY", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00433 {"RotatingVelocityZ", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00434 {"RotationAngle", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00435 {"RotationCenter", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00436 {"RotationRateVector", 0, 5, { 0, 0, -1, 0, 1, 0, 0, 0}},
00437
00438
00439
00440 {"SkinFrictionMagnitude", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00441 {"SkinFrictionNormal", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00442 {"SkinFrictionPhi", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00443 {"SkinFrictionR", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00444 {"SkinFrictionTangential", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00445 {"SkinFrictionTheta", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00446 {"SkinFrictionX", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00447 {"SkinFrictionY", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00448 {"SkinFrictionZ", 0, 5, { 1, -1, -2, 0, 0, 0, 0, 0}},
00449 {"SoundIntensity", 0, 5, { 1, 0, -3, 0, 0, 0, 0, 0}},
00450 {"SoundIntensityDB", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00451 {"SpeciesDensity", 1, 5, { 1, -3, 0, 0, 0, 0, 0, 0}},
00452 {"SpecificHeatPressure", 0, 5, { 0, 2, -2, -1, 0, 0, 0, 0}},
00453 {"SpecificHeatRatio", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00454 {"SpecificHeatRatio_Pressure", 0, 5, { 0, 2, -2, -1, 0, 0, 0, 0}},
00455 {"SpecificHeatRatio_Volume", 0, 5, { 0, 2, -2, -1, 0, 0, 0, 0}},
00456 {"SpecificHeatVolume", 0, 5, { 0, 2, -2, -1, 0, 0, 0, 0}},
00457 {"StreamFunction", 0, 5, { 0, 2, -1, 0, 0, 0, 0, 0}},
00458 {"SurfaceArea", 0, 5, { 0, 2, 0, 0, 0, 0, 0, 0}},
00459 {"SutherlandLawConstant", 0, 5, { 0, 0, 0, 1, 0, 0, 0, 0}},
00460 {"Temperature", 0, 5, { 0, 0, 0, 1, 0, 0, 0, 0}},
00461 {"TemperatureReference", 0, 5, { 0, 0, 0, 1, 0, 0, 0, 0}},
00462 {"TemperatureStagnation", 0, 5, { 0, 0, 0, 1, 0, 0, 0, 0}},
00463 {"ThermalConductivity", 1, 5, { 1, 1, -3, -1, 0, 0, 0, 0}},
00464 {"ThermalConductivityReference", 0, 5, { 1, 1, -3, -1, 0, 0, 0, 0}},
00465 {"Translation", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00466 {"TurbulentBBReynolds", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00467 {"TurbulentDissipation", 0, 5, { 0, 2, -3, 0, 0, 0, 0, 0}},
00468 {"TurbulentDissipationRate", 0, 5, { 0, 0, -1, 0, 0, 0, 0, 0}},
00469 {"TurbulentDistance", 0, 5, { 0, 1, 0, 0, 0, 0, 0, 0}},
00470 {"TurbulentEnergyKinetic", 0, 5, { 0, 2, -2, 0, 0, 0, 0, 0}},
00471 {"TurbulentSANuTilde", 0, 5, { 0, 2, -1, 0, 0, 0, 0, 0}},
00472 {"VelocityAngleMagnitude", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00473 {"VelocityAngleNormal", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00474 {"VelocityAnglePhi", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00475 {"VelocityAngleR", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00476 {"VelocityAngleTangential", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00477 {"VelocityAngleTheta", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00478 {"VelocityAngleX", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00479 {"VelocityAngleY", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00480 {"VelocityAngleZ", 0, 5, { 0, 0, 0, 0, 1, 0, 0, 0}},
00481 {"VelocityMagnitude", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00482 {"VelocityNormal", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00483 {"VelocityPhi", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00484 {"VelocityR", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00485 {"VelocitySound", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00486 {"VelocitySoundStagnation", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00487 {"VelocityTangential", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00488 {"VelocityTheta", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00489 {"VelocityUnitVectorMagnitude", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00490 {"VelocityUnitVectorNormal", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00491 {"VelocityUnitVectorPhi", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00492 {"VelocityUnitVectorR", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00493 {"VelocityUnitVectorTangential", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00494 {"VelocityUnitVectorTheta", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00495 {"VelocityUnitVectorX", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00496 {"VelocityUnitVectorY", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00497 {"VelocityUnitVectorZ", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}},
00498 {"VelocityX", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00499 {"VelocityY", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00500 {"VelocityZ", 0, 5, { 0, 1, -1, 0, 0, 0, 0, 0}},
00501 {"VibrationalElectronEnergy", 0, 5, { 0, 2, -2, 0, 0, 0, 0, 0}},
00502 {"VibrationalElectronTemperature", 0, 5, { 0, 0, 0, 1, 0, 0, 0, 0}},
00503 {"ViscosityEddy", 0, 5, { 1, -1, -1, 0, 0, 0, 0, 0}},
00504 {"ViscosityEddyKinematic", 0, 5, { 0, 2, -1, 0, 0, 0, 0, 0}},
00505 {"ViscosityKinematic", 0, 5, { 0, 2, -1, 0, 0, 0, 0, 0}},
00506 {"ViscosityMolecular", 0, 5, { 1, -1, -1, 0, 0, 0, 0, 0}},
00507 {"ViscosityMolecularReference", 0, 5, { 1, -1, -1, 0, 0, 0, 0, 0}},
00508 {"Voltage", 0, 8, { 1, 2, -1, 0, 0, -1, 0, 0}},
00509 {"VorticityMagnitude", 0, 5, { 0, 0, -1, 0, 0, 0, 0, 0}},
00510 {"VorticityNormal", 0, 5, { 0, 0, -1, 0, 0, 0, 0, 0}},
00511 {"VorticityPhi", 0, 5, { 0, 0, -1, 0, 0, 0, 0, 0}},
00512 {"VorticityR", 0, 5, { 0, 0, -1, 0, 0, 0, 0, 0}},
00513 {"VorticityTangential", 0, 5, { 0, 0, -1, 0, 0, 0, 0, 0}},
00514 {"VorticityTheta", 0, 5, { 0, 0, -1, 0, 0, 0, 0, 0}},
00515 {"VorticityX", 0, 5, { 0, 0, -1, 0, 0, 0, 0, 0}},
00516 {"VorticityY", 0, 5, { 0, 0, -1, 0, 0, 0, 0, 0}},
00517 {"VorticityZ", 0, 5, { 0, 0, -1, 0, 0, 0, 0, 0}}
00518 };
00519
00520 #define NUM_IDENTIFIER (sizeof(Identifier)/sizeof(IDENTIFIER))
00521
00522
00523
00524 int cg_get_identifier (const char *name, int *nexps, float *exps)
00525 {
00526 int n, cmp, lo = 0, hi = NUM_IDENTIFIER - 1, mid;
00527 IDENTIFIER *ident = NULL;
00528
00529 if (NULL == name || !*name) return 1;
00530 if (0 == strcmp (Identifier[lo].name, name))
00531 ident = &Identifier[lo];
00532 else if (0 == strcmp (Identifier[hi].name, name))
00533 ident = &Identifier[hi];
00534 else {
00535 while (lo <= hi) {
00536 mid = (lo + hi) >> 1;
00537 if ((Identifier[mid].flags & 1) == 1)
00538 cmp = strncmp (Identifier[mid].name, name,
00539 strlen(Identifier[mid].name));
00540 else
00541 cmp = strcmp (Identifier[mid].name, name);
00542 if (0 == cmp) {
00543 ident = &Identifier[mid];
00544 break;
00545 }
00546 if (cmp > 0)
00547 hi = mid - 1;
00548 else
00549 lo = mid + 1;
00550 }
00551 }
00552
00553 if (ident == NULL) return 1;
00554
00555 *nexps = ident->nexps;
00556 if (ident->nexps && exps != NULL) {
00557 cmp = abs (ident->nexps);
00558 for (n = 0; n < cmp; n++)
00559 exps[n] = (float)ident->exps[n];
00560 }
00561 return 0;
00562 }
00563
00564
00565
00566 static int matches (char *p, char *s)
00567 {
00568 char *cmp;
00569 int rev, strt, n;
00570
00571 while (*p) {
00572 if (*s == '\\')
00573 s++;
00574 switch (*p) {
00575
00576
00577
00578 case '?':
00579 if (!*s++)
00580 return 0;
00581 break;
00582
00583
00584
00585 case '*':
00586 if (!*++p)
00587 return 1;
00588 while (*s) {
00589 if ((n = matches (p, s)) != 0)
00590 break;
00591 s++;
00592 }
00593 return (*s ? n : 0);
00594
00595
00596
00597 case '[':
00598 if (*++p == '^') {
00599 rev = 1;
00600 p++;
00601 }
00602 else
00603 rev = 0;
00604 for (cmp = p; *cmp != ']'; cmp++) {
00605 if (!*cmp)
00606 return -1;
00607 if (*cmp == '-') {
00608 strt = *(cmp-1);
00609 if (cmp == p || !*++cmp || (*cmp == '\\' && !*++cmp))
00610 return -1;
00611 if (((strt <= *s && *s <= *cmp ? 1 : 0) ^ rev) != 0)
00612 break;
00613 }
00614 if (*cmp == '\\' && !*++cmp)
00615 return -1;
00616 if (((*s == *cmp ? 1 : 0) ^ rev) != 0)
00617 break;
00618 }
00619 if (*cmp == ']')
00620 return 0;
00621 while (*cmp && (*cmp != ']' || *(cmp-1) == '\\'))
00622 cmp++;
00623 if (!*cmp)
00624 return 0;
00625 p = cmp;
00626 s++;
00627 break;
00628
00629
00630
00631 case '\\':
00632 if (!*++p)
00633 return -1;
00634 default:
00635 if (*s++ != *p)
00636 return 0;
00637 break;
00638 }
00639 p++;
00640 }
00641 return (*s ? 0 : 1);
00642 }
00643
00644
00645
00646 int cg_find_identifier (const char *pattern, int *nnames, char ***names)
00647 {
00648 int n, cnt = 0;
00649 char *p, **pp;
00650
00651 for (n = 0; n < NUM_IDENTIFIER; n++) {
00652 if (matches ((char *)pattern, Identifier[n].name) > 0) {
00653 Identifier[n].flags |= 8;
00654 cnt++;
00655 }
00656 else
00657 Identifier[n].flags &= 7;
00658 }
00659 *nnames = cnt;
00660 if (!cnt) return 0;
00661
00662 if (names != NULL) {
00663 pp = (char **) malloc (cnt * (33 + sizeof(char *)));
00664 if (pp == NULL) {
00665 fprintf (stderr, "malloc failed for indentifier names\n");
00666 return 1;
00667 }
00668 p = (char *)(pp + cnt);
00669 for (cnt = 0, n = 0; n < NUM_IDENTIFIER; n++) {
00670 if ((Identifier[n].flags & 8) == 8) {
00671 if ((Identifier[n].flags & 1) == 1)
00672 sprintf (p, "%s#", Identifier[n].name);
00673 else
00674 strcpy (p, Identifier[n].name);
00675 pp[cnt++] = p;
00676 p += 33;
00677 }
00678 }
00679 }
00680
00681 return 0;
00682 }
00683
00684
00685
00686 int cg_enum_identifier (int (*callback)(char *name,
00687 int nexps, float *exps, void *user), void *user)
00688 {
00689 int n, i, ierr;
00690 float exps[8];
00691 char name[33];
00692
00693 for (n = 0; n < NUM_IDENTIFIER; n++) {
00694 for (i = 0; i < 8; i++)
00695 exps[i] = (float)Identifier[n].exps[i];
00696 if ((Identifier[n].flags & 1) == 1)
00697 sprintf (name, "%s#", Identifier[n].name);
00698 else
00699 strcpy (name, Identifier[n].name);
00700 ierr = (*callback) (name, Identifier[n].nexps, exps, user);
00701 if (ierr) return ierr;
00702 }
00703 return 0;
00704 }
00705
00706
00707
00708 #ifdef STANDALONE
00709
00710
00711
00712 #endif
00713