GTXclient C API GTXserver-16.0.2

- Main Page
- Related Pages
- Data Structures
- Files
- Examples

- File List
- Globals

GTXClient.h
Go to the documentation of this file.
1 /*****************************************************************************
2
3 Copyright (c)2009 Geovariances, Avon, France.
4
5 In consideration of payment of the license fee, which is a part of
6 the price you paid for this product, Geovariances (GV) as licensor,
7 grants you, the licensee, a non-exclusive right to use this copy of a
8 GV software product.
9 GV reserves all rights not expressly granted to licensee. GV retains
10 titleship and ownership of software. This license is not a sale of
11 the original software or any copy. GV also retains titleship and
12 ownership of any modifications or derivations of this software. Any
13 modifications of this software must be clearly marked as such. This
14 copyright message must appear in its entirety in this software, or
15 any modifications or derivations thereof.
16
17 Geovariances welcomes any comments, suggestions, bug reports, etc. At
18 the discretion of Geovariances, any customer supplied bug fixes,
19 enhancements, or utility codes will be distributed in future software
20 releases (the contributor will of course be credited).
21
22 Geovariances
23 49bis, Avenue Franklin Roosevelt
24 77210 Avon, FRANCE
25
26 Phone: +33-(0)-160.749.100
27 Fax: +33-(0)-164.228.728
28 e-mail: support@geovariances.fr
29
30 All Rights Reserved
31
32 *****************************************************************************/
33
34 /* $Id: GTXClient.h 25941 2016-04-05 15:10:18Z foucher $ */
35
420 #ifndef _GTXClient_h
421 #define _GTXClient_h
422
423 /* Redefine names of C structures */
424 #ifndef DOXYGEN
425 #ifdef __USING_GTXSERVER_CPP_API__
426 # define GTXFault GTXFault_C
427 # define GTXFaultInfo GTXFaultInfo_C
428 # define GTXFaultSegment GTXFaultSegment_C
429 # define GTXFaultSystem GTXFaultSystem_C
430 # define GTXFileInfo GTXFileInfo_C
431 # define GTXPolygon GTXPolygon_C
432 # define GTXPolygonSystem GTXPolygonSystem_C
433 # define GTXVariableInfo GTXVariableInfo_C
434 # define GTXVendorData GTXVendorData_C
435 # define GTXWireframe GTXWireframe_C
436 # define GTXWireframeObject GTXWireframeObject_C
437 # define GTXWireframeSystem GTXWireframeSystem_C
438 # define GTXColorScale GTXColorScale_C
439 #else
440 # define GTXFault_C GTXFault
441 # define GTXFaultInfo_C GTXFaultInfo
442 # define GTXFaultSegment_C GTXFaultSegment
443 # define GTXFaultSystem_C GTXFaultSystem
444 # define GTXFileInfo_C GTXFileInfo
445 # define GTXPolygon_C GTXPolygon
446 # define GTXPolygonSystem_C GTXPolygonSystem
447 # define GTXVariableInfo_C GTXVariableInfo
448 # define GTXVendorData_C GTXVendorData
449 # define GTXWireframe_C GTXWireframe
450 # define GTXWireframeObject_C GTXWireframeObject
451 # define GTXWireframeSystem_C GTXWireframeSystem
452 # define GTXColorScale_C GTXColorScale
453 #endif
454 #endif /*DOXYGEN*/
455
456
457 #include "GTXOs.h"
458
464 #define GTX_CLIENT_VERSION 1300030
465
471 typedef enum
472 {
473 GTX_FILE_TYPE_ANY = -1,
474 GTX_FILE_TYPE_POINTS,
475 GTX_FILE_TYPE_GRAVITY_LINES,
476 GTX_FILE_TYPE_CORE_LINES,
477 GTX_FILE_TYPE_GRID,
478 GTX_FILE_TYPE_INVALID
479 } GTX_FILE_TYPE;
480
486 typedef enum
487 {
488 GTX_VAR_TYPE_SELECTION = -3,
489 GTX_VAR_TYPE_FLOAT_ALL = -2,
490 GTX_VAR_TYPE_ANY = -1,
491 GTX_VAR_TYPE_FLOAT,
492 GTX_VAR_TYPE_CHAR,
493 GTX_VAR_TYPE_XG,
494 GTX_VAR_TYPE_YG,
495 GTX_VAR_TYPE_ZG,
496 GTX_VAR_TYPE_MACRO,
497 GTX_VAR_TYPE_INVALID
498 } GTX_VAR_TYPE;
499
506 typedef enum
507 {
508 GTX_FORMAT_TYPE_DECIMAL,
509 GTX_FORMAT_TYPE_INTEGER,
510 GTX_FORMAT_TYPE_EXPONENT,
511 GTX_FORMAT_TYPE_FREE,
512 GTX_FORMAT_TYPE_SHIFTED,
513 GTX_FORMAT_TYPE_INVALID
514 } GTX_FORMAT_TYPE;
515
518 typedef struct
519 {
520 int faults_2d;
521 int aux_var_used;
522 int faults_number;
523 int segments_number;
524 int min_fpriority;
525 int max_fpriority;
526 int auth_priority;
527 } GTXFaultInfo;
528
533 typedef struct
534 {
535 GTX_FILE_TYPE type;
536 char linked_file[50];
537 int faulted;
538 int polygon_file;
541 int dimension;
543 gtx_long s_number;
544 int item_number;
545 double X0;
546 double Y0;
547 double Z0;
548 double DX;
549 double DY;
550 double DZ;
551 int NX;
552 int NY;
553 int NZ;
554 int rotation;
556 double angle_z;
557 double angle_y;
558 double angle_x;
559 char sn_var_name[50];
560 char ln_var_name[50];
561 char lname_var_name[50];
562 char rn_var_name[50];
563 char xg_var_name[50];
564 char yg_var_name[50];
565 char zg_var_name[50];
566 char xb_var_name[50];
567 char yb_var_name[50];
568 char zb_var_name[50];
569 char xe_var_name[50];
570 char ye_var_name[50];
571 char ze_var_name[50];
572 GTXFaultInfo fault_info;
573 } GTXFileInfo;
574
579 typedef struct
580 {
581 GTX_VAR_TYPE type;
582 int bit_length;
585 int alpha_length;
587 int implicit;
589 int i_number;
591 char unit[11];
592 char unit_symbol[11];
593 int length_var;
594 } GTXVariableInfo;
595
599 typedef struct
600 {
601 double X1;
602 double Y1;
603 double Z1;
604 double X2;
605 double Y2;
606 double Z2;
607 double X3;
608 double Y3;
609 double Z3;
610 double V1;
611 double V2;
612 double V3;
613 int priority;
614 } GTXFaultSegment;
615
622 typedef struct
623 {
624 char name[8];
625 int polygon;
626 int n_segments;
627 GTXFaultSegment *segments;
628 } GTXFault;
629
640 typedef struct
641 {
642 int faults_2d;
643 int aux_var_used;
644 double aux_var_test;
645 int n_faults;
646 GTXFault *faults;
647 } GTXFaultSystem;
648
654 typedef struct
655 {
656 char name[16];
657 char group_name[16];
658 double z_min;
659 double z_max;
660 int n_vertices;
661 double *vertices;
662 } GTXPolygon;
663
673 typedef struct
674 {
675 int polygons_2d;
676 double ext_min[3];
677 double ext_max[3];
678 gtx_long n_polygons;
679 GTXPolygon *polygons;
680 } GTXPolygonSystem;
681
685 typedef struct
686 {
687 int n_vertices;
688 double *vertices;
690 int n_triangles;
691 int *triangles;
693 } GTXWireframeObject;
694
701 typedef struct
702 {
703 char name[50];
704 int color[3];
705 int n_objects;
706 GTXWireframeObject *objects;
707 } GTXWireframe;
708
718 typedef struct
719 {
720 int n_wireframes;
721 GTXWireframe *wireframes;
722 } GTXWireframeSystem;
723
729 typedef enum
730 {
731 GTX_CSCALE_TYPE_AUTOMATIC,
732 GTX_CSCALE_TYPE_ISOFREQ,
733 GTX_CSCALE_TYPE_MANUAL,
734 GTX_CSCALE_TYPE_FACIES,
735 GTX_CSCALE_TYPE_INVALID
736 } GTX_CSCALE_TYPE;
737
742 typedef struct
743 {
744 GTX_CSCALE_TYPE type;
745 int readonly;
746 char palette_name[50];
747 int nclasses;
748 int undef_col[3];
749 double* bounds;
750 int* pal_ind;
751 int lowval_col[3];
752 int highval_col[3];
753 int bnd_inc_low;
754 int bnd_inc_inter;
755 int bnd_inc_high;
756 int other_col[3];
757 int facies_int_nb;
758 int facies_integers;
760 double* facies_int_min;
761 double* facies_int_max;
762 int* facies_class_ind;
763 int* facies_rgbs;
764 char** facies_labels;
765 char undef_label[50];
766 char other_label[50];
767 } GTXColorScale;
768
776 typedef struct _GTXVendorDataRec* GTXVendorData;
777
778 #ifdef __cplusplus
779 extern "C" {
780 #endif
781
791 GLOBAL void (*GTX_ERROR_FUNCTION)(const char *string);
792
797 typedef enum {
798 GTX_ERROR_NONE = 0,
799 GTX_ERROR_PARAMETER,
800 GTX_ERROR_NETWORK,
801 GTX_ERROR_SERVER,
802 GTX_ERROR_MEMORY
803 } GTXErrorCode;
804
809 typedef enum
810 {
811 GTX_FEATURE_PALETTES,
812 GTX_FEATURE_COLOR_SCALES,
813 } GTXFeatureType;
814
815 /******************************************************************************/
816 /* GTXClient API functions */
817 /******************************************************************************/
818
819
820 /* @defgroup init Init/Debug functions
821 ** @{
822 */
823 GLOBAL int GTXClientInitialize(int linked_version);
824 GLOBAL void GTXClientDebug(int mode);
825 GLOBAL GTXErrorCode GTXClientGetLastError();
826 /* @}
827 */
828
829 /* @defgroup connect Connection functions
830 ** @{
831 */
832 GLOBAL unsigned short GTXClientGetDefaultPort(void);
833 GLOBAL int GTXClientLocateGTXserver(char *path);
834 GLOBAL void GTXClientSetGTXserverPath(const char *path);
835 GLOBAL int GTXClientRunGTXserver(unsigned short *port);
836 GLOBAL int GTXClientConnect(const char *host, unsigned short port, const char *path);
837 GLOBAL int GTXClientIsConnected();
838 GLOBAL int GTXClientDisconnect(void);
839 GLOBAL int GTXClientGetServerVersion();
840 GLOBAL int GTXClientServerHasFeature(GTXFeatureType type, int generate_error);
841
842 /* @}
843 */
844
845 /* Unit functions */
846 GLOBAL int GTXClientSetUnit(const char *unit);
847 GLOBAL double GTXClientUnitFactorFromSymbol(const char *symbol);
848 GLOBAL const char *GTXClientUnitSymbolFromFactor(double factor);
849 GLOBAL int GTXClientSetUnitMode(int mode);
850 GLOBAL int GTXClientSetCreationUnits(const char *x_unit, const char *y_unit, const char *z_unit);
851
852 /* Memory Management functions */
853 GLOBAL void *GTXClientFreePointer(void *pointer);
854 GLOBAL char **GTXClientFreeStringArray(gtx_long nlist, char **list);
855
856 /* Study functions */
857 GLOBAL int GTXClientGetStudyList(int *nb_study, char ***studies);
858 GLOBAL int GTXClientSetStudy(const char *study);
859 GLOBAL int GTXClientNewStudy(const char *study, const char *path);
860 GLOBAL int GTXClientDeleteStudy(void);
861
862 /* Directory functions */
863 GLOBAL int GTXClientGetDirectoryList(int *nb_dir, char ***directories);
864 GLOBAL int GTXClientDirectoryExists(const char *dir_name, int *exists);
865 GLOBAL int GTXClientSetDirectory(const char *dir);
866 GLOBAL int GTXClientNewDirectory(const char *name);
867 GLOBAL int GTXClientDeleteDirectory(void);
868
869 /* File functions */
870 GLOBAL int GTXClientGetFileList(int *nb_file, char ***files);
871 GLOBAL int GTXClientGetFileListByType(GTX_FILE_TYPE file_type, int file_dim, int *nb_file, char ***files);
872 GLOBAL int GTXClientFileExists(const char *file_name, int *exists);
873 GLOBAL int GTXClientSetFile(const char *file);
874 GLOBAL int GTXClientDeleteFile(void);
875 GLOBAL int GTXClientGetFileInfo(GTXFileInfo *file_info);
876 GLOBAL int GTXClientGetFileComment(char **comment);
877 GLOBAL int GTXClientSetFileComment(int append, const char *comment);
878 GLOBAL int GTXClientNewPointsFile(const char *name, gtx_long nsample, const double *x, const double *y, const double *z);
879 GLOBAL int GTXClientNewGridFile(const char *name, int dimension, double X0, double Y0, double Z0, double DX, double DY, double DZ, int NX, int NY, int NZ);
880 GLOBAL int GTXClientNewLinesFile(const char *name, int dimension);
881 GLOBAL int GTXClientPointsFileAppend(gtx_long nsample, const double *x, const double *y, const double *z);
882 GLOBAL int GTXClientLinesFileAddCoreLine(int nsample, double xbegin, double ybegin, double zbegin, const double *xend, const double *yend, const double *zend);
883 GLOBAL int GTXClientLinesFileAddGravityLine(int nsample, const double *xg, const double *yg, const double *zg);
884 GLOBAL int GTXClientLinesFileAddLineCoresOld(int nsample, double xbegin, double ybegin, double zbegin, const double *xend, const double *yend, const double *zend);
885 GLOBAL int GTXClientLinesFileCreateLink(const char *points_file);
886 GLOBAL int GTXClientGridModifyOrigin(double x0, double y0, double z0);
887 GLOBAL int GTXClientGridModifyMesh(double dx, double dy, double dz);
888 GLOBAL int GTXClientGridModifyRotation(double az, double ay, double ax);
889
890 /* Variable functions */
891 GLOBAL int GTXClientGetVariableList(int *nb_var, char ***vars);
892 GLOBAL int GTXClientGetVariableListByType(GTX_VAR_TYPE var_type, int *nb_var, char ***vars);
893 GLOBAL int GTXClientVariableExists(const char *var_name, int *exists);
894 GLOBAL int GTXClientSetVariable(const char *var);
895 GLOBAL int GTXClientDeleteVariable(void);
896 GLOBAL int GTXClientSetIndice(const int indice);
897 GLOBAL int GTXClientSetAlphaIndice(const char* alphaindice);
898 GLOBAL int GTXClientGetVariableInfo(GTXVariableInfo *var_info);
899 GLOBAL int GTXClientGetMacroIndices(int *nb_indices, int **indices);
900 GLOBAL int GTXClientGetMacroIndicesWithAlpha(int *nb_indices, int **indices, char ***alpha_indices);
901 GLOBAL int GTXClientAddMacroIndicesWithAlpha(const int nb_indice, const int* indices, const char * const*alpha_indices);
902 GLOBAL int GTXClientAddMacroIndices(const int nb_indice, const int* indices);
903 GLOBAL int GTXClientReadLineDoubleVariable(int line_index, double *test_val, int *nsample, double **data);
904 GLOBAL int GTXClientReadDoubleVariable(int compress, double *test_val, gtx_long *nb_val, double **data);
905 GLOBAL int GTXClientReadDoubleVariableSub(gtx_long first, gtx_long last, int compress, double *test_val, gtx_long *nb_val, double **data);
906 GLOBAL int GTXClientReadCharVariable(int compress, char **test_val, gtx_long *nb_val, char ***data);
907 GLOBAL int GTXClientReadCharVariableSub(gtx_long first, gtx_long last, int compress, char **test_val, gtx_long *nb_val, char ***data);
908 GLOBAL int GTXClientReadLineCharVariable(int line_index, char **test_val, int *nsample, char ***data);
909 GLOBAL int GTXClientReadSelectionVariable(gtx_long *nb_val, unsigned char **data);
910 GLOBAL int GTXClientReadSelectionVariableSub(gtx_long first, gtx_long last, gtx_long *nb_val, unsigned char **data);
911 GLOBAL int GTXClientNewDoubleVariable(const char *name, int bit_length, GTX_FORMAT_TYPE format_type, int format_length, int format_digits, const char *format_unit);
912 GLOBAL int GTXClientNewCharVariable(const char *name, int max_length);
913 GLOBAL int GTXClientSetVariableAsLineName(void);
914 GLOBAL int GTXClientWriteLineDoubleVariable(int line_index, double test_val, int nsample, const double *data);
915 GLOBAL int GTXClientWriteDoubleVariable(int flag_compress, double test_val, gtx_long nb_val, const double *dbl_data);
916 GLOBAL int GTXClientWriteDoubleVariableSub(gtx_long first, gtx_long last, int flag_compress, double test_val, gtx_long nb_val, const double *dbl_data);
917 GLOBAL int GTXClientWriteCharVariable(int flag_compress, const char *test_val, gtx_long nb_val, const char * const *char_data);
918 GLOBAL int GTXClientWriteCharVariableSub(gtx_long first, gtx_long last, int compress, const char *test_val, gtx_long nb_val, const char * const *data);
919 GLOBAL int GTXClientWriteLineCharVariable(int line_index, const char* test_val, int nsample, const char * const *char_data);
920 GLOBAL int GTXClientWriteSelectionVariable(const gtx_long nb_val, const unsigned char *data);
921 GLOBAL int GTXClientWriteSelectionVariableSub(const gtx_long first, const gtx_long last,const gtx_long nb_val, const unsigned char *data);
922 GLOBAL int GTXClientGetVariableComment(char **comment);
923 GLOBAL int GTXClientSetVariableComment(int append, const char *comment);
924 GLOBAL int GTXClientSetSelection(const char *sel);
925 GLOBAL int GTXClientSetVariableUnit(const char *factor, const char *symbol);
926
927 /* Fault functions */
928 GLOBAL int GTXClientReadFaults(int priority, GTXFaultSystem *fault_system);
929 GLOBAL int GTXClientWriteFaults(const GTXFaultSystem *fault_system);
930 GLOBAL void GTXClientFreeFaults(GTXFaultSystem *fault_system);
931 GLOBAL void GTXClientFaultsSegmentDuplicate(const GTXFaultSegment *fault_seg_in, GTXFaultSegment *fault_seg_out);
932 GLOBAL void GTXClientFaultDuplicate(const GTXFault *fault_in, GTXFault *fault_out);
933 GLOBAL GTXFaultSystem *GTXClientFaultSystemDuplicate(const GTXFaultSystem *fault_sys);
934
935 /* Polygon functions */
936 GLOBAL int GTXClientNewPolygonsFile(const char *name, const GTXPolygonSystem *psystem);
937 GLOBAL int GTXClientReadPolygons(GTXPolygonSystem *polygon_system);
938 GLOBAL void GTXClientFreePolygons(GTXPolygonSystem *polygon_system);
939 GLOBAL void GTXClientPolygonDuplicate(const GTXPolygon *polygon_in, GTXPolygon *polygon_out);
940 GLOBAL void GTXClientPolygonSystemDuplicate(const GTXPolygonSystem *polysys_in, GTXPolygonSystem *polysys_out);
941
942
943 /* Vendor Data functions */
944 GLOBAL GTXVendorData GTXClientVendorDataNew(const char *identificator, int version);
945 GLOBAL int GTXClientVendorDataAddAttributeInt(GTXVendorData vendor_data, const char *name, int value);
946 GLOBAL int GTXClientVendorDataAddAttributeDouble(GTXVendorData vendor_data, const char *name, double value);
947 GLOBAL int GTXClientVendorDataAddAttributeString(GTXVendorData vendor_data, const char *name, const char *value);
948 GLOBAL int GTXClientVendorDataAddAttributeIntArray(GTXVendorData vendor_data, const char *name, int nvalues, const int *values);
949 GLOBAL int GTXClientVendorDataAddAttributeDoubleArray(GTXVendorData vendor_data, const char *name, int nvalues, const double *values);
950 GLOBAL int GTXClientVendorDataAddAttributeStringArray(GTXVendorData vendor_data, const char *name, int nvalues, const char * const *values);
951 GLOBAL int GTXClientVendorDataWrite(int level, GTXVendorData vendor_data);
952 GLOBAL int GTXClientVendorDataGetVersion(const char *identificator, int level, int *version);
953 GLOBAL int GTXClientVendorDataRead(const char *identificator, int level, GTXVendorData *vendor_data, int *version);
954 GLOBAL int GTXClientVendorDataGetAttributeInt(GTXVendorData vendor_data, const char *name, int *value);
955 GLOBAL int GTXClientVendorDataGetAttributeDouble(GTXVendorData vendor_data, const char *name, double *value);
956 GLOBAL int GTXClientVendorDataGetAttributeString(GTXVendorData vendor_data, const char *name, char **value);
957 GLOBAL int GTXClientVendorDataGetAttributeIntArray(GTXVendorData vendor_data, const char *name, int *nvalues, int **values);
958 GLOBAL int GTXClientVendorDataGetAttributeDoubleArray(GTXVendorData vendor_data, const char *name, int *nvalues, double **values);
959 GLOBAL int GTXClientVendorDataGetAttributeStringArray(GTXVendorData vendor_data, const char *name, int *nvalues, char ***values);
960 GLOBAL GTXVendorData GTXClientVendorDataFree(GTXVendorData vendor_data);
961 GLOBAL int GTXClientVendorDataExists(const char *identificator, int level, int *exists);
962 GLOBAL GTXVendorData GTXClientVendorDataDuplicate(GTXVendorData vendor_data);
963
964 /* Wireframes functions */
965 GLOBAL int GTXClientReadWireframes(GTXWireframeSystem *wireframe_system);
966 GLOBAL int GTXClientNewWireframesFile(const char *filename, const GTXWireframeSystem *wireframe_system);
967 GLOBAL void GTXClientFreeWireframes(GTXWireframeSystem *wireframe_system);
968 GLOBAL void GTXClientWireframeObjectDuplicate(const GTXWireframeObject *object_in, GTXWireframeObject *object_out);
969 GLOBAL void GTXClientWireframeDuplicate(const GTXWireframe *wireframe_in, GTXWireframe *wireframe_out);
970 GLOBAL void GTXClientWireframeSystemDuplicate(const GTXWireframeSystem *wsys_in, GTXWireframeSystem *wsys_out);
971
972 /* Palettes functions */
973 GLOBAL int GTXClientPaletteGetList(int *nb_pal, char ***palettes);
974 GLOBAL int GTXClientPaletteExists(const char *cscale_name, int *exists);
975 GLOBAL int GTXClientPaletteWrite(const char *name, int ncolors, const int* rgbs);
976 GLOBAL int GTXClientPaletteRead(const char *name, int* ncolors, int** rgbs);
977 GLOBAL int GTXClientPaletteDelete(const char *name);
978
979 /* Color Scales functions */
980 GLOBAL int GTXClientColorScaleGetList(int *nb_cscales, char ***cscales);
981 GLOBAL int GTXClientColorScaleExists(const char *cscale_name, int *exists);
982 GLOBAL void GTXClientColorScaleInit(GTXColorScale *cscale);
983 GLOBAL void GTXClientColorScaleFree(GTXColorScale *cscale);
984 GLOBAL int GTXClientColorScaleNew(const char *name, const GTXColorScale* cscale);
985 GLOBAL int GTXClientColorScaleRead(const char *cscale_name, GTXColorScale *cscale);
986 GLOBAL int GTXClientColorScaleDelete(const char *name);
987
988 #ifdef __cplusplus
989 }
990 #endif
991
992 /* Stop Redefining names of C structures */
993 #ifdef __cplusplus
994 # undef GTXFault
995 # undef GTXFaultInfo
996 # undef GTXFaultSegment
997 # undef GTXFaultSystem
998 # undef GTXFileInfo
999 # undef GTXPolygon
1000 # undef GTXPolygonSystem
1001 # undef GTXVariableInfo
1002 # undef GTXVendorData
1003 # undef GTXWireframe
1004 # undef GTXWireframeObject
1005 # undef GTXWireframeSystem
1006 # undef GTXColorScale
1007 #endif
1008
1009 #endif /* _GTXClient_h */