/* file name phoenics.h ---------------------------------------------- 140623 */
/* ------------------------------------------------------------------  */

#include <stdio.h>
#include <gl\gl.h>
#include "ph_export.h"
#include "GraImage.h"

// FORTRAN_CALL differs according to whether /iface:cvf or /iface:default is used
#ifdef _COMPAQ_
  #define FORTRAN_CALL __stdcall
  #define DWORD_PTR int
#else
  #define FORTRAN_CALL __cdecl
#endif

/* --------- Structures used in Satellite DLL ----------------------- */

#ifndef _RGBCOLS
#define _RGBCOLS
typedef struct _RGBCols
{
	unsigned short red;
	unsigned short green;
	unsigned short blue;
} RGBCols;
#endif /* _RGBCOLS */

typedef struct _POINT3D
{
	float xLoc;
	float yLoc;
	float zLoc;
} POINT3D, *LPPOINT3D;

typedef struct _LINE3D
{
	float xBegin;
	float yBegin;
	float zBegin;
	float xEnd;
	float yEnd;
	float zEnd;
	RGBCols rgbCol;
} LINE3D, *LPLINE3D;

typedef struct _FACET3D
{
	POINT3D *pFac;	// Use pointer here so we can vary number of corners in facets
	int nCorner;	// Number of corners in current facet
	int iOpaq;		// Opaqueness value for facet
	RGBCols rgbCol;	// RGB values for current facet
} FACET3D, *LPFACET3D;

// VRFACETQUAD Structure added for use with contour facet Quads
typedef struct vrFacetQuad
{
	float xPos[4];
	float yPos[4];
	float zPos[4];
	float fVal[4];
} VRFACETQUAD, *PVRFACETQUAD;



/* --------- End Structure declarations  ---------------------------- */

/* --------- Constants used in Satellite DLL ------------------------ */

// Arguments which control mode in which satellite is run
#define IN_COMMANDER	100		/* VR window not active in main window, but menus remain available */
#define IN_VR			13		/* Indicates either IN_EDITOR or IN_VIEWER */
#define IN_EDITOR		1		/* Open in full VR Editor mode */
#define IN_EDITOR_ND	-1		/* In VR Editor mode but with warning dialogs disabled */
#define IN_VIEWER		3		/* Open in VR Viewer (post-processing) mode */
#define IN_TALKTRUE		5		/* Run old style Satellite with user interaction */
#define IN_TALKFALSE	6		/* Run old style Satellite without user interaction */
#define IN_MOVEMENT		9		/* Flag for movement buttons control */
#define IN_SHAPEMAKER	10		/* Geometry utility Shapemaker window active */

#define VR_DOMAIN -1

// Arguments used for starting a new case
#define FILE_NEW		401
#define FILE_LOAD		402
#define FILE_LIBRARY	403
#define FILE_DROP		404

// Object Callback function triggers
#define OC_OK			101
#define OC_CANCEL		102
#define OC_APPLY		103

// Define values for character array sizes
#ifndef _VRLENCHARS
  #define _VRLENCHARS
  #define LENOBJNAME 13
  #define LENOBJTYPE 21
  #define LENGEOMNAME 256
  #define LENVARNAME 17
#endif /* _VRLENCHARS */

// Set definition for maximum size of contour palette
// Changing this value will have coding consequences particularly in dialog function
#define MAXCONTCOLOURS 24

/* --------- End Constants declarations  ---------------------------- */

// routines available for export from DLL
PHOENICS_EXPORT void vrParseArguments();
PHOENICS_EXPORT void AddPhoeToPath(int);
PHOENICS_EXPORT int phMessageBox(HWND, LPCTSTR, LPCTSTR, UINT);
PHOENICS_EXPORT BOOL inStartUp();
PHOENICS_EXPORT HINSTANCE  BeginSatell(HINSTANCE, HWND);
PHOENICS_EXPORT int  EndSatell();
PHOENICS_EXPORT int  SatellReadQ1(int /* iMode */ ); 
PHOENICS_EXPORT int  SatellExitQ1(int /* iMode */ ); 
PHOENICS_EXPORT int  SatellWriteQ1(); 
PHOENICS_EXPORT BOOL CheckWriteQ1();
PHOENICS_EXPORT int  SatellClearCase();
PHOENICS_EXPORT int  SatellLoadCase(char* /* szFile */);
PHOENICS_EXPORT int  SatellSaveCase(char* /* szFile */ );
PHOENICS_EXPORT int  SatellSaveCaseAs(HWND /* hParent */);
PHOENICS_EXPORT int  StartEarth(HWND /* hParent */);
PHOENICS_EXPORT int  SatellPrepareCase(int, HWND);	/* Uses dialog to select & copy new/existing case for use with VR */
PHOENICS_EXPORT int  SatellStartCase(int, HWND);	/* As SatellPrepareCase and also loads case into memory */
PHOENICS_EXPORT BOOL UpdatePhoeLic(HINSTANCE, HWND);
PHOENICS_EXPORT LPSTR GetCurrentSatCaseDir();
PHOENICS_EXPORT LPSTR GetCurrentSatCaseName();
PHOENICS_EXPORT LPSTR GetCurrentSPPname();
PHOENICS_EXPORT LPSTR GetScalarName(int /* iVar */);
PHOENICS_EXPORT int GetScalarIndex(char* /* szVarNam */);
PHOENICS_EXPORT LPSTR SetCurrentScalar(int* /* iVar */, char* /*VarName */);
PHOENICS_EXPORT int  vrGetMode();
PHOENICS_EXPORT BOOL vrCheckInMode(int /* Satellite mode */);
PHOENICS_EXPORT int  OpenInformEditor();
PHOENICS_EXPORT TCHAR *Check4AvailableUpdate(TCHAR*);
PHOENICS_EXPORT int isRhinoLite();
PHOENICS_EXPORT int vrSolverMultiRun(HWND /* hParent */);
PHOENICS_EXPORT int vrLoadIntermediatePhiFile(int* /* iStep */);
PHOENICS_EXPORT int vrRequestSpecifiedPhiFile();

PHOENICS_EXPORT int  VR_Create_Object(BOOL /* bDeleteOnCancel */);
PHOENICS_EXPORT void VR_Delete_Object(int /* iObj */);
PHOENICS_EXPORT int  VR_Restore_Object(int* /* iObj */);
PHOENICS_EXPORT int  GetObjIndexFromFortran(int /* iObjFor */);
PHOENICS_EXPORT int  GetFortranIndex(int /* iObj */);
PHOENICS_EXPORT int  vrGetCurrentObject();
PHOENICS_EXPORT int  vrSetCurrentObject(int /* iObj */);
PHOENICS_EXPORT int  vrMoveObjectIndex(int /* iObjSrc */, int /* iObjDest */);

PHOENICS_EXPORT int    vrObjGetPosition(int /* iObj */, float* /* xPos */, float* /* yPos */, float* /* zPos */);
PHOENICS_EXPORT int        vrObjGetSize(int /* iObj */, float* /* xSiz */, float* /* ySiz */, float* /* zSiz */);
PHOENICS_EXPORT int         vrObjGetInt(int /* iObj */, int /* IOB_ref */, int* /* iVal */);
PHOENICS_EXPORT int        vrObjGetChar(int /* iObj */, int /* IOB_ref */, char* /* szVal */, DWORD_PTR /* szLen */);
PHOENICS_EXPORT int  vrObjGetAttribItem(int /* iObj */, int /* index */, float* /* fVal */);
PHOENICS_EXPORT int vrObjGetAttribArray(int /* iObj */, float* /* Attrib array */, int /* size of array */);
PHOENICS_EXPORT int  vrObjGetSizeAttrib(int /* iObj */, int /* IOB_ref */, 
										float* /* xAttr */, float* /* yAttr */, float* /* zAttr */);
PHOENICS_EXPORT int  vrDomainGetAttribItem(int /* index */, float* /* fVal */);

PHOENICS_EXPORT int    vrObjSetPosition(int /* iObj */, float* /* xPos */, float* /* yPos */, float* /* zPos */);
PHOENICS_EXPORT int        vrObjSetSize(int /* iObj */, float* /* xSiz */, float* /* ySiz */, float* /* zSiz */);
PHOENICS_EXPORT int         vrObjSetInt(int /* iObj */, int /* IOB_ref */, int* /* iVal */);
PHOENICS_EXPORT int        vrObjSetChar(int /* iObj */, int /* IOB_ref */, char* /* szVal */, DWORD_PTR /* szLen */);
PHOENICS_EXPORT int  vrObjSetAttribItem(int /* iObj */, int /* index */, float* /* fVal */);
PHOENICS_EXPORT int vrObjSetAttribArray(int /* iObj */, float* /* Attrib array */, int /* size of array */);
PHOENICS_EXPORT int  vrObjSetSizeAttrib(int /* iObj */, int /* IOB_ref */, 
										float* /* xAttr */, float* /* yAttr */, float* /* zAttr */);
PHOENICS_EXPORT int  vrDomainSetAttribItem(int /* index */, float* /* fVal */);

PHOENICS_EXPORT int vrObjGetRotorData(int /* iObj */, float* /* RotSpeed */, int* /* nJump */, int* /* iDir */);

PHOENICS_EXPORT float vrConvertVariableToSI(float /* inVal */, int /* IUN_iType */);
PHOENICS_EXPORT float vrConvertVariableFromSI(float /* inVal */, int /* IUN_iType */);

