Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Fabian.Wein
ParaView
Commits
e490ce30
Commit
e490ce30
authored
Jun 26, 2022
by
Fabian.Wein
Browse files
changed more code style to comply with guidelines
parent
299dc748
Pipeline
#287104
waiting for manual action with stages
in 0 seconds
Changes
5
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Plugins/CFSReader/Reader/hdf5Common.cc
View file @
e490ce30
...
...
@@ -161,7 +161,7 @@ void ReadAttribute<std::string>(hid_t loc_id, const std::string& objName, const
//-----------------------------------------------------------------------------
std
::
vector
<
unsigned
int
>
GetArrayDims
(
hid_t
loc
,
const
std
::
string
&
name
)
{
hid_t
set
=
OpenDataSet
(
loc
,
name
);
hid_t
set
=
H5CFS
::
OpenDataSet
(
loc
,
name
);
hid_t
space_id
=
H5Dget_space
(
set
);
if
(
H5Sis_simple
(
space_id
)
<=
0
)
...
...
@@ -193,7 +193,7 @@ std::vector<unsigned int> GetArrayDims(hid_t loc, const std::string& name)
//-----------------------------------------------------------------------------
unsigned
int
GetNumEntries
(
hid_t
id
,
const
std
::
string
&
name
)
{
hid_t
set
=
OpenDataSet
(
id
,
name
);
hid_t
set
=
H5CFS
::
OpenDataSet
(
id
,
name
);
hid_t
dspace
=
H5Dget_space
(
set
);
if
(
H5Sis_simple
(
dspace
)
<=
0
)
...
...
@@ -240,7 +240,7 @@ void ReadDataSet<int>(hid_t loc, const std::string& name, int* out)
template
<
>
void
ReadDataSet
<
unsigned
int
>
(
hid_t
loc
,
const
std
::
string
&
name
,
unsigned
int
*
out
)
{
return
ReadDataSet
(
loc
,
name
,
reinterpret_cast
<
int
*>
(
out
));
// no uint version in HL available :(
return
H5CFS
::
ReadDataSet
(
loc
,
name
,
reinterpret_cast
<
int
*>
(
out
));
// no uint version in HL available :(
}
//-----------------------------------------------------------------------------
...
...
@@ -261,9 +261,9 @@ void ReadDataSet<std::string>(hid_t loc, const std::string& name, std::string* o
template
<
typename
TYPE
>
TYPE
ReadDataSet
(
hid_t
loc
,
const
std
::
string
&
name
)
{
assert
(
GetNumEntries
(
loc
,
name
)
==
1
);
assert
(
H5CFS
::
GetNumEntries
(
loc
,
name
)
==
1
);
TYPE
val
;
ReadDataSet
(
loc
,
name
,
&
val
);
H5CFS
::
ReadDataSet
(
loc
,
name
,
&
val
);
return
val
;
}
...
...
@@ -271,15 +271,15 @@ TYPE ReadDataSet(hid_t loc, const std::string& name)
template
<
typename
TYPE
>
void
ReadArray
(
hid_t
loc
,
const
std
::
string
&
name
,
std
::
vector
<
TYPE
>&
data
)
{
data
.
resize
(
GetNumEntries
(
loc
,
name
));
ReadDataSet
(
loc
,
name
,
data
.
data
());
// directly write to the vector data space
data
.
resize
(
H5CFS
::
GetNumEntries
(
loc
,
name
));
H5CFS
::
ReadDataSet
(
loc
,
name
,
data
.
data
());
// directly write to the vector data space
}
//-----------------------------------------------------------------------------
template
<
>
void
ReadArray
<
std
::
string
>
(
hid_t
loc
,
const
std
::
string
&
name
,
std
::
vector
<
std
::
string
>&
data
)
{
const
unsigned
int
n
=
GetNumEntries
(
loc
,
name
);
const
unsigned
int
n
=
H5CFS
::
GetNumEntries
(
loc
,
name
);
// the incomplete hdf5 documentation is hell :( We use RAII instead of char** buffer = new char*[n];
std
::
vector
<
char
*>
buffer
(
n
);
if
(
H5LTread_dataset_string
(
loc
,
name
.
c_str
(),
reinterpret_cast
<
char
*>
(
buffer
.
data
()))
<
0
)
...
...
@@ -309,7 +309,7 @@ std::string GetMultiStepKey(unsigned int msStep, bool isHistory)
//-----------------------------------------------------------------------------
hid_t
GetMultiStepGroup
(
hid_t
root
,
unsigned
int
msStep
,
bool
isHistory
)
{
return
OpenGroup
(
root
,
GetMultiStepKey
(
msStep
,
isHistory
));
return
H5CFS
::
OpenGroup
(
root
,
H5CFS
::
GetMultiStepKey
(
msStep
,
isHistory
));
}
...
...
@@ -317,8 +317,8 @@ hid_t GetMultiStepGroup(hid_t root, unsigned int msStep, bool isHistory)
hid_t
GetStepGroup
(
hid_t
root
,
unsigned
int
msStep
,
unsigned
int
stepNum
)
{
// no history but element/node result
std
::
string
key
=
GetMultiStepKey
(
msStep
,
false
)
+
std
::
string
(
"/Step_"
)
+
std
::
string
(
std
::
to_string
(
stepNum
));
return
OpenGroup
(
root
,
key
);
std
::
string
key
=
H5CFS
::
GetMultiStepKey
(
msStep
,
false
)
+
std
::
string
(
"/Step_"
)
+
std
::
string
(
std
::
to_string
(
stepNum
));
return
H5CFS
::
OpenGroup
(
root
,
key
);
}
//-----------------------------------------------------------------------------
...
...
@@ -364,10 +364,10 @@ std::string MapUnknownTypeAsString(EntityType t)
return
definedOn
;
}
template
void
ReadArray
<
unsigned
int
>(
hid_t
loc
,
const
std
::
string
&
name
,
std
::
vector
<
unsigned
int
>&
data
);
template
void
ReadArray
<
int
>(
hid_t
loc
,
const
std
::
string
&
name
,
std
::
vector
<
int
>&
data
);
template
void
ReadArray
<
double
>(
hid_t
loc
,
const
std
::
string
&
name
,
std
::
vector
<
double
>&
data
);
template
unsigned
int
ReadDataSet
<
unsigned
int
>(
hid_t
loc
,
const
std
::
string
&
name
);
template
std
::
string
ReadDataSet
<
std
::
string
>(
hid_t
loc
,
const
std
::
string
&
name
);
template
void
H5CFS
::
ReadArray
<
unsigned
int
>(
hid_t
loc
,
const
std
::
string
&
name
,
std
::
vector
<
unsigned
int
>&
data
);
template
void
H5CFS
::
ReadArray
<
int
>(
hid_t
loc
,
const
std
::
string
&
name
,
std
::
vector
<
int
>&
data
);
template
void
H5CFS
::
ReadArray
<
double
>(
hid_t
loc
,
const
std
::
string
&
name
,
std
::
vector
<
double
>&
data
);
template
unsigned
int
H5CFS
::
ReadDataSet
<
unsigned
int
>(
hid_t
loc
,
const
std
::
string
&
name
);
template
std
::
string
H5CFS
::
ReadDataSet
<
std
::
string
>(
hid_t
loc
,
const
std
::
string
&
name
);
}
// end of namespace H5CFS
Plugins/CFSReader/Reader/hdf5Reader.cc
View file @
e490ce30
This diff is collapsed.
Click to expand it.
Plugins/CFSReader/Reader/hdf5Reader.h
View file @
e490ce30
...
...
@@ -77,15 +77,15 @@ public:
*/
unsigned
int
GetGridOrder
()
const
;
unsigned
int
GetNumNodes
()
const
{
return
n
umNodes
_
;
}
unsigned
int
GetNumNodes
()
const
{
return
N
umNodes
;
}
unsigned
int
GetNumElems
()
const
{
return
n
umElems
_
;
}
unsigned
int
GetNumElems
()
const
{
return
N
umElems
;
}
unsigned
int
GetNumRegions
()
const
{
return
r
egionNames
_
.
size
();
}
unsigned
int
GetNumRegions
()
const
{
return
R
egionNames
.
size
();
}
unsigned
int
GetNumNamedNodes
()
const
{
return
n
odeNames
_
.
size
();
}
unsigned
int
GetNumNamedNodes
()
const
{
return
N
odeNames
.
size
();
}
unsigned
int
GetNumNamedElems
()
const
{
return
e
lemNames
_
.
size
();
}
unsigned
int
GetNumNamedElems
()
const
{
return
E
lemNames
.
size
();
}
/**
* Get all nodal coordinates
...
...
@@ -126,17 +126,17 @@ public:
* a number type (unsigned int, unsigned int32), the regionId of an element can
* be directly used as index to the regions-vector
*/
const
std
::
vector
<
std
::
string
>&
GetAllRegionNames
()
{
return
r
egionNames
_
;
}
const
std
::
vector
<
std
::
string
>&
GetAllRegionNames
()
{
return
R
egionNames
;
}
/**
* Returns a vector which contains all names of named nodes.
*/
const
std
::
vector
<
std
::
string
>&
GetNodeNames
()
{
return
n
odeNames
_
;
}
const
std
::
vector
<
std
::
string
>&
GetNodeNames
()
{
return
N
odeNames
;
}
/**
* Returns a vector which contains all names of element groups
*/
const
std
::
vector
<
std
::
string
>&
GetElemNames
()
{
return
e
lemNames
_
;
}
const
std
::
vector
<
std
::
string
>&
GetElemNames
()
{
return
E
lemNames
;
}
/**
* Get entities (nodes, elements), on which a result is defined on
...
...
@@ -184,73 +184,73 @@ private:
* Main hdf5 file, HDF-C-API object type
*/
//!
hid_t
m
ainFile
_
=
-
1
;
hid_t
M
ainFile
=
-
1
;
/**
* Root group of main file
*/
hid_t
m
ainRoot
_
=
-
1
;
hid_t
M
ainRoot
=
-
1
;
/**
* Root group for mesh section
*/
hid_t
m
eshRoot
_
=
-
1
;
hid_t
M
eshRoot
=
-
1
;
std
::
string
f
ileName
_
;
std
::
string
F
ileName
;
/**
* Native directory path to hdf5 file
*/
std
::
string
b
aseDir
_
;
std
::
string
B
aseDir
;
/**
* Flag indicating use of external files for mesh results
*/
bool
h
asExternalFiles
_
=
false
;
bool
H
asExternalFiles
=
false
;
std
::
vector
<
std
::
string
>
r
egionNames
_
;
std
::
vector
<
std
::
string
>
R
egionNames
;
/**
* Map with number of dimensions for each region
* Surface regions have lower dimensions than volume regions.
*/
std
::
map
<
std
::
string
,
unsigned
int
>
r
egionDims
_
;
std
::
map
<
std
::
string
,
unsigned
int
>
R
egionDims
;
/**
* Map with element numbers for each region
*/
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
int
>>
r
egionElems
_
;
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
int
>>
R
egionElems
;
/**
* Map with node numbers for each region
*/
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
int
>>
r
egionNodes
_
;
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
int
>>
R
egionNodes
;
/**
* List with names of node groups
*/
std
::
vector
<
std
::
string
>
n
odeNames
_
;
std
::
vector
<
std
::
string
>
N
odeNames
;
/**
* List with names of element groups
*/
std
::
vector
<
std
::
string
>
e
lemNames
_
;
std
::
vector
<
std
::
string
>
E
lemNames
;
/**
* Map with element numbers for each named element group
*/
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
int
>>
e
ntityElems
_
;
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
int
>>
E
ntityElems
;
/**
* Map with element numbers for each named element and node group
*/
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
int
>>
e
ntityNodes
_
;
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
int
>>
E
ntityNodes
;
unsigned
int
n
umNodes
_
=
0
;
unsigned
int
N
umNodes
=
0
;
unsigned
int
n
umElems
_
=
0
;
unsigned
int
N
umElems
=
0
;
std
::
vector
<
double
>
n
odeCoords
_
;
std
::
vector
<
double
>
N
odeCoords
;
};
// end of class
}
// end of namespace H5CFS
...
...
Plugins/CFSReader/Reader/vtkCFSReader.cxx
View file @
e490ce30
This diff is collapsed.
Click to expand it.
Plugins/CFSReader/Reader/vtkCFSReader.h
View file @
e490ce30
...
...
@@ -174,7 +174,7 @@ public:
{
this
->
ComplexModeReal
=
flag
;
// In addition trigger resetting the data value arrays
this
->
r
esetDataArrays
=
true
;
this
->
R
esetDataArrays
=
true
;
// update pipeline
this
->
Modified
();
}
...
...
@@ -184,7 +184,7 @@ public:
{
this
->
ComplexModeImag
=
flag
;
// In addition trigger resetting the data value arrays
this
->
r
esetDataArrays
=
true
;
this
->
R
esetDataArrays
=
true
;
// update pipeline
this
->
Modified
();
}
...
...
@@ -194,7 +194,7 @@ public:
{
this
->
ComplexModeAmpl
=
flag
;
// In addition trigger resetting the data value arrays
this
->
r
esetDataArrays
=
true
;
this
->
R
esetDataArrays
=
true
;
// update pipeline
this
->
Modified
();
}
...
...
@@ -204,7 +204,7 @@ public:
{
this
->
ComplexModePhase
=
flag
;
// In addition trigger resetting the data value arrays
this
->
r
esetDataArrays
=
true
;
this
->
R
esetDataArrays
=
true
;
// update pipeline
this
->
Modified
();
}
...
...
@@ -225,14 +225,14 @@ public:
/**
* Return spatial dimension of grid
*/
int
GetGridDimension
()
const
{
return
d
imension
_
;
}
int
GetGridDimension
()
const
{
return
D
imension
;
}
int
GetGridOrder
()
const
{
return
g
ridOrder
_
;
}
int
GetGridOrder
()
const
{
return
G
ridOrder
;
}
/**
* Get the number of cell arrays available in the input.
*/
int
GetNumberOfRegionArrays
()
const
{
return
static_cast
<
int
>
(
r
egionNames
_
.
size
());
}
int
GetNumberOfRegionArrays
()
const
{
return
static_cast
<
int
>
(
R
egionNames
.
size
());
}
///@{
/** Get/Set whether the cell array with the given name is to
...
...
@@ -248,7 +248,7 @@ public:
*/
const
char
*
GetRegionArrayName
(
int
index
);
int
GetNumberOfNamedNodeArrays
()
const
{
return
static_cast
<
int
>
(
n
amedNodeNames
_
.
size
());
}
int
GetNumberOfNamedNodeArrays
()
const
{
return
static_cast
<
int
>
(
N
amedNodeNames
.
size
());
}
///@{
/**
...
...
@@ -261,7 +261,7 @@ public:
const
char
*
GetNamedNodeArrayName
(
int
index
);
int
GetNumberOfNamedElemArrays
()
const
{
return
static_cast
<
int
>
(
n
amedElemNames
_
.
size
());
}
int
GetNumberOfNamedElemArrays
()
const
{
return
static_cast
<
int
>
(
N
amedElemNames
.
size
());
}
///@{
/**
...
...
@@ -385,7 +385,7 @@ private:
/**
* This object encapsulates the openCFS hfdf file with some service functions
*/
H5CFS
::
Hdf5Reader
r
eader
_
;
H5CFS
::
Hdf5Reader
R
eader
;
/**
* exposed via vtkGetStringMacro(FileName)
...
...
@@ -403,124 +403,126 @@ private:
/**
* dimension of the grid (2 or 3)
*/
int
d
imension
_
=
0
;
int
D
imension
=
0
;
/**
* order of grid (linear case 1)
*/
int
g
ridOrder
_
=
0
;
int
G
ridOrder
=
0
;
std
::
vector
<
std
::
string
>
r
egionNames
_
;
std
::
vector
<
std
::
string
>
R
egionNames
;
std
::
vector
<
std
::
string
>
n
amedElemNames
_
;
std
::
vector
<
std
::
string
>
N
amedElemNames
;
std
::
vector
<
std
::
string
>
n
amedNodeNames
_
;
std
::
vector
<
std
::
string
>
N
amedNodeNames
;
/**
* map (region, globalNodeNumber)->(regionLocalNodeNumber)
*/
std
::
vector
<
std
::
vector
<
unsigned
int
>>
n
odeMap
_
;
std
::
vector
<
std
::
vector
<
unsigned
int
>
>
N
odeMap
;
/**
* time steps of current multisequence step
*/
std
::
vector
<
double
>
s
tepVals
;
std
::
vector
<
double
>
S
tepVals
;
/**
* vector with step values having a result
*/
std
::
vector
<
unsigned
int
>
s
tepNums
;
std
::
vector
<
unsigned
int
>
S
tepNums
;
/**
* multiblock dataset, which contains for each
* region an initialized grid
*/
vtkMultiBlockDataSet
*
mb
DataSet
=
nullptr
;
vtkMultiBlockDataSet
*
MB
DataSet
=
nullptr
;
/**
* reduced multiblock dataset, which contains
* only blocks for currently active regions
*/
vtkMultiBlockDataSet
*
mb
ActiveDataSet
=
nullptr
;
vtkMultiBlockDataSet
*
MB
ActiveDataSet
=
nullptr
;
/**
* flag array indicating active regions
*/
std
::
map
<
std
::
string
,
int
>
r
egionSwitch
;
std
::
map
<
std
::
string
,
int
>
R
egionSwitch
;
/**
* flag array indicating named nodes to read
*/
std
::
map
<
std
::
string
,
int
>
n
amedNodeSwitch
;
std
::
map
<
std
::
string
,
int
>
N
amedNodeSwitch
;
/**
* flag array indicating named elems to read
*/
std
::
map
<
std
::
string
,
int
>
n
amedElemSwitch
;
std
::
map
<
std
::
string
,
int
>
N
amedElemSwitch
;
/**
* flag indicating change of multisequence step
*/
bool
ms
StepChanged
=
false
;
bool
MS
StepChanged
=
false
;
/**
* Analysis type of multi-sequence steps with mesh results
*/
std
::
map
<
unsigned
int
,
H5CFS
::
AnalysisType
>
r
esAnalysisType
_
;
std
::
map
<
unsigned
int
,
H5CFS
::
AnalysisType
>
R
esAnalysisType
;
/**
* ResultInfo of mesh results per multi-sequence step
*/
std
::
map
<
unsigned
int
,
std
::
vector
<
std
::
shared_ptr
<
H5CFS
::
ResultInfo
>>>
m
eshResultInfos
_
;
std
::
map
<
unsigned
int
,
std
::
vector
<
std
::
shared_ptr
<
H5CFS
::
ResultInfo
>>>
M
eshResultInfos
;
/**
* Analysis type of multi-sequence step with history results
*/
std
::
map
<
unsigned
int
,
H5CFS
::
AnalysisType
>
h
istAnalysisType
_
;
std
::
map
<
unsigned
int
,
H5CFS
::
AnalysisType
>
H
istAnalysisType
;
/**
* ResultInfo of history results per multi-sequence step
*/
std
::
map
<
unsigned
int
,
std
::
vector
<
std
::
shared_ptr
<
H5CFS
::
ResultInfo
>>>
h
istResultInfos
_
;
std
::
map
<
unsigned
int
,
std
::
vector
<
std
::
shared_ptr
<
H5CFS
::
ResultInfo
>>>
H
istResultInfos
;
/**
* Global steps per multisequence where ANY result is available
*/
std
::
map
<
unsigned
int
,
std
::
set
<
std
::
pair
<
unsigned
int
,
double
>>>
g
lobalResultSteps
_
;
std
::
map
<
unsigned
int
,
std
::
set
<
std
::
pair
<
unsigned
int
,
double
>>>
G
lobalResultSteps
;
/**
* Current multisequence step
* Current multisequence step
, exposed by vtk macro
*/
unsigned
int
MultiSequenceStep
=
1
;
/**
* Analysis type of current multisequence step
*/
H5CFS
::
AnalysisType
a
nalysisType
=
H5CFS
::
NO_ANALYSIS_TYPE
;
H5CFS
::
AnalysisType
A
nalysisType
=
H5CFS
::
NO_ANALYSIS_TYPE
;
/**
* Current time step (for discrete time steps)
* Current time step (for discrete time steps)
, exposed by vtk macro
*/
unsigned
int
TimeStep
=
1
;
/**
* Current time step / frequency value pretty printed
*/
double
t
imeFreqVal
=
0.0
;
double
T
imeFreqVal
=
0.0
;
/**
* pretty formatted time value / frequency value
*/
std
::
string
t
imeFreqValStr
=
"0.0"
;
std
::
string
T
imeFreqValStr
=
"0.0"
;
/**
* The time value which the pipeline requests
*/
double
r
equestedTimeValue
=
0.0
;
double
R
equestedTimeValue
=
0.0
;
///@{
/**
* The complex mode comes in real/imag or ampl/phase pairs
* The complex mode comes in real/imag or ampl/phase pairs.
*
* Exposed by vtk makros.
*/
unsigned
int
ComplexModeReal
=
0
;
unsigned
int
ComplexModeImag
=
0
;
...
...
@@ -529,26 +531,28 @@ private:
///@}
/**
*
s
witch if missing results should get filled with 0
*
S
witch if missing results should get filled with 0
* 0 = omit empty regions (only partial results available)
* 1 = fill empty missing results with 0-valued vector
* Exposed by vtk makro
*/
unsigned
int
FillMissingResults
=
0
;
/**
*
a
dd dimensions to array names
*
A
dd dimensions to array names
. Exposed by vtk makro
*/
int
AddDimensionsToArrayNames
=
0
;
/**
* Interpret harmonic data as transient mode shape
* Interpret harmonic data as transient mode shape.
* Exposed by vtk makro
*/
int
HarmonicDataAsModeShape
=
0
;
/**
* Are we dealing with harmonic data?
*/
bool
h
armonicData
=
false
;
bool
H
armonicData
=
false
;
/**
* number of time/freq steps in current ms step
...
...
@@ -556,7 +560,7 @@ private:
unsigned
int
NumberOfTimeSteps
=
0
;
/**
* array with first/last time/freq step value
* array with first/last time/fre
q step value
*/
int
TimeStepNumRange
[
2
]
=
{
1
,
1
};
// as this is used in vtk macros, a std::array<> does not work
...
...
@@ -573,23 +577,23 @@ private:
/**
* flag if hdf5 file is already read in
*/
bool
i
sInitialized
=
false
;
bool
I
sInitialized
=
false
;
/**
* flag if hdf5 infos (region names, named node/elems) have been read in
*/
bool
h
df5InfoRead
=
false
;
bool
H
df5InfoRead
=
false
;
/**
* flag, if region settings were modified
*/
bool
a
ctiveRegionsChanged
=
false
;
bool
A
ctiveRegionsChanged
=
false
;
/**
* flag, to reset the data value arrays (e.g. after
* switching the complex mode etc.)
*/
bool
r
esetDataArrays
=
false
;
bool
R
esetDataArrays
=
false
;
/**
* Actually opens the file and reads region and group names
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment