Microflow 3D  v1.0
ConfigData.cpp
Go to the documentation of this file.
1 // ==============================================================================================
2 // Microflow 3D, http://www.microflow.pwr.edu.pl/
3 // Created by Roman Szafran on 14.04.19.
4 // Copyright (c) 2019 Wroclaw University of Science and Technology.
5 // Distributed under the Apache License, Version 2.0. You may obtain a copy of the License at
6 // http://www.apache.org/licenses/LICENSE-2.0 or see accompanying file license.txt.
7 // Redistributions of source code must retain the above copyright and license notice.
8 // ==============================================================================================
9 
10 #include "ConfigData.h"
11 
13 
14  //Parser object delete
15  m_pProgramParams->destroy();
16  m_pCaseParams->destroy();
17  m_pThreadParams->destroy();
18 
19 }
20 
21 MF::Database::ConfigData::ConfigData(const char* pPathToProgramConfigFile, const char* pPathToCaseFolder, const char* pScope, const bool verbose) {
22 
23  const char* pPathToCaseFile;
24  const char* pPathToThreadFile;
25 
26  m_pScope = pScope;
27  ProgramConfigFile = pPathToProgramConfigFile;
28 
29  // MF Config file parsing
30  //-------------------------------------------------------------------------------------------------------------------------------------------------------------
31  m_pTextParser_Ptr = std::make_shared<MF::Parser::TextParser>(); //Parser object
32 
33  // Config file
34  m_pProgramParams = m_pTextParser_Ptr->ProgramConfigFileParse(pPathToProgramConfigFile, m_pScope, verbose); //Parsing of Microflow.cfg file
35 
36  if (strcmp(pPathToCaseFolder, "") == 0)
37  CaseFolder = m_pProgramParams->lookupString(m_pScope, "CaseFolder");
38  else
39  CaseFolder = pPathToCaseFolder;
40 
41  GeometryFile = (CaseFolder + m_pProgramParams->lookupString(m_pScope, "GeometryFolder") + m_pProgramParams->lookupString(m_pScope, "GeometryFileName"));
42 
43  // Case file
44  CaseFile = (CaseFolder + m_pProgramParams->lookupString(m_pScope, "CaseParametersFile")); //Path to case config file
45  pPathToCaseFile = CaseFile.c_str();
46  m_pCaseParams = m_pTextParser_Ptr->CaseConfigFileParse(pPathToCaseFile, m_pScope, verbose); //Parsing of case config file
47 
48  // Thread file
49  ThreadFile = (CaseFolder + m_pProgramParams->lookupString(m_pScope, "ThreadParametersFile")); //Path to thread config file
50  pPathToThreadFile = ThreadFile.c_str();
51  m_pThreadParams = m_pTextParser_Ptr->ThreadConfigFileParse(pPathToThreadFile, m_pScope, verbose); //Parsing of thread config file
52 
53  //-------------------------------------------------------------------------------------------------------------------------------------------------------------
54 }
std::string GeometryFile
Full path to geometry file (relative to program folder).
Definition: ConfigData.h:112
std::string CaseFile
Full path to case config file (relative to program folder).
Definition: ConfigData.h:110
ConfigData(const char *pPathToProgramConfigFile, const char *pPathToCaseFolder, const char *pScope, bool verbose)
Definition: ConfigData.cpp:21
std::string ThreadFile
Full path to thread file (relative to program folder).
Definition: ConfigData.h:111
std::string CaseFolder
Path to case folder (relative to program folder).
Definition: ConfigData.h:108
std::string ProgramConfigFile
Full path to program config file (relative to program folder).
Definition: ConfigData.h:109