Commit bd0eddf6 authored by Fabian.Wein's avatar Fabian.Wein
Browse files

changed more code style to comply with guidelines

parent 299dc748
......@@ -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
This diff is collapsed.
......@@ -77,15 +77,15 @@ public:
*/
unsigned int GetGridOrder() const;
unsigned int GetNumNodes() const { return numNodes_; }
unsigned int GetNumNodes() const { return NumNodes; }
unsigned int GetNumElems() const { return numElems_; }
unsigned int GetNumElems() const { return NumElems; }
unsigned int GetNumRegions() const { return regionNames_.size(); }
unsigned int GetNumRegions() const { return RegionNames.size(); }
unsigned int GetNumNamedNodes() const { return nodeNames_.size(); }
unsigned int GetNumNamedNodes() const { return NodeNames.size(); }
unsigned int GetNumNamedElems() const { return elemNames_.size(); }
unsigned int GetNumNamedElems() const { return ElemNames.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 regionNames_; }
const std::vector<std::string>& GetAllRegionNames() { return RegionNames; }
/**
* Returns a vector which contains all names of named nodes.
*/
const std::vector<std::string>& GetNodeNames() { return nodeNames_; }
const std::vector<std::string>& GetNodeNames() { return NodeNames; }
/**
* Returns a vector which contains all names of element groups
*/
const std::vector<std::string>& GetElemNames() { return elemNames_; }
const std::vector<std::string>& GetElemNames() { return ElemNames; }
/**
* 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 mainFile_ = -1;
hid_t MainFile = -1;
/**
* Root group of main file
*/
hid_t mainRoot_ = -1;
hid_t MainRoot = -1;
/**
* Root group for mesh section
*/
hid_t meshRoot_ = -1;
hid_t MeshRoot = -1;
std::string fileName_;
std::string FileName;
/**
* Native directory path to hdf5 file
*/
std::string baseDir_;
std::string BaseDir;
/**
* Flag indicating use of external files for mesh results
*/
bool hasExternalFiles_ = false;
bool HasExternalFiles = false;
std::vector<std::string> regionNames_;
std::vector<std::string> RegionNames;
/**
* Map with number of dimensions for each region
* Surface regions have lower dimensions than volume regions.
*/
std::map<std::string, unsigned int> regionDims_;
std::map<std::string, unsigned int> RegionDims;
/**
* Map with element numbers for each region
*/
std::map<std::string, std::vector<unsigned int>> regionElems_;
std::map<std::string, std::vector<unsigned int>> RegionElems;
/**
* Map with node numbers for each region
*/
std::map<std::string, std::vector<unsigned int>> regionNodes_;
std::map<std::string, std::vector<unsigned int>> RegionNodes;
/**
* List with names of node groups
*/
std::vector<std::string> nodeNames_;
std::vector<std::string> NodeNames;
/**
* List with names of element groups
*/
std::vector<std::string> elemNames_;
std::vector<std::string> ElemNames;
/**
* Map with element numbers for each named element group
*/
std::map<std::string, std::vector<unsigned int>> entityElems_;
std::map<std::string, std::vector<unsigned int>> EntityElems;
/**
* Map with element numbers for each named element and node group
*/
std::map<std::string, std::vector<unsigned int>> entityNodes_;
std::map<std::string, std::vector<unsigned int>> EntityNodes;
unsigned int numNodes_ = 0;
unsigned int NumNodes = 0;
unsigned int numElems_ = 0;
unsigned int NumElems = 0;
std::vector<double> nodeCoords_;
std::vector<double> NodeCoords;
}; // end of class
} // end of namespace H5CFS
......
This diff is collapsed.
......@@ -174,7 +174,7 @@ public:
{
this->ComplexModeReal = flag;
// In addition trigger resetting the data value arrays
this->resetDataArrays = true;
this->ResetDataArrays = true;
// update pipeline
this->Modified();
}
......@@ -184,7 +184,7 @@ public:
{
this->ComplexModeImag = flag;
// In addition trigger resetting the data value arrays
this->resetDataArrays = true;
this->ResetDataArrays = true;
// update pipeline
this->Modified();
}
......@@ -194,7 +194,7 @@ public:
{
this->ComplexModeAmpl = flag;
// In addition trigger resetting the data value arrays
this->resetDataArrays = true;
this->ResetDataArrays = true;
// update pipeline
this->Modified();
}
......@@ -204,7 +204,7 @@ public:
{
this->ComplexModePhase = flag;
// In addition trigger resetting the data value arrays
this->resetDataArrays = true;
this->ResetDataArrays = true;
// update pipeline
this->Modified();
}
......@@ -225,14 +225,14 @@ public:
/**
* Return spatial dimension of grid
*/
int GetGridDimension() const { return dimension_; }
int GetGridDimension() const { return Dimension; }
int GetGridOrder() const { return gridOrder_; }
int GetGridOrder() const { return GridOrder; }
/**
* Get the number of cell arrays available in the input.
*/
int GetNumberOfRegionArrays() const { return static_cast<int>(regionNames_.size()); }
int GetNumberOfRegionArrays() const { return static_cast<int>(RegionNames.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>(namedNodeNames_.size()); }
int GetNumberOfNamedNodeArrays() const { return static_cast<int>(NamedNodeNames.size()); }
///@{
/**
......@@ -261,7 +261,7 @@ public:
const char* GetNamedNodeArrayName(int index);
int GetNumberOfNamedElemArrays() const { return static_cast<int>(namedElemNames_.size()); }
int GetNumberOfNamedElemArrays() const { return static_cast<int>(NamedElemNames.size()); }
///@{
/**
......@@ -385,7 +385,7 @@ private:
/**
* This object encapsulates the openCFS hfdf file with some service functions
*/
H5CFS::Hdf5Reader reader_;
H5CFS::Hdf5Reader Reader;
/**
* exposed via vtkGetStringMacro(FileName)
......@@ -403,124 +403,126 @@ private:
/**
* dimension of the grid (2 or 3)
*/
int dimension_ = 0;
int Dimension = 0;
/**
* order of grid (linear case 1)
*/
int gridOrder_ = 0;
int GridOrder = 0;
std::vector<std::string> regionNames_;
std::vector<std::string> RegionNames;
std::vector<std::string> namedElemNames_;
std::vector<std::string> NamedElemNames;
std::vector<std::string> namedNodeNames_;
std::vector<std::string> NamedNodeNames;
/**
* map (region, globalNodeNumber)->(regionLocalNodeNumber)
*/
std::vector<std::vector<unsigned int>> nodeMap_;
std::vector<std::vector<unsigned int>> NodeMap;
/**
* time steps of current multisequence step
*/
std::vector<double> stepVals;
std::vector<double> StepVals;
/**
* vector with step values having a result
*/
std::vector<unsigned int> stepNums;
std::vector<unsigned int> StepNums;
/**
* multiblock dataset, which contains for each
* region an initialized grid
*/
vtkMultiBlockDataSet* mbDataSet = nullptr;
vtkMultiBlockDataSet* MBDataSet = nullptr;
/**
* reduced multiblock dataset, which contains
* only blocks for currently active regions
*/
vtkMultiBlockDataSet* mbActiveDataSet = nullptr;
vtkMultiBlockDataSet* MBActiveDataSet = nullptr;
/**
* flag array indicating active regions
*/
std::map<std::string, int> regionSwitch;
std::map<std::string, int> RegionSwitch;
/**
* flag array indicating named nodes to read
*/
std::map<std::string, int> namedNodeSwitch;
std::map<std::string, int> NamedNodeSwitch;
/**
* flag array indicating named elems to read
*/
std::map<std::string, int> namedElemSwitch;
std::map<std::string, int> NamedElemSwitch;
/**
* flag indicating change of multisequence step
*/
bool msStepChanged = false;
bool MSStepChanged = false;
/**
* Analysis type of multi-sequence steps with mesh results
*/
std::map<unsigned int, H5CFS::AnalysisType> resAnalysisType_;
std::map<unsigned int, H5CFS::AnalysisType> ResAnalysisType;
/**
* ResultInfo of mesh results per multi-sequence step
*/
std::map<unsigned int, std::vector<std::shared_ptr<H5CFS::ResultInfo>>> meshResultInfos_;
std::map<unsigned int, std::vector<std::shared_ptr<H5CFS::ResultInfo>>> MeshResultInfos;
/**
* Analysis type of multi-sequence step with history results
*/
std::map<unsigned int, H5CFS::AnalysisType> histAnalysisType_;
std::map<unsigned int, H5CFS::AnalysisType> HistAnalysisType;
/**
* ResultInfo of history results per multi-sequence step
*/
std::map<unsigned int, std::vector<std::shared_ptr<H5CFS::ResultInfo>>> histResultInfos_;
std::map<unsigned int, std::vector<std::shared_ptr<H5CFS::ResultInfo>>> HistResultInfos;
/**
* Global steps per multisequence where ANY result is available
*/
std::map<unsigned int, std::set<std::pair<unsigned int, double>>> globalResultSteps_;
std::map<unsigned int, std::set<std::pair<unsigned int, double>>> GlobalResultSteps;
/**
* Current multisequence step
* Current multisequence step, exposed by vtk macro
*/
unsigned int MultiSequenceStep = 1;
/**
* Analysis type of current multisequence step
*/
H5CFS::AnalysisType analysisType = H5CFS::NO_ANALYSIS_TYPE;
H5CFS::AnalysisType AnalysisType = 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 timeFreqVal = 0.0;
double TimeFreqVal = 0.0;
/**
* pretty formatted time value / frequency value
*/
std::string timeFreqValStr = "0.0";
std::string TimeFreqValStr = "0.0";
/**
* The time value which the pipeline requests
*/
double requestedTimeValue = 0.0;
double RequestedTimeValue = 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:
///@}
/**
* switch if missing results should get filled with 0
* Switch 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;
/**
* add dimensions to array names
* Add 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 harmonicData = false;
bool HarmonicData = 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 isInitialized = false;
bool IsInitialized = false;
/**
* flag if hdf5 infos (region names, named node/elems) have been read in
*/
bool hdf5InfoRead = false;
bool Hdf5InfoRead = false;
/**
* flag, if region settings were modified
*/
bool activeRegionsChanged = false;
bool ActiveRegionsChanged = false;
/**
* flag, to reset the data value arrays (e.g. after
* switching the complex mode etc.)
*/
bool resetDataArrays = false;
bool ResetDataArrays = false;
/**
* Actually opens the file and reads region and group names
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment