Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VirtualFluids
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iRMB
VirtualFluids
Commits
5c532920
Commit
5c532920
authored
6 years ago
by
Timon Habenicht
Browse files
Options
Downloads
Patches
Plain Diff
adds new TestInformation
parent
1a6d1d8a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
targets/tests/TestingHULC/Utilities/reader/reader.cpp
+94
-50
94 additions, 50 deletions
targets/tests/TestingHULC/Utilities/reader/reader.cpp
targets/tests/TestingHULC/Utilities/reader/reader.h
+25
-15
25 additions, 15 deletions
targets/tests/TestingHULC/Utilities/reader/reader.h
with
119 additions
and
65 deletions
targets/tests/TestingHULC/Utilities/reader/reader.cpp
+
94
−
50
View file @
5c532920
...
...
@@ -6,35 +6,53 @@
#include
"utilities/input/Input.h"
#include
"utilities/StringUtil/StringUtil.h"
#include
"Utilities\EvaluationParameter\EvaluationParameter.h"
#include
"Utilities\TestInformation\TestInformationImp.h"
#include
"Utilities\TestParameter\TaylorGreenTestParameter\TaylorGreenTestParameter.h"
#include
"Utilities\TestParameter\ShearWaveTestParameter\ShearWaveTestParameter.h"
#include
"Utilities\TestResults\PhiAndNuTestResults.h"
void
Reader
::
calcNumberOfEqualTests
()
#include
"Utilities/TestInformation/TestInformationImp.h"
#include
"Utilities/TestParameter/TaylorGreenTestParameter/TaylorGreenTestParameter.h"
#include
"Utilities/TestParameter/ShearWaveTestParameter/ShearWaveTestParameter.h"
#include
"Tests/PhiAndNuTest/PhiAndNuTest.h"
#include
"Utilities/TestCout/TestCoutImp.h"
#include
"Utilities/SimulationInfo/SimulationInfoImp.h"
#include
"Utilities/LogFileInformation/LogFileInformation.h"
#include
"Utilities/LogFileInformation/LogFileInformationOutput/LogFileInformationOutput.h"
#include
"Utilities/LogFileInformation/BasicSimulationInfo/BasicSimulationInfo.h"
#include
"Utilities/LogFileInformation/TaylorGreenInformation/TaylorGreenInformation.h"
#include
"Utilities/LogFileInformation/ShearWaveInformation/ShearWaveInformation.h"
#include
"Utilities/LogFileInformation/SimulationTimeInformation/SimulationTimeInformation.h"
bool
Reader
::
testShouldRun
(
std
::
vector
<
bool
>
test
)
{
for
(
int
i
=
0
;
i
<
tgv
.
size
();
i
++
)
if
(
tgv
.
at
(
i
))
numberOfTaylorGreenTests
++
;
for
(
int
i
=
0
;
i
<
sw
.
size
();
i
++
)
if
(
sw
.
at
(
i
))
numberOfShearWaveTests
++
;
for
(
int
i
=
0
;
i
<
test
.
size
();
i
++
)
{
if
(
test
.
at
(
i
))
return
true
;
}
return
false
;
}
std
::
shared_ptr
<
Reader
>
Reader
::
getNewInstance
(
const
std
::
string
aFilePath
)
{
return
std
::
shared_ptr
<
Reader
>
(
new
Reader
(
aFilePath
));
}
std
::
shared_ptr
<
TestInformation
>
Reader
::
getTestInformation
()
{
return
testInfo
;
}
std
::
vector
<
std
::
shared_ptr
<
TestParameter
>>
Reader
::
getTestParameter
()
{
return
testParameter
;
}
Reader
::
Reader
(
const
std
::
string
aFilePath
)
{
std
::
ifstream
stream
;
stream
.
open
(
aFilePath
.
c_str
(),
std
::
ios
::
in
);
std
::
unique_ptr
<
input
::
Input
>
input
=
input
::
Input
::
makeInput
(
stream
,
"config"
);
devices
=
StringUtil
::
toVector
(
input
->
getValue
(
"Devices"
));
viscosity
=
StringUtil
::
toDouble
(
input
->
getValue
(
"Viscosity"
));
minOrderOfAccuracy
=
StringUtil
::
toDouble
(
input
->
getValue
(
"MinOrderOfAccuracy"
));
...
...
@@ -84,60 +102,86 @@ Reader::Reader(const std::string aFilePath)
stream
.
close
();
numberOfTaylorGreenTests
=
0
;
numberOfShearWaveTests
=
0
;
calcNumberOfEqualTests
();
testResults
.
resize
(
0
);
simInfo
.
resize
(
0
);
testOutput
=
TestCoutImp
::
getNewInstance
();
makeTestParameter
();
makeTestInformation
();
}
std
::
vector
<
std
::
shared_ptr
<
EvaluationParameter
>>
Reader
::
makeEvaluationParameter
()
void
Reader
::
makeTestInformation
()
{
std
::
vector
<
std
::
shared_ptr
<
EvaluationParameter
>>
evaPara
;
testInfo
=
TestInformationImp
::
getNewInstance
()
;
for
(
int
i
=
0
;
i
<
tgv
.
size
();
i
++
)
{
if
(
tgv
.
at
(
i
))
{
evaPara
.
push_back
(
EvaluationParameter
::
getNewInstance
(
"TaylorGreenVortex"
,
numberOfTaylorGreenTests
,
l
.
at
(
i
),
"vX"
,
logFilePath
,
minOrderOfAccuracy
,
writeFiles
,
viscosity
));
}
}
for
(
int
i
=
0
;
i
<
sw
.
size
();
i
++
)
{
if
(
sw
.
at
(
i
))
{
evaPara
.
push_back
(
EvaluationParameter
::
getNewInstance
(
"ShearWave"
,
numberOfShearWaveTests
,
l
.
at
(
i
),
"vZ"
,
logFilePath
,
minOrderOfAccuracy
,
writeFiles
,
viscosity
));
}
}
return
evaPara
;
makeSimulationInfo
();
testInfo
->
setSimulationInfo
(
simInfo
);
testInfo
->
setLogFilePath
(
logFilePath
);
makeLogFileInformation
();
testInfo
->
setLogFileInformation
(
logInfo
);
}
std
::
shared_ptr
<
TestInformation
>
Reader
::
makeTest
Information
()
void
Reader
::
makeTest
Parameter
()
{
bool
tgvTest
=
false
;
bool
swTest
=
false
;
for
(
int
i
=
0
;
i
<
tgv
.
size
();
i
++
)
{
if
(
tgv
.
at
(
i
))
tgvTest
=
true
;
if
(
testShouldRun
(
tgv
))
{
std
::
shared_ptr
<
PhiAndNuTest
>
tgvTestResults
=
PhiAndNuTest
::
getNewInstance
(
"TaylorGreenVortex"
,
minOrderOfAccuracy
,
testOutput
);
testResults
.
push_back
(
tgvTestResults
);
for
(
int
i
=
0
;
i
<
tgv
.
size
();
i
++
)
{
if
(
tgv
.
at
(
i
))
{
testParameter
.
push_back
(
TaylorGreenTestParameter
::
getNewInstance
(
u0TGV
,
amplitudeTGV
,
viscosity
,
l
.
at
(
i
),
numberOfTimeSteps
,
basisTimeStepLength
,
startStepCalculation
,
ySliceForCalculation
,
grids
.
at
(
i
),
writeFiles
,
startStepFileWriter
,
filePath
,
tgvTestResults
,
devices
));
}
}
}
for
(
int
i
=
0
;
i
<
sw
.
size
();
i
++
)
{
if
(
sw
.
at
(
i
))
swTest
=
true
;
if
(
testShouldRun
(
sw
))
{
std
::
shared_ptr
<
PhiAndNuTest
>
swTestResults
=
PhiAndNuTest
::
getNewInstance
(
"ShearWave"
,
minOrderOfAccuracy
,
testOutput
);
testResults
.
push_back
(
swTestResults
);
for
(
int
i
=
0
;
i
<
sw
.
size
();
i
++
)
{
if
(
sw
.
at
(
i
))
{
testParameter
.
push_back
(
ShearWaveTestParameter
::
getNewInstance
(
u0SW
,
v0SW
,
viscosity
,
l
.
at
(
i
),
numberOfTimeSteps
,
basisTimeStepLength
,
startStepCalculation
,
ySliceForCalculation
,
grids
.
at
(
i
),
writeFiles
,
startStepFileWriter
,
filePath
,
swTestResults
,
devices
));
}
}
}
std
::
shared_ptr
<
TestInformation
>
testInfo
=
TestInformationImp
::
getNewInstance
(
numberOfTimeSteps
,
basisTimeStepLength
,
startStepCalculation
,
viscosity
,
tgvTest
,
u0TGV
,
amplitudeTGV
,
swTest
,
u0SW
,
v0SW
);
return
testInfo
;
}
std
::
vector
<
std
::
shared_ptr
<
TestParameter
>>
Reader
::
makeTestParameter
()
void
Reader
::
makeSimulationInfo
()
{
std
::
vector
<
std
::
shared_ptr
<
TestParameter
>>
testParameter
;
std
::
shared_ptr
<
PhiAndNuTestResults
>
tgvTestResults
=
PhiAndNuTestResults
::
getNewInstance
(
"TaylorGreenVortex"
);
std
::
shared_ptr
<
PhiAndNuTestResults
>
swTestResults
=
PhiAndNuTestResults
::
getNewInstance
(
"ShearWave"
);
for
(
int
i
=
0
;
i
<
tgv
.
size
();
i
++
)
{
if
(
tgv
.
at
(
i
))
{
testParameter
.
push_back
(
TaylorGreenTestParameter
::
getNewInstance
(
u0TGV
,
amplitudeTGV
,
viscosity
,
l
.
at
(
i
),
numberOfTimeSteps
,
basisTimeStepLength
,
startStepCalculation
,
ySliceForCalculation
,
grids
.
at
(
i
),
writeFiles
,
startStepFileWriter
,
filePath
,
tgvTestResults
));
simInfo
.
push_back
(
SimulationInfoImp
::
getNewInstance
(
testOutput
,
"TaylorGreenVortex"
,
l
.
at
(
i
)
));
}
}
for
(
int
i
=
0
;
i
<
sw
.
size
();
i
++
)
{
if
(
sw
.
at
(
i
))
{
testParameter
.
push_back
(
ShearWaveTestParameter
::
getNewInstance
(
u0SW
,
v0SW
,
viscosity
,
l
.
at
(
i
),
numberOfTimeSteps
,
basisTimeStepLength
,
startStepCalculation
,
ySliceForCalculation
,
grids
.
at
(
i
),
writeFiles
,
startStepFileWriter
,
filePath
,
swTestResults
));
simInfo
.
push_back
(
SimulationInfoImp
::
getNewInstance
(
testOutput
,
"ShearWave"
,
l
.
at
(
i
)
));
}
}
}
return
testParameter
;
void
Reader
::
makeLogFileInformation
()
{
logInfo
.
push_back
(
LogFileInformationOutput
::
getNewInstance
(
devices
));
logInfo
.
push_back
(
BasicSimulationInfo
::
getNewInstance
(
numberOfTimeSteps
,
basisTimeStepLength
,
startStepCalculation
,
viscosity
));
if
(
testShouldRun
(
tgv
))
logInfo
.
push_back
(
TaylorGreenInformation
::
getNewInstance
(
u0TGV
,
amplitudeTGV
));
if
(
testShouldRun
(
sw
))
logInfo
.
push_back
(
ShearWaveInformation
::
getNewInstance
(
u0SW
,
v0SW
));
logInfo
.
push_back
(
SimulationTimeInformation
::
getNewInstance
(
simInfo
,
writeFiles
));
for
(
int
i
=
0
;
i
<
testResults
.
size
();
i
++
)
{
logInfo
.
push_back
(
testResults
.
at
(
i
));
}
}
std
::
vector
<
std
::
shared_ptr
<
TestResults
>
>
Reader
::
getAllTestResults
()
{
std
::
vector
<
std
::
shared_ptr
<
TestResults
>
>
allTestResults
;
for
(
int
i
=
0
;
i
<
testResults
.
size
();
i
++
)
{
allTestResults
.
push_back
(
testResults
.
at
(
i
));
}
return
allTestResults
;
}
This diff is collapsed.
Click to expand it.
targets/tests/TestingHULC/Utilities/reader/reader.h
+
25
−
15
View file @
5c532920
...
...
@@ -7,46 +7,56 @@
#include
<vector>
#include
<string>
class
EvaluationParameter
;
class
TestInformation
;
class
TestParameter
;
class
TestResults
;
class
TestCout
;
class
TestInformationImp
;
class
PhiAndNuTest
;
class
SimulationInfo
;
class
LogFileInformation
;
class
Reader
{
public:
static
std
::
shared_ptr
<
Reader
>
getNewInstance
(
const
std
::
string
aFilePath
);
std
::
vector
<
std
::
shared_ptr
<
EvaluationParameter
>
>
makeEvaluationParameter
();
std
::
shared_ptr
<
TestInformation
>
makeTestInformation
();
std
::
vector
<
std
::
shared_ptr
<
TestParameter
>
>
makeTestParameter
();
static
std
::
shared_ptr
<
Reader
>
getNewInstance
(
const
std
::
string
aFilePath
);
std
::
shared_ptr
<
TestInformation
>
getTestInformation
();
std
::
vector
<
std
::
shared_ptr
<
TestParameter
>
>
getTestParameter
();
std
::
vector
<
std
::
shared_ptr
<
TestResults
>
>
getAllTestResults
();
protected:
Reader
()
{};
Reader
(
const
std
::
string
aFilePath
);
private
:
void
calcNumberOfEqualTests
();
void
makeTestInformation
();
void
makeTestParameter
();
void
makeSimulationInfo
();
void
makeLogFileInformation
();
bool
testShouldRun
(
std
::
vector
<
bool
>
test
);
std
::
vector
<
int
>
devices
;
real
viscosity
;
double
minOrderOfAccuracy
;
real
u0SW
,
v0SW
;
real
amplitudeTGV
,
u0TGV
;
unsigned
int
numberOfTimeSteps
,
basisTimeStepLength
,
startStepCalculation
;
unsigned
int
ySliceForCalculation
;
std
::
vector
<
real
>
l
;
std
::
vector
<
std
::
string
>
grids
;
bool
writeFiles
;
std
::
string
filePath
;
unsigned
int
startStepFileWriter
;
std
::
string
logFilePath
;
std
::
vector
<
bool
>
tgv
;
std
::
vector
<
bool
>
sw
;
real
u0SW
,
v0SW
;
real
amplitudeTGV
,
u0TGV
;
int
numberOfTaylorGreenTests
,
numberOfShearWaveTests
;
std
::
vector
<
std
::
shared_ptr
<
PhiAndNuTest
>
>
testResults
;
std
::
shared_ptr
<
TestCout
>
testOutput
;
std
::
vector
<
std
::
shared_ptr
<
TestParameter
>
>
testParameter
;
std
::
shared_ptr
<
TestInformationImp
>
testInfo
;
std
::
vector
<
std
::
shared_ptr
<
SimulationInfo
>
>
simInfo
;
std
::
vector
<
std
::
shared_ptr
<
LogFileInformation
>
>
logInfo
;
};
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment