Compare commits
3 Commits
8c9a1522a0
...
9b1872139d
Author | SHA1 | Date | |
---|---|---|---|
9b1872139d | |||
66a54d85cc | |||
f080d00697 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,3 +3,5 @@
|
||||
bin/
|
||||
compile_commands.json
|
||||
build-*/
|
||||
latex.out/
|
||||
docs/folien/folien.pdf
|
||||
|
@ -22,6 +22,13 @@
|
||||
qt6.full
|
||||
libGL
|
||||
|
||||
# presentation
|
||||
pandoc
|
||||
texlive.combined.scheme-full
|
||||
noto-fonts
|
||||
latexrun
|
||||
entr
|
||||
|
||||
# pre-commit
|
||||
pre-commit
|
||||
commitizen
|
||||
|
@ -23,6 +23,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
setupAlgorithmSelector();
|
||||
setupWordListSourceSelector();
|
||||
setupWordList();
|
||||
createSelectedFinder();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() { delete ui; }
|
||||
@ -79,8 +80,7 @@ void MainWindow::loadWordList(std::filesystem::path path) {
|
||||
|
||||
void MainWindow::search(const QString &search_term) {
|
||||
if (search_term.isEmpty()) {
|
||||
result_model_.setStringList(QStringList());
|
||||
ui->mainStatusBar->clearMessage();
|
||||
clearResults();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -99,6 +99,7 @@ void MainWindow::search(const QString &search_term) {
|
||||
void MainWindow::createSelectedFinder() {
|
||||
auto selectedFinder = ui->searchAlgorithmSelector->currentIndex();
|
||||
|
||||
Timer timer;
|
||||
switch (selectedFinder) {
|
||||
case 0:
|
||||
default:
|
||||
@ -120,6 +121,12 @@ void MainWindow::createSelectedFinder() {
|
||||
finder_ = std::make_unique<GroupedFinder>(word_list_);
|
||||
break;
|
||||
}
|
||||
timer.stop();
|
||||
|
||||
std::stringstream status_message;
|
||||
status_message << "finder initialized in " << timer << ", "
|
||||
<< word_list_.size() << " words loaded";
|
||||
ui->mainStatusBar->showMessage(QString::fromStdString(status_message.str()));
|
||||
}
|
||||
|
||||
void MainWindow::showResults(const WordRefList &results) {
|
||||
@ -131,32 +138,37 @@ void MainWindow::showResults(const WordRefList &results) {
|
||||
result_model_.setStringList(ui_results);
|
||||
}
|
||||
|
||||
void MainWindow::clearResults() { result_model_.setStringList({}); }
|
||||
|
||||
void MainWindow::on_searchInput_textChanged(const QString &search_term) {
|
||||
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
search(search_term);
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
// QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
// search(search_term);
|
||||
// QGuiApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void MainWindow::on_searchAlgorithmSelector_currentIndexChanged(int) {
|
||||
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
clearResults();
|
||||
createSelectedFinder();
|
||||
search(ui->searchInput->displayText());
|
||||
// search(ui->searchInput->displayText());
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void MainWindow::on_wordListSourceSelector_currentIndexChanged(int) {
|
||||
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
clearResults();
|
||||
setupWordList();
|
||||
createSelectedFinder();
|
||||
search(ui->searchInput->displayText());
|
||||
// search(ui->searchInput->displayText());
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void MainWindow::on_wordListSizeSelector_valueChanged(int) {
|
||||
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
clearResults();
|
||||
setupWordList();
|
||||
createSelectedFinder();
|
||||
search(ui->searchInput->displayText());
|
||||
// search(ui->searchInput->displayText());
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ private:
|
||||
void search(const QString &search_term);
|
||||
void createSelectedFinder();
|
||||
void showResults(const WordRefList &results);
|
||||
void clearResults();
|
||||
|
||||
private slots:
|
||||
void on_searchInput_textChanged(const QString &search_term);
|
||||
|
34
docs/folien/analyse.tex
Normal file
34
docs/folien/analyse.tex
Normal file
@ -0,0 +1,34 @@
|
||||
\begin{frame}{Analyse}
|
||||
|
||||
{\Large Anforderungen}
|
||||
\vspace{0.5cm}
|
||||
|
||||
\begin{itemize}
|
||||
\item Datenstruktur für Wortliste
|
||||
\item Paralleler Such-Algorithmus
|
||||
\item Abgeleitet: Optimierung der Such-Zeit
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}{Analyse}
|
||||
|
||||
{\Large Abgeleitete Aufgabenstellung}
|
||||
\vspace{0.5cm}
|
||||
|
||||
\begin{minipage}{0.7\textwidth}
|
||||
Aufteilung in zwei Blöcke:
|
||||
\begin{block}{Anwendungs-Schicht (Layer 5 - 7)}
|
||||
\begin{itemize}
|
||||
\item Request/Reponse
|
||||
\item Konkurrierender Zugriff
|
||||
\item Session Handling
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
\begin{block}{Transport-Schicht (Layer 1 - 4)}
|
||||
\begin{itemize}
|
||||
\item Datenübertragung zwischen SG
|
||||
\item Gleichzeitige Kommunikation
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
\end{minipage}
|
||||
\end{frame}
|
14
docs/folien/aufgabe.tex
Normal file
14
docs/folien/aufgabe.tex
Normal file
@ -0,0 +1,14 @@
|
||||
\begin{frame}{Aufgabe}
|
||||
|
||||
{\Large Entwicklung einer parallelen Suche in einer Liste mit Wörtern}
|
||||
\vspace{0.5cm}
|
||||
|
||||
Es ist eine Datenstruktur in Form einer Liste (Vektor) mit unterschiedlichen Wörtern
|
||||
gegeben. Ein Suchalgorithmus soll eine Liste mit Wörtern aus dieser Wortliste ermitteln,
|
||||
deren erste Zeichen mit einem Suchstring übereinstimmen.
|
||||
|
||||
Der Algorithmus soll moderne Multi-Core-Prozessoren ausnutzen, die Suche also auf
|
||||
möglichst viele Cores verteilen.
|
||||
\end{frame}
|
||||
|
||||
|
5
docs/folien/danke.tex
Normal file
5
docs/folien/danke.tex
Normal file
@ -0,0 +1,5 @@
|
||||
\begin{frame}
|
||||
\begin{center}
|
||||
\huge Vielen Dank
|
||||
\end{center}
|
||||
\end{frame}
|
51
docs/folien/folien.tex
Normal file
51
docs/folien/folien.tex
Normal file
@ -0,0 +1,51 @@
|
||||
\documentclass[aspectratio=169]{beamer}
|
||||
\title{Fallstudie Wortliste}
|
||||
\author{Michael Mandl}
|
||||
\date[v0.1 | 25.03.2024]{25.03.2024}
|
||||
|
||||
\usepackage[sfdefault]{noto}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{tikz}
|
||||
\usepackage{fontawesome}
|
||||
|
||||
\definecolor{vector_red}{RGB}{183, 0, 50}
|
||||
\definecolor{vector_grey}{RGB}{234, 236, 237}
|
||||
|
||||
\usetheme{Boadilla}
|
||||
|
||||
\setbeamercolor*{palette primary}{fg=white,bg=vector_red}
|
||||
\setbeamercolor*{palette secondary}{fg=black,bg=vector_grey}
|
||||
\setbeamercolor*{palette tertiary}{fg=black,bg=vector_grey}
|
||||
\setbeamercolor*{palette quaternary}{fg=black,bg=vector_grey}
|
||||
|
||||
\setbeamercolor{titlelike}{fg=white, bg=vector_red}
|
||||
\setbeamercolor{frametitle}{bg=vector_red,fg=white}
|
||||
|
||||
\setbeamertemplate{itemize item}[triangle]
|
||||
\setbeamertemplate{itemize subitem}[circle]
|
||||
\setbeamercolor{itemize item}{fg=vector_red}
|
||||
\setbeamercolor{itemize subitem}{fg=vector_red}
|
||||
\setbeamercolor{itemize subsubitem}{fg=vector_red}
|
||||
|
||||
\setbeamercolor{description item}{fg=vector_red}
|
||||
|
||||
\setbeamercolor{block title}{fg=white, bg=vector_red}
|
||||
\setbeamercolor{block body}{fg=black, bg=vector_grey}
|
||||
|
||||
\setbeamertemplate{navigation symbols}{}
|
||||
|
||||
\setbeamersize
|
||||
{
|
||||
text margin left=2cm,
|
||||
text margin right=2cm
|
||||
}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\frame[plain]{\titlepage}
|
||||
|
||||
\include{aufgabe}
|
||||
\include{analyse}
|
||||
\include{danke}
|
||||
|
||||
\end{document}
|
BIN
docs/folien/insert_1.png
Normal file
BIN
docs/folien/insert_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
BIN
docs/folien/insert_2.png
Normal file
BIN
docs/folien/insert_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
BIN
docs/folien/insert_3.png
Normal file
BIN
docs/folien/insert_3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
BIN
docs/folien/insert_4.png
Normal file
BIN
docs/folien/insert_4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 112 KiB |
3
docs/folien/watch_and_build.sh
Executable file
3
docs/folien/watch_and_build.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
find . -name "*.tex" -o -name "*.png" | entr latexrun folien.tex
|
2270
docs/input.svg
Normal file
2270
docs/input.svg
Normal file
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 97 KiB |
@ -7,7 +7,7 @@
|
||||
|
||||
class Bucket {
|
||||
private:
|
||||
std::map<const char, WordRefList> groups_;
|
||||
std::map<char, WordRefList> directory_;
|
||||
|
||||
public:
|
||||
void insert(const WordList &word_list, size_t first_index, size_t last_index);
|
||||
|
@ -6,20 +6,20 @@
|
||||
|
||||
void Bucket::insert(const WordList &word_list, size_t first_index,
|
||||
size_t last_index) {
|
||||
for (size_t index = first_index; index < last_index; ++index) {
|
||||
for (auto index = first_index; index < last_index; ++index) {
|
||||
const auto ¤t_word = word_list[index];
|
||||
groups_[current_word.front()].push_back(¤t_word);
|
||||
directory_[current_word.front()].push_back(¤t_word);
|
||||
}
|
||||
}
|
||||
|
||||
WordRefList Bucket::find_prefix(std::string_view search_term) const {
|
||||
auto group_it = groups_.find(search_term.front());
|
||||
if (group_it == groups_.cend()) {
|
||||
auto directory_it = directory_.find(search_term.front());
|
||||
if (directory_it == directory_.cend()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
WordRefList result;
|
||||
for (const auto *word : group_it->second) {
|
||||
for (const auto *word : directory_it->second) {
|
||||
if (word->starts_with(search_term)) {
|
||||
result.push_back(word);
|
||||
}
|
||||
|
Reference in New Issue
Block a user