//============================================================================ // Name : testnas2exo.cpp // Author : Ramon J. Moral (STRA LLC), John Niederhaus (Coordinator, SNL) // Version : // Copyright : (c) Sandia National Labs 2020, 2021, 2022 // Description : Testing nas2exo Library, C++ 14 //============================================================================ #pragma once #include "N2EDataTypes.h" #include #include #include #include using namespace N2EModules; namespace NasModules { class N2ENasReader { public: N2ENasReader(std::string ifname = ""); virtual ~N2ENasReader() = default; inline unsigned getLineCount() { return this->lineCount; }; inline size_t getNumberGridPts() { return this->gridList.size(); }; inline size_t getNumberElems() { return this->elementList.size(); }; inline size_t getNumberSects() { return this->sections.size(); }; inline std::string getPath() { return this->inFileName; }; bool processFile(); std::vector getSections() { return this->sections; }; std::vector getGridPoints() { return this->gridList; }; std::vector getElementList() { return this->elementList; }; std::string getModelTitle(); void setModelTitle(const std::string &title = ""); protected: std::string inFileName{}; std::unique_ptr inStream{}; unsigned lineCount{0u}; std::vector sections{}; std::vector gridList{}; std::vector elementList{}; std::string modelTitle{}; bool doesFileExist(const std::string &fname); // Local buffer for reading faster char _readBuffer[4096]{'\0'}; private: unsigned lineCounter(); std::vector csvLineToTokens(char buff[]); }; } // namespace NasModules