-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathpgtiol-gTiffData.h
162 lines (141 loc) · 5.19 KB
/
pgtiol-gTiffData.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#ifndef PGTIOL_GTIFFDATA_H
#define PGTIOL_GTIFFDATA_H
#include <gdal.h>
#include <gdal_priv.h>
#include <mpi.h>
#include <vector>
#include "math.h"
#include "pgtiol-basicTypes.h"
#include "pgtiol-gTiffMetaData.h"
using namespace std;
class gTiffData {
public:
gTiffData(void);
~gTiffData(void);
bool setInputFileName(char*fileName);
bool setOutputFileName(char*fileName);
bool readDataFromGDAL(long xstart,long ystart, long numRows,long numCols,void* dest,GDALDataType type,int iband);
bool readData(long xstart,
long ystart,
long numRows,
long numCols,
void* dest,
GDALDataType type,
int iband,
gTiffMetaData*iMeataData);
void initWrite();
bool writeData(long xstart,
long ystart,
long numRows,
long numCols,
void* source,
GDALDataType type,
gTiffMetaData*iMeataData,
long nLineSpace);
private:
char inputgTiff[MAXLEN];
char outputgTiff[MAXLEN];
int rank;
bool write_area(gTiffMetaData*iMeataData,
void *data,
double ul_x,
double ul_y,
double lr_x,
double lr_y,
long nLineSpace);
Area calculate_tile_intersection(gTiffMetaData*iMeataData, Area subset);
bool fill_stack(std::vector<Area> *write_stack,
Area old_area,
Area written_subset);
bool write_subset(MPI_File&fh,gTiffMetaData*iMeataData,
void *data,
int64_t buffer_ul_x,
int64_t buffer_ul_y,
int64_t buffer_lr_x,
int64_t buffer_lr_y,
int64_t write_ul_x,
int64_t write_ul_y,
int64_t write_lr_x,
int64_t write_lr_y,
long nLineSpace);
int64_t calculate_file_offset(gTiffMetaData*iMeataData,
const int64_t raster_x,
const int64_t raster_y);
bool readStripData(long xstart,
long ystart,
long numRows,
long numCols,
void* dest,
gTiffMetaData*iMeataData);
void getStripRowData(void* dest,
MPI_File&fh,
long currentStripFirstRowIndex,
long currentStripLastRowIndex,
long currentStripIndex,
long readCols,
uint32_t stripWidth,
uint32_t stripLength,
unsigned short sampleFormat,
unsigned short dataSizeFileIn,
double NoData,
GDALDataType dataType,
Rectangle rectangle);
template <class Soutype,class Destype>
void readStripByRow(MPI_File&fh,
Soutype type1,
Destype type2,
long currentStripIndex,
long currentRowIndex,
long readCols,
uint32_t stripWidth,
uint32_t stripLength,
unsigned short dataSizeFileIn,
Rectangle rectangle,
double NoData,
Soutype*tempbuff,
void*dest);
bool readTileData(long xstart,
long ystart,
long numRows,
long numCols,
void* dest,
gTiffMetaData*iMeataData);
template <class memType>
memType*getMem(memType type,long memSize);
template <class Soutype,class Destype>
void readTileDataByRow(MPI_File&fh,
Soutype type1,
Destype type2,
long tileCols,
uint32_t destOffset,
long tileWidth,
unsigned short dataSizeFileIn,
double NoData,
Soutype*tempbuff,
long readBytes,
void*dest);
bool readTileDataByRows(long xstart,
long ystart,
long numRows,
long numCols,
void* dest,
gTiffMetaData*iMeataData);
bool readTileDataByCols(long xstart,
long ystart,
long numRows,
long numCols,
void* dest,
gTiffMetaData*iMeataData);
template <class Soutype,class Destype>
bool readTileDataByCol( Soutype type1,
Destype type2,
uint32_t ReadstartX,
uint32_t ReadendX,
uint32_t tileCols,
uint32_t destOffset,
unsigned short dataSizeFileIn,
Soutype *tempDataRow,
MPI_File&fh,
void*dest);
};
#endif