From dae96f287c5d90095e942471d74606bde83a4fe5 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Tue, 12 Jul 2022 14:26:14 +0000
Subject: [PATCH] Fix some sonarqube and clang-tidy warnings

also tabs to spaces
---
 .gitignore                                    |   2 +-
 .../TriangularMesh/TriangularMesh.cpp         |  31 +--
 .../TriangularMesh/TriangularMesh.h           |  24 +-
 src/gpu/GridGenerator/grid/Field.cpp          |   2 +-
 src/gpu/GridGenerator/grid/Field.h            |  14 +-
 src/gpu/GridGenerator/grid/GridInterface.h    |   6 +-
 .../io/GridVTKWriter/GridVTKWriter.cpp        | 260 +++++++++---------
 .../io/GridVTKWriter/GridVTKWriter.h          |   8 +-
 .../BoundaryConditionFactory.h                |  10 +-
 .../GridReaderGenerator/GridGenerator.cpp     |   5 +-
 .../GridReaderGenerator/GridGenerator.h       |   2 +-
 .../VirtualFluids_GPU/GPU/CudaMemoryManager.h | 150 +++++-----
 12 files changed, 250 insertions(+), 264 deletions(-)

diff --git a/.gitignore b/.gitignore
index ae19800aa..f87c8efbb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,7 +24,7 @@ output/
 logs/
 
 # grid
-grid/
+.grid/
 
 # scripts
 scripts/
