From 4c622dd932435bbf373367e57b0d4e7dd604e55f Mon Sep 17 00:00:00 2001
From: "samuel.hayden" <samuel.haydeb@fhr.frunhofer.de>
Date: Wed, 20 Mar 2024 10:18:26 +0100
Subject: [PATCH] Input file now has cell type option

---
 .../src/inputParsing/ParseInputFile.cpp           | 15 ++++++++++++++-
 .../src/inputParsing/ParseInputFile.h             |  2 ++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/LatticeDehomogenization/src/inputParsing/ParseInputFile.cpp b/LatticeDehomogenization/src/inputParsing/ParseInputFile.cpp
index 659338a..5535777 100644
--- a/LatticeDehomogenization/src/inputParsing/ParseInputFile.cpp
+++ b/LatticeDehomogenization/src/inputParsing/ParseInputFile.cpp
@@ -2,9 +2,15 @@
 
 /* Parsed Data */
 ParseInputFile::ParseInputFile(const ParseCommandLine& cmdln)
-	: _hasCells(false), _hasRadii(false), _hasCellSize(false), _hasPositions(false),
+	: _hasCells(false), _hasRadii(false), _hasCellSize(false), _hasPositions(false), _hasCellType(false),
 	_nx(0), _ny(0), _nz(0), _cx(0.0), _cy(0.0), _cz(0.0)
 {
+	if (cmdln.hasKey("celltype"))
+	{
+		_cellType = cmdln.getValue("celltype");
+		_hasCellType = true;
+	}
+
 	if (cmdln.hasKey("input"))
 		if (!parseFile(cmdln.getValue("input")))
 			return;
@@ -57,6 +63,13 @@ bool ParseInputFile::parseFile(const std::string filepath)
 			iss >> nPoints;
 			parsePositions(file, nPoints);
 		}
+		else if (argument == "CellType" && !_hasCellType)
+		{
+			iss >> _cellType;
+			for (auto& c : _cellType)
+				c = tolower(c);
+			_hasCellType = true;
+		}
 	}
 	return true;
 }
diff --git a/LatticeDehomogenization/src/inputParsing/ParseInputFile.h b/LatticeDehomogenization/src/inputParsing/ParseInputFile.h
index adb0096..9279126 100644
--- a/LatticeDehomogenization/src/inputParsing/ParseInputFile.h
+++ b/LatticeDehomogenization/src/inputParsing/ParseInputFile.h
@@ -15,8 +15,10 @@ private:
 	bool _hasRadii;		// nRadii > 0
 	bool _hasCellSize;	// Cell size given
 	bool _hasPositions;	// Cell positions defined
+	bool _hasCellType;	// Cell type defined
 
 	/* Parsed Data */
+	std::string _cellType;			// Type of unit cell
 	size_t _nx, _ny, _nz;			// nCells
 	double _cx, _cy, _cz;			// cell size
 	std::vector<double> _radii;		// Cell radii
-- 
GitLab