Peano
Loading...
Searching...
No Matches
NetCDFFieldParser.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5#include "config.h"
6
7#ifdef UseNetCDF
8
9#include "NetCDFFileReader.h"
10#include "tarch/logging/Log.h"
11
12namespace tarch::reader {
13 class NetCDFFieldParser;
14} // namespace tarch::reader
15
16class tarch::reader::NetCDFFieldParser {
17private:
19
20 NetCDFFileReader _netCDFFileReader;
21
22 double* _topology = nullptr;
23 double* _displacement = nullptr;
24
25 const char* _ncTopologyKey = nullptr;
26 const char* _ncTopologyKeyX = nullptr;
27 const char* _ncTopologyKeyY = nullptr;
28
29 const char* _ncDisplacementKey = nullptr;
30 const char* _ncDisplacementKeyX = nullptr;
31 const char* _ncDisplacementKeyY = nullptr;
32
33 std::size_t _lengthOfTopologyInX = 0;
34 std::size_t _lengthOfTopologyInY = 0;
35 std::size_t _lengthOfDisplacementInX = 0;
36 std::size_t _lengthOfDisplacementInY = 0;
37
38 double _lengthOfSimulationDomainInX = -1;
39 double _lengthOfSimulationDomainInY = -1;
40 double _offsetOfSimulationDomainInX = -1;
41 double _offsetOfSimulationDomainInY = -1;
42
43 double _minXCoordinateInTopology = 1;
44 double _minYCoordinateInTopology = 1;
45 double _maxXCoordinateInTopology = -1;
46 double _maxYCoordinateInTopology = -1;
47
48 double _minXCoordinateInDisplacement = 1;
49 double _minYCoordinateInDisplacement = 1;
50 double _maxXCoordinateInDisplacement = -1;
51 double _maxYCoordinateInDisplacement = -1;
52
53 void parseTopologyFile(const char* bathymetryFilePath);
54 void parseDisplacementFile(const char* displacementFilePath);
55
62 double transformIndexSimulationToCDFRange(
63 double coordinateOfDimensionZInSimulationSpace,
64 double sizeOfSimulationSpaceInZDirection,
65 double minIndexOfCDFspaceInZDirection,
66 double maxIndexOfCDFspaceInZDirection,
67 double offsetOfSimulationSpaceInZDirection
68 );
69
76 int transformIndexCDFRangeToArray(
77 double xCoordinateInCDFMesh,
78 double yCoordinateInCDFMesh,
79 double minXCoordinateInCDFMesh,
80 double minYCoordinateInCDFMesh,
81 double maxXCoordinateInCDFMesh,
82 double maxYCoordinateInCDFMesh,
83 std::size_t lengthOfXDimensionInCDFMesh,
84 std::size_t lengthOfYDimensionInCDFMesh
85 );
86
87public:
88 NetCDFFieldParser(
89 const char* bathymetryFilePath,
90 const char* displacementFilePath,
91 double lengthOfSimulationDomainInX,
92 double lengthOfSimulationDomainInY,
93 double offsetOfSimulationDomainInX,
94 double offsetOfSimulationDomainInY,
95 const char* ncTopologyKey = "z",
96 const char* ncTopologyKeyX = "x",
97 const char* ncTopologyKeyY = "y",
98 const char* ncDisplacementKey = "z",
99 const char* ncDisplacementKeyX = "x",
100 const char* ncDisplacementKeyY = "y"
101 );
102
103 NetCDFFieldParser(
104 const char* bathymetryFilePath,
105 double lengthOfSimulationDomainInX,
106 double lengthOfSimulationDomainInY,
107 double offsetOfSimulationDomainInX,
108 double offsetOfSimulationDomainInY,
109 const char* ncTopologyKey = "z",
110 const char* ncTopologyKeyX = "x",
111 const char* ncTopologyKeyY = "y"
112 );
113
114 ~NetCDFFieldParser();
115
116 double sampleTopology(double x, double y);
117 double sampleDisplacement(double x, double y);
118};
119
120#endif
Log Device.
Definition Log.h:517