diff --git a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cpp b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cpp
index a11384887..883ca0dea 100644
--- a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cpp
+++ b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cpp
@@ -58,9 +58,9 @@ TriangularMesh* TriangularMesh::make(const std::string& fileName, const std::vec
 
 TriangularMesh::TriangularMesh(const std::string& input, const BoundingBox& box)
 {
-	this->triangleVec = STLReader::readSTL(box, input);
-	initalizeDataFromTriangles();
-	this->findNeighbors();
+    this->triangleVec = STLReader::readSTL(box, input);
+    initalizeDataFromTriangles();
+    this->findNeighbors();
 }
 
 TriangularMesh::TriangularMesh(const std::string& inputPath, const std::vector<uint> ignorePatches)
@@ -76,12 +76,7 @@ TriangularMesh::TriangularMesh(const std::string& inputPath, const std::vector<u
 
 TriangularMesh::TriangularMesh()
 {
-	this->minmax = BoundingBox::makeInvalidMinMaxBox();  // blame Lenz
-}
-
-TriangularMesh::~TriangularMesh()
-{
-
+    this->minmax = BoundingBox::makeInvalidMinMaxBox();  // blame Lenz
 }
 
 Object* TriangularMesh::clone() const
@@ -100,12 +95,12 @@ uint TriangularMesh::getNumberOfTriangles() const
 
 void TriangularMesh::findNeighbors()
 {
-	*logging::out << logging::Logger::INFO_INTERMEDIATE << "start finding neighbors ...\n";
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "start finding neighbors ...\n";
 
     auto t = Timer::makeStart();
 
-	TriangleNeighborFinder finder(triangles, size);
-	finder.fillWithNeighborAngles(this);
+    TriangleNeighborFinder finder(triangles, size);
+    finder.fillWithNeighborAngles(this);
 
     t->end();
 
@@ -114,19 +109,19 @@ void TriangularMesh::findNeighbors()
 
 void TriangularMesh::setTriangles(std::vector<Triangle> triangles)
 {
-	this->triangleVec = triangles;
-	initalizeDataFromTriangles();
+    this->triangleVec = triangles;
+    initalizeDataFromTriangles();
 }
 
 void TriangularMesh::setMinMax(BoundingBox minmax)
 {
-	this->minmax = minmax;
+    this->minmax = minmax;
 }
 
 void TriangularMesh::initalizeDataFromTriangles()
 {
-	this->triangles = triangleVec.data();
-	this->size = long(triangleVec.size());
+    this->triangles = triangleVec.data();
+    this->size = long(triangleVec.size());
 
     for (std::size_t i = 0; i < (size_t)this->size; i++) {
         this->minmax.setMinMax(this->triangleVec[i]);
@@ -201,7 +196,7 @@ void TriangularMesh::scale(double offset)
     auto averrageNormals = getAverrageNormalsPerVertex(trianglesPerVertex);
 
 
-    for (std::size_t vertexID = 0; vertexID < this->getNumberOfTriangles() * 3; vertexID++)
+    for (uint vertexID = 0; vertexID < this->getNumberOfTriangles() * 3; vertexID++)
     {
         int coordinatedID = finder.sortedToTriangles[vertexID][IDS::coordinateID];
         Vertex averrageNormal = averrageNormals[coordinatedID];
diff --git a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h
index beb1c3a05..2e876e1d3 100644
--- a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h
+++ b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h
@@ -33,7 +33,6 @@
 #ifndef TriangularMesh_h
 #define TriangularMesh_h
 
-#include <stdio.h>
 #include <vector>
 #include <string>
 #include <memory>
@@ -55,20 +54,20 @@ class TriangularMesh : public Object
 public:
 
     GRIDGENERATOR_EXPORT static TriangularMesh* make(const std::string& fileName, const std::vector<uint> ignorePatches = std::vector<uint>());
-	GRIDGENERATOR_EXPORT TriangularMesh();
+    GRIDGENERATOR_EXPORT TriangularMesh();
     GRIDGENERATOR_EXPORT TriangularMesh(const std::string& inputPath, const std::vector<uint> ignorePatches = std::vector<uint>());
-	GRIDGENERATOR_EXPORT TriangularMesh(const std::string& inputPath, const BoundingBox &box);
-	GRIDGENERATOR_EXPORT ~TriangularMesh();
+    GRIDGENERATOR_EXPORT TriangularMesh(const std::string& inputPath, const BoundingBox &box);
+    GRIDGENERATOR_EXPORT ~TriangularMesh() override = default;
 
     GRIDGENERATOR_EXPORT uint getNumberOfTriangles() const;
 
-	GRIDGENERATOR_EXPORT void setTriangles(std::vector<Triangle> triangles);
-	GRIDGENERATOR_EXPORT void setMinMax(BoundingBox minmax);
+    GRIDGENERATOR_EXPORT void setTriangles(std::vector<Triangle> triangles);
+    GRIDGENERATOR_EXPORT void setMinMax(BoundingBox minmax);
 
-	std::vector<Triangle> triangleVec;
-	Triangle *triangles;
-	long size;
-	BoundingBox minmax;
+    std::vector<Triangle> triangleVec;
+    Triangle *triangles = nullptr;
+    long size = 0;
+    BoundingBox minmax;
 
     SPtr<GbTriFaceMesh3D> VF_GbTriFaceMesh3D;
 
@@ -81,8 +80,8 @@ public:
     GRIDGENERATOR_EXPORT void generateGbTriFaceMesh3D();
 
 private:
-	
-	void initalizeDataFromTriangles();
+
+    void initalizeDataFromTriangles();
 
     static std::vector<Vertex> getAverrageNormalsPerVertex(std::vector<std::vector<Triangle> > trianglesPerVertex);
     static void eliminateTriangleswithIdenticialNormal(std::vector<Triangle> &triangles);
@@ -110,4 +109,3 @@ public:
 
 
 #endif
-
diff --git a/src/gpu/GridGenerator/grid/Field.cpp b/src/gpu/GridGenerator/grid/Field.cpp
index 86985af60..177771210 100644
--- a/src/gpu/GridGenerator/grid/Field.cpp
+++ b/src/gpu/GridGenerator/grid/Field.cpp
@@ -115,7 +115,7 @@ bool Field::isStopperCoarseUnderFine(uint index) const
 
 bool Field::isStopperSolid(uint index) const
 {
-	return field[index] == STOPPER_SOLID;
+    return field[index] == STOPPER_SOLID;
 }
 
 bool Field::isStopper(uint index) const
diff --git a/src/gpu/GridGenerator/grid/Field.h b/src/gpu/GridGenerator/grid/Field.h
index 08fff6da7..db664d882 100644
--- a/src/gpu/GridGenerator/grid/Field.h
+++ b/src/gpu/GridGenerator/grid/Field.h
@@ -51,20 +51,20 @@ public:
     bool is(uint index, char type) const;
     bool isCoarseToFineNode(uint index) const;
     bool isFineToCoarseNode(uint index) const;
-	bool isFluid(uint index) const;
-	bool isInvalidSolid(uint index) const;
+    bool isFluid(uint index) const;
+    bool isInvalidSolid(uint index) const;
     bool isQ(uint index) const;
     bool isBoundaryConditionNode(uint index) const;
     bool isInvalidCoarseUnderFine(uint index) const;
     bool isStopperOutOfGrid(uint index) const;
     bool isStopperCoarseUnderFine(uint index) const;
-	bool isStopperSolid(uint index) const;
-	bool isStopper(uint index) const;
+    bool isStopperSolid(uint index) const;
+    bool isStopper(uint index) const;
     bool isInvalidOutOfGrid(uint index) const;
 
     void setFieldEntry(uint index, char val);
-	void setFieldEntryToFluid(uint index);
-	void setFieldEntryToInvalidSolid(uint index);
+    void setFieldEntryToFluid(uint index);
+    void setFieldEntryToInvalidSolid(uint index);
     void setFieldEntryToStopperOutOfGrid(uint index);
     void setFieldEntryToStopperOutOfGridBoundary(uint index);
     void setFieldEntryToStopperCoarseUnderFine(uint index);
@@ -72,7 +72,7 @@ public:
     void setFieldEntryToInvalidOutOfGrid(uint index);
 
 private:
-    char *field;
+    char *field = nullptr;
     uint size;
 };
 
diff --git a/src/gpu/GridGenerator/grid/GridInterface.h b/src/gpu/GridGenerator/grid/GridInterface.h
index b5f71317e..713d495d4 100644
--- a/src/gpu/GridGenerator/grid/GridInterface.h
+++ b/src/gpu/GridGenerator/grid/GridInterface.h
@@ -47,9 +47,9 @@ public:
     void GRIDGENERATOR_EXPORT findBoundaryGridInterfaceCF(const uint& indexOnCoarseGrid, GridImp* coarseGrid, GridImp* fineGrid);
 
 
-	void GRIDGENERATOR_EXPORT findInterfaceCF_GKS(const uint& indexOnCoarseGrid, GridImp* coarseGrid, GridImp* fineGrid);
+    void GRIDGENERATOR_EXPORT findInterfaceCF_GKS(const uint& indexOnCoarseGrid, GridImp* coarseGrid, GridImp* fineGrid);
 
-	void GRIDGENERATOR_EXPORT findInterfaceFC(const uint& indexOnCoarseGrid, GridImp* coarseGrid, GridImp* fineGrid);
+    void GRIDGENERATOR_EXPORT findInterfaceFC(const uint& indexOnCoarseGrid, GridImp* coarseGrid, GridImp* fineGrid);
     void GRIDGENERATOR_EXPORT findOverlapStopper(const uint& indexOnCoarseGrid, GridImp* coarseGrid, GridImp* fineGrid);
     
     void GRIDGENERATOR_EXPORT findInvalidBoundaryNodes(const uint& indexOnCoarseGrid, GridImp* coarseGrid);
@@ -66,7 +66,7 @@ public:
         uint *fine, *coarse;
         uint numberOfEntries = 0;
         uint *offset;
-    } fc, cf;
+    } fc{}, cf{};
 
 
 private:
diff --git a/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp b/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp
index 35b3197ff..7f818f321 100644
--- a/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp
+++ b/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp
@@ -59,7 +59,7 @@ void GridVTKWriter::writeSparseGridToVTK(SPtr<Grid> grid, const std::string& nam
     writeVtkFile(grid);
 }
 
-void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name, WRITING_FORMAT format)
+void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name)
 {
     
     const uint chunkSize = 20000000; 
@@ -87,11 +87,9 @@ void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name,
 
         *logging::out << logging::Logger::INFO_INTERMEDIATE << "Write Grid to XML VTK (*.vtu) output file : " + name + "_Part_" + std::to_string(part) + "\n";
 
-        nodedatanames.push_back("types");
-        nodedatanames.push_back("sparse_id");
-        nodedatanames.push_back("matrix_id");
-        nodedatanames.push_back("isSendNode");
-        nodedatanames.push_back("isReceiveNode");
+        nodedatanames.emplace_back("types");
+        nodedatanames.emplace_back("sparse_id");
+        nodedatanames.emplace_back("matrix_id");
 
         nodedata.resize(nodedatanames.size());
 
@@ -113,14 +111,12 @@ void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name,
                     grid->transIndexToCoords(index, x, y, z);
 
                     nodeNumbers(xIndex, yIndex, zIndex) = nr++;
-                    nodes.push_back(UbTupleFloat3(float(x), float(y), float(z)));
+                    nodes.emplace_back(UbTupleFloat3(float(x), float(y), float(z)));
 
                     const char type = grid->getFieldEntry(grid->transCoordToIndex(x, y, z));
                     nodedata[0].push_back(type);
                     nodedata[1].push_back(grid->getSparseIndex(index));
                     nodedata[2].push_back(index);
-                    nodedata[3].push_back(grid->isSendNode(index));
-                    nodedata[4].push_back(grid->isReceiveNode(index));
                 }
             }
         }
