From ff85a48b5120e1a832a2e3a47ace40679679dee7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Sch=C3=B6nherr?= <schoen@irmb.tu-bs.de>
Date: Mon, 15 Jun 2020 22:37:51 +0200
Subject: [PATCH] added two flags: 1. calcPlaneConc and 2. writeVeloASCIIfiles

---
 src/Core/Input/ConfigData/ConfigData.h        |  4 +++
 src/Core/Input/ConfigData/ConfigDataImp.cpp   | 32 +++++++++++++++++++
 src/Core/Input/ConfigData/ConfigDataImp.h     | 10 ++++++
 src/VirtualFluids_GPU/LBM/Simulation.cpp      |  5 +--
 src/VirtualFluids_GPU/Parameter/Parameter.cpp | 28 +++++++++++++++-
 src/VirtualFluids_GPU/Parameter/Parameter.h   |  6 ++++
 6 files changed, 82 insertions(+), 3 deletions(-)

diff --git a/src/Core/Input/ConfigData/ConfigData.h b/src/Core/Input/ConfigData/ConfigData.h
index 89f65b0cd..acd5ee053 100644
--- a/src/Core/Input/ConfigData/ConfigData.h
+++ b/src/Core/Input/ConfigData/ConfigData.h
@@ -24,6 +24,8 @@ public:
 	virtual bool getCalcMedian() = 0;
 	virtual bool getCalcDragLift() = 0;
 	virtual bool getCalcCp() = 0;
+	virtual bool getWriteVeloASCIIfiles() = 0;
+	virtual bool getCalcPlaneConc() = 0;
 	virtual bool getConcFile() = 0;
 	virtual bool getStreetVelocityFile() = 0;
 	virtual bool getUseMeasurePoints() = 0;
@@ -108,6 +110,8 @@ public:
 	virtual bool isCalcMedianInConfigFile() = 0;
 	virtual bool isCalcDragLiftInConfigFile() = 0;
 	virtual bool isCalcCpInConfigFile() = 0;
+	virtual bool isWriteVeloASCIIfilesInConfigFile() = 0;
+	virtual bool isCalcPlaneConcInConfigFile() = 0;
 	virtual bool isConcFileInConfigFile() = 0;
 	virtual bool isStreetVelocityFileInConfigFile() = 0;
 	virtual bool isUseMeasurePointsInConfigFile() = 0;
diff --git a/src/Core/Input/ConfigData/ConfigDataImp.cpp b/src/Core/Input/ConfigData/ConfigDataImp.cpp
index 2c5125106..48836eaa4 100644
--- a/src/Core/Input/ConfigData/ConfigDataImp.cpp
+++ b/src/Core/Input/ConfigData/ConfigDataImp.cpp
@@ -166,6 +166,16 @@ bool ConfigDataImp::getCalcCp()
 	return this->calcCp;
 }
 
+bool ConfigDataImp::getWriteVeloASCIIfiles()
+{
+	return this->writeVeloASCIIfiles;
+}
+
+bool ConfigDataImp::getCalcPlaneConc()
+{
+	return	this->calcPlaneConc;
+}
+
 bool ConfigDataImp::getConcFile()
 {
 	return this->concFile;
@@ -581,6 +591,18 @@ void ConfigDataImp::setCalcCp(bool calcCp)
 	this->isCalcCp = true;
 }
 
+void ConfigDataImp::setWriteVeloASCIIfiles(bool writeVeloASCIIfiles)
+{
+	this->writeVeloASCIIfiles = writeVeloASCIIfiles;
+	this->isWriteVeloASCII = true;
+}
+
+void ConfigDataImp::setCalcPlaneConc(bool calcPlaneConc)
+{
+	this->calcPlaneConc = calcPlaneConc;
+	this->isCalcPlaneConc = true;
+}
+
 void ConfigDataImp::setConcFile(bool concFile)
 {
 	this->concFile = concFile;
@@ -1012,6 +1034,16 @@ bool ConfigDataImp::isCalcCpInConfigFile()
 	return this->isCalcCp;
 }
 