PHOENICS_EXPORT int ForGridMenu(int /* iRegnX */, int /* iRegnY */, int /* iRegnZ */);
PHOENICS_EXPORT BOOL vrOpenObjectDialog(HWND /* hParent */, int /* iObj */, int /* iTab */);
PHOENICS_EXPORT BOOL vrCloseObjectDialog(int /* iMode */);
PHOENICS_EXPORT BOOL vrUpdateObjectDialogSelection(int /* iObj */);
PHOENICS_EXPORT BOOL vrOpenObjectManagement(HWND /* hParent */);
PHOENICS_EXPORT BOOL vrCloseObjectManagement();
PHOENICS_EXPORT void vrRefreshObjectManagement(int /* iHiLght */); // SCM 28.02.23 Highlight argument added 
PHOENICS_EXPORT int  ReplaceObjectGeometry(HWND /* hParent */, int /* iObj */, char* /* GeomName */);
PHOENICS_EXPORT void vrFixedObjectSize(BOOL /* NoSizeChangeOnDialog */);
PHOENICS_EXPORT BOOL isObjectSizeFixed();
PHOENICS_EXPORT HWND vrOpenViewerTabSelection(HWND /* hParent */, int /* iTab */);
PHOENICS_EXPORT int vrGetViewerTabSelection();
PHOENICS_EXPORT int vrAnyViewerTabChanges();
PHOENICS_EXPORT int vrAnyObjectManagementChanges(int* /* last selected object */, int* /* number of objects selected */);
PHOENICS_EXPORT void SetDomainEdges();
PHOENICS_EXPORT int vrDisplayMonitorPlot(HWND /* hParent */, int /* wmId */);
PHOENICS_EXPORT LPSTR vrGetTimeFromStep(int /* iStep */, float* /* fTime */);
PHOENICS_EXPORT int InitialiseAnimStream(HWND /* hParent */, char* /* szFile */, HBITMAP /* hBitmap */, int /* nFramePeriod */);
PHOENICS_EXPORT int AddAnimFrame(HBITMAP /* hBitmap */);
PHOENICS_EXPORT int FinaliseAnimStream();

PHOENICS_EXPORT LPLINE3D vrGetEditorGridLines(int /* iGridDir */, float /* fPlane */ , int* /* nSize */);
PHOENICS_EXPORT int      vrFreeEditorGridLines(LPLINE3D /* Lines3D */);
PHOENICS_EXPORT int      vrGetGridPointArray(int /* iDir */, float* /* GridArray */, int /* nArraySize */);
PHOENICS_EXPORT void     vrApplyMeshChanges();	/* Regenerates grid. Applies grid matching in all directions */
PHOENICS_EXPORT int      vrGridMatch(int /* iDir */);  /* Applied grid matching in nominated direction only  */
PHOENICS_EXPORT int      vrOpenAutoMeshDialog(HWND /* hParent */); /* Open Auto-meshing slider dialog */
PHOENICS_EXPORT int      vrCloseAutoMeshDialog();	/* (Automatically) Close auto-meshing dialog */
PHOENICS_EXPORT GLuint phGetMeshDisplayList(int /* iGridDir */, float /* fPlane */);
PHOENICS_EXPORT GLuint phGetContourPlaneDisplayList(int /* iGridDir */, float /* fPlane */, GLuint /* gliCont */);
PHOENICS_EXPORT GLuint phGetIsosurfDisplayList
	(char* /* szSurfVar */, float /* fSurfVal */, int /* iOpaq */, GLuint /* gliSurf */);
PHOENICS_EXPORT int phAddNewStreamlines(POINT3D* /* lpStreamlines */, int /* nStreamlines */);
PHOENICS_EXPORT GLuint phGetStreamlinesDisplayList(int /* iIndex */, GLuint /* gliStream */);
PHOENICS_EXPORT int phClearAllStreamlines();

PHOENICS_EXPORT void setApplyGrid(int (*gapplyf)(void)); 
PHOENICS_EXPORT void setObjectCallback(int (*gobjectf)(int, int)); 
PHOENICS_EXPORT int phSendContourPalette(RGBCols *ConCols, int nCols);
PHOENICS_EXPORT int phSelectContourPalette(RGBCols *ConCols, int nMaxCols);
PHOENICS_EXPORT int vrStartObjectSurfaceContours(int /* iObj */, int /* nMaxQuads */);
PHOENICS_EXPORT int vrGetNextObjectSurfaceContours(PVRFACETQUAD /* pFQ */, int /* MaxQuads*/ );
PHOENICS_EXPORT int vrEndObjectSurfaceContours();


// The FORTRAN interface subroutines are required to be defined as extern 
// whencompiled within a C++ program
#ifdef __cplusplus
extern "C" {
#endif

// *** MULTIPLE PURPOSE get/set routines in VR ***
PHOENICS_EXPORT int  FORTRAN_CALL LOG_VRGETINI(int /* IGET_ref */);
PHOENICS_EXPORT void FORTRAN_CALL VR_GET1REAL(int /* I1R_ref */, float* /* fVal1 */);
PHOENICS_EXPORT void FORTRAN_CALL VR_GET2REAL(int /* I2R_ref */, float* /* fVal1 */, float* /* fVal2 */);
PHOENICS_EXPORT void FORTRAN_CALL VR_GET3REAL(int /* I3R_ref */, float* /* fVal1 */, float* /* fVal2 */, float* /* fVal3 */);
PHOENICS_EXPORT void FORTRAN_CALL VR_GET1INT (int /* I1I_ref */, int* /* iVal1 */);
PHOENICS_EXPORT void FORTRAN_CALL VR_GET2INT (int /* I2I_ref */, int* /* iVal1 */, int* /* iVal2 */);
PHOENICS_EXPORT void FORTRAN_CALL VR_GET3INT (int /* I3I_ref */, int* /* iVal1 */, int* /* iVal2 */, int* /* iVal2 */);

PHOENICS_EXPORT void FORTRAN_CALL LOG_VRSETINI(int /* IGET_ref */, int);
PHOENICS_EXPORT void FORTRAN_CALL VR_SET1REAL(int /* I1R_ref */, float* /* fVal1 */);
PHOENICS_EXPORT void FORTRAN_CALL VR_SET2REAL(int /* I2R_ref */, float* /* fVal1 */, float* /* fVal2 */);
PHOENICS_EXPORT void FORTRAN_CALL VR_SET3REAL(int /* I3R_ref */, float* /* fVal1 */, float* /* fVal2 */, float* /* fVal3 */);
PHOENICS_EXPORT void FORTRAN_CALL VR_SET1INT(int /* I1I_ref */, int* /* iVal1 */);
PHOENICS_EXPORT void FORTRAN_CALL VR_SET2INT(int /* I2I_ref */, int* /* iVal1 */, int* /* iVal2 */);
PHOENICS_EXPORT void FORTRAN_CALL VR_SET3INT(int /* I3I_ref */, int* /* iVal1 */, int* /* iVal2 */, int* /* iVal3 */);
// *** END MULTIPLE PURPOSE ***

PHOENICS_EXPORT void FORTRAN_CALL VR_GET_UNITS(int /* IUN_ref */, char* /* szVal */, DWORD_PTR /* szLen */);
PHOENICS_EXPORT int FORTRAN_CALL  SET_ADDITIONAL_INTERFACE(char*, DWORD_PTR, int);
PHOENICS_EXPORT int GET_TRANS_SETTINGS(
		int*		/* first step for output */,
		int*		/* last step */,
		int*		/* step interval between output files */ ,
		int*		/* number of transient output regions */,
		char*		/* PHI prefix for transient output */,
		DWORD_PTR	/* max size of PHI prefix string (5) */ );
PHOENICS_EXPORT int FORTRAN_CALL GET_TRANS_REGDATA(
		int			/* iRegion index */,
		float*		/* Size of region (seconds) */,
		int*		/* Number of time steps in region */,
		int*		/* Power law (0) or Geometric progression (1) distribution */,
		float*		/* Value for distribution */,
		int*		/* Non-symmetric (0) or Symmetric (1) */,
		int*		/* Free (0) or Set(1) */);

PHOENICS_EXPORT int FORTRAN_CALL PVM3IN();				// Required at start of Earth run to determine parallel settings
PHOENICS_EXPORT void FORTRAN_CALL GET_SPOTVALUE(
		float	/* X co-ordinate */, 
		float	/* Y co-ordinate */, 
		float	/* Z co-ordinate */, 
		float*	/* Value */);


#ifdef __cplusplus
}
#endif

