/*==================================================================================== ! Purpose(s): ! ! Contain(s): ! ! Author(s): Javier Lopez Lara (jav.lopez@unican.es) ! Gabriel Barajas (barajasg@unican.es) !====================================================================================*/ #ifndef CMiscH #define CMiscH #include "CArrayMasks.h" // Compiler depedent macros. #ifdef __INTEL_COMPILER #define _FORTRAN _cdecl #define _ENUM #define _DOUBLE double #define _DOUBLE_ARRAY double * #define _INT int #define _INT_ARRAY int * #define _BOOL bool #define _BOOL_ARRAY bool * #else #define _FORTRAN #define _ENUM #define _DOUBLE double & #define _DOUBLE_ARRAY double * #define _INT int & #define _INT_ARRAY int * #define _BOOL bool & #define _BOOL_ARRAY bool * #endif const int VER_OBS= 1; const int HOR_OBS= 2; const int HOR_OBS2= 4; const int LBOUND = 8; const int RBOUND = 16; const int TBOUND = 32; const int BBOUND = 64; // These funtions pack/unpack 4 index values (for every side of the cell) into/from an unsigned integer. int IdxPack(int AL, int AR, int AT, int AB); void IdxUnpack(int AValue, int &AL, int &AR, int &AT, int &AB); // This struct let's know the type of obstacle interface at the cell. struct TCellObstacleType { private: int COT; public: void Reset(void) {COT=0;}; void AddType(int AType) {COT=(COT | AType);}; bool NoObstacle(void) {return COT==0;}; bool IsLBound(void) {return (COT & LBOUND)!=0;}; bool IsRBound(void) {return (COT & RBOUND)!=0;}; bool IsTBound(void) {return (COT & TBOUND)!=0;}; bool IsBBound(void) {return (COT & BBOUND)!=0;}; bool IsVerObs(void) {return (COT & VER_OBS)!=0;}; bool IsHorObs(void) {return (COT & HOR_OBS)!=0;}; bool IsHorObs2(void) {return (COT & HOR_OBS2)!=0;}; }; //TCellObstacleType // -------------------------------------------------------------------------------------------------- bool IsObstacleInterface(const TMesh &AMesh, TMask &wAc, TMask &wAr, TMask &wAt, bool AKlRigid, bool AKrRigid, bool AKtRigid, bool AKbRigid, TVector &ANormVec, double &ACDist, double &ATRDist); /*!======================================================================= ! Purpose(s): This function returns true if the cell has an obstacle interface. In this case it also returns: ! - ANormVec: an unitary vector perpendicular to this interface (outward from the obstacle). ! - ACDist: Distance from the central point to the obstacle. ! - ATRDist: Distance from top-right point to the obstacle. ! ! Author(s): Javier Lopez Lara (jav.lopez@unican.es) ! Gabriel Barajas (barajasg@unican.es) !=======================================================================*/ //---------------------------------------------------------------------------------------- //extern "C" void _FORTRAN cdefinelowturbrect(int *ARect, // bool AIsExNonTurbArea, // int AISourceS, // int AISourceE, // int AJSourceS, // int AJSourceE, // int ALowTurbLength); extern "C" void _FORTRAN cdefinelowturbrect_(_INT_ARRAY ARect, _BOOL AIsExNonTurbArea, _INT AISourceS, _INT AISourceE, _INT AJSourceS, _INT AJSourceE, _INT ALowTurbLength); /*!======================================================================= ! Purpose(s): Defines the low turbulence rectangle. ARect is an integer array of size 4. The reason for using ! this array and not a TIntRect is because we need to store the rectangle in a Fortran's array. ! The order of the values in the array is: L, R, B, T ! ! Author(s): Javier Lopez Lara (jav.lopez@unican.es) ! Gabriel Barajas (barajasg@unican.es) !=======================================================================*/ #endif