+bool ConfigDataImp::isWriteVeloASCIIfilesInConfigFile()
+{
+	return this->isWriteVeloASCII;
+}
+
+bool ConfigDataImp::isCalcPlaneConcInConfigFile()
+{
+	return this->isCalcPlaneConc;
+}
+
 bool ConfigDataImp::isConcFileInConfigFile()
 {
 	return this->isConcFile;
diff --git a/src/Core/Input/ConfigData/ConfigDataImp.h b/src/Core/Input/ConfigData/ConfigDataImp.h
index f3545e61b..bcd518056 100644
--- a/src/Core/Input/ConfigData/ConfigDataImp.h
+++ b/src/Core/Input/ConfigData/ConfigDataImp.h
@@ -27,6 +27,8 @@ public:
 	bool getCalcMedian();
 	bool getCalcDragLift();
 	bool getCalcCp();
+	bool getWriteVeloASCIIfiles();
+	bool getCalcPlaneConc();
 	bool getConcFile();
 	bool getStreetVelocityFile();
 	bool getUseMeasurePoints();
@@ -111,6 +113,8 @@ public:
 	void setCalcMedian(bool calcMedian);   
 	void setCalcDragLift(bool calcDragLift);
 	void setCalcCp(bool calcCp);
+	void setWriteVeloASCIIfiles(bool writeVeloASCIIfiles);
+	void setCalcPlaneConc(bool calcPlaneConc);
 	void setConcFile(bool concFile);
 	void setStreetVelocityFile(bool streetVelocityFile);
 	void setUseMeasurePoints(bool useMeasurePoints);
@@ -196,6 +200,8 @@ public:
 	bool isCalcMedianInConfigFile();
 	bool isCalcDragLiftInConfigFile();
 	bool isCalcCpInConfigFile();
+	bool isWriteVeloASCIIfilesInConfigFile();
+	bool isCalcPlaneConcInConfigFile();
 	bool isConcFileInConfigFile();
 	bool isStreetVelocityFileInConfigFile();
 	bool isUseMeasurePointsInConfigFile();
@@ -283,6 +289,8 @@ private:
 	bool calcMedian;
 	bool calcDragLift;
 	bool calcCp;
+	bool writeVeloASCIIfiles;
+	bool calcPlaneConc;
 	bool concFile;
 	bool streetVelocityFile;
 	bool useMeasurePoints;
@@ -368,6 +376,8 @@ private:
 	bool isCalcMedian;
 	bool isCalcDragLift;
 	bool isCalcCp;
+	bool isWriteVeloASCII;
+	bool isCalcPlaneConc;
 	bool isConcFile;
 	bool isStreetVelocityFile;
 	bool isUseMeasurePoints;
diff --git a/src/VirtualFluids_GPU/LBM/Simulation.cpp b/src/VirtualFluids_GPU/LBM/Simulation.cpp
index 9f4b8a5e9..9a81ec6f3 100644
--- a/src/VirtualFluids_GPU/LBM/Simulation.cpp
+++ b/src/VirtualFluids_GPU/LBM/Simulation.cpp
@@ -590,7 +590,7 @@ void Simulation::run()
         //////////////////////////////////////////////////////////////////////////////////
         ////get concentration at the plane
         //////////////////////////////////////////////////////////////////////////////////
-        if (para->getDiffOn()==true) 
+        if (para->getDiffOn() && para->getCalcPlaneConc()) 
         {
             PlaneConcThS27( para->getParD(0)->ConcPlaneIn,
             		       para->getParD(0)->cpTopIndex,
@@ -798,7 +798,8 @@ void Simulation::run()
 
 			   //////////////////////////////////////////////////////////////////////////
                //TODO: implement flag to write ASCII data
-			   //VeloASCIIWriter::writeVelocitiesAsTXT(para.get(), lev, t);
+			   if (para->getWriteVeloASCIIfiles())
+				   VeloASCIIWriter::writeVelocitiesAsTXT(para.get(), lev, t);
 			   //////////////////////////////////////////////////////////////////////////
                if( this->kineticEnergyAnalyzer || this->enstrophyAnalyzer )
                {
diff --git a/src/VirtualFluids_GPU/Parameter/Parameter.cpp b/src/VirtualFluids_GPU/Parameter/Parameter.cpp
index c3d63e85c..daef7ff2e 100644
--- a/src/VirtualFluids_GPU/Parameter/Parameter.cpp
+++ b/src/VirtualFluids_GPU/Parameter/Parameter.cpp
@@ -106,6 +106,16 @@ Parameter::Parameter(SPtr<ConfigData> configData, Communicator* comm)
 	else
 		this->setCalcCp(false);
 	//////////////////////////////////////////////////////////////////////////
+	if (configData->isWriteVeloASCIIfilesInConfigFile())
+		this->setWriteVeloASCIIfiles(configData->getWriteVeloASCIIfiles());
+	else
+		this->setWriteVeloASCIIfiles(false);
+	//////////////////////////////////////////////////////////////////////////
+	if (configData->isCalcPlaneConcInConfigFile())
+		this->setCalcPlaneConc(configData->getCalcPlaneConc());
+	else
+		this->setCalcPlaneConc(false);
+	//////////////////////////////////////////////////////////////////////////
 	if (configData->isConcFileInConfigFile())
 		this->setConcFile(configData->getConcFile());
 	else
@@ -3470,8 +3480,16 @@ void Parameter::setCalcCp(bool calcCp)
 {
 	this->calcCp = calcCp;
 }
-void Parameter::setTimeCalcMedStart(int CalcMedStart)
+void Parameter::setWriteVeloASCIIfiles(bool writeVeloASCII)
+{
+	this->writeVeloASCII = writeVeloASCII;
+}
+void Parameter::setCalcPlaneConc(bool calcPlaneConc)
 {
+	this->calcPlaneConc = calcPlaneConc;
+}
+void Parameter::setTimeCalcMedStart(int CalcMedStart)
+{		
 	ic.tCalcMedStart = CalcMedStart;
 }
 void Parameter::setTimeCalcMedEnd(int CalcMedEnd)
@@ -4463,6 +4481,14 @@ bool Parameter::getCalcParticle()
 {
 	return this->calcParticles;
 }
+bool Parameter::getWriteVeloASCIIfiles()
+{
+	return this->writeVeloASCII;
+}
+bool Parameter::getCalcPlaneConc()
+{
+	return this->calcPlaneConc;
+}
 int Parameter::getTimeCalcMedStart()
 {
 	return ic.tCalcMedStart;
diff --git a/src/VirtualFluids_GPU/Parameter/Parameter.h b/src/VirtualFluids_GPU/Parameter/Parameter.h
index 176886832..c090d4d18 100644
--- a/src/VirtualFluids_GPU/Parameter/Parameter.h
+++ b/src/VirtualFluids_GPU/Parameter/Parameter.h
@@ -621,6 +621,8 @@ public:
 	void setCalcMedian(bool calcMedian);
 	void setCalcDragLift(bool calcDragLift);
 	void setCalcCp(bool calcCp);
+	void setWriteVeloASCIIfiles(bool writeVeloASCII);
+	void setCalcPlaneConc(bool calcPlaneConc);
 	void setTimeCalcMedStart(int CalcMedStart);
 	void setTimeCalcMedEnd(int CalcMedEnd);
 	void setMaxDev(int maxdev);
@@ -817,6 +819,8 @@ public:
 	bool getCalcDragLift();
 	bool getCalcCp();
 	bool getCalcParticle();
+	bool getWriteVeloASCIIfiles();
+	bool getCalcPlaneConc();
 	int getFine();
 	int getCoarse();
 	int getParticleBasicLevel();
@@ -1028,6 +1032,8 @@ private:
 	bool diffOn;
 	bool isF3;
 	bool calcDragLift, calcCp;
+	bool writeVeloASCII;
+	bool calcPlaneConc;
 	int diffMod;
 	int coarse, fine, maxlevel;
 	int factor_gridNZ;
-- 
GitLab