@@ -150,7 +146,7 @@ void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name,
                     {
                         Cell cell(x, y, z, grid->getDelta());
                         //if (grid->nodeInCellIs(cell, INVALID_OUT_OF_GRID) || grid->nodeInCellIs(cell, INVALID_COARSE_UNDER_FINE))
-                        //	continue;
+                        // continue;
 
                         cells.push_back(makeUbTuple(uint(SWB), uint(SEB), uint(NEB), uint(NWB), uint(SWT), uint(SET), uint(NET), uint(NWT)));
                     }
@@ -163,7 +159,7 @@ void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name,
 
 }
 
-void GridVTKWriter::writeInterpolationCellsToVTKXML(SPtr<Grid> grid, SPtr<Grid> gridCoarse, const std::string& name, WRITING_FORMAT format)
+void GridVTKWriter::writeInterpolationCellsToVTKXML(SPtr<Grid> grid, SPtr<Grid> gridCoarse, const std::string& name)
 {
     std::vector<char> nodeInterpolationCellType( grid->getSize() );
     for( auto& type : nodeInterpolationCellType ) type = -1;
@@ -202,79 +198,79 @@ void GridVTKWriter::writeInterpolationCellsToVTKXML(SPtr<Grid> grid, SPtr<Grid>
         }
     }
 