// Flags used as first argument to LOG_VR[G/S]ETINI - inquiry routine for CHAM.INI
enum {
	IGET_FIGURES = 1,	/* [MONITOR]/Figures: indicates whether variable values displayed on plot */
	IGET_SWEEP,			/* [MONITOR]/Sweep: indicates whether current sweep value displayed */
	IGET_PAUSE,			/* [MONITOR]/Pause: indicates whether to pause at the end of run */
	IGET_SPINNER,		/* [MONITOR]/Spinner: indicates whether spinner animation displayed */
	IGET_TIME,			/* [MONITOR]/Time: indicates whether simulation time displayed */
	IGET_ZPLANES,		/* [MONITOR]/zplanes: indicates whether current z-plane index displayed */
	IGET_ALTERNATIVEDC,	/* [WINDOWS]/AlternativeDC: debug option */
	IGET_POLYGONOFFSET,	/* [WINDOWS]/PolygonOffset: use polygon offset used when drawing objects */
	IGET_WIREONROTATE,	/* [WINDOWS]/WireOnRotate: switch to object wireframe when rotating domain */
	IGET_FRONTANDBACK,	/* [WINDOWS]/FrontAndBack: draw front and back facets of objects */
	IGET_RCSRUN,		/* [RCS]/RCSrun: indicates batch run mode */
	IGET_HARDWAREACCEL,	/* [Graphics]/HardwareAccel: switch for graphics hardware acceleration */
	IGET_PCXBACKGROUND,	/* [Graphics]/PCX_Background: indicates if VR background colour=white */
	IGET_STLCONVERSION,	/* indicates preferred method for CAD conversion */
	IGET_SAVESCREENDIRECT,	/* [Graphics]/SaveScreenDirect: avoid virtual screen when saving plot */
	IGET_MPICH2,		/* [EARTH]/Mpi: indicates flavour of mpi: one of mpich, mpich2, msmpi */
	IGET_LINEWIDTH,		/* [MONITOR]/LineWidth: line with used for line drawing */
	IGET_NPROCS,		/* [EARTH]/NProcs: default number of processes for parallel */
	IGET_PLOTTYPE,		/* 1) plot min and max, 2) absmax correction and residuals, 3) spot values and residuals */
	IGET_MONWINDOW,		/* Width in sweep/steps of monitor window */
	IGET_LSWEEP,		/* LSWEEP trminating sweep for current run */
	IGET_NSTORE,		/* NSTO frequency of storgage dumps */
	IGET_CONWIZ,		/* LSG57 convergence wizard on or off */
	IGET_PLOTALL,		/* Indicates whether all monitor plot types saved at end of run */
	IGET_MFM,			/* Flag indicates if MultiFluid output available (GET Only) */
	IGET_LIBGIF,		/* [Graphics]/Giflib: Switch off to revert to old Gif plotting routines */
	IGET_FASTREAD,		/* Flag indicates whether to use fast reading of results */
	IGET_ANIMTHREAD,	/* Flag indicates whether threaded path during animation */
	IGET_VBOGRAPHICS,	/* Flags indicates whether VBO required, if available */
	IGET_VBOSIMPLE,
	IGET_VBOSHADOWS,
	IGET_OVERWRITE		/* Indicates if intermediate files overwritten rather than numbered copies */
};

// Flags used as first argument to VR_[G/S]ET1REAL - inquiry routine for FORTRAN values
enum {
	I1R_NEARPLANE = 101,	/* distance of near plane */
	I1R_ROTATION,		/* rotational 'speed' */
	I1R_ZOOM,			/* zoom 'speed' */
	I1R_DEPTHEFF,		/* depth effect */
	I1R_SNAPSIZE,		/* snap size */
	I1R_VSIZ,			/* VSIZ */
	I1R_VIEWANG,		/* VANG */
	I1R_SURFACEVAL,		/* spot value at probe */
	I1R_ANIMBALL,		/* radius of animation ball */
	I1R_STRRAD,			/* radius to arrangement of streamlines */
	I1R_MAXVEL,			/* maximum velocity use for plotting */
	I1R_TIMSEG,			/* STRSEG */
	I1R_SIZINC,			/* VXINC size increment */
	I1R_RINNER,			/* RINNER – inner radius for PARSOL domain */
	I1R_SPARTOL			/* SPARSOL tolerance */
};

// Flags used as first argument to VR_[G/S]ET2REAL - inquiry routine for FORTRAN values
enum {
	I2R_VECTREF = 201,	/* VSREF, VSVEC */
	I2R_VARLIM,			/* VMIN, VMAX: domain limits of current variable */
	I2R_CURVARLIM,		/* VMIN, VMAX: currently set limits of current variable */
	I2R_GRIDXLIM,		/* extent of domain in X plane (GET only) */
	I2R_GRIDYLIM,		/* extent of domain in Y plane (GET only) */
	I2R_GRIDZLIM,		/* extent of domain in Z plane (GET only) */
	I2R_PLOTXLIM,		/* extent of viewer plotting area in X plane (GET only) */
	I2R_PLOTYLIM,		/* extent of viewer plotting area in Y plane (GET only) */
	I2R_PLOTZLIM,		/* extent of viewer plotting area in Z plane (GET only) */
	I2R_VREFLIM,		/* 0.005*VELMAX, VELMAX: limits for velocity (GET only) */
	I2R_STRTIME,		/* TIMLM1,TIMLM2: time limits for streamlines */
	I2R_UNITCONV,		/* RUNITA,RUNITB: SI unit conversion factors for current var. (GET only) */
	I2R_VARUNITCONV,	/* RUNITA,RUNITB: SI unit conversion (for specified variable RL1)(GET only) */
	I2R_DOMXLIM,		/* physical extent of domain in X plane (for BFC) (GET only) */
	I2R_DOMYLIM,		/* physical extent of domain in Y plane (for BFC) (GET only) */
	I2R_DOMZLIM,		/* physical extent of domain in Z plane (for BFC) (GET only) */
	I2R_TRANSTIME,		/* Start and End times (in seconds) for transient cases */
	I2R_AUTOGRID,		/* Grid direction, Auto grid matching index (0 - 100) */
	I2R_ISOVARLIM		/* VMIN, VMAX: currently set limits of iso-surface variable */
};

// Flags used as first argument to VR_[G/S]ET3REAL - inquiry routine for FORTRAN values
enum {
	I3R_DOMSIZE = 301,	/* size of domain in three cardinal directions */
	I3R_VIEWPARAM,		/* position of view centre */
	I3R_DOMSCALE,		/* domain scaling factors */
	I3R_VIEWNORM,		/* view normal VN(3)vector */
	I3R_VIEWUP,			/* view up VU(3) vector */
	I3R_VIEWCROSS,		/* view cross product VR(3) array */
	I3R_PROBELOC,		/* probe location */
	I3R_POSMIN,			/* viewer plot area mins */
	I3R_POSMAX,			/* viewer plot area maxs */
	I3R_OBJDIR,			/* current object rotation angles */
	I3R_ROTCEN,			/* current object rotation centre */
	I3R_MINLOC,			/* location for minimum value of current variable (GET only) */
	I3R_MAXLOC,			/* location for maximum value of current variable (GET only) */
	I3R_STRBEGIN,		/* start point for line along which streamlines will appear */
	I3R_STREND,			/* end point for line along which streamlines will appear */
	I3R_PLOTSTART,		/* start point for variable profile plot */
	I3R_PLOTEND,		/* end point for variable profile plot */
	I3R_SIZINC,			/* size increments for location size buttons */
	I3R_BFCDOMSIZ,		/* physical size of BFC domain */
	I3R_OBJCEN,			/* location of centre of current object (GET only) */
	I3R_DOMORIG			/* get/set domain origin with I3R_DOMORIG */
};

// Flags used as first argument to VR_[G/S]ET1INT - inquiry routine for FORTRAN values
enum {
	I1I_CURROBJ = 1101,	/* index of current object */
	I1I_NUMOBJ,			/* number of VR objects in domain (GET only) */
	I1I_CARTES,			/* indicates whether domain is Cartesian (0), Polar (1), BFC (2), USP(3) */
	I1I_BFC,			/* indicates whether domain is BFC (1) or not (0) */
	I1I_NUMVARS,		/* number of variables in viewer */
	I1I_CONTOPAQ,		/* opaqueness value for contour planes */
	I1I_NUMSLICE,		/* number of saved slices */
	I1I_NUMSTREAM,		/* number of streamlines plotted */
	I1I_EDITREF,		/* flag indicates whether pQ1editor used as text editor */
	I1I_STRMVIS,		/* flag to show streamline start locations along line */
	I1I_STRMCOL,		/* flag indicates what to colour streamlines by */
	I1I_OBJROTA,		/* geometry rotation index */
	I1I_NUMTYPES,		/* number of object types available */
	I1I_STRMVEC,		/* streamline animation mode (ball, vector or line segment) */
	I1I_DOPROBE,		/* flag indicates whether probe displayed */
	I1I_DOCELL,			/* flag indicates whether probe cell location displayed */
	I1I_DOTITL,			/* flag indicates whether to display case title */
	I1I_DOCONK,			/* flag indicates whether to display contour key */
	I1I_DOAXES,			/* flag indicates whether to display domain axes */
	I1I_BLKCUR,			/* indicates block of current probe location (GET only) */
	I1I_BLKMIN,			/* block index for location of minimum variable value location (GET only) */
	I1I_BLKMAX,			/* block index for location of maximum variable value location (GET only) */
	I1I_MINMAX,			/* flag indicates whether min/max value locations displayed */
	I1I_DODOM,			/* flag indicates whether domain outline displayed */
	I1I_NUMBLK,			/* maximum number of blocks in model domain */
	I1I_VLINWID,		/* line width used for vector arrows */
	I1I_DOMCOL,			/* palette index for domain outline */
	I1I_REVCOL,			/* flag indicates if contour colours reversed */
	I1I_PLANT,			/* indicates whether current case uses PLANT */
	I1I_CLINES,			/* indicates whether contour lines to be drawn */
	I1I_NUMTXT,			/* number of user text items in plot window */
	I1I_XCYCLE,			/* flag indicates whether case uses X-cycle */
	I1I_CVD,			/* flag indicates whether case is CVD (GET only) */
	I1I_VECMODE,		/* indicates whether vectors plotted total or inplane */
	I1I_NUMPLINE,		/* number of plot lines */
	I1I_PLOTINTVL,		/* number of values along plot profiles */
	I1I_NWARN,			/* number of warnings during the Q1 read */
	I1I_SURFOPAQ,		/* surface contour opaqueness */
	I1I_CON256,			/* indicates whether to normal or extended palette for contours */
	I1I_GREYSCALE,		/* indicates whether to use greyscale colouring for contours */
	I1I_BFCSTROPT,		/* BFC streamline options */
	I1I_VECSTYLE,		/* indicates whether vectors plotted as lines or 3D */
	I1I_NUMCONCOL,		/* number of contour colours in palette */
	I1I_MESHDIR,		/* indicates plane direction in which mesh drawn */
	I1I_CADFILTYP,		/* indicates number of CAD files supported (GET only) */
	I1I_DROPCAD,		/* number of CAD files that were dropped into domain */
	I1I_DOMGRDCOL,		/* index for domain gridline colour for domain material */
	I1I_DRAWCELL,		/* flag indicates whether gridlines plotted at cell centre or edge */
	I1I_PARSOL,			/* flag indicates PARSOL on or off. (GET only) */
	I1I_AXISWID,		/* line thickness for drawing axis lines */
	I1I_OFREFINE,		/* level of grid refinement for OpenFOAM grids */
	I1I_RESTOREOBJ,		/* flag indicates whether it is possible to restore a deleted object */
	I1I_STEADY,			/* indicates whether case is Steady state (1) or Transient (0) */
	I1I_KEYVALS,		/* */
	I1I_ISOSURFACE,		/* Isosurface flag: (-1) use current variable, (>0) variable index */
	I1I_EARPRECISION,	/* Solver precision flag: (1) single (2) double */
	I1I_PROJFILTYPES,   /* Number of project file types (referred to in phoesav.cfg) */
	I1I_GENTRA,			/* Flag indicates when Gentra enabled */
	I1I_SAVEANIM,		/* Flag indicates whether 'animation saved to file' flag set */
	I1I_MONSTYLE,		/* Flag indicates style of monitor plot (classic/new) */
	I1I_PLOTLOG			/* Flag indicates whether current variable plotted with log scale */
};

