Skip to content

Commit

Permalink
Merge branch 'clang-format' into 'master'
Browse files Browse the repository at this point in the history
Clang format

Closes #3420

See merge request ogs/ogs!4826
  • Loading branch information
bilke committed Nov 29, 2023
2 parents 6da4167 + 2047023 commit b021952
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 78 deletions.
3 changes: 2 additions & 1 deletion Applications/DataExplorer/DataView/GEOModels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ std::vector<std::string> GEOModels::getGeometryNames() const
{
return _geo_objects.getGeometryNames();
}
const std::vector<GeoLib::Point*>* GEOModels::getPointVec(const std::string& name) const
const std::vector<GeoLib::Point*>* GEOModels::getPointVec(
const std::string& name) const
{
return _geo_objects.getPointVec(name);
}
Expand Down
2 changes: 0 additions & 2 deletions Applications/DataExplorer/DataView/ModellingTabWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
*
*/

// ** INCLUDES **
//#include "ProcessModel.h"
#include "ModellingTabWidget.h"

ModellingTabWidget::ModellingTabWidget(QWidget* parent /*= 0*/)
Expand Down
1 change: 0 additions & 1 deletion Applications/DataExplorer/DataView/ProcessView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "CondItem.h"
#include "ProcessModel.h"
#include "ProcessVarItem.h"
//#include "FEMConditionSetupDialog.h"
#include "SelectMeshDialog.h"

ProcessView::ProcessView(QWidget* parent) : QTreeView(parent) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@
*
*/

// ** INCLUDES **
#include "VtkCompositeNodeSelectionFilter.h"

#include <memory>
//#include "VtkCompositePointToGlyphFilter.h"
#include <vtkDataSetAlgorithm.h>
#include <vtkGlyph3D.h>
#include <vtkSmartPointer.h>
#include <vtkSphereSource.h>

#include <memory>

#include "VtkPointsSource.h"

VtkCompositeNodeSelectionFilter::VtkCompositeNodeSelectionFilter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*
*/

// ** INCLUDES **
#include "VtkCompositeTextureOnSurfaceFilter.h"

#include <vtkDataSetSurfaceFilter.h>
Expand All @@ -31,8 +30,6 @@
#include <QFileInfo>
#include <QSettings>

//#include "VtkCompositeColormapToImageFilter.h"

