-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from eric2003/hexin
Hexin
- Loading branch information
Showing
11 changed files
with
1,051 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
cmake_minimum_required(VERSION 3.29) | ||
|
||
project(ModernCFD VERSION 0.1.0) | ||
|
||
set ( PRJ_COMPILE_FEATURES ) | ||
set ( PRJ_COMPILE_DEFINITIONS ) | ||
set ( PRJ_LIBRARIES ) | ||
set ( PRJ_INCLUDE_DIRS ) | ||
|
||
set(CMAKE_AUTOUIC ON) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
|
||
find_package(Qt6 REQUIRED COMPONENTS Widgets) | ||
|
||
list ( APPEND PRJ_LIBRARIES Qt6::Widgets ) | ||
list ( APPEND PRJ_COMPILE_FEATURES cxx_std_23 ) | ||
|
||
if ( MSVC ) | ||
set_property( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME} ) | ||
endif() | ||
|
||
set( PROJECT_SOURCES | ||
main.cpp | ||
mainwindow.cpp | ||
mainwindow.h | ||
mainwindow.ui | ||
CfdThread.h CfdThread.cpp | ||
Terminal.h Terminal.cpp | ||
terminal.ui | ||
) | ||
|
||
set( PRJ_SOURCES ) | ||
foreach(source ${PROJECT_SOURCES}) | ||
list( APPEND PRJ_SOURCES "codes/${source}" ) | ||
endforeach() | ||
|
||
foreach(source ${PRJ_SOURCES}) | ||
#message( STATUS "source=${source}" ) | ||
endforeach() | ||
|
||
add_executable( ${PROJECT_NAME} | ||
) | ||
|
||
target_sources( ${PROJECT_NAME} | ||
PRIVATE | ||
${PRJ_SOURCES} | ||
) | ||
|
||
target_include_directories ( ${PROJECT_NAME} | ||
PRIVATE | ||
${PRJ_INCLUDE_DIRS} | ||
) | ||
|
||
target_link_libraries( ${PROJECT_NAME} | ||
PRIVATE | ||
${PRJ_LIBRARIES} | ||
) | ||
|
||
target_compile_features ( ${PROJECT_NAME} | ||
PRIVATE | ||
${PRJ_COMPILE_FEATURES} | ||
) | ||
|
||
target_compile_definitions ( ${PROJECT_NAME} | ||
PRIVATE | ||
${PRJ_COMPILE_DEFINITIONS} | ||
) | ||
|
||
include(GNUInstallDirs) | ||
install(TARGETS ${PROJECT_NAME} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include "CfdThread.h" | ||
#include <QTime> | ||
#include <thread> | ||
#include <iostream> | ||
|
||
CfdThread::CfdThread() | ||
{ | ||
this->paused = false; | ||
this->stop = false; | ||
} | ||
|
||
void CfdThread::beginCFD() | ||
{ | ||
this->paused = false; | ||
|
||
} | ||
|
||
void CfdThread::pauseCFD() | ||
{ | ||
this->paused = true; | ||
} | ||
|
||
void CfdThread::stopCFD() | ||
{ | ||
this->stop = true; | ||
} | ||
|
||
void CfdThread::run() | ||
{ | ||
download( "CfdThread::run()" ); | ||
} | ||
|
||
void CfdThread::download(const std::string &file) | ||
{ | ||
for ( int i = 0; i < 10; ++ i ) | ||
{ | ||
if ( this->stop ) break; | ||
std::cout << "Downloading " << file | ||
<< " (" << i * 10 << "%)..." << std::endl; | ||
std::this_thread::sleep_for(std::chrono::milliseconds(1000)); | ||
} | ||
std::cout << "Download complete: " << file << std::endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include <QObject> | ||
#include <QThread> | ||
|
||
class CfdThread : public QThread | ||
{ | ||
Q_OBJECT | ||
public: | ||
CfdThread(); | ||
public: | ||
void beginCFD(); | ||
void pauseCFD(); | ||
void stopCFD(); | ||
private: | ||
void download( const std::string & file ); | ||
signals: | ||
void newValue(int seq, int diceValue); | ||
protected: | ||
void run() override; | ||
private: | ||
bool stop = false; | ||
bool paused = false; | ||
}; |
Oops, something went wrong.