-	std::vector<UbTupleFloat3> nodes;
-	std::vector<UbTupleInt8> cells;
-	std::vector<std::string> celldatanames;
-	std::vector< std::vector<double> > celldata;
-
-	celldatanames.push_back("InterpolationCells");
-    celldatanames.push_back("Offset");
-
-	celldata.resize(celldatanames.size());
-
-	CbArray3D<int> nodeNumbers(grid->getNumberOfNodesX(), grid->getNumberOfNodesY(), grid->getNumberOfNodesZ(), -1);
-	int nr = 0;
-
-	for (uint xIndex = 0; xIndex < grid->getNumberOfNodesX(); xIndex++)
-	{
-		for (uint yIndex = 0; yIndex < grid->getNumberOfNodesY(); yIndex++)
-		{
-			for (uint zIndex = 0; zIndex < grid->getNumberOfNodesZ(); zIndex++)
-			{
-				real x, y, z;
-				uint index = 
-					  grid->getNumberOfNodesX() * grid->getNumberOfNodesY() * zIndex
-					+ grid->getNumberOfNodesX() *                             yIndex
-					+ xIndex;
-
-				grid->transIndexToCoords(index, x, y, z);
-
-				nodeNumbers(xIndex, yIndex, zIndex) = nr++;
-				nodes.push_back(UbTupleFloat3(float(x), float(y), float(z)));
-			}
-		}
-	}
-
-	int SWB, SEB, NEB, NWB, SWT, SET, NET, NWT;
-	for (uint xIndex = 0; xIndex < grid->getNumberOfNodesX() - 1; xIndex++)
-	{
-		for (uint yIndex = 0; yIndex < grid->getNumberOfNodesY() - 1; yIndex++)
-		{
-			for (uint zIndex = 0; zIndex < grid->getNumberOfNodesZ() - 1; zIndex++)
-			{
-				real x, y, z;
-				uint index = grid->getNumberOfNodesX() * grid->getNumberOfNodesY() * zIndex
-					+ grid->getNumberOfNodesX() *                             yIndex
-					+ xIndex;
-
-				grid->transIndexToCoords(index, x, y, z);
-
-				if ((SWB = nodeNumbers(xIndex, yIndex, zIndex)) >= 0
-					&& (SEB = nodeNumbers(xIndex + 1, yIndex, zIndex)) >= 0
-					&& (NEB = nodeNumbers(xIndex + 1, yIndex + 1, zIndex)) >= 0
-					&& (NWB = nodeNumbers(xIndex, yIndex + 1, zIndex)) >= 0
-					&& (SWT = nodeNumbers(xIndex, yIndex, zIndex + 1)) >= 0
-					&& (SET = nodeNumbers(xIndex + 1, yIndex, zIndex + 1)) >= 0
-					&& (NET = nodeNumbers(xIndex + 1, yIndex + 1, zIndex + 1)) >= 0
-					&& (NWT = nodeNumbers(xIndex, yIndex + 1, zIndex + 1)) >= 0)
-				{
-					Cell cell(x, y, z, grid->getDelta());
-					//if (grid->nodeInCellIs(cell, INVALID_OUT_OF_GRID) || grid->nodeInCellIs(cell, INVALID_COARSE_UNDER_FINE))
-					//	continue;
-
-					cells.push_back(makeUbTuple(SWB, SEB, NEB, NWB, SWT, SET, NET, NWT));
-
-				    //const char type = grid->getFieldEntry(grid->transCoordToIndex(nodes[SWB].v1, nodes[SWB].v2.v1, nodes[SWB].v2.v2));
-				    //const char type = grid->getFieldEntry(grid->transCoordToIndex(val<1>(nodes[SWB]), val<2>(nodes[SWB]), val<3>(nodes[SWB])));
-				    const char type = nodeInterpolationCellType[ grid->transCoordToIndex(val<1>(nodes[SWB]), val<2>(nodes[SWB]), val<3>(nodes[SWB])) ];
+    std::vector<UbTupleFloat3> nodes;
+    std::vector<UbTupleInt8> cells;
+    std::vector<std::string> celldatanames;
+    std::vector< std::vector<double> > celldata;
+
+    celldatanames.emplace_back("InterpolationCells");
+    celldatanames.emplace_back("Offset");
+
+    celldata.resize(celldatanames.size());
+
+    CbArray3D<int> nodeNumbers(grid->getNumberOfNodesX(), grid->getNumberOfNodesY(), grid->getNumberOfNodesZ(), -1);
+    int nr = 0;
+
+    for (uint xIndex = 0; xIndex < grid->getNumberOfNodesX(); xIndex++)
+    {
+        for (uint yIndex = 0; yIndex < grid->getNumberOfNodesY(); yIndex++)
+        {
+            for (uint zIndex = 0; zIndex < grid->getNumberOfNodesZ(); zIndex++)
+            {
+                real x, y, z;
+                uint index = 
+                      grid->getNumberOfNodesX() * grid->getNumberOfNodesY() * zIndex
+                    + grid->getNumberOfNodesX() *                             yIndex
+                    + xIndex;
+
+                grid->transIndexToCoords(index, x, y, z);
+
+                nodeNumbers(xIndex, yIndex, zIndex) = nr++;
+                nodes.emplace_back(UbTupleFloat3(float(x), float(y), float(z)));
+            }
+        }
+    }
+
+    int SWB, SEB, NEB, NWB, SWT, SET, NET, NWT;
+    for (uint xIndex = 0; xIndex < grid->getNumberOfNodesX() - 1; xIndex++)
+    {
+        for (uint yIndex = 0; yIndex < grid->getNumberOfNodesY() - 1; yIndex++)
+        {
+            for (uint zIndex = 0; zIndex < grid->getNumberOfNodesZ() - 1; zIndex++)
+            {
+                real x, y, z;
+                uint index = grid->getNumberOfNodesX() * grid->getNumberOfNodesY() * zIndex
+                    + grid->getNumberOfNodesX() *                             yIndex
+                    + xIndex;
+
+                grid->transIndexToCoords(index, x, y, z);
+
+                if ((SWB = nodeNumbers(xIndex, yIndex, zIndex)) >= 0
+                    && (SEB = nodeNumbers(xIndex + 1, yIndex, zIndex)) >= 0
+                    && (NEB = nodeNumbers(xIndex + 1, yIndex + 1, zIndex)) >= 0
+                    && (NWB = nodeNumbers(xIndex, yIndex + 1, zIndex)) >= 0
+                    && (SWT = nodeNumbers(xIndex, yIndex, zIndex + 1)) >= 0
+                    && (SET = nodeNumbers(xIndex + 1, yIndex, zIndex + 1)) >= 0
+                    && (NET = nodeNumbers(xIndex + 1, yIndex + 1, zIndex + 1)) >= 0
+                    && (NWT = nodeNumbers(xIndex, yIndex + 1, zIndex + 1)) >= 0)
+                {
+                    Cell cell(x, y, z, grid->getDelta());
+                    //if (grid->nodeInCellIs(cell, INVALID_OUT_OF_GRID) || grid->nodeInCellIs(cell, INVALID_COARSE_UNDER_FINE))
+                    //    continue;
+
+                    cells.push_back(makeUbTuple(SWB, SEB, NEB, NWB, SWT, SET, NET, NWT));
+
+                    //const char type = grid->getFieldEntry(grid->transCoordToIndex(nodes[SWB].v1, nodes[SWB].v2.v1, nodes[SWB].v2.v2));
+                    //const char type = grid->getFieldEntry(grid->transCoordToIndex(val<1>(nodes[SWB]), val<2>(nodes[SWB]), val<3>(nodes[SWB])));
+                    const char type = nodeInterpolationCellType[ grid->transCoordToIndex(val<1>(nodes[SWB]), val<2>(nodes[SWB]), val<3>(nodes[SWB])) ];
                     const char offset = nodeOffset               [ grid->transCoordToIndex(val<1>(nodes[SWB]), val<2>(nodes[SWB]), val<3>(nodes[SWB])) ];
 
                     celldata[0].push_back( type );
                     celldata[1].push_back( offset );
-				}
-			}
-		}
-	}
+                }
+            }
+        }
+    }
     WbWriterVtkXmlBinary::getInstance()->writeOctsWithCellData(name, nodes, cells, celldatanames, celldata);
 }
 
@@ -323,18 +319,18 @@ void GridVTKWriter::openFile(const std::string& name, const std::string& mode)
 void GridVTKWriter::closeFile()
 {
     GridVTKWriter::end_line();
-	fclose(file);
+    fclose(file);
 }
 
 void GridVTKWriter::writeHeader()
 {
-	fprintf(file, "# vtk DataFile Version 3.0\n");
-	fprintf(file, "by MeshGenerator\n");
-	if (isBinaryWritingFormat())
-		fprintf(file, "BINARY\n");
-	else
-		fprintf(file, "ASCII\n");
-	fprintf(file, "DATASET UNSTRUCTURED_GRID\n");
+    fprintf(file, "# vtk DataFile Version 3.0\n");
+    fprintf(file, "by MeshGenerator\n");
+    if (isBinaryWritingFormat())
+        fprintf(file, "BINARY\n");
+    else
+        fprintf(file, "ASCII\n");
+    fprintf(file, "DATASET UNSTRUCTURED_GRID\n");
 }
 
 void GridVTKWriter::writePoints(SPtr<Grid> grid)
@@ -360,34 +356,34 @@ void GridVTKWriter::writePoints(SPtr<Grid> grid)
 
 void GridVTKWriter::writeCells(const unsigned int &size)
 {
-	fprintf(file, "\nCELLS %d %d\n", size, size * 2);
-	for (unsigned int i = 0; i < size; ++i)
-	{
-		if (isBinaryWritingFormat()){
-			write_int(1);
-			write_int(i);
-		}
-		else
-			fprintf(file, "1 %d\n", i);
-	}
-
-	fprintf(file, "\nCELL_TYPES %d\n", size);
-	for (unsigned int i = 0; i < size; ++i)
-	{
-		if (isBinaryWritingFormat())
-			write_int(1);
-		else
-			fprintf(file, "1 ");
-	}
-	if (!isBinaryWritingFormat())
+    fprintf(file, "\nCELLS %u %u\n", size, size * 2);
+    for (unsigned int i = 0; i < size; ++i)
+    {
+        if (isBinaryWritingFormat()){
+            write_int(1);
+            write_int(i);
+        }
+        else
+            fprintf(file, "1 %u\n", i);
+    }
+
+    fprintf(file, "\nCELL_TYPES %u\n", size);
+    for (unsigned int i = 0; i < size; ++i)
+    {
+        if (isBinaryWritingFormat())
+            write_int(1);
+        else
+            fprintf(file, "1 ");
+    }
+    if (!isBinaryWritingFormat())
         GridVTKWriter::end_line();
 }
 
 void GridVTKWriter::writeTypeHeader(const unsigned int &size)
 {
-	fprintf(file, "\nPOINT_DATA %d\n", size);
-	fprintf(file, "SCALARS type int\n");
-	fprintf(file, "LOOKUP_TABLE default\n");
+    fprintf(file, "\nPOINT_DATA %u\n", size);
+    fprintf(file, "SCALARS type int\n");
+    fprintf(file, "LOOKUP_TABLE default\n");
 }
 
 void GridVTKWriter::writeTypes(SPtr<Grid> grid)
