AtilaCalculatorSoftware  2.3.4
C++ Interface for Atila fem resources files
result.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Project: AtilaCalculatorSoftware
4  File: result.h
5 
6  Copyright (c) 2020
7  All rights reserved.
8 
9 =========================================================================*/
10 #ifndef ATILACALCULATORSOFTWARE_RESULT_H
11 #define ATILACALCULATORSOFTWARE_RESULT_H
12 
13 #include "core/mesh.h"
14 #include "logger/logger.h"
15 
16 #include <cstring>
17 #include <exception>
18 #include <memory>
19 #include <string>
20 #include <tuple>
21 #include <vector>
22 #include <zlib.h>
23 
28 class Result {
29  public:
35  Result(gzFile file, dataFields fields, int componentCount);
36 
40  std::string getAnalysis();
41 
45  std::string getResultType();
46 
50  float getStep() const;
51 
55  int getComponentCount() const;
56 
60  unsigned int getValuesCount() const;
61 
65  std::vector<std::string> getComponents();
66 
71  std::tuple<int&, float*> getResult(const unsigned int& id);
72 
73  // /**
74  // * @brief Write the result into a currently open PostResultFile
75  // * @return The state of the GiD Post Result closure
76  // */
77  // const int toPostGid();
78 
79  private:
86  void readComponents(gzFile file, char buffer[GZ_BUFFER_SIZE], dataFields fields);
87 
93  void readResults(gzFile file, char buffer[GZ_BUFFER_SIZE]);
94 
98  std::string analysis;
99 
103  std::string result;
104 
108  float step;
109 
114 
118  unsigned int valuesCount;
119 
123  std::vector<std::string> components;
124 
128  int* nodeIDs;
129 
130 
134  float* values;
135 };
136 
137 #endif // ATILACALCULATORSOFTWARE_RESULT_H
void readResults(gzFile file, char buffer[GZ_BUFFER_SIZE])
Definition: result.cpp:101
float step
Time step inside the analysis.
Definition: result.h:108
Result(gzFile file, dataFields fields, int componentCount)
Definition: result.cpp:16
std::string result
Type of results.
Definition: result.h:103
std::string analysis
Type of analysis.
Definition: result.h:98
int componentCount
Number of components of the result.
Definition: result.h:113
Representation of all the results and their components read from a res file.
Definition: result.h:28
float getStep() const
Definition: result.cpp:50
int getComponentCount() const
Definition: result.cpp:52
std::vector< std::string > getComponents()
Definition: result.cpp:55
std::vector< std::string > components
Components of the result (size = componentCount)
Definition: result.h:123
#define GZ_BUFFER_SIZE
Buffer size for gzread uses.
Definition: utilities.h:26
int * nodeIDs
List of IDs of the nodes involved in the result.
Definition: result.h:128
std::string getAnalysis()
Definition: result.cpp:47
unsigned int getValuesCount() const
Definition: result.cpp:53
std::string getResultType()
Definition: result.cpp:48
void readComponents(gzFile file, char buffer[GZ_BUFFER_SIZE], dataFields fields)
Write the result into a currently open PostResultFile.
Definition: result.cpp:73
float * values
Values of the result.
Definition: result.h:134
unsigned int valuesCount
Number of values read.
Definition: result.h:118
std::tuple< int &, float * > getResult(const unsigned int &id)
Definition: result.cpp:61
char dataFields[10][40]
Definition: utilities.h:76