FEDEM Solver  R8.0
Source code of the dynamics solver
FFrVariable.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
8 #ifndef FFR_VARIABLE_H
9 #define FFR_VARIABLE_H
10 
11 #include "FFrLib/FFrEnums.H"
13 #include <string>
14 #include <vector>
15 #include <set>
16 #include <cstdio>
17 
18 class FFrCreatorData;
19 
20 
22 {
23 public:
24  enum VDType { NONE, CHAR, UCHAR, INT, UINT, FLOAT };
25 
26 private:
28  FFaEnumEntry(NONE, "NONE");
29  FFaEnumEntry(CHAR, "CHAR");
30  FFaEnumEntry(UCHAR, "UCHAR");
31  FFaEnumEntry(INT, "INT");
32  FFaEnumEntry(UINT, "UINT");
33  FFaEnumEntry(FLOAT, "FLOAT");
35  };
36 
37 public:
38 #if FFR_DEBUG > 2
39  FFrVariable();
40  ~FFrVariable();
41 #else
43 #endif
44 
45  static FFrStatus create(FILE* varStream, FFrCreatorData& cd, bool dataBlocks);
46 
47  int fillObject(const std::vector<std::string>& tokens);
48 
49  void dump(std::ostream& os = std::cout) const;
50 
51  size_t getTotalDataSize() const { return dataSize*repeats; }
52  size_t getRepeats() const { return repeats; }
53 
54  bool equal(const FFrVariable* that) const;
55  bool less(const FFrVariable* that) const;
56 
57  struct Less
58  {
59  bool operator()(const FFrVariable* a, const FFrVariable* b) const { return a->less(b); }
60  };
61 
62 #if FFR_DEBUG > 2
63 private:
64  static long int count;
65  long int myCount;
66 #endif
67 
68 public:
69  std::string name;
70  std::string unit; // fix this to iterator in a library of units
71  VDTypeEnum dataType;
72  std::string dataClass; // fix this to iterator in a library of classes
73  size_t dataSize;
74  size_t repeats;
75  std::vector<size_t> dataBlockSizes;
76  std::vector<std::string> dataBlockDescription;
77 };
78 
79 typedef std::set<FFrVariable*,FFrVariable::Less> VariableSet;
80 typedef VariableSet::const_iterator VariableSetIt;
81 
82 #endif
Enum variables with text representations.
#define FFaEnumEntryEnd
Defines the end of an enum mapping definition.
Definition: FFaEnum.H:238
#define FFaEnumEntry(EnumValue, EnumText)
Adds one entry to the current enum mapping definition.
Definition: FFaEnum.H:234
FFrStatus
Definition: FFrEnums.H:12
std::set< FFrVariable *, FFrVariable::Less > VariableSet
Definition: FFrVariable.H:79
VariableSet::const_iterator VariableSetIt
Definition: FFrVariable.H:80
Definition: FFrVariable.H:22
size_t repeats
Definition: FFrVariable.H:74
std::vector< std::string > dataBlockDescription
Definition: FFrVariable.H:76
void dump(std::ostream &os=std::cout) const
Definition: FFrVariable.C:154
size_t dataSize
Definition: FFrVariable.H:73
int fillObject(const std::vector< std::string > &tokens)
Definition: FFrVariable.C:107
std::string name
Definition: FFrVariable.H:69
std::string unit
Definition: FFrVariable.H:70
FFaEnumMapping(VDType)
Definition: FFrVariable.H:27
VDType
Definition: FFrVariable.H:24
@ UCHAR
Definition: FFrVariable.H:24
@ INT
Definition: FFrVariable.H:24
@ UINT
Definition: FFrVariable.H:24
@ NONE
Definition: FFrVariable.H:24
@ CHAR
Definition: FFrVariable.H:24
@ FLOAT
Definition: FFrVariable.H:24
size_t getRepeats() const
Definition: FFrVariable.H:52
std::vector< size_t > dataBlockSizes
Definition: FFrVariable.H:75
bool less(const FFrVariable *that) const
Definition: FFrVariable.C:194
VDTypeEnum dataType
Definition: FFrVariable.H:71
size_t getTotalDataSize() const
Definition: FFrVariable.H:51
static FFrStatus create(FILE *varStream, FFrCreatorData &cd, bool dataBlocks)
Definition: FFrVariable.C:31
FFrVariable()
Definition: FFrVariable.H:42
bool equal(const FFrVariable *that) const
Definition: FFrVariable.C:179
std::string dataClass
Definition: FFrVariable.H:72
real(sp), dimension(:,:,:), pointer b
Definition: diffractionModule.f90:22
real(sp), dimension(:,:,:), pointer a
Definition: diffractionModule.f90:21
Incapsulation of temporary data used during results file parsing.
Definition: FFrResultContainer.H:36
Definition: FFrVariable.H:58
bool operator()(const FFrVariable *a, const FFrVariable *b) const
Definition: FFrVariable.H:59