@@ -406,38 +402,38 @@ void GridVTKWriter::writeTypes(SPtr<Grid> grid)
 
 void GridVTKWriter::end_line()
 {
-	char str2[8] = "\n";
-	fprintf(file, "%s", str2);
+    char str2[8] = "\n";
+    fprintf(file, "%s", str2);
 }
 
 void GridVTKWriter::write_int(int val)
 {
-	force_big_endian((unsigned char *)&val);
-	fwrite(&val, sizeof(int), 1, file);
+    force_big_endian((unsigned char *)&val);
+    fwrite(&val, sizeof(int), 1, file);
 }
 
 void GridVTKWriter::write_float(float val)
 {
-	force_big_endian((unsigned char *)&val);
-	fwrite(&val, sizeof(float), 1, file);
+    force_big_endian((unsigned char *)&val);
+    fwrite(&val, sizeof(float), 1, file);
 }
 
 
 void GridVTKWriter::force_big_endian(unsigned char *bytes)
 {
-	bool shouldSwap = false;
-	int tmp1 = 1;
-	unsigned char *tmp2 = (unsigned char *)&tmp1;
-	if (*tmp2 != 0)
-		shouldSwap = true;
-
-	if (shouldSwap)
-	{
-		unsigned char tmp = bytes[0];
-		bytes[0] = bytes[3];
-		bytes[3] = tmp;
-		tmp = bytes[1];
-		bytes[1] = bytes[2];
-		bytes[2] = tmp;
-	}
+    bool shouldSwap = false;
+    int tmp1 = 1;
+    unsigned char *tmp2 = (unsigned char *)&tmp1;
+    if (*tmp2 != 0)
+        shouldSwap = true;
+
+    if (shouldSwap)
+    {
+        unsigned char tmp = bytes[0];
+        bytes[0] = bytes[3];
+        bytes[3] = tmp;
+        tmp = bytes[1];
+        bytes[1] = bytes[2];
+        bytes[2] = tmp;
+    }
 }
diff --git a/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.h b/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.h
index cf33df096..f8458ae27 100644
--- a/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.h
+++ b/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.h
@@ -46,12 +46,12 @@ class GRIDGENERATOR_EXPORT GridVTKWriter
 {
 public:
     static void writeSparseGridToVTK(SPtr<Grid> grid, const std::string& name, WRITING_FORMAT format = WRITING_FORMAT::ASCII);
-    static void writeGridToVTKXML(SPtr<Grid> grid, const std::string& name, WRITING_FORMAT format = WRITING_FORMAT::ASCII);
-    static void writeInterpolationCellsToVTKXML(SPtr<Grid> grid, SPtr<Grid> gridCoarse, const std::string& name, WRITING_FORMAT format = WRITING_FORMAT::ASCII);
+    static void writeGridToVTKXML(SPtr<Grid> grid, const std::string& name);
+    static void writeInterpolationCellsToVTKXML(SPtr<Grid> grid, SPtr<Grid> gridCoarse, const std::string& name);
 
 private:
-    GridVTKWriter() {}
-    ~GridVTKWriter() {}
+    GridVTKWriter() = default;
+    ~GridVTKWriter() = default;
 
     static FILE *file;
     static WRITING_FORMAT format;
diff --git a/src/gpu/VirtualFluids_GPU/BoundaryConditions/BoundaryConditionFactory.h b/src/gpu/VirtualFluids_GPU/BoundaryConditions/BoundaryConditionFactory.h
index c2d374c7d..cefab2d98 100644
--- a/src/gpu/VirtualFluids_GPU/BoundaryConditions/BoundaryConditionFactory.h
+++ b/src/gpu/VirtualFluids_GPU/BoundaryConditions/BoundaryConditionFactory.h
@@ -101,11 +101,11 @@ public:
     // void setOutflowBoundaryCondition(...); // TODO:
     // https://git.rz.tu-bs.de/m.schoenherr/VirtualFluids_dev/-/issues/16
 
-    boundaryCondition getVelocityBoundaryConditionPost(bool isGeometryBC = false) const;
-    boundaryCondition getNoSlipBoundaryConditionPost(bool isGeometryBC = false) const;
-    boundaryCondition getSlipBoundaryConditionPost(bool isGeometryBC = false) const;
-    boundaryCondition getPressureBoundaryConditionPre() const;
-    boundaryCondition getGeometryBoundaryConditionPost() const;
+    [[nodiscard]] boundaryCondition getVelocityBoundaryConditionPost(bool isGeometryBC = false) const;
+    [[nodiscard]] boundaryCondition getNoSlipBoundaryConditionPost(bool isGeometryBC = false) const;
+    [[nodiscard]] boundaryCondition getSlipBoundaryConditionPost(bool isGeometryBC = false) const;
+    [[nodiscard]] boundaryCondition getPressureBoundaryConditionPre() const;
+    [[nodiscard]] boundaryCondition getGeometryBoundaryConditionPost() const;
 
     boundaryConditionPara getStressBoundaryConditionPost() const;
 
diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
index 8bfffe395..e287a2eac 100644
--- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
+++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
@@ -23,10 +23,7 @@ GridGenerator::GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_p
     this->indexRearrangement = std::make_unique<IndexRearrangementForStreams>(para, builder, communicator);
 }
 
-GridGenerator::~GridGenerator()
-{
-
-}
+GridGenerator::~GridGenerator() = default;
 
 void GridGenerator::initalGridInformations()
 {
diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h
index 3603a88b3..73cb05970 100644
--- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h
+++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h
@@ -61,7 +61,7 @@ private:
 
 public:
     VIRTUALFLUIDS_GPU_EXPORT GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::gpu::Communicator& communicator);
-    VIRTUALFLUIDS_GPU_EXPORT virtual ~GridGenerator();
+    VIRTUALFLUIDS_GPU_EXPORT ~GridGenerator() override;
 
     //! \brief allocates and initialized the data structures for Coordinates and node types
     void allocArrays_CoordNeighborGeo() override;