VtkCompositeTextureOnSurfaceFilter::VtkCompositeTextureOnSurfaceFilter(
vtkAlgorithm* inputAlgorithm)
: VtkCompositeFilter(inputAlgorithm)
Expand Down
6 changes: 3 additions & 3 deletions Applications/Utils/MeshEdit/Vtu2Grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ int main(int argc, char* argv[])
MathLib::Point3d const max(
std::array<double, 3>{bounds[1], bounds[3], bounds[5]});
std::array<double, 3> ranges = {max[0] - min[0], max[1] - min[1],
max[2] - min[2]};
max[2] - min[2]};
if (ranges[0] < 0 || ranges[1] < 0 || ranges[2] < 0)
{
ERR("The range ({},{},{}) is not allowed to be < 0",
ranges[0], ranges[1], ranges[2]);
ERR("The range ({},{},{}) is not allowed to be < 0", ranges[0],
ranges[1], ranges[2]);
#ifdef USE_PETSC
MPI_Finalize();
#endif
Expand Down
1 change: 1 addition & 0 deletions MathLib/LinAlg/MatrixVectorTraits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

#include "MatrixVectorTraits.h"

#include <cassert>

#include "MatrixSpecifications.h"
Expand Down
4 changes: 2 additions & 2 deletions MeshLib/IO/XDMF/transformData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ std::optional<XdmfHdfData> transformAttribute(
// lambda f : Collects properties from the propertyVectorBase. It captures
// (and overwrites) data that can only be collected via the typed property.
// It has boolean return type to allow kind of pipe using || operator.
auto f = [&data_type, &num_of_tuples, &data_ptr, &property_pair](
auto basic_type) -> bool
auto f = [&data_type, &num_of_tuples, &data_ptr,
&property_pair](auto basic_type) -> bool
{
auto const property_base = property_pair.second;
auto const typed_property =
Expand Down
4 changes: 2 additions & 2 deletions Tests/GeoLib/CreateTestPoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ void createSetOfTestPointsAndAssociatedNames(GeoLib::GEOObjects& geo_objs,
for (std::size_t i(0); i < pnts_per_edge; i++)
{
std::size_t const id(i + offset);
pnts.push_back(new GeoLib::Point(
i + shift[0], j + shift[1], k + shift[2], id));
pnts.push_back(new GeoLib::Point(i + shift[0], j + shift[1],
k + shift[2], id));
std::string const pnt_name(name + "-" + std::to_string(i) +
"-" + std::to_string(j) + "-" +
std::to_string(k));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ TEST(MaterialPropertyLib, SaturationWeightedThermalConductivity1Dgeometric)
ParameterLib::ConstantParameter<double> const k_wet{"k_wet", {1.5}};

auto const k_model_eff = MPL::SaturationWeightedThermalConductivity<
MaterialPropertyLib::MeanType::GEOMETRIC, 1>(
"thermal_conductivity", k_dry, k_wet);
MaterialPropertyLib::MeanType::GEOMETRIC, 1>("thermal_conductivity",
k_dry, k_wet);

ParameterLib::SpatialPosition const pos;
double const t = std::numeric_limits<double>::quiet_NaN();
Expand Down Expand Up @@ -536,8 +536,8 @@ TEST(MaterialPropertyLib, SaturationWeightedThermalConductivity3Dgeometric)
ParameterLib::ConstantParameter<double> const k_wet{"k_wet", {1.5}};

auto const k_model_eff = MPL::SaturationWeightedThermalConductivity<
MaterialPropertyLib::MeanType::GEOMETRIC, 3>(
"thermal_conductivity", k_dry, k_wet);
MaterialPropertyLib::MeanType::GEOMETRIC, 3>("thermal_conductivity",
k_dry, k_wet);

ParameterLib::SpatialPosition const pos;
double const t = std::numeric_limits<double>::quiet_NaN();
Expand Down
20 changes: 10 additions & 10 deletions Tests/MaterialLib/TestMPLWaterDensity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,27 @@ TEST(Material, checkWaterDensityIAPWSIF97Region1_)

const double rho_expected = 890.98496087498256;

ASSERT_NEAR(rho_expected, property.template value<double>(
variable_array, pos, t, dt), 1.e-10);
ASSERT_NEAR(rho_expected,
property.template value<double>(variable_array, pos, t, dt),
1.e-10);

const double drho_dT = property.template dValue<double>(
variable_array, MaterialPropertyLib::Variable::temperature, pos,
t, dt);
variable_array, MaterialPropertyLib::Variable::temperature, pos, t, dt);
const double drho_dp = property.template dValue<double>(
variable_array, MaterialPropertyLib::Variable::phase_pressure, pos,
t, dt);
variable_array, MaterialPropertyLib::Variable::phase_pressure, pos, t,
dt);

const double perturbation = 1.e-4;

// Test the differentiation: with respect to temperature:
variable_array.temperature += perturbation;
const double rho_T1 = property.template value<double>(
variable_array, pos, t, dt);
const double rho_T1 =
property.template value<double>(variable_array, pos, t, dt);
ASSERT_NEAR((rho_T1 - rho_expected) / perturbation, drho_dT, 1.e-6);

// Test the differentiation: with respect to pressure:
variable_array.phase_pressure += perturbation;
const double rho_p1 = property.template value<double>(
variable_array, pos, t, dt);
const double rho_p1 =
property.template value<double>(variable_array, pos, t, dt);
ASSERT_NEAR((rho_p1 - rho_T1) / perturbation, drho_dp, 1.e-6);
}
7 changes: 4 additions & 3 deletions Tests/MaterialLib/TestMPLWaterEnthalpyIAPWSIF97Region4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ TEST(Material, checkWaterVapourEnthalpyIAPWSIF97Region4)
for (int i = 0; i < 4; i++)
{
variable_array.phase_pressure = p[i];
ASSERT_NEAR(expected_h[i],
property.template value<double>(variable_array, pos, t, dt) / 1e3,
1.e-8);
ASSERT_NEAR(
expected_h[i],
property.template value<double>(variable_array, pos, t, dt) / 1e3,
1.e-8);
}
}
1 change: 0 additions & 1 deletion Tests/MaterialLib/TestMPLWaterSaturationTemperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <gtest/gtest.h>

#include <array>

#include <memory>

#include "MaterialLib/MPL/Properties/CreateWaterSaturationTemperatureIAPWSIF97Region4.h"
Expand Down
27 changes: 12 additions & 15 deletions Tests/MaterialLib/TestMPLWaterThermalConductivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,35 @@ TEST(Material, checkWaterThermalConductivityIAPWS_)
const double T[] = {298.15, 298.15, 298.15, 873.15};
const double rho[] = {0, 998, 1200, 0};

const double expected_lambda[] = {18.4341883e-3, 607.712868e-3, 799.038144e-3, 79.1034659e-3};
const double expected_lambda[] = {18.4341883e-3, 607.712868e-3,
799.038144e-3, 79.1034659e-3};

const double perturbation = 1.e-8;
for (int i = 0; i < 4; i++)
{
// Test lambda
variable_array.temperature = T[i];
variable_array.density = rho[i];
const double lambda = property.template value<double>(
variable_array, pos, t, dt);
const double lambda =
property.template value<double>(variable_array, pos, t, dt);
ASSERT_NEAR(expected_lambda[i], lambda, 1.e-9);

const double dlambda_dT = property.template dValue<double>(
variable_array, MaterialPropertyLib::Variable::temperature, pos,
t, dt);
variable_array, MaterialPropertyLib::Variable::temperature, pos, t,
dt);
const double dlambda_drho = property.template dValue<double>(
variable_array, MaterialPropertyLib::Variable::density, pos,
t, dt);
variable_array, MaterialPropertyLib::Variable::density, pos, t, dt);

