FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
netcdf_handler.h
1#pragma once
2
3#include "netcdf.h"
4
5#include <cmath>
6#include <fstream>
7#include <iostream>
8#include <string>
9#include <vector>
10
29{
35 const int U_V_FILE = 0;
36 const int Z_X_VELOCITY_FILE = 1;
37 const int Z_PROFILE_FILE = 2;
38 const int U_V_W_FILE = 3;
40
41 int ncid;
42 int type = U_V_FILE;
43
48 size_t dim1 = -1;
49 size_t dim2 = -1;
50 size_t dim3 = -1;
52
55 int xdim = -1;
56 int ydim = -1;
57 int zdim = -1;
59
65 float* geo1;
66 float* geo2;
67 float* geo3;
69
72 float low1, low2, low3;
73 float diff1, diff2, diff3;
75
78 float minVal;
79 float meanVal;
80 float maxVal;
82
83 bool hasCachedValues = false;
84
90 std::vector<std::vector<std::vector<float>>> currentFieldU;
91 std::vector<std::vector<std::vector<float>>> currentFieldV;
92 std::vector<std::vector<std::vector<float>>> currentFieldW;
94
95public:
106 void readNCFile(const char* filename);
107
112
115
120 void getDomainBounds(float* bounds);
121
127 int getVar(char* name);
128
137 int getCurrentSpeedAt(float x, float y, float z, float* value);
138
144 int calculateDescriptorValues(float* values);
145
150};
Definition netcdf_handler.h:29
void closeNCFile()
Close the NetCDF file and release the file handle.
int calculateDescriptorValues(float *values)
int cacheCurrentField()
void getDomainBounds(float *bounds)
int getVar(char *name)
bool isProfileFile()
int getCurrentSpeedAt(float x, float y, float z, float *value)
void readNCFile(const char *filename)