Skip to content

Commit 805a50a

Browse files
committed
Adding headers and clang format
1 parent 5204783 commit 805a50a

2 files changed

Lines changed: 82 additions & 33 deletions

File tree

UnitTests/Common/geometry/CGeometry_test.cpp

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
/*!
2+
* \file CGeometry_tests.cpp
3+
* \brief Unit tests for CGeometry.
4+
* \author T. Albring
5+
* \version 7.0.5 "Blackbird"
6+
*
7+
* SU2 Project Website: https://su2code.github.io
8+
*
9+
* The SU2 Project is maintained by the SU2 Foundation
10+
* (http://su2foundation.org)
11+
*
12+
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
13+
*
14+
* SU2 is free software; you can redistribute it and/or
15+
* modify it under the terms of the GNU Lesser General Public
16+
* License as published by the Free Software Foundation; either
17+
* version 2.1 of the License, or (at your option) any later version.
18+
*
19+
* SU2 is distributed in the hope that it will be useful,
20+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22+
* Lesser General Public License for more details.
23+
*
24+
* You should have received a copy of the GNU Lesser General Public
25+
* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26+
*/
27+
128
#include "catch.hpp"
229
#include "../../UnitQuadTestCase.hpp"
330

@@ -137,4 +164,4 @@ TEST_CASE("Set bound control volume", "[Geometry]"){
137164
CHECK(TestCase->geometry->vertex[3][2]->GetNormal()[1] == -0.0625);
138165
CHECK(TestCase->geometry->vertex[5][3]->GetNormal()[2] == 0.03125);
139166

140-
}
167+
}

UnitTests/UnitQuadTestCase.hpp

Lines changed: 54 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,80 @@
1+
/*!
2+
* \file UnitQuadTestCase.hpp
3+
* \brief Simple unit quad test to be used in unit tests.
4+
* \author T. Albring
5+
* \version 7.0.5 "Blackbird"
6+
*
7+
* SU2 Project Website: https://su2code.github.io
8+
*
9+
* The SU2 Project is maintained by the SU2 Foundation
10+
* (http://su2foundation.org)
11+
*
12+
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
13+
*
14+
* SU2 is free software; you can redistribute it and/or
15+
* modify it under the terms of the GNU Lesser General Public
16+
* License as published by the Free Software Foundation; either
17+
* version 2.1 of the License, or (at your option) any later version.
18+
*
19+
* SU2 is distributed in the hope that it will be useful,
20+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22+
* Lesser General Public License for more details.
23+
*
24+
* You should have received a copy of the GNU Lesser General Public
25+
* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26+
*/
27+
128
#pragma once
229

330
#include <string>
431

5-
#include "../SU2_CFD/include/solvers/CSolverFactory.hpp"
632
#include "../Common/include/geometry/CPhysicalGeometry.hpp"
733
#include "../SU2_CFD/include/solvers/CNSSolver.hpp"
34+
#include "../SU2_CFD/include/solvers/CSolverFactory.hpp"
835