// Test dlambda/dT
variable_array.temperature =
T[i] + perturbation;
double lambda1 = property.template value<double>(
variable_array, pos, t, dt);
variable_array.temperature = T[i] + perturbation;
double lambda1 =
property.template value<double>(variable_array, pos, t, dt);
ASSERT_NEAR((lambda1 - lambda) / perturbation, dlambda_dT, 8.e-6);

// Test dlambda/drho
variable_array.temperature = T[i];
variable_array.density =
rho[i] + perturbation;
lambda1 = property.template value<double>(
variable_array, pos, t, dt);
variable_array.density = rho[i] + perturbation;
lambda1 = property.template value<double>(variable_array, pos, t, dt);

ASSERT_NEAR((lambda1 - lambda) / perturbation, dlambda_drho, 8.e-6);
}
Expand Down
49 changes: 21 additions & 28 deletions Tests/MaterialLib/TestMPLWaterViscosity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

#include <memory>

#include "MaterialLib/MPL/Properties/Viscosity/CreateWaterViscosityIAPWS.h"
#include "MaterialLib/MPL/Properties/Viscosity/CreateLiquidViscosityVogels.h"
#include "MaterialLib/MPL/Properties/Viscosity/CreateWaterViscosityIAPWS.h"
#include "TestMPL.h"

TEST(Material, checkWaterViscosityIAPWS_)
Expand Down Expand Up @@ -52,30 +52,26 @@ TEST(Material, checkWaterViscosityIAPWS_)
// Test mu
variable_array.temperature = T[i];
variable_array.density = rho[i];
const double mu = property.template value<double>(
variable_array, pos, t, dt);
const double mu =
property.template value<double>(variable_array, pos, t, dt);
ASSERT_NEAR(expected_mumu[i] * 1.e-6, mu, 1.e-9);