// Flags used as first argument to VR_[G/S]ET2INT - inquiry routine for FORTRAN values
// SCM 08.03.16 Initial value for I2I_* enum increased by 1000 to avoid confusion with I2R_*
enum {
	I2I_SURFACE = 1201,	/* flag for iso-surface plotting (phase not used) */
	I2I_VECPHASE,		/* number of phases, current phase selected */
	I2I_CURSTREAM,		/* IN1-in: streamline index, In2-out: indicates highlighted streamline */
	I2I_CONKORIG,		/* Contour key origin in plot window */
	I2I_PROBORIG,		/* Probe key location */
	I2I_TITLORIG,		/* Plot title location */
	I2I_CELLORIG,		/* Cell display location */
	I2I_COARSE,			/* Coarse contour on rotation flag and max cells for contours */
	I2I_AXESORIG,		/* location for user located axes display */
	I2I_PANELSTATUS,	/* visibility status for Control and Movement panels */
	I2I_BARSTATUS,		/* visibility status for Toolbar and Statusbar */
	I2I_BUT1STATUS,		/* visibility status for File and Movement items of toolbar */
	I2I_BUT2STATUS,		/* visibility status for Domain and Object items of toolbar */
	I2I_BUT3STATUS,		/* visibility status for Function and Animation items of toolbar */
	I2I_BUT4STATUS,		/* visibility status for Slice and Variable items of toolbar */
	I2I_IFACESTATUS,	/* IN1-in:index IN2-out:flag for additional interface outputs */
	I2I_TEXTCOLOURS,	/* text colour index and VR background colour index (GET only) */
	I2I_VECTCOLOUR,		/* flag indicates vector colour mode, fixed vector colour index */
	I2I_WRITEOPTS,		/* Write options for Q1 and Eardat */
	I2I_MONOPTS,		/* Monitor plot output and line width for plot lines */
	I2I_CONLINE,		/* line width and colour option for line contours */
	I2I_DOSPLITS,		/* flag to split Cad objects 1) closed volumes, 2) CAD entities */
	I2I_CONTOPTN,		/* additional SPARSOL display options (SET only) */
	I2I_LANGUAGE,		/* Language settings */
	I2I_OFFACET,		/* Additional multi-STL output, number of facetted objects */
	I2I_TIMESTEPS,		/* First and last time steps for transient cases */
	I2I_AUTOCELL,		/* Grid direction, Cell Fraction (0) or Size (1) */
	I2I_ISOSURFCOL		/* Coloured by flag, Colour Palette index */
};

// Flags used as first argument to VR_[G/S]ET3INT - inquiry routine for FORTRAN values
enum {
	I3I_GRIDDIM = 1301,	/* number of cells in cardinal directions */
	I3I_PRIPUB,			/* public/private settings for satellite, earth and photon */
	I3I_CELLMIN,		/* min cell values (I,J,K) of viewer plotting area */
	I3I_CELLMAX,		/* max cell values (I,J,K) of viewer plotting area */
	I3I_CONTOUR,		/* contour options BLANK, AVERAGE, KEYOPT */
	I3I_VARINFO,		/* variable index for Pressure, Temperature and Velocity (GET only) */
	I3I_VECINTVLS,		/* vector cell intervals in I,J,K */
	I3I_NSTRMINT,		/* streamline animation: number of intervals, XXX, balls per streamline */
	I3I_LOWCELL,		/* cell location for current variable low point (GET only) */
	I3I_HIGHCELL,		/* cell location for current variable high point (GET only) */
	I3I_PROBECELL,		/* cell location for probe */
	I3I_GRIDMAX,		/* max number of cells in current block (GET only) */
	I3I_STRTYPE,		/* 1)line:arrow:ribbon 2)streamline pixel width 3)downstream:up:both */
	I3I_STROPT,			/* 1)streamline coloured by 2)from probe:line:circle 3) XXX */
	I3I_COMPONENTS,		/* component variables for user set vectors */
	I3I_MAXOBJPOS,		/* ‘at_end’ position flags in 3 directions for current object */
	I3I_FULLOBJSIZE,	/* ‘to_end’ size flags in 3 directions for current object */
	I3I_ANIMIVALS,		/* macro animation flags, istart, iend, interval */
	I3I_ISG,			/* ISG settings for Earth monitor output */
	I3I_DOMDEC,			/* Parallel domain decomposition settings */
	I3I_INTERSIZE,		/* Size of intermediate PHI, GXMONI and GENTRA files (reported when clearing case) */
	I3I_AXESCOLS,		/* palette indexes for drawing axes, defaults (X=, Y=, Z=) */
	I3I_AUTOGRID,		/* indicates whether autogrid switch on in each co-ordinate direction */
	I3I_CONTTXT			/* controls appearance of contour key text: format (0,1,2 or 3), field width and decimal places */
};

// Flags used as second argument to vrObj[G/S]etInt - inquiry routine for VR Object integer values
enum {
	IOB_VISIBIL = 1,	/* Visibility setting for object IOBJ */
	IOB_COLOUR,			/* Colour setting */
	IOB_OPAQNESS,		/* Opaqueness setting */
	IOB_MESH,			/* Object affects grid setting 
						   If (value%2)==0 object affects grid in X direction; (value%3)==0 then Y; (value%5)==0 then Z */
	IOB_SURFACE,		/* contour object surface setting */
	IOB_PARENT,			/* parental setting for object */
	IOB_CHILDREN,		/* number of child objects */
	IOB_ROTMOD,			/* rotation mode */
	IOB_ROTCEN,			/* rotation centre reference */
	IOB_COLMOD,			/* colour mode */
	IOB_BOUND,			/* indicates if object bound by domain */
	IOB_BLOCK,			/* object setting for BFC multi-block */
	IOB_TEXTURE,		/* texture number for object */
	IOB_WIRE,			/* indicates if object drawn wireframe */
	IOB_CLIPTYPE,		/* indicates whether clipping plane is high or low end */
	IOB_CLIPSLICE,		/* indicates whether clipping plane applies to viewer slices */
	IOB_POLARGEOM,		/* indicates whether geometry is polar */
	IOB_NUMFACETS,		/* number of facets in object geometry */
	IOB_ROTINDEX,		/* geometry rotation index */
	IOB_POSMODE,		/* position mode - corner (0) or centre (1) */
	IOB_POSCOORDS,		/* (polar) position co-ordinate system (0) polar (1) cartesian */
	IOB_MATERIAL		/* Material index for object (Get only) */
};

// Flags used as second argument to vrObj[G/S]etChar - inquiry routine for VR Object character values
enum {
	IOB_NAME = 101,		/* name of current object */
	IOB_TYPE,			/* type set for current object (blockage, inlet etc) */
	IOB_GEOM			/* geometry file associated with object */
};

// Flags used as first argument to VR_GET_UNITS - inquiry routine for name of units for reference
enum {
	IUN_CURRENT = 500,	/* unit for current variable */
	IUN_SYSTEM,			/* unit system (SI, FPS or CGS) */
	IUN_LENGTH,			/* unit for lengths */
	IUN_TIME,			/* unit for time */
	IUN_MASS,			/* unit for mass */
	IUN_WORK,			/* unit for work */
	IUN_POWER,			/* unit for power */
	IUN_TEMP,			/* unit for temperature */
	IUN_FORCE,			/* unit for force */
	IUN_PRESSURE,		/* unit for pressure */
	IUN_VELOCITY,		/* unit for velocities */
	IUN_DENSITY,		/* unit for densities */
	IUN_ISOSURFACE		/* unit for iso-surface variable */
};