936
struct UnitQuadTestCase {
10-
11-
const std::string config_options = "SOLVER= NAVIER_STOKES\n"
12-
"KIND_VERIFICATION_SOLUTION=MMS_NS_UNIT_QUAD\n"
13-
"MESH_FORMAT= BOX\n"
14-
"INIT_OPTION=TD_CONDITIONS\n"
15-
"MACH_NUMBER=0.5\n"
16-
"MARKER_HEATFLUX= (y_minus, 0.0, y_plus, 0.0)\n"
17-
"MARKER_CUSTOM= ( x_minus, x_plus, z_plus, z_minus)\n"
18-
"VISCOSITY_MODEL= CONSTANT_VISCOSITY\n"
19-
"CONV_FIELD=RMS_DENSITY\n"
20-
"MESH_BOX_SIZE=5,5,5\n"
21-
"MESH_BOX_LENGTH=1,1,1\n"
22-
"MESH_BOX_OFFSET=0,0,0\n"
23-
"REF_ORIGIN_MOMENT_X=0.0\n"
24-
"REF_ORIGIN_MOMENT_Y=0.0\n"
25-
"REF_ORIGIN_MOMENT_Z=0.0\n";
37+
const std::string config_options =
38+
"SOLVER= NAVIER_STOKES\n"
39+
"KIND_VERIFICATION_SOLUTION=MMS_NS_UNIT_QUAD\n"
40+
"MESH_FORMAT= BOX\n"
41+
"INIT_OPTION=TD_CONDITIONS\n"
42+
"MACH_NUMBER=0.5\n"
43+
"MARKER_HEATFLUX= (y_minus, 0.0, y_plus, 0.0)\n"
44+
"MARKER_CUSTOM= ( x_minus, x_plus, z_plus, z_minus)\n"
45+
"VISCOSITY_MODEL= CONSTANT_VISCOSITY\n"
46+
"CONV_FIELD=RMS_DENSITY\n"
47+
"MESH_BOX_SIZE=5,5,5\n"
48+
"MESH_BOX_LENGTH=1,1,1\n"
49+
"MESH_BOX_OFFSET=0,0,0\n"
50+
"REF_ORIGIN_MOMENT_X=0.0\n"
51+
"REF_ORIGIN_MOMENT_Y=0.0\n"
52+
"REF_ORIGIN_MOMENT_Z=0.0\n";
2653
std::stringstream ss;
27-
std::unique_ptr<CConfig> config;
54+
std::unique_ptr<CConfig> config;
2855
std::unique_ptr<CGeometry> geometry;
2956
CSolver** solver{nullptr};
3057
streambuf* orig_buf{nullptr};
3158
UnitQuadTestCase() : ss(config_options), orig_buf(cout.rdbuf()) {}
3259

33-
void InitConfig(){
60+
void InitConfig() {
3461
cout.rdbuf(nullptr);
3562
config = std::unique_ptr<CConfig>(new CConfig(ss, SU2_CFD, false));
3663
cout.rdbuf(orig_buf);
3764
}
3865

39-
void InitSolver(){
66+
void InitSolver() {
4067
cout.rdbuf(nullptr);
4168
solver = new CSolver*[MAX_SOLS];
4269
solver[FLOW_SOL] = new CNSSolver(geometry.get(), config.get(), 0);
4370
cout.rdbuf(orig_buf);
44-
4571
}
4672

47-
void InitGeometry(){
73+
void InitGeometry() {
4874
cout.rdbuf(nullptr);
4975
{
5076
auto aux_geometry = std::unique_ptr<CGeometry>(new CPhysicalGeometry(config.get(), 0, 1));
51-
geometry = std::unique_ptr<CGeometry>(new CPhysicalGeometry(aux_geometry.get(), config.get()));
77+
geometry = std::unique_ptr<CGeometry>(new CPhysicalGeometry(aux_geometry.get(), config.get()));
5278
}
5379
geometry->SetSendReceive(config.get());
5480
geometry->SetBoundaries(config.get());
@@ -63,17 +89,13 @@ struct UnitQuadTestCase {
6389
geometry->SetBoundControlVolume(config.get(), ALLOCATE);
6490
geometry->FindNormal_Neighbor(config.get());
6591
geometry->SetGlobal_to_Local_Point();
66-
geometry->PreprocessP2PComms(geometry.get(),config.get());
92+
geometry->PreprocessP2PComms(geometry.get(), config.get());
6793

6894
cout.rdbuf(orig_buf);
69-
7095
}
7196

72-
~UnitQuadTestCase(){
73-
if (solver != nullptr){
74-
delete solver[FLOW_SOL];
75-
delete [] solver;
76-
}
97+
~UnitQuadTestCase() {
98+
delete solver;
99+
delete [] solver;
77100
}
78-
79-
};
101+
};

0 commit comments

Comments
 (0)