const double dmu_dT = property.template dValue<double>(
variable_array, MaterialPropertyLib::Variable::temperature, pos,
t, dt);
variable_array, MaterialPropertyLib::Variable::temperature, pos, t,
dt);
const double dmu_drho = property.template dValue<double>(
variable_array, MaterialPropertyLib::Variable::density, pos,
t, dt);
variable_array, MaterialPropertyLib::Variable::density, pos, t, dt);

// Test dmu/dT
variable_array.temperature =
T[i] + perturbation;
double mu1 = property.template value<double>(
variable_array, pos, t, dt);
variable_array.temperature = T[i] + perturbation;
double mu1 =
property.template value<double>(variable_array, pos, t, dt);
ASSERT_NEAR((mu1 - mu) / perturbation, dmu_dT, 8.e-6);

// Test dmu/drho
variable_array.temperature = T[i];
variable_array.density =
rho[i] + perturbation;
mu1 = property.template value<double>(
variable_array, pos, t, dt);
variable_array.density = rho[i] + perturbation;
mu1 = property.template value<double>(variable_array, pos, t, dt);

ASSERT_NEAR((mu1 - mu) / perturbation, dmu_drho, 8.e-6);
}
Expand All @@ -99,11 +95,10 @@ TEST(Material, checkVogelViscosity_)
double const dt = std::numeric_limits<double>::quiet_NaN();

variable_array.temperature = 303.;
auto const mu_w = property_w.template value<double>(
variable_array, pos, t, dt);
auto const mu_w =
property_w.template value<double>(variable_array, pos, t, dt);
auto const dmu_w_dT = property_w.template dValue<double>(
variable_array, MaterialPropertyLib::Variable::temperature,
pos, t, dt);
variable_array, MaterialPropertyLib::Variable::temperature, pos, t, dt);
ASSERT_NEAR(0.802657e-3, mu_w, 1.e-5);
ASSERT_NEAR(-1.87823e-5, dmu_w_dT, 1.e-5);

Expand All @@ -119,12 +114,11 @@ TEST(Material, checkVogelViscosity_)
MaterialPropertyLib::Property const& property_co2 = *property_ptr_co2;

variable_array.temperature = 255.04;
auto const mu_co2 = property_co2.template value<double>(
variable_array, pos, t, dt);
auto const mu_co2 =
property_co2.template value<double>(variable_array, pos, t, dt);
auto const dmu_co2_dT = property_co2.template dValue<double>(
variable_array, MaterialPropertyLib::Variable::temperature,
pos, t, dt);
ASSERT_NEAR(0.137956e-3, mu_co2,1.e-5);
variable_array, MaterialPropertyLib::Variable::temperature, pos, t, dt);
ASSERT_NEAR(0.137956e-3, mu_co2, 1.e-5);
ASSERT_NEAR(-2.35664e-6, dmu_co2_dT, 1.e-5);

const char xml_ch4[] =
Expand All @@ -139,11 +133,10 @@ TEST(Material, checkVogelViscosity_)
MaterialPropertyLib::Property const& property_ch4 = *property_ptr_ch4;

variable_array.temperature = 172.0;
auto const mu_ch4 = property_ch4.template value<double>(
variable_array, pos, t, dt);
auto const mu_ch4 =
property_ch4.template value<double>(variable_array, pos, t, dt);
auto const dmu_ch4_dT = property_ch4.template dValue<double>(
variable_array, MaterialPropertyLib::Variable::temperature,
pos, t, dt);
variable_array, MaterialPropertyLib::Variable::temperature, pos, t, dt);
ASSERT_NEAR(0.352072e-4, mu_ch4, 1.e-5);
ASSERT_NEAR(-2.35664e-6, dmu_ch4_dT, 1.e-5);
}

0 comments on commit b021952

Please sign in to comment.