diff --git a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h
index a6a84f921..8df1b412c 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h
+++ b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h
@@ -24,10 +24,10 @@ class Probe;
 class VIRTUALFLUIDS_GPU_EXPORT CudaMemoryManager
 {
 public:
-	CudaMemoryManager(std::shared_ptr<Parameter> parameter);
+    CudaMemoryManager(std::shared_ptr<Parameter> parameter);
 
-	void setMemsizeGPU(double admem, bool reset);
-	double getMemsizeGPU();
+    void setMemsizeGPU(double admem, bool reset);
+    double getMemsizeGPU();
 
     void cudaAllocFull(int lev);
     void cudaFreeFull(int lev);
@@ -35,109 +35,109 @@ public:
     void cudaCopyPrint(int lev);
     void cudaCopyMedianPrint(int lev);
 
-	void cudaAllocCoord(int lev);
-	void cudaCopyCoord(int lev);
-	void cudaFreeCoord(int lev);
+    void cudaAllocCoord(int lev);
+    void cudaCopyCoord(int lev);
+    void cudaFreeCoord(int lev);
 
-	void cudaAllocBodyForce(int lev);
+    void cudaAllocBodyForce(int lev);
     void cudaCopyBodyForce(int lev);
     void cudaFreeBodyForce(int lev);
 
     void cudaCopyDataToHost(int lev);
 
-	void cudaAllocSP(int lev);
-	void cudaCopySP(int lev);
-	void cudaFreeSP(int lev);
+    void cudaAllocSP(int lev);
+    void cudaCopySP(int lev);
+    void cudaFreeSP(int lev);
 
     void cudaAllocF3SP(int lev);
 
-	void cudaAllocNeighborWSB(int lev);
-	void cudaCopyNeighborWSB(int lev);
-	void cudaFreeNeighborWSB(int lev);
+    void cudaAllocNeighborWSB(int lev);
+    void cudaCopyNeighborWSB(int lev);
+    void cudaFreeNeighborWSB(int lev);
 
-	void cudaAllocVeloBC(int lev);
-	void cudaCopyVeloBC(int lev);
-	void cudaFreeVeloBC(int lev);
+    void cudaAllocVeloBC(int lev);
+    void cudaCopyVeloBC(int lev);
+    void cudaFreeVeloBC(int lev);
 
-	void cudaAllocOutflowBC(int lev);
-	void cudaCopyOutflowBC(int lev);
-	void cudaFreeOutflowBC(int lev);
+    void cudaAllocOutflowBC(int lev);
+    void cudaCopyOutflowBC(int lev);
+    void cudaFreeOutflowBC(int lev);
 
-	void cudaAllocNoSlipBC(int lev);
-	void cudaCopyNoSlipBC(int lev);
-	void cudaFreeNoSlipBC(int lev);
+    void cudaAllocNoSlipBC(int lev);
+    void cudaCopyNoSlipBC(int lev);
+    void cudaFreeNoSlipBC(int lev);
 
-	void cudaAllocGeomBC(int lev);
-	void cudaCopyGeomBC(int lev);
-	void cudaFreeGeomBC(int lev);
+    void cudaAllocGeomBC(int lev);
+    void cudaCopyGeomBC(int lev);
+    void cudaFreeGeomBC(int lev);
 
-	void cudaAllocPress(int lev);
-	void cudaCopyPress(int lev);
-	void cudaFreePress(int lev);
+    void cudaAllocPress(int lev);
+    void cudaCopyPress(int lev);
+    void cudaFreePress(int lev);
 
-	void cudaAllocForcing();
-	void cudaCopyForcingToDevice();
-	void cudaCopyForcingToHost();
-	void cudaFreeForcing();
+    void cudaAllocForcing();
+    void cudaCopyForcingToDevice();
+    void cudaCopyForcingToHost();
+    void cudaFreeForcing();
 
     void cudaAllocLevelForcing(int level);
-	void cudaCopyLevelForcingToDevice(int level);
-	void cudaFreeLevelForcing(int level);
+    void cudaCopyLevelForcingToDevice(int level);
+    void cudaFreeLevelForcing(int level);
 
-	void cudaAllocQuadricLimiters();
-	void cudaCopyQuadricLimitersToDevice();
-	void cudaFreeQuadricLimiters();
+    void cudaAllocQuadricLimiters();
+    void cudaCopyQuadricLimitersToDevice();
+    void cudaFreeQuadricLimiters();
 
-	//////////////////////////////////////////////////////////////////////////
-	//3D domain decomposition
-	void cudaAllocProcessNeighborX(int lev, unsigned int processNeighbor);
+    //////////////////////////////////////////////////////////////////////////
+    //3D domain decomposition
+    void cudaAllocProcessNeighborX(int lev, unsigned int processNeighbor);
     void cudaCopyProcessNeighborXFsHD(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsRecv,
                                       int streamIndex);
     void cudaCopyProcessNeighborXFsDH(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsSend,
                                       int streamIndex);
-	void cudaCopyProcessNeighborXIndex(int lev, unsigned int processNeighbor);
-	void cudaFreeProcessNeighborX(int lev, unsigned int processNeighbor);
-	//
-	void cudaAllocProcessNeighborY(int lev, unsigned int processNeighbor);
+    void cudaCopyProcessNeighborXIndex(int lev, unsigned int processNeighbor);
+    void cudaFreeProcessNeighborX(int lev, unsigned int processNeighbor);
+    //
+    void cudaAllocProcessNeighborY(int lev, unsigned int processNeighbor);
     void cudaCopyProcessNeighborYFsHD(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsRecv,
                                       int streamIndex);
     void cudaCopyProcessNeighborYFsDH(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsSend,
                                       int streamIndex);
-	void cudaCopyProcessNeighborYIndex(int lev, unsigned int processNeighbor);
+    void cudaCopyProcessNeighborYIndex(int lev, unsigned int processNeighbor);
     void cudaFreeProcessNeighborY(int lev, unsigned int processNeighbor);
-	//
-	void cudaAllocProcessNeighborZ(int lev, unsigned int processNeighbor);
+    //
+    void cudaAllocProcessNeighborZ(int lev, unsigned int processNeighbor);
     void cudaCopyProcessNeighborZFsHD(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsRecv,
                                       int streamIndex);
     void cudaCopyProcessNeighborZFsDH(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsSend,
                                       int streamIndex);
-	void cudaCopyProcessNeighborZIndex(int lev, unsigned int processNeighbor);
-	void cudaFreeProcessNeighborZ(int lev, unsigned int processNeighbor);
-
-	//////////////////////////////////////////////////////////////////////////
-
-	//////////////////////////////////////////////////////////////////////////
-	//3D domain decomposition F3
-	void cudaAllocProcessNeighborF3X(int lev, unsigned int processNeighbor);
-	void cudaCopyProcessNeighborF3XFsHD(int lev, unsigned int processNeighbor);
-	void cudaCopyProcessNeighborF3XFsDH(int lev, unsigned int processNeighbor);
-	void cudaCopyProcessNeighborF3XIndex(int lev, unsigned int processNeighbor);
-	void cudaFreeProcessNeighborF3X(int lev, unsigned int processNeighbor);
-	//
-	void cudaAllocProcessNeighborF3Y(int lev, unsigned int processNeighbor);
-	void cudaCopyProcessNeighborF3YFsHD(int lev, unsigned int processNeighbor);
-	void cudaCopyProcessNeighborF3YFsDH(int lev, unsigned int processNeighbor);
-	void cudaCopyProcessNeighborF3YIndex(int lev, unsigned int processNeighbor);
-	void cudaFreeProcessNeighborF3Y(int lev, unsigned int processNeighbor);
-	//
-	void cudaAllocProcessNeighborF3Z(int lev, unsigned int processNeighbor);
-	void cudaCopyProcessNeighborF3ZFsHD(int lev, unsigned int processNeighbor);
-	void cudaCopyProcessNeighborF3ZFsDH(int lev, unsigned int processNeighbor);
-	void cudaCopyProcessNeighborF3ZIndex(int lev, unsigned int processNeighbor);
-	void cudaFreeProcessNeighborF3Z(int lev, unsigned int processNeighbor);
-	//////////////////////////////////////////////////////////////////////////
-
-	void cudaAllocTurbulentViscosity(int lev);
+    void cudaCopyProcessNeighborZIndex(int lev, unsigned int processNeighbor);
+    void cudaFreeProcessNeighborZ(int lev, unsigned int processNeighbor);
+
+    //////////////////////////////////////////////////////////////////////////
+
+    //////////////////////////////////////////////////////////////////////////
+    //3D domain decomposition F3
+    void cudaAllocProcessNeighborF3X(int lev, unsigned int processNeighbor);
+    void cudaCopyProcessNeighborF3XFsHD(int lev, unsigned int processNeighbor);
+    void cudaCopyProcessNeighborF3XFsDH(int lev, unsigned int processNeighbor);
+    void cudaCopyProcessNeighborF3XIndex(int lev, unsigned int processNeighbor);
+    void cudaFreeProcessNeighborF3X(int lev, unsigned int processNeighbor);
+    //
+    void cudaAllocProcessNeighborF3Y(int lev, unsigned int processNeighbor);
+    void cudaCopyProcessNeighborF3YFsHD(int lev, unsigned int processNeighbor);
+    void cudaCopyProcessNeighborF3YFsDH(int lev, unsigned int processNeighbor);
+    void cudaCopyProcessNeighborF3YIndex(int lev, unsigned int processNeighbor);
+    void cudaFreeProcessNeighborF3Y(int lev, unsigned int processNeighbor);
+    //
+    void cudaAllocProcessNeighborF3Z(int lev, unsigned int processNeighbor);
+    void cudaCopyProcessNeighborF3ZFsHD(int lev, unsigned int processNeighbor);
+    void cudaCopyProcessNeighborF3ZFsDH(int lev, unsigned int processNeighbor);
+    void cudaCopyProcessNeighborF3ZIndex(int lev, unsigned int processNeighbor);
+    void cudaFreeProcessNeighborF3Z(int lev, unsigned int processNeighbor);
+    //////////////////////////////////////////////////////////////////////////
+
+    void cudaAllocTurbulentViscosity(int lev);
     void cudaCopyTurbulentViscosityHD(int lev);
     void cudaCopyTurbulentViscosityDH(int lev);
     void cudaFreeTurbulentViscosity(int lev);
@@ -403,7 +403,7 @@ public:
 
 private:
     std::shared_ptr<Parameter> parameter;
-    double memsizeGPU = 0.;
+    double memsizeGPU = 0.0;
 
 };
 #endif
-- 
GitLab