Skip to content
Snippets Groups Projects
Commit 8dd4a343 authored by samuel.hayden's avatar samuel.hayden
Browse files

Now also determines the cell type. Defaults to BCC

parent 4c622dd9
No related branches found
No related tags found
No related merge requests found
#include "DetermineLatticeType.h" #include "DetermineLatticeType.h"
#include "unitcells/UnitCellTypes.h"
DetermineLatticeType::DetermineLatticeType(ParseInputFile* filedata) DetermineLatticeType::DetermineLatticeType(ParseInputFile* filedata)
: _data(filedata) : _data(filedata), _unitcell(BCC), _type(UnrecognisedLatticeType)
{ {
if (!_data->_hasCells && !_data->_hasPositions) if (!_data->_hasCells && !_data->_hasPositions)
{ {
...@@ -9,6 +10,17 @@ DetermineLatticeType::DetermineLatticeType(ParseInputFile* filedata) ...@@ -9,6 +10,17 @@ DetermineLatticeType::DetermineLatticeType(ParseInputFile* filedata)
return; return;
} }
if (_data->_hasCellType)
{
const std::string& cellstring = _data->_cellType;
if (SupportedCells::isSupportedCell(cellstring))
_unitcell = SupportedCells::getCellType(cellstring);
else
{
_errors.emplace_back(UnrecognisedUnitCell);
}
}
// Simple Lattice // Simple Lattice
if (!_data->_hasPositions) if (!_data->_hasPositions)
{ {
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
#include "ParseInputFile.h" #include "ParseInputFile.h"
#include "lattice/LatticeData.h" #include "lattice/LatticeData.h"
enum UnitCells;
/* Lattice Type Determination */ /* Lattice Type Determination */
class DetermineLatticeType class DetermineLatticeType
...@@ -12,11 +14,13 @@ private: ...@@ -12,11 +14,13 @@ private:
std::vector<ErrorCodes> _errors; std::vector<ErrorCodes> _errors;
LatticeType _type; LatticeType _type;
UnitCells _unitcell;
public: public:
DetermineLatticeType(ParseInputFile* filedata); DetermineLatticeType(ParseInputFile* filedata);
UnitCells getCellType() { return _unitcell; }
LatticeType getLatticeType() { return _type; } LatticeType getLatticeType() { return _type; }
template<class T> template<class T>
T getLatticeData() T getLatticeData()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment